Provides a container for storing fields associated with a specified mesh topology and methods to create, access and remove fields from the container.
More...
|
| ~FieldData () |
| Destructor. More...
|
|
|
| FieldData ()=delete |
| Default constructor. Disabled. More...
|
|
| FieldData (int association) |
| Creates an empty FieldData instance with the specified mesh topology association. More...
|
|
|
int | getAssociation () const |
| Returns the mesh topology association of fields in this container. More...
|
|
bool | empty () const |
| Checks if this FieldData instance is empty. More...
|
|
int | getNumFields () const |
| Returns the number of fields of this FieldData instance. More...
|
|
bool | hasField (const std::string &name) const |
| Checks if the field with the given name exists. More...
|
|
bool | hasSidreGroup () const |
| Checks if a Sidre Group is associated with this FieldData instance. More...
|
|
double | getResizeRatio () const |
| Return the resize ratio of this FieldData. More...
|
|
|
template<typename T > |
T * | createField (const std::string &name, IndexType num_tuples, IndexType num_components=1, IndexType capacity=USE_DEFAULT, bool storeInSidre=true) |
| Creates a new field with the given name consisting of the specified number of tuples and number of components. More...
|
|
template<typename T > |
T * | createField (const std::string &name, T *data, IndexType num_tuples, IndexType num_components=1, IndexType capacity=USE_DEFAULT) |
| Creates a new field which will use the supplied external buffer as storage, consisting of the specified number of tuples and components. More...
|
|
void | removeField (const std::string &name) |
| Removes the field with the given name. More...
|
|
void | removeField (int i) |
| Removes the ith field from the container. More...
|
|
Field * | getField (int i) |
| Returns the ith field of this FieldData instance. More...
|
|
const Field * | getField (int i) const |
|
|
Field * | getField (const std::string &name) |
| Returns the field with the given name. More...
|
|
const Field * | getField (const std::string &name) const |
|
|
template<typename T > |
T * | getFieldPtr (const std::string &name) |
| Returns pointer to the buffer of the field with the given name. More...
|
|
template<typename T > |
T * | getFieldPtr (const std::string &name, IndexType &num_tuples) |
|
template<typename T > |
T * | getFieldPtr (const std::string &name, IndexType &num_tuples, IndexType &num_components) |
|
|
template<typename T > |
const T * | getFieldPtr (const std::string &name) const |
| Returns const pointer to the buffer of the field with the given name. More...
|
|
template<typename T > |
const T * | getFieldPtr (const std::string &name, IndexType &num_tuples) const |
|
template<typename T > |
const T * | getFieldPtr (const std::string &name, IndexType &num_tuples, IndexType &num_components) const |
|
|
void | resize (IndexType newNumTuples) |
| Changes the num-tuples of all fields in this FieldData instance. More...
|
|
void | emplace (IndexType pos, IndexType n_tuples) |
| Inserts n_tuples with the default value at the given position. More...
|
|
void | reserve (IndexType newCapacity) |
| Changes the tuple capacity of all fields in this FieldData instance. More...
|
|
void | shrink () |
| Shrinks the tuple capacity of all fields in this FieldData instance to be equal to the actual number of tuples in the field. More...
|
|
void | setResizeRatio (double ratio) |
| Set the resize ratio of this FieldData and all associated Fields. More...
|
|
bool | checkConsistency (IndexType num_tuples, IndexType capacity) const |
|
Provides a container for storing fields associated with a specified mesh topology and methods to create, access and remove fields from the container.
A FieldData object may store fields associated with a single mesh topology, e.g., node-, cell- , face- or edge-centered. The FieldData object provides the means to create, access, modify and remove fields from the container.
Each field in the container is a FieldVariable instance which may store scalar, vector, tensor fields etc. as explained in more detail in the FieldVariable documentation.
When Mint is compiled with Sidre support, the FieldData object can be bound to a particular sidre::Group to store fields in a Sidre hierarchy according to the mesh blueprint .
- Note
- When using Sidre as the back-end storage, the action of creating or removing fields from the FieldData object is reflected in the associated Sidre hierarchy by default.
- See also
- Field
-
FieldVariable
template<typename T >
T * axom::mint::FieldData::createField |
( |
const std::string & |
name, |
|
|
IndexType |
num_tuples, |
|
|
IndexType |
num_components = 1 , |
|
|
IndexType |
capacity = USE_DEFAULT , |
|
|
bool |
storeInSidre = true |
|
) |
| |
|
inline |
Creates a new field with the given name consisting of the specified number of tuples and number of components.
- Parameters
-
[in] | name | the user-supplied name to identify this field. |
[in] | num_tuples | the number of tuples in the field. |
[in] | num_components | number of components per tuple (optional) |
[in] | capacity | initial max capacity for the field (optional). |
[in] | storeInSidre | indicates whether to store the field in the associated Sidre group of this FieldData instance (optional). |
- Template Parameters
-
T | the underlying data type of the field, e.g., double, int, etc. |
- Note
- num_components is an optional argument. It defaults to '1' if a value is not explicitly specified by the caller.
-
The 'storeInSidre' boolean argument that indicates whether the field data should be stored in Sidre. This is an optional argument which defaults to true and is only relevant when the code is compiled with Sidre support and the FieldData instance is associated with a Sidre Group. For persistent data, e.g., state variables etc., Sidre should own the data. However, for temporary variables it may be desirable to not modify the Sidre hierarchy.
- Returns
- ptr pointer to the buffer associated with this field.
- Precondition
- hasField( name ) == false
-
num_components >= 1
- Postcondition
- ptr != nullptr
References axom::sidre::Group::createGroup(), axom::sidre::Group::createView(), hasField(), hasSidreGroup(), axom::mint::Field::setResizeRatio(), axom::sidre::View::setString(), SLIC_ASSERT, and SLIC_ERROR_IF.