mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -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()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user