30#ifndef INCLUDED_KEY_HPP
31#define INCLUDED_KEY_HPP
66 return std::hash<value_type>()(n.index_);
74 for(
int d=1;d<Dim;++d)
84 for (
int d = 0; d < Dim; ++d) c[d] = static_cast<scalar_coordinate_type>(
compress_bits(code >>
static_cast<value_type>(d)));
96 Key(
int x,
int y,
int z) noexcept
141 template<
int nDim =Dim>
144 using tag=std::integral_constant<int,3>*;
147 template<
int nDim =Dim>
150 using tag=std::integral_constant<int,3>*;
158 w &= 0x00000000001fffff;
159 w = (w | w << 32) & 0x001f00000000ffff;
160 w = (w | w << 16) & 0x001f0000ff0000ff;
161 w = (w | w << 8) & 0x010f00f00f00f00f;
162 w = (w | w << 4) & 0x10c30c30c30c30c3;
163 w = (w | w << 2) & 0x1249249249249249;
169 w &= 0x1249249249249249;
170 w = (w ^ (w >> 2)) & 0x30c30c30c30c30c3;
171 w = (w ^ (w >> 4)) & 0xf00f00f00f00f00f;
172 w = (w ^ (w >> 8)) & 0x00ff0000ff0000ff;
173 w = (w ^ (w >> 16)) & 0x00ff00000000ffff;
174 w = (w ^ (w >> 32)) & 0x00000000001fffff;
181 x = (x | (x << 16)) & 0x0000FFFF0000FFFF;
182 x = (x | (x << 8)) & 0x00FF00FF00FF00FF;
183 x = (x | (x << 4)) & 0x0F0F0F0F0F0F0F0F;
184 x = (x | (x << 2)) & 0x3333333333333333;
185 x = (x | (x << 1)) & 0x5555555555555555;
192 w &= 0x5555555555555555;
193 w = (w ^ (w >> 1)) & 0x3333333333333333;
194 w = (w ^ (w >> 2)) & 0x0f0f0f0f0f0f0f0f;
195 w = (w ^ (w >> 4)) & 0x00ff00ff00ff00ff;
196 w = (w ^ (w >> 8)) & 0x0000ffff0000ffff;
197 w = (w ^ (w >> 16)) & 0x00000000ffffffff;
217{
return l.
index() == r.index(); }
221{
return l.index() != r.index(); }
225{
return l.index() < r.index(); }
229{
return l.index() <= r.index(); }
233{
return l.index() > r.index(); }
237{
return l.index() >= r.index(); }
Definition decomposition.hpp:40
constexpr bool operator>(const Key< Dim > &l, const Key< Dim > &r) noexcept
Definition key.hpp:232
Key< Dim > operator+(int n, Key< Dim > k) noexcept
Definition key.hpp:207
Key< Dim > operator-(int n, Key< Dim > k) noexcept
Definition key.hpp:211
constexpr bool operator==(const Key< Dim > &l, const Key< Dim > &r) noexcept
Definition key.hpp:216
constexpr bool operator<=(const Key< Dim > &l, const Key< Dim > &r) noexcept
Definition key.hpp:228
constexpr bool operator<(const Key< Dim > &l, const Key< Dim > &r) noexcept
Definition key.hpp:224
constexpr bool operator>=(const Key< Dim > &l, const Key< Dim > &r) noexcept
Definition key.hpp:236
constexpr bool operator!=(const Key< Dim > &l, const Key< Dim > &r) noexcept
Definition key.hpp:220
std::size_t operator()(Key const &n) const noexcept
Definition key.hpp:64
static value_type compute_index(const coordinate_type &_c) noexcept
Definition key.hpp:72
Key & operator-=(int) noexcept
Definition key.hpp:130
double float_type
Definition key.hpp:57
Key & operator++() noexcept
Definition key.hpp:127
Key(value_type idx) noexcept
Definition key.hpp:93
const value_type & getIndex() const noexcept
Definition key.hpp:113
Key & operator=(const Key &) &=default
vector_type< scalar_coordinate_type > coordinate_type
Definition key.hpp:60
Key & operator--() noexcept
Definition key.hpp:128
const value_type & index() const noexcept
Definition key.hpp:111
int scalar_coordinate_type
Definition key.hpp:55
value_type index_
Definition key.hpp:202
static value_type split_bits_impl(value_type w, std::integral_constant< int, 3 > *) noexcept
Definition key.hpp:155
Key & operator+=(int) noexcept
Definition key.hpp:129
static value_type split_bits_impl(value_type x, std::integral_constant< int, 2 > *) noexcept
Definition key.hpp:178
unsigned long long int value_type
Definition key.hpp:54
Key(coordinate_type x) noexcept
Definition key.hpp:99
static coordinate_type coordinate(const value_type &code) noexcept
Definition key.hpp:82
Key & operator=(Key &&) &=default
value_type & getIndex() noexcept
Definition key.hpp:114
static scalar_coordinate_type compress_bits_impl(value_type w, std::integral_constant< int, 3 > *) noexcept
Definition key.hpp:167
static scalar_coordinate_type compress_bits_impl(value_type w, std::integral_constant< int, 2 > *) noexcept
Definition key.hpp:190
Key neighbor(const coordinate_type &_offset) const noexcept
Definition key.hpp:116
static value_type split_bits(value_type w)
Definition key.hpp:142
Key child(int i) const noexcept
Definition key.hpp:122
value_type & index() noexcept
Definition key.hpp:112
Key() noexcept
Definition key.hpp:90
Key(int x, int y, int z) noexcept
Definition key.hpp:96
static value_type compress_bits(value_type w)
Definition key.hpp:148
coordinate_type coordinate() const noexcept
Definition key.hpp:110
friend std::ostream & operator<<(std::ostream &os, const Key &_k)
Definition key.hpp:131