37 namespace histogramModels
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];
void write(scalarField &dataNormalised, const labelField &dataCount, const scalarField &magMidBin)
Write histogram data.
Field< label > labelField
Specialisation of Field<T> for label.
defineTypeNameAndDebug(equalBinWidth, 0)
Histogram model which groups data into bins of equal width.
addToRunTimeSelectionTable(histogramModel, equalBinWidth, dictionary)
dimensionedScalar log(const dimensionedScalar &ds)
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
virtual bool read(const dictionary &dict)
Read top-level dictionary.
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.
virtual bool read(const dictionary &dict)
Read top-level dictionary.
equalBinWidth(const word &name, const fvMesh &mesh, const dictionary &dict)
Construct from components.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
void reset()
Reset to an inverted (invalid) range.
vectorField pointField
pointField is a vectorField.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
A base class for histogram models.
virtual bool write(const bool log)
Write data to stream and files.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
errorManip< error > abort(error &err)
vector point
Point is a vector.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Mesh data needed to do the Finite Volume discretisation.
volScalarField & getOrReadField(const word &fieldName) const
Return requested field from the object registry or read+register the field to the object registry...
messageStream Info
Information stream (stdout output on master, null elsewhere)
static void listCombineGather(const List< commsStruct > &comms, List< T > &values, const CombineOp &cop, const int tag, const label comm)
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)