SPH
UniformGrid.h
Go to the documentation of this file.
1 #pragma once
2 
7 
10 
12 
14 class UniformGridFinder : public FinderTemplate<UniformGridFinder> {
15 protected:
17 
20 
21  virtual void buildImpl(IScheduler& scheduler, ArrayView<const Vector> points) override;
22 
23 public:
29 
31 
32  template <bool FindAll>
33  Size find(const Vector& pos, const Size index, const Float radius, Array<NeighbourRecord>& neighs) const;
34 
37 
38  template <typename TFunctor>
39  void iterate(const TFunctor& functor) {
40  const Size size = lut.getDimensionSize();
41  for (Size z = 0; z < size; ++z) {
42  for (Size y = 0; y < size; ++y) {
43  for (Size x = 0; x < size; ++x) {
44  const Indices idxs = Indices(x, y, z);
45  Array<Size>& particles = lut(idxs);
46  functor(particles);
47  }
48  }
49  }
50  }
51 
53  return lut.getDimensionSize();
54  }
55 };
56 
NAMESPACE_SPH_BEGIN
Definition: BarnesHut.cpp:13
const float radius
Definition: CurveDialog.cpp:18
uint32_t Size
Integral type used to index arrays (by default).
Definition: Globals.h:16
double Float
Precision used withing the code. Use Float instead of float or double where precision is important.
Definition: Globals.h:13
Three-dimensional grid containing indices.
#define INLINE
Macros for conditional compilation based on selected compiler.
Definition: Object.h:31
#define NAMESPACE_SPH_END
Definition: Object.h:12
Object providing safe access to continuous memory of data.
Definition: ArrayView.h:17
Helper template, allowing to define all three functions with a single function.
Interface that allows unified implementation of sequential and parallelized versions of algorithms.
Definition: Scheduler.h:27
Helper object for storing three (possibly four) int or bool values.
Definition: Indices.h:16
INLINE Size getDimensionSize() const
Definition: LookupMap.h:84
Finder projecting a uniform grid on the particles.
Definition: UniformGrid.h:14
void iterate(const TFunctor &functor)
Definition: UniformGrid.h:39
Size find(const Vector &pos, const Size index, const Float radius, Array< NeighbourRecord > &neighs) const
Definition: UniformGrid.cpp:27
virtual void buildImpl(IScheduler &scheduler, ArrayView< const Vector > points) override
Builds finder from set of vectors.
Definition: UniformGrid.cpp:13
UniformGridFinder(const Float relativeCellCnt=1)
Definition: UniformGrid.cpp:6
INLINE Size getDimensionSize() const
Definition: UniformGrid.h:52
Float relativeCellCnt
Multiplier of the number of cells.
Definition: UniformGrid.h:19