37#define DetailInfo if (::Foam::infoDetailLevel > 0) ::Foam::InfoErr
51 primitiveEntryIstream,
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)
117 ignore =
s[other] ==
';' || std::isspace(
s[other]);
129 <<
"Invalid input (after trailing ';') for #eval" <<
nl
137 <<
"expanded: " <<
s <<
endl;
143 <<
"Empty #eval - line "
150 expressions::exprResult result;
154 result = std::move(driver.result());
157 if (!result.hasValue() || !result.size())
160 <<
"Failed #eval - line "
168 if (result.size() <= 1)
170 result.writeValue(toks);
174 result.writeField(toks);
177 return tokenList(std::move(toks.tokens()));
189 <<
"Using #eval - line "
190 << is.lineNumber() <<
" in file "
191 << parentDict.relativeName() <<
nl;
201 fieldWidth =
Foam::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)
256 tokenList toks(evaluate(parentDict, is));
258 entry.add_tokens(std::move(toks));
268 const string& inputExpr,
273 tokenList toks(evaluate(parentDict, inputExpr, fieldWidth, is));
275 entry.add_tokens(std::move(toks));
Macros for easy insertion into member function selection tables.
#define addNamedToMemberFunctionSelectionTable(baseType, thisType, funcName, argNames, lookupName)
Add to hash-table of functions with 'lookupName' as the key.
label lineNumber() const noexcept
Const access to the current stream line number.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
fileName relativeName(const bool caseTag=false) const
The dictionary name relative to the case.
A keyword and a list of tokens is an 'entry'.
entry(const keyType &keyword)
Construct from keyword.
static void inplaceExpand(std::string &str, const dictionary &dict, const bool stripComments=true)
Inplace expansion with dictionary variables, and strip any embedded C/C++ comments.
Uses expressions::fieldExprDriver to evaluate mathematical expressions with scalars,...
static bool execute(const dictionary &parentDict, primitiveEntry &thisEntry, Istream &is)
Execute in a primitiveEntry context, extracts token or line.
A functionEntry causes entries to be added/manipulated on the specified dictionary given an input str...
A keyword and a list of tokens comprise a primitiveEntry. A primitiveEntry can be read,...
primitiveEntry(const keyType &key)
Construct from keyword and no tokens.
static std::string::size_type length(const char *s)
Length of the character sequence (with nullptr protection).
@ BEGIN_BLOCK
Begin block [isseparator].
@ END_BLOCK
End block [isseparator].
@ DOLLAR
Dollar - start variable or expression.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
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))
fieldExpr::parseDriver fieldExprDriver
Typedef for fieldExpr parseDriver.
Namespace for containing a functionEntry.
void inplaceTrim(std::string &s)
Trim leading and trailing whitespace inplace.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Ostream & endl(Ostream &os)
Add newline and flush stream.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
messageStream InfoErr
Information stream (stderr output on master, null elsewhere).
List< token > tokenList
List of token, used for dictionary primitive entry (for example).
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).