43 namespace functionObjects
88 "OF_MESH_NINTERNALFACES",
93 "OF_MESH_NBOUNDARYFACES",
99 mesh.boundaryMesh().nNonProcessor()
103 "OF_MESH_BOUNDS_MIN",
108 "OF_MESH_BOUNDS_MAX",
133 Info<<
" Reading template from " << fName <<
endl;
140 <<
"Unable to open file " << fName <<
endl;
159 if (modelKeys_.insert(
key, nullValue))
165 if (substitutions_[i].valid(
key))
175 modelKeys_[
key].first() = modeli;
178 DynamicList<label>& lineNos = modelKeys_[
key].second();
179 lineNos.push_back(lineNo);
187 templateContents_.transfer(contents);
189 return templateContents_.size() > 0;
200 const label modeli = iter.val().first();
205 for (
const label linei : lineNos)
212 <<
"Unable to find substitution for " <<
key 213 <<
" on line " << linei <<
endl;
218 substitutions_[modeli].apply(
key, out[linei]);
223 for (
const auto&
line : out)
246 debugKeys_(
dict.getOrDefault<bool>(
"debugKeys", false))
262 dict.readEntry(
"template", templateFile_);
264 Info<<
" Template: " << templateFile_ <<
endl;
266 const word ext = templateFile_.
ext();
277 Info<<
" Reading substitutions" <<
endl;
281 substitutions_.resize(subsDict.size());
284 for (
const entry&
e : subsDict)
289 <<
"Substitution models must be provided in dictionary " 297 parseTemplate(templateFile_.expand());
310 for (
auto& sub : substitutions_)
323 setDynamicBuiltins();
325 auto filePtr = newFileAtTime(
name(), time().value());
336 os <<
"Model keys:" <<
nl;
337 for (
const auto& model : substitutions_)
339 os << model.type() <<
":" << model.keys() <<
nl;
342 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.
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.
HashTable< const Type * > lookupClass() const
Return all objects with a class satisfying isA<Type> or isType<Type> (with Strict) ...
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.
static std::string clockTime()
The current wall-clock (in local time) as a string formatted as as (hh:mm:ss).
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.
iterator begin()
Return iterator to begin traversal of non-nullptr entries.
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.
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
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.