|
NGen
|
Subtype that manages/writes per-nexus data files in CSV format. More...
#include <PerNexusCsvOutputMgr.hpp>
Inheritance diagram for utils::PerNexusCsvOutputMgr:
Collaboration diagram for utils::PerNexusCsvOutputMgr:Public Member Functions | |
| PerNexusCsvOutputMgr (const std::vector< std::string > &nexus_ids, const std::string &output_root) | |
| Construct instance set for managing/writing nexus data files. | |
| void | close () override |
| Close this instance, closing all nexus_outfiles streams. | |
| void | commit_writes () override |
Commit writes by flushing output file ofstreams to filesystem. | |
| bool | is_closed () override |
| A test of whether this instance is closed. | |
| void | receive_data_entry (const std::string &formulation_id, const std::string &nexus_id, const time_marker &data_time_marker, double flow_data_at_t) override |
| Receive a data entry for this nexus, specifying details including the formulation id. | |
| virtual void | receive_data_entry (const std::string &nexus_id, const time_marker &data_time_marker, const double flow_data_at_t) |
| Receive a data entry for this nexus, specifying details but using the default formulation id (however that is determined). | |
Protected Member Functions | |
| const std::string | get_default_formulation_id () |
| Get some a formulation id value. | |
Private Attributes | |
| std::unordered_map< std::string, std::ofstream > | nexus_outfiles |
| bool | closed = false |
Subtype that manages/writes per-nexus data files in CSV format.
| utils::PerNexusCsvOutputMgr::PerNexusCsvOutputMgr | ( | const std::vector< std::string > & | nexus_ids, |
| const std::string & | output_root ) |
Construct instance set for managing/writing nexus data files.
| nexus_ids | Nexus ids for which this instance manages data (in particular, local nexuses when using MPI). |
| output_root | The output root for written files (as a string). |
References nexus_outfiles.
|
overridevirtual |
Close this instance, closing all nexus_outfiles streams.
Once a manager is closed, it will not be able to receive new data. Subsequent calls to receive_data_entry functions will result in an exception.
However, because of the way this type is implemented, all data received before the call to close should get flushed to disk as part of closing the files.
If this instance is already closed, the function will simply return.
Implements utils::NexusOutputsMgr.
|
overridevirtual |
Commit writes by flushing output file ofstreams to filesystem.
Note that this function will do nothing and immediately return if the instance has already been closed with close.
Implements utils::NexusOutputsMgr.
|
inlineprotectedinherited |
Get some a formulation id value.
Referenced by utils::NexusOutputsMgr::receive_data_entry().
|
overridevirtual |
A test of whether this instance is closed.
Implements utils::NexusOutputsMgr.
|
inlinevirtualinherited |
Receive a data entry for this nexus, specifying details but using the default formulation id (however that is determined).
| nexus_id | The id for the nexus to which this data applies. |
| data_time_marker | A marker for the current simulation time for the data. |
| flow_data_at_t | The nexus flow contribution at this time index (the main data to write). |
References utils::NexusOutputsMgr::get_default_formulation_id(), and utils::NexusOutputsMgr::receive_data_entry().
|
overridevirtual |
Receive a data entry for this nexus, specifying details including the formulation id.
If this instance is closed (is_closed) an exception will be raised.
| formulation_id | The id of the formulation involved in producing this data. |
| nexus_id | The id for the nexus to which this data applies. |
| data_time_marker | A marker for the current simulation time for the data. |
| flow_data_at_t | The nexus flow contribution at this time index (the main data to write). |
Implements utils::NexusOutputsMgr.
References utils::time_marker::sim_time_index, and utils::time_marker::time_stamp.
|
private |
|
private |
Referenced by PerNexusCsvOutputMgr().