CYCLUS
Public Member Functions | Static Public Member Functions | List of all members
cyclus::SimInit Class Reference

Detailed Description

Handles initialization of a simulation from the output database.

After calling Init, Restart, or Branch, the initialized Context, Timer, and Recorder can be retrieved.

Warning
the Init, Restart, and Branch methods are NOT idempotent. Only one simulation should ever be initialized per SimInit object.
the SimInit class manages the memory of the initialized Context, Timer, and Recorder.

Definition at line 24 of file sim_init.h.

#include <sim_init.h>

Public Member Functions

void Branch (QueryableBackend *b, boost::uuids::uuid prev_sim_id, int t, boost::uuids::uuid new_sim_id)
 
Contextcontext ()
 
void Init (Recorder *r, QueryableBackend *b)
 
Recorderrecorder ()
 
void Restart (QueryableBackend *b, boost::uuids::uuid sim_id, int t)
 
 SimInit ()
 
Timertimer ()
 
 ~SimInit ()
 

Static Public Member Functions

static Material::Ptr BuildMaterial (QueryableBackend *b, int resid)
 
static Product::Ptr BuildProduct (QueryableBackend *b, int resid)
 
static void SnapAgent (Agent *m)
 
static void Snapshot (Context *ctx)
 

Constructor & Destructor Documentation

◆ SimInit()

cyclus::SimInit::SimInit ( )

Definition at line 17 of file sim_init.cc.

◆ ~SimInit()

cyclus::SimInit::~SimInit ( )

Definition at line 19 of file sim_init.cc.

Member Function Documentation

◆ Branch()

void cyclus::SimInit::Branch ( QueryableBackend b,
boost::uuids::uuid  prev_sim_id,
int  t,
boost::uuids::uuid  new_sim_id 
)

NOT IMPLEMENTED.

Initializes a simulation branched from prev_sim_id at time t with diverging state described in new_sim_id.

TODO(rwcarlsen): implement

Definition at line 44 of file sim_init.cc.

◆ BuildMaterial()

Material::Ptr cyclus::SimInit::BuildMaterial ( QueryableBackend b,
int  resid 
)
static

Convenience function for reconstructing an untracked material object with the given resource state id from a database backend b.

Particularly useful for running mock simulations/tests.

Definition at line 491 of file sim_init.cc.

◆ BuildProduct()

Product::Ptr cyclus::SimInit::BuildProduct ( QueryableBackend b,
int  resid 
)
static

Convenience function for reconstructing an untracked product object with the given resource state id from a database backend b.

Particularly useful for running mock simulations/tests.

Definition at line 505 of file sim_init.cc.

◆ context()

Context* cyclus::SimInit::context ( )
inline

Returns the initialized context.

Note that either Init, Restart, or Branch must be called first.

Definition at line 58 of file sim_init.h.

◆ Init()

void cyclus::SimInit::Init ( Recorder r,
QueryableBackend b 
)

Initialize a simulation with data from b for simulation id in r.

SimInit does not take ownership of the recorder or backend. the configured context's recorder is set to r.

Definition at line 25 of file sim_init.cc.

◆ recorder()

Recorder* cyclus::SimInit::recorder ( )
inline

Returns the initialized recorder with registered backends.

Note that either Init, Restart, or Branch must be called first.

Definition at line 62 of file sim_init.h.

◆ Restart()

void cyclus::SimInit::Restart ( QueryableBackend b,
boost::uuids::uuid  sim_id,
int  t 
)

EXPERIMENTAL (might not work properly).

Restarts a simulation from time t with data from b identified by simid. The newly configured simulation will run with a new simulation id.

Definition at line 32 of file sim_init.cc.

◆ SnapAgent()

void cyclus::SimInit::SnapAgent ( Agent m)
static

Records a snapshot of the agent's current internal state into the simulation's output database.

Note that this should generally not be called directly.

Definition at line 122 of file sim_init.cc.

◆ Snapshot()

void cyclus::SimInit::Snapshot ( Context ctx)
static

Records a snapshot of the current state of the simulation being managed by ctx into the simulation's output database.

Definition at line 74 of file sim_init.cc.

◆ timer()

Timer* cyclus::SimInit::timer ( )
inline

Returns the initialized timer.

Note that either Init, Restart, or Branch must be called first.

Definition at line 66 of file sim_init.h.


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