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

@ -37,7 +37,7 @@ bool Foam::functionObjects::fieldAverageItem::calculateMeanField
return false;
}
const Type* baseFieldPtr = obr.lookupObjectPtr<Type>(fieldName_);
const Type* baseFieldPtr = obr.findObject<Type>(fieldName_);
if (!baseFieldPtr)
{
@ -122,7 +122,7 @@ bool Foam::functionObjects::fieldAverageItem::calculateMeanField
{
const word& fieldName = nameIter();
const scalar dt = timeIter();
const Type* w = obr.lookupObjectPtr<Type>(fieldName);
const Type* w = obr.findObject<Type>(fieldName);
meanField += dt*(*w);
@ -173,7 +173,7 @@ bool Foam::functionObjects::fieldAverageItem::calculatePrime2MeanField
return false;
}
const Type1* baseFieldPtr = obr.lookupObjectPtr<Type1>(fieldName_);
const Type1* baseFieldPtr = obr.findObject<Type1>(fieldName_);
if (!baseFieldPtr)
{
@ -258,7 +258,7 @@ bool Foam::functionObjects::fieldAverageItem::calculatePrime2MeanField
{
const word& fieldName = nameIter();
const scalar dt = timeIter();
const Type1* w = obr.lookupObjectPtr<Type1>(fieldName);
const Type1* w = obr.findObject<Type1>(fieldName);
prime2MeanField += dt*(sqr((*w) - meanField));

View File

@ -119,7 +119,7 @@ void Foam::functionObjects::fieldAverage::restoreWindowFieldsType
const word& fieldName = item.fieldName();
const Type* fieldPtr = lookupObjectPtr<Type>(fieldName);
const Type* fieldPtr = findObject<Type>(fieldName);
if (!fieldPtr)
{