73 dict.getOrDefault<scalar>(
"min", GREAT),
74 dict.getOrDefault<scalar>(
"max", -GREAT)
77 nBins_ =
dict.get<scalar>(
"nBins");
82 <<
"Number of histogram bins = " << nBins_
83 <<
" cannot be negative or zero."
101 if (histRange.max() == -GREAT)
103 histRange.max() =
max(
field).value();
105 if (histRange.min() == GREAT)
107 histRange.min() =
min(
field).value();
112 Info<<
" Determined histogram bounds from field"
113 <<
" min/max(" << fieldName() <<
") = "
114 << histRange <<
endl;
117 else if (histRange.min() == GREAT)
119 histRange.min() =
Zero;
122 if (!histRange.good())
125 <<
"Invalid histogram range: " << histRange
132 const scalar
delta = histRange.span()/nBins_;
135 scalar
x = histRange.min() + 0.5*
delta;
136 for (
point&
p : binMidPoints)
151 const label bini = (
field[celli] - histRange.min())/
delta;
152 if (bini >= 0 && bini < nBins_)
154 dataNormalised[bini] +=
V[celli];
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
const T & max() const noexcept
The max value.
const T & min() const noexcept
The min value.
bool good() const
Range is non-inverted.
void reset()
Reset to an inverted (invalid) range.
T span() const
The min to max span. Zero for invalid range.
static void listGather(UList< T > &values, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Gather (reduce) list elements, applying bop to each list element.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Mesh data needed to do the Finite Volume discretisation.
A base class for histogram models.
const fvMesh & mesh() const noexcept
Return const reference to the mesh.
volScalarField & getOrReadField(const word &fieldName) const
Return requested field from the object registry or read+register the field to the object registry.
void write(scalarField &dataNormalised, const labelField &dataCount, const scalarField &magMidBin)
Write histogram data.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
const word & fieldName() const noexcept
Return const reference to the operand field name.
histogramModel(const word &name, const fvMesh &mesh, const dictionary &dict)
Construct from components.
Histogram model which groups data into bins of equal width.
equalBinWidth(const word &name, const fvMesh &mesh, const dictionary &dict)
Construct from components.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
virtual bool write(const bool log)
Write data to stream and files.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const expr V(m.psi().mesh().V())
A namespace for various histogram model implementations.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
messageStream Info
Information stream (stdout output on master, null elsewhere).
MinMax< scalar > scalarMinMax
A scalar min/max range.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensionedScalar log(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
errorManip< error > abort(error &err)
Field< label > labelField
Specialisation of Field<T> for label.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
vector point
Point is a 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...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
vectorField pointField
pointField is a vectorField.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define forAll(list, i)
Loop across all elements in list.