GEOS
|
Base class for all wrappers containing common operations. More...
#include <WrapperBase.hpp>
Public Member Functions | |
virtual bool | hasDefaultValue () const =0 |
Return true iff this wrapper has a valid default value. More... | |
virtual string | getDefaultValueString () const =0 |
Return a string representing the default value. More... | |
virtual bool | processInputFile (xmlWrapper::xmlNode const &targetNode, xmlWrapper::xmlNodePos const &nodePos)=0 |
Initialize the wrapper from the input xml node. More... | |
virtual void | addBlueprintField (conduit::Node &fields, string const &name, string const &topology, std::vector< string > const &componentNames={}) const =0 |
Push the data in the wrapper into a Conduit blueprint field. More... | |
virtual void | populateMCArray (conduit::Node &node, std::vector< string > const &componentNames={}) const =0 |
Push the data in the wrapper into a Conduit Blueprint mcarray. More... | |
virtual std::unique_ptr< WrapperBase > | averageOverSecondDim (string const &name, Group &group) const =0 |
Create a new Wrapper with values averaged over the second dimension. More... | |
virtual HistoryMetadata | getHistoryMetadata (localIndex const packCount) const =0 |
Get a description of the wrapped data for time history collection/output. More... | |
Constructor, desctructor | |
WrapperBase (string const &name, Group &parent, string const &rtTypeName) | |
Constructor. More... | |
virtual | ~WrapperBase () |
Default destructor. | |
Methods that delegate to the wrapped type | |
These functions will call the corresponding method on the wrapped object, if such method is declared in wrapped type. | |
virtual localIndex | size () const =0 |
Calls T::size() More... | |
virtual void const * | voidPointer () const =0 |
virtual localIndex | elementByteSize () const =0 |
virtual size_t | bytesAllocated () const =0 |
virtual void | resize (int num_dims, localIndex const *const dims)=0 |
Calls T::resize( num_dims, dims ) More... | |
virtual void | reserve (localIndex const newCapacity)=0 |
Calls T::reserve( newCapacity ) if it exists, otherwise a no-op. More... | |
virtual localIndex | capacity () const =0 |
virtual void | resize (localIndex newsize)=0 |
Calls T::resize(newsize) if it exists. More... | |
void | resize () |
Calls resize(newsize) where newsize is taken from the parent Group. | |
virtual void | copy (localIndex const sourceIndex, localIndex const destIndex)=0 |
Calls T::copy(sourceIndex, destIndex) More... | |
virtual void | erase (std::set< localIndex > const &indicesToErase)=0 |
Calls T::erase(indicesToErase) More... | |
virtual void | move (LvArray::MemorySpace const space, bool const touch) const =0 |
Calls T::move(space, touch) More... | |
virtual Regex const & | getTypeRegex () const =0 |
string const & | getRTTypeName () const |
WrapperBase & | setRTTypeName (string_view rtTypeName) |
override the rtType to use when parsing an input value to the wrapped object. It can be useful to change the used regex to validate the input value. More... | |
Restart output methods | |
virtual void | registerToWrite () const =0 |
Register the wrapper's data for writing with Conduit. | |
virtual void | finishWriting () const =0 |
Write the wrapped data into Conduit. | |
virtual bool | loadFromConduit ()=0 |
Read the wrapped data from Conduit. More... | |
Methods for buffer packing/unpacking | |
This group of functions is used to pack/unpack wrapped object to/from binary buffers | |
virtual bool | isPackable (bool onDevice) const =0 |
Check whether wrapped type is can be packed into a buffer on host or device. More... | |
template<bool DO_PACKING> | |
localIndex | pack (buffer_unit_type *&buffer, bool withMetadata, bool onDevice, parallelDeviceEvents &events) const |
Concrete implementation of the packing method. More... | |
template<bool DO_PACKING> | |
localIndex | packByIndex (buffer_unit_type *&buffer, arrayView1d< localIndex const > const &packList, bool withMetadata, bool onDevice, parallelDeviceEvents &events) const |
Concrete implementation of the packing by index method. More... | |
virtual localIndex | unpack (buffer_unit_type const *&buffer, bool withMetadata, bool onDevice, parallelDeviceEvents &events)=0 |
Unpack the entire wrapped object from a buffer. More... | |
virtual localIndex | unpackByIndex (buffer_unit_type const *&buffer, arrayView1d< localIndex const > const &unpackIndices, bool withMetadata, bool onDevice, parallelDeviceEvents &events, MPI_Op op=MPI_REPLACE)=0 |
For indexable types, unpack selected indices of wrapped object from a buffer. More... | |
Wrapper attribute getters and setters | |
int | sizedFromParent () const |
Check whether this wrapper is resized when its parent is resized. More... | |
WrapperBase & | setSizedFromParent (int val) |
Set whether this wrapper is resized when its parent is resized. More... | |
RestartFlags | getRestartFlags () const |
Get the RestartFlags of the wrapper. More... | |
WrapperBase & | setRestartFlags (RestartFlags flags) |
Set the RestartFlags of the wrapper. More... | |
PlotLevel | getPlotLevel () const |
Get PlotLevel for this wrapper. More... | |
WrapperBase & | setPlotLevel (PlotLevel const flag) |
Set the PlotLevel of the wrapper. More... | |
string const & | getName () const |
Get name of the wrapper. More... | |
string | getPath () const |
Return the path to this Wrapper in the data repository. More... | |
DataContext const & | getDataContext () const |
Group & | getParent () |
Group const & | getParent () const |
WrapperBase & | setInputFlag (InputFlags const input) |
Set the InputFlag of the wrapper. More... | |
InputFlags | getInputFlag () const |
Get the InputFlag of the wrapper. More... | |
bool | getSuccessfulReadFromInput () const |
Returns flag that indicates whether the contents of the wrapper have been successfully read from the input file. More... | |
WrapperBase & | setDescription (string const &description) |
Set the description string of the wrapper. More... | |
WrapperBase & | appendDescription (string const &description) |
Add up more text to the existing description string of the wrapper. More... | |
string const & | getDescription () const |
Get the description string of the wrapper. More... | |
string | dumpInputOptions (bool const outputHeader) const |
std::set< string > const & | getRegisteringObjects () const |
Get the list of names of groups that registered this wrapper. More... | |
WrapperBase & | setRegisteringObjects (string const &objectName) |
Add a new name to the list of groups that register this wrapper. More... | |
Miscellaneous | |
virtual void | copyWrapperAttributes (WrapperBase const &source) |
Copy attributes from another wrapper. More... | |
virtual std::unique_ptr< WrapperBase > | clone (string const &name, Group &parent)=0 |
Creates a clone of *this WrapperBase. More... | |
virtual void | copyData (WrapperBase const &source)=0 |
Copy the the data contained in another wrapper into this wrapper. More... | |
virtual void | copyWrapper (WrapperBase const &source)=0 |
Copies the contents of a Wrapper into *this. More... | |
virtual std::type_info const & | getTypeId () const =0 |
Get the typeid of T. More... | |
virtual int | numArrayDims () const =0 |
Return the number of dimensions of the array. More... | |
virtual localIndex | numArrayComp () const =0 |
Return the number of components in a multidimensional array. More... | |
virtual WrapperBase & | setDimLabels (integer dim, Span< string const > labels)=0 |
Set dimension labels for an array. More... | |
virtual Span< string const > | getDimLabels (integer dim) const =0 |
Get dimension labels of an array. More... | |
Protected Member Functions | |
void | createDataContext (xmlWrapper::xmlNode const &targetNode, xmlWrapper::xmlNodePos const &nodePos) |
Sets the m_dataContext to a DataFileContext by retrieving the attribute file line. More... | |
Protected Attributes | |
string | m_name |
Name of the object that is being wrapped. | |
Group * | m_parent |
Pointer to Group that holds this WrapperBase. | |
int | m_sizedFromParent |
Integer to indicate whether or not this wrapped object should be resized when m_parent is resized. | |
RestartFlags | m_restart_flags |
Flag to determine the restart behavior for this wrapped object. | |
PlotLevel | m_plotLevel |
Flag to store the plotLevel. | |
InputFlags | m_inputFlag |
Flag to store if this wrapped object should be read from input. | |
bool | m_successfulReadFromInput |
Flag to indicate if wrapped object was successfully read from input. | |
string | m_description |
A string description of the wrapped object. | |
string | m_rtTypeName |
A string regex to validate the input values string to parse for the wrapped object. | |
std::set< string > | m_registeringObjects |
A vector of the names of the objects that created this Wrapper. | |
conduit::Node & | m_conduitNode |
A reference to the corresponding conduit::Node. | |
std::unique_ptr< DataContext > | m_dataContext |
A DataContext object that can helps to contextualize this Group. | |
Base class for all wrappers containing common operations.
Definition at line 55 of file WrapperBase.hpp.
|
explicit |
Constructor.
[in] | name | name of the object |
[in] | parent | pointer to Group that holds this WrapperBase |
[in] | rtTypeName | the name of the rtType to use (given by rtType::CustomTypes or rtType::getTypeName()) |
|
pure virtual |
Push the data in the wrapper into a Conduit blueprint field.
fields | The Conduit Node containg the blueprint fields. |
name | The name of the field. |
topology | The topology associated with the field. |
componentNames | The name of the components, if not specified they are auto generated. |
Implemented in geos::dataRepository::Wrapper< T >.
|
inline |
Add up more text to the existing description string of the wrapper.
description | the description to add to the end of the previous one. |
Definition at line 517 of file WrapperBase.hpp.
|
pure virtual |
Create a new Wrapper with values averaged over the second dimension.
name | The name to give the new wrapper. |
group | The group to hang the new Wrapper from. |
group
. Implemented in geos::dataRepository::Wrapper< T >.
|
pure virtual |
Implemented in geos::dataRepository::Wrapper< T >.
|
pure virtual |
Implemented in geos::dataRepository::Wrapper< T >.
|
pure virtual |
Creates a clone of *this
WrapperBase.
[in] | name | name of the clone |
[in] | parent | parent Group that will hold this clone |
The overridden function will create a copy of the derived Wrapper<T> the using the provided values of name and parent to differentiate itself from the source.
Implemented in geos::dataRepository::Wrapper< T >.
|
pure virtual |
Calls T::copy(sourceIndex, destIndex)
[in] | sourceIndex | index to copy from |
[in] | destIndex | index to copy to |
Implemented in geos::dataRepository::Wrapper< T >.
|
pure virtual |
Copy the the data contained in another wrapper into this wrapper.
source | The wrapper that holds the data to copy. |
Implemented in geos::dataRepository::Wrapper< T >.
|
pure virtual |
Copies the contents of a Wrapper into *this.
[in] | source | The wrapper to copy |
Implemented in geos::dataRepository::Wrapper< T >.
|
virtual |
Copy attributes from another wrapper.
[in] | source | the source wrapper, must wrap the same type T |
Reimplemented in geos::dataRepository::Wrapper< T >.
|
protected |
Sets the m_dataContext to a DataFileContext by retrieving the attribute file line.
targetNode | the node containing this wrapper source attribute. |
nodePos | the xml node position of the node |
string geos::dataRepository::WrapperBase::dumpInputOptions | ( | bool const | outputHeader | ) | const |
outputHeader | If true outputs the table header, otherwise just outputs a row. |
|
pure virtual |
Implemented in geos::dataRepository::Wrapper< T >.
|
pure virtual |
Calls T::erase(indicesToErase)
[in] | indicesToErase | indices to erase |
Implemented in geos::dataRepository::Wrapper< T >.
|
inline |
Definition at line 450 of file WrapperBase.hpp.
|
pure virtual |
Return a string representing the default value.
Implemented in geos::dataRepository::Wrapper< T >.
|
inline |
Get the description string of the wrapper.
Definition at line 527 of file WrapperBase.hpp.
|
pure virtual |
Get dimension labels of an array.
dim | dimension index (must be less than number of array dimensions) |
An error is raised if wrapped type is not LvArray::Array.
Implemented in geos::dataRepository::Wrapper< T >.
|
pure virtual |
Get a description of the wrapped data for time history collection/output.
packCount | The number of indices from the wrapped data to collect, |
Implemented in geos::dataRepository::Wrapper< T >.
|
inline |
Get the InputFlag of the wrapper.
Definition at line 486 of file WrapperBase.hpp.
|
inline |
|
inline |
Definition at line 456 of file WrapperBase.hpp.
|
inline |
Definition at line 462 of file WrapperBase.hpp.
string geos::dataRepository::WrapperBase::getPath | ( | ) | const |
|
inline |
Get PlotLevel for this wrapper.
Definition at line 418 of file WrapperBase.hpp.
|
inline |
Get the list of names of groups that registered this wrapper.
Definition at line 544 of file WrapperBase.hpp.
|
inline |
Get the RestartFlags of the wrapper.
Definition at line 401 of file WrapperBase.hpp.
|
inline |
Definition at line 177 of file WrapperBase.hpp.
|
inline |
Returns flag that indicates whether the contents of the wrapper have been successfully read from the input file.
Definition at line 496 of file WrapperBase.hpp.
|
pure virtual |
Get the typeid of T.
Implemented in geos::dataRepository::Wrapper< T >.
|
pure virtual |
Implemented in geos::dataRepository::Wrapper< T >.
|
pure virtual |
Return true iff this wrapper has a valid default value.
Implemented in geos::dataRepository::Wrapper< T >.
|
pure virtual |
Check whether wrapped type is can be packed into a buffer on host or device.
[in] | onDevice | determine whether the wrapper is packable on host vs device |
true
if T
is packable, false
otherwise Implemented in geos::dataRepository::Wrapper< T >.
|
pure virtual |
Read the wrapped data from Conduit.
Implemented in geos::dataRepository::Wrapper< T >.
|
pure virtual |
Calls T::move(space, touch)
[in] | space | A CHAI execution space to move the data into |
[in] | touch | whether to register a touch in target space |
Implemented in geos::dataRepository::Wrapper< T >.
|
pure virtual |
Return the number of components in a multidimensional array.
Implemented in geos::dataRepository::Wrapper< T >.
|
pure virtual |
Return the number of dimensions of the array.
Implemented in geos::dataRepository::Wrapper< T >.
|
inline |
Concrete implementation of the packing method.
DO_PACKING | A template parameter to discriminate between actually packing or only computing the packing size. |
[in,out] | buffer | The buffer that will receive the packed data. |
[in] | withMetadata | Whether to pack string metadata with the underlying data. |
[in] | onDevice | Whether to use device-based packing functions (buffer must be either pinned or a device pointer) |
[out] | events | A collection of events to poll for completion of async packing kernels ( device packing is incomplete until all events are finalized ) |
Definition at line 303 of file WrapperBase.hpp.
|
inline |
Concrete implementation of the packing by index method.
DO_PACKING | A template parameter to discriminate between actually packing or only computing the packing size. |
[in,out] | buffer | The buffer that will receive the packed data. |
[in] | packList | The element we want packed. |
[in] | withMetadata | Whether to pack string metadata with the underlying data. |
[in] | onDevice | Whether to use device-based packing functions (buffer must be either pinned or a device pointer) |
[out] | events | A collection of events to poll for completion of async packing kernels ( device packing is incomplete until all events are finalized ) |
Definition at line 325 of file WrapperBase.hpp.
|
pure virtual |
Push the data in the wrapper into a Conduit Blueprint mcarray.
node | The Conduit Node to put the data into. |
componentNames | The names of the components, if not specified they are auto generated. |
Implemented in geos::dataRepository::Wrapper< T >.
|
pure virtual |
Initialize the wrapper from the input xml node.
targetNode | the xml node to initialize from. |
nodePos | the target node position, typically obtained with xmlDocument::getNodePosition(). |
Implemented in geos::dataRepository::Wrapper< T >.
|
pure virtual |
Calls T::reserve( newCapacity ) if it exists, otherwise a no-op.
[in] | newCapacity | the new capacity of the T. |
Implemented in geos::dataRepository::Wrapper< T >.
|
pure virtual |
Calls T::resize( num_dims, dims )
[in] | num_dims | number of dimensions in T |
[in] | dims | pointer to the new dims |
Implemented in geos::dataRepository::Wrapper< T >.
|
pure virtual |
Calls T::resize(newsize) if it exists.
[in] | newsize | parameter to pass to T::resize(newsize) |
Implemented in geos::dataRepository::Wrapper< T >.
|
inline |
Set the description string of the wrapper.
description | the description |
Definition at line 506 of file WrapperBase.hpp.
|
pure virtual |
Set dimension labels for an array.
dim | dimension index (must be less than number of array dimensions) |
labels | array of labels |
this
(for convenience of call chaining)Dimension labels are typically used in visualization output to give context to plots of multidimensional data, such as fluid component and phase names. This method provides a way for physics modules (solvers and constitutive models) to communicate meaningful labels to output drivers (such as VTK and Silo).
An error is raised if wrapped type is not LvArray::Array.
Implemented in geos::dataRepository::Wrapper< T >.
|
inline |
Set the InputFlag of the wrapper.
input | the new InputFlags value |
Definition at line 470 of file WrapperBase.hpp.
|
inline |
Set the PlotLevel of the wrapper.
flag | the new PlotLevel value |
Definition at line 425 of file WrapperBase.hpp.
|
inline |
Add a new name to the list of groups that register this wrapper.
objectName | name of the registering object |
Definition at line 554 of file WrapperBase.hpp.
|
inline |
Set the RestartFlags of the wrapper.
flags | the new RestartFlags value |
Definition at line 408 of file WrapperBase.hpp.
|
inline |
override the rtType to use when parsing an input value to the wrapped object. It can be useful to change the used regex to validate the input value.
rtTypeName | the name of the rtType to use (given by rtType::CustomTypes or rtType::getTypeName()) |
Definition at line 186 of file WrapperBase.hpp.
|
inline |
Set whether this wrapper is resized when its parent is resized.
val | an int that is converted into a bool |
Definition at line 391 of file WrapperBase.hpp.
|
pure virtual |
|
inline |
Check whether this wrapper is resized when its parent is resized.
true
if wrapper is resized with parent group, false
otherwise Definition at line 381 of file WrapperBase.hpp.
|
pure virtual |
Unpack the entire wrapped object from a buffer.
[in,out] | buffer | the binary buffer pointer, advanced upon completion |
[in] | withMetadata | whether to expect string metadata with the underlying data |
[in] | onDevice | whether to use device-based packing functions (buffer must be either pinned or a device pointer) |
[out] | events | a collection of events to poll for completion of async packing kernels ( device packing is incomplete until all events are finalized ) |
buffer_unit_type
units unpacked Implemented in geos::dataRepository::Wrapper< T >.
|
pure virtual |
For indexable types, unpack selected indices of wrapped object from a buffer.
[in,out] | buffer | the binary buffer pointer, advanced upon completion |
[in] | unpackIndices | the list of indices to pack |
[in] | withMetadata | whether to include metadata in the packing |
[in] | onDevice | whether to use device-based packing functions (buffer must be either pinned or a device pointer) |
[out] | events | a collection of events to poll for completion of async packing kernels ( device packing is incomplete until all events are finalized ) |
[in] | op | the operation to perform while unpacking |
buffer_unit_type
units unpacked Implemented in geos::dataRepository::Wrapper< T >.
|
pure virtual |
Implemented in geos::dataRepository::Wrapper< T >.