68 template<
class GeoField>
102 const word& fieldName,
109 this->setResult(
"average(" + fieldName +
")", avgVal);
110 this->setResult(
"min(" + fieldName +
")", limits.
min());
111 this->setResult(
"max(" + fieldName +
")", limits.
max());
112 this->setResult(
"size(" + fieldName +
")",
values.size());
117 <<
" avg: " << avgVal <<
nl 118 <<
" min: " << limits.
min() <<
nl 119 <<
" max: " << limits.
max() <<
nl <<
nl;
127 void Foam::probes::writeValues
129 const word& fieldName,
130 const Field<Type>&
values,
131 const scalar timeValue
137 OFstream&
os = *probeFilePtrs_[fieldName];
139 os <<
setw(width) << timeValue;
145 if (includeOutOfBounds_ || processor_[probei] != -1)
149 os <<
' ' <<
setw(width) << buf.str().data();
157 template<
class GeoField>
158 void Foam::probes::performAction
160 const fieldGroup<GeoField>& fieldNames,
164 for (
const word& fieldName : fieldNames)
166 tmp<GeoField> tfield = getOrLoadField<GeoField>(fieldName);
170 const auto&
field = tfield();
171 const scalar timeValue =
field.time().timeOutputValue();
173 Field<typename GeoField::value_type>
values(sample(
field));
175 this->storeResults(fieldName,
values);
176 if (request & ACTION_WRITE)
178 this->writeValues(fieldName,
values, timeValue);
194 auto&
values = tvalues.ref();
205 if (elementList_[probei] >= 0)
207 const vector& position = operator[](probei);
209 values[probei] = interpPtr().interpolate
212 elementList_[probei],
222 if (elementList_[probei] >= 0)
224 values[probei] = vField[elementList_[probei]];
242 auto&
values = tvalues.ref();
246 if (faceList_[probei] >= 0)
248 values[probei] = sField[faceList_[probei]];
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &f1)
Input/output streams with (internal or external) character storage.
void operator()(T &x, const T &y) const
constexpr char nl
The newline '\n' character (0x0a)
A min/max value pair with additional methods. In addition to conveniently storing values...
Ostream & endl(Ostream &os)
Add newline and flush stream.
A traits class, which is primarily used for primitives and vector-space.
tmp< GeoField > getOrLoadField(const word &fieldName) const
Get from registry or load from disk.
const T & cref() const
Return const reference to the object or to the contents of a (non-null) managed pointer.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
static unsigned int defaultPrecision() noexcept
Return the default precision.
Generic GeometricField class.
Ignore writing from objectRegistry::writeObject()
const Time & time() const
Return the top-level database.
const Type * cfindObject(const word &name, const bool recursive=false) const
Return const pointer to the object of the given Type.
tmp< Field< Type > > sampleSurfaceField(const word &fieldName) const
Sample a surface field at all locations.
virtual const objectRegistry & thisDb() const
Return the object registry - resolve conflict polyMesh/lduMesh.
#define forAll(list, i)
Loop across all elements in list.
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
const T & min() const noexcept
The min value (first)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Generic templated field type.
A class for handling words, derived from Foam::string.
Istream and Ostream manipulators taking arguments.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
OBJstream os(runTime.globalPath()/outputName)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
bool loadFromFiles_
Load fields from files (not from objectRegistry)
void storeResults(const word &fieldName, const Field< Type > &values)
Store results: min/max/average/size.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
const T & max() const noexcept
The max value (second)
tmp< Field< Type > > sample(const VolumeField< Type > &) const
Sample a volume field at all locations.
Abstract base class for volume field interpolation.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Omanip< int > setw(const int i)
A class for managing temporary objects.
T & emplace(Args &&... args)
Reset with emplace construction. Return reference to the new content.
Defines the attributes of an object for which implicit objectRegistry management is supported...
const fvMesh & mesh_
Reference to the fvMesh.
Do not request registration (bool: false)
static void listCombineReduce(List< T > &values, const CombineOp &cop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Combines List elements. After completion all processors have the same data.