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 : #include "DataStructures/DataBox/TagTraits.hpp"
9 :
10 : namespace Parallel {
11 : namespace initialization_tag_detail {
12 : // This check should be implementable without all these structs by
13 : // using SFINAE directly in the concept, but that causes clang 13 to
14 : // segfault.
15 : template <template <typename> typename>
16 : struct templated_check;
17 :
18 : template <typename Tag, typename = std::void_t<>>
19 : struct has_templated_option_tags : std::false_type {};
20 :
21 : template <typename Tag>
22 : struct has_templated_option_tags<
23 : Tag, std::void_t<templated_check<Tag::template option_tags>>>
24 : : std::true_type {};
25 : } // namespace initialization_tag_detail
26 :
27 : /*!
28 : * \ingroup ParallelGroup
29 : * Concept for an initialization tag with `pass_metavariables` true.
30 : */
31 : template <typename Tag>
32 : concept templated_initialization_tag =
33 : db::simple_tag<Tag> and Tag::pass_metavariables and
34 : initialization_tag_detail::has_templated_option_tags<Tag>::value;
35 :
36 : /*!
37 : * \ingroup ParallelGroup
38 : * Concept for an initialization tag with `pass_metavariables` false.
39 : */
40 : template <typename Tag>
41 : concept untemplated_initialization_tag =
42 : db::simple_tag<Tag> and not Tag::pass_metavariables and
43 : requires { typename Tag::option_tags; };
44 :
45 : /*!
46 : * \ingroup ParallelGroup
47 : * Concept for an initialization tag.
48 : */
49 : template <typename Tag>
50 : concept initialization_tag =
51 : templated_initialization_tag<Tag> or untemplated_initialization_tag<Tag>;
52 : } // namespace Parallel
|