68 const Float particleRadius,
76 const Float particleRadius,
140 const Float limit = 0._f);
367 return (a * x + b) * x + c;
386 const Float disc =
sqr(b) - 4._f * a * (c - y);
389 }
else if (disc == 0._f) {
390 return { -b / (2._f * a) };
393 Float x1 = (-b - sqrtDisc) / (2._f * a);
394 Float x2 = (-b + sqrtDisc) / (2._f * a);
SPH_EXTEND_ENUM(QuantityId, Post::HistogramId)
#define SPH_ASSERT(x,...)
Wrapper of type containing either a value or an error message.
Generic wrappers of lambdas, functors and other callables.
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 sqr(const T &f) noexcept
Return a squared value.
INLINE T sqrt(const T f)
Return a squared root of a value.
#define INLINE
Macros for conditional compilation based on selected compiler.
#define NAMESPACE_SPH_END
QuantityId
Unique IDs of basic quantities of SPH particles.
NAMESPACE_SPH_BEGIN const struct EmptyArray EMPTY_ARRAY
Wrapper of an integral value providing functions for reading and modifying individual bits.
Interface providing generic (text, human readable) output of the program.
Interface that allows unified implementation of sequential and parallelized versions of algorithms.
Object representing a 1D interval of real numbers.
Object representing a path on a filesystem.
Class representing an ordinary 1D linear function.
Float solve(const Float y) const
Finds a value of x such that f(x) = y for given y.
Float offset() const
Returns the offset in y-direction.
INLINE Float operator()(const Float x) const
Evaluates the linear function for given value.
Float slope() const
Returns the slope of the function.
LinearFunction(const Float slope, const Float offset)
Creates a new linear function.
StaticArray< Float, 2 > solve(const Float y) const
Returns solutions of a quadratic equation y = a*x^2 + b*x + c.
QuadraticFunction(const Float a, const Float b, const Float c)
y = a*x^2 + b*x + c
INLINE Float operator()(const Float x) const
Array with fixed number of allocated elements.
Container storing all quantities used within the simulations.
Symmetric tensor of 2nd order.
Generic storage and input/output routines of settings.
Array< MoonEnum > findMoons(const Storage &storage, const Float radius=1._f, const Float limit=0._f)
Find a potential satellites of the largest body.
Array< HistPoint > getDifferentialHistogram(ArrayView< const Float > values, const HistogramParams ¶ms)
Computes the differential histogram from given values.
Array< Size > findNeighbourCounts(const Storage &storage, const Float particleRadius)
Finds the number of neighbours of each particle.
HistogramSource
Source data used to construct the histogram.
@ COMPONENTS
Equivalent radii of connected chunks of particles (SPH framework)
@ PARTICLES
Radii of individual particles, considering particles as spheres (N-body framework)
LinearFunction getLinearFit(ArrayView< const PlotPoint > points)
Finds a linear fit to a set of points.
QuadraticFunction getQuadraticFit(ArrayView< const PlotPoint > points)
Array< Size > findLargestComponent(const Storage &storage, const Float particleRadius, const Flags< ComponentFlag > flags)
Returns the indices of particles belonging to the largest remnant.
Vector getAngularFrequency(ArrayView< const Float > m, ArrayView< const Vector > r, ArrayView< const Vector > v, const Vector &r0, const Vector &v0, ArrayView< const Size > idxs=nullptr)
Computes the immediate vector of angular frequency of a rigid body.
@ OVERLAP
Specifies that overlapping particles belong into the same component.
@ SEPARATE_BY_FLAG
Specifies that particles with different flag belong to different component, even if they overlap.
Size findComponents(const Storage &storage, const Float particleRadius, const Flags< ComponentFlag > flags, Array< Size > &indices)
Finds and marks connected components (a.k.a. separated bodies) in the array of vertices.
Vector getCenterOfMass(ArrayView< const Float > m, ArrayView< const Vector > r, ArrayView< const Size > idxs=nullptr)
Computes the center of mass.
Array< Tumbler > findTumblers(const Storage &storage, const Float limit)
Find all tumbling asteroids.
SymmetricTensor getInertiaTensor(ArrayView< const Float > m, ArrayView< const Vector > r, const Vector &r0, ArrayView< const Size > idxs=nullptr)
Computes the total inertia tensor of particles with respect to given center.
MoonEnum
Potential relationship of the body with a respect to the largest remnant (fragment).
@ LARGEST_FRAGMENT
This is the largest fragment (or remnant, depending on definition)
@ UNOBSERVABLE
Body is smaller than the user-defined observational limit.
@ RUNAWAY
Body is on hyperbolic trajectory, ejected away from the largest remnant (fragment)
@ IMPACTOR
Body is on collisional course with the largest remnant (fragment)
@ MOON
Body is on elliptical trajectory, it is a potential sattelite.
Array< HistPoint > getCumulativeHistogram(const Storage &storage, const ExtHistogramId id, const HistogramSource source, const HistogramParams ¶ms)
Computes cumulative (integral) histogram of particles in the storage.
HistogramId
Quantity from which the histogram is constructed.
@ VELOCITIES
Particle velocities.
@ ROTATIONAL_AXIS
Distribution of axis directions, from -pi to pi.
@ ROTATIONAL_FREQUENCY
Rotational frequency in revs/day.
@ RADII
Particle radii or equivalent radii of components.
Float getSphericity(IScheduler &scheduler, const Storage &strorage, const Float resolution=0.05_f)
Computes the sphericity coefficient of a body.
Size findMoonCount(ArrayView< const Float > m, ArrayView< const Vector > r, ArrayView< const Vector > v, const Size i, const Float radius=1._f, const Float limit=0._f)
Find the number of moons of given body.
void swap(Sph::Array< T, TCounter > &ar1, Sph::Array< T, TCounter > &ar2)
Size count
Number of particles/components.
Float value
Value of the quantity.
bool operator==(const HistPoint &other) const
Parameters used by histogram of components.
Float radius
Radius of particles in units of their smoothing lengths.
Flags< Post::ComponentFlag > flags
Determines how the particles are clustered into the components.
Parameters of the histogram.
Float velocityCutoff
Cutoff value (upper bound) of particle velocity for inclusion in the histogram.
Float referenceDensity
Reference density, used when computing particle radii from their masses.
Function< bool(Size index)> validator
Function used for inclusiong/exclusion of values in the histogram.
Float massCutoff
Cutoff value (lower bound) of particle mass for inclusion in the histogram.
Interval range
Range of values from which the histogram is constructed.
struct Post::HistogramParams::ComponentParams components
Size binCnt
Number of histogram bins.
Size index
Index of particle (body)
Float beta
Angle between the current angular velocity and the angular momentum.