SPH
NeighbourFinder.cpp
Go to the documentation of this file.
2 #include "thread/Scheduler.h"
3 
5 
7  values = points;
8  this->buildImpl(scheduler, values);
9 }
10 
11 static Order makeRankH(ArrayView<const Vector> values, Flags<FinderFlag> flags) {
12  if (flags.has(FinderFlag::MAKE_RANK)) {
13  return makeRank(values.size(), [values](const Size i1, const Size i2) { //
14  return values[i1][H] < values[i2][H];
15  });
16  } else {
17  return Order();
18  }
19 }
20 
22  values = points;
23  rank = makeRankH(values, flags);
24  this->buildImpl(scheduler, values);
25 }
26 
NAMESPACE_SPH_BEGIN
Definition: BarnesHut.cpp:13
uint32_t Size
Integral type used to index arrays (by default).
Definition: Globals.h:16
@ MAKE_RANK
Creates the ranks of particles. Without this flag, only the IBasicFinder interface can be used.
#define NAMESPACE_SPH_END
Definition: Object.h:12
Interface for executing tasks (potentially) asynchronously.
Object providing safe access to continuous memory of data.
Definition: ArrayView.h:17
INLINE TCounter size() const
Definition: ArrayView.h:101
Wrapper of an integral value providing functions for reading and modifying individual bits.
Definition: Flags.h:20
constexpr INLINE bool has(const TEnum flag) const
Checks if the object has a given flag.
Definition: Flags.h:77
ArrayView< const Vector > values
View of the source datapoints, updated every time (re)build is called.
virtual void buildImpl(IScheduler &scheduler, ArrayView< const Vector > points)=0
Builds finder from set of vectors.
void build(IScheduler &scheduler, ArrayView< const Vector > points)
Constructs the struct with an array of vectors.
Interface that allows unified implementation of sequential and parallelized versions of algorithms.
Definition: Scheduler.h:27
Order rank
Ranks of particles according to their smoothing lengths.
void build(IScheduler &scheduler, ArrayView< const Vector > points, Flags< FinderFlag > flags=FinderFlag::MAKE_RANK)
Constructs the struct with an array of vectors.
Permutation, i.e. (discrete) invertible function int->int.
Definition: Order.h:18