40 accumulationBuffer() += (*this)[
b];
44 (*this)[
b] = Field<Type>(bufferLength(),
Zero);
46 bufferOffsets_[
b] = 0;
65 const label bufferLength,
66 const label bufferingInterval
89 averagesTaken_(bA.averagesTaken()),
90 bufferOffsets_(bA.bufferOffsets())
106 const label nBuffers,
107 const label bufferLength,
108 const label bufferingInterval
111 (*this).setSize(nBuffers + 1);
120 bufferOffsets_.
setSize(nBuffers);
122 forAll(bufferOffsets_, bO)
124 bufferOffsets_[bO] = -bufferingInterval * bO - 1;
135 label bufferToRefill = -1;
137 for (
label b = 0;
b < nBuffers();
b++)
141 label& bO = bufferOffsets_[
b];
145 buf[bO] = valuesToAdd[
b];
150 if (bO == bufferLength())
152 accumulateAndResetBuffer(
b);
157 if (bufferToRefill != -1)
160 <<
"More than one bufferedAccumulator accumulation " 161 <<
"buffer filled at once, this is considered an error." 169 return bufferToRefill;
178 Field<Type> bA = accumulationBuffer()/averagesTaken_;
185 <<
"Averaged correlation function requested but averagesTaken = " 187 <<
". Returning empty field." 207 void Foam::bufferedAccumulator<Type>::operator=
216 <<
"Attempted assignment to self" 222 averagesTaken_ = rhs.averagesTaken();
224 bufferOffsets_ = rhs.bufferOffsets();
#define forAll(list, i)
Loop across all elements in list.
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
#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...
const dimensionedScalar b
Wien displacement law constant: default SI units: [m K].
Ostream & endl(Ostream &os)
Add newline and flush stream.
void setSizes(const label nBuffers, const label bufferLength, const label bufferingInterval)
Field< Type > averaged() const
Pre-declare SubField and related Field type.
static const char *const typeName
~bufferedAccumulator()
Destructor.
errorManip< error > abort(error &err)
bufferedAccumulator()
Construct null.
void setSize(const label)
Reset size of List.
#define WarningInFunction
Report a warning using Foam::Warning.
label addToBuffers(const List< Type > &valuesToAdd)