NDEVR
API Documentation
GridIndexing< t_dims >

Converts 1 dimensional index into N dimensional index based on size of each dimension. More...

Inheritance diagram for GridIndexing< t_dims >:
[legend]
Collaboration diagram for GridIndexing< t_dims >:
[legend]

Public Member Functions

Vector< t_dims, uint04convertFromIndex (const uint04 &location) const
 Converts a flat 1D index back into an N-dimensional grid coordinate.
uint04 convertToIndex (const Vector< t_dims, uint04 > &location) const
 Converts an N-dimensional grid coordinate into a flat 1D index using row-major ordering.
void setSize (Vector< t_dims, uint04 > index_size)
 Sets the size of the grid in each dimension.

Static Public Member Functions

static constexpr uint01 getNumberOfCorners ()
 Returns the number of corners for a grid cell of the given dimensionality.

Protected Attributes

Vector< t_dims, uint04m_size
 The number of elements along each dimension of the grid.

Detailed Description

template<uint01 t_dims>
class GridIndexing< t_dims >

Converts 1 dimensional index into N dimensional index based on size of each dimension.


Definition at line 41 of file GriddedMesh.h.

Member Function Documentation

◆ convertFromIndex()

template<uint01 t_dims>
Vector< t_dims, uint04 > GridIndexing< t_dims >::convertFromIndex ( const uint04 & location) const
inline

Converts a flat 1D index back into an N-dimensional grid coordinate.


Parameters
[in]locationThe flat 1D index to convert.
Returns
The corresponding N-dimensional grid coordinate.

Definition at line 66 of file GriddedMesh.h.

References m_size.

Referenced by GridMesh< t_dims >::setupVertexTable().

◆ convertToIndex()

template<uint01 t_dims>
uint04 GridIndexing< t_dims >::convertToIndex ( const Vector< t_dims, uint04 > & location) const
inline

Converts an N-dimensional grid coordinate into a flat 1D index using row-major ordering.


Parameters
[in]locationThe N-dimensional grid coordinate to convert.
Returns
The corresponding flat 1D index into the underlying data array.

Definition at line 49 of file GriddedMesh.h.

References m_size.

Referenced by GridMesh< t_dims >::getVertexProperty(), GridMesh< t_dims >::setVertex(), GridMesh< t_dims >::setVertexProperty(), and GridMesh< t_dims >::vertex().

◆ getNumberOfCorners()

template<uint01 t_dims>
constexpr uint01 GridIndexing< t_dims >::getNumberOfCorners ( )
inlinestaticconstexpr

Returns the number of corners for a grid cell of the given dimensionality.


For 1D returns 2 (line segment endpoints), for 2D returns 4 (quad corners), for 3D returns 8 (cube/hexahedron corners).

Returns
The number of corners for a cell in t_dims dimensions.

Definition at line 95 of file GriddedMesh.h.

◆ setSize()

template<uint01 t_dims>
void GridIndexing< t_dims >::setSize ( Vector< t_dims, uint04 > index_size)
inline

Sets the size of the grid in each dimension.


Parameters
[in]index_sizeThe number of elements along each dimension.

Definition at line 110 of file GriddedMesh.h.

References m_size.

Referenced by GridMesh< t_dims >::setupVertexTable().


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