SpECTRE Documentation Coverage Report
Current view: top level - ControlSystem - Component.hpp Hit Total Coverage
Commit: 697db44127ce57424c079f629b3283267ec6bd78 Lines: 2 10 20.0 %
Date: 2024-06-21 21:13:41
Legend: Lines: hit not hit

          Line data    Source code
       1           0 : // Distributed under the MIT License.
       2             : // See LICENSE.txt for details.
       3             : 
       4             : #pragma once
       5             : 
       6             : #include <tuple>
       7             : 
       8             : #include "ControlSystem/Actions/Initialization.hpp"
       9             : #include "ControlSystem/Protocols/ControlSystem.hpp"
      10             : #include "DataStructures/DataBox/DataBox.hpp"
      11             : #include "Parallel/Algorithms/AlgorithmSingleton.hpp"
      12             : #include "Parallel/GlobalCache.hpp"
      13             : #include "Parallel/Local.hpp"
      14             : #include "Parallel/ParallelComponentHelpers.hpp"
      15             : #include "Parallel/Phase.hpp"
      16             : #include "ParallelAlgorithms/Actions/InitializeItems.hpp"
      17             : #include "ParallelAlgorithms/Actions/TerminatePhase.hpp"
      18             : #include "Utilities/ProtocolHelpers.hpp"
      19             : #include "Utilities/TMPL.hpp"
      20             : 
      21             : /*!
      22             :  * \ingroup ControlSystemGroup
      23             :  * \brief The singleton parallel component responsible for managing a single
      24             :  * control system.
      25             :  *
      26             :  * The control system that this component is responsible for is specified by the
      27             :  * `ControlSystem` template parameter. This control system must conform to the
      28             :  * `control_system::Protocols::ControlSystem` protocol.
      29             :  */
      30             : template <class Metavariables, typename ControlSystem>
      31           1 : struct ControlComponent {
      32             :   static_assert(tt::assert_conforms_to_v<
      33             :                 ControlSystem, control_system::protocols::ControlSystem>);
      34           0 :   using chare_type = Parallel::Algorithms::Singleton;
      35           0 :   using control_system = ControlSystem;
      36             : 
      37           0 :   static std::string name() { return ControlSystem::name(); }
      38             : 
      39           0 :   using metavariables = Metavariables;
      40             : 
      41           0 :   using phase_dependent_action_list = tmpl::list<Parallel::PhaseActions<
      42             :       Parallel::Phase::Initialization,
      43             :       tmpl::list<Initialization::Actions::InitializeItems<
      44             :                      ::control_system::Actions::Initialize<Metavariables,
      45             :                                                            ControlSystem>>,
      46             :                  Parallel::Actions::TerminatePhase>>>;
      47             : 
      48           0 :   using simple_tags_from_options = Parallel::get_simple_tags_from_options<
      49             :       Parallel::get_initialization_actions_list<phase_dependent_action_list>>;
      50             : 
      51           0 :   static void execute_next_phase(
      52             :       const Parallel::Phase next_phase,
      53             :       Parallel::CProxy_GlobalCache<Metavariables>& global_cache) {
      54             :     auto& local_cache = *Parallel::local_branch(global_cache);
      55             :     Parallel::get_parallel_component<
      56             :         ControlComponent<Metavariables, ControlSystem>>(local_cache)
      57             :         .start_phase(next_phase);
      58             :   }
      59             : };
      60             : 
      61             : namespace control_system {
      62             : /// \ingroup ControlSystemGroup
      63             : /// List of control components to be added to the component list of the
      64             : /// metavars
      65             : template <typename Metavariables, typename ControlSystems>
      66           1 : using control_components = tmpl::transform<
      67             :     ControlSystems,
      68             :     tmpl::bind<ControlComponent, tmpl::pin<Metavariables>, tmpl::_1>>;
      69             : }  // namespace control_system

Generated by: LCOV version 1.14