Go to the documentation of this file.
30 #ifndef PLANNER_CSPACE_BLOCKMEM_GRIDMAP_H
31 #define PLANNER_CSPACE_BLOCKMEM_GRIDMAP_H
42 template <
class T,
int DIM,
int NONCYCLIC>
48 virtual void clear(
const T zero) = 0;
66 template <
class T,
int DIM,
int NONCYCLIC,
int BLOCK_WIDTH = 0x20,
bool ENABLE_VALIDATION = false>
72 return v && ((v & (v - 1)) == 0);
74 static_assert(
isPowOf2(BLOCK_WIDTH),
"BLOCK_WIDTH must be power of 2");
75 static_assert(BLOCK_WIDTH > 0,
"BLOCK_WIDTH must be >0");
77 static constexpr
size_t log2Recursive(
const size_t v,
const size_t depth = 0)
86 std::unique_ptr<T[]>
c_;
100 for (
int i = 0; i < NONCYCLIC; i++)
106 for (
int i = NONCYCLIC; i < DIM; i++)
119 std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
140 for (p[0] =
min[0]; p[0] <= max[0]; ++p[0])
142 for (p[1] =
min[1]; p[1] <= max[1]; ++p[1])
144 for (p[2] =
min[2]; p[2] <= max[2]; ++p[2])
159 for (p[0] =
min[0]; p[0] <= max[0]; ++p[0])
161 for (p[1] =
min[1]; p[1] <= max[1]; ++p[1])
163 for (p[2] =
min[2]; p[2] <= max[2]; ++p[2])
166 (*this)[p] = base[p];
182 for (p[0] = src_min[0]; p[0] <= src_max[0]; ++p[0])
184 for (p[1] = src_min[1]; p[1] <= src_max[1]; ++p[1])
186 for (p[2] = src_min[2]; p[2] <= src_max[2]; ++p[2])
190 (*this)[p + offset] = src[p];
199 for (
int i = 0; i < NONCYCLIC; i++)
201 if (size_tmp[i] < BLOCK_WIDTH)
202 size_tmp[i] = BLOCK_WIDTH;
207 for (
int i = 0; i < DIM; i++)
213 block_size_[i] = (size_tmp[i] + width - 1) / width;
248 if (ENABLE_VALIDATION)
260 if (ENABLE_VALIDATION)
263 return std::numeric_limits<T>::max();
269 for (
int i = 0; i < NONCYCLIC; i++)
271 if (pos[i] < tolerance ||
size_[i] - tolerance <= pos[i])
274 for (
int i = NONCYCLIC; i < DIM; i++)
276 if (pos[i] < 0 ||
size_[i] <= pos[i])
301 #endif // PLANNER_CSPACE_BLOCKMEM_GRIDMAP_H
virtual void clear_partially(const T zero, const CyclicVecInt< DIM, NONCYCLIC > &min, const CyclicVecInt< DIM, NONCYCLIC > &max)=0
virtual void clear(const T zero)=0
bool validate(const CyclicVecInt< DIM, NONCYCLIC > &pos, const int tolerance=0) const override
std::function< void(CyclicVecInt< DIM, NONCYCLIC >, size_t &, size_t &)> getAddressor() const
virtual const CyclicVecInt< DIM, NONCYCLIC > & size() const =0
void block_addr(const CyclicVecInt< DIM, NONCYCLIC > &pos, size_t &baddr, size_t &addr) const
CyclicVecInt< DIM, NONCYCLIC > size_
T & operator[](const CyclicVecInt< DIM, NONCYCLIC > &pos) override
constexpr static size_t block_bit_mask_
virtual bool validate(const CyclicVecInt< DIM, NONCYCLIC > &pos, const int tolerance=0) const =0
virtual std::function< void(CyclicVecInt< DIM, NONCYCLIC >, size_t &, size_t &)> getAddressor() const =0
BlockMemGridmap(const CyclicVecInt< DIM, NONCYCLIC > &size_)
virtual T & operator[](const CyclicVecInt< DIM, NONCYCLIC > &pos)=0
virtual void reset(const CyclicVecInt< DIM, NONCYCLIC > &size)=0
void copy_partially(const BlockMemGridmapBase< T, DIM, NONCYCLIC > &base, const CyclicVecInt< DIM, NONCYCLIC > &min, const CyclicVecInt< DIM, NONCYCLIC > &max) override
const BlockMemGridmap< T, DIM, NONCYCLIC, BLOCK_WIDTH, ENABLE_VALIDATION > & operator=(const BlockMemGridmap< T, DIM, NONCYCLIC, BLOCK_WIDTH, ENABLE_VALIDATION > &gm)
static constexpr bool isPowOf2(const int v)
static constexpr size_t log2Recursive(const size_t v, const size_t depth=0)
void reset(const CyclicVecInt< DIM, NONCYCLIC > &size) override
void clear_positive(const T zero)
size_t ser_size() const override
virtual void copy_partially(const BlockMemGridmapBase< T, DIM, NONCYCLIC > &base, const CyclicVecInt< DIM, NONCYCLIC > &min, const CyclicVecInt< DIM, NONCYCLIC > &max)=0
constexpr static size_t block_bit_
void clear(const T zero) override
void copy_partially(const CyclicVecInt< DIM, NONCYCLIC > &dst_min, const BlockMemGridmapBase< T, DIM, NONCYCLIC > &src, const CyclicVecInt< DIM, NONCYCLIC > &src_min, const CyclicVecInt< DIM, NONCYCLIC > &src_max) override
void clear_partially(const T zero, const CyclicVecInt< DIM, NONCYCLIC > &min, const CyclicVecInt< DIM, NONCYCLIC > &max) override
const T operator[](const CyclicVecInt< DIM, NONCYCLIC > &pos) const override
CyclicVecInt< DIM, NONCYCLIC > block_size_
const CyclicVecInt< DIM, NONCYCLIC > & size() const override
virtual size_t ser_size() const =0
planner_cspace
Author(s): Atsushi Watanabe
autogenerated on Fri May 16 2025 02:15:22