diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C index 4d32e95ae..14098437e 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C @@ -422,7 +422,7 @@ Foam::GeometricField::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::GeometricField } +#ifndef NoConstructFromTmp +template class PatchField, class GeoMesh> +Foam::GeometricField::GeometricField +( + const IOobject& io, + const tmp>& tgf, + const wordList& patchFieldTypes, + const wordList& actualPatchTypes +) +: + DimensionedField + ( + io, + const_cast&>(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 PatchField, class GeoMesh> diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H index 7c47a526c..5c27f055d 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H @@ -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>&, + const wordList& patchFieldTypes, + const wordList& actualPatchTypes = wordList() + ); + #endif + //- Destructor virtual ~GeometricField();