33 void Foam::primitiveEntry::append(
const UList<token>& varTokens)
42 bool Foam::primitiveEntry::expandVariable
45 const dictionary& dict
51 string s(w(2, w.size() - 3));
57 newW.std::string::replace(1, newW.size() - 1,
s);
59 return expandVariable(newW, dict);
63 string varName = w(1, w.size() - 1);
71 const entry* ePtr = dict.lookupScopedEntryPtr(varName,
true,
false);
78 append(ePtr->dict().tokens());
82 append(ePtr->stream());
88 string envStr =
getEnv(varName);
95 ) <<
"Illegal dictionary entry or environment variable name " 96 << varName <<
endl <<
"Valid dictionary entries are " 101 append(
tokenList(IStringStream(
'(' + envStr +
')')()));
160 return tokens.
first().lineNumber();
175 return tokens.
last().lineNumber();
191 <<
"Attempt to return primitive entry " <<
info()
192 <<
" as a sub-dictionary" 202 <<
"Attempt to return primitive entry " <<
info()
203 <<
" as a sub-dictionary"
string getEnv(const word &)
Return environment variable of given name.
A class for handling keywords in dictionaries.
#define forAll(list, i)
Loop across all elements in list.
bool empty() const
Return true if the UList is empty (ie, size() is zero)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const keyType & keyword() const
Return keyword.
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< token > tokenList
List of tokens, used for a IOdictionary entry.
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual Istream & rewind()
Rewind and return the stream so that it may be read again.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
InfoProxy< primitiveEntry > info() const
Return info proxy.
label endLineNumber() const
Return line number of last token in dictionary.
A token holds items read from Istream.
T & newElmt(const label)
Return subscript-checked element of UList.
Ostream & endl(Ostream &os)
Add newline and flush stream.
T & first()
Return the first element of the list.
A keyword and a list of tokens is a 'primitiveEntry'. An primitiveEntry can be read, written and printed, and the types and values of its tokens analysed.
entry(const keyType &)
Construct from keyword.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
label tokenIndex() const
Return the current token index.
ITstream(const string &name, const UList< token > &tokens, streamFormat format=ASCII, versionNumber version=currentVersion)
Construct from components.
static const dictionary null
Null dictionary.
errorManip< error > abort(error &err)
ITstream & stream() const
Return token stream if this entry is a primitive entry.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
const dictionary & dict() const
This entry is not a dictionary,.
label startLineNumber() const
Return line number of first token in dictionary.
string & inplaceExpand(string &, const HashTable< string, word, string::hash > &mapping, const char sigil='$')
Inplace expand occurrences of variables according to the mapping.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
primitiveEntry(const keyType &, Istream &)
Construct from keyword and a Istream.
const fileName & name() const
Return the dictionary name.
T & last()
Return the last element of the list.
A keyword and a list of tokens is an 'entry'.