Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <type_traits>
7 :
8 : namespace evolution::dg {
9 : /*!
10 : * \brief If `Metavars` has a `SubcellOptions` member struct and
11 : * `SubcellOptions::subcell_enabled` is `true` then inherits from
12 : * `std::true_type`, otherwise inherits from `std::false_type`.
13 : *
14 : * \note This check is intentionally not inside the `DgSubcell` library so that
15 : * executables that do not use subcell do not need to link against it.
16 : */
17 : template <typename Metavars, typename = std::void_t<>>
18 1 : struct using_subcell : std::false_type {};
19 :
20 : /// \cond
21 : template <typename Metavars>
22 : struct using_subcell<Metavars, std::void_t<typename Metavars::SubcellOptions>>
23 : : std::bool_constant<Metavars::SubcellOptions::subcell_enabled> {};
24 : /// \endcond
25 :
26 : /*!
27 : * \brief If `Metavars` has a `SubcellOptions` member struct and
28 : * `SubcellOptions::subcell_enabled` is `true` then is `true`, otherwise
29 : * `false`.
30 : *
31 : * \note This check is intentionally not inside the `DgSubcell` library so that
32 : * executables that do not use subcell do not need to link against it.
33 : */
34 : template <typename Metavars>
35 1 : constexpr bool using_subcell_v = using_subcell<Metavars>::value;
36 : } // namespace evolution::dg
|