34 INLINE bool additionalEquals(
const Derivative&
UNUSED(other))
const {
38 template <
bool Symmetrize>
51 derivatives.
require(makeAuto<Derivative>(settings));
90 INLINE bool additionalEquals(
const Derivative&
UNUSED(other))
const {
94 template <
bool Symmetrize>
96 const Vector dr = (r[j] - r[i]) / (r[i][
H] + r[j][
H]);
99 const Vector normalized = dr / length;
110 derivatives.
require(makeAuto<Derivative>(settings));
134 #ifdef SPH_USE_CHAISCRIPT
135 Chai::Particles particles;
144 #ifdef SPH_USE_CHAISCRIPT
148 throw InvalidSetup(
"Code not built with ChaiScript support. Re-build with flag 'use_chaiscript'.");
160 #ifdef SPH_USE_CHAISCRIPT
161 if (t < nextTime || done) {
165 particles.bindToStorage(storage);
167 chaiscript::ChaiScript chai;
168 Chai::registerBindings(chai);
169 chai.add(chaiscript::var(std::ref(particles)),
"particles");
170 chai.add(chaiscript::const_var(t),
"time");
@ UNIQUE
Only a single derivative accumulates to this buffer.
#define SPH_ASSERT(x,...)
Right-hand side term of SPH equations.
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.
#define INLINE
Macros for conditional compilation based on selected compiler.
#define NAMESPACE_SPH_END
@ POSITION
Positions (velocities, accelerations) of particles, always a vector quantity,.
@ SURFACE_NORMAL
Vector approximating surface normal.
@ NEIGHBOUR_CNT
Number of neighbouring particles (in radius h * kernel.radius)
@ ZERO
Quantity without derivatives, or "zero order" of quantity.
Utility functions and classes exposed to the embedded scripting language.
INLINE Float getLength(const Vector &v)
Returns the length of the vector. Enabled only for vectors of floating-point precision.
BasicVector< Float > Vector
Storage for accumulating derivatives.
Array< TValue > & getBuffer(const QuantityId id, const OrderEnum order)
Returns the buffer of given quantity and given order.
void insert(const QuantityId id, const OrderEnum order, const BufferSource source)
Creates a new storage with given ID.
ChaiScriptTerm(const Path &scriptFile, const Float period, const bool oneShot)
virtual void initialize(IScheduler &UNUSED(scheduler), Storage &UNUSED(storage), const Float UNUSED(t)) override
virtual void setDerivatives(DerivativeHolder &UNUSED(derivatives), const RunSettings &UNUSED(settings)) override
virtual void create(Storage &UNUSED(storage), IMaterial &UNUSED(material)) const override
virtual void finalize(IScheduler &UNUSED(scheduler), Storage &storage, const Float t) override
Container holding derivatives and the storage they accumulate to.
virtual void require(AutoPtr< IDerivative > &&derivative)
Adds derivative if not already present.
Helper template for derivatives that define both the symmetrized and asymmetric variant.
Represents a term or terms appearing in evolutionary equations.
Material settings and functions specific for one material.
Interface that allows unified implementation of sequential and parallelized versions of algorithms.
Thrown when components of the run are mutually incompatible.
Helper term counting the number of neighbours of each particle.
virtual void setDerivatives(DerivativeHolder &derivatives, const RunSettings &settings) override
Sets derivatives required by this term.
virtual void finalize(IScheduler &UNUSED(scheduler), Storage &UNUSED(storage), const Float UNUSED(t)) override
virtual void initialize(IScheduler &UNUSED(scheduler), Storage &UNUSED(storage), const Float UNUSED(t)) override
virtual void create(Storage &UNUSED(storage), IMaterial &UNUSED(material)) const override
Object representing a path on a filesystem.
Container storing all quantities used within the simulations.
Quantity & insert(const QuantityId key, const OrderEnum order, const TValue &defaultValue)
Creates a quantity in the storage, given its key, value type and order.
Array< TValue > & getValue(const QuantityId key)
Retrieves a quantity values from the storage, given its key and value type.
Term computing normals of free surface.
virtual void initialize(IScheduler &UNUSED(scheduler), Storage &UNUSED(storage), const Float UNUSED(t)) override
virtual void finalize(IScheduler &UNUSED(scheduler), Storage &UNUSED(storage), const Float UNUSED(t)) override
virtual void create(Storage &storage, IMaterial &UNUSED(material)) const override
virtual void setDerivatives(DerivativeHolder &derivatives, const RunSettings &settings) override
Sets derivatives required by this term.
std::string readFile(const Path &path)
Reads the whole file into the string.