|
AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
|
This class encapsulates data for strided structured indexing and provides methods for creating/manipulating indices. More...
#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/main/src/axom/bump/views/StridedStructuredIndexing.hpp>
Public Types | |
| using | IndexType = IndexT |
| using | LogicalIndex = axom::StackArray< IndexType, NDIMS > |
Public Member Functions | |
| AXOM_HOST_DEVICE | StridedStructuredIndexing () |
| constructor More... | |
| AXOM_HOST_DEVICE | StridedStructuredIndexing (const LogicalIndex &dims, const LogicalIndex &offsets, const LogicalIndex &strides) |
| Constructor. More... | |
| AXOM_HOST_DEVICE IndexType | size () const |
| Return the number of values in the index space. More... | |
| AXOM_HOST_DEVICE const LogicalIndex & | logicalDimensions () const |
| Return the logical dimensions. More... | |
| AXOM_HOST_DEVICE IndexType ::type | jStride () const |
| template<size_t _ndims = NDIMS> | |
| AXOM_HOST_DEVICE std::enable_if< _ndims==3, IndexType >::type | kStride () const |
| Return the k stride. More... | |
| AXOM_HOST_DEVICE IndexType | globalToGlobal (const LogicalIndex &global) const |
| Turn a global logical index into an index. More... | |
| AXOM_HOST_DEVICE LogicalIndex | globalToLocal (const LogicalIndex &global) const |
| Convert global logical index to a local one. More... | |
| AXOM_HOST_DEVICE IndexType | globalToLocal (IndexType global) const |
| Turn a global index into a local index. More... | |
| AXOM_HOST_DEVICE LogicalIndex | localToGlobal (const LogicalIndex &local) const |
| Convert local logical index to a global one. More... | |
| AXOM_HOST_DEVICE IndexType | localToGlobal (IndexType local) const |
| Convert local logical index to a global one. More... | |
| AXOM_HOST_DEVICE IndexType | logicalIndexToIndex (const LogicalIndex &logical) const |
| Turn a local logical index into a local flat index. More... | |
| AXOM_HOST_DEVICE bool | contains (const LogicalIndex &logical) const |
| Determines whether the indexing contains the supplied logical index. More... | |
| AXOM_HOST_DEVICE bool | contains (IndexType index) const |
| Determines whether the indexing contains the supplied index. More... | |
| template<int _ndims = NDIMS> | |
| AXOM_HOST_DEVICE std::enable_if< _ndims==1, LogicalIndex >::type | globalToGlobal (IndexType global) const |
| Turn a global index into a global logical index. More... | |
| template<int _ndims = NDIMS> | |
| AXOM_HOST_DEVICE std::enable_if< _ndims==2, LogicalIndex >::type | globalToGlobal (IndexType global) const |
| template<int _ndims = NDIMS> | |
| AXOM_HOST_DEVICE std::enable_if< _ndims==3, LogicalIndex >::type | globalToGlobal (IndexType global) const |
| template<int _ndims = NDIMS> | |
| AXOM_HOST_DEVICE std::enable_if< _ndims==1, LogicalIndex >::type | indexToLogicalIndex (IndexType index) const |
| Turn a local index into a local logical index. More... | |
| template<int _ndims = NDIMS> | |
| AXOM_HOST_DEVICE std::enable_if< _ndims==2, LogicalIndex >::type | indexToLogicalIndex (IndexType index) const |
| template<int _ndims = NDIMS> | |
| AXOM_HOST_DEVICE std::enable_if< _ndims==3, LogicalIndex >::type | indexToLogicalIndex (IndexType index) const |
| template<int _ndims = NDIMS> | |
| AXOM_HOST_DEVICE std::enable_if< _ndims==1, StridedStructuredIndexing >::type | expand () const |
| Expand the current StridedStructuredIndexing by one in each dimension. More... | |
| template<int _ndims = NDIMS> | |
| AXOM_HOST_DEVICE std::enable_if< _ndims==2, StridedStructuredIndexing >::type | expand () const |
| template<int _ndims = NDIMS> | |
| AXOM_HOST_DEVICE std::enable_if< _ndims==3, StridedStructuredIndexing >::type | expand () const |
| AXOM_HOST_DEVICE LogicalIndex | clamp (const LogicalIndex &logical) const |
| Given a logical index that may or may not be in the index space, return a clamped logical index that is in the index space. The logical indices are clamped to [0, dimensions-1] in each dimension. More... | |
| IndexType | clamp (IndexType index) const |
Static Public Member Functions | |
| constexpr static AXOM_HOST_DEVICE int | dimension () |
| static constexpr AXOM_HOST_DEVICE bool | supports_strided_structured_indexing () |
| Return whether the view supports strided structured indexing. More... | |
Public Attributes | |
| LogicalIndex | m_dimensions {} |
| LogicalIndex | m_offsets {} |
| LogicalIndex | m_strides {} |
This class encapsulates data for strided structured indexing and provides methods for creating/manipulating indices.
| IndexT | The type used for indices. |
| NDIMS | The number of dimensions. |
Strided structured indexing lets us index part of a larger overall indexing space. We can index it using indices local to the selected window and the class provides a mechanism to return indices in the overall indexing space.
Example:
x—x—x—x—x—x—x | | | | | | | x—x—*—*—*—*—x *=real node, x=ignored node, O=origin node 16 | | | | | | | x—x—*—*—*—*—x dims={4,3} | | | | | | | origin={2,2} x—x—O—*—*—*—x stride={1,7} | | | | | | | x—x—x—x—x—x—x | | | | | | | x—x—x—x—x—x—x
| using axom::bump::views::StridedStructuredIndexing< IndexT, NDIMS >::IndexType = IndexT |
| using axom::bump::views::StridedStructuredIndexing< IndexT, NDIMS >::LogicalIndex = axom::StackArray<IndexType, NDIMS> |
|
inline |
|
inline |
Constructor.
| dims | The number of zones in each logical dimension. |
| offsets | The offset of the first zone from the mesh origin in each logical dimension. |
| strides | The amount to stride when moving to the next element for each logical dimension. |
References axom::bump::views::StridedStructuredIndexing< IndexT, NDIMS >::m_dimensions, and SLIC_ERROR_IF.
|
inlinestaticconstexpr |
|
inlinestaticconstexpr |
Return whether the view supports strided structured indexing.
|
inline |
Return the number of values in the index space.
References axom::bump::views::StridedStructuredIndexing< IndexT, NDIMS >::m_dimensions.
|
inline |
Return the logical dimensions.
References axom::bump::views::StridedStructuredIndexing< IndexT, NDIMS >::m_dimensions.
|
inline |
|
inline |
Return the k stride.
References axom::bump::views::StridedStructuredIndexing< IndexT, NDIMS >::m_strides.
|
inline |
Turn a global logical index into an index.
| global | The global logical index to convert. |
References axom::bump::views::StridedStructuredIndexing< IndexT, NDIMS >::m_strides.
|
inline |
Turn a global index into a global logical index.
| global | The index to convert. |
|
inline |
|
inline |
|
inline |
Convert global logical index to a local one.
| local | The local logical index. |
References axom::bump::views::StridedStructuredIndexing< IndexT, NDIMS >::m_offsets.
|
inline |
Turn a global index into a local index.
| global | The index to convert. |
References axom::bump::views::StridedStructuredIndexing< IndexT, NDIMS >::globalToGlobal(), axom::bump::views::StridedStructuredIndexing< IndexT, NDIMS >::globalToLocal(), and axom::bump::views::StridedStructuredIndexing< IndexT, NDIMS >::logicalIndexToIndex().
|
inline |
Convert local logical index to a global one.
| local | The local logical index. |
References axom::bump::views::StridedStructuredIndexing< IndexT, NDIMS >::m_offsets.
|
inline |
Convert local logical index to a global one.
| local | The local logical index. |
References axom::bump::views::StridedStructuredIndexing< IndexT, NDIMS >::globalToGlobal(), axom::bump::views::StridedStructuredIndexing< IndexT, NDIMS >::indexToLogicalIndex(), and axom::bump::views::StridedStructuredIndexing< IndexT, NDIMS >::localToGlobal().
|
inline |
Turn a local index into a local logical index.
| index | The index to convert. |
|
inline |
|
inline |
|
inline |
Turn a local logical index into a local flat index.
| logical | The logical indexto convert to a flat index. |
References axom::bump::views::StridedStructuredIndexing< IndexT, NDIMS >::m_dimensions.
|
inline |
Determines whether the indexing contains the supplied logical index.
| logical | The logical index being tested. |
References axom::bump::views::StridedStructuredIndexing< IndexT, NDIMS >::dimension(), and axom::bump::views::StridedStructuredIndexing< IndexT, NDIMS >::m_dimensions.
|
inline |
Determines whether the indexing contains the supplied index.
| index | The index being tested. |
References axom::bump::views::StridedStructuredIndexing< IndexT, NDIMS >::contains(), and axom::bump::views::StridedStructuredIndexing< IndexT, NDIMS >::indexToLogicalIndex().
|
inline |
Expand the current StridedStructuredIndexing by one in each dimension.
References axom::bump::views::StridedStructuredIndexing< IndexT, NDIMS >::m_dimensions.
|
inline |
|
inline |
|
inline |
Given a logical index that may or may not be in the index space, return a clamped logical index that is in the index space. The logical indices are clamped to [0, dimensions-1] in each dimension.
| logical | The input logical index being clamped. |
| A | new LogicalIndex that is in the index space. |
References axom::utilities::clampVal(), axom::bump::views::StridedStructuredIndexing< IndexT, NDIMS >::dimension(), and axom::bump::views::StridedStructuredIndexing< IndexT, NDIMS >::m_dimensions.
|
inline |
| LogicalIndex axom::bump::views::StridedStructuredIndexing< IndexT, NDIMS >::m_dimensions {} |
| LogicalIndex axom::bump::views::StridedStructuredIndexing< IndexT, NDIMS >::m_offsets {} |
| LogicalIndex axom::bump::views::StridedStructuredIndexing< IndexT, NDIMS >::m_strides {} |