memory leak

This commit is contained in:
mattijs
2009-02-05 15:28:32 +00:00
parent 01fbf98dd2
commit 11176914d4
2 changed files with 28 additions and 22 deletions

View File

@ -81,7 +81,9 @@ Foam::phaseModel::phaseModel
{
Info<< "Reading face flux field " << phiName << endl;
phiPtr_ = new surfaceScalarField
phiPtr_.reset
(
new surfaceScalarField
(
IOobject
(
@ -92,6 +94,7 @@ Foam::phaseModel::phaseModel
IOobject::AUTO_WRITE
),
mesh
)
);
}
else
@ -112,7 +115,9 @@ Foam::phaseModel::phaseModel
}
}
phiPtr_ = new surfaceScalarField
phiPtr_.reset
(
new surfaceScalarField
(
IOobject
(
@ -124,6 +129,7 @@ Foam::phaseModel::phaseModel
),
fvc::interpolate(U_) & mesh.Sf(),
phiTypes
)
);
}
}

View File

@ -69,7 +69,7 @@ class phaseModel
volVectorField U_;
//- Fluxes
surfaceScalarField* phiPtr_;
autoPtr<surfaceScalarField> phiPtr_;
public:
@ -133,12 +133,12 @@ public:
const surfaceScalarField& phi() const
{
return *phiPtr_;
return phiPtr_();
}
surfaceScalarField& phi()
{
return *phiPtr_;
return phiPtr_();
}
};