mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Corrected the building of the sub-dictionary names used for debug messages.
This commit is contained in:
@ -109,14 +109,21 @@ Foam::dictionary::dictionary()
|
||||
{}
|
||||
|
||||
|
||||
Foam::dictionary::dictionary(const fileName& name)
|
||||
:
|
||||
dictionaryName(name),
|
||||
parent_(dictionary::null)
|
||||
{}
|
||||
|
||||
|
||||
Foam::dictionary::dictionary
|
||||
(
|
||||
const dictionary& parentDict,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
dictionaryName(parentDict.name() + "::" + dict.name()),
|
||||
IDLList<entry>(dict, *this),
|
||||
name_(dict.name()),
|
||||
parent_(parentDict)
|
||||
{
|
||||
forAllIter(IDLList<entry>, *this, iter)
|
||||
@ -140,8 +147,8 @@ Foam::dictionary::dictionary
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
dictionaryName(dict.name()),
|
||||
IDLList<entry>(dict, *this),
|
||||
name_(dict.name()),
|
||||
parent_(dictionary::null)
|
||||
{
|
||||
forAllIter(IDLList<entry>, *this, iter)
|
||||
@ -183,6 +190,7 @@ Foam::dictionary::dictionary
|
||||
parent_(parentDict)
|
||||
{
|
||||
transfer(dict());
|
||||
name() = parentDict.name() + "::" + name();
|
||||
}
|
||||
|
||||
|
||||
@ -472,6 +480,24 @@ Foam::dictionary& Foam::dictionary::subDict(const word& keyword)
|
||||
}
|
||||
|
||||
|
||||
Foam::dictionary Foam::dictionary::subOrEmptyDict
|
||||
(
|
||||
const word& keyword
|
||||
) const
|
||||
{
|
||||
const entry* entryPtr = lookupEntryPtr(keyword, false, true);
|
||||
|
||||
if (entryPtr == NULL)
|
||||
{
|
||||
return dictionary(*this, dictionary(keyword));
|
||||
}
|
||||
else
|
||||
{
|
||||
return entryPtr->dict();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::wordList Foam::dictionary::toc() const
|
||||
{
|
||||
wordList keys(size());
|
||||
@ -530,7 +556,7 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
|
||||
|
||||
if (hashedEntries_.insert(entryPtr->keyword(), entryPtr))
|
||||
{
|
||||
entryPtr->name() = name_ + "::" + entryPtr->keyword();
|
||||
entryPtr->name() = name() + "::" + entryPtr->keyword();
|
||||
|
||||
if (entryPtr->keyword().isPattern())
|
||||
{
|
||||
@ -558,7 +584,7 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
|
||||
|
||||
if (hashedEntries_.insert(entryPtr->keyword(), entryPtr))
|
||||
{
|
||||
entryPtr->name() = name_ + "::" + entryPtr->keyword();
|
||||
entryPtr->name() = name() + "::" + entryPtr->keyword();
|
||||
IDLList<entry>::append(entryPtr);
|
||||
|
||||
if (entryPtr->keyword().isPattern())
|
||||
@ -763,7 +789,7 @@ bool Foam::dictionary::changeKeyword
|
||||
|
||||
// change name and HashTable, but leave DL-List untouched
|
||||
iter()->keyword() = newKeyword;
|
||||
iter()->name() = name_ + "::" + newKeyword;
|
||||
iter()->name() = name() + "::" + newKeyword;
|
||||
hashedEntries_.erase(oldKeyword);
|
||||
hashedEntries_.insert(newKeyword, iter());
|
||||
|
||||
@ -838,7 +864,7 @@ void Foam::dictionary::transfer(dictionary& dict)
|
||||
{
|
||||
// changing parents probably doesn't make much sense,
|
||||
// but what about the names?
|
||||
name_ = dict.name_;
|
||||
name() = dict.name();
|
||||
|
||||
IDLList<entry>::transfer(dict);
|
||||
hashedEntries_.transfer(dict.hashedEntries_);
|
||||
@ -871,7 +897,7 @@ void Foam::dictionary::operator=(const dictionary& rhs)
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
name_ = rhs.name();
|
||||
name() = rhs.name();
|
||||
clear();
|
||||
|
||||
// Create clones of the entries in the given dictionary
|
||||
|
||||
@ -41,7 +41,7 @@ Description
|
||||
|
||||
ToDo
|
||||
A merge() member function with a non-const dictionary parameter.
|
||||
This would avoid unnecessary cloning in the add(entry*,bool) method
|
||||
This would avoid unnecessary cloning in the add(entry*, bool) method.
|
||||
|
||||
SourceFiles
|
||||
dictionary.C
|
||||
@ -74,6 +74,47 @@ class SHA1Digest;
|
||||
Istream& operator>>(Istream&, dictionary&);
|
||||
Ostream& operator<<(Ostream&, const dictionary&);
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class dictionaryName Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class dictionaryName
|
||||
{
|
||||
// Private data
|
||||
|
||||
fileName name_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct dictionaryName null
|
||||
dictionaryName()
|
||||
{}
|
||||
|
||||
//- Construct dictionaryName as copy of the given fileName
|
||||
dictionaryName(const fileName& name)
|
||||
:
|
||||
name_(name)
|
||||
{}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Return the dictionary name
|
||||
const fileName& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Return the dictionary name
|
||||
fileName& name()
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class dictionary Declaration
|
||||
@ -81,13 +122,11 @@ Ostream& operator<<(Ostream&, const dictionary&);
|
||||
|
||||
class dictionary
|
||||
:
|
||||
public dictionaryName,
|
||||
public IDLList<entry>
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Dictionary name
|
||||
fileName name_;
|
||||
|
||||
//- HashTable of the entries held on the DL-list for quick lookup
|
||||
HashTable<entry*> hashedEntries_;
|
||||
|
||||
@ -100,6 +139,7 @@ class dictionary
|
||||
//- Patterns as precompiled regular expressions
|
||||
DLList<autoPtr<regExp> > patternRegexps_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Search patterns table for exact match or regular expression match
|
||||
@ -121,16 +161,6 @@ class dictionary
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Read dictionary from Istream
|
||||
bool read(Istream&);
|
||||
|
||||
//- Substitute the given keyword prepended by '$' with the
|
||||
// corresponding sub-dictionary entries
|
||||
bool substituteKeyword(const word& keyword);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Declare friendship with the entry class for IO
|
||||
@ -150,10 +180,14 @@ public:
|
||||
//- Construct top-level dictionary null
|
||||
dictionary();
|
||||
|
||||
//- Construct from the parent dictionary and Istream, reading entries
|
||||
// until lastEntry or EOF
|
||||
//- Construct top-level empty dictionary with given name
|
||||
dictionary(const fileName& name);
|
||||
|
||||
//- Construct given the entry name, parent dictionary and Istream,
|
||||
// reading entries until lastEntry or EOF
|
||||
dictionary
|
||||
(
|
||||
const fileName& name,
|
||||
const dictionary& parentDict,
|
||||
Istream&
|
||||
);
|
||||
@ -192,18 +226,6 @@ public:
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Return the dictionary name
|
||||
const fileName& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Return the dictionary name
|
||||
fileName& name()
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Return the parent dictionary
|
||||
const dictionary& parent() const
|
||||
{
|
||||
@ -320,14 +342,23 @@ public:
|
||||
//- Find and return a sub-dictionary for manipulation
|
||||
dictionary& subDict(const word&);
|
||||
|
||||
//- Find and return a sub-dictionary as a copy, or
|
||||
// return an empty dictionary if the sub-dictionary does not exist
|
||||
dictionary subOrEmptyDict(const word&) const;
|
||||
|
||||
//- Return the table of contents
|
||||
wordList toc() const;
|
||||
|
||||
//- Return the list of available keys or patterns
|
||||
List<keyType> keys(bool patterns=false) const;
|
||||
|
||||
|
||||
// Editing
|
||||
|
||||
//- Substitute the given keyword prepended by '$' with the
|
||||
// corresponding sub-dictionary entries
|
||||
bool substituteKeyword(const word& keyword);
|
||||
|
||||
//- Add a new entry
|
||||
// With the merge option, dictionaries are interwoven and
|
||||
// primitive entries are overwritten
|
||||
@ -407,6 +438,12 @@ public:
|
||||
Xfer<dictionary> xfer();
|
||||
|
||||
|
||||
// Read
|
||||
|
||||
//- Read dictionary from Istream
|
||||
bool read(Istream&);
|
||||
|
||||
|
||||
// Write
|
||||
|
||||
void write(Ostream&, bool subDict=true) const;
|
||||
|
||||
@ -58,10 +58,8 @@ Foam::dictionaryEntry::dictionaryEntry
|
||||
)
|
||||
:
|
||||
entry(key),
|
||||
dictionary(parentDict, is)
|
||||
dictionary(key, parentDict, is)
|
||||
{
|
||||
name() += "::" + key;
|
||||
|
||||
is.fatalCheck
|
||||
(
|
||||
"dictionaryEntry::dictionaryEntry"
|
||||
|
||||
@ -95,11 +95,12 @@ bool Foam::dictionary::substituteKeyword(const word& keyword)
|
||||
|
||||
Foam::dictionary::dictionary
|
||||
(
|
||||
const fileName& name,
|
||||
const dictionary& parentDict,
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
name_(is.name()),
|
||||
dictionaryName(parentDict.name() + "::" + name),
|
||||
parent_(parentDict)
|
||||
{
|
||||
read(is);
|
||||
@ -108,7 +109,7 @@ Foam::dictionary::dictionary
|
||||
|
||||
Foam::dictionary::dictionary(Istream& is)
|
||||
:
|
||||
name_(is.name()),
|
||||
dictionaryName(is.name()),
|
||||
parent_(dictionary::null)
|
||||
{
|
||||
// Reset input mode as this is a "top-level" dictionary
|
||||
@ -132,6 +133,7 @@ Foam::Istream& Foam::operator>>(Istream& is, dictionary& dict)
|
||||
functionEntries::inputModeEntry::clear();
|
||||
|
||||
dict.clear();
|
||||
dict.name() = is.name();
|
||||
dict.read(is);
|
||||
|
||||
return is;
|
||||
|
||||
@ -108,8 +108,7 @@ public:
|
||||
static autoPtr<entry> New(Istream& is);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
//- Destructor
|
||||
virtual ~entry()
|
||||
{}
|
||||
|
||||
|
||||
@ -77,7 +77,7 @@ LESModel::LESModel
|
||||
),
|
||||
|
||||
printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)),
|
||||
coeffDict_(subDictPtr(type + "Coeffs")),
|
||||
coeffDict_(subOrEmptyDict(type + "Coeffs")),
|
||||
|
||||
k0_("k0", dimVelocity*dimVelocity, SMALL),
|
||||
|
||||
|
||||
@ -79,7 +79,7 @@ RASModel::RASModel
|
||||
|
||||
turbulence_(lookup("turbulence")),
|
||||
printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)),
|
||||
coeffDict_(subDictPtr(type + "Coeffs")),
|
||||
coeffDict_(subOrEmptyDict(type + "Coeffs")),
|
||||
|
||||
k0_("k0", dimVelocity*dimVelocity, SMALL),
|
||||
epsilon0_("epsilon", k0_.dimensions()/dimTime, SMALL),
|
||||
|
||||
@ -76,7 +76,7 @@ LESModel::LESModel
|
||||
),
|
||||
|
||||
printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)),
|
||||
coeffDict_(subDictPtr(type + "Coeffs")),
|
||||
coeffDict_(subOrEmptyDict(type + "Coeffs")),
|
||||
|
||||
k0_("k0", dimVelocity*dimVelocity, SMALL),
|
||||
delta_(LESdelta::New("delta", U.mesh(), *this))
|
||||
|
||||
@ -78,7 +78,7 @@ RASModel::RASModel
|
||||
|
||||
turbulence_(lookup("turbulence")),
|
||||
printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)),
|
||||
coeffDict_(subDictPtr(type + "Coeffs")),
|
||||
coeffDict_(subOrEmptyDict(type + "Coeffs")),
|
||||
|
||||
k0_("k0", dimVelocity*dimVelocity, SMALL),
|
||||
epsilon0_("epsilon", k0_.dimensions()/dimTime, SMALL),
|
||||
|
||||
Reference in New Issue
Block a user