Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include "Utilities/ProtocolHelpers.hpp"
7 : #include "Utilities/Protocols/StaticReturnApplyable.hpp"
8 : #include "Utilities/TMPL.hpp"
9 : #include "Utilities/TypeTraits/IsA.hpp"
10 :
11 : /// \cond
12 : namespace Tags {
13 : template <typename Tag>
14 : struct Source;
15 : } // namespace Tags
16 : /// \endcond
17 :
18 : namespace imex::protocols {
19 : /// Protocol for implicit source terms.
20 : ///
21 : /// A struct conforming to this protocol must also conform to
22 : /// ::protocols::StaticReturnApplyable. The `return_tags` of this
23 : /// struct must be a list of `::Tags::Source<T>` for every tensor `T`
24 : /// in the implicit sector.
25 : ///
26 : /// The `argument_tags` must not include compute items depending on
27 : /// tensors in the implicit sector.
28 : ///
29 : /// \snippet Test_SolveImplicitSector.cpp source
30 1 : struct ImplicitSource {
31 : template <typename ConformingType>
32 0 : struct test {
33 : static_assert(tt::assert_conforms_to_v<ConformingType,
34 : ::protocols::StaticReturnApplyable>);
35 :
36 0 : using return_tags = typename ConformingType::return_tags;
37 : static_assert(
38 : tmpl::all<return_tags, tt::is_a<::Tags::Source, tmpl::_1>>::value,
39 : "All return tags must be ::Tags::Source<...>");
40 : };
41 : };
42 : } // namespace imex::protocols
|