12 #ifndef EBGeometry_SFC
13 #define EBGeometry_SFC
31 using Index = std::array<unsigned int, 3>;
36 static constexpr
unsigned int ValidBits = 21;
41 static constexpr
Code ValidSpan = (
static_cast<uint64_t
>(1) << ValidBits) - 1;
43 #if __cplusplus >= 202002L
48 concept Encodable = requires(
const Index& point,
const SFC::Code code) {
49 { S::encode(point) } -> std::same_as<SFC::Code>;
50 { S::decode(code) } -> std::same_as<Index>;
63 inline static uint64_t
71 decode(
const uint64_t& a_code) noexcept;
77 static constexpr uint_fast64_t
Mask_64[6]{
78 0x1fffff, 0x1f00000000ffff, 0x1f0000ff0000ff, 0x100f00f00f00f00f, 0x10c30c30c30c30c3, 0x1249249249249249};
91 inline static uint64_t
99 decode(
const uint64_t& a_code) noexcept;
105 #if __cplusplus >= 202002L
106 static_assert(EBGeometry::SFC::Encodable<EBGeometry::SFC::Morton>);
107 static_assert(EBGeometry::SFC::Encodable<EBGeometry::SFC::Nested>);
110 #include "EBGeometry_SFCImplem.hpp"
uint64_t Code
Alias for SFC code.
Definition: EBGeometry_SFC.hpp:26
std::array< unsigned int, 3 > Index
Alias for 3D cell index.
Definition: EBGeometry_SFC.hpp:31
Implementation of the Morton SFC.
Definition: EBGeometry_SFC.hpp:58
static Index decode(const uint64_t &a_code) noexcept
Decode the 64-bit Morton code into an Index.
static constexpr uint_fast64_t Mask_64[6]
Mask for magic-bits encoding of 3D Morton code.
Definition: EBGeometry_SFC.hpp:77
static uint64_t encode(const Index &a_point) noexcept
Encode an input point into a Morton index with a 64-bit representation.
Implementation of a nested index SFC.
Definition: EBGeometry_SFC.hpp:86
static Index decode(const uint64_t &a_code) noexcept
Decode the 64-bit SFC code into an Index.
static uint64_t encode(const Index &a_point) noexcept
Encode the input point into the SFC code.