mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: regIOobject store() now also registers the object
- previously the store() method just set the ownedByRegistry flag.
Now ensure that it is indeed registered first.
- support register/store of tmp<> items.
The tmp parameter is not cleared, but changed from PTR to CREF
to allow further use.
The implicit registration allows code simplification using the
GeometricField::New factory method, for example.
Old Code
========
volScalarField* ptr = new volScalarField
(
IOobject
(
fieldName,
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
true // Register
),
mesh,
dimless,
zeroGradientFvPatchField<scalar>::typeName
);
ptr->store();
New Code
========
auto tptr = volScalarField::New
(
fieldName,
mesh,
dimless,
zeroGradientFvPatchField<scalar>::typeName
);
regIOobject::store(tptr);
or even
regIOobject::store
(
volScalarField::New
(
fieldName,
mesh,
dimless,
zeroGradientFvPatchField<scalar>::typeName
)
);
This commit is contained in:
committed by
Mattijs Janssens
parent
12bd45673a
commit
b0072bfab8
@ -34,24 +34,17 @@ cellZoneID
|
||||
{
|
||||
if (!volZonePtr)
|
||||
{
|
||||
volZonePtr = new volScalarField
|
||||
volZonePtr = ®IOobject::store
|
||||
(
|
||||
IOobject
|
||||
volScalarField::New
|
||||
(
|
||||
fieldName,
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
true // Register
|
||||
),
|
||||
mesh,
|
||||
dimless,
|
||||
zeroGradientFvPatchField<scalar>::typeName
|
||||
dimless,
|
||||
zeroGradientFvPatchField<scalar>::typeName
|
||||
)
|
||||
);
|
||||
|
||||
volZonePtr->store();
|
||||
|
||||
Info<< "Creating " << fieldName
|
||||
<< " field for postProcessing" << nl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user