COMP: incomplete Time class used in objectRegistryTemplates

This commit is contained in:
Mark Olesen
2010-12-08 08:41:50 +01:00
parent f5f51aebe2
commit a3c6d6ace3
8 changed files with 41 additions and 36 deletions

View File

@ -64,6 +64,11 @@ $(sha1)/SHA1Digest.C
primitives/random/Random/Random.C
primitives/random/cachedRandom/cachedRandom.H
ranges = primitives/ranges
$(ranges)/scalarRange/scalarRange.C
$(ranges)/scalarRange/scalarRanges.C
containers/HashTables/HashTable/HashTableCore.C
containers/HashTables/StaticHashTable/StaticHashTableCore.C
containers/Lists/SortableList/ParSortableListName.C
@ -194,9 +199,6 @@ $(Time)/timeSelector.C
$(Time)/instant/instant.C
db/scalarRange/scalarRange.C
db/scalarRange/scalarRanges.C
dimensionSet/dimensionSet.C
dimensionSet/dimensionSetIO.C
dimensionSet/dimensionSets.C

View File

@ -31,6 +31,14 @@ License
defineTypeNameAndDebug(Foam::objectRegistry, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::objectRegistry::parentNotTime() const
{
return (&parent_ != dynamic_cast<const objectRegistry*>(&time_));
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::objectRegistry::objectRegistry

View File

@ -69,6 +69,10 @@ class objectRegistry
// Private Member Functions
//- Is the objectRegistry parent_ different from time_
// Used to terminate searching within the ancestors
bool parentNotTime() const;
//- Disallow Copy constructor
objectRegistry(const objectRegistry&);

View File

@ -84,22 +84,13 @@ bool Foam::objectRegistry::foundObject(const word& name) const
{
return true;
}
else
{
return false;
}
}
else
else if (this->parentNotTime())
{
if (&parent_ != dynamic_cast<const objectRegistry*>(&time_))
{
return parent_.foundObject<Type>(name);
}
else
{
return false;
}
return parent_.foundObject<Type>(name);
}
return false;
}
@ -117,8 +108,10 @@ const Type& Foam::objectRegistry::lookupObject(const word& name) const
return *vpsiPtr_;
}
FatalErrorIn("objectRegistry::lookupObject<Type>(const word&) const")
<< nl
FatalErrorIn
(
"objectRegistry::lookupObject<Type>(const word&) const"
) << nl
<< " lookup of " << name << " from objectRegistry "
<< this->name()
<< " successful\n but it is not a " << Type::typeName
@ -127,23 +120,21 @@ const Type& Foam::objectRegistry::lookupObject(const word& name) const
}
else
{
if (&parent_ != dynamic_cast<const objectRegistry*>(&time_))
if (this->parentNotTime())
{
return parent_.lookupObject<Type>(name);
}
else
{
FatalErrorIn
(
"objectRegistry::lookupObject<Type>(const word&) const"
) << nl
<< " request for " << Type::typeName
<< " " << name << " from objectRegistry " << this->name()
<< " failed\n available objects of type " << Type::typeName
<< " are" << nl
<< names<Type>()
<< abort(FatalError);
}
FatalErrorIn
(
"objectRegistry::lookupObject<Type>(const word&) const"
) << nl
<< " request for " << Type::typeName
<< " " << name << " from objectRegistry " << this->name()
<< " failed\n available objects of type " << Type::typeName
<< " are" << nl
<< names<Type>()
<< abort(FatalError);
}
return *reinterpret_cast< const Type* >(0);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2007-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2007-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2007-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2007-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License