diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistry.H b/src/OpenFOAM/db/objectRegistry/objectRegistry.H index 48cabcc1cf..14306e41fb 100644 --- a/src/OpenFOAM/db/objectRegistry/objectRegistry.H +++ b/src/OpenFOAM/db/objectRegistry/objectRegistry.H @@ -157,7 +157,7 @@ public: //- Lookup and return all objects of the given Type template - HashTable lookupClass() const; + HashTable lookupClass(const bool strict = false) const; //- Is the named Type found? template diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C b/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C index eb7b8fab63..922d630de7 100644 --- a/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C +++ b/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,8 +29,7 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -Foam::wordList -Foam::objectRegistry::names() const +Foam::wordList Foam::objectRegistry::names() const { wordList objectNames(size()); @@ -50,14 +49,24 @@ Foam::objectRegistry::names() const template -Foam::HashTable -Foam::objectRegistry::lookupClass() const +Foam::HashTable Foam::objectRegistry::lookupClass +( + const bool strict +) const { HashTable objectsOfClass(size()); for (const_iterator iter = begin(); iter != end(); ++iter) { - if (isA(*iter())) + if (strict && isType(*iter())) + { + objectsOfClass.insert + ( + iter()->name(), + dynamic_cast(iter()) + ); + } + else if (isA(*iter())) { objectsOfClass.insert (