129 template <
typename TValue>
131 params.
set(paramIdx, std::forward<TValue>(value));
136 template <
typename TValue>
#define SPH_ASSERT(x,...)
Key-value associative container implemented as a sorted array.
double Float
Precision used withing the code. Use Float instead of float or double where precision is important.
Helper objects allowing to iterate in reverse, iterate over multiple containeres, etc.
#define INLINE
Macros for conditional compilation based on selected compiler.
#define NAMESPACE_SPH_END
QuantityId
Unique IDs of basic quantities of SPH particles.
Random number generators.
INLINE Optional< TValue & > tryGet(const TKey &key)
Returns a reference to the value matching the given key, or NOTHING if no such value exists.
Material settings and functions specific for one material.
FlatMap< QuantityId, Interval > ranges
Allowed range of quantities.
INLINE TValue getParam(const BodySettingsId paramIdx) const
Returns a parameter associated with given particle.
static const Float DEFAULT_MINIMAL
FlatMap< QuantityId, Float > minimals
Minimal values used in timestepping, do not affect values of quantities themselves.
INLINE const Interval range(const QuantityId id) const
Returns the range of allowed quantity values.
INLINE Float minimal(const QuantityId id) const
Returns the scale value of the quantity.
IMaterial(const BodySettings &settings)
INLINE const BodySettings & getParams() const
Returns settings containing material parameters.
virtual void finalize(IScheduler &scheduler, Storage &storage, const IndexSequence sequence)=0
Finalizes the material for the time step.
static const Interval DEFAULT_RANGE
Default values.
INLINE void setRange(const QuantityId id, const BodySettingsId rangeId, const BodySettingsId minimalId)
Sets the timestepping parameters of given quantity.
virtual void initialize(IScheduler &scheduler, Storage &storage, const IndexSequence sequence)=0
Initialize all quantities and material parameters.
BodySettings params
Per-material parameters.
INLINE IMaterial & setParam(const BodySettingsId paramIdx, TValue &&value)
void setRange(const QuantityId id, const Interval &range, const Float minimal)
Sets the timestepping parameters of given quantity.
virtual void create(Storage &storage, const MaterialInitialContext &context)=0
Create all quantities needed by the material.
Interface that allows unified implementation of sequential and parallelized versions of algorithms.
Object representing a 1D interval of real numbers.
Non-owning wrapper of a material and particles with this material.
INLINE MaterialView(RawPtr< IMaterial > &&material, IndexSequence seq)
INLINE const IndexSequence sequence() const
Returns iterable index sequence, const version.
INLINE IMaterial & material() const
Returns the const reference to the material of the particles.
INLINE IMaterial & material()
Returns the reference to the material of the particles.
INLINE IndexSequence sequence()
Returns iterable index sequence.
INLINE RawPtr< const IMaterial > operator->() const
Overloaded -> operator for convenient access to material functions.
INLINE RawPtr< IMaterial > operator->()
Overloaded -> operator for convenient access to material functions.
Material that does not require any initialization or finalization.
virtual void initialize(IScheduler &UNUSED(scheduler), Storage &UNUSED(storage), const IndexSequence UNUSED(sequence)) override
virtual void create(Storage &UNUSED(storage), const MaterialInitialContext &UNUSED(context)) override
virtual void finalize(IScheduler &UNUSED(scheduler), Storage &UNUSED(storage), const IndexSequence UNUSED(sequence)) override
NullMaterial(const BodySettings &body)
TValue get(const TEnum idx, std::enable_if_t<!std::is_enum< std::decay_t< TValue >>::value, int >=0) const
Returns a value of given type from the settings.
Settings & set(const TEnum idx, TValue &&value, std::enable_if_t<!std::is_enum< std::decay_t< TValue >>::value, int >=0)
Saves a value into the settings.
Container storing all quantities used within the simulations.
Generic storage and input/output routines of settings.
BodySettingsId
Settings of a single body / gas phase / ...
Overload of std::swap for Sph::Array.
Shared data used when creating all bodies in the simulation.
MaterialInitialContext()=default
SharedPtr< IScheduler > scheduler
AutoPtr< IUvMapping > uvMap
If used, texture mapping coordinates are generated provided mapping.
Float kernelRadius
Kernel radius in units of smoothing length.
AutoPtr< IRng > rng
Random number generator.
Base class for all polymorphic objects.