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