AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
|
Provides the ability to store and operate on a set of particles. More...
#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/latest/src/axom/mint/mesh/ParticleMesh.hpp>
Public Member Functions | |
ParticleMesh ()=delete | |
Default constructor. Disabled. More... | |
virtual bool | isExternal () const final override |
Return true iff particle positions are stored in external arrays. More... | |
bool | empty () const |
Return true iff the mesh holds no particles. More... | |
bool | isInSidre () const |
Return true iff the particle positions are stored in sidre. More... | |
Native Storage Constructors | |
ParticleMesh (int dimension, IndexType numParticles, IndexType capacity=USE_DEFAULT) | |
Constructs a ParticleMesh instance of specified dimension that holds the specified number of particles. More... | |
External Storage Constructors | |
ParticleMesh (IndexType numParticles, double *x, double *y=nullptr, double *z=nullptr) | |
Creates a ParticleMesh instance that points to the supplied external particle position buffers. More... | |
Virtual methods | |
virtual | ~ParticleMesh () |
Destructor. More... | |
Cells | |
virtual IndexType | getNumberOfCells () const final override |
Return the number of cells in the mesh. More... | |
virtual IndexType | getCellCapacity () const final override |
Return the capacity for cells. More... | |
virtual IndexType | getNumberOfCellNodes (IndexType AXOM_UNUSED_PARAM(cellID)=0) const final override |
virtual CellType | getCellType (IndexType AXOM_UNUSED_PARAM(cellID)=0) const final override |
virtual IndexType | getCellNodeIDs (IndexType cellID, IndexType *cell) const final override |
virtual IndexType | getNumberOfCellFaces (IndexType AXOM_UNUSED_PARAM(cellID)=0) const final override |
Return the number of faces associated with the given cell. For the ParticleMesh this is always zero. More... | |
virtual IndexType | getCellFaceIDs (IndexType AXOM_UNUSED_PARAM(cellID), IndexType *AXOM_UNUSED_PARAM(faces)) const final override |
Populates the given buffer with the IDs of the faces of the given cell and returns the number of faces. Since the ParticleMesh has no faces this method errors out. More... | |
Nodes | |
virtual IndexType | getNumberOfNodes () const final override |
Return the number of nodes in the mesh. More... | |
virtual IndexType | getNodeCapacity () const final override |
Return the capacity for nodes. More... | |
virtual void | getNode (IndexType nodeID, double *node) const final override |
Copy the coordinates of the given node into the provided buffer. More... | |
virtual double * | getCoordinateArray (int dim) final override |
Returns pointer to the particle positions in the specified dimension. More... | |
virtual const double * | getCoordinateArray (int dim) const final override |
double | getNodeResizeRatio () const |
Return the node resize ratio. More... | |
void | resize (IndexType newSize) |
Increase the number of particles this ParticleMesh instance can hold. More... | |
void | reserve (IndexType newCapacity) |
Increase the max particle capacity of this ParticleMesh instance. More... | |
void | shrink () |
Shrinks the max particle capacity to the actual number of particles. More... | |
Faces | |
virtual IndexType | getNumberOfFaces () const final override |
Return the number of faces in the mesh. More... | |
virtual CellType | getFaceType (IndexType AXOM_UNUSED_PARAM(faceID)) const final override |
Return the type of the given face. More... | |
virtual IndexType | getNumberOfFaceNodes (IndexType AXOM_UNUSED_PARAM(faceID)) const final override |
Return the number of nodes associated with the given face. More... | |
virtual IndexType | getFaceNodeIDs (IndexType AXOM_UNUSED_PARAM(faceID), IndexType *AXOM_UNUSED_PARAM(nodes)) const final override |
Copy the IDs of the nodes that compose the given face into the provided buffer. More... | |
virtual void | getFaceCellIDs (IndexType AXOM_UNUSED_PARAM(faceID), IndexType &AXOM_UNUSED_PARAM(cellIDOne), IndexType &AXOM_UNUSED_PARAM(cellIDTwo)) const final override |
Copy the IDs of the cells adjacent to the given face into the provided indices. More... | |
Edges | |
virtual IndexType | getNumberOfEdges () const final override |
Return the number of edges in the mesh. More... | |
virtual IndexType | getEdgeCapacity () const final override |
Return the capacity for edges. More... | |
Data Access Methods | |
void | append (double x) |
Appends a new particle to the ParticleMesh. More... | |
void | append (double x, double y) |
void | append (double x, double y, double z) |
Cells | |
virtual CellType | getCellType (IndexType cellID=0) const =0 |
Return the type of the given cell. More... | |
virtual IndexType | getNumberOfCellNodes (IndexType cellID=0) const =0 |
Return the number of nodes associated with the given cell. More... | |
virtual IndexType | getCellNodeIDs (IndexType AXOM_UNUSED_PARAM(cellID), IndexType *AXOM_UNUSED_PARAM(nodes)) const =0 |
Copy the connectivity of the given cell into the provided buffer. The buffer must be of length at least getNumberOfCellNodes( cellID ). More... | |
Faces | |
virtual IndexType | getFaceCapacity () const |
Returns the capacity for number of faces in this mesh instance. More... | |
Mesh Attribute get/set Methods | |
int | getDimension () const |
Returns the dimension for this mesh instance. More... | |
int | getBlockId () const |
Returns the ID of this mesh instance. More... | |
void | setBlockId (int ID) |
set the block ID of this mesh instance. More... | |
int | getPartitionId () const |
Returns the partition ID of this mesh instance. More... | |
void | setPartitionId (int ID) |
set the partition ID of this mesh instance. More... | |
int | getMeshType () const |
Returns the mesh type of this mesh instance. More... | |
bool | hasExplicitCoordinates () const |
Checks if this mesh instance has explicit coordinates. More... | |
bool | hasExplicitConnectivity () const |
Checks if this mesh instance has explicit connectivity. More... | |
bool | hasMixedCellTypes () const |
Checks if the mesh has mixed cell types, e.g., consisting of both triangle and quad elements or hex,pyramid,prisms and tets in 3-D. More... | |
bool | isStructured () const |
Returns true if the mesh type is structured. More... | |
bool | isUnstructured () const |
Returns true if the mesh type is unstructured. More... | |
bool | hasSidreGroup () const |
Checks if this Mesh instance is associated with a Sidre Group. More... | |
Methods to Create, Access & Remove Fields from a Mesh | |
const FieldData * | getFieldData (int association) const |
Returns const pointer to the FieldData instance with the specified mesh field association, e.g., NODE_CENTERED, CELL_CENTERED, etc. More... | |
bool | hasField (const std::string &name, int association=ANY_CENTERING) const |
Check if a field with the given name and association exists. More... | |
template<typename T > | |
T * | createField (const std::string &name, int association, IndexType num_components=1, bool storeInSidre=true) |
Creates a new field with the given name and specified mesh field association, e.g., NODE_CENTERED, CELL_CENTERED, etc. More... | |
template<typename T > | |
T * | createField (const std::string &name, int association, T *data, IndexType num_components=1, IndexType capacity=USE_DEFAULT) |
Creates a new field from an external buffer that has the given name and specified mesh field association, e.g., NODE_CENTERED, CELL_CENTERED, etc. More... | |
bool | removeField (const std::string &name, int association) |
Removes the field with the given name and specified association. More... | |
template<typename T > | |
T * | getFieldPtr (const std::string &name, int association, IndexType &num_components) |
Returns pointer to buffer of the field with the given ane and specified mesh field association. More... | |
template<typename T > | |
T * | getFieldPtr (const std::string &name, int association) |
template<typename T > | |
const T * | getFieldPtr (const std::string &name, int association, IndexType &num_components) const |
template<typename T > | |
const T * | getFieldPtr (const std::string &name, int association) const |
Protected Attributes | |
Protected Members | |
int | m_ndims |
int | m_type |
int | m_block_idx |
int | m_part_idx |
bool | m_explicit_coords |
bool | m_explicit_connectivity |
bool | m_has_mixed_topology |
FieldData * | m_mesh_fields [NUM_FIELD_ASSOCIATIONS] |
Provides the ability to store and operate on a set of particles.
The ParticleMesh class derives from the top-level Mesh base class and provides the ability to store and operate on a collection of particles and associated data. Each particle has a position and may have associated scalar, vector and tensor fields.
A ParticleMesh object may be constructed using (a) native storage, (b) external storage, or, (c) from a Sidre blueprint conforming hierarchy:
Native Storage
When using native storage, the ParticleMesh object owns all memory associated with the particle data. The storage can grow dynamically as needed by the application, i.e., adding more particles. Once the ParticleMesh object goes out-of-scope, all memory associated with it is returned to the system.
External Storage
A ParticleMesh may also be constructed from external, user-supplied buffers. In this case, all memory associated with the particle data is owned by the caller. Consequently, the number of particles and associated data cannot grow dynamically.
Sidre
A ParticleMesh may also be constructed from a Sidre hierarchy that is conforming to the mesh blueprint conventions. In this case, all operations are supported, including dynamically adding new particles and growing the associated storage. However, Sidre owns all the memory. Once the ParticleMesh object goes out-of-scope, the data remains persistent in Sidre.
|
delete |
Default constructor. Disabled.
axom::mint::ParticleMesh::ParticleMesh | ( | int | dimension, |
IndexType | numParticles, | ||
IndexType | capacity = USE_DEFAULT |
||
) |
Constructs a ParticleMesh instance of specified dimension that holds the specified number of particles.
[in] | dimension | the ambient dimension of the particle mesh. |
[in] | numParticles | the number of particles in this |
[in] | capacity | max particle capacity (optional) |
axom::mint::ParticleMesh::ParticleMesh | ( | IndexType | numParticles, |
double * | x, | ||
double * | y = nullptr , |
||
double * | z = nullptr |
||
) |
Creates a ParticleMesh instance that points to the supplied external particle position buffers.
[in] | numParticles | the number of particles in the supplied buffers. |
[in] | x | pointer to the particle x-coordinate positions |
[in] | y | pointer to the particle y-coordinate positions (optional) |
[in] | z | pointer to the particle z-coordinate positions (optional) |
|
virtual |
Destructor.
|
inlinefinaloverridevirtual |
|
inlinefinaloverridevirtual |
|
inlinefinaloverridevirtual |
|
inlinefinaloverridevirtual |
References axom::mint::VERTEX.
|
inlinefinaloverridevirtual |
References getNumberOfCells(), and SLIC_ASSERT.
|
inlinefinaloverridevirtual |
Return the number of faces associated with the given cell. For the ParticleMesh this is always zero.
[in] | cellID | the ID of the cell in question. |
Implements axom::mint::Mesh.
|
inlinefinaloverridevirtual |
Populates the given buffer with the IDs of the faces of the given cell and returns the number of faces. Since the ParticleMesh has no faces this method errors out.
[in] | cellID | the ID of the cellID in question. |
[out] | faces | buffer to populate with the face IDs. Must be of length at least getNumberOfCellFaces( cellID ). |
Implements axom::mint::Mesh.
References SLIC_ERROR.
|
inlinefinaloverridevirtual |
Return the number of nodes in the mesh.
Implements axom::mint::Mesh.
References axom::mint::MeshCoordinates::numNodes().
|
inlinefinaloverridevirtual |
Return the capacity for nodes.
Reimplemented from axom::mint::Mesh.
References axom::mint::MeshCoordinates::capacity().
|
inlinefinaloverridevirtual |
Copy the coordinates of the given node into the provided buffer.
[in] | nodeID | the ID of the node in question. |
[in] | coords | the buffer to copy the coordinates into, of length at least getDimension(). |
Implements axom::mint::Mesh.
References axom::mint::MeshCoordinates::getCoordinates().
|
inlinefinaloverridevirtual |
Returns pointer to the particle positions in the specified dimension.
[in] | dim | the specified dimension |
Implements axom::mint::Mesh.
References axom::mint::MeshCoordinates::getCoordinateArray().
|
inlinefinaloverridevirtual |
Implements axom::mint::Mesh.
References axom::mint::MeshCoordinates::getCoordinateArray().
|
inlinefinaloverridevirtual |
Return the number of faces in the mesh.
Implements axom::mint::Mesh.
|
inlinefinaloverridevirtual |
Return the type of the given face.
[in] | faceID | the ID of the face in question. |
Implements axom::mint::Mesh.
References SLIC_ERROR, and axom::mint::UNDEFINED_CELL.
|
inlinefinaloverridevirtual |
Return the number of nodes associated with the given face.
[in] | faceID | the ID of the face in question. |
Implements axom::mint::Mesh.
References SLIC_ERROR.
|
inlinefinaloverridevirtual |
Copy the IDs of the nodes that compose the given face into the provided buffer.
[in] | faceID | the ID of the face in question. |
[out] | nodes | the buffer into which the node IDs are copied, must be of length at least getNumberOfFaceNodes(). |
Implements axom::mint::Mesh.
References SLIC_ERROR.
|
inlinefinaloverridevirtual |
Copy the IDs of the cells adjacent to the given face into the provided indices.
[in] | faceID | the ID of the face in question. |
[out] | cellIDOne | the ID of the first cell. |
[out] | cellIDTwo | the ID of the second cell. |
Implements axom::mint::Mesh.
References SLIC_ERROR.
|
inlinefinaloverridevirtual |
Return the number of edges in the mesh.
Implements axom::mint::Mesh.
|
inlinefinaloverridevirtual |
Return the capacity for edges.
Reimplemented from axom::mint::Mesh.
|
inlinefinaloverridevirtual |
Return true iff particle positions are stored in external arrays.
Implements axom::mint::Mesh.
References axom::mint::MeshCoordinates::isExternal().
|
inline |
Return the node resize ratio.
References axom::mint::MeshCoordinates::getResizeRatio().
|
inline |
Increase the number of particles this ParticleMesh instance can hold.
[in] | newSize | the number of particles this instance will now hold |
References axom::mint::Mesh::m_mesh_fields, axom::mint::NODE_CENTERED, axom::mint::FieldData::resize(), axom::mint::MeshCoordinates::resize(), and SLIC_ASSERT.
|
inline |
Increase the max particle capacity of this ParticleMesh instance.
[in] | newCapacity |
References axom::mint::Mesh::m_mesh_fields, axom::mint::NODE_CENTERED, axom::mint::MeshCoordinates::reserve(), axom::mint::FieldData::reserve(), and SLIC_ASSERT.
|
inline |
Shrinks the max particle capacity to the actual number of particles.
References axom::mint::Mesh::m_mesh_fields, axom::mint::NODE_CENTERED, axom::mint::FieldData::shrink(), axom::mint::MeshCoordinates::shrink(), and SLIC_ASSERT.
|
inline |
Return true iff the mesh holds no particles.
References axom::mint::MeshCoordinates::empty().
|
inline |
Return true iff the particle positions are stored in sidre.
References axom::mint::MeshCoordinates::isInSidre().
|
inline |
Appends a new particle to the ParticleMesh.
[in] | x | the x-coordinate of the particle position |
[in] | y | the y-coordinate of the particle position (valid in 2-D) |
[in] | z | the z-coordinate of the particle position (valid in 3-D) |
References axom::mint::MeshCoordinates::append(), axom::mint::Mesh::m_mesh_fields, axom::mint::Mesh::m_ndims, axom::mint::NODE_CENTERED, axom::mint::MeshCoordinates::numNodes(), axom::mint::FieldData::resize(), SLIC_ASSERT, and SLIC_ERROR_IF.
|
inline |
|
inline |
Return the type of the given cell.
[in] | cellID | the ID of the cell in question, this parameter is ignored if hasMixedCellTypes() == false. |
Implemented in axom::mint::UnstructuredMesh< TOPO >.
|
pure virtualinherited |
Return the number of nodes associated with the given cell.
[in] | cellID | the ID of the cell in question, this parameter is ignored unless hasMixedCellTypes() == true. |
Implemented in axom::mint::UnstructuredMesh< TOPO >.
|
pure virtualinherited |
Copy the connectivity of the given cell into the provided buffer. The buffer must be of length at least getNumberOfCellNodes( cellID ).
[in] | cellID | the ID of the cell in question. |
[out] | nodes | the buffer into which the connectivity is copied, must be of length at least getNumberOfCellNodes( cellID ). |
|
inlinevirtualinherited |
Returns the capacity for number of faces in this mesh instance.
Reimplemented in axom::mint::UnstructuredMesh< TOPO >.
References axom::mint::Mesh::getNumberOfFaces().
|
inlineinherited |
Returns the dimension for this mesh instance.
References axom::mint::Mesh::m_ndims.
|
inlineinherited |
Returns the ID of this mesh instance.
References axom::mint::Mesh::m_block_idx.
|
inherited |
set the block ID of this mesh instance.
[in] | ID | the new block ID. |
|
inlineinherited |
Returns the partition ID of this mesh instance.
References axom::mint::Mesh::m_part_idx.
|
inherited |
set the partition ID of this mesh instance.
[in] | ID | the new partition ID. |
|
inlineinherited |
Returns the mesh type of this mesh instance.
References axom::mint::Mesh::m_type.
|
inlineinherited |
Checks if this mesh instance has explicit coordinates.
References axom::mint::Mesh::m_explicit_coords.
|
inlineinherited |
Checks if this mesh instance has explicit connectivity.
References axom::mint::Mesh::m_explicit_connectivity.
|
inlineinherited |
Checks if the mesh has mixed cell types, e.g., consisting of both triangle and quad elements or hex,pyramid,prisms and tets in 3-D.
References axom::mint::Mesh::m_has_mixed_topology.
|
inlineinherited |
Returns true if the mesh type is structured.
References axom::mint::Mesh::m_type, axom::mint::STRUCTURED_CURVILINEAR_MESH, axom::mint::STRUCTURED_RECTILINEAR_MESH, and axom::mint::STRUCTURED_UNIFORM_MESH.
|
inlineinherited |
Returns true if the mesh type is unstructured.
References axom::mint::Mesh::m_type, and axom::mint::UNSTRUCTURED_MESH.
|
inlineinherited |
|
inlineinherited |
Returns const pointer to the FieldData instance with the specified mesh field association, e.g., NODE_CENTERED, CELL_CENTERED, etc.
[in] | association | the specified mesh field association |
References axom::mint::Mesh::m_mesh_fields, axom::mint::Mesh::m_type, axom::mint::NODE_CENTERED, axom::mint::NUM_FIELD_ASSOCIATIONS, axom::mint::PARTICLE_MESH, and SLIC_ERROR_IF.
|
inlineinherited |
Check if a field with the given name and association exists.
[in] | name | the name of the field in query. |
[in] | association | the field association (optional) |
References axom::mint::ANY_CENTERING, axom::mint::Mesh::getFieldData(), axom::mint::FieldData::hasField(), axom::mint::Mesh::m_type, axom::mint::NUM_FIELD_ASSOCIATIONS, axom::mint::PARTICLE_MESH, and SLIC_ASSERT.
|
inlineinherited |
Creates a new field with the given name and specified mesh field association, e.g., NODE_CENTERED, CELL_CENTERED, etc.
[in] | name | the name of the new field. |
[in] | association | the mesh field association. |
[in] | num_components | number of components of the field (optional). |
[in] | storeInSidre | indicates whether to store the field in the corresponding Sidre group (optional). |
[in] | capacity |
References axom::mint::FieldData::createField(), axom::mint::Mesh::getFieldData(), axom::mint::Mesh::hasField(), SLIC_ASSERT, and SLIC_ERROR_IF.
|
inlineinherited |
Creates a new field from an external buffer that has the given name and specified mesh field association, e.g., NODE_CENTERED, CELL_CENTERED, etc.
[in] | name | the name of the new field. |
[in] | association | the mesh field association. |
[in] | data | pointer to the external data buffer. |
[in] | num_components | number of components of the field (optional). |
References axom::mint::FieldData::createField(), axom::mint::Mesh::getFieldData(), axom::mint::Mesh::hasField(), SLIC_ASSERT, and SLIC_ERROR_IF.
|
inlineinherited |
Removes the field with the given name and specified association.
[in] | name | the name of the field to remove. |
[in] | association | the mesh field association. |
References axom::mint::Mesh::getFieldData(), axom::mint::FieldData::hasField(), axom::mint::Mesh::hasField(), axom::mint::FieldData::removeField(), and SLIC_WARNING_IF.
|
inlineinherited |
Returns pointer to buffer of the field with the given ane and specified mesh field association.
[in] | name | the name of the requested field. |
[in] | association | the mesh field association. |
[out] | num_components | the number of components per tuple (optional). |
References axom::mint::Mesh::getFieldPtr().
|
inlineinherited |
|
inlineinherited |
References axom::mint::Mesh::getFieldData(), axom::mint::FieldData::getFieldPtr(), and SLIC_ASSERT.
|
inlineinherited |
|
protectedinherited |
|
protectedinherited |
mesh dimension
|
protectedinherited |
the type of the mesh
|
protectedinherited |
the Block ID of the mesh
|
protectedinherited |
the partition ID of the mesh
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |