Skip to content
Snippets Groups Projects
Commit 5fe4e62b authored by Mark OLESEN's avatar Mark OLESEN
Browse files

STYLE: can use objectRegistry::checkOut() directly with a pointer

parent ec519e3c
No related merge requests found
...@@ -239,7 +239,7 @@ bool Foam::regIOobject::checkOut() ...@@ -239,7 +239,7 @@ bool Foam::regIOobject::checkOut()
{ {
registered_ = false; registered_ = false;
return db().checkOut(*this); return db().checkOut(this);
} }
return false; return false;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010, 2018 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2010, 2018-2019 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
| Copyright (C) 2011-2016 OpenFOAM Foundation | Copyright (C) 2011-2016 OpenFOAM Foundation
...@@ -94,7 +94,7 @@ bool Foam::MeshObject<Mesh, MeshObjectType, Type>::Delete(const Mesh& mesh) ...@@ -94,7 +94,7 @@ bool Foam::MeshObject<Mesh, MeshObjectType, Type>::Delete(const Mesh& mesh)
<< Type::typeName << endl; << Type::typeName << endl;
} }
return mesh.thisDb().checkOut(*ptr); return mesh.thisDb().checkOut(ptr);
} }
return false; return false;
...@@ -118,9 +118,8 @@ void Foam::meshObject::movePoints(objectRegistry& obr) ...@@ -118,9 +118,8 @@ void Foam::meshObject::movePoints(objectRegistry& obr)
forAllIters(meshObjects, iter) forAllIters(meshObjects, iter)
{ {
// Same as (isA<MoveableMeshObject<Mesh>>(*iter())) // isA<MoveableMeshObject<Mesh>>
auto* objectPtr = dynamic_cast<MoveableMeshObject<Mesh>*>(*iter);
auto* objectPtr = dynamic_cast<MoveableMeshObject<Mesh>*>(iter());
if (objectPtr) if (objectPtr)
{ {
...@@ -136,7 +135,7 @@ void Foam::meshObject::movePoints(objectRegistry& obr) ...@@ -136,7 +135,7 @@ void Foam::meshObject::movePoints(objectRegistry& obr)
{ {
Pout<< " Destroying " << iter->name() << endl; Pout<< " Destroying " << iter->name() << endl;
} }
obr.checkOut(*iter()); obr.checkOut(*iter);
} }
} }
} }
...@@ -159,9 +158,8 @@ void Foam::meshObject::updateMesh(objectRegistry& obr, const mapPolyMesh& mpm) ...@@ -159,9 +158,8 @@ void Foam::meshObject::updateMesh(objectRegistry& obr, const mapPolyMesh& mpm)
forAllIters(meshObjects, iter) forAllIters(meshObjects, iter)
{ {
// Same as (isA<UpdateableMeshObject<Mesh>>(*iter())) // isA<MoveableMeshObject<Mesh>>
auto* objectPtr = dynamic_cast<UpdateableMeshObject<Mesh>*>(*iter);
auto* objectPtr = dynamic_cast<UpdateableMeshObject<Mesh>*>(iter());
if (objectPtr) if (objectPtr)
{ {
...@@ -177,7 +175,7 @@ void Foam::meshObject::updateMesh(objectRegistry& obr, const mapPolyMesh& mpm) ...@@ -177,7 +175,7 @@ void Foam::meshObject::updateMesh(objectRegistry& obr, const mapPolyMesh& mpm)
{ {
Pout<< " Destroying " << iter->name() << endl; Pout<< " Destroying " << iter->name() << endl;
} }
obr.checkOut(*iter()); obr.checkOut(*iter);
} }
} }
} }
...@@ -204,7 +202,7 @@ void Foam::meshObject::clear(objectRegistry& obr) ...@@ -204,7 +202,7 @@ void Foam::meshObject::clear(objectRegistry& obr)
{ {
Pout<< " Destroying " << iter->name() << endl; Pout<< " Destroying " << iter->name() << endl;
} }
obr.checkOut(*iter()); obr.checkOut(*iter);
} }
} }
...@@ -231,13 +229,16 @@ void Foam::meshObject::clearUpto(objectRegistry& obr) ...@@ -231,13 +229,16 @@ void Foam::meshObject::clearUpto(objectRegistry& obr)
forAllIters(meshObjects, iter) forAllIters(meshObjects, iter)
{ {
if (!isA<ToType<Mesh>>(*iter())) // isA<ToType<Mesh>
auto* objectPtr = dynamic_cast<ToType<Mesh>*>(*iter);
if (!objectPtr)
{ {
if (meshObject::debug) if (meshObject::debug)
{ {
Pout<< " Destroying " << iter->name() << endl; Pout<< " Destroying " << iter->name() << endl;
} }
obr.checkOut(*iter()); obr.checkOut(*iter);
} }
} }
} }
......
...@@ -77,13 +77,7 @@ bool Foam::sampledSurface::removeRegistrySurface ...@@ -77,13 +77,7 @@ bool Foam::sampledSurface::removeRegistrySurface
) const ) const
{ {
polySurface* surfptr = getRegistrySurface(obr, lookupName); polySurface* surfptr = getRegistrySurface(obr, lookupName);
return obr.checkOut(surfptr);
if (surfptr)
{
return obr.checkOut(*surfptr);
}
return false;
} }
...@@ -124,13 +118,7 @@ Foam::surfMesh* Foam::sampledSurface::storeSurfMesh(word lookupName) const ...@@ -124,13 +118,7 @@ Foam::surfMesh* Foam::sampledSurface::storeSurfMesh(word lookupName) const
bool Foam::sampledSurface::removeSurfMesh(word lookupName) const bool Foam::sampledSurface::removeSurfMesh(word lookupName) const
{ {
surfMesh* surfptr = getSurfMesh(lookupName); surfMesh* surfptr = getSurfMesh(lookupName);
return mesh().checkOut(surfptr);
if (surfptr)
{
return mesh().checkOut(*surfptr);
}
return false;
} }
......
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