AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::mint::Field Class Referenceabstract

Field is an abstract base class which provides the following: More...

#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/latest/src/axom/mint/mesh/Field.hpp>

Inheritance diagram for axom::mint::Field:

Public Member Functions

 Field ()=delete
 Default constructor. Disabled. More...
 
Virtual methods
virtual ~Field ()
 Destructor. More...
 
virtual IndexType getNumTuples () const =0
 Returns the number of tuples associated with this field. More...
 
virtual IndexType getNumComponents () const =0
 Returns the number of components associated with this field. More...
 
virtual IndexType getCapacity () const =0
 Returns the total number of tuples this Field instance can hold. More...
 
virtual void resize (IndexType newNumTuples)=0
 Resizes the Field such that it can store the given number of tuples. More...
 
virtual void emplace (IndexType pos, IndexType n_tuples)=0
 Inserts n_tuples with the default value at the given position. More...
 
virtual void reserve (IndexType newCapacity)=0
 Increase the Field capacity to hold the given number of tuples. More...
 
virtual void shrink ()=0
 Shrinks the field capacity to be equal to the number of tuples. More...
 
virtual double getResizeRatio () const =0
 Return the resize ratio of this field. More...
 
virtual void setResizeRatio (double ratio)=0
 Set the resize ratio of this field. More...
 
virtual bool isExternal () const =0
 Return true iff the field is stored in an external buffer. More...
 
virtual bool isInSidre () const =0
 Return true iff the field is stored in sidre. More...
 
Attribute get/set Methods
int getType () const
 Returns the type of the field. More...
 
const std::string & getName () const
 Returns the name of the field. More...
 
int getBasis () const
 Returns the basis associated with this field. More...
 
void setBasis (int fe_basis)
 Sets the finite element basis associated with this field. More...
 

Static Public Member Functions

Static Methods
template<typename T >
static T * getDataPtr (Field *field)
 Returns raw pointer to the field data. More...
 
template<typename T >
static const T * getDataPtr (const Field *field)
 

Protected Member Functions

 Field (const std::string &name, int type)
 Custom constructor to call from a derived class. More...
 

Protected Attributes

std::string m_name
 
int m_type
 
int m_basis
 

Detailed Description

Field is an abstract base class which provides the following:

  • A type-agnostic wrapper for FieldVariable< T > objects, which are templated on the underlying field type, e.g., double, int, etc.
  • A unified interface to access Fields regardless of type
  • The ability to store fields of different types in a FieldData container.
See also
FieldVariable
FieldData

Constructor & Destructor Documentation

◆ Field() [1/2]

axom::mint::Field::Field ( )
delete

Default constructor. Disabled.

◆ ~Field()

virtual axom::mint::Field::~Field ( )
inlinevirtual

Destructor.

◆ Field() [2/2]

axom::mint::Field::Field ( const std::string &  name,
int  type 
)
inlineprotected

Custom constructor to call from a derived class.

Parameters
[in]namethe name associated with this field instance.
[in]typethe field type.
Precondition
name.empty() == false
type >= 0 && type < NUMBER_OF_FIELD_TYPES
See also
FieldType for a list of supported field types.

References m_name, m_type, SLIC_ERROR_IF, and axom::mint::UNDEFINED_FIELD_TYPE.

Member Function Documentation

◆ getNumTuples()

virtual IndexType axom::mint::Field::getNumTuples ( ) const
pure virtual

Returns the number of tuples associated with this field.

Returns
N the number of tuples of this field.
Postcondition
N >= 0

Implemented in axom::mint::FieldVariable< T >.

◆ getNumComponents()

virtual IndexType axom::mint::Field::getNumComponents ( ) const
pure virtual

Returns the number of components associated with this field.

Returns
N the number of components of this field.
Postcondition
N >= 1

Implemented in axom::mint::FieldVariable< T >.

◆ getCapacity()

virtual IndexType axom::mint::Field::getCapacity ( ) const
pure virtual

Returns the total number of tuples this Field instance can hold.

Returns
N the number of tuples this Field instance can hold.
Postcondition
getCapacity() >= getNumTuples()

Implemented in axom::mint::FieldVariable< T >.

◆ resize()

virtual void axom::mint::Field::resize ( IndexType  newNumTuples)
pure virtual

Resizes the Field such that it can store the given number of tuples.

Parameters
[in]newNumTuplesthe number of tuples of this Field instance.
Note
Reallocation is done only if the new size exceeds the capacity.

Implemented in axom::mint::FieldVariable< T >.

◆ emplace()

virtual void axom::mint::Field::emplace ( IndexType  pos,
IndexType  n_tuples 
)
pure virtual

Inserts n_tuples with the default value at the given position.

Parameters
[in]posthe position of the insert.
[in]n_tuplesthe number of tuples to insert.
Note
The values at pos and above are shifted up and the new tuples have the default values.
See also
FieldVariable

Implemented in axom::mint::FieldVariable< T >.

◆ reserve()

virtual void axom::mint::Field::reserve ( IndexType  newCapacity)
pure virtual

Increase the Field capacity to hold the given number of tuples.

Parameters
[in]newCapacitynumber of tuples to reserve memory for.
Note
if newCapacity < getCapacity() this method returns immediately.

Implemented in axom::mint::FieldVariable< T >.

◆ shrink()

virtual void axom::mint::Field::shrink ( )
pure virtual

Shrinks the field capacity to be equal to the number of tuples.

Postcondition
getCapacity()==getNumTuple()

Implemented in axom::mint::FieldVariable< T >.

◆ getResizeRatio()

virtual double axom::mint::Field::getResizeRatio ( ) const
pure virtual

Return the resize ratio of this field.

Implemented in axom::mint::FieldVariable< T >.

◆ setResizeRatio()

virtual void axom::mint::Field::setResizeRatio ( double  ratio)
pure virtual

Set the resize ratio of this field.

Parameters
[in]ratiothe new resize ratio.
Postcondition
getResizeRatio() == ratio

Implemented in axom::mint::FieldVariable< T >.

◆ isExternal()

virtual bool axom::mint::Field::isExternal ( ) const
pure virtual

Return true iff the field is stored in an external buffer.

Implemented in axom::mint::FieldVariable< T >.

◆ isInSidre()

virtual bool axom::mint::Field::isInSidre ( ) const
pure virtual

Return true iff the field is stored in sidre.

Implemented in axom::mint::FieldVariable< T >.

◆ getType()

int axom::mint::Field::getType ( ) const
inline

Returns the type of the field.

Returns
t the type of the field.
Postcondition
t < NUMBER_OF_FIELD_TYPES
See also
FieldTypes

References m_type.

◆ getName()

const std::string& axom::mint::Field::getName ( ) const
inline

Returns the name of the field.

Returns
name the name of the field.

References m_name.

◆ getBasis()

int axom::mint::Field::getBasis ( ) const
inline

Returns the basis associated with this field.

Returns
basis the basis associated with this field.
Precondition
fe_basis >= 0 && fe_basis < MINT_NUM_BASIS_TYPES

References m_basis.

◆ setBasis()

void axom::mint::Field::setBasis ( int  fe_basis)
inline

Sets the finite element basis associated with this field.

Parameters
[in]fe_basisthe finite element basis
Note
A field is not associated with basis type by default. The caller must explicitly associate a field with a basis by calling setBasis()
Precondition
fe_basis >= 0 && fe_basis < MINT_NUM_BASIS_TYPES
See also
FEBasisTypes for a list of supported basis.

References m_basis, MINT_NUM_BASIS_TYPES, and SLIC_ASSERT.

◆ getDataPtr() [1/2]

template<typename T >
T * axom::mint::Field::getDataPtr ( Field field)
inlinestatic

Returns raw pointer to the field data.

Returns
dataPtr pointer to the field data.
Template Parameters
Tthe field data type, e.g., double, int, etc.
Precondition
field_traits< T >::type() == field->getType()
Postcondition
dataPtr != nullptr

References axom::mint::FieldVariable< T >::getFieldVariablePtr(), getType(), SLIC_ASSERT, SLIC_ERROR_IF, axom::mint::field_traits< FieldType >::type(), and axom::mint::UNDEFINED_FIELD_TYPE.

◆ getDataPtr() [2/2]

template<typename T >
const T * axom::mint::Field::getDataPtr ( const Field field)
inlinestatic

Member Data Documentation

◆ m_name

std::string axom::mint::Field::m_name
protected

the name of the field

◆ m_type

int axom::mint::Field::m_type
protected

the field type

◆ m_basis

int axom::mint::Field::m_basis
protected

associated finite element basis with the field.


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