mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
ENH: MeshObject: add selective clearing function
This commit is contained in:
@ -374,4 +374,32 @@ void Foam::meshObject::clear(objectRegistry& obr)
|
||||
}
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
class Mesh,
|
||||
template<class> class FromType,
|
||||
template<class> class ToType
|
||||
>
|
||||
void Foam::meshObject::clearUpto(objectRegistry& obr)
|
||||
{
|
||||
HashTable<FromType<Mesh>*> meshObjects
|
||||
(
|
||||
obr.lookupClass<FromType<Mesh> >()
|
||||
);
|
||||
|
||||
forAllIter(typename HashTable<FromType<Mesh>*>, meshObjects, iter)
|
||||
{
|
||||
if (!isA<ToType<Mesh> >(*iter()))
|
||||
{
|
||||
if (meshObject::debug)
|
||||
{
|
||||
Pout<< "meshObject::clearUpto(objectRegistry&) : destroying "
|
||||
<< iter()->name() << endl;
|
||||
}
|
||||
obr.checkOut(*iter());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -182,6 +182,16 @@ public:
|
||||
|
||||
template<class Mesh, template<class> class MeshObjectType>
|
||||
static void clear(objectRegistry&);
|
||||
|
||||
//- Clear all meshObject derived from FromType up to (but not including)
|
||||
// ToType. Used to clear e.g. all non-updateable meshObjects
|
||||
template
|
||||
<
|
||||
class Mesh,
|
||||
template<class> class FromType,
|
||||
template<class> class ToType
|
||||
>
|
||||
static void clearUpto(objectRegistry&);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user