WARPXM v1.10.0
Loading...
Searching...
No Matches
WxObject Class Reference

WxObject is a base class for WarpX classes which need to go through a creation/destruction cycle within the simulation. More...

#include <wxobject.h>

Inheritance diagram for WxObject:
WxBox< int > WmHostAction WmSequencedGroup WmSimulation WmSolverBase WmSubSolver WmVariable WxBox< TYPE > WxLogRecordHandler wxm::variable::variable_t

Detailed Description

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.
 
WxIoBasegetIo ()
 Return reference to I/O object.
 
const WxIoBasegetIo () const
 Return constant reference to I/O object.
 
WxMsgBasegetMsg ()
 Return reference to msg object.
 
const WxMsgBasegetMsg () 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.
 

Constructor & Destructor Documentation

◆ ~WxObject()

virtual WxObject::~WxObject ( )
virtual

Dtor: destroy object.

◆ WxObject() [1/2]

WxObject::WxObject ( )
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.

◆ WxObject() [2/2]

WxObject::WxObject ( const std::string &  name)
protected

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.

The WxObject is considered "setup" following instantiation.

Parameters
nameName of object

Member Function Documentation

◆ dump()

virtual void WxObject::dump ( WxIoBase io,
WxIoNodeType grpNode 
) const
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.

Parameters
ioI/O object to use for writing
grpNodegroup node to write to

Reimplemented in wxm::variable::variable_t, wxm::dfem::variable::distributed_variable_t, wxm::dfem::variable::UniqueDistributedVariable, WmUnstructuredArray, and WmVariable.

◆ finishBuild()

virtual void WxObject::finishBuild ( )
virtual

Finish building the object.

This is called after the init() or load() methods have been called. In this the object should finish building itself and be ready for use.

◆ getIo() [1/2]

WxIoBase & WxObject::getIo ( )

Return reference to I/O object.

Returns
reference to I/O object

◆ getIo() [2/2]

const WxIoBase & WxObject::getIo ( ) const

Return constant reference to I/O object.

Returns
reference to I/O object

◆ getMsg() [1/2]

WxMsgBase & WxObject::getMsg ( )

Return reference to msg object.

Returns
reference to msg object

◆ getMsg() [2/2]

const WxMsgBase & WxObject::getMsg ( ) const

Return const reference to msg object.

Returns
reference to msg object

◆ init()

virtual void WxObject::init ( )
virtual

Initialize the object.

This is called after the setup() method is called. This method is not called if the object is being restored from an output file. In this case the load() method is called instead.

◆ load()

virtual void WxObject::load ( WxIoBase io,
const WxIoNodeType grpNode 
)
virtual

Load object from file.

This method is passed a group node from which its data should be read and then constructed.

Parameters
ioI/O object to use for writing
grpNodegroup node to read from

Reimplemented in wxm::variable::variable_t, wxm::dfem::variable::distributed_variable_t, wxm::dfem::variable::UniqueDistributedVariable, WmUnstructuredArray, and WmVariable.

◆ name()

virtual std::string WxObject::name ( ) const
virtual

Get name of object.

Returns
Name of object

Reimplemented in WmPatchProcessor.

◆ setIo()

void WxObject::setIo ( WxIoBase io)

Set the I/O pointer for use in object.

Parameters
ioI/O object to use

◆ setMsg()

void WxObject::setMsg ( WxMsgBase msg)

Set the msg pointer for use in object.

Parameters
msgobject to use

◆ setName()

void WxObject::setName ( const std::string &  nm)

Set object's name.

Parameters
nmName to set

◆ setup()


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