morton-arithmetic 0.1.0
Fast Morton (Z-order) codes with O(1) arithmetic
Loading...
Searching...
No Matches
morton Namespace Reference

Namespaces

namespace  batch
 
namespace  detail
 
namespace  kokkos
 

Classes

class  Morton
 A Morton (Z-order) code interleaving Dim unsigned coordinates of Bits bits each. More...
 

Typedefs

using Morton2D32 = Morton< 2, 32 >
 
using Morton2D16 = Morton< 2, 16 >
 
using Morton3D21 = Morton< 3, 21 >
 
using Morton3D16 = Morton< 3, 16 >
 
using Morton3D32 = Morton< 3, 32 >
 
using Morton2D64 = Morton< 2, 64 >
 

Functions

template<unsigned Dim, unsigned Bits, typename Fn >
void for_each_in_box (const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &lo, const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &hi, Fn &&fn)
 Visit every cell of the inclusive box [lo, hi] in row-major order (axis 0 varies fastest).
 
template<unsigned Dim, unsigned Bits>
bool bigmin_in_box (const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &lo, const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &hi, Morton< Dim, Bits > probe, Morton< Dim, Bits > &out)
 Smallest Morton code in the inclusive box [lo, hi] that is strictly greater than probe.
 
template<unsigned Dim, unsigned Bits>
bool litmax_in_box (const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &lo, const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &hi, Morton< Dim, Bits > probe, Morton< Dim, Bits > &out)
 Largest Morton code in the inclusive box [lo, hi] that is strictly less than probe.
 
template<unsigned Dim, unsigned Bits>
MORTON_HD bool in_box (const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &lo, const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &hi, Morton< Dim, Bits > m)
 Test whether m lies inside the inclusive box [lo, hi].
 
template<unsigned Dim, unsigned Bits, typename Fn >
void for_each_in_box_zorder (const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &lo, const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &hi, Fn &&fn)
 Visit every cell of the inclusive box [lo, hi] in Z-order (increasing Morton code), skipping the gaps between rows with BIGMIN.
 

Typedef Documentation

◆ Morton2D32

using morton::Morton2D32 = typedef Morton<2, 32>

◆ Morton2D16

using morton::Morton2D16 = typedef Morton<2, 16>

◆ Morton3D21

using morton::Morton3D21 = typedef Morton<3, 21>

◆ Morton3D16

using morton::Morton3D16 = typedef Morton<3, 16>

◆ Morton3D32

using morton::Morton3D32 = typedef Morton<3, 32>

◆ Morton2D64

using morton::Morton2D64 = typedef Morton<2, 64>

Function Documentation

◆ for_each_in_box()

template<unsigned Dim, unsigned Bits, typename Fn >
void morton::for_each_in_box ( const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &  lo,
const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &  hi,
Fn &&  fn 
)

Visit every cell of the inclusive box [lo, hi] in row-major order (axis 0 varies fastest).

Advancing from one cell to the next costs O(1) amortised Morton arithmetic; the full coordinate tuple is never re-encoded.

◆ bigmin_in_box()

template<unsigned Dim, unsigned Bits>
bool morton::bigmin_in_box ( const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &  lo,
const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &  hi,
Morton< Dim, Bits >  probe,
Morton< Dim, Bits > &  out 
)

Smallest Morton code in the inclusive box [lo, hi] that is strictly greater than probe.

Returns false if there is none.

◆ litmax_in_box()

template<unsigned Dim, unsigned Bits>
bool morton::litmax_in_box ( const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &  lo,
const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &  hi,
Morton< Dim, Bits >  probe,
Morton< Dim, Bits > &  out 
)

Largest Morton code in the inclusive box [lo, hi] that is strictly less than probe.

Returns false if there is none.

◆ in_box()

template<unsigned Dim, unsigned Bits>
MORTON_HD bool morton::in_box ( const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &  lo,
const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &  hi,
Morton< Dim, Bits >  m 
)

Test whether m lies inside the inclusive box [lo, hi].

◆ for_each_in_box_zorder()

template<unsigned Dim, unsigned Bits, typename Fn >
void morton::for_each_in_box_zorder ( const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &  lo,
const std::array< typename Morton< Dim, Bits >::coord_type, Dim > &  hi,
Fn &&  fn 
)

Visit every cell of the inclusive box [lo, hi] in Z-order (increasing Morton code), skipping the gaps between rows with BIGMIN.