Go to the documentation of this file.
37 #define DetailInfo if (::Foam::infoDetailLevel > 0) InfoErr
44 namespace functionEntries
51 primitiveEntryIstream,
63 const dictionary& parentDict,
64 const string& inputExpr,
73 <<
"Invalid field width: " << fieldWidth <<
nl <<
endl
79 <<
"input: " << inputExpr <<
endl;
98 s.assign(inputExpr, 3, inputExpr.length()-5);
111 const auto trailing =
s.find(
';');
112 if (std::string::npos != trailing)
115 for (
size_t other = trailing; ignore && other <
s.length(); ++other)
129 <<
"Invalid input (after trailing ';') for #eval" <<
nl
137 <<
"expanded: " <<
s <<
endl;
143 <<
"Empty #eval - line "
144 << is.lineNumber() <<
" in file "
145 << parentDict.relativeName() <<
nl;
150 expressions::exprResult result;
154 result = std::move(driver.result());
157 if (!result.hasValue() || !result.size())
160 <<
"Failed #eval - line "
161 << is.lineNumber() <<
" in file "
162 << parentDict.relativeName() <<
nl;
168 if (result.size() <= 1)
170 result.writeValue(toks);
174 result.writeField(toks);
177 return std::move(toks);
183 const dictionary& parentDict,
189 <<
"Using #eval - line "
190 << is.lineNumber() <<
" in file "
191 << parentDict.relativeName() <<
nl;
201 fieldWidth =
max(1, tok.labelToken());
209 if (tok.isStringType())
214 str = tok.stringToken();
220 if (!continueReadUntilRightBrace(is, str,
true))
225 "Premature end while reading #eval - missing '}'?"
232 <<
"Invalid input for #eval."
233 " Expecting a string or block to evaluate, but found" <<
nl
234 << tok.info() <<
endl
240 evalEntry::evaluate(parentDict, str, fieldWidth, is)
258 entry.append(std::move(toks),
true);
268 const string& inputExpr,
275 entry.append(std::move(toks),
true);
A keyword and a list of tokens is an 'entry'.
A keyword and a list of tokens comprise a primitiveEntry. A primitiveEntry can be read,...
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.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))
bool isspace(char c) noexcept
Test for whitespace (C-locale)
void inplaceTrim(std::string &s)
Trim leading and trailing whitespace inplace.
Ostream & endl(Ostream &os)
Add newline and flush stream.
messageStream InfoErr
Information stream (stderr output on master, null elsewhere)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Macros for easy insertion into member function selection tables.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Dollar - start variable or expression.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
addNamedToMemberFunctionSelectionTable(functionEntry, calcEntry, execute, dictionaryIstream, calc)
Begin block [isseparator].
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< token > tokenList
List of tokens, used for a IOdictionary entry.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
static bool execute(const dictionary &parentDict, primitiveEntry &thisEntry, Istream &is)
Execute in a primitiveEntry context, extracts token or line.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
static void inplaceExpand(std::string &str, const dictionary &dict, const bool stripComments=true)
fieldExpr::parseDriver fieldExprDriver
Typedef for fieldExpr parseDriver.
string evaluate(label fieldWidth, const std::string &s, size_t pos=0, size_t len=std::string::npos)
String evaluation with specified (positive, non-zero) field width.