Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <array>
7 : #include <cstddef>
8 :
9 : #include "Domain/Amr/Flag.hpp"
10 : #include "Domain/Amr/Info.hpp"
11 : #include "Domain/Amr/Tags/Flags.hpp"
12 : #include "Domain/Amr/Tags/NeighborFlags.hpp"
13 : #include "IO/Observer/Tags.hpp"
14 : #include "Parallel/Tags/Section.hpp"
15 : #include "ParallelAlgorithms/Amr/Protocols/AmrMetavariables.hpp"
16 : #include "ParallelAlgorithms/Amr/Tags.hpp"
17 : #include "Utilities/Gsl.hpp"
18 : #include "Utilities/MakeArray.hpp"
19 : #include "Utilities/ProtocolHelpers.hpp"
20 : #include "Utilities/TMPL.hpp"
21 :
22 : namespace amr::Initialization {
23 : /// \ingroup InitializationGroup
24 : /// \brief Initialize items related to adaptive mesh refinement
25 : ///
26 : /// \see InitializeItems
27 : template <size_t Dim, typename Metavariables>
28 1 : struct Initialize {
29 : static_assert(tt::assert_conforms_to_v<typename Metavariables::amr,
30 : amr::protocols::AmrMetavariables>);
31 0 : using ElementArray = typename Metavariables::amr::element_array;
32 :
33 0 : using const_global_cache_tags = tmpl::list<>;
34 0 : using mutable_global_cache_tags = tmpl::list<>;
35 0 : using simple_tags_from_options = tmpl::list<>;
36 :
37 0 : using argument_tags = tmpl::list<>;
38 0 : using return_tags = tmpl::list<amr::Tags::Info<Dim>>;
39 0 : using simple_tags = tmpl::append<
40 : return_tags, tmpl::list<amr::Tags::NeighborInfo<Dim>>,
41 : tmpl::conditional_t<
42 : Metavariables::amr::keep_coarse_grids,
43 : tmpl::list<
44 : amr::Tags::ParentId<Dim>, amr::Tags::ChildIds<Dim>,
45 : amr::Tags::ParentMesh<Dim>,
46 : Parallel::Tags::Section<ElementArray, amr::Tags::GridIndex>,
47 : Parallel::Tags::Section<ElementArray, amr::Tags::IsFinestGrid>>,
48 : tmpl::list<>>>;
49 :
50 0 : using compute_tags = tmpl::conditional_t<
51 : Metavariables::amr::keep_coarse_grids,
52 : tmpl::list<amr::Tags::GridIndexObservationKeyCompute<Dim>,
53 : amr::Tags::IsFinestGridObservationKeyCompute<Dim>>,
54 : tmpl::list<>>;
55 :
56 : /// Given the items fetched from a DataBox by the argument_tags, mutate
57 : /// the items in the DataBox corresponding to return_tags
58 1 : static void apply(const gsl::not_null<amr::Info<Dim>*> amr_info) {
59 : amr_info->flags = make_array<Dim>(amr::Flag::Undefined);
60 : }
61 : };
62 : } // namespace amr::Initialization
|