34 namespace functionObjects
44 void Foam::functionObjects::histogram::writeGraph
46 const coordSet& coords,
47 const word& fieldName,
53 fileName outputPath = file_.baseTimeDir();
57 outputPath/formatterPtr_().getFileName(coords,
fieldNames)
60 Log <<
" Writing histogram of " << fieldName
61 <<
" to " << graphFile.name() <<
endl;
63 List<const scalarField*> yPtrs(1);
65 formatterPtr_().write(coords,
fieldNames, yPtrs, graphFile);
95 dict.
lookup(
"field") >> fieldName_;
96 dict.
lookup(
"max") >> max_;
98 dict.
lookup(
"nBins") >> nBins_;
120 Log <<
" Looking up field " << fieldName_ <<
endl;
124 Log <<
" Reading field " << fieldName_ <<
endl;
132 mesh_.time().timeName(),
151 const scalar
delta = (max_- min_)/nBins_;
153 scalar
x = min_ + 0.5*
delta;
156 xBin[i] =
point(x, 0, 0);
165 const label bini = (field[celli] - min_)/delta;
166 if (bini >= 0 && bini < nBins_)
168 volFrac[bini] += V[celli];
176 const scalar sumVol =
sum(volFrac);
190 writeGraph(coords, field.
name(), volFrac);
#define forAll(list, i)
Loop across all elements in list.
virtual bool write()
Calculate the histogram and write.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const word & name() const
Return name.
void reset(T *=nullptr)
If object pointer already set, delete object and set to given.
A list of keyword definitions, which are a keyword followed by any number of values (e...
addToRunTimeSelectionTable(functionObject, Qdot, dictionary)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool master(const label communicator=0)
Am I the master process.
word format(conversionProperties.lookup("format"))
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
virtual bool execute()
Execute, currently does nothing.
Macros for easy insertion into run-time selection tables.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
static List< word > fieldNames
bool read(const char *, int32_t &)
virtual bool read(const dictionary &)
Read the histogram data.
histogram(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Holds list of sampling positions.
A class for handling words, derived from string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set)
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
word name(const complex &)
Return a string representation of a complex.
defineTypeNameAndDebug(Qdot, 0)
static autoPtr< setWriter > New(const word &writeFormat)
Return a reference to the selected setWriter.
List< word > wordList
A List of words.
vector point
Point is a vector.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
#define Log
Report write to Foam::Info if the local log switch is true.
dimensioned< scalar > mag(const dimensioned< Type > &)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Specialisation of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.