SEVN
Loading...
Searching...
No Matches
evolve_utility::EvolveFunctor Class Reference

#include <evolve.h>

Inheritance diagram for evolve_utility::EvolveFunctor:
evolve_utility::EvolveBLC evolve_utility::EvolveBinaryCompactOld evolve_utility::EvolveDebug evolve_utility::EvolveDefault evolve_utility::EvolveRecordCondition evolve_utility::EvolveStopCondition evolve_utility::EvolveBHMS evolve_utility::EvolveRRL evolve_utility::EvolveW1 evolve_utility::EvolveBBH evolve_utility::EvolveBCX1 evolve_utility::EvolveBHMSTarantula evolve_utility::EvolveBinaryCompact

Public Member Functions

 EvolveFunctor (SevnLogging &svlog, bool record_state=true, bool include_failed=false, Options *options=nullptr)
 
virtual ~EvolveFunctor ()=default
 
virtual int operator() (_UNUSED Binstar &binary)
 
virtual int operator() (_UNUSED Star &star)
 
virtual std::string name ()
 

Static Public Member Functions

template<typename System >
static bool check_stalling (System &system)
 

Protected Member Functions

template<class System >
void final_print (System &system, bool evolution_result)
 

Static Protected Member Functions

template<class System >
static void catched_error_message (System &system, const sevnstd::sevnerr &e)
 
static long elapsed_time (std::chrono::steady_clock::time_point start_clock)
 

Protected Attributes

SevnLogging_svlog
 
const bool _record_state
 
const bool _include_failed
 
const Options_options
 

Detailed Description

Abstract Base class for Evolve functions. The derived class needs to call the base constructor with parameters:

Parameters
svlog,instanceof class Svlogging
record_state,Iftrue enable the state recording during the evolution (following the parameters in input)
include_failed,Iftrue include the results of failed evolutions in the output files
Options[Optional], Pointer to an istance of the struct evolve_utility::Options containing a vector of doubles and a vector of strings. The struct is used to pass extra parameters to the given Evolve FUnctor (if needed)

Constructor & Destructor Documentation

◆ EvolveFunctor()

evolve_utility::EvolveFunctor::EvolveFunctor ( SevnLogging svlog,
bool  record_state = true,
bool  include_failed = false,
Options options = nullptr 
)
inlineexplicit

◆ ~EvolveFunctor()

virtual evolve_utility::EvolveFunctor::~EvolveFunctor ( )
virtualdefault

Member Function Documentation

◆ catched_error_message()

template<class System >
static void evolve_utility::EvolveFunctor::catched_error_message ( System &  system,
const sevnstd::sevnerr e 
)
inlinestaticprotected

Special error message printed to std::cerr. This message is always print do not throw errors and can be used to print a message of a catched error during during a system evolution

Parameters
eInstance of Sevnerror
system_namename of the system (sytem.get_name())
system_IDID of the system (system.get_ID())

◆ check_stalling()

template<typename System >
static bool evolve_utility::EvolveFunctor::check_stalling ( System &  system)
inlinestatic

Check if the system has been evolving for more than a given threshold (standard 20 s) If this is the case throw a sevnerror The check is performed only if the option check_stalling is set to true @TODO it could be better to move the check_stalling parameter from bool to double including the maximum time allowed for the evolution

Template Parameters
SystemAn object of the class Star or Binary
Parameters
systemthe system for which we want to check if the evolution is stalling
Returns
EXIT success if the system is not stalling otherwise throw an error @error throw a sevnerror if the system has been evolving for more than the second set as threshold

◆ elapsed_time()

static long evolve_utility::EvolveFunctor::elapsed_time ( std::chrono::steady_clock::time_point  start_clock)
inlinestaticprotected

Measure the elapsed time in seconds from a given starting clock

Parameters
start_clock,aninstance of std::chrono::steady_clock::time_point, the elapsed time is estimated from this point
Returns
elapsed time in seconds (approximated to the nearest integer)

◆ final_print()

template<class System >
void evolve_utility::EvolveFunctor::final_print ( System &  system,
bool  evolution_result 
)
inlineprotected

◆ name()

◆ operator()() [1/2]

virtual int evolve_utility::EvolveFunctor::operator() ( _UNUSED Binstar binary)
inlinevirtual

◆ operator()() [2/2]

Member Data Documentation

◆ _include_failed

const bool evolve_utility::EvolveFunctor::_include_failed
protected

◆ _options

const Options* evolve_utility::EvolveFunctor::_options
protected

◆ _record_state

const bool evolve_utility::EvolveFunctor::_record_state
protected

◆ _svlog

SevnLogging& evolve_utility::EvolveFunctor::_svlog
protected

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