GEOSX
Public Member Functions | Protected Attributes | List of all members
geosx::dataRepository::WrapperBase Class Referenceabstract

Base class for all wrappers containing common operations. More...

#include <WrapperBase.hpp>

Inheritance diagram for geosx::dataRepository::WrapperBase:
Inheritance graph
[legend]

Public Member Functions

virtual bool hasDefaultValue () const =0
 Return true iff this wrapper has a valid default value. More...
 
virtual std::string getDefaultValueString () const =0
 Return a string representing the default value. More...
 
virtual bool processInputFile (xmlWrapper::xmlNode const &targetNode)=0
 Initialize the wrapper from the input xml node. More...
 
virtual void addBlueprintField (conduit::Node &fields, std::string const &name, std::string const &topology, std::vector< std::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< std::string > const &componentNames={}) const =0
 Push the data in the wrapper into a Conduit Blueprint mcarray. More...
 
virtual std::unique_ptr< WrapperBaseaverageOverSecondDim (std::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 *const parent)
 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 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 move (LvArray::MemorySpace const space, bool const touch) const =0
 Calls T::move(space, touch) More...
 
virtual string typeRegex () const =0
 Calls TypeRegex< T >::get(). 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...
 
virtual localIndex Pack (buffer_unit_type *&buffer, bool withMetadata, bool onDevice) const =0
 Pack the entire wrapped object into a buffer. More...
 
virtual localIndex PackByIndex (buffer_unit_type *&buffer, arrayView1d< localIndex const > const &packList, bool withMetadata, bool onDevice) const =0
 For indexable types, pack selected indices of wrapped object into a buffer. More...
 
virtual localIndex PackSize (bool withMetadata, bool onDevice) const =0
 Get the buffer size needed to pack the entire wrapped object. More...
 
virtual localIndex PackByIndexSize (arrayView1d< localIndex const > const &packList, bool withMetadata, bool onDevice) const =0
 Get the buffer size needed to pack the selected indices wrapped object. More...
 
virtual localIndex Unpack (buffer_unit_type const *&buffer, bool withMetadata, bool onDevice)=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)=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...
 
WrapperBasesetSizedFromParent (int val)
 Set whether this wrapper is resized when its parent is resized. More...
 
RestartFlags getRestartFlags () const
 Get the RestartFlags of the wrapper. More...
 
WrapperBasesetRestartFlags (RestartFlags flags)
 Set the RestartFlags of the wrapper. More...
 
PlotLevel getPlotLevel () const
 Get PlotLevel for this wrapper. More...
 
WrapperBasesetPlotLevel (PlotLevel const flag)
 Set the PlotLevel of the wrapper. More...
 
string const & getName () const
 Get name of the wrapper. More...
 
WrapperBasesetInputFlag (InputFlags const input)
 Set the InputFlag of the wrapper. More...
 
InputFlags getInputFlag () const
 Get the InputFlag of the wrapper. More...
 
WrapperBasesetDescription (string const &description)
 Set the 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...
 
WrapperBasesetRegisteringObjects (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< WrapperBaseclone (string const &name, Group *const 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 & get_typeid () const =0
 Get the typeid of T. More...
 

Protected Attributes

string m_name
 Name of the object that is being wrapped.
 
Groupm_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.
 
string m_description
 A string description of the wrapped object.
 
std::set< stringm_registeringObjects
 A vector of the names of the objects that created this Wrapper.
 
conduit::Node & m_conduitNode
 A reference to the corresponding conduit::Node.
 

Detailed Description

Base class for all wrappers containing common operations.

Definition at line 48 of file WrapperBase.hpp.

Constructor & Destructor Documentation

◆ WrapperBase()

geosx::dataRepository::WrapperBase::WrapperBase ( string const &  name,
Group *const  parent 
)
explicit

Constructor.

Parameters
[in]namename of the object
[in]parentpointer to Group that holds this WrapperBase

Member Function Documentation

◆ addBlueprintField()

virtual void geosx::dataRepository::WrapperBase::addBlueprintField ( conduit::Node &  fields,
std::string const &  name,
std::string const &  topology,
std::vector< std::string > const &  componentNames = {} 
) const
pure virtual

Push the data in the wrapper into a Conduit blueprint field.

Parameters
fieldsThe Conduit Node containg the blueprint fields.
nameThe name of the field.
topologyThe topology associated with the field.
componentNamesThe name of the components, if not specified they are auto generated.
Note
This wrapper must hold an LvArray::Array.

Implemented in geosx::dataRepository::Wrapper< T >.

◆ averageOverSecondDim()

virtual std::unique_ptr< WrapperBase > geosx::dataRepository::WrapperBase::averageOverSecondDim ( std::string const &  name,
Group group 
) const
pure virtual

Create a new Wrapper with values averaged over the second dimension.

Parameters
nameThe name to give the new wrapper.
groupThe group to hang the new Wrapper from.
Returns
The newly created wrapper.
Note
This Wrapper must hold an LvArray::Array of dimension 2 or greater.
The new Wrapper is not registered with group.

Implemented in geosx::dataRepository::Wrapper< T >.

◆ capacity()

virtual localIndex geosx::dataRepository::WrapperBase::capacity ( ) const
pure virtual
Returns
T::capacity() if it exists, other wise calls size().

Implemented in geosx::dataRepository::Wrapper< T >.

◆ clone()

virtual std::unique_ptr< WrapperBase > geosx::dataRepository::WrapperBase::clone ( string const &  name,
Group *const  parent 
)
pure virtual

Creates a clone of *this WrapperBase.

Parameters
[in]namename of the clone
[in]parentparent Group that will hold this clone
Returns

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 geosx::dataRepository::Wrapper< T >.

◆ copy()

virtual void geosx::dataRepository::WrapperBase::copy ( localIndex const  sourceIndex,
localIndex const  destIndex 
)
pure virtual

Calls T::copy(sourceIndex, destIndex)

Parameters
[in]sourceIndexindex to copy from
[in]destIndexindex to copy to

Implemented in geosx::dataRepository::Wrapper< T >.

◆ copyData()

virtual void geosx::dataRepository::WrapperBase::copyData ( WrapperBase const &  source)
pure virtual

Copy the the data contained in another wrapper into this wrapper.

Parameters
sourceThe wrapper that holds the data to copy.

Implemented in geosx::dataRepository::Wrapper< T >.

◆ copyWrapper()

virtual void geosx::dataRepository::WrapperBase::copyWrapper ( WrapperBase const &  source)
pure virtual

Copies the contents of a Wrapper into *this.

Parameters
[in]sourceThe wrapper to copy

Implemented in geosx::dataRepository::Wrapper< T >.

◆ copyWrapperAttributes()

virtual void geosx::dataRepository::WrapperBase::copyWrapperAttributes ( WrapperBase const &  source)
virtual

Copy attributes from another wrapper.

Parameters
[in]sourcethe source wrapper, must wrap the same type T

Reimplemented in geosx::dataRepository::Wrapper< T >.

◆ dumpInputOptions()

string geosx::dataRepository::WrapperBase::dumpInputOptions ( bool const  outputHeader) const
Returns
a table formatted string containing the input options.
Parameters
outputHeaderIf true outputs the table header, otherwise just outputs a row.

◆ elementByteSize()

virtual localIndex geosx::dataRepository::WrapperBase::elementByteSize ( ) const
pure virtual
Returns
the number of bytes in an object of unit size. Ie elementByteSize() * size() gives the size of memory pointed to by voidPointer().

Implemented in geosx::dataRepository::Wrapper< T >.

◆ get_typeid()

virtual std::type_info const& geosx::dataRepository::WrapperBase::get_typeid ( ) const
pure virtual

Get the typeid of T.

Returns
type_info of the wrapped type "typeid(T)"

Implemented in geosx::dataRepository::Wrapper< T >.

◆ getDefaultValueString()

virtual std::string geosx::dataRepository::WrapperBase::getDefaultValueString ( ) const
pure virtual

Return a string representing the default value.

Returns
A string representing the default value.

Implemented in geosx::dataRepository::Wrapper< T >.

◆ getDescription()

string const& geosx::dataRepository::WrapperBase::getDescription ( ) const
inline

Get the description string of the wrapper.

Returns
this wrapper's description string

Definition at line 429 of file WrapperBase.hpp.

◆ getHistoryMetadata()

virtual HistoryMetadata geosx::dataRepository::WrapperBase::getHistoryMetadata ( localIndex const  packCount) const
pure virtual

Get a description of the wrapped data for time history collection/output.

Parameters
packCountThe number of indices from the wrapped data to collect,
Returns
HistoryMetadata about the wrapped type

Implemented in geosx::dataRepository::Wrapper< T >.

◆ getInputFlag()

InputFlags geosx::dataRepository::WrapperBase::getInputFlag ( ) const
inline

Get the InputFlag of the wrapper.

Returns
this wrapper's input flags

Definition at line 409 of file WrapperBase.hpp.

◆ getName()

string const& geosx::dataRepository::WrapperBase::getName ( ) const
inline

Get name of the wrapper.

Returns
name of the wrapper

Definition at line 384 of file WrapperBase.hpp.

◆ getPlotLevel()

PlotLevel geosx::dataRepository::WrapperBase::getPlotLevel ( ) const
inline

Get PlotLevel for this wrapper.

Returns
this wrapper's plot level

Definition at line 367 of file WrapperBase.hpp.

◆ getRegisteringObjects()

std::set< string > const& geosx::dataRepository::WrapperBase::getRegisteringObjects ( ) const
inline

Get the list of names of groups that registered this wrapper.

Returns
vector of object names

Definition at line 446 of file WrapperBase.hpp.

◆ getRestartFlags()

RestartFlags geosx::dataRepository::WrapperBase::getRestartFlags ( ) const
inline

Get the RestartFlags of the wrapper.

Returns
this wrapper's restart flags

Definition at line 350 of file WrapperBase.hpp.

◆ hasDefaultValue()

virtual bool geosx::dataRepository::WrapperBase::hasDefaultValue ( ) const
pure virtual

Return true iff this wrapper has a valid default value.

Returns
True iff this wrapper has a valid default value.

Implemented in geosx::dataRepository::Wrapper< T >.

◆ isPackable()

virtual bool geosx::dataRepository::WrapperBase::isPackable ( bool  onDevice) const
pure virtual

Check whether wrapped type is can be packed into a buffer on host or device.

Parameters
[in]onDevicedetermine whether the wrapper is packable on host vs device
Returns
true if T is packable, false otherwise

Implemented in geosx::dataRepository::Wrapper< T >.

◆ loadFromConduit()

virtual bool geosx::dataRepository::WrapperBase::loadFromConduit ( )
pure virtual

Read the wrapped data from Conduit.

Returns
True iff the Wrapper read in data.

Implemented in geosx::dataRepository::Wrapper< T >.

◆ move()

virtual void geosx::dataRepository::WrapperBase::move ( LvArray::MemorySpace const  space,
bool const  touch 
) const
pure virtual

Calls T::move(space, touch)

Parameters
[in]spaceA CHAI execution space to move the data into
[in]touchwhether to register a touch in target space

Implemented in geosx::dataRepository::Wrapper< T >.

◆ Pack()

virtual localIndex geosx::dataRepository::WrapperBase::Pack ( buffer_unit_type *&  buffer,
bool  withMetadata,
bool  onDevice 
) const
pure virtual

Pack the entire wrapped object into a buffer.

Parameters
[in,out]bufferthe binary buffer pointer, advanced upon completion
[in]withMetadatawhether to pack string metadata with the underlying data
[in]onDevicewhether to use device-based packing functions (buffer must be either pinned or a device pointer)
Returns
the number of buffer_unit_type units packed

Implemented in geosx::dataRepository::Wrapper< T >.

◆ PackByIndex()

virtual localIndex geosx::dataRepository::WrapperBase::PackByIndex ( buffer_unit_type *&  buffer,
arrayView1d< localIndex const > const &  packList,
bool  withMetadata,
bool  onDevice 
) const
pure virtual

For indexable types, pack selected indices of wrapped object into a buffer.

Parameters
[in,out]bufferthe binary buffer pointer, advanced upon completion
[in]packListthe list of indices to pack
[in]withMetadatawhether to pack string metadata with the underlying data
[in]onDevicewhether to use device-based packing functions (buffer must be either pinned or a device pointer)
Returns
the number of buffer_unit_type units packed

Implemented in geosx::dataRepository::Wrapper< T >.

◆ PackByIndexSize()

virtual localIndex geosx::dataRepository::WrapperBase::PackByIndexSize ( arrayView1d< localIndex const > const &  packList,
bool  withMetadata,
bool  onDevice 
) const
pure virtual

Get the buffer size needed to pack the selected indices wrapped object.

Parameters
[in]packListthe list of indices to pack
[in]withMetadatawhether to pack string metadata with the underlying data
[in]onDevicewhether to use device-based packing functions (buffer must be either pinned or a device pointer)
Returns
the number of buffer_unit_type units needed to pack

Implemented in geosx::dataRepository::Wrapper< T >.

◆ PackSize()

virtual localIndex geosx::dataRepository::WrapperBase::PackSize ( bool  withMetadata,
bool  onDevice 
) const
pure virtual

Get the buffer size needed to pack the entire wrapped object.

Parameters
[in]withMetadatawhether to pack string metadata with the underlying data
[in]onDevicewhether to use device-based packing functions this matters as the size on device differs from the size on host as we pack less metadata on device
Returns
the number of buffer_unit_type units needed to pack

Implemented in geosx::dataRepository::Wrapper< T >.

◆ populateMCArray()

virtual void geosx::dataRepository::WrapperBase::populateMCArray ( conduit::Node &  node,
std::vector< std::string > const &  componentNames = {} 
) const
pure virtual

Push the data in the wrapper into a Conduit Blueprint mcarray.

Parameters
nodeThe Conduit Node to put the data into.
componentNamesThe names of the components, if not specified they are auto generated.
Note
This wrapper must hold an LvArray::Array.

Implemented in geosx::dataRepository::Wrapper< T >.

◆ processInputFile()

virtual bool geosx::dataRepository::WrapperBase::processInputFile ( xmlWrapper::xmlNode const &  targetNode)
pure virtual

Initialize the wrapper from the input xml node.

Parameters
targetNodethe xml node to initialize from.
Returns
True iff the wrapper initialized itself from the file.

Implemented in geosx::dataRepository::Wrapper< T >.

◆ reserve()

virtual void geosx::dataRepository::WrapperBase::reserve ( localIndex const  newCapacity)
pure virtual

Calls T::reserve( newCapacity ) if it exists, otherwise a no-op.

Parameters
[in]newCapacitythe new capacity of the T.

Implemented in geosx::dataRepository::Wrapper< T >.

◆ resize() [1/2]

virtual void geosx::dataRepository::WrapperBase::resize ( int  num_dims,
localIndex const *const  dims 
)
pure virtual

Calls T::resize( num_dims, dims )

Parameters
[in]num_dimsnumber of dimensions in T
[in]dimspointer to the new dims

Implemented in geosx::dataRepository::Wrapper< T >.

◆ resize() [2/2]

virtual void geosx::dataRepository::WrapperBase::resize ( localIndex  newsize)
pure virtual

Calls T::resize(newsize) if it exists.

Parameters
[in]newsizeparameter to pass to T::resize(newsize)

Implemented in geosx::dataRepository::Wrapper< T >.

◆ setDescription()

WrapperBase* geosx::dataRepository::WrapperBase::setDescription ( string const &  description)
inline

Set the description string of the wrapper.

Parameters
descriptionthe description
Returns
a pointer to this wrapper

Definition at line 419 of file WrapperBase.hpp.

◆ setInputFlag()

WrapperBase* geosx::dataRepository::WrapperBase::setInputFlag ( InputFlags const  input)
inline

Set the InputFlag of the wrapper.

Parameters
inputthe new InputFlags value
Returns
a pointer to this wrapper

Definition at line 394 of file WrapperBase.hpp.

◆ setPlotLevel()

WrapperBase* geosx::dataRepository::WrapperBase::setPlotLevel ( PlotLevel const  flag)
inline

Set the PlotLevel of the wrapper.

Parameters
flagthe new PlotLevel value
Returns
a pointer to this wrapper

Definition at line 374 of file WrapperBase.hpp.

◆ setRegisteringObjects()

WrapperBase* geosx::dataRepository::WrapperBase::setRegisteringObjects ( string const &  objectName)
inline

Add a new name to the list of groups that register this wrapper.

Parameters
objectNamename of the registering object
Returns
pointer to this wrapper

Definition at line 456 of file WrapperBase.hpp.

◆ setRestartFlags()

WrapperBase* geosx::dataRepository::WrapperBase::setRestartFlags ( RestartFlags  flags)
inline

Set the RestartFlags of the wrapper.

Parameters
flagsthe new RestartFlags value
Returns
a pointer to this wrapper

Definition at line 357 of file WrapperBase.hpp.

◆ setSizedFromParent()

WrapperBase* geosx::dataRepository::WrapperBase::setSizedFromParent ( int  val)
inline

Set whether this wrapper is resized when its parent is resized.

Parameters
valan int that is converted into a bool
Returns
a pointer to this wrapper

Definition at line 340 of file WrapperBase.hpp.

◆ size()

virtual localIndex geosx::dataRepository::WrapperBase::size ( ) const
pure virtual

Calls T::size()

Returns
result of T::size()

Implemented in geosx::dataRepository::Wrapper< T >.

◆ sizedFromParent()

int geosx::dataRepository::WrapperBase::sizedFromParent ( ) const
inline

Check whether this wrapper is resized when its parent is resized.

Returns
true if wrapper is resized with parent group, false otherwise

Definition at line 330 of file WrapperBase.hpp.

◆ typeRegex()

virtual string geosx::dataRepository::WrapperBase::typeRegex ( ) const
pure virtual

Calls TypeRegex< T >::get().

Returns
regex used to validate inputs of wrapped type

Implemented in geosx::dataRepository::Wrapper< T >.

◆ Unpack()

virtual localIndex geosx::dataRepository::WrapperBase::Unpack ( buffer_unit_type const *&  buffer,
bool  withMetadata,
bool  onDevice 
)
pure virtual

Unpack the entire wrapped object from a buffer.

Parameters
[in,out]bufferthe binary buffer pointer, advanced upon completion
[in]withMetadatawhether to expect string metadata with the underlying data
[in]onDevicewhether to use device-based packing functions (buffer must be either pinned or a device pointer)
Returns
the number of buffer_unit_type units unpacked

Implemented in geosx::dataRepository::Wrapper< T >.

◆ UnpackByIndex()

virtual localIndex geosx::dataRepository::WrapperBase::UnpackByIndex ( buffer_unit_type const *&  buffer,
arrayView1d< localIndex const > const &  unpackIndices,
bool  withMetadata,
bool  onDevice 
)
pure virtual

For indexable types, unpack selected indices of wrapped object from a buffer.

Parameters
[in,out]bufferthe binary buffer pointer, advanced upon completion
[in]unpackIndicesthe list of indices to pack
[in]withMetadatawhether to include metadata in the packing
[in]onDevicewhether to use device-based packing functions (buffer must be either pinned or a device pointer)
Returns
the number of buffer_unit_type units unpacked

Implemented in geosx::dataRepository::Wrapper< T >.

◆ voidPointer()

virtual void const* geosx::dataRepository::WrapperBase::voidPointer ( ) const
pure virtual
Returns
a const void pointer to the data.

Implemented in geosx::dataRepository::Wrapper< T >.


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