opm-simulators
has_function.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 #ifndef OPM_CUISTL_DETAIL_HAS_FUNCTION_HPP
20 #define OPM_CUISTL_DETAIL_HAS_FUNCTION_HPP
21 #include <type_traits>
32 namespace Opm::gpuistl::detail
33 {
34 
49 template <typename T>
51 {
52  template <typename U>
53  static std::true_type test(decltype(&U::shouldCallPre));
54  template <typename U>
55  static std::false_type test(...);
56 
57 public:
58  static constexpr bool value = std::is_same_v<decltype(test<T>(0)), std::true_type>;
59 };
60 
75 template <typename T>
77 {
78  template <typename U>
79  static std::true_type test(decltype(&U::shouldCallPost));
80  template <typename U>
81  static std::false_type test(...);
82 
83 public:
84  static constexpr bool value = std::is_same_v<decltype(test<T>(0)), std::true_type>;
85 };
86 
87 
94 template <typename T>
96 {
97  template <typename U>
98  static std::true_type test(decltype(&U::getCommunication));
99  template <typename U>
100  static std::false_type test(...);
101 
102 public:
103  static constexpr bool value = std::is_same_v<decltype(test<T>(0)), std::true_type>;
104 };
105 
112 template <typename T>
114 {
115  template <typename U>
116  static std::true_type test(decltype(&U::addWellPressureEquations));
117  template <typename U>
118  static std::false_type test(...);
119 
120 public:
121  static constexpr bool value = std::is_same_v<decltype(test<T>(0)), std::true_type>;
122 };
123 
124 } // namespace Opm::gpuistl::detail
125 #endif
The has_should_call_post class detects the presence of the method shouldCallPost. ...
Definition: has_function.hpp:76
The is_a_well_operator class tries to guess if the operator is a well type operator.
Definition: has_function.hpp:113
The has_should_call_pre class detects the presence of the method shouldCallPre.
Definition: has_function.hpp:50
The has_communication class checks if the type has the member function getCommunication.
Definition: has_function.hpp:95
Contains wrappers to make the CuBLAS library behave as a modern C++ library with function overlading...
Definition: autotuner.hpp:29