67 template<
class GeoField>
105 const word& fieldName,
112 this->setResult(
"average(" + fieldName +
")", avgVal);
113 this->setResult(
"min(" + fieldName +
")", limits.
min());
114 this->setResult(
"max(" + fieldName +
")", limits.
max());
115 this->setResult(
"size(" + fieldName +
")",
values.size());
120 <<
" avg: " << avgVal <<
nl 121 <<
" min: " << limits.
min() <<
nl 122 <<
" max: " << limits.
max() <<
nl <<
nl;
130 void Foam::probes::writeValues
132 const word& fieldName,
133 const Field<Type>&
values,
134 const scalar timeValue
140 OFstream&
os = *probeFilePtrs_[fieldName];
142 os <<
setw(width) << timeValue;
146 if (includeOutOfBounds_ || processor_[probei] != -1)
156 template<
class GeoField>
157 void Foam::probes::performAction
159 const fieldGroup<GeoField>& fieldNames,
163 for (
const word& fieldName : fieldNames)
165 tmp<GeoField> tfield = getOrLoadField<GeoField>(fieldName);
169 const auto&
field = tfield();
170 const scalar timeValue =
field.time().timeOutputValue();
172 Field<typename GeoField::value_type>
values(sample(
field));
174 this->storeResults(fieldName,
values);
175 if (request & ACTION_WRITE)
177 this->writeValues(fieldName,
values, timeValue);
193 auto&
values = tvalues.ref();
204 if (elementList_[probei] >= 0)
206 const vector& position = operator[](probei);
208 values[probei] = interpPtr().interpolate
211 elementList_[probei],
221 if (elementList_[probei] >= 0)
223 values[probei] = vField[elementList_[probei]];
241 auto&
values = tvalues.ref();
245 if (faceList_[probei] >= 0)
247 values[probei] = sField[faceList_[probei]];
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &f1)
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.
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.
#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 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 time name of given scalar time 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.
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)
void reset(tmp< T > &&other) noexcept
Clear existing and transfer ownership.
static void listCombineReduce(List< T > &values, const CombineOp &cop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
After completion all processors have the same data.