Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <string>
7 : #include <tuple>
8 :
9 : #include "Parallel/Algorithms/AlgorithmSingleton.hpp"
10 : #include "Parallel/GlobalCache.hpp"
11 : #include "Parallel/Local.hpp"
12 : #include "Parallel/ParallelComponentHelpers.hpp"
13 : #include "Parallel/Phase.hpp"
14 : #include "ParallelAlgorithms/Actions/InitializeItems.hpp"
15 : #include "ParallelAlgorithms/Actions/TerminatePhase.hpp"
16 : #include "ParallelAlgorithms/ApparentHorizonFinder/Initialization.hpp"
17 : #include "ParallelAlgorithms/ApparentHorizonFinder/Protocols/HorizonMetavars.hpp"
18 : #include "Utilities/ProtocolHelpers.hpp"
19 : #include "Utilities/TMPL.hpp"
20 :
21 : namespace ah {
22 : /*!
23 : * \brief The singleton parallel component responsible for finding horizons.
24 : */
25 : template <class Metavariables, typename HorizonMetavars>
26 1 : struct Component {
27 : static_assert(tt::assert_conforms_to_v<HorizonMetavars,
28 : ah::protocols::HorizonMetavars>);
29 0 : using horizon_metavars = HorizonMetavars;
30 0 : using chare_type = Parallel::Algorithms::Singleton;
31 0 : static constexpr bool checkpoint_data = true;
32 :
33 0 : static std::string name() { return HorizonMetavars::name(); }
34 :
35 0 : using metavariables = Metavariables;
36 :
37 0 : using phase_dependent_action_list = tmpl::list<Parallel::PhaseActions<
38 : Parallel::Phase::Initialization,
39 : tmpl::list<Initialization::Actions::InitializeItems<
40 : ::ah::Initialize<HorizonMetavars>>,
41 : Parallel::Actions::TerminatePhase>>>;
42 :
43 0 : using simple_tags_from_options = Parallel::get_simple_tags_from_options<
44 : Parallel::get_initialization_actions_list<phase_dependent_action_list>>;
45 :
46 0 : static void execute_next_phase(
47 : const Parallel::Phase next_phase,
48 : Parallel::CProxy_GlobalCache<Metavariables>& global_cache) {
49 : auto& local_cache = *Parallel::local_branch(global_cache);
50 : Parallel::get_parallel_component<Component>(local_cache)
51 : .start_phase(next_phase);
52 : }
53 : };
54 : } // namespace ah
|