![]() |
SEVN
|
Classes | |
| class | EvolveBBH |
| class | EvolveBCX1 |
| class | EvolveBHMS |
| class | EvolveBHMSTarantula |
| class | EvolveBinaryCompact |
| class | EvolveBinaryCompactOld |
| class | EvolveBLC |
| class | EvolveDebug |
| class | EvolveDefault |
| class | EvolveFunctor |
| class | EvolveRecordCondition |
| class | EvolveRRL |
| class | EvolveStopCondition |
| class | EvolveW1 |
| struct | Options |
Functions | |
| int | evolve_single (Binstar &binary, SevnLogging &svlog, bool record_state=true) |
| int | evolve_single (Star &star, SevnLogging &svlog, bool record_state=true) |
| template<typename System > | |
| int | evolve_list (EvolveFunctor *evolve_function, std::vector< System > &systems, _UNUSED IO &sevnio, int Nevolve=-1) |
| template<typename T > | |
| int | chunk_dispatcher (unsigned int Nchunk, IO &sevnio, std::vector< T > &systems, bool record_state=true, bool progress=true) |
| template<typename T > | |
| int | chunk_dispatcher (EvolveFunctor *evolve_function, unsigned int Nchunk, IO &sevnio, std::vector< T > &systems, bool progress=true) |
IDEA BEHIND THE EVOLVE FUNCTOR
The Evolve Functors are used to handle the evolution, the record of properties and the output of both stars and binaries. The evolve function of the classes Star and Binaries just evolves the system of a single adaptive timestep forward, the Evolve fuctor described here have the role to drive the complete evolution stopping it when needed, print in in output the results and handle errors. The Base EvolveFunctor constructor has 4 parameters:
The key method of a Functor is the override of the operators(Binstar& binstar) and operators(Star& star). This is the function that perform the actual evolution. As a general guide the evolve should contain an infinite for that call star or binstar evolution.
** CHECK STALLING ** At beginning of each evolution step the check for stalling should be added through the static method check_stalling(system). System could be both a Star or a binary, for example check_stalling(binary) or check_stalling(star). Notice that the method is static so it could (and should be called) also for custom evolution functions: EvolveFunctor::check_stalling(binary) or EvolveFunctor::check_stalling(star). The method returns a sevnerror if the binary or the stars has been evolving for more a time set at runtime through the propertis check_stalling_time. The check can be disabled at runtime by using -check_stalling false
After the evolution it should be checked if the breaktrigger condition have been reached. In that case the for cycle is stopped through a break. Inside the for it should be checked also if the condition for record of the states has been reached. If this is the case we have to call the method recordstate_w_timeupdate(). The method records the states and update the property NextOutput. Notice that if the memmber _record_state is false, the states should be never recorded indepentely from the input and EvolveFunctor options. If we want to handle the errors without stopping the whole computation we have to use a try .. catch .. structure. The evolution is inserted inside the try part while inside the catch we have to set the member evolution_results=EXIT_FAILURE; and a brak for the for cycle should be inserted. At the end of the function before we have to add the mandatory following lines: final_print(system); //Handle the output printing return _evolution_result; //Exit_SUccess (default) or EXIT_FAILURE if it has been set in the evolution (if the evolution failed).
HOW TO ADD A NEW EVOLVE FUNCTION
The evolve function is a Functor that should have two mandatory override operator:
Implementation steps Assume we are implementing a new evolve functor EvolveNizzi 1- Create a class derived from the the base class EvolveFunctor class EvolveNizzi : public EvolveFunctor 2- Implement the class constructor that calls the base class constructor
EvolveNizzi(SevnLogging& svlog, bool record_state=true) : EvolveFunctor(svlog,record_state) {...}
@param svlog, instance of class Svlogging
@param record_state, If true enable the state recording during the evolution (following the parameters in input)
3- Override the pure virtual operator () for both stars and binstars
and then
public: inline int operator() (Binstar& binary) override { return evolve_common(binary);} inline int operator() (Star& star) override { return evolve_common(star);}
NOTICE: The functions have to return EXIT_SUCCESS if the evolution ended without problems or EXIT_FAILURE or
raise an Error in the other cases
WRITE DOCUMENTATION OF THE CLASS The documentation of new EvolveFunctor should follow the schema:
HOW TO USE IT IN THE MAIN FUNCTION
|
inline |
Evolve using chunk version with functor
| evolve_function | Pointer to functor derived from base class EvolveFunctor |
| Nchunk | Number of systems to evolve in each chunk |
| sevnio | Instance of the IO class (the one linked to the binaries) |
| systems | Vector containing the systems to evolve. |
| progress | If true print progress information to the standard output |
Preliminary reset
Preliminary assignment
Cycle
|
inline |
Evolve using chunk
| Nchunk | Number of systems to evolve in each chunk |
| sevnio | Instance of the IO class (the one linked to the binaries) |
| systems | Vector containing the systems to evolve. |
| record_state | If true record and print the systems states (accordingly with the option parameters) |
| progress | If true print progress information to the standard output |
Preliminary reset
Preliminary assignment
Cycle
|
inline |
Evolve a list of stars or binstars
| evolve_function | Pointer to functor derived from base class EvolveFunctor |
| systems | Vector containing the systems to evolve. |
| sevnio | Instance of the IO class (the one linked to the binaries) |
| Nevolve | Number of systems to evolve (first Nevolve). If -1 evolve all the sytems |
|
inline |
Evolve a binary system DEPREACATED
| binary | Binary system to evolve |
| svlog | Instance of the Sevenlogging class |
| record_state | If true record and print the binary states (accordingly with the option parameters) |
|
inline |
Evolve a star
| star | Star system to evolve |
| svlog | Instance of the Sevenlogging class |
| record_state | If true record and print the binary states (accordingly with the option parameters) |