18 #ifndef GEOS_DATAREPOSITORY_WRAPPERBASE_HPP_
19 #define GEOS_DATAREPOSITORY_WRAPPERBASE_HPP_
22 #include "common/GEOS_RAJA_Interface.hpp"
30 #if defined(GEOS_USE_PYGEOSX)
31 #include "LvArray/src/python/python.hpp"
46 namespace dataRepository
72 string const & rtTypeName );
160 virtual void erase( std::set< localIndex >
const & indicesToErase ) = 0;
167 virtual void move( LvArray::MemorySpace
const space,
bool const touch )
const = 0;
225 string const & topology,
302 template<
bool DO_PACKING >
306 parallelDeviceEvents & events )
const
308 return DO_PACKING ? packPrivate( buffer, withMetadata, onDevice, events ) : packSizePrivate( withMetadata, onDevice, events );
324 template<
bool DO_PACKING >
329 parallelDeviceEvents & events )
const
331 return DO_PACKING ? packByIndexPrivate( buffer, packList, withMetadata, onDevice, events ) : packByIndexSizePrivate( packList, withMetadata, onDevice, events );
348 parallelDeviceEvents & events ) = 0;
367 parallelDeviceEvents & events,
368 MPI_Op op=MPI_REPLACE ) = 0;
574 virtual std::unique_ptr< WrapperBase >
clone(
string const & name,
Group & parent ) = 0;
632 #if defined(USE_TOTALVIEW_OUTPUT)
638 virtual string totalviewTypeName()
const = 0;
645 virtual int setTotalviewDisplay()
const;
649 #if defined(GEOS_USE_PYGEOSX)
654 virtual PyObject * createPythonObject( ) = 0;
661 conduit::Node & getConduitNode()
727 virtual localIndex packPrivate(
buffer_unit_type * & buffer,
bool withMetadata,
bool onDevice, parallelDeviceEvents & events )
const = 0;
740 virtual localIndex packSizePrivate(
bool withMetadata,
bool onDevice, parallelDeviceEvents & events )
const = 0;
759 parallelDeviceEvents & events )
const = 0;
775 parallelDeviceEvents & events )
const = 0;
A minimal class to specify information about time history information being collected and output.
Lightweight non-owning wrapper over a contiguous range of elements.
Base class for all wrappers containing common operations.
InputFlags getInputFlag() const
Get the InputFlag of the wrapper.
virtual localIndex unpack(buffer_unit_type const *&buffer, bool withMetadata, bool onDevice, parallelDeviceEvents &events)=0
Unpack the entire wrapped object from a buffer.
virtual bool hasDefaultValue() const =0
Return true iff this wrapper has a valid default value.
string const & getName() const
Get name of the wrapper.
string const & getDescription() const
Get the description string of the wrapper.
virtual localIndex size() const =0
Calls T::size()
virtual localIndex numArrayComp() const =0
Return the number of components in a multidimensional array.
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.
PlotLevel m_plotLevel
Flag to store the plotLevel.
std::set< string > const & getRegisteringObjects() const
Get the list of names of groups that registered this wrapper.
string const & getRTTypeName() const
virtual bool processInputFile(xmlWrapper::xmlNode const &targetNode, xmlWrapper::xmlNodePos const &nodePos)=0
Initialize the wrapper from the input xml node.
int sizedFromParent() const
Check whether this wrapper is resized when its parent is resized.
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.
RestartFlags getRestartFlags() const
Get the RestartFlags of the wrapper.
WrapperBase & setInputFlag(InputFlags const input)
Set the InputFlag of the wrapper.
virtual void resize(localIndex newsize)=0
Calls T::resize(newsize) if it exists.
WrapperBase(string const &name, Group &parent, string const &rtTypeName)
Constructor.
conduit::Node & m_conduitNode
A reference to the corresponding conduit::Node.
virtual void move(LvArray::MemorySpace const space, bool const touch) const =0
Calls T::move(space, touch)
Group * m_parent
Pointer to Group that holds this WrapperBase.
virtual void erase(std::set< localIndex > const &indicesToErase)=0
Calls T::erase(indicesToErase)
virtual void finishWriting() const =0
Write the wrapped data into Conduit.
int m_sizedFromParent
Integer to indicate whether or not this wrapped object should be resized when m_parent is resized.
DataContext const & getDataContext() const
WrapperBase & setDescription(string const &description)
Set the description string of the wrapper.
virtual void populateMCArray(conduit::Node &node, stdVector< string > const &componentNames={}) const =0
Push the data in the wrapper into a Conduit Blueprint mcarray.
virtual void reserve(localIndex const newCapacity)=0
Calls T::reserve( newCapacity ) if it exists, otherwise a no-op.
virtual WrapperBase & setDimLabels(integer dim, Span< string const > labels)=0
Set dimension labels for an array.
virtual void copyData(WrapperBase const &source)=0
Copy the the data contained in another wrapper into this wrapper.
virtual bool loadFromConduit()=0
Read the wrapped data from Conduit.
WrapperBase & setSizedFromParent(int val)
Set whether this wrapper is resized when its parent is resized.
virtual void resize(int num_dims, localIndex const *const dims)=0
Calls T::resize( num_dims, dims )
virtual localIndex elementByteSize() const =0
virtual void copyWrapperAttributes(WrapperBase const &source)
Copy attributes from another wrapper.
WrapperBase & setRegisteringObjects(string const &objectName)
Add a new name to the list of groups that register this wrapper.
virtual void registerToWrite() const =0
Register the wrapper's data for writing with Conduit.
WrapperBase & setRestartFlags(RestartFlags flags)
Set the RestartFlags of the wrapper.
Group const & getParent() const
string m_rtTypeName
A string regex to validate the input values string to parse for the wrapped object.
WrapperBase & appendDescription(string const &description)
Add up more text to the existing description string of the wrapper.
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.
virtual localIndex capacity() const =0
std::unique_ptr< DataContext > m_dataContext
A DataContext object that can helps to contextualize this Group.
virtual std::unique_ptr< WrapperBase > averageOverSecondDim(string const &name, Group &group) const =0
Create a new Wrapper with values averaged over the second dimension.
void createDataContext(xmlWrapper::xmlNode const &targetNode, xmlWrapper::xmlNodePos const &nodePos)
Sets the m_dataContext to a DataFileContext by retrieving the attribute file line.
bool getSuccessfulReadFromInput() const
Returns flag that indicates whether the contents of the wrapper have been successfully read from the ...
virtual size_t bytesAllocated() const =0
string m_description
A string description of the wrapped object.
PlotLevel getPlotLevel() const
Get PlotLevel for this wrapper.
void resize()
Calls resize(newsize) where newsize is taken from the parent Group.
virtual ~WrapperBase()
Default destructor.
virtual void copy(localIndex const sourceIndex, localIndex const destIndex)=0
Calls T::copy(sourceIndex, destIndex)
bool m_successfulReadFromInput
Flag to indicate if wrapped object was successfully read from input.
virtual bool isPackable(bool onDevice) const =0
Check whether wrapped type is can be packed into a buffer on host or device.
std::set< string > m_registeringObjects
A vector of the names of the objects that created this Wrapper.
virtual Regex const & getTypeRegex() const =0
virtual string getDefaultValueString() const =0
Return a string representing the default value.
virtual std::type_info const & getTypeId() const =0
Get the typeid of T.
virtual void const * voidPointer() const =0
virtual void copyWrapper(WrapperBase const &source)=0
Copies the contents of a Wrapper into *this.
virtual int numArrayDims() const =0
Return the number of dimensions of the array.
WrapperBase & setRTTypeName(string_view rtTypeName)
override the rtType to use when parsing an input value to the wrapped object. It can be useful to cha...
virtual HistoryMetadata getHistoryMetadata(localIndex const packCount) const =0
Get a description of the wrapped data for time history collection/output.
virtual Span< string const > getDimLabels(integer dim) const =0
Get dimension labels of an array.
localIndex pack(buffer_unit_type *&buffer, bool withMetadata, bool onDevice, parallelDeviceEvents &events) const
Concrete implementation of the packing method.
InputFlags m_inputFlag
Flag to store if this wrapped object should be read from input.
string m_name
Name of the object that is being wrapped.
WrapperBase & setPlotLevel(PlotLevel const flag)
Set the PlotLevel of the wrapper.
RestartFlags m_restart_flags
Flag to determine the restart behavior for this wrapped object.
string getPath() const
Return the path to this Wrapper in the data repository.
virtual std::unique_ptr< WrapperBase > clone(string const &name, Group &parent)=0
Creates a clone of *this WrapperBase.
@ OPTIONAL
Optional in input.
@ REQUIRED
Required in input.
@ WRITE
Write into restart.
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
std::int32_t integer
Signed integer type.
@ Node
location is node (like displacements in finite elements)
std::vector< T, Allocator > stdVector
signed char buffer_unit_type
Type stored in communication buffers.
std::string_view string_view
String type.