13 for (
Size i = 0; i < m.
size(); ++i) {
21 : omega(0._f, 0._f, omega) {}
30 for (
Size i = 0; i < v.
size(); ++i) {
31 total += vectorCast<double>(m[i] * (v[i] +
cross(omega, r[i])));
34 return vectorCast<Float>(total);
38 : frameFrequency(0._f, 0._f, omega) {}
48 for (
Size i = 0; i < v.
size(); ++i) {
49 total += vectorCast<double>(m[i] *
cross(r[i], (v[i] +
cross(frameFrequency, r[i]))));
63 return vectorCast<Float>(total);
67 : omega(0._f, 0._f, omega) {}
75 for (
Size i = 0; i < v.
size(); ++i) {
83 for (
Size i = 0; i < v.
size(); ++i) {
94 : omega(0._f, 0._f, omega) {}
101 for (
Size i = 0; i < v.
size(); ++i) {
117 for (
Size i = 0; i < m.size(); ++i) {
118 total += double(m[i] * u[i]);
129 Float totalMass = 0._f;
132 auto accumulate = [&](
const Size i) {
139 for (
Size i = 0; i < r.size(); ++i) {
140 if (ids[i] == bodyId.
value()) {
145 for (
Size i = 0; i < r.size(); ++i) {
149 return com / totalMass;
157 : quantity(
std::move(func))
162 auto accumulate = [&](
const auto& getter) {
166 for (
Size i = 0; i < size; ++i) {
167 if (ids[i] == bodyId.
value()) {
172 for (
Size i = 0; i < size; ++i) {
181 accumulate([&](
const Size i) {
return q[i]; });
185 func->initialize(storage);
186 accumulate([&](
const Size i) {
return func->evaluate(i); });
193 , idx(particleIdx) {}
Various function for interpretation of the results of a simulation.
INLINE bool isReal(const AntisymmetricTensor &t)
#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.
Integrals of motion and other integral quantities.
#define NAMESPACE_SPH_END
QuantityId
Unique IDs of basic quantities of SPH particles.
@ FLAG
ID of original body, used to implement discontinuities between bodies in SPH.
@ POSITION
Positions (velocities, accelerations) of particles, always a vector quantity,.
@ ENERGY
Specific internal energy, always a scalar quantity.
@ MASS
Paricles masses, always a scalar quantity.
StaticArray< T0 &, sizeof...(TArgs)+1 > tie(T0 &t0, TArgs &... rest)
Creates a static array from a list of l-value references.
Container for storing particle quantities and materials.
INLINE Float getSqrLength(const Vector &v)
INLINE BasicVector< float > cross(const BasicVector< float > &v1, const BasicVector< float > &v2)
Cross product between two vectors.
INLINE bool empty() const
INLINE TCounter size() const
Wrapper of pointer that deletes the resource from destructor.
specialization for doubles or units of double precision
virtual Vector evaluate(const Storage &storage) const override
Computes the integral quantity using particles in the storage.
CenterOfMass(const Optional< Size > bodyId=NOTHING)
Helper class for statistics, accumulating minimal, maximal and mean value of a set of numbers.
INLINE void accumulate(const Float value)
INLINE Type & value()
Returns the reference to the stored value.
QuantityMeans(const QuantityId id, const Optional< Size > bodyId=NOTHING)
Computes mean of quantity values.
virtual MinMaxMean evaluate(const Storage &storage) const override
Computes the integral quantity using particles in the storage.
QuantityValue(const QuantityId id, const Size particleIdx)
virtual Float evaluate(const Storage &storage) const override
Computes the integral quantity using particles in the storage.
Container storing all quantities used within the simulations.
StaticArray< Array< TValue > &, 3 > getAll(const QuantityId key)
Retrieves quantity buffers from the storage, given its key and value type.
Size getParticleCnt() const
Returns the number of particles.
bool has(const QuantityId key) const
Checks if the storage contains quantity with given key.
Array< TValue > & getValue(const QuantityId key)
Retrieves a quantity values from the storage, given its key and value type.
virtual Vector evaluate(const Storage &storage) const override
Computes the integral quantity using particles in the storage.
TotalAngularMomentum(const Float frameFrequency=0._f)
virtual Float evaluate(const Storage &storage) const override
Computes the integral quantity using particles in the storage.
TotalEnergy(const Float omega=0._f)
virtual Float evaluate(const Storage &storage) const override
Computes the integral quantity using particles in the storage.
virtual Float evaluate(const Storage &storage) const override
Computes the integral quantity using particles in the storage.
TotalKineticEnergy(const Float omega=0._f)
virtual Float evaluate(const Storage &storage) const override
Computes the integral quantity using particles in the storage.
virtual Vector evaluate(const Storage &storage) const override
Computes the integral quantity using particles in the storage.
TotalMomentum(const Float omega=0._f)
INLINE Size getTypeIdx() const
Returns index of type currently stored in variant.
INLINE T & get()
Returns the stored value.
Creating code components based on values from settings.
Overload of std::swap for Sph::Array.