AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::bump::views::StructuredIndexing< IndexT, NDIMS > Class Template Reference

This class encapsulates a structured mesh size and contains methods to help with indexing into it. More...

#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/develop/src/axom/bump/views/StructuredIndexing.hpp>

Inheritance diagram for axom::bump::views::StructuredIndexing< IndexT, NDIMS >:

Public Types

using IndexType = IndexT
 
using LogicalIndex = axom::StackArray< IndexType, NDIMS >
 

Public Member Functions

AXOM_HOST_DEVICE StructuredIndexing ()
 constructor More...
 
AXOM_HOST_DEVICE StructuredIndexing (const LogicalIndex &dims)
 
AXOM_HOST_DEVICE IndexType size () const
 Return the number of points in the index space. More...
 
AXOM_HOST_DEVICE const LogicalIndexlogicalDimensions () const
 Return the logical dimensions. More...
 
AXOM_HOST_DEVICE IndexType ::type jStride () const
 
template<int _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 globalToGlobal (IndexType global) const
 Turn a global index into a global logical index. More...
 
AXOM_HOST_DEVICE LogicalIndex globalToLocal (const LogicalIndex &index) const
 Turn global logical index to local logical index. no-op. More...
 
AXOM_HOST_DEVICE IndexType globalToLocal (IndexType index) const
 Turn global index to local index. no-op. More...
 
AXOM_HOST_DEVICE LogicalIndex localToGlobal (const LogicalIndex &index) const
 Turn local logical index to global logical index. no-op. More...
 
AXOM_HOST_DEVICE IndexType localToGlobal (IndexType index) const
 Turn local index to global index. no-op. 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...
 
AXOM_HOST_DEVICE StructuredIndexing expand () const
 Expand the current StructuredIndexing by one in each dimension. More...
 
template<int _ndims = NDIMS>
AXOM_HOST_DEVICE std::enable_if< _ndims==1, LogicalIndex >::type indexToLogicalIndex (IndexType index) const
 Turn an index into a 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, IndexType >::type logicalIndexToIndex (const LogicalIndex &logical) const
 Turn a logical index into a flat index. More...
 
template<int _ndims = NDIMS>
AXOM_HOST_DEVICE std::enable_if< _ndims==2, IndexType >::type logicalIndexToIndex (const LogicalIndex &logical) const
 
template<int _ndims = NDIMS>
AXOM_HOST_DEVICE std::enable_if< _ndims==3, IndexType >::type logicalIndexToIndex (const LogicalIndex &logical) 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...
 

Detailed Description

template<typename IndexT, int NDIMS = 3>
class axom::bump::views::StructuredIndexing< IndexT, NDIMS >

This class encapsulates a structured mesh size and contains methods to help with indexing into it.

Template Parameters
IndexTThe type used for indices.
NDIMSThe number of dimensions.

Member Typedef Documentation

◆ IndexType

template<typename IndexT , int NDIMS = 3>
using axom::bump::views::StructuredIndexing< IndexT, NDIMS >::IndexType = IndexT

◆ LogicalIndex

template<typename IndexT , int NDIMS = 3>
using axom::bump::views::StructuredIndexing< IndexT, NDIMS >::LogicalIndex = axom::StackArray<IndexType, NDIMS>

Constructor & Destructor Documentation

◆ StructuredIndexing() [1/2]

template<typename IndexT , int NDIMS = 3>
AXOM_HOST_DEVICE axom::bump::views::StructuredIndexing< IndexT, NDIMS >::StructuredIndexing ( )
inline

constructor

Parameters
dimsThe dimensions we're indexing.

◆ StructuredIndexing() [2/2]

template<typename IndexT , int NDIMS = 3>
AXOM_HOST_DEVICE axom::bump::views::StructuredIndexing< IndexT, NDIMS >::StructuredIndexing ( const LogicalIndex dims)
inline

References SLIC_ERROR_IF.

Member Function Documentation

◆ dimension()

template<typename IndexT , int NDIMS = 3>
constexpr static AXOM_HOST_DEVICE int axom::bump::views::StructuredIndexing< IndexT, NDIMS >::dimension ( )
inlinestaticconstexpr

◆ supports_strided_structured_indexing()

template<typename IndexT , int NDIMS = 3>
static constexpr AXOM_HOST_DEVICE bool axom::bump::views::StructuredIndexing< IndexT, NDIMS >::supports_strided_structured_indexing ( )
inlinestaticconstexpr

Return whether the view supports strided structured indexing.

Returns
false

◆ size()

template<typename IndexT , int NDIMS = 3>
AXOM_HOST_DEVICE IndexType axom::bump::views::StructuredIndexing< IndexT, NDIMS >::size ( ) const
inline

Return the number of points in the index space.

Returns
The number of points in the index space.

◆ logicalDimensions()

template<typename IndexT , int NDIMS = 3>
AXOM_HOST_DEVICE const LogicalIndex& axom::bump::views::StructuredIndexing< IndexT, NDIMS >::logicalDimensions ( ) const
inline

Return the logical dimensions.

Returns
The logical dimensions.

◆ jStride()

template<typename IndexT , int NDIMS = 3>
AXOM_HOST_DEVICE IndexType ::type axom::bump::views::StructuredIndexing< IndexT, NDIMS >::jStride ( ) const
inline

◆ kStride()

template<typename IndexT , int NDIMS = 3>
template<int _ndims = NDIMS>
AXOM_HOST_DEVICE std::enable_if<_ndims == 3, IndexType>::type axom::bump::views::StructuredIndexing< IndexT, NDIMS >::kStride ( ) const
inline

Return the k stride.

Returns
The k stride to move forward a "page".

◆ globalToGlobal() [1/2]

template<typename IndexT , int NDIMS = 3>
AXOM_HOST_DEVICE IndexType axom::bump::views::StructuredIndexing< IndexT, NDIMS >::globalToGlobal ( const LogicalIndex global) const
inline

Turn a global logical index into an index.

Parameters
globalThe global logical index to convert.
Returns
The global index.

References axom::bump::views::StructuredIndexing< IndexT, NDIMS >::logicalIndexToIndex().

◆ globalToGlobal() [2/2]

template<typename IndexT , int NDIMS = 3>
AXOM_HOST_DEVICE LogicalIndex axom::bump::views::StructuredIndexing< IndexT, NDIMS >::globalToGlobal ( IndexType  global) const
inline

Turn a global index into a global logical index.

Parameters
globalThe global index to convert.
Returns
The global logical index.

References axom::bump::views::StructuredIndexing< IndexT, NDIMS >::indexToLogicalIndex().

◆ globalToLocal() [1/2]

template<typename IndexT , int NDIMS = 3>
AXOM_HOST_DEVICE LogicalIndex axom::bump::views::StructuredIndexing< IndexT, NDIMS >::globalToLocal ( const LogicalIndex index) const
inline

Turn global logical index to local logical index. no-op.

Parameters
indexThe index to convert.
Returns
Same as the input in this case.

◆ globalToLocal() [2/2]

template<typename IndexT , int NDIMS = 3>
AXOM_HOST_DEVICE IndexType axom::bump::views::StructuredIndexing< IndexT, NDIMS >::globalToLocal ( IndexType  index) const
inline

Turn global index to local index. no-op.

Parameters
indexThe index to convert.
Returns
Same as the input in this case.

◆ localToGlobal() [1/2]

template<typename IndexT , int NDIMS = 3>
AXOM_HOST_DEVICE LogicalIndex axom::bump::views::StructuredIndexing< IndexT, NDIMS >::localToGlobal ( const LogicalIndex index) const
inline

Turn local logical index to global logical index. no-op.

Parameters
indexThe index to convert.
Returns
Same as the input in this case.

◆ localToGlobal() [2/2]

template<typename IndexT , int NDIMS = 3>
AXOM_HOST_DEVICE IndexType axom::bump::views::StructuredIndexing< IndexT, NDIMS >::localToGlobal ( IndexType  index) const
inline

Turn local index to global index. no-op.

Parameters
indexThe index to convert.
Returns
Same as the input in this case.

◆ indexToLogicalIndex() [1/3]

template<typename IndexT , int NDIMS = 3>
template<int _ndims = NDIMS>
AXOM_HOST_DEVICE std::enable_if<_ndims == 1, LogicalIndex>::type axom::bump::views::StructuredIndexing< IndexT, NDIMS >::indexToLogicalIndex ( IndexType  index) const
inline

Turn an index into a logical index.

Parameters
indexThe index to convert.
Returns
The logical index that corresponds to the index.

◆ indexToLogicalIndex() [2/3]

template<typename IndexT , int NDIMS = 3>
template<int _ndims = NDIMS>
AXOM_HOST_DEVICE std::enable_if<_ndims == 2, LogicalIndex>::type axom::bump::views::StructuredIndexing< IndexT, NDIMS >::indexToLogicalIndex ( IndexType  index) const
inline

◆ indexToLogicalIndex() [3/3]

template<typename IndexT , int NDIMS = 3>
template<int _ndims = NDIMS>
AXOM_HOST_DEVICE std::enable_if<_ndims == 3, LogicalIndex>::type axom::bump::views::StructuredIndexing< IndexT, NDIMS >::indexToLogicalIndex ( IndexType  index) const
inline

◆ logicalIndexToIndex() [1/3]

template<typename IndexT , int NDIMS = 3>
template<int _ndims = NDIMS>
AXOM_HOST_DEVICE std::enable_if<_ndims == 1, IndexType>::type axom::bump::views::StructuredIndexing< IndexT, NDIMS >::logicalIndexToIndex ( const LogicalIndex logical) const
inline

Turn a logical index into a flat index.

Parameters
logicalThe logical indexto convert to a flat index.
Returns
The index that corresponds to the logical index.

◆ logicalIndexToIndex() [2/3]

template<typename IndexT , int NDIMS = 3>
template<int _ndims = NDIMS>
AXOM_HOST_DEVICE std::enable_if<_ndims == 2, IndexType>::type axom::bump::views::StructuredIndexing< IndexT, NDIMS >::logicalIndexToIndex ( const LogicalIndex logical) const
inline

◆ logicalIndexToIndex() [3/3]

template<typename IndexT , int NDIMS = 3>
template<int _ndims = NDIMS>
AXOM_HOST_DEVICE std::enable_if<_ndims == 3, IndexType>::type axom::bump::views::StructuredIndexing< IndexT, NDIMS >::logicalIndexToIndex ( const LogicalIndex logical) const
inline

◆ contains() [1/2]

template<typename IndexT , int NDIMS = 3>
AXOM_HOST_DEVICE bool axom::bump::views::StructuredIndexing< IndexT, NDIMS >::contains ( const LogicalIndex logical) const
inline

Determines whether the indexing contains the supplied logical index.

Parameters
logicalThe logical index being tested.
Returns
True if the logical index is within the index, false otherwise.

References axom::bump::views::StructuredIndexing< IndexT, NDIMS >::dimension().

◆ contains() [2/2]

template<typename IndexT , int NDIMS = 3>
AXOM_HOST_DEVICE bool axom::bump::views::StructuredIndexing< IndexT, NDIMS >::contains ( IndexType  index) const
inline

Determines whether the indexing contains the supplied index.

Parameters
indexThe index being tested.
Returns
True if the index is within the index, false otherwise.

References axom::bump::views::StructuredIndexing< IndexT, NDIMS >::contains(), and axom::bump::views::StructuredIndexing< IndexT, NDIMS >::indexToLogicalIndex().

◆ expand()

template<typename IndexT , int NDIMS = 3>
AXOM_HOST_DEVICE StructuredIndexing axom::bump::views::StructuredIndexing< IndexT, NDIMS >::expand ( ) const
inline

Expand the current StructuredIndexing by one in each dimension.

Returns
An expanded StructuredIndexing.

References axom::bump::views::StructuredIndexing< IndexT, NDIMS >::dimension().

◆ clamp() [1/2]

template<typename IndexT , int NDIMS = 3>
AXOM_HOST_DEVICE LogicalIndex axom::bump::views::StructuredIndexing< IndexT, NDIMS >::clamp ( const LogicalIndex logical) const
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.

Parameters
logicalThe input logical index being clamped.
Return values
Anew LogicalIndex that is in the index space.

References axom::utilities::clampVal(), and axom::bump::views::StructuredIndexing< IndexT, NDIMS >::dimension().

◆ clamp() [2/2]


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