SpECTRE  v2024.04.12
PhaseControl::VisitAndReturn< TargetPhase > Struct Template Reference

Phase control object for temporarily visiting TargetPhase, until the algorithm halts again, then returning to the original phase. More...

#include <VisitAndReturn.hpp>

Public Types

using options = tmpl::list<>
 
using argument_tags = tmpl::list<>
 
using return_tags = tmpl::list<>
 
using phase_change_tags_and_combines = tmpl::list< Tags::ReturnPhase< TargetPhase >, Tags::TemporaryPhaseRequested< TargetPhase > >
 
template<typename Metavariables >
using participating_components = typename Metavariables::component_list
 

Public Member Functions

template<typename... DecisionTags>
void initialize_phase_data_impl (const gsl::not_null< tuples::TaggedTuple< DecisionTags... > * > phase_change_decision_data) const
 
template<typename ParallelComponent , typename ArrayIndex , typename Metavariables >
void contribute_phase_data_impl (Parallel::GlobalCache< Metavariables > &cache, const ArrayIndex &array_index) const
 
template<typename... DecisionTags, typename Metavariables >
std::optional< std::pair< Parallel::Phase, ArbitrationStrategy > > arbitrate_phase_change_impl (const gsl::not_null< tuples::TaggedTuple< DecisionTags... > * > phase_change_decision_data, const Parallel::Phase current_phase, const Parallel::GlobalCache< Metavariables > &) const
 
void pup (PUP::er &) override
 
- Public Member Functions inherited from PhaseChange
 PhaseChange (CkMigrateMessage *msg)
 
 WRAPPED_PUPable_abstract (PhaseChange)
 
template<typename ParallelComponent , typename DbTags , typename Metavariables , typename ArrayIndex >
void contribute_phase_data (const gsl::not_null< db::DataBox< DbTags > * > box, Parallel::GlobalCache< Metavariables > &cache, const ArrayIndex &array_index) const
 Send data from all participating_components to the Main chare for determining the next phase.
 
template<typename... DecisionTags, typename Metavariables >
std::optional< std::pair< Parallel::Phase, PhaseControl::ArbitrationStrategy > > arbitrate_phase_change (const gsl::not_null< tuples::TaggedTuple< DecisionTags... > * > phase_change_decision_data, const Parallel::Phase current_phase, const Parallel::GlobalCache< Metavariables > &cache) const
 Determine a phase request and PhaseControl::ArbitrationStrategy based on aggregated phase_change_decision_data on the Main Chare.
 
template<typename Metavariables , typename... Tags>
void initialize_phase_data (const gsl::not_null< tuples::TaggedTuple< Tags... > * > phase_change_decision_data) const
 Initialize the phase_change_decision_data on the main chare to starting values.
 

Static Public Member Functions

static std::string name ()
 

Static Public Attributes

static constexpr Options::String help
 

Detailed Description

template<Parallel::Phase TargetPhase>
struct PhaseControl::VisitAndReturn< TargetPhase >

Phase control object for temporarily visiting TargetPhase, until the algorithm halts again, then returning to the original phase.

The motivation for this type of procedure is e.g. load balancing, checkpointing, and other maintenance tasks that should be performed periodically during a lengthy evolution. Once triggered, this will cause a change to TargetPhase, but store the current phase to resume execution when the tasks in TargetPhase are completed.

Any parallel component can participate in the associated phase change reduction data contribution, and if any component requests the temporary phase, it will execute.

Note
If multiple such methods are specified (with different TargetPhases), then the order of phase jumps depends on their order in the list.
  • If multiple VisitAndReturns trigger simultaneously, then they will visit in sequence specified by the input file: first going to the first TargetPhase until that phase resolves, then immediately entering the second TargetPhase (without yet returning to the original phase), then finally returning to the original phase.
  • If a VisitAndReturn is triggered in a phase that is already a TargetPhase of another VisitAndReturn, it will be executed, and following completion, control will return to the original phase from before the first VisitAndReturn.

Member Data Documentation

◆ help

template<Parallel::Phase TargetPhase>
constexpr Options::String PhaseControl::VisitAndReturn< TargetPhase >::help
staticconstexpr
Initial value:
{
"Temporarily jump to the phase given by `TargetPhase`, returning to the "
"previously executing phase when complete."}

The documentation for this struct was generated from the following file: