opm-simulators
preconditioner_should_call_post_pre.hpp
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 
23 #include <opm/simulators/linalg/gpuistl/detail/has_function.hpp>
24 
25 namespace Opm::gpuistl::detail
26 {
27 
32 template <class PreconditionerType>
33 constexpr 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 
50 template <class PreconditionerType>
51 constexpr 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::gpuistl::detail
64 #endif
The has_should_call_post class detects the presence of the method shouldCallPost. ...
Definition: has_function.hpp:76
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
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
The has_should_call_pre class detects the presence of the method shouldCallPre.
Definition: has_function.hpp:50
Contains wrappers to make the CuBLAS library behave as a modern C++ library with function overlading...
Definition: autotuner.hpp:29