Skip to content
Snippets Groups Projects
Commit 0f86a786 authored by mattijs's avatar mattijs
Browse files

ENH: MeshObject: add selective clearing function

parent 4dd1ce08
Branches
Tags
No related merge requests found
...@@ -374,4 +374,32 @@ void Foam::meshObject::clear(objectRegistry& obr) ...@@ -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: ...@@ -182,6 +182,16 @@ public:
template<class Mesh, template<class> class MeshObjectType> template<class Mesh, template<class> class MeshObjectType>
static void clear(objectRegistry&); 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&);
}; };
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment