Go to the documentation of this file.
57 int main(
int argc,
char *argv[])
68 "Alternative dictionary for setExprBoundaryFieldsDict"
74 "Cache fields between calls",
80 "Preserve sub-entry as .backup",
87 "Evaluate but do not write"
93 const bool dryrun =
args.
found(
"dry-run");
95 const bool cacheFields =
args.
found(
"cache-fields");
100 <<
"The current cache-fields behaviour (caching disk reads) "
101 <<
"may lead to unexpected behaviour as previous modifications "
102 <<
"will not be visible."
112 if (times.size() < 1)
131 for (
const entry& dEntry : setExprDict)
133 if (!dEntry.isDict())
135 Info<<
"Ignoring non-dictionary entry "
136 << dEntry.keyword() <<
nl;
147 if (exprDicts.empty())
149 Info<<
"No expressions for " << fieldName <<
nl;
156 const word oldTypeName = IOdictionary::typeName;
174 const_cast<word&
>(IOdictionary::typeName) = oldTypeName;
177 <<
"Requested field to change " << fieldName
178 <<
" does not exist in " << fieldHeader.path() <<
endl;
185 const_cast<word&
>(IOdictionary::typeName) = oldTypeName;
188 const_cast<word&
>(fieldDict.type()) = fieldDict.headerClassName();
190 Info<<
"Processing field " << fieldName <<
nl;
196 const word targetName = currDict.get<
word>(
"target");
197 const word patchName = currDict.get<
word>(
"patch");
203 currDict.get<
string>(
"expression"),
208 Info<<
"Set boundaryField/" << patchName <<
'/'
210 <<
"with expression" <<
nl
212 << expr.c_str() <<
nl
218 driver.setSearchBehaviour(cacheFields,
false,
true);
220 driver.clearVariables();
227 if (backup && !dryrun)
229 patchDict.changeKeyword
232 word(targetName +
".backup"),
237 patchDict.set(targetName, serialize.
str().c_str());
243 << serialize.
str().c_str()
250 Info<<
"Write " << fieldDict.filePath() <<
nl;
251 fieldDict.regIOobject::write();
A keyword and a list of tokens is an 'entry'.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A class for handling words, derived from Foam::string.
virtual const objectRegistry & thisDb() const
Return the object registry - resolve conflict polyMesh/lduMesh.
bool typeHeaderOk(const bool checkType=true, const bool search=true, const bool verbose=true)
Read header (uses typeFilePath to find file) and check its info.
const Time & time() const
Return time.
static word timeName(const scalar t, const int precision=precision_)
const word dictName("blockMeshDict")
Ostream & endl(Ostream &os)
Add newline and flush stream.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
#define forAll(list, i)
Loop across all elements in list.
virtual readUpdateState readUpdate()
Update the mesh based on the mesh files saved in time.
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
messageStream Info
Information stream (uses stdout - output is on the master only)
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Driver for patch expressions.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Foam::string str() const
Get the string - as Foam::string rather than std::string.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static void addOptions(const bool constant=true, const bool withZero=false)
Add timeSelector options to argList::validOptions.
Output to string buffer, using a OSstream.
virtual void setTime(const Time &t)
Reset the time and time-index to those of the given time.
static const word null
An empty word.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
static instantList select0(Time &runTime, const argList &args)
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
Foam::argList args(argc, argv)
#define WarningInFunction
Report a warning using Foam::Warning.
bool found(const word &optName) const
Return true if the named option is found.