core 1.8.1
Shared MPI block decomposition, asynchronous ghost-layer exchange, SDF geometry, load balancing (header-only C++20)
Loading...
Searching...
No Matches
peclet::core::decomp::MortonIndexer< Dim, Bits > Class Template Reference

Z-order (Morton) indexer over an axis-origin-relative cell block. More...

#include <morton_indexer.hpp>

Public Types

using M = morton::Morton<Dim, Bits>
using Code = typename M::code_type
using Coord = typename M::coord_type

Public Member Functions

 MortonIndexer ()=default
 MortonIndexer (IVec< Dim > origin, IVec< Dim > size)
void init (IVec< Dim > origin, IVec< Dim > size)
const IVec< Dim > & origin () const
const IVec< Dim > & size () const
MORTON_HD Code codeOf (const IVec< Dim > &g) const
 Global multi-index → Z-order code (origin-relative).
MORTON_HD IVec< Dim > multiIndex (Code c) const
 Z-order code → global multi-index (inverse of codeOf).
MORTON_HD Code neighborCode (Code c, int axis, int dir) const
 Neighbour code one cell along ±axis, computed directly in Morton space (the headline O(1) morton arithmetic — no decode/re-encode).

Static Public Member Functions

static constexpr unsigned bits ()

Detailed Description

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
class peclet::core::decomp::MortonIndexer< Dim, Bits >

Z-order (Morton) indexer over an axis-origin-relative cell block.

Bits is the per-axis code width; the default keeps the code in a built-in 64-bit integer (3D: 21 bits/axis → 96-bit codes use __uint128, so we cap the default at 21 for a 64-bit code_type in 3D and 32 in 2D). A block extent must satisfy size[i] <= 2^Bits. Codes are origin-relative: codeOf subtracts the origin so the curve starts at the block corner.

Definition at line 33 of file morton_indexer.hpp.

Member Typedef Documentation

◆ M

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
using peclet::core::decomp::MortonIndexer< Dim, Bits >::M = morton::Morton<Dim, Bits>

Definition at line 35 of file morton_indexer.hpp.

◆ Code

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
using peclet::core::decomp::MortonIndexer< Dim, Bits >::Code = typename M::code_type

Definition at line 36 of file morton_indexer.hpp.

◆ Coord

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
using peclet::core::decomp::MortonIndexer< Dim, Bits >::Coord = typename M::coord_type

Definition at line 37 of file morton_indexer.hpp.

Constructor & Destructor Documentation

◆ MortonIndexer() [1/2]

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
peclet::core::decomp::MortonIndexer< Dim, Bits >::MortonIndexer ( )
default

◆ MortonIndexer() [2/2]

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
peclet::core::decomp::MortonIndexer< Dim, Bits >::MortonIndexer ( IVec< Dim > origin,
IVec< Dim > size )
inline

Definition at line 40 of file morton_indexer.hpp.

References init(), origin(), and size().

Member Function Documentation

◆ init()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
void peclet::core::decomp::MortonIndexer< Dim, Bits >::init ( IVec< Dim > origin,
IVec< Dim > size )
inline

Definition at line 42 of file morton_indexer.hpp.

References origin(), and size().

Referenced by MortonIndexer().

◆ bits()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
constexpr unsigned peclet::core::decomp::MortonIndexer< Dim, Bits >::bits ( )
inlinestaticconstexpr

Definition at line 47 of file morton_indexer.hpp.

◆ origin()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
const IVec< Dim > & peclet::core::decomp::MortonIndexer< Dim, Bits >::origin ( ) const
inline

Definition at line 48 of file morton_indexer.hpp.

Referenced by init(), and MortonIndexer().

◆ size()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
const IVec< Dim > & peclet::core::decomp::MortonIndexer< Dim, Bits >::size ( ) const
inline

Definition at line 49 of file morton_indexer.hpp.

Referenced by init(), and MortonIndexer().

◆ codeOf()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
MORTON_HD Code peclet::core::decomp::MortonIndexer< Dim, Bits >::codeOf ( const IVec< Dim > & g) const
inline

Global multi-index → Z-order code (origin-relative).

Precondition: every g[i] - origin[i] is in [0, 2^Bits).

Definition at line 53 of file morton_indexer.hpp.

◆ multiIndex()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
MORTON_HD IVec< Dim > peclet::core::decomp::MortonIndexer< Dim, Bits >::multiIndex ( Code c) const
inline

Z-order code → global multi-index (inverse of codeOf).

Definition at line 61 of file morton_indexer.hpp.

◆ neighborCode()

template<int Dim, unsigned Bits = (Dim == 2 ? 32u : (Dim == 3 ? 21u : 16u))>
MORTON_HD Code peclet::core::decomp::MortonIndexer< Dim, Bits >::neighborCode ( Code c,
int axis,
int dir ) const
inline

Neighbour code one cell along ±axis, computed directly in Morton space (the headline O(1) morton arithmetic — no decode/re-encode).

dir>=0 → +1. Wraps mod 2^Bits per axis, like morton's neighbor.

Definition at line 72 of file morton_indexer.hpp.


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