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);
111 this->
setResult(
"max" + nameStr +
"_position", maxC);
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_]
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Generic GeometricField class.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
const T & first() const noexcept
Access the first element.
const T & second() const noexcept
Access the second element.
static void allGatherList(UList< T > &values, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Gather data, but keep individual values separate. Uses MPI_Allgather or manual communication.
void size(const label n)
Older name for setAddressableSize.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
static bool parRun(const bool on) noexcept
Set as parallel run on/off.
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run.
Smooth ATC in cells next to a set of patches supplied by type.
bool location_
Flag to write location of min/max values.
modeType mode_
Mode for min/max - only applicable for ranks > 0.
void calcMinMaxFields(const word &fieldName, const modeType &mode)
Calculate the field min/max.
void calcMinMaxFieldType(const GeometricField< Type, fvPatchField, volMesh > &field, const word &outputFieldName)
Calculate the field min/max for a given field type.
static const Enum< modeType > modeTypeNames_
Mode type names.
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.
modeType
Options for the mode types.
const fvMesh & mesh_
Reference to the fvMesh.
const ObjectType & lookupObject(const word &fieldName) const
Lookup and return object (eg, a field) from the (sub) objectRegistry.
const objectRegistry & obr_
Reference to the region objectRegistry.
void setResult(const word &entryName, const Type &value)
Add result.
virtual void writeTabbed(Ostream &os, const string &str) const
Write a tabbed string to stream.
virtual OFstream & file()
Return access to the file (if only 1).
virtual void writeCurrentTime(Ostream &os) const
Write the current time to stream.
A traits class, which is primarily used for primitives and vector-space.
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
word outputName("finiteArea-edges.obj")
Pair< label > labelPair
A pair of labels.
List< label > labelList
A List of labels.
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...
mode_t mode(const fileName &name, const bool followLink=true)
Return the file mode, normally following symbolic links.
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 ...
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Field< vector > vectorField
Specialisation of Field<T> for vector.
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
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...
errorManipArg< error, int > exit(error &err, const int errNo=1)
UList< label > labelUList
A UList of labels.
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.