The Sparta Modeling Framework
|
Contains information describing the simulation instance for the purpose of identifying the simulation and possible recreating it. This information should be written to all log files, reports, cmdline, etc. More...
#include <SimulationInfo.hpp>
Public Member Functions | |
~SimulationInfo () | |
Destruction. | |
SimulationInfo () | |
Default Constructor. | |
SimulationInfo (const SimulationInfo &rhp) | |
Copy-constructor. | |
SimulationInfo (SimulationInfo &&)=delete | |
Not move-constructable. | |
SimulationInfo & | operator= (const SimulationInfo &rhp) |
Assignable. | |
SimulationInfo (const std::string &_sim_name, const std::string &_command_line, const std::string &_working_dir, const std::string &_executable, const std::string &_simulator_version, const std::string &_reproduction_info, const std::vector< std::string > &_other) | |
SimulationInfo constructor. | |
SimulationInfo (const std::string &_sim_name, int argc, char **argv, const std::string &_simulator_version, const std::string &_reproduction_info, const std::vector< std::string > &_other) | |
SimulationInfo constructor with automatic command-line reconstruction. | |
SimulationInfo (const simdb::ObjectManager &sim_db, const simdb::DatabaseID obj_mgr_db_id, const simdb::DatabaseID report_node_id=0) | |
Recreate a SimulationInfo object from the provided SimInfo record with the given ObjMgrID. | |
SimulationInfo (std::ifstream &json_fin, std::map< std::string, std::string > *json_kvpairs=nullptr) | |
Instantiate a SimulationInfo object from a json, json_reduced, json_detail, or js_json report file. | |
std::string | getSpartaVersion () const |
Get the SPARTA version string for this SimulationInfo object. Most of the time, this will be SimulationInfo::sparta_version (const / global). But there are some SimDB/report workflows that need to create or recreate SimulationInfo objects with a different SPARTA version string. | |
void | setCommandLine (int argc, char **argv) |
Assign command_line_ and executable_ from args. | |
void | setCommandLine (const std::string &cmdline) |
Assign command line from string. | |
void | addOtherInfo (const std::string &_other) |
Add other information to the simulation. | |
template<typename StreamType = std::ostream> | |
void | write (StreamType &o, const std::string &line_start="# ", const std::string &line_end="\n", bool show_field_names=true) const |
Write this information to an ostream. | |
template<typename ... Args> | |
std::string | stringize (const Args &...args) const |
Generate a string using the write function without needing to construct a temporary stringstream. | |
template<typename ... Args> | |
std::vector< std::string > | stringizeToLines (const Args &...args) const |
Generate a vector of lines. | |
std::vector< std::pair< std::string, std::string > > | getHeaderPairs () const |
Gets (name, value) pairs for each header entry. | |
const utils::ValidValue< std::string > & | getLastCapturedElapsedTime () const |
Return the very last 'Elapsed' time that this object got from the TimeManager. This is reset with each call to getHeaderPairs(). | |
Static Public Member Functions | |
static SimulationInfo & | getInstance () |
Gets the SimulationInfo singleton instance. | |
Public Attributes | |
const std::string & | sim_name |
Simulator application name. Note that multiple simulators could exist in the same process space, so this should be the application containing those simulations. If there is only one simulation, this should usually match the simulation name. | |
const std::string & | command_line |
Simulator application instance command-line. | |
const std::string & | working_dir |
Simulator application instance working dir. | |
const std::string & | executable |
Executable being run. | |
const std::string & | simulator_version |
Simulator Version of the simulator itself. | |
const std::string & | reproduction_info |
versions/buildnums/tags of simulator and dependencies necessary for reproducing the build from a version control system | |
const std::string & | start_time |
Time at which the simulation started (roughly) | |
const std::vector< std::string > & | other |
other simulator information | |
Static Public Attributes | |
static const char | sparta_version [] |
The version of SPARTA. | |
Contains information describing the simulation instance for the purpose of identifying the simulation and possible recreating it. This information should be written to all log files, reports, cmdline, etc.
Definition at line 108 of file SimulationInfo.hpp.
|
inline |
Destruction.
Definition at line 201 of file SimulationInfo.hpp.
|
inline |
Default Constructor.
Definition at line 210 of file SimulationInfo.hpp.
|
inline |
Copy-constructor.
Definition at line 225 of file SimulationInfo.hpp.
|
inline |
SimulationInfo constructor.
Definition at line 261 of file SimulationInfo.hpp.
|
inline |
SimulationInfo constructor with automatic command-line reconstruction.
Definition at line 285 of file SimulationInfo.hpp.
sparta::SimulationInfo::SimulationInfo | ( | const simdb::ObjectManager & | sim_db, |
const simdb::DatabaseID | obj_mgr_db_id, | ||
const simdb::DatabaseID | report_node_id = 0 |
||
) |
Recreate a SimulationInfo object from the provided SimInfo record with the given ObjMgrID.
sparta::SimulationInfo::SimulationInfo | ( | std::ifstream & | json_fin, |
std::map< std::string, std::string > * | json_kvpairs = nullptr |
||
) |
Instantiate a SimulationInfo object from a json, json_reduced, json_detail, or js_json report file.
json_fin | Input file stream for the JSON report file |
json_kvpairs | Optional output argument to get all the name-value pairs of SimulationInfo properties found in the file. |
|
inline |
Add other information to the simulation.
Definition at line 385 of file SimulationInfo.hpp.
|
inline |
Gets (name, value) pairs for each header entry.
Definition at line 447 of file SimulationInfo.hpp.
|
inlinestatic |
Gets the SimulationInfo singleton instance.
Definition at line 191 of file SimulationInfo.hpp.
|
inline |
Return the very last 'Elapsed' time that this object got from the TimeManager. This is reset with each call to getHeaderPairs().
Definition at line 480 of file SimulationInfo.hpp.
|
inline |
Get the SPARTA version string for this SimulationInfo object. Most of the time, this will be SimulationInfo::sparta_version (const / global). But there are some SimDB/report workflows that need to create or recreate SimulationInfo objects with a different SPARTA version string.
Definition at line 342 of file SimulationInfo.hpp.
|
inline |
Assignable.
Definition at line 245 of file SimulationInfo.hpp.
|
inline |
Assign command line from string.
Definition at line 378 of file SimulationInfo.hpp.
|
inline |
Assign command_line_ and executable_ from args.
Definition at line 353 of file SimulationInfo.hpp.
|
inline |
Generate a string using the write function without needing to construct a temporary stringstream.
Definition at line 425 of file SimulationInfo.hpp.
|
inline |
Generate a vector of lines.
Definition at line 438 of file SimulationInfo.hpp.
|
inline |
Write this information to an ostream.
line_start | String to write at the start of each line (per field) |
line_end | String to write at the end of each line (per field). This is typically "\n", but can be anything. |
show_field_names | Show the names of each field before printing the values |
Definition at line 398 of file SimulationInfo.hpp.
const std::string& sparta::SimulationInfo::command_line |
Simulator application instance command-line.
Definition at line 149 of file SimulationInfo.hpp.
const std::string& sparta::SimulationInfo::executable |
Executable being run.
Definition at line 159 of file SimulationInfo.hpp.
const std::vector<std::string>& sparta::SimulationInfo::other |
other simulator information
Definition at line 186 of file SimulationInfo.hpp.
const std::string& sparta::SimulationInfo::reproduction_info |
versions/buildnums/tags of simulator and dependencies necessary for reproducing the build from a version control system
Definition at line 176 of file SimulationInfo.hpp.
const std::string& sparta::SimulationInfo::sim_name |
Simulator application name. Note that multiple simulators could exist in the same process space, so this should be the application containing those simulations. If there is only one simulation, this should usually match the simulation name.
Definition at line 144 of file SimulationInfo.hpp.
const std::string& sparta::SimulationInfo::simulator_version |
Simulator Version of the simulator itself.
Definition at line 164 of file SimulationInfo.hpp.
|
static |
The version of SPARTA.
Definition at line 169 of file SimulationInfo.hpp.
const std::string& sparta::SimulationInfo::start_time |
Time at which the simulation started (roughly)
Definition at line 181 of file SimulationInfo.hpp.
const std::string& sparta::SimulationInfo::working_dir |
Simulator application instance working dir.
Definition at line 154 of file SimulationInfo.hpp.