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 tokenList(std::move(toks.tokens()));
183 const dictionary& parentDict,
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)
268 const string& inputExpr,
275 entry.add_tokens(std::move(toks));
Begin block [isseparator].
errorManipArg< error, int > exit(error &err, const int errNo=1)
fieldExpr::parseDriver fieldExprDriver
Typedef for fieldExpr parseDriver.
messageStream InfoErr
Information stream (stderr output on master, null elsewhere)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
constexpr char nl
The newline '\n' character (0x0a)
void inplaceTrim(std::string &s)
Trim leading and trailing whitespace inplace.
Ostream & endl(Ostream &os)
Add newline and flush stream.
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.
Dollar - start variable or expression.
List< token > tokenList
List of token, used for dictionary primitive entry (for example)
A keyword and a list of tokens comprise a primitiveEntry. A primitiveEntry can be read...
static bool execute(const dictionary &parentDict, primitiveEntry &thisEntry, Istream &is)
Execute in a primitiveEntry context, extracts token or line.
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.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
bool isspace(char c) noexcept
Test for whitespace (C-locale)
Macros for easy insertion into member function selection tables.
addNamedToMemberFunctionSelectionTable(functionEntry, calcEntry, execute, dictionaryIstream, calc)
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))
A keyword and a list of tokens is an 'entry'.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...