37#define DetailInfo if (::Foam::infoDetailLevel > 0) InfoErr
44namespace 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);
105 expressions::exprString::inplaceExpand(
s, parentDict,
true);
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 "
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
256 tokenList toks(evaluate(parentDict, is));
258 entry.append(std::move(toks),
true);
268 const string& inputExpr,
273 tokenList toks(evaluate(parentDict, inputExpr, fieldWidth, is));
275 entry.append(std::move(toks),
true);
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.
void evaluate()
Evaluate boundary conditions.
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,...
A keyword and a list of tokens is an 'entry'.
Uses expressions::fieldExprDriver to evaluate mathematical expressions with scalars,...
A functionEntry causes entries to be added/manipulated on the specified dictionary given an input str...
virtual bool execute()
Calculate the output fields.
A keyword and a list of tokens comprise a primitiveEntry. A primitiveEntry can be read,...
@ 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.
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.
messageStream InfoErr
Information stream (stderr output on master, null elsewhere)
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< token > tokenList
List of tokens, used for a IOdictionary entry.
constexpr char nl
The newline '\n' character (0x0a)