34 namespace functionObjects
44 void Foam::functionObjects::histogram::writeGraph
46 const coordSet& coords,
47 const word& fieldName,
53 fileName outputPath = 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);
71 Foam::functionObjects::histogram::histogram
80 if (!isA<fvMesh>(obr_))
100 dict.
lookup(
"field") >> fieldName_;
101 dict.
lookup(
"max") >> max_;
103 dict.
lookup(
"nBins") >> nBins_;
122 const fvMesh&
mesh = refCast<const fvMesh>(obr_);
127 Log <<
" Looking up field " << fieldName_ <<
endl;
131 Log <<
" Reading field " << fieldName_ <<
endl;
158 const scalar
delta = (max_- min_)/nBins_;
160 scalar
x = min_ + 0.5*
delta;
163 xBin[i] =
point(x, 0, 0);
172 const label bini = (field[celli] - min_)/delta;
173 if (bini >= 0 && bini < nBins_)
175 volFrac[bini] += V[celli];
183 const scalar sumVol =
sum(volFrac);
197 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.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
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 word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
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.
Holds list of sampling positions.
A class for handling words, derived from string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
static autoPtr< writer > New(const word &writeFormat)
Return a reference to the selected writer.
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.
List< word > wordList
A List of words.
vector point
Point is a vector.
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
addToRunTimeSelectionTable(functionObject, blendingFactor, dictionary)
Mesh data needed to do the Finite Volume discretisation.
const DimensionedField< scalar, volMesh > & V() const
Return cell volumes.
#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...
defineTypeNameAndDebug(fvMeshFunctionObject, 0)
functionObject base class for writing single files
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
const word & name() const
Return name.
const Time & time() const
Return the top-level database.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.