mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: avoid raw dictionary lookup in functionObjects (issue #762)
Style changes:
- use lookupObjectRef instead of using const_cast
- use tmp::New factory
This commit is contained in:
@ -58,20 +58,17 @@ Foam::volScalarField& Foam::functionObjects::scalarTransport::transportedField()
|
||||
{
|
||||
if (!foundObject<volScalarField>(fieldName_))
|
||||
{
|
||||
tmp<volScalarField> tfldPtr
|
||||
auto tfldPtr = tmp<volScalarField>::New
|
||||
(
|
||||
new volScalarField
|
||||
IOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldName_,
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh_
|
||||
)
|
||||
fieldName_,
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh_
|
||||
);
|
||||
store(fieldName_, tfldPtr);
|
||||
|
||||
@ -81,10 +78,7 @@ Foam::volScalarField& Foam::functionObjects::scalarTransport::transportedField()
|
||||
}
|
||||
}
|
||||
|
||||
return const_cast<volScalarField&>
|
||||
(
|
||||
lookupObject<volScalarField>(fieldName_)
|
||||
);
|
||||
return lookupObjectRef<volScalarField>(fieldName_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user