functionEntry: Simplified the primitiveEntry created when functions are disabled

This commit is contained in:
Henry Weller
2019-08-20 23:36:49 +01:00
parent c5d4d5e17b
commit da52b23f41
3 changed files with 11 additions and 10 deletions

View File

@ -49,16 +49,14 @@ namespace Foam
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::string Foam::functionEntry::readLine(const word& key, Istream& is) Foam::word Foam::functionEntry::readLine(Istream& is)
{ {
string s; word s;
dynamic_cast<ISstream&>(is).getLine(s); dynamic_cast<ISstream&>(is).getLine(s);
return s;
return key + s;
} }
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
bool Foam::functionEntry::insert bool Foam::functionEntry::insert
@ -95,8 +93,8 @@ Foam::functionEntry::functionEntry
: :
primitiveEntry primitiveEntry
( (
word(key + dict.name() + Foam::name(is.lineNumber())), key,
token(word(readLine(key, is)), is.lineNumber()) token(readLine(is), is.lineNumber())
) )
{} {}
@ -192,6 +190,8 @@ void Foam::functionEntry::write(Ostream& os) const
{ {
os.indent(); os.indent();
writeKeyword(os, keyword());
for (label i=0; i<size(); ++i) for (label i=0; i<size(); ++i)
{ {
os << operator[](i); os << operator[](i);

View File

@ -67,8 +67,9 @@ class functionEntry
{ {
// Private Member Functions // Private Member Functions
//- Read line as string token //- Read line as word token
static string readLine(const word& key, Istream& is); static word readLine(Istream& is);
protected: protected:

View File

@ -373,7 +373,6 @@ bool Foam::functionObjectList::readFunctionObject
funcDict.set("region", region); funcDict.set("region", region);
} }
// Merge this functionObject dictionary into functionsDict
const word funcCallKeyword = string::validate<word>(funcCall); const word funcCallKeyword = string::validate<word>(funcCall);
dictionary funcArgsDict; dictionary funcArgsDict;
funcArgsDict.add(funcCallKeyword, funcDict); funcArgsDict.add(funcCallKeyword, funcDict);
@ -400,6 +399,7 @@ bool Foam::functionObjectList::readFunctionObject
requiredFields.insert(wordList(expandedFuncDict.lookup("fields"))); requiredFields.insert(wordList(expandedFuncDict.lookup("fields")));
} }
// Merge this functionObject dictionary into functionsDict
functionsDict.merge(funcArgsDict); functionsDict.merge(funcArgsDict);
functionsDict.subDict(funcCallKeyword).name() = funcDict.name(); functionsDict.subDict(funcCallKeyword).name() = funcDict.name();