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

@ -260,13 +260,7 @@ public:
virtual volScalarField& he()
{
NotImplemented;
return
(
const_cast<volScalarField&>
(
volScalarField::null()
)
);
return const_cast<volScalarField&>(volScalarField::null());
}
//- Return access to the inernal energy field [J/Kg]
@ -274,10 +268,7 @@ public:
virtual const volScalarField& he() const
{
NotImplemented;
return
(
volScalarField::null()
);
return volScalarField::null();
}
//- Enthalpy/Internal energy

View File

@ -131,19 +131,15 @@ Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::heatTransfer() const
dimensionedScalar(dimensionSet(1,-1,-3,0,0), Zero)
);
if
(
otherPhase.mesh().foundObject<volScalarField>
const volScalarField* alphatPtr =
otherPhase.mesh().findObject<volScalarField>
(
"alphat." + otherPhase.name()
)
)
);
if (alphatPtr)
{
const volScalarField& alphat =
otherPhase.mesh().lookupObject<volScalarField>
(
"alphat." + otherPhase.name()
);
const volScalarField& alphat = *alphatPtr;
const fvPatchList& patches = this->mesh().boundary();
forAll(patches, patchi)
@ -427,19 +423,15 @@ void Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::correctThermo()
dimensionedScalar(dimDensity/dimTime, Zero)
);
if
(
phase2.mesh().foundObject<volScalarField>
const volScalarField* alphatPtr =
phase2.mesh().findObject<volScalarField>
(
"alphat." + phase2.name()
)
)
"alphat." + phase2.name()
);
if (alphatPtr)
{
const volScalarField& alphat =
phase2.mesh().lookupObject<volScalarField>
(
"alphat." + phase2.name()
);
const volScalarField& alphat = *alphatPtr;
const fvPatchList& patches = this->mesh().boundary();
forAll(patches, patchi)