35 : gravity(
std::move(gravity)) {
36 period = recomputationPeriod;
44 gravity->build(scheduler, storage);
50 if (dv.
size() == cachedDv.
size() && t - t_last < period) {
57 gravity->evalAll(scheduler, cachedDv, stats);
62 for (
Size i = 0; i < dv.
size(); ++i) {
70 return gravity->eval(r0);
74 return gravity->evalEnergy(scheduler, stats);
78 return gravity->getFinder();
#define SPH_ASSERT(x,...)
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.
Base class for solvers of gravity.
#define NAMESPACE_SPH_END
Statistics gathered and periodically displayed during the run.
@ RUN_TIME
Current time of the simulation in code units. Does not necessarily have to be 0 when run starts.
@ GRAVITY_EVAL_TIME
Wallclock duration of gravity evaluation.
BasicVector< Float > Vector
Object providing safe access to continuous memory of data.
INLINE TCounter size() const
Generic dynamically allocated resizable storage.
void resize(const TCounter newSize)
Resizes the array to new size.
void fill(const T &t)
Sets all elements of the array to given value.
INLINE TCounter size() const noexcept
Wrapper of other IGravity implementation that approximates the gravity using cached values.
virtual Float evalEnergy(IScheduler &scheduler, Statistics &stats) const override
Computes the total potential energy of the particles.
virtual void build(IScheduler &scheduler, const Storage &storage) override
Builds the accelerating structure.
virtual void evalAll(IScheduler &scheduler, ArrayView< Vector > dv, Statistics &stats) const override
Evaluates the gravitational acceleration concurrently.
CachedGravity(const Float recomputationPeriod, AutoPtr< IGravity > &&gravity)
Creates the cached gravity.
virtual RawPtr< const IBasicFinder > getFinder() const override
Optionally returns a finder used by the gravity implementation.
virtual Vector eval(const Vector &r0) const override
Evaluates the gravitational acceleration at given point.
Interface for computing gravitational interactions of particles.
Interface that allows unified implementation of sequential and parallelized versions of algorithms.
Non-owning wrapper of pointer.
Object holding various statistics about current run.
TValue get(const StatisticsId idx) const
Returns value of a statistic.
Statistics & set(const StatisticsId idx, TValue &&value)
Sets new values of a statistic.
Container storing all quantities used within the simulations.
Generic storage and input/output routines of settings.
Overload of std::swap for Sph::Array.