GEOS
|
#include <Wrapper.hpp>
Public Types | |
using | TYPE = T |
Alias for the wrapped type T . | |
Public Member Functions | |
virtual HistoryMetadata | getHistoryMetadata (localIndex const packCount=-1) const override final |
Get a description of the wrapped data for time history collection/output. More... | |
void const * | voidPointer () const override |
virtual localIndex | elementByteSize () const override |
virtual size_t | bytesAllocated () const override final |
Constructors, destructor, copy/move assignment | |
Wrapper (string const &name, Group &parent) | |
Constructor that creates a new instance of wrapped type. More... | |
Wrapper (string const &name, Group &parent, std::unique_ptr< T > object) | |
Constructor that takes ownership of an existing object. More... | |
Wrapper (string const &name, Group &parent, T *object) | |
Constructor that does not take ownership of an existing object. More... | |
virtual | ~Wrapper () noexcept override |
Default destructor. More... | |
Wrapper & | operator= (Wrapper const &source) |
Copy Assignment Operator. More... | |
Wrapper & | operator= (Wrapper &&source) |
Move Assignment Operator. More... | |
Packing/unpacking methods. | |
virtual bool | isPackable (bool onDevice) const override |
Check whether wrapped type is can be packed into a buffer on host or device. More... | |
virtual localIndex | unpack (buffer_unit_type const *&buffer, bool withMetadata, bool onDevice, parallelDeviceEvents &events) override final |
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) override final |
For indexable types, unpack selected indices of wrapped object from a buffer. More... | |
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 override |
Calls T::size() More... | |
virtual void | resize (int ndims, localIndex const *const dims) override |
Calls T::resize( num_dims, dims ) More... | |
virtual void | reserve (localIndex const newCapacity) override |
Calls T::reserve( newCapacity ) if it exists, otherwise a no-op. More... | |
virtual localIndex | capacity () const override |
virtual void | resize (localIndex const newSize) override |
Calls T::resize(newsize) if it exists. More... | |
virtual void | copy (localIndex const sourceIndex, localIndex const destIndex) override |
Calls T::copy(sourceIndex, destIndex) More... | |
virtual void | copyData (WrapperBase const &source) override |
Copy the the data contained in another wrapper into this wrapper. More... | |
void | erase (std::set< localIndex > const &indicesToErase) override |
Calls T::erase(indicesToErase) More... | |
virtual void | move (LvArray::MemorySpace const space, bool const touch) const override |
Calls T::move(space, touch) More... | |
virtual Regex const & | getTypeRegex () const override |
Methods for wrapped value data access | |
T & | reference () |
Accessor for m_data. More... | |
GEOS_DECLTYPE_AUTO_RETURN | reference () const |
const Accessor for m_data More... | |
template<typename _T = T, typename = std::enable_if_t< traits::HasMemberFunction_toView< _T > >> | |
GEOS_DECLTYPE_AUTO_RETURN | referenceAsView () |
Provide access to wrapped object converted to a view, if possible. More... | |
template<typename _T = T, typename = std::enable_if_t< !traits::HasMemberFunction_toView< _T > >> | |
T & | referenceAsView () |
Provide access to wrapped object converted to a view, if possible. More... | |
template<typename _T = T, typename = std::enable_if_t< traits::HasMemberFunction_toView< _T > >> | |
GEOS_DECLTYPE_AUTO_RETURN | referenceAsView () const |
Provide access to wrapped object converted to a view, if possible. More... | |
template<typename _T = T, typename = std::enable_if_t< !traits::HasMemberFunction_toView< _T > >> | |
T const & | referenceAsView () const |
Provide access to wrapped object converted to a view, if possible. More... | |
Methods to manipulate default value for wrapped object | |
virtual bool | hasDefaultValue () const final override |
Return true iff this wrapper has a valid default value. More... | |
template<typename U = T> | |
DefaultValue< T > const & | getDefaultValueStruct () const |
Accessor for m_default. More... | |
template<typename U = T> | |
std::enable_if_t< DefaultValue< U >::has_default_value, typename DefaultValue< U >::value_type const & > | getDefaultValue () const |
Accessor for default value. More... | |
template<typename U = T> | |
std::enable_if_t< DefaultValue< U >::has_default_value, Wrapper< T > & > | setDefaultValue (typename DefaultValue< U >::value_type const &defaultVal) |
Setter for default value. More... | |
template<typename U = T> | |
std::enable_if_t< !traits::is_array< U > &&DefaultValue< U >::has_default_value, Wrapper< T > & > | setApplyDefaultValue (typename DefaultValue< U >::value_type const &defaultVal) |
Set and apply for default value. More... | |
template<typename U = T> | |
std::enable_if_t< traits::is_array< U > &&DefaultValue< U >::has_default_value, Wrapper< T > & > | setApplyDefaultValue (typename DefaultValue< U >::value_type const &defaultVal) |
Set and apply for default value. More... | |
virtual string | getDefaultValueString () const override |
Return a string representing the default value. More... | |
virtual bool | processInputFile (xmlWrapper::xmlNode const &targetNode, xmlWrapper::xmlNodePos const &nodePos) override |
Initialize the wrapper from the input xml node. More... | |
void | setName () |
DO_NOT_DOCUMENT. More... | |
void | addBlueprintField (conduit::Node &fields, string const &name, string const &topology, stdVector< string > const &componentNames={}) const override |
void | populateMCArray (conduit::Node &node, stdVector< string > const &componentNames={}) const override |
std::unique_ptr< WrapperBase > | averageOverSecondDim (string const &name, Group &group) const override |
void | registerToWrite () const override |
Register the wrapper's data for writing with Conduit. | |
void | finishWriting () const override |
Write the wrapped data into Conduit. | |
bool | loadFromConduit () override |
Read the wrapped data from Conduit. More... | |
Overridden setters | |
Setters that replace (hide) corresponding non-virtual functions in WrapperBase with the goal of returning Wrapper<T> pointers rather than WrapperBase pointers. | |
Wrapper< T > & | setSizedFromParent (int val) |
Set whether this wrapper is resized when its parent is resized. More... | |
Wrapper< T > & | setRestartFlags (RestartFlags flags) |
Set the RestartFlags of the wrapper. More... | |
Wrapper< T > & | setPlotLevel (PlotLevel const flag) |
Set the PlotLevel of the wrapper. More... | |
Wrapper< T > & | setInputFlag (InputFlags const input) |
Set the InputFlag of the wrapper. More... | |
Wrapper< T > & | setDescription (string const &description) |
Set the description string of the wrapper. More... | |
Wrapper< T > & | appendDescription (string const &description) |
Add up more text to the existing description string of the wrapper. More... | |
Wrapper< T > & | setRegisteringObjects (string const &objectName) |
Add a new name to the list of groups that register this wrapper. More... | |
Wrapper< T > & | 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... | |
![]() | |
virtual void | addBlueprintField (conduit::Node &fields, string const &name, string const &topology, stdVector< string > const &componentNames={}) const =0 |
Push the data in the wrapper into a Conduit blueprint field. More... | |
virtual void | populateMCArray (conduit::Node &node, stdVector< 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... | |
WrapperBase (string const &name, Group &parent, string const &rtTypeName) | |
Constructor. More... | |
virtual | ~WrapperBase () |
Default destructor. | |
void | resize () |
Calls resize(newsize) where newsize is taken from the parent Group. | |
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... | |
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... | |
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... | |
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... | |
virtual std::unique_ptr< WrapperBase > | clone (string const &name, Group &parent)=0 |
Creates a clone of *this WrapperBase. More... | |
virtual WrapperBase & | setDimLabels (integer dim, Span< string const > labels)=0 |
Set dimension labels for an array. More... | |
Miscellaneous | |
virtual std::unique_ptr< WrapperBase > | clone (string const &name, Group &parent) override |
virtual void | copyWrapper (WrapperBase const &source) override |
Copies the contents of a Wrapper into *this. More... | |
virtual void | copyWrapperAttributes (WrapperBase const &source) override |
Copy attributes from another wrapper. More... | |
virtual const std::type_info & | getTypeId () const noexcept override |
Get the typeid of T. More... | |
virtual int | numArrayDims () const override |
Return the number of dimensions of the array. More... | |
virtual localIndex | numArrayComp () const override |
Return the number of components in a multidimensional array. More... | |
virtual Wrapper & | setDimLabels (integer const dim, Span< string const > const labels) override |
virtual Span< string const > | getDimLabels (integer const dim) const override |
Get dimension labels of an array. More... | |
static Wrapper & | cast (WrapperBase &wrapper) |
Downcast base to a typed wrapper. More... | |
static Wrapper< T > const & | cast (WrapperBase const &wrapper) |
Downcast base to a const typed wrapper. More... | |
Additional Inherited Members | |
![]() | |
void | createDataContext (xmlWrapper::xmlNode const &targetNode, xmlWrapper::xmlNodePos const &nodePos) |
Sets the m_dataContext to a DataFileContext by retrieving the attribute file line. More... | |
![]() | |
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. | |
Templated class to serve as a wrapper to arbitrary objects.
T | is any type that is to be wrapped by Wrapper |
Definition at line 57 of file Wrapper.hpp.
|
inlineexplicit |
Constructor that creates a new instance of wrapped type.
name | name of the object |
parent | parent group which owns the Wrapper |
Definition at line 76 of file Wrapper.hpp.
|
inlineexplicit |
Constructor that takes ownership of an existing object.
name | name of the object |
parent | parent group that owns the Wrapper |
object | object that is being wrapped by the Wrapper |
Definition at line 98 of file Wrapper.hpp.
|
inlineexplicit |
Constructor that does not take ownership of an existing object.
name | name of the object |
parent | parent group that owns the Wrapper |
object | object that is being wrapped by the Wrapper |
Definition at line 121 of file Wrapper.hpp.
|
inlineoverridevirtualnoexcept |
Default destructor.
Deletes wrapped object if the wrapper is owning
Definition at line 143 of file Wrapper.hpp.
|
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 907 of file Wrapper.hpp.
|
inlinefinaloverridevirtual |
Implements geos::dataRepository::WrapperBase.
Definition at line 371 of file Wrapper.hpp.
|
inlineoverridevirtual |
Implements geos::dataRepository::WrapperBase.
Definition at line 404 of file Wrapper.hpp.
|
inlinestatic |
Downcast base to a typed wrapper.
wrapper | the base wrapper reference |
wrapper
must be an instance of Wrapper<T> wrapper
cast to a typed wrapper. Definition at line 221 of file Wrapper.hpp.
|
inlinestatic |
Downcast base to a const typed wrapper.
wrapper | the base wrapper reference |
wrapper
must be an instance of Wrapper<T> wrapper
cast to a typed wrapper. Definition at line 234 of file Wrapper.hpp.
|
inlineoverridevirtual |
Calls T::copy(sourceIndex, destIndex)
[in] | sourceIndex | index to copy from |
[in] | destIndex | index to copy to |
Implements geos::dataRepository::WrapperBase.
Definition at line 456 of file Wrapper.hpp.
|
inlineoverridevirtual |
Copy the the data contained in another wrapper into this wrapper.
source | The wrapper that holds the data to copy. |
Implements geos::dataRepository::WrapperBase.
Definition at line 463 of file Wrapper.hpp.
|
inlineoverridevirtual |
Copies the contents of a Wrapper into *this.
[in] | source | The wrapper to copy |
Implements geos::dataRepository::WrapperBase.
Definition at line 192 of file Wrapper.hpp.
|
inlineoverridevirtual |
Copy attributes from another wrapper.
[in] | source | the source wrapper, must wrap the same type T |
Reimplemented from geos::dataRepository::WrapperBase.
Definition at line 200 of file Wrapper.hpp.
|
inlineoverridevirtual |
Implements geos::dataRepository::WrapperBase.
Definition at line 368 of file Wrapper.hpp.
|
inlineoverridevirtual |
Calls T::erase(indicesToErase)
[in] | indicesToErase | indices to erase |
Implements geos::dataRepository::WrapperBase.
Definition at line 562 of file Wrapper.hpp.
|
inline |
|
inlineoverridevirtual |
Return a string representing the default value.
Implements geos::dataRepository::WrapperBase.
Definition at line 714 of file Wrapper.hpp.
|
inline |
Accessor for m_default.
Definition at line 653 of file Wrapper.hpp.
|
inlineoverridevirtual |
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.
Implements geos::dataRepository::WrapperBase.
Definition at line 259 of file Wrapper.hpp.
|
inlinefinaloverridevirtual |
Get a description of the wrapped data for time history collection/output.
packCount | The number of indices from the wrapped data to collect, |
Implements geos::dataRepository::WrapperBase.
Definition at line 268 of file Wrapper.hpp.
|
inlineoverridevirtualnoexcept |
Get the typeid of T.
Implements geos::dataRepository::WrapperBase.
Definition at line 210 of file Wrapper.hpp.
|
inlineoverridevirtual |
Implements geos::dataRepository::WrapperBase.
Definition at line 574 of file Wrapper.hpp.
|
inlinefinaloverridevirtual |
Return true iff this wrapper has a valid default value.
Implements geos::dataRepository::WrapperBase.
Definition at line 642 of file Wrapper.hpp.
|
inlineoverridevirtual |
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 Implements geos::dataRepository::WrapperBase.
Definition at line 281 of file Wrapper.hpp.
|
inlineoverridevirtual |
Read the wrapped data from Conduit.
Implements geos::dataRepository::WrapperBase.
Definition at line 829 of file Wrapper.hpp.
|
inlineoverridevirtual |
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 |
Implements geos::dataRepository::WrapperBase.
Definition at line 570 of file Wrapper.hpp.
|
inlineoverridevirtual |
Return the number of components in a multidimensional array.
Implements geos::dataRepository::WrapperBase.
Definition at line 248 of file Wrapper.hpp.
|
inlineoverridevirtual |
Return the number of dimensions of the array.
Implements geos::dataRepository::WrapperBase.
Definition at line 243 of file Wrapper.hpp.
|
inline |
Move Assignment Operator.
source |
Definition at line 169 of file Wrapper.hpp.
|
inline |
Copy Assignment Operator.
source | rhs |
*this
Definition at line 158 of file Wrapper.hpp.
|
inlineoverridevirtual |
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(). |
Implements geos::dataRepository::WrapperBase.
Definition at line 721 of file Wrapper.hpp.
|
inline |
|
inline |
const Accessor for m_data
Definition at line 596 of file Wrapper.hpp.
|
inline |
Provide access to wrapped object converted to a view, if possible.
U | dummy template parameter to enable SFINAE (do not change) |
This is used mainly for LvArray
classes (arrays, etc.) that can convert themselves into views. For other types, a regular reference is returned.
Definition at line 608 of file Wrapper.hpp.
|
inline |
Provide access to wrapped object converted to a view, if possible.
U | dummy template parameter to enable SFINAE (do not change) |
This is used mainly for LvArray
classes (arrays, etc.) that can convert themselves into views. For other types, a regular reference is returned.
Definition at line 615 of file Wrapper.hpp.
|
inline |
Provide access to wrapped object converted to a view, if possible.
U | dummy template parameter to enable SFINAE (do not change) |
This is used mainly for LvArray
classes (arrays, etc.) that can convert themselves into views. For other types, a regular reference is returned.
Definition at line 622 of file Wrapper.hpp.
|
inline |
Provide access to wrapped object converted to a view, if possible.
U | dummy template parameter to enable SFINAE (do not change) |
This is used mainly for LvArray
classes (arrays, etc.) that can convert themselves into views. For other types, a regular reference is returned.
Definition at line 629 of file Wrapper.hpp.
|
inlineoverridevirtual |
Calls T::reserve( newCapacity ) if it exists, otherwise a no-op.
[in] | newCapacity | the new capacity of the T. |
Implements geos::dataRepository::WrapperBase.
Definition at line 397 of file Wrapper.hpp.
|
inlineoverridevirtual |
Calls T::resize( num_dims, dims )
[in] | num_dims | number of dimensions in T |
[in] | dims | pointer to the new dims |
Implements geos::dataRepository::WrapperBase.
Definition at line 390 of file Wrapper.hpp.
|
inlineoverridevirtual |
Calls T::resize(newsize) if it exists.
[in] | newsize | parameter to pass to T::resize(newsize) |
Implements geos::dataRepository::WrapperBase.
Definition at line 411 of file Wrapper.hpp.
|
inline |
Set and apply for default value.
defaultVal | the new default value |
Definition at line 690 of file Wrapper.hpp.
|
inline |
Set and apply for default value.
defaultVal | the new default value |
Definition at line 704 of file Wrapper.hpp.
|
inline |
Setter for default value.
defaultVal | the new default value |
Definition at line 677 of file Wrapper.hpp.
|
inline |
Set the description string of the wrapper.
description | the description |
Definition at line 898 of file Wrapper.hpp.
|
inline |
Set the InputFlag of the wrapper.
input | the new InputFlags value |
Definition at line 889 of file Wrapper.hpp.
|
inline |
DO_NOT_DOCUMENT.
Associate the path to this wrapper with the object being held.
Definition at line 774 of file Wrapper.hpp.
|
inline |
Set the PlotLevel of the wrapper.
flag | the new PlotLevel value |
Definition at line 880 of file Wrapper.hpp.
|
inline |
Add a new name to the list of groups that register this wrapper.
objectName | name of the registering object |
Definition at line 916 of file Wrapper.hpp.
|
inline |
Set the RestartFlags of the wrapper.
flags | the new RestartFlags value |
Definition at line 871 of file Wrapper.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 925 of file Wrapper.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 862 of file Wrapper.hpp.
|
inlineoverridevirtual |
Calls T::size()
Implements geos::dataRepository::WrapperBase.
Definition at line 386 of file Wrapper.hpp.
|
inlinefinaloverridevirtual |
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 Implements geos::dataRepository::WrapperBase.
Definition at line 297 of file Wrapper.hpp.
|
inlinefinaloverridevirtual |
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 Implements geos::dataRepository::WrapperBase.
Definition at line 327 of file Wrapper.hpp.
|
inlineoverridevirtual |
Implements geos::dataRepository::WrapperBase.
Definition at line 364 of file Wrapper.hpp.