mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
GeometricField: Added another constructor from tmp<GeometricField>
which supports re-using the internalField storage
This commit is contained in:
@ -422,7 +422,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
|
||||
if (debug)
|
||||
{
|
||||
InfoInFunction
|
||||
<< "Constructing as copy" << endl << this->info() << endl;
|
||||
<< "Constructing from tmp" << endl << this->info() << endl;
|
||||
}
|
||||
|
||||
this->writeOpt() = IOobject::NO_WRITE;
|
||||
@ -634,6 +634,47 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
|
||||
}
|
||||
|
||||
|
||||
#ifndef NoConstructFromTmp
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
|
||||
(
|
||||
const IOobject& io,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf,
|
||||
const wordList& patchFieldTypes,
|
||||
const wordList& actualPatchTypes
|
||||
)
|
||||
:
|
||||
DimensionedField<Type, GeoMesh>
|
||||
(
|
||||
io,
|
||||
const_cast<GeometricField<Type, PatchField, GeoMesh>&>(tgf()),
|
||||
tgf.isTmp()
|
||||
),
|
||||
timeIndex_(tgf().timeIndex()),
|
||||
field0Ptr_(NULL),
|
||||
fieldPrevIterPtr_(NULL),
|
||||
boundaryField_
|
||||
(
|
||||
this->mesh().boundary(),
|
||||
*this,
|
||||
patchFieldTypes,
|
||||
actualPatchTypes
|
||||
)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
InfoInFunction
|
||||
<< "Constructing from tmp resetting IO params and patch types"
|
||||
<< endl << this->info() << endl;
|
||||
}
|
||||
|
||||
boundaryField_ == tgf().boundaryField_;
|
||||
|
||||
tgf.clear();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
|
||||
@ -411,6 +411,17 @@ public:
|
||||
const wordList& actualPatchTypes = wordList()
|
||||
);
|
||||
|
||||
//- Construct as copy resetting IO parameters and boundary types
|
||||
#ifndef NoConstructFromTmp
|
||||
GeometricField
|
||||
(
|
||||
const IOobject&,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>&,
|
||||
const wordList& patchFieldTypes,
|
||||
const wordList& actualPatchTypes = wordList()
|
||||
);
|
||||
#endif
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~GeometricField();
|
||||
|
||||
Reference in New Issue
Block a user