has_function.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#ifndef OPM_CUISTL_DETAIL_HAS_FUNCTION_HPP
20#define OPM_CUISTL_DETAIL_HAS_FUNCTION_HPP
21#include <type_traits>
32namespace Opm::cuistl::detail
33{
34
49template <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
57public:
58 static constexpr bool value = std::is_same_v<decltype(test<T>(0)), std::true_type>;
59};
60
75template <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
83public:
84 static constexpr bool value = std::is_same_v<decltype(test<T>(0)), std::true_type>;
85};
86
87
94template <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
102public:
103 static constexpr bool value = std::is_same_v<decltype(test<T>(0)), std::true_type>;
104};
105
112template <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
120public:
121 static constexpr bool value = std::is_same_v<decltype(test<T>(0)), std::true_type>;
122};
123
124} // namespace Opm::cuistl::detail
125#endif
The has_communication class checks if the type has the member function getCommunication.
Definition: has_function.hpp:96
static constexpr bool value
Definition: has_function.hpp:103
The has_should_call_post class detects the presence of the method shouldCallPost.
Definition: has_function.hpp:77
static constexpr bool value
Definition: has_function.hpp:84
The has_should_call_pre class detects the presence of the method shouldCallPre.
Definition: has_function.hpp:51
static constexpr bool value
Definition: has_function.hpp:58
The is_a_well_operator class tries to guess if the operator is a well type operator.
Definition: has_function.hpp:114
static constexpr bool value
Definition: has_function.hpp:121
Definition: cublas_safe_call.hpp:32