43 accumulationBuffer() += (*this)[
b];
47 (*this)[
b] = Field<Type>(bufferLength(),
Zero);
49 bufferOffsets_[
b] = 0;
68 const label bufferLength,
69 const label bufferingInterval
92 averagesTaken_(bA.averagesTaken()),
93 bufferOffsets_(bA.bufferOffsets())
109 const label nBuffers,
110 const label bufferLength,
111 const label bufferingInterval
114 (*this).setSize(nBuffers + 1);
123 bufferOffsets_.
setSize(nBuffers);
125 forAll(bufferOffsets_, bO)
127 bufferOffsets_[bO] = -bufferingInterval * bO - 1;
135 const List<Type>& valuesToAdd
138 label bufferToRefill = -1;
140 for (label
b = 0;
b < nBuffers();
b++)
142 Field<Type>& buf((*
this)[
b]);
144 label& bO = bufferOffsets_[
b];
148 buf[bO] = valuesToAdd[
b];
153 if (bO == bufferLength())
155 accumulateAndResetBuffer(
b);
160 if (bufferToRefill != -1)
163 <<
"More than one bufferedAccumulator accumulation " 164 <<
"buffer filled at once, this is considered an error." 172 return bufferToRefill;
181 Field<Type> bA = accumulationBuffer()/averagesTaken_;
188 <<
"Averaged correlation function requested but averagesTaken = " 190 <<
". Returning empty field." 201 accumulationBuffer() = Field<Type>(bufferLength(),
Zero);
220 List<Field<Type>>::operator=(rhs);
224 bufferOffsets_ = rhs.bufferOffsets();
label averagesTaken() const
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Ostream & endl(Ostream &os)
Add newline and flush stream.
void setSizes(const label nBuffers, const label bufferLength, const label bufferingInterval)
Field< Type > averaged() const
#define forAll(list, i)
Loop across all elements in list.
void setSize(const label n)
Alias for resize()
Generic templated field type.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
static const char *const typeName
~bufferedAccumulator()
Destructor.
errorManip< error > abort(error &err)
bufferedAccumulator()
Construct null.
#define WarningInFunction
Report a warning using Foam::Warning.
label addToBuffers(const List< Type > &valuesToAdd)
static constexpr const zero Zero
Global zero (0)