33 for (
const Vector& v : points) {
36 boundingBox = this->extendBox(tightBox, 1.e-6_f);
37 for (
auto& a : storage) {
41 for (
Size i = 0; i < points.
size(); ++i) {
43 (*this)(idxs).push(i);
48 return storage.
empty();
52 return tightBox.
clamp(pos);
56 storage = std::move(other.storage);
57 dimensionSize = other.dimensionSize;
58 boundingBox = other.boundingBox;
63 const Size idx = idxs[
X] *
sqr(dimensionSize) + idxs[
Y] * dimensionSize + idxs[
Z];
69 const Size idx = idxs[
X] *
sqr(dimensionSize) + idxs[
Y] * dimensionSize + idxs[
Z];
77 return Box(lower, upper);
81 return boundingBox.
size() / dimensionSize;
91 Vector idxs = (v - boundingBox.
lower()) / (boundingBox.
size()) * dimensionSize;
105 Box extendBox(
const Box& box,
const Float eps)
const {
108 Box extendedBox = box;
Generic dynamically allocated resizable storage.
#define SPH_ASSERT(x,...)
Object representing a three-dimensional axis-aligned box.
uint32_t Size
Integral type used to index arrays (by default).
double Float
Precision used withing the code. Use Float instead of float or double where precision is important.
constexpr INLINE T max(const T &f1, const T &f2)
constexpr INLINE T clamp(const T &f, const T &f1, const T &f2)
constexpr INLINE T sqr(const T &f) noexcept
Return a squared value.
constexpr INLINE Float pow(const Float v)
Power for floats.
INLINE auto abs(const T &f)
#define INLINE
Macros for conditional compilation based on selected compiler.
#define NAMESPACE_SPH_END
Basic vector algebra. Computations are accelerated using SIMD.
BasicVector< Float > Vector
Object providing safe access to continuous memory of data.
INLINE TCounter size() const
Generic dynamically allocated resizable storage.
INLINE TCounter size() const noexcept
INLINE bool empty() const noexcept
Helper object defining three-dimensional interval (box).
INLINE void extend(const Vector &v)
Enlarges the box to contain the vector.
INLINE const Vector & lower() const
Returns lower bounds of the box.
INLINE const Vector & upper() const
Returns upper bounds of the box.
INLINE Vector size() const
Returns box dimensions.
INLINE Vector clamp(const Vector &v) const
Clamps all components of the vector to fit within the box.
Helper object for storing three (possibly four) int or bool values.
INLINE Vector getVoxelSize() const
void update(ArrayView< const Vector > points)
INLINE bool empty() const
INLINE Array< Size > & operator()(const Indices &idxs)
INLINE Size getDimensionSize() const
LookupMap & operator=(LookupMap &&other)
INLINE Indices map(const Vector &v) const
INLINE Box voxel(const Indices idxs) const
INLINE const Array< Size > & operator()(const Indices &idxs) const
INLINE Vector clamp(const Vector &pos) const
Object with deleted copy constructor and copy operator.