SPH
|
Storage for accumulating derivatives. More...
#include <Accumulated.h>
Public Member Functions | |
template<typename TValue > | |
void | insert (const QuantityId id, const OrderEnum order, const BufferSource source) |
Creates a new storage with given ID. More... | |
void | initialize (const Size size) |
Initialize all storages. More... | |
template<typename TValue > | |
Array< TValue > & | getBuffer (const QuantityId id, const OrderEnum order) |
Returns the buffer of given quantity and given order. More... | |
void | sum (ArrayView< Accumulated * > others) |
Sums values of a list of storages. More... | |
void | sum (IScheduler &scheduler, ArrayView< Accumulated * > others) |
Sums values, concurently over different quantities. More... | |
void | store (Storage &storage) |
Stores accumulated values to corresponding quantities. More... | |
Size | getBufferCnt () const |
template<typename TValue > | |
NAMESPACE_SPH_BEGIN void | insert (const QuantityId id, const OrderEnum order, const BufferSource source) |
Storage for accumulating derivatives.
Each thread shall own its own Accumulated storage. Each accumulated buffer is associated with a quantity using QuantityId.
Definition at line 30 of file Accumulated.h.
template Array< TracelessTensor > & Accumulated::getBuffer | ( | const QuantityId | id, |
const OrderEnum | order | ||
) |
Returns the buffer of given quantity and given order.
Definition at line 53 of file Accumulated.cpp.
Size Accumulated::getBufferCnt | ( | ) | const |
Definition at line 100 of file Accumulated.cpp.
void Accumulated::initialize | ( | const Size | size | ) |
Initialize all storages.
Storages are resized if needed and cleared out of all previously accumulated values.
Definition at line 37 of file Accumulated.cpp.
NAMESPACE_SPH_BEGIN void Accumulated::insert | ( | const QuantityId | id, |
const OrderEnum | order, | ||
const BufferSource | source | ||
) |
Definition at line 9 of file Accumulated.cpp.
void Accumulated::insert | ( | const QuantityId | id, |
const OrderEnum | order, | ||
const BufferSource | source | ||
) |
Creates a new storage with given ID.
Should be called once for each thread when the solver is initialized.
id | ID of the accumulated quantity |
order | Order of the quantity. Only highest order can be accumulated, this parameter is used to ensure the derivative is used consistently. |
unique | Whether this buffer is being accumulated by a single derivative. It has no effect on the simulation, but ensures a consistency of the run (that we don't accumulate two different velocity gradients, for example). |
void Accumulated::store | ( | Storage & | storage | ) |
Stores accumulated values to corresponding quantities.
The accumulated quantity must already exist in the storage and its order must be at least the order of the accumulated buffer. The accumulated buffer is cleared (filled with zeroes) after storing the values into the storage.
Definition at line 86 of file Accumulated.cpp.
void Accumulated::sum | ( | ArrayView< Accumulated * > | others | ) |
Sums values of a list of storages.
Storages must have the same number of buffers and the matching buffers must have the same type and same size.
Definition at line 71 of file Accumulated.cpp.
void Accumulated::sum | ( | IScheduler & | scheduler, |
ArrayView< Accumulated * > | others | ||
) |
Sums values, concurently over different quantities.
Definition at line 79 of file Accumulated.cpp.