44 namespace functionObjects
88 mesh.globalData().nTotalCells()
93 mesh.globalData().nTotalFaces()
103 mesh.globalData().nTotalPoints()
107 "OF_MESH_NINTERNALFACES",
112 "OF_MESH_NBOUNDARYFACES",
119 mesh.boundaryMesh().nNonProcessor()
123 "OF_MESH_BOUNDS_MIN",
128 "OF_MESH_BOUNDS_MAX",
153 Info<<
" Reading template from " << fName <<
endl;
160 <<
"Unable to open file " << fName <<
endl;
179 if (modelKeys_.insert(
key, nullValue))
185 if (substitutions_[i].valid(
key))
195 modelKeys_[
key].first() = modeli;
198 DynamicList<label>& lineNos = modelKeys_[
key].second();
199 lineNos.push_back(lineNo);
207 templateContents_.transfer(contents);
209 return templateContents_.size() > 0;
220 const label modeli = iter.val().first();
225 for (
const label linei : lineNos)
232 <<
"Unable to find substitution for " <<
key 233 <<
" on line " << linei <<
endl;
238 substitutions_[modeli].apply(
key, out[linei]);
243 for (
const auto&
line : out)
266 debugKeys_(
dict.getOrDefault<bool>(
"debugKeys", false))
282 dict.readEntry(
"template", templateFile_);
284 Info<<
" Template: " << templateFile_ <<
endl;
286 const word ext = templateFile_.
ext();
297 Info<<
" Reading substitutions" <<
endl;
301 substitutions_.resize(subsDict.size());
304 for (
const entry&
e : subsDict)
309 <<
"Substitution models must be provided in dictionary " 317 parseTemplate(templateFile_.expand());
330 for (
auto& sub : substitutions_)
343 setDynamicBuiltins();
345 auto filePtr = newFileAtTime(
name(), time().value());
356 os <<
"Model keys:" <<
nl;
357 for (
const auto& model : substitutions_)
359 os << model.type() <<
":" << model.keys() <<
nl;
362 os <<
"Builtins:" <<
nl;
static bool replaceBuiltin(const word &key, string &str)
Replace key in string.
bool parseTemplate(const fileName &fName)
Parse the template and collect keyword information.
defineTypeNameAndDebug(ObukhovLength, 0)
A class for handling file names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
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.
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
static autoPtr< substitutionModel > New(const dictionary &dict, const Time &time)
Return a reference to the selected substitution model.
UPtrList< const Type > csorted() const
Return sorted list of objects with a class satisfying isA<Type> or isType<Type> (with Strict) ...
constexpr char nl
The newline '\n' character (0x0a)
static void setBuiltin(const word &key, const Type &value)
Set a builtin to the hash table.
static void apply(bitSet &selection, const Detail::parcelSelection::actionType action, const Predicate &accept, const UList< Type > &list, const AccessOp &aop)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool & parRun() noexcept
Test if this a parallel run.
static void setBuiltinStr(const word &key, const string &value)
Set a builtin to the hash table.
Abstract base-class for Time/database function objects.
static std::string date()
The current wall-clock date as a string formatted as (MON dd yyyy), where MON is Jan, Feb, etc.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
virtual bool read(const dictionary &)
Read foamReport settings.
Macros for easy insertion into run-time selection tables.
virtual bool execute()
Execute foamReport.
static void addBuiltinStr(const word &key, const string &value)
Add a builtin to the hash table - does not overwrite.
#define forAll(list, i)
Loop across all elements in list.
void setStaticBuiltins()
Set static builtin entries.
word ext() const
Return file name extension (part after last .)
autoPtr< OFstream > filePtr
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run. ...
const dimensionedScalar e
Elementary charge.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
A class for handling words, derived from Foam::string.
label size() const noexcept
The number of entries in the list.
Foam::PtrList< Foam::fvMesh > meshes(regionNames.size())
bool apply(Ostream &os) const
Apply the substitution models to the template.
T returnReduce(const T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
static std::string clockTime()
The current wall-clock (in local time) as a string formatted as as (hh:mm:ss).
auto key(const Type &t) -> std::enable_if_t< std::is_enum_v< Type >, std::underlying_type_t< Type > >
string hostName()
Return the system's host name, as per hostname(1)
const int api
OpenFOAM api number (integer) corresponding to the value of OPENFOAM at the time of compilation...
void setDynamicBuiltins()
Set dynamic (potentially changing per execution step) builtin entries.
#define DebugInfo
Report an information message using Foam::Info.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
OBJstream os(runTime.globalPath()/outputName)
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
Input from file stream as an ISstream, normally using std::ifstream for the actual input...
void push_back(const T &val)
Copy append an element to the end of this list.
virtual bool write()
Write foamReport results.
static word envExecutable()
Name of the executable from environment variable.
const std::string buildArch
OpenFOAM build architecture information (machine endian, label/scalar sizes) as a std::string...
const std::string version
OpenFOAM version (name or stringified number) as a std::string.
static void writeBuiltins(Ostream &os)
Write all builtins to stream.
static fileName envGlobalPath()
Global case (directory) from environment variable.
static wordList getKeys(string &buffer)
Return all keys from a string buffer.
#define WarningInFunction
Report a warning using Foam::Warning.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
virtual bool read(const dictionary &dict)
Read and set the function object if its data have changed.
Mesh data needed to do the Finite Volume discretisation.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
const std::string patch
OpenFOAM patch number as a std::string.
Replaces user-supplied keywords by run-time computed values in a text file.
Base class for function objects, adding functionality to read/write state information (data required ...
messageStream Info
Information stream (stdout output on master, null elsewhere)
static void addBuiltin(const word &key, const Type &value)
Add a builtin to the hash table - does not overwrite.
const Time & time() const
Return time database.
const std::string build
OpenFOAM build information as a std::string.
foamReport(const foamReport &)=delete
No copy construct.
Base class for writing single files from the function objects.
forAllConstIters(mixture.phases(), phase)
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
const Time & time_
Reference to the time database.