24 : gravity(
std::move(gravity)) {
44 for (
Size i = 0; i < r.
size(); ++i) {
45 if (r[i][
Z] <= 0._f) {
50 r_a.push(r[i] - 2._f *
Vector(0, 0, r[i][
Z]));
57 gravity->build(scheduler,
all);
66 gravity->evalAll(scheduler, dv_a, stats);
68 for (
Size i = 0; i < idxs.
size(); ++i) {
69 if (idxs[i] ==
Size(-1)) {
73 dv[idxs[i]] += dv_a[i];
78 return gravity->eval(r0);
82 return gravity->evalEnergy(scheduler, stats);
#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.
INLINE bool all(const Indices &i)
#define NAMESPACE_SPH_END
@ POSITION
Positions (velocities, accelerations) of particles, always a vector quantity,.
@ MASS
Paricles masses, always a scalar quantity.
Holder of quantity values and their temporal derivatives.
@ SECOND
Quantity with 1st and 2nd derivative.
@ ZERO
Quantity without derivatives, or "zero order" of quantity.
Statistics gathered and periodically displayed during the run.
Container for storing particle quantities and materials.
BasicVector< Float > Vector
Object providing safe access to continuous memory of data.
INLINE TCounter size() const
void resize(const TCounter newSize)
Resizes the array to new size.
INLINE void push(U &&u)
Adds new element to the end of the array, resizing the array if necessary.
void fill(const T &t)
Sets all elements of the array to given value.
void clear()
Removes all elements from the array, but does NOT release the memory.
INLINE TCounter size() const noexcept
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.
Container storing all quantities used within the simulations.
Size getParticleCnt() const
Returns the number of particles.
Array< TValue > & getValue(const QuantityId key)
Retrieves a quantity values from the storage, given its key and value type.
virtual void build(IScheduler &scheduler, const Storage &storage) override
Builds the accelerating structure.
virtual Float evalEnergy(IScheduler &scheduler, Statistics &stats) const override
Computes the total potential energy of the particles.
virtual Vector eval(const Vector &r0) const override
Evaluates the gravitational acceleration at given point.
SymmetricGravity(AutoPtr< IGravity > &&gravity)
virtual RawPtr< const IBasicFinder > getFinder() const override
Optionally returns a finder used by the gravity implementation.
virtual void evalAll(IScheduler &scheduler, ArrayView< Vector > dv, Statistics &stats) const override
Evaluates the gravitational acceleration concurrently.
Generic storage and input/output routines of settings.
Overload of std::swap for Sph::Array.