ENH: simplify objectRegistry access names (issue #322)

New name:  findObject(), cfindObject()
  Old name:  lookupObjectPtr()

      Return a const pointer or nullptr on failure.

  New name:  findObject()
  Old name:  --

      Return a non-const pointer or nullptr on failure.

  New name:  getObjectPtr()
  Old name:  lookupObjectRefPtr()

      Return a non-const pointer or nullptr on failure.
      Can be called on a const object and it will perform a
      const_cast.

- use these updated names and functionality in more places

NB: The older methods names are deprecated, but continue to be defined.
This commit is contained in:
Mark Olesen
2018-10-17 16:44:10 +02:00
parent e0255cfff2
commit 8fabc32539
94 changed files with 918 additions and 952 deletions

View File

@ -84,24 +84,13 @@ void Foam::refinementHistoryConstraint::add
List<labelPair>& explicitConnections
) const
{
autoPtr<const refinementHistory> storagePtr;
refinementHistory const* refPtr = nullptr;
const refinementHistory* refPtr =
mesh.findObject<refinementHistory>("refinementHistory");
if (mesh.foundObject<refinementHistory>("refinementHistory"))
autoPtr<const refinementHistory> storagePtr;
if (!refPtr)
{
if (decompositionConstraint::debug)
{
Info<< type() << " : found refinementHistory" << endl;
}
refPtr = &mesh.lookupObject<refinementHistory>("refinementHistory");
}
else
{
if (decompositionConstraint::debug)
{
Info<< type() << " : reading refinementHistory from time "
<< mesh.facesInstance() << endl;
}
storagePtr.reset
(
new refinementHistory
@ -120,6 +109,19 @@ void Foam::refinementHistoryConstraint::add
);
}
if (decompositionConstraint::debug)
{
if (refPtr)
{
Info<< type() << " : found refinementHistory" << nl;
}
else
{
Info<< type() << " : reading refinementHistory from time "
<< mesh.facesInstance() << nl;
}
}
const refinementHistory& history =
(
storagePtr.valid()
@ -151,24 +153,13 @@ void Foam::refinementHistoryConstraint::apply
labelList& decomposition
) const
{
autoPtr<const refinementHistory> storagePtr;
refinementHistory const* refPtr = nullptr;
const refinementHistory* refPtr =
mesh.findObject<refinementHistory>("refinementHistory");
if (mesh.foundObject<refinementHistory>("refinementHistory"))
autoPtr<const refinementHistory> storagePtr;
if (!refPtr)
{
//if (decompositionConstraint::debug)
//{
// Info<< type() << " : found refinementHistory" << endl;
//}
refPtr = &mesh.lookupObject<refinementHistory>("refinementHistory");
}
else
{
//if (decompositionConstraint::debug)
//{
// Info<< type() << " : reading refinementHistory from time "
// << mesh.facesInstance() << endl;
//}
storagePtr.reset
(
new refinementHistory

View File

@ -808,7 +808,7 @@ Foam::distributedTriSurfaceMesh::independentlyDistributedBbs
// here since we've only got Time and not a mesh.
const auto* dictPtr =
searchableSurface::time().lookupObjectPtr<IOdictionary>
searchableSurface::time().findObject<IOdictionary>
(
// == decompositionModel::canonicalName
"decomposeParDict"
@ -1914,13 +1914,11 @@ void Foam::distributedTriSurfaceMesh::getField
return;
}
if (foundObject<triSurfaceLabelField>("values"))
{
const triSurfaceLabelField& fld = lookupObject<triSurfaceLabelField>
(
"values"
);
const auto* fldPtr = findObject<triSurfaceLabelField>("values");
if (fldPtr)
{
const triSurfaceLabelField& fld = *fldPtr;
// Get query data (= local index of triangle)
// ~~~~~~~~~~~~~~