SPH
Classes | Typedefs | Enumerations | Functions
Post Namespace Reference

Classes

struct  Tumbler
 
struct  HistogramParams
 Parameters of the histogram. More...
 
struct  HistPoint
 Point in the histogram. More...
 
class  LinearFunction
 Class representing an ordinary 1D linear function. More...
 
class  QuadraticFunction
 
struct  KsResult
 

Typedefs

using ExtHistogramId = ExtendedEnum< HistogramId >
 
using KsFunction = Function< StaticArray< Float, 4 >(PlotPoint)>
 

Enumerations

enum class  ComponentFlag { OVERLAP = 0 , SEPARATE_BY_FLAG = 1 << 0 , ESCAPE_VELOCITY = 1 << 1 , SORT_BY_MASS = 1 << 2 }
 
enum class  MoonEnum {
  LARGEST_FRAGMENT , RUNAWAY , MOON , IMPACTOR ,
  UNOBSERVABLE
}
 Potential relationship of the body with a respect to the largest remnant (fragment). More...
 
enum class  HistogramId {
  RADII = -1 , EQUIVALENT_MASS_RADII = -2 , VELOCITIES = -3 , ROTATIONAL_FREQUENCY = -4 ,
  ROTATIONAL_PERIOD = -5 , ROTATIONAL_AXIS = -6
}
 Quantity from which the histogram is constructed. More...
 
enum class  HistogramSource { COMPONENTS , PARTICLES }
 Source data used to construct the histogram. More...
 

Functions

Array< SizefindNeighbourCounts (const Storage &storage, const Float particleRadius)
 Finds the number of neighbours of each particle. More...
 
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. More...
 
Array< SizefindLargestComponent (const Storage &storage, const Float particleRadius, const Flags< ComponentFlag > flags)
 Returns the indices of particles belonging to the largest remnant. More...
 
Array< TumblerfindTumblers (const Storage &storage, const Float limit)
 Find all tumbling asteroids. More...
 
Array< MoonEnumfindMoons (const Storage &storage, const Float radius=1._f, const Float limit=0._f)
 Find a potential satellites of the largest body. More...
 
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. More...
 
Vector getCenterOfMass (ArrayView< const Float > m, ArrayView< const Vector > r, ArrayView< const Size > idxs=nullptr)
 Computes the center of mass. More...
 
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. More...
 
SymmetricTensor getInertiaTensor (ArrayView< const Float > m, ArrayView< const Vector > r, ArrayView< const Size > idxs=nullptr)
 Computes the total inertia tensor of particle with respect to their center of mass. More...
 
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. More...
 
Vector getAngularFrequency (ArrayView< const Float > m, ArrayView< const Vector > r, ArrayView< const Vector > v, ArrayView< const Size > idxs=nullptr)
 
Float getSphericity (IScheduler &scheduler, const Storage &strorage, const Float resolution=0.05_f)
 Computes the sphericity coefficient of a body. More...
 
Array< HistPointgetDifferentialHistogram (ArrayView< const Float > values, const HistogramParams &params)
 Computes the differential histogram from given values. More...
 
Array< HistPointgetDifferentialHistogram (const Storage &storage, const ExtHistogramId id, const HistogramSource source, const HistogramParams &params)
 Computes the differential histogram of particles in the storage. More...
 
Array< HistPointgetCumulativeHistogram (const Storage &storage, const ExtHistogramId id, const HistogramSource source, const HistogramParams &params)
 Computes cumulative (integral) histogram of particles in the storage. More...
 
LinearFunction getLinearFit (ArrayView< const PlotPoint > points)
 Finds a linear fit to a set of points. More...
 
QuadraticFunction getQuadraticFit (ArrayView< const PlotPoint > points)
 
Outcome compareParticles (const Storage &test, const Storage &ref, const Float eps=1.e-6_f)
 Compares particle positions and state quantities of two storages. More...
 
Outcome compareLargeSpheres (const Storage &test, const Storage &ref, const Float fraction, const Float maxDeviation, const Float eps=1.e-6_f)
 Compares the positions, velocities and radii of the largest particles in given states. More...
 
Float correlationCoefficient (ArrayView< const PlotPoint > points)
 
Float chiSquareDistribution (const Float chiSqr, const Float dof)
 
Float chiSquareTest (ArrayView< const Float > measured, ArrayView< const Float > expected)
 
Float kolmogorovSmirnovDistribution (const Float x)
 
KsResult kolmogorovSmirnovTest (ArrayView< const Float > data, const Function< Float(Float)> &expectedCdf)
 One-dimensional Kolmogorov-Smirnov test with given CDF of expected probability distribution. More...
 
KsResult kolmogorovSmirnovTest (ArrayView< const Float > data1, ArrayView< const Float > data2)
 
KsResult kolmogorovSmirnovTest (ArrayView< const PlotPoint > data, const KsFunction &expected)
 Two-dimensional Kolmogorov-Smirnov test. More...
 
KsFunction getUniformKsFunction (Interval rangeX, Interval rangeY)
 

Typedef Documentation

◆ ExtHistogramId

Definition at line 214 of file Analysis.h.

◆ KsFunction

Definition at line 30 of file StatisticTests.h.

Enumeration Type Documentation

◆ ComponentFlag

enum Post::ComponentFlag
strong
Enumerator
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.

ESCAPE_VELOCITY 

Specifies that the gravitationally bound particles belong to the same component. If used, the components are constructed in two steps; first, the initial components are created from overlapping particles. Then each pair of components is merged if their relative velocity is less then the escape velocity.

SORT_BY_MASS 

If used, components are sorted by the total mass of the particles, i.e. component with index 0 will correspond to the largest remnant, index 1 will be the second largest body, etc.

Definition at line 39 of file Analysis.h.

◆ HistogramId

enum Post::HistogramId
strong

Quantity from which the histogram is constructed.

Beside the listed options, any QuantityId can be used, by casting to HistogramId enum. All values of HistogramId has to be negative to avoid clashes.

Enumerator
RADII 

Particle radii or equivalent radii of components.

EQUIVALENT_MASS_RADII 

Radii determined from particle masses and given reference density. This generally given more 'discretized' SFD, as masses of SPH particles are constant during the run, whereas radii (smoothing lenghts) or densities may change.

VELOCITIES 

Particle velocities.

ROTATIONAL_FREQUENCY 

Rotational frequency in revs/day.

ROTATIONAL_PERIOD 

Rotational periods of particles (in hours)

Todo:
it should be in code units and then converted to hours on output!
ROTATIONAL_AXIS 

Distribution of axis directions, from -pi to pi.

Definition at line 191 of file Analysis.h.

◆ HistogramSource

enum Post::HistogramSource
strong

Source data used to construct the histogram.

Enumerator
COMPONENTS 

Equivalent radii of connected chunks of particles (SPH framework)

PARTICLES 

Radii of individual particles, considering particles as spheres (N-body framework)

Definition at line 217 of file Analysis.h.

◆ MoonEnum

enum Post::MoonEnum
strong

Potential relationship of the body with a respect to the largest remnant (fragment).

Enumerator
LARGEST_FRAGMENT 

This is the largest fragment (or remnant, depending on definition)

RUNAWAY 

Body is on hyperbolic trajectory, ejected away from the largest remnant (fragment)

MOON 

Body is on elliptical trajectory, it is a potential sattelite.

IMPACTOR 

Body is on collisional course with the largest remnant (fragment)

UNOBSERVABLE 

Body is smaller than the user-defined observational limit.

Definition at line 96 of file Analysis.h.

Function Documentation

◆ chiSquareDistribution()

Float Post::chiSquareDistribution ( const Float  chiSqr,
const Float  dof 
)

Definition at line 28 of file StatisticTests.cpp.

◆ chiSquareTest()

Float Post::chiSquareTest ( ArrayView< const Float measured,
ArrayView< const Float expected 
)

Definition at line 33 of file StatisticTests.cpp.

◆ compareLargeSpheres()

Outcome Post::compareLargeSpheres ( const Storage test,
const Storage ref,
const Float  fraction,
const Float  maxDeviation,
const Float  eps = 1.e-6_f 
)

Compares the positions, velocities and radii of the largest particles in given states.

If both states match, returns SUCCESS, otherwise returns an explanatory message. This comparison method in suitable for N-body simulations with merging. Function considers two states equal even if they differ by few particles.

Parameters
testParticles to test
refReference particles
fractionFraction of the largest particles to test. The rest is considered a "noise".
maxDeviationMaximal difference in positions of matching particles
epsAllowed relative error.

Definition at line 101 of file Compare.cpp.

◆ compareParticles()

NAMESPACE_SPH_BEGIN Outcome Post::compareParticles ( const Storage test,
const Storage ref,
const Float  eps = 1.e-6_f 
)

Compares particle positions and state quantities of two storages.

If both states match, returns SUCCESS, otherwise returns an explanatory message. This comparison method is mainly intended for SPH simulations.

Parameters
testParticles to test
refReference particles
epsAllowed relative error.

Definition at line 9 of file Compare.cpp.

◆ correlationCoefficient()

NAMESPACE_SPH_BEGIN Float Post::correlationCoefficient ( ArrayView< const PlotPoint points)

Definition at line 7 of file StatisticTests.cpp.

◆ findComponents()

Size Post::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.

It is a useful function for finding bodies in simulations where we do not merge particles.

Parameters
storageStorage containing the particles. Must also contain QuantityId::FLAG if SEPARATE_BY_FLAG option is used.
particleRadiusSize of particles in smoothing lengths.
flagsFlags specifying connectivity of components, etc; see emum ComponentFlag.
indices[out]Array of indices from 0 to n-1, where n is the number of components. In the array, i-th index corresponds to component to which i-th particle belongs.
Returns
Number of components

Definition at line 86 of file Analysis.cpp.

◆ findLargestComponent()

Array< Size > Post::findLargestComponent ( const Storage storage,
const Float  particleRadius,
const Flags< ComponentFlag flags 
)

Returns the indices of particles belonging to the largest remnant.

The returned indices are sorted.

Definition at line 216 of file Analysis.cpp.

◆ findMoonCount()

Size Post::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.

Parameters
mMasses of bodies, sorted in descending order.
rPositions and radii of bodies, sorted by mass (in descending order)
vVelocities of bodies, sorted by mass (in descending order)
iIndex of the queried body
radiusRadius multiplier, may be used to exclude moons with pericenter very close to the body.
limitLimiting mass radio, moons with masses lower than limit*m[i] are excluded.

Definition at line 415 of file Analysis.cpp.

◆ findMoons()

Array< Post::MoonEnum > Post::findMoons ( const Storage storage,
const Float  radius = 1._f,
const Float  limit = 0._f 
)

Find a potential satellites of the largest body.

The sattelites are mainly determined using the total energy of the bodies; if the energy is negative, the body is likely to be a sattelite. Note that the N-body interactions can eject bodies with negative energy away from the largest remnant (fragment), and also make a body with positive energy a future satellite (by decreasing the energy during close encounter with 3rd body). If the energy of a body is negative, a Keplerian ellipse (assuming 2-body problem) is computed and based on this ellipse, the body is either marked as moon or as impactor.

The function is mainly intended for post-reaccumulation analysis of the created asteroidal family. Satellites determined during reaccumulation can be very uncertain, as explained above. The storage must contains positions (with velocities) and masses of the bodies. The bodies do not have to be sorted, the largest remnant (or fragment) is defined as the most massive body.

Parameters
storageStorage containing bodies of the asteroidal family
radiusRelative radius of bodies, multiplying the radius stored in h-component. Used only in collision detection; value 0 turns it off completely.
limitRelative observational limit, with a respect to the largest remnant (fragment). Bodies with radius smaller than \({\rm limit} \cdot R_{\rm lr}\) are marked as UNOBSERVABLE, regardless their bound status. Must be in interval [0, 1>.
Returns
Array of the same size of storage, marking each body in the storage; see MoonEnum.

Definition at line 367 of file Analysis.cpp.

◆ findNeighbourCounts()

NAMESPACE_SPH_BEGIN Array< Size > Post::findNeighbourCounts ( const Storage storage,
const Float  particleRadius 
)

Finds the number of neighbours of each particle.

Note that each particle searches neighbours up to the distance given by their smoothing length, so the relation "A is a neighbour of B" might not be symmetrical.

Parameters
storageStorage containing the particles.
particleRadiusSize of particles in smoothing lengths.
Returns
Number of neighbours of each particle.

Definition at line 22 of file Analysis.cpp.

◆ findTumblers()

Array< Post::Tumbler > Post::findTumblers ( const Storage storage,
const Float  limit 
)

Find all tumbling asteroids.

Limit specifies the required misalignment angle (in radians) for asteroid to be considered a tumbler. Note that tumbling begins to be detectable for the misalignment angle larger than 15 degrees with high accuracy data (Henych, 2013).

Definition at line 441 of file Analysis.cpp.

◆ getAngularFrequency() [1/2]

Vector Post::getAngularFrequency ( ArrayView< const Float m,
ArrayView< const Vector r,
ArrayView< const Vector v,
ArrayView< const Size idxs = nullptr 
)

Definition at line 541 of file Analysis.cpp.

◆ getAngularFrequency() [2/2]

Vector Post::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.

Definition at line 514 of file Analysis.cpp.

◆ getCenterOfMass()

Vector Post::getCenterOfMass ( ArrayView< const Float m,
ArrayView< const Vector r,
ArrayView< const Size idxs = nullptr 
)

Computes the center of mass.

Definition at line 461 of file Analysis.cpp.

◆ getCumulativeHistogram()

Array< Post::HistPoint > Post::getCumulativeHistogram ( const Storage storage,
const ExtHistogramId  id,
const HistogramSource  source,
const HistogramParams params 
)

Computes cumulative (integral) histogram of particles in the storage.

Parameters
storageStorage containing particle data.
idSpecifies the quantity for which the histogram is constructed.
sourceSpecifies the input bodies, see HistogramSource.
paramsParameters of the histogram.

Definition at line 814 of file Analysis.cpp.

◆ getDifferentialHistogram() [1/2]

Array< Post::HistPoint > Post::getDifferentialHistogram ( ArrayView< const Float values,
const HistogramParams params 
)

Computes the differential histogram from given values.

Note that only bin count and input range are used from the histogram parameters. No cut-offs are applied.

Definition at line 861 of file Analysis.cpp.

◆ getDifferentialHistogram() [2/2]

Array< Post::HistPoint > Post::getDifferentialHistogram ( const Storage storage,
const ExtHistogramId  id,
const HistogramSource  source,
const HistogramParams params 
)

Computes the differential histogram of particles in the storage.

Definition at line 852 of file Analysis.cpp.

◆ getInertiaTensor() [1/2]

SymmetricTensor Post::getInertiaTensor ( ArrayView< const Float m,
ArrayView< const Vector r,
ArrayView< const Size idxs = nullptr 
)

Computes the total inertia tensor of particle with respect to their center of mass.

Definition at line 506 of file Analysis.cpp.

◆ getInertiaTensor() [2/2]

SymmetricTensor Post::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.

Definition at line 484 of file Analysis.cpp.

◆ getLinearFit()

Post::LinearFunction Post::getLinearFit ( ArrayView< const PlotPoint points)

Finds a linear fit to a set of points.

The set of points must have at least two elements and they must not coincide.

Returns
Function representing the linear fit.

Definition at line 914 of file Analysis.cpp.

◆ getQuadraticFit()

Post::QuadraticFunction Post::getQuadraticFit ( ArrayView< const PlotPoint points)

Definition at line 935 of file Analysis.cpp.

◆ getSphericity()

Float Post::getSphericity ( IScheduler scheduler,
const Storage strorage,
const Float  resolution = 0.05_f 
)

Computes the sphericity coefficient of a body.

Sphericity is defined as the ratio of the surface area of a sphere (with the same volume as the given body) to the surface area of the body ([Wadell_1935]). This value is equal to 1 for sphere (and only for sphere); the lower the value, the more the body is "aspheric". The sphericity is useful for quantification of "roundness"; the ratio of semi-axes, for example, can be easily 1 even for cube, definitely not a round body.

Note that the sphericity depends on resolution, small-scale topograpy will always cause the sphericity to decrease! When comparing sphericities, it is necessary to use the same resolution for the compared bodies.

Parameters
schedulerScheduler potentially used for parallelization.
storageStorage containing particle positions, optionally also masses and densities.
resolutionRelative resolution used to compute the sphericity.
Returns
Wadell's sphericity value for the body.

Definition at line 550 of file Analysis.cpp.

◆ getUniformKsFunction()

Post::KsFunction Post::getUniformKsFunction ( Interval  rangeX,
Interval  rangeY 
)

Definition at line 167 of file StatisticTests.cpp.

◆ kolmogorovSmirnovDistribution()

Float Post::kolmogorovSmirnovDistribution ( const Float  x)

Definition at line 53 of file StatisticTests.cpp.

◆ kolmogorovSmirnovTest() [1/3]

Post::KsResult Post::kolmogorovSmirnovTest ( ArrayView< const Float data,
const Function< Float(Float)> &  expectedCdf 
)

One-dimensional Kolmogorov-Smirnov test with given CDF of expected probability distribution.

Definition at line 92 of file StatisticTests.cpp.

◆ kolmogorovSmirnovTest() [2/3]

Post::KsResult Post::kolmogorovSmirnovTest ( ArrayView< const Float data1,
ArrayView< const Float data2 
)

Definition at line 111 of file StatisticTests.cpp.

◆ kolmogorovSmirnovTest() [3/3]

Post::KsResult Post::kolmogorovSmirnovTest ( ArrayView< const PlotPoint data,
const KsFunction expected 
)

Two-dimensional Kolmogorov-Smirnov test.

Definition at line 149 of file StatisticTests.cpp.