WARPXM v1.10.0
|
WxObject is a base class for WarpX classes which need to go through a creation/destruction cycle within the simulation. More...
#include <wxobject.h>
WxObject is a base class for WarpX classes which need to go through a creation/destruction cycle within the simulation.
Objects derived from this class can provide several methods which are used to create and destroy them.
The objects in WarpX are created in a three-step process. First, the setup() method is called which should read in data from the cryptset. Second, either the init() or the load() method is called. The init() method is not called if the object is being restored from an output file. Instead, the load() method is called. Finally, the finishBuild() method is called.
The init() method should initialize the object using the data read in by the setup() method. Often, for simple objects, this method is not needed and all the work can be done in the setup() method.
The load() method should read data from the HDF5 file and restore itself. This method is passed a pointer to the HDF5 group from which the object should read data to restore itself.
Finally, the finishBuild() method is called which should complete the initialization of the object. After this call is complete the object should be ready for use.
Simple objects may not need init(), load(), dump() and finishBuild() methods. In this case they need not be provided by the derived classes.
Objects which provide a load() need to provide a dump() method. This method should write its data out to the HDF5 group provided. It should write enough data so that it can reconstruct itself when the load() method is called.
Public Member Functions | |
virtual | ~WxObject () |
Dtor: destroy object. | |
void | setIo (WxIoBase &io) |
Set the I/O pointer for use in object. | |
void | setMsg (WxMsgBase &msg) |
Set the msg pointer for use in object. | |
WxIoBase & | getIo () |
Return reference to I/O object. | |
const WxIoBase & | getIo () const |
Return constant reference to I/O object. | |
WxMsgBase & | getMsg () |
Return reference to msg object. | |
const WxMsgBase & | getMsg () const |
Return const reference to msg object. | |
virtual void | setup (const WxCryptSet &wxc) |
Setup object using supplied crypset. | |
virtual void | init () |
Initialize the object. | |
virtual void | finishBuild () |
Finish building the object. | |
virtual void | load (WxIoBase &io, const WxIoNodeType &grpNode) |
Load object from file. | |
virtual void | dump (WxIoBase &io, WxIoNodeType &grpNode) const |
Dump object to file. | |
virtual std::string | name () const |
Get name of object. | |
void | setName (const std::string &nm) |
Set object's name. | |
Protected Member Functions | |
WxObject () | |
Create object, that will be initialized subsequently. | |
WxObject (const std::string &name) | |
Create object with given name bypassing object setup phase Protected because there is no reason to have a WxObject directly, as it is meant to be a parent class. | |
|
virtual |
Dtor: destroy object.
|
protected |
Create object, that will be initialized subsequently.
Protected because there is no reason to have a WxObject directly, as it is meant to be a parent class.
|
protected |
|
virtual |
Dump object to file.
This methods is passed a group node to which is should write its data to. Enough data should be written so that it can reconstruct itself using the load() method.
io | I/O object to use for writing |
grpNode | group node to write to |
Reimplemented in wxm::variable::variable_t, wxm::dfem::variable::distributed_variable_t, wxm::dfem::variable::UniqueDistributedVariable, WmUnstructuredArray, and WmVariable.
|
virtual |
WxIoBase & WxObject::getIo | ( | ) |
Return reference to I/O object.
const WxIoBase & WxObject::getIo | ( | ) | const |
Return constant reference to I/O object.
WxMsgBase & WxObject::getMsg | ( | ) |
Return reference to msg object.
const WxMsgBase & WxObject::getMsg | ( | ) | const |
Return const reference to msg object.
|
virtual |
|
virtual |
Load object from file.
This method is passed a group node from which its data should be read and then constructed.
io | I/O object to use for writing |
grpNode | group node to read from |
Reimplemented in wxm::variable::variable_t, wxm::dfem::variable::distributed_variable_t, wxm::dfem::variable::UniqueDistributedVariable, WmUnstructuredArray, and WmVariable.
|
virtual |
void WxObject::setIo | ( | WxIoBase & | io | ) |
Set the I/O pointer for use in object.
io | I/O object to use |
void WxObject::setMsg | ( | WxMsgBase & | msg | ) |
Set the msg pointer for use in object.
msg | object to use |
void WxObject::setName | ( | const std::string & | nm | ) |
Set object's name.
nm | Name to set |
|
virtual |
Setup object using supplied crypset.
This method should read in parameters needed to initialize it. May only be called once.
wxc | Cryptset using which the object is set up. |
Reimplemented in WmSimulation, wxm::host_actions::data_loader, WmFillValue, WmFunctionApplicator, WmGhostSync, WmICGenerator, WmPatchProcessor, WmProbeLocation, WmSynchronizer, WmTestSuggestedDt, WmTimedSwapVariables, WmVariableLoader, WmVariableSwapper, WxBox< TYPE >, WxBox< int >, WxFileHandler, WmHostSequencedGroup, WmSequencedGroup, WmSolver, WmSolverBase, WmSubSolver, wxm::variable::distributed_variable_t, wxm::variable::variable_t, WmUnstructuredArray, WmVariable, WmDistributedVariable, wxm::temporal::implicit, WmTemporalSolver_RK, wxm::dfem::variable::distributed_variable_t, wxm::dfem::variable::UniqueDistributedVariable, wxm::diagnostics::Diagnostic, wxm::diagnostics::Probe, wxm::diagnostics::UniqueVariable, wxm::diagnostics::WmIntegrator, wxm::diagnostics::DiagnosticsWriter, wxm::dt_calc::convergence_dt, wxm::dt_calc::fixed_dt, wxm::dt_calc::integrating_controller, wxm::dt_calc::stability_dt, wxm::dt_calc::time_stepper_base, WmHostAction, wxm::temporal_solver, wxm::va_runner, and WmWriteOut.