#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/latest/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") |
|
◆ 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.
|
◆ GetB()
template<typename CoordType , typename MortonIndexType >
◆ GetS()
template<typename CoordType , typename MortonIndexType >
◆ mortonize() [1/2]
template<typename CoordType , typename MortonIndexType >
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 >
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
◆ 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
◆ maxSetBit()
Finds the index of the maximum set bit (MSB) in an integral type.
The documentation for this struct was generated from the following file:
- /home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/latest/src/axom/spin/MortonIndex.hpp