#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/v0.5.0/src/axom/spin/MortonIndex.hpp>
|
enum | {
NDIM = 2,
COORD_BITS = std::numeric_limits<CoordType>::digits,
MORTON_BITS = std::numeric_limits<MortonIndexType>::digits,
MB_PER_DIM = MORTON_BITS / NDIM,
MAX_UNIQUE_BITS = (MB_PER_DIM < COORD_BITS) ? MB_PER_DIM : COORD_BITS,
CONTRACT_MAX_ITER = NumReps<MortonIndexType>::value,
EXPAND_MAX_ITER = NumReps<MortonIndexType>::value
} |
|
using | self = Mortonizer< CoordType, MortonIndexType, 2 > |
|
using | Base = MortonBase< CoordType, MortonIndexType, self > |
|
|
| AXOM_STATIC_ASSERT_MSG (std::is_integral< CoordType >::value, "Coordtype must be integral for Morton indexing") |
|
| AXOM_STATIC_ASSERT_MSG (std::is_integral< MortonIndexType >::value, "MortonIndexType must be integral for Morton indexing") |
|
|
static MortonIndexType | mortonize (CoordType x, CoordType y) |
| A function to convert a 2D point to a Morton index. More...
|
|
static MortonIndexType | mortonize (const primal::Point< CoordType, NDIM > &pt) |
| A function to convert a 2D point to a Morton index. More...
|
|
static void | demortonize (MortonIndexType morton, CoordType &x, CoordType &y) |
| A function to convert a Morton index back to a 2D point. More...
|
|
static primal::Point< CoordType, NDIM > | demortonize (MortonIndexType morton) |
| A function to convert a Morton index back to a 2D point. More...
|
|
static int | maxBitsPerCoord () |
| returns the maximum number of bits per coordinate More...
|
|
static int | maxSetBit (CoordType x) |
| Finds the index of the maximum set bit (MSB) in an integral type. More...
|
|
|
static const MortonIndexType | B [] |
|
static const int | S [] = {1, 2, 4, 8, 16, 32} |
|
|
static MortonIndexType | expandBits (MortonIndexType x) |
| Expands bits in bitwise representation of an integral type and zero-fills the holes. More...
|
|
static MortonIndexType | contractBits (MortonIndexType x) |
| Contracts bits in bitwise representation of x. More...
|
|
◆ self
template<typename CoordType , typename MortonIndexType >
◆ Base
template<typename CoordType , typename MortonIndexType >
◆ anonymous enum
template<typename CoordType , typename MortonIndexType >
Enumerator |
---|
NDIM | The dimension of the Mortonizer
|
COORD_BITS | The number of bits in a CoordType
|
MORTON_BITS | The number of bits in a MortonIndex
|
MB_PER_DIM | The number of representable Morton bits per dimension
|
MAX_UNIQUE_BITS | The maximum number of unique bits from each coordinate of type CoordType that can be represented in a MortonIndex.
- Note
- If we are use Mortonizer as a (one-way) hash function, it is ok to use more bits. But, if we would like to be able to reverse the MortonIndex, then we cannot safely use more than MAX_UNIQUE_BITS per coordinate.
|
CONTRACT_MAX_ITER | The number of iterations required for converting from MortonIndexes to CoordType using the bit interleaving algorithm in MortonBase.
|
EXPAND_MAX_ITER | The number of iterations required for converting between CoordTypes and MortonIndexes using the bit interleaving algorithm in MortonBase.
|
◆ mortonize() [1/2]
template<typename CoordType , typename MortonIndexType >
static MortonIndexType axom::spin::Mortonizer< CoordType, MortonIndexType, 2 >::mortonize |
( |
CoordType |
x, |
|
|
CoordType |
y |
|
) |
| |
|
inlinestatic |
A function to convert a 2D point to a Morton index.
Morton indexing interleaves the bits of the point's coordinates
- Parameters
-
[in] | x | The x-coordinate of the point |
[in] | y | The y-coordinate of the point |
- Precondition
- CoordType must be an integral type
-
x and y must be positive with value less than \( 2^{16} \)
- Note
- These preconditions can easily be relaxed, if desired (e.g. to 32 bits for 64 bit Morton indices)
- Returns
- The MortonIndex of the 2D point
◆ mortonize() [2/2]
template<typename CoordType , typename MortonIndexType >
◆ demortonize() [1/2]
template<typename CoordType , typename MortonIndexType >
static void axom::spin::Mortonizer< CoordType, MortonIndexType, 2 >::demortonize |
( |
MortonIndexType |
morton, |
|
|
CoordType & |
x, |
|
|
CoordType & |
y |
|
) |
| |
|
inlinestatic |
A function to convert a Morton index back to a 2D point.
- Parameters
-
[in] | morton | The MortonIndex of the desired point |
[out] | x | The x-coordinate of the point |
[out] | y | The y-coordinate of the point Morton indexing interleaves the bits of the point's coordinates |
- Note
- The point's coordinates are returned in the x and y parameters
◆ demortonize() [2/2]
template<typename CoordType , typename MortonIndexType >
A function to convert a Morton index back to a 2D point.
- See also
- demortonize(MortonIndex,CoordType,CoordType)
◆ maxBitsPerCoord()
template<typename CoordType , typename MortonIndexType >
returns the maximum number of bits per coordinate
◆ AXOM_STATIC_ASSERT_MSG() [1/2]
axom::spin::MortonBase< CoordType, MortonIndexType, Mortonizer< CoordType, MortonIndexType, 2 > >::AXOM_STATIC_ASSERT_MSG |
( |
std::is_integral< CoordType >::value |
, |
|
|
"Coordtype must be integral for Morton indexing" |
|
|
) |
| |
|
inherited |
◆ AXOM_STATIC_ASSERT_MSG() [2/2]
axom::spin::MortonBase< CoordType, MortonIndexType, Mortonizer< CoordType, MortonIndexType, 2 > >::AXOM_STATIC_ASSERT_MSG |
( |
std::is_integral< MortonIndexType >::value |
, |
|
|
"MortonIndexType must be integral for Morton indexing" |
|
|
) |
| |
|
inherited |
◆ expandBits()
|
inlinestaticprotectedinherited |
Expands bits in bitwise representation of an integral type and zero-fills the holes.
- Parameters
-
[in] | x | The integer type that we are expanding |
- Returns
- A zero-filled expanded MortonIndex In dimension D, it adds (D-1) zeros between each bit, so, e.g. in 2D, 6 == 0b0110 becomes 0b*0*1*1*0 == 0b00010100 == 20
References B.
◆ contractBits()
|
inlinestaticprotectedinherited |
Contracts bits in bitwise representation of x.
- Parameters
-
[in] | x | The Morton index that we are contracting |
- Returns
- A contracted MortonIndex
In dimension D, it retains every (D-1) \(^th\) bit, so, e.g. in 2D, 20 = 0b00010100 == 0b*0*1*1*0 becomes 0b0110 = 6
References B.
◆ maxSetBit()
Finds the index of the maximum set bit (MSB) in an integral type.
template<typename CoordType , typename MortonIndexType >
Initial value:=
{static_cast<MortonIndexType>(0x5555555555555555),
static_cast<MortonIndexType>(0x3333333333333333),
static_cast<MortonIndexType>(0x0F0F0F0F0F0F0F0F),
static_cast<MortonIndexType>(0x00FF00FF00FF00FF),
static_cast<MortonIndexType>(0x0000FFFF0000FFFF),
static_cast<MortonIndexType>(0x00000000FFFFFFFF)}
template<typename CoordType , typename MortonIndexType >
The documentation for this struct was generated from the following file:
- /home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/v0.5.0/src/axom/spin/MortonIndex.hpp