AutoPas  3.0.0
Loading...
Searching...
No Matches
Functions
autopas::utils::ThreeDimensionalMapping Namespace Reference

Namespace to handle the conversion between one dimensional and three dimensional indices. More...

Functions

template<typename T >
constexpr T threeToOneD (T x, T y, T z, const std::array< T, 3 > &dims)
 Convert a 3d index to a 1d index.
 
template<typename T >
constexpr T threeToOneD (const std::array< T, 3 > &index3d, const std::array< T, 3 > &dims)
 Convert a 3d index to a 1d index.
 
template<typename T >
constexpr std::array< T, 3 > oneToThreeD (T ind, const std::array< T, 3 > &dims)
 Convert a 1d index to a 3d index.
 

Detailed Description

Namespace to handle the conversion between one dimensional and three dimensional indices.

The running index is x.

Function Documentation

◆ oneToThreeD()

template<typename T >
constexpr std::array< T, 3 > autopas::utils::ThreeDimensionalMapping::oneToThreeD ( ind,
const std::array< T, 3 > &  dims 
)
constexpr

Convert a 1d index to a 3d index.

Template Parameters
TType of the indices.
Parameters
indThe 1d index.
dimsThe total dimensions of the index space.
Returns
The 3d index.

◆ threeToOneD() [1/2]

template<typename T >
constexpr T autopas::utils::ThreeDimensionalMapping::threeToOneD ( const std::array< T, 3 > &  index3d,
const std::array< T, 3 > &  dims 
)
constexpr

Convert a 3d index to a 1d index.

Template Parameters
TType of the indices.
Parameters
index3dThe 3d index.
dimsThe total dimensions of the index space.
Returns
The 1d index.

◆ threeToOneD() [2/2]

template<typename T >
constexpr T autopas::utils::ThreeDimensionalMapping::threeToOneD ( x,
y,
z,
const std::array< T, 3 > &  dims 
)
constexpr

Convert a 3d index to a 1d index.

Template Parameters
TType of the indices.
Parameters
xx index of the 3d index.
yy index of the 3d index.
zz index of the 3d index.
dimsThe total dimensions of the index space.
Returns
The 1d index.