49 vector geomMin(GREAT, GREAT, GREAT);
50 vector geomMax(-GREAT, -GREAT, -GREAT);
57 for (
direction i = 0; i < vector::nComponents; ++i)
59 geomMin[i] =
min(
min(ppcs.component(i)), geomMin[i]);
60 geomMax[i] =
max(
max(ppcs.component(i)), geomMax[i]);
72 for (
direction i = 0; i < vector::nComponents; ++i)
74 geomMin[i] =
min(
min(d.component(i)), geomMin[i]);
75 geomMax[i] =
max(
max(d.component(i)), geomMax[i]);
79 reduce(geomMin, minOp<vector>());
80 reduce(geomMax, maxOp<vector>());
82 for (
direction i = 0; i < vector::nComponents; ++i)
85 geomMax[i] = 1.0001*(geomMax[i] - geomMin[i]) + geomMin[i];
94 <<
"Max bounds must be greater than min bounds" <<
nl 95 <<
" direction = " << i <<
nl 107 <<
"Bin widths must be greater than zero" <<
nl 108 <<
" direction = " << i <<
nl 111 <<
" bin width = " <<
binW_[i]
127 bool faceInside =
true;
128 for (
direction j = 0; j < vector::nComponents; ++j)
130 if (d[i][j] < binMinMax_[j][0] || d[i][j] > binMinMax_[j][1])
140 Vector<label>
n(
Zero);
141 for (
direction j = 0; j < vector::nComponents; ++j)
143 n[j] = floor((d[i][j] - binMinMax_[j][0])/binW_[j]);
144 n[j] =
min(
max(
n[j], 0), nBins_[j] - 1);
148 binIndices[i] =
n[0] + nBins_[0]*
n[1] + nBins_[0]*nBins_[1]*
n[2];
162 faceToBin_.setSize(mesh_.nBoundaryFaces());
167 const polyPatch&
pp = mesh_.boundaryMesh()[iter()];
168 const label i0 =
pp.start() - mesh_.nInternalFaces();
171 binAddr(coordSysPtr_->localPosition(
pp.faceCentres()));
174 cellToBin_.setSize(mesh_.nCells());
177 for (
const label zonei : cellZoneIDs_)
179 const cellZone& cZone = mesh_.cellZones()[zonei];
182 binAddr(coordSysPtr_->localPosition(
vectorField(mesh_.C(), cZone)))
187 const label celli = cZone[i];
188 cellToBin_[celli] = bins[i];
200 const word& outputPrefix
226 Info<<
" Activating a set of uniform bins" <<
endl;
232 for (
const label
n : nBins_)
240 <<
"Number of bins must be greater than zero" <<
nl 241 <<
" e1 bins = " << nBins_[0] <<
nl 242 <<
" e2 bins = " << nBins_[1] <<
nl 243 <<
" e3 bins = " << nBins_[2]
247 Info<<
" - Employing:" <<
nl 248 <<
" " << nBins_[0] <<
" e1 bins," <<
nl 249 <<
" " << nBins_[1] <<
" e2 bins," <<
nl 250 <<
" " << nBins_[2] <<
" e3 bins" 253 cumulative_ = binDict.
getOrDefault<
bool>(
"cumulative",
false);
254 Info<<
" - cumulative : " << cumulative_ <<
endl;
255 Info<<
" - decomposePatchValues : " << decomposePatchValues_ <<
endl;
257 if (binDict.
found(
"minMax"))
259 const dictionary& minMaxDict = binDict.
subDict(
"minMax");
261 for (
direction i = 0; i < vector::nComponents; ++i)
265 if (minMaxDict.readIfPresent(ei, binMinMax_[i]))
267 Info<<
" - " << ei <<
" min : " 268 << binMinMax_[i][0] <<
nl 269 <<
" - " << ei <<
" max : " 270 << binMinMax_[i][1] <<
endl;
287 processField<scalar>(i)
288 || processField<vector>(i)
289 || processField<sphericalTensor>(i)
290 || processField<symmTensor>(i)
291 || processField<tensor>(i);
296 <<
"Unable to find field " << fieldNames_[i]
301 writtenHeader_ =
true;
const polyBoundaryMesh & pbm
void size(const label n)
Older name for setAddressableSize.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const fvMesh & mesh_
Reference to the mesh.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
labelHashSet patchSet_
Indices of operand patches.
defineTypeNameAndDebug(singleDirectionUniformBin, 0)
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Macros for easy insertion into run-time selection tables.
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
#define forAll(list, i)
Loop across all elements in list.
Base class for bin models to handle general bin characteristics.
A List obtained as a section of another List.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
A class for handling words, derived from Foam::string.
#define forAllIters(container, iter)
Iterate across all elements in the container object.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO...
autoPtr< coordinateSystem > coordSysPtr_
Local coordinate system of bins.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
addToRunTimeSelectionTable(binModel, singleDirectionUniformBin, dictionary)
#define WarningInFunction
Report a warning using Foam::Warning.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Mesh data needed to do the Finite Volume discretisation.
virtual bool read(const dictionary &dict)
Read the dictionary.
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
Reduce inplace (cf. MPI Allreduce) using specified communication schedule.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Field< vector > vectorField
Specialisation of Field<T> for vector.
Mesh consisting of general polyhedral cells.
const volVectorField & C() const
Return cell centres as volVectorField.
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
labelList cellZoneIDs_
Indices of operand cell zones.
A patch is a list of labels that address the faces in the global face list.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
static constexpr const zero Zero
Global zero (0)