37 const word& fieldName,
76 <<
" in cell " << minCell
77 <<
" at location " << minC;
81 Log <<
" on processor " << minProci;
85 <<
" in cell " << maxCell
86 <<
" at location " << maxC;
90 Log <<
" on processor " << maxProci;
106 this->
setResult(
"min" + nameStr +
"_cell", minCell);
107 this->
setResult(
"min" + nameStr +
"_position", minC);
108 this->
setResult(
"min" + nameStr +
"_processor", minProci);
110 this->
setResult(
"max" + nameStr +
"_cell", maxCell);
112 this->
setResult(
"max" + nameStr +
"_processor", maxProci);
120 const word& outputFieldName
137 label minId = minMaxIds.
first();
140 minVs[proci] =
field[minId];
141 minCells[proci] = minId;
142 minCs[proci] = mesh_.C()[minId];
145 label maxId = minMaxIds.
second();
148 maxVs[proci] =
field[maxId];
149 maxCells[proci] = maxId;
150 maxCs[proci] = mesh_.C()[maxId];
155 const auto& fieldBoundary =
field.boundaryField();
156 const auto& CfBoundary = mesh_.C().boundaryField();
158 forAll(fieldBoundary, patchi)
160 const Field<Type>& fp = fieldBoundary[patchi];
166 fieldBoundary[patchi].patch().faceCells();
170 minId = minMaxIds.
first();
171 if (minVs[proci] > fp[minId])
173 minVs[proci] = fp[minId];
174 minCells[proci] = faceCells[minId];
175 minCs[proci] = Cfp[minId];
178 maxId = minMaxIds.
second();
179 if (maxVs[proci] < fp[maxId])
181 maxVs[proci] = fp[maxId];
182 maxCells[proci] = faceCells[maxId];
183 maxCs[proci] = Cfp[maxId];
198 const Type&
minValue = minVs[minId];
199 const label minCell = minCells[minId];
200 const vector& minC = minCs[minId];
203 const Type&
maxValue = maxVs[maxId];
204 const label maxCell = maxCells[maxId];
205 const vector& maxC = maxCs[maxId];
226 const word& fieldName,
232 if (obr_.foundObject<fieldType>(fieldName))
234 const fieldType&
field = lookupObject<fieldType>(fieldName);
240 calcMinMaxFieldType<scalar>
243 word(
"mag(" + fieldName +
")")
249 calcMinMaxFieldType(
field, fieldName);
255 <<
"Unknown min/max mode: " << modeTypeNames_[mode_]
label findMax(const ListType &input, label start=0)
Linear search for the index of the max element, similar to std::max_element but for lists and returns...
const T & first() const noexcept
Access the first element.
virtual OFstream & file()
Return access to the file (if only 1)
labelPair findMinMax(const ListType &input, label start=0)
Linear search for the index of the min/max element, similar to std::minmax_element but for lists and ...
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
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.
Output to file stream as an OSstream, normally using std::ofstream for the actual output...
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
A traits class, which is primarily used for primitives and vector-space.
static bool & parRun() noexcept
Test if this a parallel run.
void setResult(const word &entryName, const Type &value)
Add result.
Generic GeometricField class.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Can be negative if the process i...
#define forAll(list, i)
Loop across all elements in list.
void calcMinMaxFields(const word &fieldName, const modeType &mode)
Calculate the field min/max.
label findMin(const ListType &input, label start=0)
Linear search for the index of the min element, similar to std::min_element but for lists and returns...
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run. ...
word outputName("finiteArea-edges.obj")
A class for handling words, derived from Foam::string.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
bool location_
Flag to write location of min/max values.
virtual void writeCurrentTime(Ostream &os) const
Write the current time to stream.
void output(const word &fieldName, const word &outputName, const label minCell, const label maxCell, const vector &minC, const vector &maxC, const label minProci, const label maxProci, const Type &minValue, const Type &maxValue)
Helper function to write the output.
static void allGatherList(UList< T > &values, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Gather data, but keep individual values separate. Uses MPI_Allgather or manual linear/tree communicat...
static Ostream & output(Ostream &os, const IntRange< T > &range)
Field< vector > vectorField
Specialisation of Field<T> for vector.
void calcMinMaxFieldType(const GeometricField< Type, fvPatchField, volMesh > &field, const word &outputFieldName)
Calculate the field min/max for a given field type.
List< label > labelList
A List of labels.
const T & second() const noexcept
Access the second element.
mode_t mode(const fileName &name, const bool followLink=true)
Return the file mode, normally following symbolic links.
static constexpr const zero Zero
Global zero (0)
virtual void writeTabbed(Ostream &os, const string &str) const
Write a tabbed string to stream.