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 "Utilities/ProtocolHelpers.hpp"
9 :
10 : namespace amr::protocols {
11 :
12 : /// \brief A DataBox mutator used in AMR actions
13 : ///
14 : /// A class conforming to this protocol can be used as a projector in the list
15 : /// of `projectors` for a class conforming to amr::protocols::AmrMetavariables.
16 : /// The conforming class will be used when adaptive mesh refinement occurs to
17 : /// either initialize items on a newly created element of a DgElementArray, or
18 : /// update items on an existing element.
19 : ///
20 : /// The conforming class must provide the following:
21 : /// - `return_tags`: A type list of tags corresponding to mutable items in the
22 : /// DataBox that may be modified during refinement.
23 : /// - `argument_tags`: A type list of tags corresponding to items in the DataBox
24 : /// that are not changed, but used to initialize/update the items
25 : /// corresponding to the `return_tags`.
26 : /// - `apply`: static functions whose return value are void, and that take as
27 : /// arguments:
28 : /// - A `const gsl::not_null<Tag::type*>` for each `Tag` in `return_tags`
29 : /// - A `const db::const_item_type<Tag, BoxTags>` for each `Tag` in
30 : /// `argument_tags`
31 : /// - and one additional argument which is either:
32 : /// - `const std::pair<Mesh<Dim>, Element<Dim>>&` (used by
33 : /// amr::Actions::AdjustDomain)
34 : /// - `const tuples::TaggedTuple<Tags...>&` (used by
35 : /// amr::Actions::InitializeChild)
36 : /// - `const std::unordered_map<ElementId<Dim>,
37 : /// tuples::TaggedTuple<Tags...>>&`
38 : /// (used by amr::Actions::InitializeParent)
39 : ///
40 : /// The Mesh and Element passed to amr::Actions::AdjustDomain are their
41 : /// values before the grid changes. The tuples passed to
42 : /// amr::Actions::InitializeChild and amr::Actions::InitializeParent hold the
43 : /// items corresponding to the `DataBox<BoxTags>::mutable_item_creation_tags`
44 : /// of the parent (children) of the child (parent) being initialized.
45 : ///
46 : /// \note In amr::Actions::AdjustDomain the projectors are called on
47 : /// all elements that were not h-refined (i.e. split or joined) even
48 : /// if their Mesh did not change. This allows a projector to mutate a
49 : /// mutable item that depends upon information about the neighboring
50 : /// elements. Therefore a particular projector may want to check
51 : /// whether or not the Mesh changed before projecting any data.
52 : ///
53 : /// For examples, see Initialization::ProjectTimeStepping and
54 : /// evolution::dg::Initialization::ProjectDomain
55 1 : struct Projector {
56 : template <typename ConformingType>
57 0 : struct test {
58 0 : using argument_tags = typename ConformingType::argument_tags;
59 0 : using return_tags = typename ConformingType::return_tags;
60 : };
61 : };
62 : } // namespace amr::protocols
|