Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <optional>
7 :
8 : #include "DataStructures/LinkedMessageId.hpp"
9 : #include "IO/Logging/Verbosity.hpp"
10 : #include "Parallel/GlobalCache.hpp"
11 : #include "Parallel/ParallelComponentHelpers.hpp"
12 : #include "ParallelAlgorithms/ApparentHorizonFinder/FastFlow.hpp"
13 : #include "ParallelAlgorithms/ApparentHorizonFinder/OptionTags.hpp"
14 : #include "ParallelAlgorithms/ApparentHorizonFinder/Tags.hpp"
15 : #include "Utilities/Gsl.hpp"
16 : #include "Utilities/TMPL.hpp"
17 :
18 : namespace ah {
19 : /*!
20 : * \brief Initialize items related to the horizon finder
21 : *
22 : * GlobalCache:
23 : * - Uses:
24 : * - `ah::Tags::ApparentHorizonOptions`
25 : * - `ah::Tags::BlocksForHorizonFind`
26 : * - `ah::Tags::LMax`
27 : *
28 : * DataBox:
29 : * - Uses: Nothing
30 : * - Adds:
31 : * - `ah::Tags::Verbosity`
32 : * - `ah::Tags::FastFlow`
33 : * - `ah::Tags::CurrentTime`
34 : * - `ah::Tags::PendingTimes`
35 : * - `ah::Tags::CompletedTimes`
36 : * - `ah::Tags::Storage`
37 : * - `ah::Tags::PreviousSurfaces`
38 : * - `ah::Tags::Strahlkorper`
39 : * - `ah::Tags::TimeDerivStrahlkorper`
40 : * - `ah::Tags::Dependency`
41 : * - `::Tags::Variables<ah::vars_to_interpolate_to_target>`
42 : * - `ah::Tags::CurrentResolutionL`
43 : * - Modifies:
44 : * - `ah::Tags::Verbosity`
45 : * - `ah::Tags::FastFlow`
46 : * - `ah::Tags::CurrentTime`
47 : */
48 : template <typename HorizonMetavars>
49 1 : struct Initialize {
50 0 : using Fr = typename HorizonMetavars::frame;
51 :
52 0 : using simple_tags_from_options = tmpl::list<>;
53 :
54 0 : using simple_tags = tmpl::append<
55 : tmpl::list<Tags::CurrentResolutionL, Tags::Verbosity, Tags::FastFlow,
56 : Tags::CurrentTime, Tags::PendingTimes, Tags::CompletedTimes,
57 : Tags::Storage<Fr>, Tags::BlockSearchOrder,
58 : Tags::PreviousSurfaces<Fr>, ylm::Tags::Strahlkorper<Fr>,
59 : ylm::Tags::TimeDerivStrahlkorper<Fr>, ah::Tags::Dependency,
60 : ::Tags::Variables<ah::vars_to_interpolate_to_target<3, Fr>>>,
61 : tmpl::conditional_t<
62 : std::is_same_v<Fr, Frame::Inertial>, tmpl::list<>,
63 : tmpl::list<ylm::Tags::CartesianCoords<Frame::Inertial>>>>;
64 :
65 0 : using const_global_cache_tags =
66 : tmpl::remove_duplicates<tmpl::flatten<tmpl::append<
67 : tmpl::list<Tags::ApparentHorizonOptions<HorizonMetavars>,
68 : Tags::BlocksForHorizonFind, Tags::LMax>,
69 : Parallel::get_const_global_cache_tags_from_actions<tmpl::flatten<
70 : tmpl::list<typename HorizonMetavars::horizon_find_callbacks,
71 : typename HorizonMetavars::
72 : horizon_find_failure_callbacks>>>>>>;
73 :
74 0 : using mutable_global_cache_tags =
75 : tmpl::list<Tags::PreviousSurface<HorizonMetavars>>;
76 :
77 0 : using compute_tags = ah::compute_items_on_target<3, Fr>;
78 :
79 0 : using return_tags = tmpl::list<Tags::CurrentResolutionL, Tags::Verbosity,
80 : Tags::FastFlow, Tags::CurrentTime>;
81 :
82 0 : using argument_tags =
83 : tmpl::list<Tags::ApparentHorizonOptions<HorizonMetavars>>;
84 :
85 0 : static void apply(
86 : const gsl::not_null<std::optional<size_t>*> current_resolution_l,
87 : const gsl::not_null<::Verbosity*> verbosity,
88 : const gsl::not_null<::FastFlow*> fast_flow,
89 : const gsl::not_null<std::optional<LinkedMessageId<double>>*> current_time,
90 : const HorizonOptions<Fr>& options) {
91 : (*verbosity) = options.verbosity;
92 : (*fast_flow) = options.fast_flow;
93 : current_time->reset();
94 : current_resolution_l->reset();
95 : }
96 : };
97 : } // namespace ah
|