preconditioner_should_call_post_pre.hpp
Go to the documentation of this file.
1/*
2 Copyright 2022-2023 SINTEF AS
3
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef OPM_CUISTL_PRECONDIDTIONER_SHOULD_CALL_POST_PRE_HPP
21#define OPM_CUISTL_PRECONDIDTIONER_SHOULD_CALL_POST_PRE_HPP
22
24
25namespace Opm::cuistl::detail
26{
27
32template <class PreconditionerType>
33constexpr bool
35{
37 return PreconditionerType::shouldCallPre();
38 } else {
39 // If the preconditioner type does not have a way of signalling the need
40 // to call pre(), we should always call it. This is because it could be an
41 // old design.
42 return true;
43 }
44}
45
50template <class PreconditionerType>
51constexpr bool
53{
55 return PreconditionerType::shouldCallPost();
56 } else {
57 // If the preconditioner type does not have a way of signalling the need
58 // to call post(), we should always call it. This is because it could be an
59 // old design.
60 return true;
61 }
62}
63} // namespace Opm::cuistl::detail
64#endif
The has_should_call_post class detects the presence of the method shouldCallPost.
Definition: has_function.hpp:77
The has_should_call_pre class detects the presence of the method shouldCallPre.
Definition: has_function.hpp:51
Definition: cublas_safe_call.hpp:32
constexpr bool shouldCallPreconditionerPost()
Tests (compile time) if the preconditioner type needs to call post() after a call to apply(....
Definition: preconditioner_should_call_post_pre.hpp:52
constexpr bool shouldCallPreconditionerPre()
Tests (compile time) if the preconditioner type needs to call pre() before a call to apply()
Definition: preconditioner_should_call_post_pre.hpp:34