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

@ -88,10 +88,7 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::scalarTransport::D
const surfaceScalarField& phi
) const
{
typedef incompressible::turbulenceModel icoModel;
typedef compressible::turbulenceModel cmpModel;
word Dname("D" + s.name());
const word Dname("D" + s.name());
if (constantD_)
{
@ -109,38 +106,49 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::scalarTransport::D
dimensionedScalar(Dname, phi.dimensions()/dimLength, D_)
);
}
else if (nutName_ != "none")
if (nutName_ != "none")
{
const volScalarField& nutMean =
mesh_.lookupObject<volScalarField>(nutName_);
return tmp<volScalarField>::New(Dname, nutMean);
}
else if (foundObject<icoModel>(turbulenceModel::propertiesName))
{
const icoModel& model = lookupObject<icoModel>
(
turbulenceModel::propertiesName
);
return tmp<volScalarField>::New
(
Dname,
alphaD_*model.nu() + alphaDt_*model.nut()
);
// Incompressible
{
const auto* turb =
findObject<incompressible::turbulenceModel>
(
turbulenceModel::propertiesName
);
if (turb)
{
return tmp<volScalarField>::New
(
Dname,
alphaD_ * turb->nu() + alphaDt_ * turb->nut()
);
}
}
else if (foundObject<cmpModel>(turbulenceModel::propertiesName))
{
const cmpModel& model = lookupObject<cmpModel>
(
turbulenceModel::propertiesName
);
return tmp<volScalarField>::New
(
Dname,
alphaD_*model.mu() + alphaDt_*model.mut()
);
// Compressible
{
const auto* turb =
findObject<compressible::turbulenceModel>
(
turbulenceModel::propertiesName
);
if (turb)
{
return tmp<volScalarField>::New
(
Dname,
alphaD_ * turb->mu() + alphaDt_ * turb->mut()
);
}
}