30#ifndef INCLUDED_KEY_HPP
31#define INCLUDED_KEY_HPP
42template <
int Dim>
struct Key
55 std::size_t
operator()(
Key const& n)
const noexcept {
return std::hash<value_type>()(n.index_); }
62 for (
int d = 1; d < Dim; ++d) {
72 for (
int d = 0; d < Dim; ++d) c[d] = static_cast<scalar_coordinate_type>(
compress_bits(code >>
static_cast<value_type>(d)));
134 using tag = std::integral_constant<int, 3>*;
139 using tag = std::integral_constant<int, 3>*;
145 w &= 0x00000000001fffff;
146 w = (w | w << 32) & 0x001f00000000ffff;
147 w = (w | w << 16) & 0x001f0000ff0000ff;
148 w = (w | w << 8) & 0x010f00f00f00f00f;
149 w = (w | w << 4) & 0x10c30c30c30c30c3;
150 w = (w | w << 2) & 0x1249249249249249;
155 w &= 0x1249249249249249;
156 w = (w ^ (w >> 2)) & 0x30c30c30c30c30c3;
157 w = (w ^ (w >> 4)) & 0xf00f00f00f00f00f;
158 w = (w ^ (w >> 8)) & 0x00ff0000ff0000ff;
159 w = (w ^ (w >> 16)) & 0x00ff00000000ffff;
160 w = (w ^ (w >> 32)) & 0x00000000001fffff;
165 x = (x | (x << 16)) & 0x0000FFFF0000FFFF;
166 x = (x | (x << 8)) & 0x00FF00FF00FF00FF;
167 x = (x | (x << 4)) & 0x0F0F0F0F0F0F0F0F;
168 x = (x | (x << 2)) & 0x3333333333333333;
169 x = (x | (x << 1)) & 0x5555555555555555;
175 w &= 0x5555555555555555;
176 w = (w ^ (w >> 1)) & 0x3333333333333333;
177 w = (w ^ (w >> 2)) & 0x0f0f0f0f0f0f0f0f;
178 w = (w ^ (w >> 4)) & 0x00ff00ff00ff00ff;
179 w = (w ^ (w >> 8)) & 0x0000ffff0000ffff;
180 w = (w ^ (w >> 16)) & 0x00000000ffffffff;
Definition decomposition.hpp:40
constexpr bool operator>(const Key< Dim > &l, const Key< Dim > &r) noexcept
Definition key.hpp:202
Key< Dim > operator+(int n, Key< Dim > k) noexcept
Definition key.hpp:189
Key< Dim > operator-(int n, Key< Dim > k) noexcept
Definition key.hpp:191
constexpr bool operator==(const Key< Dim > &l, const Key< Dim > &r) noexcept
Definition key.hpp:194
constexpr bool operator<=(const Key< Dim > &l, const Key< Dim > &r) noexcept
Definition key.hpp:200
constexpr bool operator<(const Key< Dim > &l, const Key< Dim > &r) noexcept
Definition key.hpp:198
constexpr bool operator>=(const Key< Dim > &l, const Key< Dim > &r) noexcept
Definition key.hpp:204
constexpr bool operator!=(const Key< Dim > &l, const Key< Dim > &r) noexcept
Definition key.hpp:196
std::size_t operator()(Key const &n) const noexcept
Definition key.hpp:55
static value_type compute_index(const coordinate_type &_c) noexcept
Definition key.hpp:59
Key & operator-=(int) noexcept
Definition key.hpp:120
double float_type
Definition key.hpp:49
Key & operator++() noexcept
Definition key.hpp:105
Key(value_type idx) noexcept
Definition key.hpp:79
const value_type & getIndex() const noexcept
Definition key.hpp:94
Key & operator=(const Key &) &=default
vector_type< float_type > real_coordinate_type
Definition key.hpp:52
vector_type< scalar_coordinate_type > coordinate_type
Definition key.hpp:51
Key & operator--() noexcept
Definition key.hpp:110
const value_type & index() const noexcept
Definition key.hpp:92
int scalar_coordinate_type
Definition key.hpp:47
value_type index_
Definition key.hpp:185
static value_type split_bits_impl(value_type w, std::integral_constant< int, 3 > *) noexcept
Definition key.hpp:143
Key & operator+=(int) noexcept
Definition key.hpp:115
static value_type split_bits_impl(value_type x, std::integral_constant< int, 2 > *) noexcept
Definition key.hpp:163
unsigned long long int value_type
Definition key.hpp:46
Key(coordinate_type x) noexcept
Definition key.hpp:83
static coordinate_type coordinate(const value_type &code) noexcept
Definition key.hpp:69
Key & operator=(Key &&) &=default
value_type & getIndex() noexcept
Definition key.hpp:95
static scalar_coordinate_type compress_bits_impl(value_type w, std::integral_constant< int, 3 > *) noexcept
Definition key.hpp:153
static scalar_coordinate_type compress_bits_impl(value_type w, std::integral_constant< int, 2 > *) noexcept
Definition key.hpp:173
Key neighbor(const coordinate_type &_offset) const noexcept
Definition key.hpp:97
static value_type split_bits(value_type w)
Definition key.hpp:132
Key child(int i) const noexcept
Definition key.hpp:103
value_type & index() noexcept
Definition key.hpp:93
Key() noexcept
Definition key.hpp:77
Key(int x, int y, int z) noexcept
Definition key.hpp:81
math::vector< U, Dim > vector_type
Definition key.hpp:50
static value_type compress_bits(value_type w)
Definition key.hpp:137
coordinate_type coordinate() const noexcept
Definition key.hpp:91
friend std::ostream & operator<<(std::ostream &os, const Key &_k)
Definition key.hpp:125