40 const Size particleIdx)
const = 0;
72 template <
typename TValue>
83 const Size particleIdx)
const override {
85 if (particleIdx >= values.
size()) {
86 throw Exception(
"Cannot evaluate value of particle " + std::to_string(particleIdx) +
87 ", storage only contains " + std::to_string(values.
size()) +
" particles");
89 return values[particleIdx];
93 if (!storage.
has(
id)) {
98 array.
resize(particleIdx + 1);
99 array[particleIdx] = value.
get<TValue>();
102 virtual std::string
getName()
const override {
114 template <
typename TValue>
125 const Size particleIdx)
const override {
127 if (particleIdx >= values.
size()) {
128 throw Exception(
"Cannot evaluate derivative of particle " + std::to_string(particleIdx) +
129 ", storage only contains " + std::to_string(values.
size()) +
" particles");
131 return values[particleIdx];
135 if (!storage.
has(
id)) {
144 array.
resize(particleIdx + 1);
145 array[particleIdx] = value.
get<TValue>();
148 virtual std::string
getName()
const override {
160 template <
typename TValue>
171 const Size particleIdx)
const override {
173 if (particleIdx >= values.
size()) {
174 throw Exception(
"Cannot evaluate 2nd derivative of particle " + std::to_string(particleIdx) +
175 ", storage only contains " + values.
size() +
" particles");
177 return values[particleIdx];
181 if (!storage.
has(
id)) {
190 array.
resize(particleIdx + 1);
191 array[particleIdx] = value.
get<TValue>();
194 virtual std::string
getName()
const override {
208 const Size particleIdx)
const override {
210 if (particleIdx >= values.
size()) {
211 throw Exception(
"Cannot evaluate smoothing length of particle " + std::to_string(particleIdx) +
212 ", storage only contains " + std::to_string(values.
size()) +
" particles");
214 return values[particleIdx][
H];
223 array.
resize(particleIdx + 1);
224 array[particleIdx][
H] = value.
get<
Float>();
227 virtual std::string
getName()
const override {
228 return "Smoothing length";
239 template <
typename TValue>
244 const Size particleIdx)
const override {
246 if (particleIdx >= values.
size()) {
247 throw Exception(
"Cannot evaluate damage of particle " + std::to_string(particleIdx) +
248 ", storage only contains " + values.
size() +
" particles");
250 return pow<3>(values[particleIdx]);
255 array.
resize(particleIdx + 1);
256 array[particleIdx] =
root<3>(value.
get<TValue>());
259 virtual std::string
getName()
const override {
273 const Size particleIdx)
const override {
281 virtual std::string
getName()
const override {
282 return "Particle index";
295 const Size UNUSED(particleIdx))
const override {
303 virtual std::string
getName()
const override {
Object holding a single values of various types.
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 Float pow< 3 >(const Float v)
INLINE Float root< 3 >(const Float f)
#define NAMESPACE_SPH_END
QuantityMetadata getMetadata(const QuantityId key)
Returns the quantity information using quantity ID.
QuantityId
Unique IDs of basic quantities of SPH particles.
@ POSITION
Positions (velocities, accelerations) of particles, always a vector quantity,.
Holder of quantity values and their temporal derivatives.
@ SECOND
Quantity with 1st and 2nd derivative.
@ FIRST
Quantity with 1st derivative.
@ ZERO
Quantity without derivatives, or "zero order" of quantity.
Statistics gathered and periodically displayed during the run.
@ RUN_TIME
Current time of the simulation in code units. Does not necessarily have to be 0 when run starts.
Container for storing particle quantities and materials.
BasicVector< Float > Vector
Object providing safe access to continuous memory of data.
INLINE TCounter size() const
void resize(const TCounter newSize)
Resizes the array to new size.
Prints actual values of scalar damage.
virtual Dynamic evaluate(const Storage &storage, const Statistics &UNUSED(stats), const Size particleIdx) const override
virtual ValueEnum getType() const override
Returns the value type of the column.
virtual std::string getName() const override
Returns a name of the column.
virtual void accumulate(Storage &storage, const Dynamic value, const Size particleIdx) const override
Reads the value of the column and saves it into the storage, if possible.
Returns first derivatives of given quantity as stored in storage.
virtual ValueEnum getType() const override
Returns the value type of the column.
virtual std::string getName() const override
Returns a name of the column.
virtual void accumulate(Storage &storage, const Dynamic value, const Size particleIdx) const override
Reads the value of the column and saves it into the storage, if possible.
virtual Dynamic evaluate(const Storage &storage, const Statistics &UNUSED(stats), const Size particleIdx) const override
DerivativeColumn(const QuantityId id)
Convenient object for storing a single value of different types.
INLINE T & get()
Returns the reference to the stored value given its type.
Base class for conversion of quantities into the output data.
virtual std::string getName() const =0
Returns a name of the column.
virtual ValueEnum getType() const =0
Returns the value type of the column.
virtual Dynamic evaluate(const Storage &storage, const Statistics &stats, const Size particleIdx) const =0
Returns the value of the output column for given particle.
virtual void accumulate(Storage &storage, const Dynamic value, const Size particleIdx) const =0
Reads the value of the column and saves it into the storage, if possible.
Helper column printing particle numbers.
virtual std::string getName() const override
Returns a name of the column.
virtual ValueEnum getType() const override
Returns the value type of the column.
virtual Dynamic evaluate(const Storage &UNUSED(storage), const Statistics &UNUSED(stats), const Size particleIdx) const override
virtual void accumulate(Storage &, const Dynamic, const Size) const override
Reads the value of the column and saves it into the storage, if possible.
void setOrder(const OrderEnum order)
OrderEnum getOrderEnum() const
Returns the order of the quantity.
Returns second derivatives of given quantity as stored in storage.
virtual void accumulate(Storage &storage, const Dynamic value, const Size particleIdx) const override
Reads the value of the column and saves it into the storage, if possible.
virtual ValueEnum getType() const override
Returns the value type of the column.
virtual Dynamic evaluate(const Storage &storage, const Statistics &UNUSED(stats), const Size particleIdx) const override
virtual std::string getName() const override
Returns a name of the column.
SecondDerivativeColumn(const QuantityId id)
Returns smoothing lengths of particles.
virtual std::string getName() const override
Returns a name of the column.
virtual Dynamic evaluate(const Storage &storage, const Statistics &UNUSED(stats), const Size particleIdx) const override
virtual void accumulate(Storage &storage, const Dynamic value, const Size particleIdx) const override
Reads the value of the column and saves it into the storage, if possible.
virtual ValueEnum getType() const override
Returns the value type of the column.
Object holding various statistics about current run.
TValue get(const StatisticsId idx) const
Returns value of a statistic.
Container storing all quantities used within the simulations.
Quantity & getQuantity(const QuantityId key)
Retrieves quantity with given key from the storage.
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 > & getDt(const QuantityId key)
Retrieves a quantity derivative from the storage, given its key and value type.
Array< TValue > & getD2t(const QuantityId key)
Retrieves a quantity second derivative from the storage, given its key and value type.
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.
Helper column printing current run time. This value is the same for every particle.
virtual std::string getName() const override
Returns a name of the column.
virtual void accumulate(Storage &, const Dynamic, const Size) const override
Reads the value of the column and saves it into the storage, if possible.
virtual ValueEnum getType() const override
Returns the value type of the column.
virtual Dynamic evaluate(const Storage &UNUSED(storage), const Statistics &stats, const Size UNUSED(particleIdx)) const override
Returns values of given quantity as stored in storage.
virtual void accumulate(Storage &storage, const Dynamic value, const Size particleIdx) const override
Reads the value of the column and saves it into the storage, if possible.
virtual Dynamic evaluate(const Storage &storage, const Statistics &UNUSED(stats), const Size particleIdx) const override
ValueColumn(const QuantityId id)
virtual ValueEnum getType() const override
Returns the value type of the column.
virtual std::string getName() const override
Returns a name of the column.
Convert type to ValueType enum.
Base class for all polymorphic objects.