SPH
Classes | Public Member Functions | List of all members
Accumulated Class Reference

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)
 

Detailed Description

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.

Member Function Documentation

◆ getBuffer()

template<typename TValue >
template Array< TracelessTensor > & Accumulated::getBuffer ( const QuantityId  id,
const OrderEnum  order 
)

Returns the buffer of given quantity and given order.

Note
Accumulated can store only one buffer per quantity, so the order is not neccesary to retrive the buffer, but it is required to check that we are indeed returning the required order of quantity. It also makes the code more readable.

Definition at line 53 of file Accumulated.cpp.

◆ getBufferCnt()

Size Accumulated::getBufferCnt ( ) const

Definition at line 100 of file Accumulated.cpp.

◆ initialize()

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.

◆ insert() [1/2]

template<typename TValue >
NAMESPACE_SPH_BEGIN void Accumulated::insert ( const QuantityId  id,
const OrderEnum  order,
const BufferSource  source 
)

Definition at line 9 of file Accumulated.cpp.

◆ insert() [2/2]

template<typename TValue >
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.

Parameters
idID of the accumulated quantity
orderOrder of the quantity. Only highest order can be accumulated, this parameter is used to ensure the derivative is used consistently.
uniqueWhether 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).

◆ store()

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.

◆ sum() [1/2]

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.

◆ sum() [2/2]

void Accumulated::sum ( IScheduler scheduler,
ArrayView< Accumulated * >  others 
)

Sums values, concurently over different quantities.

Definition at line 79 of file Accumulated.cpp.


The documentation for this class was generated from the following files: