|
| ConnectivityArray ()=delete |
| Default constructor. Disabled. More...
|
|
void | append (const IndexType *values, IndexType AXOM_UNUSED_PARAM(n_values)=0, CellType AXOM_UNUSED_PARAM(type)=UNDEFINED_CELL) |
| Appends an ID. More...
|
|
void | appendM (const IndexType *values, IndexType n_IDs, const IndexType *AXOM_UNUSED_PARAM(offsets)=nullptr, const CellType *AXOM_UNUSED_PARAM(types)=nullptr) |
| Adds multiple IDs. More...
|
|
void | set (const IndexType *values, IndexType ID) |
| Sets the values of the given ID. More...
|
|
void | setM (const IndexType *values, IndexType start_ID, IndexType n_IDs) |
| Sets the values of multiple IDs starting with the given ID. More...
|
|
void | insert (const IndexType *values, IndexType start_ID, IndexType AXOM_UNUSED_PARAM(n_values)=0, CellType AXOM_UNUSED_PARAM(type)=UNDEFINED_CELL) |
| Insert the values of a new ID before the given ID. More...
|
|
void | insertM (const IndexType *values, IndexType start_ID, IndexType n_IDs, const IndexType *AXOM_UNUSED_PARAM(offsets)=nullptr, const CellType *AXOM_UNUSED_PARAM(types)=nullptr) |
| Insert the values of multiple IDs before the given ID. More...
|
|
|
| ConnectivityArray (CellType cell_type, IndexType ID_capacity=USE_DEFAULT) |
| Constructs an empty ConnectivityArray instance. More...
|
|
| ConnectivityArray (IndexType stride, IndexType ID_capacity=USE_DEFAULT) |
| Constructs an empty ConnectivityArray instance. More...
|
|
|
| ConnectivityArray (CellType cell_type, IndexType n_IDs, IndexType *values, IndexType ID_capacity=USE_DEFAULT) |
| External constructor which creates a ConnectivityArray instance to wrap the given pointer. More...
|
|
| ConnectivityArray (IndexType stride, IndexType n_IDs, IndexType *values, IndexType ID_capacity=USE_DEFAULT) |
| External constructor which creates a ConnectivityArray instance to wrap the given pointer. More...
|
|
|
IndexType | getNumberOfIDs () const |
| Returns the total number of IDs. More...
|
|
IndexType | getIDCapacity () const |
| Returns the number of IDs available for storage without resizing. More...
|
|
IndexType | getNumberOfValues () const |
| Returns the number of values in this ConnectivityArray instance. More...
|
|
IndexType | getValueCapacity () const |
| Returns the number of values available for storage without resizing. More...
|
|
void | reserve (IndexType ID_capacity, IndexType AXOM_UNUSED_PARAM(value_capacity)=0) |
| Reserve space for IDs and values. More...
|
|
void | resize (IndexType ID_size, IndexType AXOM_UNUSED_PARAM(value_size)=0) |
| Resize space to hold the specified number of IDs. More...
|
|
void | shrink () |
| Shrink the array so that there is no extra capacity. More...
|
|
double | getResizeRatio () const |
| Get the resize ratio. More...
|
|
void | setResizeRatio (double ratio) |
| Set the resize ratio. More...
|
|
bool | hasVariableValuesPerID () const |
| Checks if this CellConnecitivity instance has a variable number of values per ID. More...
|
|
bool | empty () const |
| Return true if this ConnectivityArray instance is empty. More...
|
|
bool | isExternal () const |
| Return true iff constructed via the external constructor. More...
|
|
bool | isInSidre () const |
| Return true iff constructed via the sidre constructors. More...
|
|
|
IndexType | getNumberOfValuesForID (IndexType AXOM_UNUSED_PARAM(ID)=0) const |
| Returns the number of values for the given ID. More...
|
|
CellType | getIDType (IndexType AXOM_UNUSED_PARAM(ID)=0) const |
| Returns the cell type of the given ID. More...
|
|
IndexType * | operator[] (IndexType ID) |
| Access operator for the values of the given ID. More...
|
|
const IndexType * | operator[] (IndexType ID) const |
|
|
IndexType * | getValuePtr () |
| Returns a pointer to the values array, of length getNumberOfValues(). More...
|
|
const IndexType * | getValuePtr () const |
|
|
IndexType * | getOffsetPtr () |
| Returns a pointer to the offsets array. Since this version of the ConnectivityArray does not have an offsets array this function returns a null pointer. More...
|
|
const IndexType * | getOffsetPtr () const |
|
|
CellType * | getTypePtr () |
| Returns a pointer to the types array. Since this version of the ConnectivityArray does not have a types array this function returns a null pointer. More...
|
|
const CellType * | getTypePtr () const |
|
template<ConnectivityType TYPE>
class axom::mint::ConnectivityArray< TYPE >
Provides an interface for general mesh connectivity.
The ConnectivityArray is a map between IDs and values where each ID can be a different type and have a different number of values. A ConnectivityArray with N IDs has IDs from [0, N-1] whereas the values for each ID can be anything within the range of IndexType.
The ConnectivityArray object may be constructed using (a) native storage, (b) external storage, or, (c) Sidre:
Native Storage
When using native storage, the ConnectivityArray object owns all associated memory. The storage can dynamically grow as needed, e.g. when adding more IDs. Typically, extra space is allocated to minimize the number of re-allocations. At any given instance, the total ID/value capacity can be queried by calling the getIDCapacity()/getValueCapacity() functions. The extra memory can be returned to the system by calling the shrink() method.
When all extra memory is exhausted, appending a new ID triggers a re-allocation. The amount of extra space that is allocated is according to the resize_ratio parameter, which is set to 2.0 by default. The resize_ratio may be queried and set to a different value by the getResizeRatio() and setResizeRatio() functions respectively.
When the ConnectivityArray object goes out-of-scope, all memory associated with the given instance is returned to the system.
External Storage
A ConnectivityArray object may also be constructed from external, user-supplied buffers that store the various arrays. In this case, the memory is owned by the caller. The ConnectivityArray object just keeps pointers to the user-supplied buffers.
- Warning
- Since the memory is not owned by the ConnectivityArray object when external buffers are supplied, the ConnectivityArray object cannot dynamically grow the storage. Consequently, the number of IDs/values the ConnectivityArray instance can hold is fixed. All calls to
shrink()
and reserve()
will fail.
-
Moreover, when the ConnectivityArray object goes out-of-scope, the associated buffers are not deleted. The caller owns the external data and has the responsibility of properly de-allocating the associated memory.
Sidre
A ConnectivityArray object may also be constructed from a sidre::Group which conforms to a topology of the mesh blueprint .
A ConnectivityArray object that is bound to a particular sidre::Group supports all operations transparently including dynamically growing the storage to hold more nodes as needed, but instead Sidre owns the memory. All memory management operations are delegated to Sidre.
- Warning
- Once the ConnectivityArray object goes out-of-scope, the data remains persistent in Sidre.
-
Reallocations tend to be costly operations in terms of performance. Use
reserveIDs()
/reserveValues()
when the number of IDs/values is known a priori, or opt to use a constructor that takes a size and capacity when possible.
In this non-specialized ConnectivityArray it is assumed that each ID is of the same type and has the same number of values. Template specializations deal with the case where the number of values per ID differ but the type remains the same and the case where both differ.
- Template Parameters
-
TYPE | the type of the ConnectivityArray this class deals with the case of TYPE == NO_INDIRECTION. |
- See also
- ConnectivityArray_typed_indirection.hpp
-
ConnectivityArray_internal.hpp