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;
244 if (its.
size() == 1 && its[0].isStringType())
247 varValue = its[0].stringToken();
259 s.std::string::replace(varBeg, replaceLen, varValue);
260 varBeg += varValue.size();
282 const std::string& orig,
290 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
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
void size(const label n)
Older name for setAddressableSize.
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,...
const entry * findScoped(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for a scoped entry (const access) with the given keyword.
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
Return 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.
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))
A variant of Foam::string with expansion of dictionary variables into a comma-separated form.
void inplaceExpand(std::string &s, const HashTable< string > &mapping, const char sigil='$')
void inplaceTrim(std::string &s)
Trim leading and trailing whitespace inplace.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for 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.