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;
177 for (
const word& key : keys)
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);
219 const word& key = iter.key();
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;
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
label size() const noexcept
The number of elements in list.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void push_back(const T &val)
Copy append an element to the end of this list.
Input from file stream as an ISstream, normally using std::ifstream for the actual input.
bool good() const noexcept
True if next operation might succeed.
ISstream & getLine(std::string &str, char delim='\n')
Raw, low-level getline (until delimiter) into a string.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
static bool parRun(const bool on) noexcept
Set as parallel run on/off.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run.
static fileName envGlobalPath()
Global case (directory) from environment variable.
static word envExecutable()
Name of the executable from environment variable.
static std::string date()
The current wall-clock date as a string formatted as (MON dd yyyy), where MON is Jan,...
static std::string clockTime()
The current wall-clock (in local time) as a string formatted as as (hh:mm:ss).
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A keyword and a list of tokens is an 'entry'.
A class for handling file names.
Abstract base-class for Time/database function objects.
const word & name() const noexcept
Return the name of this functionObject.
virtual bool read(const dictionary &dict)
Read and set the function object if its data have changed.
functionObject(const word &name, const bool withNamePrefix=defaultUseNamePrefix)
Construct from components.
Replaces user-supplied keywords by run-time computed values in a text file.
void setStaticBuiltins()
Set static builtin entries.
HashTable< Tuple2< label, DynamicList< label > > > modelKeys_
Mapping from keyword to substitution model index and line numbers of template file where keyword is u...
PtrList< substitutionModel > substitutions_
List of substitution models.
void setDynamicBuiltins()
Set dynamic (potentially changing per execution step) builtin entries.
bool debugKeys_
Debug flag to write all known keys.
foamReport(const foamReport &)=delete
No copy construct.
List< string > templateContents_
Template file contents split into lines.
bool parseTemplate(const fileName &fName)
Parse the template and collect keyword information.
fileName templateFile_
Path to user-supplied template.
bool apply(Ostream &os) const
Apply the substitution models to the template.
virtual bool execute()
Execute the function-object operations.
virtual bool write()
Write the function-object results.
virtual bool read(const dictionary &)
Read the function-object dictionary.
Base class for function objects, adding functionality to read/write state information (data required ...
stateFunctionObject(const stateFunctionObject &)=delete
No copy construct.
const Time & time_
Reference to the time database.
const Time & time() const
Return time database.
Base class for writing single files from the function objects.
writeFile(const objectRegistry &obr, const fileName &prefix, const word &name="undefined", const bool writeToFile=true, const string &ext=".dat")
Construct from objectRegistry, prefix, fileName.
virtual autoPtr< OFstream > newFileAtTime(const word &name, scalar timeValue) const
Return autoPtr to a new file for a given time.
virtual const string & setExt(const string &ext)
Set extension.
Mesh data needed to do the Finite Volume discretisation.
UPtrList< const Type > csorted() const
Return sorted list of objects with a class satisfying isA<Type> or isType<Type> (with Strict).
static wordList getKeys(string &buffer)
Return all keys from a string buffer.
static void addBuiltin(const word &key, const Type &value)
Add a builtin to the hash table - does not overwrite.
static void setBuiltin(const word &key, const Type &value)
Set a builtin to the hash table.
static void writeBuiltins(Ostream &os)
Write all builtins to stream.
static autoPtr< substitutionModel > New(const dictionary &dict, const Time &time)
Return a reference to the selected substitution model.
static void setBuiltinStr(const word &key, const string &value)
Set a builtin to the hash table.
static bool replaceBuiltin(const word &key, string &str)
Replace key in string.
static void addBuiltinStr(const word &key, const string &value)
Add a builtin to the hash table - does not overwrite.
A class for handling words, derived from Foam::string.
word ext() const
Return file name extension (part after last .).
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Foam::PtrList< Foam::fvMesh > meshes(regionNames.size())
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
#define DebugInfo
Report an information message using Foam::Info.
#define WarningInFunction
Report a warning using Foam::Warning.
const std::string patch
OpenFOAM patch number as a std::string.
const std::string build
OpenFOAM build information as a std::string.
const int api
OpenFOAM api number (integer) corresponding to the value of OPENFOAM at the time of compilation.
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.
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
constexpr auto key(const Type &t) noexcept
Helper function to return the enum value.
List< word > wordList
List of word.
messageStream Info
Information stream (stdout output on master, null elsewhere).
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
static void apply(bitSet &selection, const Detail::parcelSelection::actionType action, const Predicate &accept, const UList< Type > &list, const AccessOp &aop)
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.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Ostream & endl(Ostream &os)
Add newline and flush stream.
string hostName()
Return the system's host name, as per hostname(1).
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.
autoPtr< OFstream > filePtr