SPH
|
Generic container for storing scalar, vector or tensor quantity and its derivatives. More...
#include <Quantity.h>
Public Member Functions | |
Quantity ()=default | |
Constructs an empty quantity. More... | |
template<typename TValue > | |
Quantity (const OrderEnum order, const TValue &defaultValue, const Size size) | |
Creates a quantity given number of particles and default value of the quantity. More... | |
template<typename TValue > | |
Quantity (const OrderEnum order, Array< TValue > &&values) | |
Creates a quantity from an array of values. More... | |
OrderEnum | getOrderEnum () const |
Returns the order of the quantity. More... | |
ValueEnum | getValueEnum () const |
Returns the value order of the quantity. More... | |
Quantity | clone (const Flags< VisitorEnum > flags) const |
Clones all buffers contained by the quantity, or optionally only selected ones. More... | |
Quantity | createZeros (const Size particleCnt) const |
Creates a new quantity with the same type and order as this one. More... | |
void | swap (Quantity &other, const Flags< VisitorEnum > flags) |
Swap quantity (or selected part of it) with other quantity. More... | |
INLINE Size | size () const |
Returns the size of the quantity (number of particles) More... | |
template<typename TValue > | |
INLINE Array< TValue > & | getValue () |
Returns a reference to array of quantity values. More... | |
template<typename TValue > | |
INLINE const Array< TValue > & | getValue () const |
Returns a reference to array of quantity values, const version. More... | |
void | setOrder (const OrderEnum order) |
template<typename TValue > | |
INLINE Array< TValue > & | getDt () |
Returns a reference to array of first derivatives of quantity. More... | |
template<typename TValue > | |
INLINE const Array< TValue > & | getDt () const |
Returns a reference to array of first derivatives of quantity, const version. More... | |
template<typename TValue > | |
INLINE Array< TValue > & | getD2t () |
Returns a reference to array of second derivatives of quantity. More... | |
template<typename TValue > | |
INLINE const Array< TValue > & | getD2t () const |
Returns a reference to array of second derivatives of quantity, const version. More... | |
template<typename TValue > | |
StaticArray< Array< TValue > &, 3 > | getAll () |
Returns all buffers of given type stored in this quantity. More... | |
template<typename TValue > | |
StaticArray< const Array< TValue > &, 3 > | getAll () const |
template<typename TIndexSequence > | |
void | clamp (const TIndexSequence &sequence, const Interval range) |
Public Member Functions inherited from Noncopyable | |
Noncopyable ()=default | |
Noncopyable (const Noncopyable &)=delete | |
Noncopyable (Noncopyable &&)=default | |
Noncopyable & | operator= (const Noncopyable &)=delete |
Noncopyable & | operator= (Noncopyable &&)=default |
Generic container for storing scalar, vector or tensor quantity and its derivatives.
Contains current values of the quantity and all derivatives. Any quantity can have first and second derivatives stored together with quantity values. There is currently no limitation of quatity types and their order, i.e. it is possible to have index quantities with derivatives.
As the quantity can have data of different types, there is no direct way to access the arrays stored within (like operator [] for Array class, for example). To access the stored values, use on of the following:
Quantity cannot be easily resized, in order to enforce validity of parent Storage; the number of quantity values should be the same for all quantities and equal to the number of particles in the storage. To add or remove particles, use Storage::resize function, rather than manually resizing all quantities. Even though this is possible to do (using mentioned iterate function), it is not recommended, as Storage keeps the number of particles as a state and it would invalidate the Storage.
Definition at line 200 of file Quantity.h.
|
default |
Constructs an empty quantity.
Calling any member functions will cause assert, quantity can be then created using move constructor. The default constructor allows using Quantity in STL containers.
|
inline |
Creates a quantity given number of particles and default value of the quantity.
All values are set to the default value. If the type is 1st-order or 2nd-order, derivatives arrays resized to the same size as the array of values and set to zero.
defaultValue | Value assigned to all particles. |
size | Size of the array, equal to the number of particles. |
Definition at line 226 of file Quantity.h.
|
inline |
Creates a quantity from an array of values.
All derivatives are set to zero.
Definition at line 233 of file Quantity.h.
|
inline |
Iterates through the quantity values using given integer sequence and clamps the visited values to given range.
Definition at line 351 of file Quantity.h.
|
inline |
Clones all buffers contained by the quantity, or optionally only selected ones.
Definition at line 252 of file Quantity.h.
Creates a new quantity with the same type and order as this one.
It creates specified number of particles and initializes them to zeros.
Definition at line 259 of file Quantity.h.
|
inline |
Returns all buffers of given type stored in this quantity.
If the quantity is of different type, an empty array is returned. Buffers in array are ordered such that quantity values is the first element (zero index), first derivative is the second element etc.
Definition at line 338 of file Quantity.h.
|
inline |
Definition at line 343 of file Quantity.h.
Returns a reference to array of second derivatives of quantity.
The type of the quantity must match the provided type and the quantity must be 2st order, checked by assert. To check whether the type and order match, use getValueEnum() and getOrderEnum(), respectively.
Definition at line 323 of file Quantity.h.
Returns a reference to array of second derivatives of quantity, const version.
Definition at line 329 of file Quantity.h.
Returns a reference to array of first derivatives of quantity.
The type of the quantity must match the provided type and the quantity must be (at least) 1st order, checked by assert. To check whether the type and order match, use getValueEnum() and getOrderEnum(), respectively.
Definition at line 307 of file Quantity.h.
Returns a reference to array of first derivatives of quantity, const version.
Definition at line 313 of file Quantity.h.
|
inline |
Returns the order of the quantity.
Zero order quantities contain only quantity values, first-order quantities contain values and first derivatives, and so on. The order is used by timestepping algorithm to advance the quantity values in time.
Definition at line 241 of file Quantity.h.
Returns a reference to array of quantity values.
The type of the quantity must match the provided type, checked by assert. To check whether the type of the quantity match, use getValueEnum().
Definition at line 287 of file Quantity.h.
Returns a reference to array of quantity values, const version.
Definition at line 293 of file Quantity.h.
|
inline |
Returns the value order of the quantity.
Definition at line 246 of file Quantity.h.
|
inline |
Definition at line 297 of file Quantity.h.
Returns the size of the quantity (number of particles)
Definition at line 278 of file Quantity.h.
|
inline |
Swap quantity (or selected part of it) with other quantity.
Swapping only part of quantity (only derivatives for example) can be useful for some timestepping algorithms, such as predictor-corrector.
Definition at line 269 of file Quantity.h.