Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
VisitAndReturn< Metavariables, TargetPhase, PhaseChangeRegistrars > 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 LocalMetavariables >
using participating_components = typename LocalMetavariables::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 noexcept
 
template<typename ParallelComponent , typename ArrayIndex , typename LocalMetavariables >
void contribute_phase_data_impl (Parallel::GlobalCache< LocalMetavariables > &cache, const ArrayIndex &array_index) const noexcept
 
template<typename... DecisionTags, typename LocalMetavariables >
std::optional< std::pair< typename Metavariables::Phase, ArbitrationStrategy > > arbitrate_phase_change_impl (const gsl::not_null< tuples::TaggedTuple< DecisionTags... > * > phase_change_decision_data, const typename LocalMetavariables::Phase current_phase, const Parallel::GlobalCache< LocalMetavariables > &) const noexcept
 
void pup (PUP::er &) noexcept override
 

Static Public Member Functions

static std::string name () noexcept
 

Static Public Attributes

static constexpr Options::String help
 

Detailed Description

template<typename Metavariables, typename Metavariables::Phase TargetPhase, typename PhaseChangeRegistrars = tmpl::list< Registrars::VisitAndReturn<Metavariables, TargetPhase>>>
struct VisitAndReturn< Metavariables, TargetPhase, PhaseChangeRegistrars >

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.

To determine which specialization of this template is requested from the input file, the Metavariables must define a phase_name(Phase) static member function that returns a string for each phase that will be used in VisitAndReturns.

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<typename Metavariables , typename Metavariables::Phase TargetPhase, typename PhaseChangeRegistrars = tmpl::list< Registrars::VisitAndReturn<Metavariables, TargetPhase>>>
constexpr Options::String VisitAndReturn< Metavariables, TargetPhase, PhaseChangeRegistrars >::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: