97 <<
"No dictionary entry " <<
name <<
nl
104 <<
"Found dictionary " <<
name <<
" instead of entry" <<
nl
122 auto* ctorPtr = emptyConstructorTable(
name);
130 *emptyConstructorTablePtr_
147 constexpr const char sigil =
'$';
152 std::string::size_type varBeg = 0;
156 (varBeg =
s.find(sigil, varBeg)) != std::string::npos
157 && varBeg <
s.size()-1
160 if (varBeg &&
s[varBeg-1] ==
'\\')
167 if (
s[varBeg+1] ==
'[')
171 std::string::size_type varEnd =
s.find(
']', varBeg);
172 std::string::size_type delim = 1;
174 if (varEnd == std::string::npos)
178 <<
"No correct terminating ']' found in " <<
s <<
nl
184 word castTo, varName;
186 const auto lparen = varBeg+2;
187 if (lparen <
s.size() &&
s[lparen] ==
'(')
189 const auto rparen =
s.find(
')', lparen);
197 if (rparen == std::string::npos)
199 err <<
"No closing ')' found in ";
203 err <<
"Closing ')' found outside of";
207 <<
s.substr(varBeg, varEnd-varBeg) <<
nl
211 castTo.assign(
s.substr(lparen+1, rparen - lparen - 1));
212 varName.assign(
s.substr(rparen+1, varEnd - rparen - 1));
218 s.substr(varBeg + 1 + delim, varEnd - varBeg - 2*delim)
232 const auto replaceLen = (varEnd - varBeg + 1);
237 std::string varValue;
242 ITstream& its = eptr->stream();
243 varValue = its.toString();
250 s.std::string::replace(varBeg, replaceLen, varValue);
251 varBeg += varValue.size();
273 const std::string& orig,
281 inplaceExpand(
s,
dict);
Macros for easy insertion into run-time selection tables.
#define addNamedToRunTimeSelectionTable(baseType, thisType, argNames, lookupName)
Add to construction table with 'lookupName' as the key.
An input stream of tokens.
std::string toString() const
Concatenate tokens into a space-separated std::string. The resulting string may contain quote charact...
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
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'.
virtual ITstream & stream() const =0
Return token stream, if entry is a primitive entry.
virtual bool isDict() const noexcept
True if this entry is a dictionary.
Convert dictionary entry to a stringified expression.
static expressions::exprString expand(const std::string &str, const dictionary &dict)
Expand expression with dictionary entries.
static void inplaceExpand(std::string &s, const dictionary &dict)
Inplace expand expression with dictionary variables/entries.
static autoPtr< expressionEntry > New(const word &name)
Return an entry to expression converter.
A variant of Foam::string with expansion of dictionary variables into a comma-separated form.
A class for handling words, derived from Foam::string.
#define defineTypeName(Type)
Define the typeName.
#define FatalErrorInLookup(lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalError.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
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))
void inplaceExpand(std::string &s, const HashTable< string > &mapping, const char sigil='$')
Inplace expand occurrences of variables according to the mapping. Does not use environment values.
void inplaceTrim(std::string &s)
Trim leading and trailing whitespace inplace.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static const entry * getVariableOrDie(const word &name, const dictionary &dict)
constexpr char nl
The newline '\n' character (0x0a).
Macros to ease declaration of run-time selection tables.
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.