From db1f124025ec639c209701d811494c433b04f573 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Thu, 21 Apr 2016 21:08:56 +0100 Subject: [PATCH] dictionary: Corrected topDict() Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=2060 --- src/OpenFOAM/db/dictionary/dictionary.C | 26 ++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/OpenFOAM/db/dictionary/dictionary.C b/src/OpenFOAM/db/dictionary/dictionary.C index a85406d53..aaace1d07 100644 --- a/src/OpenFOAM/db/dictionary/dictionary.C +++ b/src/OpenFOAM/db/dictionary/dictionary.C @@ -238,7 +238,7 @@ const Foam::dictionary& Foam::dictionary::topDict() const } else { - return p; + return *this; } } @@ -273,7 +273,7 @@ Foam::SHA1Digest Foam::dictionary::digest() const { OSHA1stream os; - // process entries + // Process entries forAllConstIter(IDLList, *this, iter) { os << *iter; @@ -285,12 +285,12 @@ Foam::SHA1Digest Foam::dictionary::digest() const Foam::tokenList Foam::dictionary::tokens() const { - // linearise dictionary into a string + // Serialize dictionary into a string OStringStream os; write(os, false); IStringStream is(os.str()); - // parse string as tokens + // Parse string as tokens DynamicList tokens; token t; while (is.read(t)) @@ -579,10 +579,10 @@ bool Foam::dictionary::substituteScopedKeyword(const word& keyword) { word varName = keyword(1, keyword.size()-1); - // lookup the variable name in the given dictionary + // Lookup the variable name in the given dictionary const entry* ePtr = lookupScopedEntryPtr(varName, true, true); - // if defined insert its entries into this dictionary + // If defined insert its entries into this dictionary if (ePtr != NULL) { const dictionary& addDict = ePtr->dict(); @@ -737,7 +737,7 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry) if (mergeEntry && iter != hashedEntries_.end()) { - // merge dictionary with dictionary + // Merge dictionary with dictionary if (iter()->isDict() && entryPtr->isDict()) { iter()->dict().merge(entryPtr->dict()); @@ -747,7 +747,7 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry) } else { - // replace existing dictionary with entry or vice versa + // Replace existing dictionary with entry or vice versa IDLList::replace(iter(), entryPtr); delete iter(); hashedEntries_.erase(iter); @@ -859,7 +859,7 @@ void Foam::dictionary::set(entry* entryPtr) { entry* existingPtr = lookupEntryPtr(entryPtr->keyword(), false, true); - // clear dictionary so merge acts like overwrite + // Clear dictionary so merge acts like overwrite if (existingPtr && existingPtr->isDict()) { existingPtr->dict().clear(); @@ -919,7 +919,7 @@ bool Foam::dictionary::changeKeyword bool forceOverwrite ) { - // no change + // No change if (oldKeyword == newKeyword) { return false; @@ -985,7 +985,7 @@ bool Foam::dictionary::changeKeyword } } - // change name and HashTable, but leave DL-List untouched + // Change name and HashTable, but leave DL-List untouched iter()->keyword() = newKeyword; iter()->name() = name() + '.' + newKeyword; hashedEntries_.erase(oldKeyword); @@ -1039,7 +1039,7 @@ bool Foam::dictionary::merge(const dictionary& dict) } else { - // not found - just add + // Not found - just add add(iter().clone(*this).ptr()); changed = true; } @@ -1060,7 +1060,7 @@ void Foam::dictionary::clear() void Foam::dictionary::transfer(dictionary& dict) { - // changing parents probably doesn't make much sense, + // Changing parents probably doesn't make much sense, // but what about the names? name() = dict.name();