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

cyclus::SimInit::SimInit ( )

Definition at line 16 of file sim_init.cc.

cyclus::SimInit::~SimInit ( )

Definition at line 18 of file sim_init.cc.

Member Function Documentation

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 43 of file sim_init.cc.

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 486 of file sim_init.cc.

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 500 of file sim_init.cc.

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.

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 24 of file sim_init.cc.

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.

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 31 of file sim_init.cc.

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 121 of file sim_init.cc.

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 73 of file sim_init.cc.

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: