39 namespace functionEntries
58 Foam::functionEntries::includeEntry::insertNamedArgs
60 dictionary& contextDict,
61 const Tuple2<string, label>& fNameArgs
67 if (fNameArgs.first().size())
79 dictionary& subDict(contextDict.scopedDict(dAk.first()));
82 if (subDict.found(dAk.second()))
84 keyType tmpName(dAk.second());
86 subDict.changeKeyword(dAk.second(), tmpName);
90 IStringStream entryStream
110 void Foam::functionEntries::includeEntry::removeInsertNamedArgs
112 dictionary& contextDict,
113 const List<Tuple3<word, string, label>>& namedArgs
119 contextDict.remove(namedArgs[i].
first());
123 dictionary& subDict(contextDict.scopedDict(dAk.first()));
124 keyType tmpName(dAk.second());
126 subDict.changeKeyword(tmpName, dAk.second());
167 includeFileName(is.
name().
path(), this->fName(), contextDict)
172 if (includeIfPresent())
181 ) <<
"Cannot find include file " << fName
182 <<
" while reading dictionary " << contextDict.
name()
204 contextEntry.
read(contextDict, ifs);
211 ) <<
"Cannot open include file "
212 << (ifs.
name().size() ? ifs.
name() : this->fName())
213 <<
" while reading dictionary " << contextDict.
name()
219 removeInsertNamedArgs(
const_cast<dictionary&
>(contextDict), namedArgs);
230 const label lineNumber,
241 readFileNameArgList(functionType, is)
248 const label lineNumber,
267 includeFileName(is.
name().
path(), this->fName(), contextDict)
272 if (includeIfPresent())
281 ) <<
"Cannot find include file " << fName
282 <<
" while reading dictionary " << contextDict.
name()
291 insertNamedArgs(contextDict,
args())
315 contextDict.
read(ifs);
318 if (foamFileDict.size() != 0)
323 contextDict += contextDictTmp;
331 ) <<
"Cannot open include file "
332 << (ifs.
name().size() ? ifs.
name() : this->fName())
333 <<
" while reading dictionary " << contextDict.
name()
339 removeInsertNamedArgs(contextDict, namedArgs);
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into member function selection tables.
Macros for easy insertion into run-time selection tables.
static constexpr const char * foamFile
Keyword for the FoamFile header sub-dictionary.
label lineNumber() const
Return current stream line number.
streamFormat format() const
Return current stream format.
virtual const fileName & name() const
Return the name of the stream.
versionNumber version() const
Return the stream version.
virtual const fileName & name() const
Return the name of the stream.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
T & first()
Return the first element of the list.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
const fileName & name() const
Return the dictionary name.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
bool read(Istream &, const bool keepHeader=false)
Read dictionary from Istream, optionally keeping the header.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
bool add(entry *, bool mergeEntry=false)
Add a new entry.
void clear()
Clear the dictionary.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
static bool New(dictionary &parentDict, Istream &)
Construct from Istream and insert into dictionary.
A class for handling file names.
bool isAbsolute() const
Return true if file name is absolute.
fileName path() const
Return directory path name (part before last /)
Specify an include file when reading dictionaries.
virtual bool virtualExecute(const dictionary &contextDict, primitiveEntry &contextEntry, Istream &)
Expand the functionEntry into the contextEntry.
includeEntry(const functionName &functionType, const label lineNumber, const dictionary &parentDict, Istream &is)
Construct from functionType, dictionary and Istream.
virtual fileName includeFileName(const fileName &dir, const fileName &, const dictionary &) const
Expand include fileName and return.
Tuple2< string, label > args() const
Return the arguments string for processing by insertNamedArgs.
virtual bool execute(dictionary &contextDict, Istream &)
Expand the functionEntry into the contextDict.
static bool log
Report which file is included to stdout.
A functionEntry causes entries to be added/manipulated on the specified dictionary given an input str...
A functionName is a word starting with '#'.
Motion of the mesh specified as a list of pointMeshMovers.
A keyword and a list of tokens is a 'primitiveEntry'. An primitiveEntry can be read,...
virtual bool read(const dictionary &, Istream &)
Read tokens from the given stream.
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
defineFunctionTypeNameAndDebug(includeFvConstraintEntry, 0)
addToMemberFunctionSelectionTable(functionEntry, calcEntry, execute, primitiveEntryIstream)
addToRunTimeSelectionTable(functionEntry, includeFvConstraintEntry, dictionary)
string & inplaceExpandEntry(string &s, const dictionary &dict, const bool allowEnvVars, const bool allowEmpty, const char sigil='$')
Inplace expand occurrences of variables according to the dictionary.
const fileOperation & fileHandler()
Get current file handler.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void dictArgList(const Tuple2< string, label > &argString, word &configName, List< Tuple2< wordRe, label >> &args, List< Tuple3< word, string, label >> &namedArgs)
Parse dictionary substitution argument list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool exists(const fileName &, const bool checkVariants=true, const bool followLink=true)
Does the name exist (as directory or file) in the file system?
labelList second(const UList< labelPair > &p)
labelList first(const UList< labelPair > &p)
Pair< word > dictAndKeyword(const word &scopedName)
Extracts dict name and keyword.
string expandArg(const string &arg, dictionary &dict, const label lineNumber)
Expand arg within the dict context and return.
Foam::argList args(argc, argv)