20 #ifndef GEOS_DATAREPOSITORY_WRAPPER_HPP_
21 #define GEOS_DATAREPOSITORY_WRAPPER_HPP_
26 #include "LvArray/src/limits.hpp"
28 #include "codingUtilities/SFINAE_Macros.hpp"
29 #include "LvArray/src/Macros.hpp"
30 #include "BufferOps.hpp"
31 #include "BufferOpsDevice.hpp"
33 #include "codingUtilities/traits.hpp"
36 #include "LvArray/src/system.hpp"
41 #include <type_traits>
46 namespace dataRepository
51 using namespace wrapperLimits;
57 template<
typename T >
79 WrapperBase( name, parent, rtTypes::getTypeName( typeid( T ) ) ),
85 if( traits::is_tensorT< T > || std::is_arithmetic< T >::value || traits::is_string< T > )
87 setSizedFromParent( 0 );
101 std::unique_ptr< T >
object ):
102 WrapperBase( name, parent, rtTypes::getTypeName( typeid( T ) ) ),
105 m_data( object.release() ),
108 if( traits::is_tensorT< T > || std::is_arithmetic< T >::value || traits::is_string< T > )
110 setSizedFromParent( 0 );
125 WrapperBase( name, parent, rtTypes::getTypeName( typeid( T ) ) ),
131 if( traits::is_tensorT< T > || std::is_arithmetic< T >::value || traits::is_string< T > )
133 setSizedFromParent( 0 );
161 m_data = source.m_data;
172 m_data = std::move( source.m_data );
184 virtual std::unique_ptr< WrapperBase > clone(
string const & name,
185 Group & parent )
override
187 std::unique_ptr< Wrapper< T > > clonedWrapper = std::make_unique< Wrapper< T > >( name, parent, m_data );
188 clonedWrapper->copyWrapperAttributes( *
this );
189 clonedWrapper->m_isClone =
true;
190 return clonedWrapper;
196 copyWrapperAttributes( source );
204 Wrapper< T > const & castedSource = dynamicCast< Wrapper< T >
const & >( source );
205 m_ownsData = castedSource.m_ownsData;
206 m_default = castedSource.m_default;
207 m_dimLabels = castedSource.m_dimLabels;
208 m_limits = castedSource.m_limits;
212 virtual const std::type_info &
getTypeId() const noexcept
override
226 GEOS_FMT(
"Invalid downcast to Wrapper< {} >", LvArray::system::demangleType< T >() ) );
239 GEOS_FMT(
"Invalid downcast to Wrapper< {} >", LvArray::system::demangleType< T >() ) );
247 return wrapperHelpers::numArrayDims( reference() );
252 return wrapperHelpers::numArrayComp( reference() );
257 m_dimLabels.set( dim, labels );
263 return m_dimLabels.get( dim );
288 return bufferOps::can_memcpy< T >;
292 return bufferOps::is_packable< T >;
305 unpackedSize += bufferOps::Unpack( buffer, name );
306 GEOS_ERROR_IF( name != getName(),
"buffer unpack leads to wrapper names that don't match" );
312 unpackedSize += wrapperHelpers::UnpackDevice( buffer, referenceAsView(), events );
316 unpackedSize += wrapperHelpers::UnpackDataDevice( buffer, referenceAsView(), events );
321 unpackedSize += bufferOps::Unpack( buffer, *m_data );
333 parallelDeviceEvents & events,
334 MPI_Op op )
override final
341 unpackedSize += bufferOps::Unpack( buffer, name );
342 GEOS_ERROR_IF( name != getName(),
"buffer unpack leads to wrapper names that don't match" );
348 unpackedSize += wrapperHelpers::UnpackByIndexDevice( buffer, referenceAsView(), unpackIndices, events, op );
352 unpackedSize += wrapperHelpers::UnpackDataByIndexDevice( buffer, referenceAsView(), unpackIndices, events, op );
357 unpackedSize += wrapperHelpers::UnpackByIndex( buffer, *m_data, unpackIndices );
367 {
return wrapperHelpers::dataPtr( *m_data ); }
371 {
return wrapperHelpers::byteSizeOfElement< T >(); }
375 return m_isClone ? 0 : wrapperHelpers::byteSize< T >( *m_data );
389 {
return wrapperHelpers::size( *m_data ); }
394 wrapperHelpers::move( *m_data, hostMemorySpace,
true );
395 wrapperHelpers::resizeDimensions( *m_data, ndims, dims );
401 wrapperHelpers::move( *m_data, hostMemorySpace,
true );
402 wrapperHelpers::reserve( reference(), newCapacity );
409 return wrapperHelpers::capacity( *m_data );
415 wrapperHelpers::move( *m_data, hostMemorySpace,
true );
418 wrapperHelpers::resizeDefault( reference(), newSize, m_default, this->getName() );
422 wrapperHelpers::resize( reference(), newSize );
429 template<
typename U,
int NDIM,
typename PERMUTATION >
432 LvArray::forValuesInSliceWithIndices( array[ sourceIndex ],
433 [destIndex, &array]( U
const & sourceVal,
auto const ... indicesToErase )
435 array( destIndex, indicesToErase ... ) = sourceVal;
439 template<
typename U >
443 template<
typename U=T >
444 static std::enable_if_t< traits::hasCopyAssignmentOp< U > >
445 copyData( U & destinationData, U
const & sourceData )
447 destinationData = sourceData;
450 template<
typename U=T >
451 static std::enable_if_t< !traits::hasCopyAssignmentOp< U > >
452 copyData( U &, U
const & )
460 copy_wrapper::copy( reference(), sourceIndex, destIndex );
467 Wrapper< T > const & castedSource = dynamicCast< Wrapper< T >
const & >( source );
468 copy_wrapper::copyData( *m_data, *castedSource.m_data );
475 template<
typename TYPE >
476 static void erase( TYPE &, std::set< localIndex >
const & )
479 template<
typename TYPE >
482 int oldSize = array.size( 0 );
483 int numToErase = indicesToErase.size();
484 int newSize = oldSize - numToErase;
485 std::set< localIndex >::iterator it = indicesToErase.begin();
492 if( offset < numToErase )
497 array[i-offset] = array[i];
499 array.resize( newSize );
502 template<
typename TYPE >
503 static void erase( array2d< TYPE > & array, std::set< localIndex >
const & indicesToErase )
505 int oldSize = array.size( 0 );
506 int numToErase = indicesToErase.size();
507 int newSize = oldSize - numToErase;
508 int dim1 = array.size( 1 );
509 std::set< localIndex >::iterator it = indicesToErase.begin();
516 if( offset < numToErase )
521 for(
int j=0; j<dim1; j++ )
523 array[i-offset][j] = array[i][j];
526 array.resize( newSize );
529 template<
typename TYPE >
530 static void erase( array3d< TYPE > & array, std::set< localIndex >
const & indicesToErase )
532 int oldSize = array.size( 0 );
533 int numToErase = indicesToErase.size();
534 int newSize = oldSize - numToErase;
535 int dim1 = array.size( 1 );
536 int dim2 = array.size( 2 );
537 std::set< localIndex >::iterator it = indicesToErase.begin();
544 if( offset < numToErase )
549 for(
int j=0; j<dim1; j++ )
551 for(
int k=0; k<dim2; k++ )
553 array[i-offset][j][k] = array[i][j][k];
557 array.resize( newSize );
564 void erase( std::set< localIndex >
const & indicesToErase )
override
566 GEOS_ERROR_IF( indicesToErase.size() == 0,
"Wrapper::erase() can only be called on a populated set of indices!" );
572 virtual void move( LvArray::MemorySpace
const space,
bool const touch )
const override
573 {
return wrapperHelpers::move( *m_data, space, touch ); }
577 {
return rtTypes::getTypeRegex< T >( m_rtTypeName ); }
599 {
return referenceAsView(); }
609 template<
typename _T=T,
typename=std::enable_if_t< traits::HasMemberFunction_toView< _T > > >
611 {
return m_data->toView(); }
616 template<
typename _T=T,
typename=std::enable_if_t< !traits::HasMemberFunction_toView< _T > > >
623 template<
typename _T=T,
typename=std::enable_if_t< traits::HasMemberFunction_toView< _T > > >
625 {
return m_data->toViewConst(); }
630 template<
typename _T=T,
typename=std::enable_if_t< !traits::HasMemberFunction_toView< _T > > >
646 return m_default.has_default_value;
653 template<
typename U=T >
665 template<
typename U=T >
666 std::enable_if_t< DefaultValue< U >::has_default_value,
typename DefaultValue< U >::value_type
const & >
669 return m_default.value;
677 template<
typename U=T >
678 std::enable_if_t< DefaultValue< U >::has_default_value,
Wrapper< T > & >
681 m_default.value = defaultVal;
690 template<
typename U=T >
694 m_default.value = defaultVal;
695 *m_data = m_default.value;
704 template<
typename U=T >
708 m_default.value = defaultVal;
709 m_data->template setValues< serialPolicy >( m_default.value );
718 std::ostringstream ss;
741 template<
typename U=T >
743 setLimits( std::optional< LimitArg< limit_value_type_t< T > > > min,
744 std::optional< LimitArg< limit_value_type_t< T > > > max,
745 LimitsMode mode = LimitsMode::Error )
747 using LimitT = limit_value_type_t< T >;
748 std::optional< Bound< LimitT > >
const minBound = toBound< LimitT >( min );
749 std::optional< Bound< LimitT > >
const maxBound = toBound< LimitT >( max );
750 if( minBound.has_value() && maxBound.has_value() )
753 "Min value should be less or equal to max value." );
755 m_limits.min = minBound;
756 m_limits.max = maxBound;
761 template<
typename U=T >
762 std::enable_if_t< !is_limitable_v< U > && !traits::is_array_type< U >,
Wrapper< T > & >
763 setLimits( std::optional< LimitArg< limit_value_type_t< T > > >,
764 std::optional< LimitArg< limit_value_type_t< T > > >,
767 static_assert( is_limitable_v< U >,
768 "setLimits is only supported on scalar arithmetic types." );
777 template<
typename U=T >
778 std::enable_if_t< is_limitable_v< U >, std::optional< Bound< limit_value_type_t< T > > >
const & >
789 template<
typename U=T >
790 std::enable_if_t< is_limitable_v< U >, std::optional< Bound< limit_value_type_t< T > > >
const & >
801 return getLimitsStringImpl();
804 template<
typename U=T >
805 std::enable_if_t< is_limitable_v< U >,
string >
806 getLimitsStringImpl()
const
808 return m_limits.getRangeStr();
811 template<
typename U=T >
812 std::enable_if_t< !is_limitable_v< U >,
string >
813 getLimitsStringImpl()
const
818 template<
typename U=T >
819 std::enable_if_t< is_limitable_v< U > && !traits::is_array_type< U >,
void >
822 if( (!m_limits.min.has_value() && !m_limits.max.has_value()) ||
823 m_limitsMode == LimitsMode::Indicative )
827 validateLimitValue( reference() );
830 template<
typename U=T >
831 std::enable_if_t< is_limitable_v< U > && traits::is_array_type< U >,
void >
834 if( (!m_limits.min.has_value() && !m_limits.max.has_value()) ||
835 m_limitsMode == LimitsMode::Indicative )
839 auto const values = m_data->toViewConst();
840 for( limit_value_type_t< T > value : values )
842 validateLimitValue( value );
846 template<
typename U=T >
847 std::enable_if_t< !is_limitable_v< U >,
void >
866 rtTypes::getTypeRegex< T >( getRTTypeName() ),
870 GEOS_FMT(
"XML Node {} ({}) with name={} is missing required attribute '{}'.\n"
871 "For more details, please refer to documentation at:\n"
872 "http://geosx-geosx.readthedocs-hosted.com/en/latest/docs/sphinx/userGuide/Index.html",
873 targetNode.name(), nodePos.
toString(), targetNode.attribute(
"name" ).value(),
881 rtTypes::getTypeRegex< T >( getRTTypeName() ),
883 getDefaultValueStruct() );
886 if( m_successfulReadFromInput )
891 catch( std::exception
const & ex )
896 if( m_successfulReadFromInput )
897 createDataContext( targetNode, nodePos );
913 { wrapperHelpers::setName( reference(), m_conduitNode.path() ); }
917 void addBlueprintField( conduit::Node & fields,
919 string const & topology,
921 { wrapperHelpers::addBlueprintField( reference(), fields, name, topology, componentNames ); }
924 void populateMCArray( conduit::Node & node, stdVector< string >
const & componentNames = {} )
const override
925 { wrapperHelpers::populateMCArray( reference(), node, componentNames ); }
928 std::unique_ptr< WrapperBase > averageOverSecondDim(
string const & name, Group & group )
const override
930 auto ptr = wrapperHelpers::averageOverSecondDim( reference() );
931 using U =
typename decltype( ptr )::element_type;
933 GEOS_ERROR_IF( ptr ==
nullptr,
"Failed to average over the second dimension of." );
935 auto ret = std::make_unique< Wrapper< U > >( name, group, std::move( ptr ) );
936 for(
integer dim = 2; dim < numArrayDims(); ++dim )
938 ret->setDimLabels( dim - 1, getDimLabels( dim ) );
947 m_conduitNode.reset();
954 move( hostMemorySpace,
false );
956 m_conduitNode[
"__sizedFromParent__" ].set( sizedFromParent() );
958 wrapperHelpers::pushDataToConduitNode( *m_data, m_conduitNode );
963 { m_conduitNode.reset(); }
971 m_conduitNode.reset();
975 setSizedFromParent( m_conduitNode[
"__sizedFromParent__" ].value() );
977 wrapperHelpers::pullDataFromConduitNode( *m_data, m_conduitNode );
979 m_conduitNode.reset();
1071 #if defined(USE_TOTALVIEW_OUTPUT)
1072 virtual string totalviewTypeName()
const override
1074 return LvArray::system::demangle(
typeid(
Wrapper< T > ).name() );
1077 virtual int setTotalviewDisplay()
const override
1080 WrapperBase::setTotalviewDisplay();
1081 TV_ttf_add_row(
"m_ownsData",
"bool", &m_ownsData );
1082 TV_ttf_add_row(
"m_data", LvArray::system::demangle< T >().c_str(), m_data );
1083 TV_ttf_add_row(
"m_default", LvArray::system::demangle<
DefaultValue< T > >().c_str(), &m_default );
1089 #if defined(GEOS_USE_PYGEOSX)
1090 virtual PyObject * createPythonObject( )
override
1091 {
return wrapperHelpers::createPythonObject( reference() ); }
1109 template<
bool DO_PACKING >
1113 parallelDeviceEvents & events )
const
1118 { packedSize += bufferOps::Pack< DO_PACKING >( buffer, getName() ); }
1123 packedSize += wrapperHelpers::PackDevice< DO_PACKING >( buffer, reference(), events );
1127 packedSize += wrapperHelpers::PackDataDevice< DO_PACKING >( buffer, reference(), events );
1132 packedSize += bufferOps::Pack< DO_PACKING >( buffer, *m_data );
1151 template<
bool DO_PACKING >
1153 arrayView1d< localIndex const >
const & packList,
1156 parallelDeviceEvents & events )
const
1161 { packedSize += bufferOps::Pack< DO_PACKING >( buffer, getName() ); }
1166 packedSize += wrapperHelpers::PackByIndexDevice< DO_PACKING >( buffer, reference(), packList, events );
1170 packedSize += wrapperHelpers::PackDataByIndexDevice< DO_PACKING >( buffer, reference(), packList, events );
1175 packedSize += wrapperHelpers::PackByIndex< DO_PACKING >( buffer, *m_data, packList );
1187 parallelDeviceEvents & events )
const override final
1189 return this->packImpl< true >( buffer, withMetadata, onDevice, events );
1196 arrayView1d< localIndex const >
const & packList,
1199 parallelDeviceEvents & events )
const override final
1201 return this->packByIndexImpl< true >( buffer, packList, withMetadata, onDevice, events );
1207 localIndex packSizePrivate(
bool withMetadata,
1209 parallelDeviceEvents & events )
const override final
1212 return this->packImpl< false >( dummy, withMetadata, onDevice, events );
1218 localIndex packByIndexSizePrivate( arrayView1d< localIndex const >
const & packList,
1221 parallelDeviceEvents & events )
const override final
1224 return this->packByIndexImpl< false >( dummy, packList, withMetadata, onDevice, events );
1227 template<
typename V >
1228 void validateLimitValue( V
const & value )
const
1230 bool const belowMin = m_limits.min.has_value() ? isValueBelowMin( value, *m_limits.min ) : false;
1231 bool const aboveMax = m_limits.max.has_value() ? isValueAboveMax( value, *m_limits.max ) : false;
1232 if( !belowMin && !aboveMax )
1237 string const msg = GEOS_FMT(
"Value {} is outside the allowed range {}.",
1238 value, m_limits.getRangeStr() );
1240 switch( m_limitsMode )
1242 case LimitsMode::Warning:
1246 case LimitsMode::Error:
1247 GEOS_THROW( msg, InputError, getDataContext() );
1266 DefaultValue< T > m_default;
1269 wrapperHelpers::ArrayDimLabels< T > m_dimLabels;
1272 Limits< T > m_limits;
#define GEOS_DECLTYPE_AUTO_RETURN
Doxygen can't parse a decltype( auto ) return type, using this gets around that.
#define GEOS_UNUSED_PARAM(X)
Mark an unused argument and silence compiler warnings.
#define GEOS_THROW(MSG,...)
Conditionally raise a hard error and terminate the program.
#define GEOS_ERROR_IF(COND,...)
Conditionally raise a hard error and terminate the program.
#define GEOS_LOG_RANK_0(msg)
Log a message on screen on rank 0.
#define GEOS_WARNING(...)
Report a warning.
#define GEOS_THROW_IF(COND, MSG,...)
Conditionally raise a hard error and terminate the program.
#define GEOS_ASSERT_LE_MSG(lhs, rhs,...)
Assert that one value compares greater than or equal to the other in debug builds.
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.
string const & getName() const
Get name of the wrapper.
WrapperBase & setInputFlag(InputFlags const input)
Set the InputFlag of the wrapper.
WrapperBase & setDescription(string const &description)
Set the description string of the wrapper.
WrapperBase & setSizedFromParent(int val)
Set whether this wrapper is resized when its parent is resized.
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.
WrapperBase & setRestartFlags(RestartFlags flags)
Set the RestartFlags of the wrapper.
WrapperBase & appendDescription(string const &description)
Add up more text to the existing description string of the wrapper.
virtual std::type_info const & getTypeId() const =0
Get the typeid of T.
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...
WrapperBase & setPlotLevel(PlotLevel const flag)
Set the PlotLevel of the wrapper.
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 cha...
Wrapper< T > & setRestartFlags(RestartFlags flags)
Set the RestartFlags of the wrapper.
virtual string getLimitsString() const override
Return a string representing the allowed value range.
virtual const std::type_info & getTypeId() const noexcept override
Get the typeid of T.
Wrapper & operator=(Wrapper &&source)
Move Assignment Operator.
virtual void copyWrapperAttributes(WrapperBase const &source) override
Copy attributes from another wrapper.
Wrapper< T > & setInputFlag(InputFlags const input)
Set the InputFlag of the wrapper.
T TYPE
Alias for the wrapped type T.
void registerToWrite() const override
Register the wrapper's data for writing with Conduit.
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.
std::enable_if_t< is_limitable_v< U >, std::optional< Bound< limit_value_type_t< T > > > const & > getMaxBound() const
Accessor for the maximum bound of this attribute's value.
virtual void resize(localIndex const newSize) override
Calls T::resize(newsize) if it exists.
std::enable_if_t< is_limitable_v< U >, Wrapper< T > & > setLimits(std::optional< LimitArg< limit_value_type_t< T > > > min, std::optional< LimitArg< limit_value_type_t< T > > > max, LimitsMode mode=LimitsMode::Error)
Set both bounds for this attribute's value.
virtual void reserve(localIndex const newCapacity) override
Calls T::reserve( newCapacity ) if it exists, otherwise a no-op.
virtual bool isPackable(bool onDevice) const override
Check whether wrapped type is can be packed into a buffer on host or device.
Wrapper< T > & setRegisteringObjects(string const &objectName)
Add a new name to the list of groups that register this wrapper.
static Wrapper< T > const & cast(WrapperBase const &wrapper)
Downcast base to a const typed wrapper.
GEOS_DECLTYPE_AUTO_RETURN referenceAsView() const
Provide access to wrapped object converted to a view, if possible.
void setName()
DO_NOT_DOCUMENT.
T & referenceAsView()
Provide access to wrapped object converted to a view, if possible.
virtual ~Wrapper() noexcept override
Default destructor.
Wrapper(string const &name, Group &parent, std::unique_ptr< T > object)
Constructor that takes ownership of an existing object.
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.
Wrapper< T > & setPlotLevel(PlotLevel const flag)
Set the PlotLevel of the wrapper.
virtual void copy(localIndex const sourceIndex, localIndex const destIndex) override
Calls T::copy(sourceIndex, destIndex)
virtual localIndex capacity() const override
GEOS_DECLTYPE_AUTO_RETURN referenceAsView()
Provide access to wrapped object converted to a view, if possible.
GEOS_DECLTYPE_AUTO_RETURN reference() const
const Accessor for m_data
virtual size_t bytesAllocated() const override final
virtual localIndex unpack(buffer_unit_type const *&buffer, bool withMetadata, bool onDevice, parallelDeviceEvents &events) override final
Unpack the entire wrapped object from a buffer.
virtual HistoryMetadata getHistoryMetadata(localIndex const packCount=-1) const override final
Get a description of the wrapped data for time history collection/output.
Wrapper(string const &name, Group &parent, T *object)
Constructor that does not take ownership of an existing object.
Wrapper< T > & setDescription(string const &description)
Set the description string of the wrapper.
virtual localIndex numArrayComp() const override
Return the number of components in a multidimensional array.
Wrapper(string const &name, Group &parent)
Constructor that creates a new instance of wrapped type.
virtual bool processInputFile(xmlWrapper::xmlNode const &targetNode, xmlWrapper::xmlNodePos const &nodePos) override
Initialize the wrapper from the input xml node.
virtual void resize(int ndims, localIndex const *const dims) override
Calls T::resize( num_dims, dims )
Wrapper< T > & appendDescription(string const &description)
Add up more text to the existing description string of the wrapper.
void finishWriting() const override
Write the wrapped data into Conduit.
virtual localIndex size() const override
Calls T::size()
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.
T const & referenceAsView() const
Provide access to wrapped object converted to a view, if possible.
virtual string getDefaultValueString() const override
Return a string representing the default value.
bool loadFromConduit() override
Read the wrapped data from Conduit.
DefaultValue< T > const & getDefaultValueStruct() const
Accessor for m_default.
virtual int numArrayDims() const override
Return the number of dimensions of the array.
void const * voidPointer() const override
std::enable_if_t< DefaultValue< U >::has_default_value, Wrapper< T > & > setDefaultValue(typename DefaultValue< U >::value_type const &defaultVal)
Setter for default value.
Wrapper< T > & setSizedFromParent(int val)
Set whether this wrapper is resized when its parent is resized.
virtual bool hasDefaultValue() const final override
Return true iff this wrapper has a valid default value.
std::enable_if_t< DefaultValue< U >::has_default_value, typename DefaultValue< U >::value_type const & > getDefaultValue() const
Accessor for default value.
Wrapper & operator=(Wrapper const &source)
Copy Assignment Operator.
virtual void copyWrapper(WrapperBase const &source) override
Copies the contents of a Wrapper into *this.
void erase(std::set< localIndex > const &indicesToErase) override
Calls T::erase(indicesToErase)
static Wrapper & cast(WrapperBase &wrapper)
Downcast base to a typed wrapper.
virtual Regex const & getTypeRegex() const override
virtual void copyData(WrapperBase const &source) override
Copy the the data contained in another wrapper into this wrapper.
T & reference()
Accessor for m_data.
std::enable_if_t< is_limitable_v< U >, std::optional< Bound< limit_value_type_t< T > > > const & > getMinBound() const
Accessor for the minimum bound of this attribute's value.
virtual void move(LvArray::MemorySpace const space, bool const touch) const override
Calls T::move(space, touch)
virtual localIndex elementByteSize() const override
virtual Span< string const > getDimLabels(integer const dim) const override
Get dimension labels of an array.
@ OPTIONAL
Optional in input.
@ REQUIRED
Required in input.
internal::Helper< T > DefaultValue
A templated alias to hold default values.
@ WRITE_AND_READ
Write and read from restart.
@ NO_WRITE
Do not write into restart.
std::enable_if_t< !internal::canParseVariable< T >, bool > readAttributeAsType(T &, string const &name, Regex const &, xmlNode const &, U const &)
Extract attribute in an xml tree, and translate its value into a typed variable. This SFINAE implemen...
void processInputException(std::exception const &ex, string const &targetAttributeName, xmlWrapper::xmlNode const &targetNode, xmlWrapper::xmlNodePos const &nodePos)
Helper method to process an exception that has been thrown during xml parsing.
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
LvArray::Array< T, NDIM, PERMUTATION, localIndex, LvArray::ChaiBuffer > Array
Multidimensional array type. See LvArray:Array for details.
std::string string
String type.
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
void erase(OrderedVariableToManyElementRelation &relation, localIndex const firstIndex, localIndex const er, localIndex const esr, localIndex const ei)
Remove an element relation from an object in the relation.
signed char buffer_unit_type
Type stored in communication buffers.
int integer
Signed integer type.
Array< T, 1 > array1d
Alias for 1D array.
std::enable_if< can_history_io< T >, HistoryMetadata >::type getHistoryMetadata(string const &name, ArrayView< T const, 1, 0 > const &arr, localIndex const numComps, localIndex sizeOverride=-1)
Produce a HistoryMetadata object for a supported one-dimensional array type.
std::string_view string_view
String type.
internal::StdVectorWrapper< T, Allocator, USE_STD_CONTAINER_BOUNDS_CHECKING > stdVector