diff --git a/src/OpenFOAM/db/dictionary/functionEntries/calcEntry/calcEntry.C b/src/OpenFOAM/db/dictionary/functionEntries/calcEntry/calcEntry.C index 51d0a309df..3f7d101236 100644 --- a/src/OpenFOAM/db/dictionary/functionEntries/calcEntry/calcEntry.C +++ b/src/OpenFOAM/db/dictionary/functionEntries/calcEntry/calcEntry.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -61,39 +61,36 @@ namespace functionEntries Foam::string Foam::functionEntries::calcEntry::calc ( - const dictionary& parentDict, + const dictionary& dict, Istream& is ) { Info<< "Using #calcEntry at line " << is.lineNumber() - << " in file " << parentDict.name() << endl; + << " in file " << dict.name() << endl; dynamicCode::checkSecurity ( "functionEntries::calcEntry::execute(..)", - parentDict + dict ); // Read string string s(is); - // Make sure we stop this entry - // is.putBack(token(token::END_STATEMENT, is.lineNumber())); // Construct codeDict for codeStream - // must reference parent for stringOps::expand to work nicely. - dictionary codeSubDict; - codeSubDict.add("code", "os << (" + s + ");"); - dictionary codeDict(parentDict, codeSubDict); + // Must reference parent dictionary for stringOps::expand to work + dictionary codeDict(dict.parent(), dict); + codeDict.add("code", "os << (" + s + ");"); codeStream::streamingFunctionType function = codeStream::getFunction ( - parentDict, + dict, codeDict ); // Use function to write stream OStringStream os(is.format()); - (*function)(os, parentDict); + (*function)(os, dict); // Return the string containing the results of the calculation return os.str(); @@ -104,22 +101,22 @@ Foam::string Foam::functionEntries::calcEntry::calc bool Foam::functionEntries::calcEntry::execute ( - dictionary& parentDict, + dictionary& dict, Istream& is ) { - return insert(parentDict, calc(parentDict, is)); + return insert(dict, calc(dict, is)); } bool Foam::functionEntries::calcEntry::execute ( - const dictionary& parentDict, + const dictionary& dict, primitiveEntry& thisEntry, Istream& is ) { - return insert(parentDict, thisEntry, calc(parentDict, is)); + return insert(dict, thisEntry, calc(dict, is)); } diff --git a/src/OpenFOAM/db/dictionary/functionEntries/calcEntry/calcEntry.H b/src/OpenFOAM/db/dictionary/functionEntries/calcEntry/calcEntry.H index 38767c2ead..7444062c9e 100644 --- a/src/OpenFOAM/db/dictionary/functionEntries/calcEntry/calcEntry.H +++ b/src/OpenFOAM/db/dictionary/functionEntries/calcEntry/calcEntry.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -76,7 +76,7 @@ class calcEntry //- Perform the calculation and return the resulting string static string calc ( - const dictionary& parentDict, + const dictionary& dict, Istream& is ); @@ -96,12 +96,12 @@ public: // Member Functions //- Execute the functionEntry in a sub-dict context - static bool execute(dictionary& parentDict, Istream&); + static bool execute(dictionary& dict, Istream&); //- Execute the functionEntry in a primitiveEntry context static bool execute ( - const dictionary& parentDict, + const dictionary& dict, primitiveEntry&, Istream& );