diff --git a/src/finiteArea/faMatrices/faMatrix/faMatrix.C b/src/finiteArea/faMatrices/faMatrix/faMatrix.C index 074cc0693a88ec08fc4bf641bba6baacdaab338e..4d06db262d2ac0c95e62f3bd331936cfda249774 100644 --- a/src/finiteArea/faMatrices/faMatrix/faMatrix.C +++ b/src/finiteArea/faMatrices/faMatrix/faMatrix.C @@ -1207,7 +1207,7 @@ Foam::tmp<Foam::faMatrix<Type>> Foam::operator+ ) { checkMethod(A, B, "+"); - tmp<faMatrix<Type>> tC(new faMatrix<Type>(A)); + auto tC = tmp<faMatrix<Type>>::New(A); tC.ref() += B; return tC; } @@ -1262,7 +1262,7 @@ Foam::tmp<Foam::faMatrix<Type>> Foam::operator- const faMatrix<Type>& A ) { - tmp<faMatrix<Type>> tC(new faMatrix<Type>(A)); + auto tC = tmp<faMatrix<Type>>::New(A); tC.ref().negate(); return tC; } @@ -1288,7 +1288,7 @@ Foam::tmp<Foam::faMatrix<Type>> Foam::operator- ) { checkMethod(A, B, "-"); - tmp<faMatrix<Type>> tC(new faMatrix<Type>(A)); + auto tC = tmp<faMatrix<Type>>::New(A); tC.ref() -= B; return tC; } diff --git a/src/finiteArea/faMatrices/faMatrix/faMatrixSolve.C b/src/finiteArea/faMatrices/faMatrix/faMatrixSolve.C index 87d5ef0e03d90717476d6eb160d52ac195b25dc0..600adc3ce068441fe1644627685bb47cc34248f9 100644 --- a/src/finiteArea/faMatrices/faMatrix/faMatrixSolve.C +++ b/src/finiteArea/faMatrices/faMatrix/faMatrixSolve.C @@ -192,8 +192,8 @@ Foam::SolverPerformance<Type> Foam::faMatrix<Type>::solve() template<class Type> Foam::tmp<Foam::Field<Type>> Foam::faMatrix<Type>::residual() const { - tmp<Field<Type>> tres(new Field<Type>(source_)); - Field<Type>& res = tres().ref(); + auto tres = tmp<Field<Type>>::New(source_); + auto& res = tres().ref(); addBoundarySource(res); diff --git a/src/finiteArea/fields/faPatchFields/basic/fixedValue/fixedValueFaPatchField.C b/src/finiteArea/fields/faPatchFields/basic/fixedValue/fixedValueFaPatchField.C index 728fa8e89b12a681cffb7ecf543b30951ffd7fc8..f4d1e26592db3e0f8246c75b972c70ef1a3af1ca 100644 --- a/src/finiteArea/fields/faPatchFields/basic/fixedValue/fixedValueFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/basic/fixedValue/fixedValueFaPatchField.C @@ -108,10 +108,7 @@ Foam::fixedValueFaPatchField<Type>::valueInternalCoeffs const tmp<scalarField>& ) const { - return tmp<Field<Type>> - ( - new Field<Type>(this->size(), Zero) - ); + return tmp<Field<Type>>::New(this->size(), Foam::zero{}); } diff --git a/src/finiteArea/fields/faPatchFields/constraint/cyclic/cyclicFaPatchField.C b/src/finiteArea/fields/faPatchFields/constraint/cyclic/cyclicFaPatchField.C index 8aa6296aa070fc2d64e6174c1e091c010209942d..70b711375f2fc7ac143a0dd81f61e83cad26bdee 100644 --- a/src/finiteArea/fields/faPatchFields/constraint/cyclic/cyclicFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/constraint/cyclic/cyclicFaPatchField.C @@ -130,8 +130,8 @@ Foam::cyclicFaPatchField<Type>::patchNeighbourField() const const Field<Type>& iField = this->primitiveField(); const labelUList& faceCells = cyclicPatch_.faceCells(); - tmp<Field<Type>> tpnf(new Field<Type>(this->size())); - Field<Type>& pnf = tpnf.ref(); + auto tpnf = tmp<Field<Type>>::New(this->size()); + auto& pnf = tpnf.ref(); const label sizeby2 = this->size()/2; diff --git a/src/finiteArea/fields/faPatchFields/constraint/wedge/wedgeFaPatchField.C b/src/finiteArea/fields/faPatchFields/constraint/wedge/wedgeFaPatchField.C index e9bd75e3ff6df878af35b33d6928d8bc0d9c5d1f..d3e5c31d78d7b36305db99619e9534b0692c58de 100644 --- a/src/finiteArea/fields/faPatchFields/constraint/wedge/wedgeFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/constraint/wedge/wedgeFaPatchField.C @@ -143,19 +143,18 @@ Foam::wedgeFaPatchField<Type>::snGradTransformDiag() const const vector diagV(diagT.xx(), diagT.yy(), diagT.zz()); - return tmp<Field<Type>> + return tmp<Field<Type>>::New ( - new Field<Type> + this->size(), + transformMask<Type> ( - this->size(), - transformMask<Type> + pow ( - pow - ( - diagV, - pTraits<typename powProduct<vector, pTraits<Type>::rank> - ::type>::zero - ) + diagV, + pTraits + < + typename powProduct<vector, pTraits<Type>::rank>::type + >::zero ) ) ); diff --git a/src/finiteArea/fields/faPatchFields/derived/clampedPlate/clampedPlateFaPatchField.H b/src/finiteArea/fields/faPatchFields/derived/clampedPlate/clampedPlateFaPatchField.H index 828937bb6ca82d82183a11cc5f29815513f9d43c..4cb191c158f54cffd75c61227f80b2cf766a28b5 100644 --- a/src/finiteArea/fields/faPatchFields/derived/clampedPlate/clampedPlateFaPatchField.H +++ b/src/finiteArea/fields/faPatchFields/derived/clampedPlate/clampedPlateFaPatchField.H @@ -149,10 +149,7 @@ public: //- Return gradient at boundary virtual tmp<Field<Type>> snGrad() const { - return tmp<Field<Type>> - ( - new Field<Type>(this->size(), Zero) - ); + return tmp<Field<Type>>::New(this->size(), Foam::zero{}); } //- Evaluate the patch field diff --git a/src/finiteArea/fields/faPatchFields/derived/fixedValueOutflow/fixedValueOutflowFaPatchField.C b/src/finiteArea/fields/faPatchFields/derived/fixedValueOutflow/fixedValueOutflowFaPatchField.C index 3b04c3fbbdb414d6598b9dd878555774df8ac493..b9d26257fb837d06ebcd1f4074988263a1b84682 100644 --- a/src/finiteArea/fields/faPatchFields/derived/fixedValueOutflow/fixedValueOutflowFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/derived/fixedValueOutflow/fixedValueOutflowFaPatchField.C @@ -95,10 +95,7 @@ Foam::fixedValueOutflowFaPatchField<Type>::valueInternalCoeffs const tmp<scalarField>& weights ) const { - return tmp<Field<Type>> - ( - new Field<Type>(Type(pTraits<Type>::one)*weights) - ); + return pTraits<Type>::one*weights; } diff --git a/src/finiteArea/fields/faePatchFields/faePatchField/faePatchField.H b/src/finiteArea/fields/faePatchFields/faePatchField/faePatchField.H index 96428b68fd42c36cabc32c8b98de4f529bf38d4a..fd1c318d8e8b5451377a4794b52ed86819eefa87 100644 --- a/src/finiteArea/fields/faePatchFields/faePatchField/faePatchField.H +++ b/src/finiteArea/fields/faePatchFields/faePatchField/faePatchField.H @@ -377,10 +377,7 @@ public: const DimensionedField<Type, edgeMesh>& iF ) const { - return tmp<faePatchField<Type>> - ( - new faePatchField<Type>(*this, iF) - ); + return tmp<faePatchField<Type>>::New(*this, iF); } diff --git a/src/finiteArea/finiteArea/divSchemes/faDivScheme/faDivScheme.C b/src/finiteArea/finiteArea/divSchemes/faDivScheme/faDivScheme.C index ee05ffe259ff5059a4bace0948d7857d70b0d748..6d85dfafd9b09ec162499269709a87872e4197c1 100644 --- a/src/finiteArea/finiteArea/divSchemes/faDivScheme/faDivScheme.C +++ b/src/finiteArea/finiteArea/divSchemes/faDivScheme/faDivScheme.C @@ -34,9 +34,6 @@ License namespace Foam { - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - namespace fa { @@ -84,19 +81,9 @@ tmp<divScheme<Type>> divScheme<Type>::New } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -divScheme<Type>::~divScheme() -{} - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace fa - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - } // End namespace Foam // ************************************************************************* // diff --git a/src/finiteArea/finiteArea/divSchemes/faDivScheme/faDivScheme.H b/src/finiteArea/finiteArea/divSchemes/faDivScheme/faDivScheme.H index 56f4abc5342b453db51a2bbf03fa2b6e88447add..47414a91231ad19cf6aff89bf50e02f4606b3131 100644 --- a/src/finiteArea/finiteArea/divSchemes/faDivScheme/faDivScheme.H +++ b/src/finiteArea/finiteArea/divSchemes/faDivScheme/faDivScheme.H @@ -35,8 +35,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef faDivScheme_H -#define faDivScheme_H +#ifndef Foam_faDivScheme_H +#define Foam_faDivScheme_H #include "tmp.H" #include "areaFieldsFwd.H" @@ -50,9 +50,8 @@ SourceFiles namespace Foam { -template<class Type> -class faMatrix; - +// Forward Declarations +template<class Type> class faMatrix; class faMesh; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -69,12 +68,12 @@ class divScheme : public refCount { - protected: - // Protected data + // Protected Data const faMesh& mesh_; + tmp<edgeInterpolationScheme<Type>> tinterpScheme_; @@ -113,9 +112,23 @@ public: //- Construct from mesh and Istream divScheme(const faMesh& mesh, Istream& is) : - mesh_(mesh), - tinterpScheme_(edgeInterpolationScheme<Type>::New(mesh, is)) - {} + mesh_(mesh) + { + if (is.eof()) + { + tinterpScheme_.reset + ( + new linearEdgeInterpolation<Type>(mesh) + ); + } + else + { + tinterpScheme_.reset + ( + edgeInterpolationScheme<Type>::New(mesh, is) + ); + } + } // Selectors @@ -129,7 +142,7 @@ public: //- Destructor - virtual ~divScheme(); + virtual ~divScheme() = default; // Member Functions diff --git a/src/finiteArea/finiteArea/divSchemes/gaussFaDivScheme/gaussFaDivScheme.H b/src/finiteArea/finiteArea/divSchemes/gaussFaDivScheme/gaussFaDivScheme.H index d92add74ee8a543d4966914facb5ca3570cb8f5c..98e834128fec5c4f7643625a0af22e8ab2c9598d 100644 --- a/src/finiteArea/finiteArea/divSchemes/gaussFaDivScheme/gaussFaDivScheme.H +++ b/src/finiteArea/finiteArea/divSchemes/gaussFaDivScheme/gaussFaDivScheme.H @@ -76,7 +76,7 @@ public: // Constructors - //- Construct null + //- Construct from mesh gaussDivScheme(const faMesh& mesh) : divScheme<Type>(mesh) diff --git a/src/finiteArea/finiteArea/gradSchemes/gaussFaGrad/gaussFaGrad.H b/src/finiteArea/finiteArea/gradSchemes/gaussFaGrad/gaussFaGrad.H index f0348ffdda9bfa5a28c79c9d050a158686759b1d..59fc08d91d46ff7e2b5f16808fdcbf86f5189d37 100644 --- a/src/finiteArea/finiteArea/gradSchemes/gaussFaGrad/gaussFaGrad.H +++ b/src/finiteArea/finiteArea/gradSchemes/gaussFaGrad/gaussFaGrad.H @@ -37,8 +37,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef gaussFaGrad_H -#define gaussFaGrad_H +#ifndef Foam_gaussFaGrad_H +#define Foam_gaussFaGrad_H #include "faGradScheme.H" #include "edgeInterpolationScheme.H" @@ -96,24 +96,21 @@ public: //- Construct from Istream gaussGrad(const faMesh& mesh, Istream& is) : - gradScheme<Type>(mesh), - tinterpScheme_(nullptr) + gradScheme<Type>(mesh) { if (is.eof()) { - tinterpScheme_ = - tmp<edgeInterpolationScheme<Type>> - ( - new linearEdgeInterpolation<Type>(mesh) - ); + tinterpScheme_.reset + ( + new linearEdgeInterpolation<Type>(mesh) + ); } else { - tinterpScheme_ = - tmp<edgeInterpolationScheme<Type>> - ( - edgeInterpolationScheme<Type>::New(mesh, is) - ); + tinterpScheme_.reset + ( + edgeInterpolationScheme<Type>::New(mesh, is) + ); } } diff --git a/src/finiteArea/finiteArea/laplacianSchemes/faLaplacianScheme/faLaplacianScheme.H b/src/finiteArea/finiteArea/laplacianSchemes/faLaplacianScheme/faLaplacianScheme.H index 01a1e3478722bec254f9af5746401aa198385f3b..009d2a8001487124a050166cfa0d7fd7176456b3 100644 --- a/src/finiteArea/finiteArea/laplacianSchemes/faLaplacianScheme/faLaplacianScheme.H +++ b/src/finiteArea/finiteArea/laplacianSchemes/faLaplacianScheme/faLaplacianScheme.H @@ -35,8 +35,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef faLaplacianScheme_H -#define faLaplacianScheme_H +#ifndef Foam_faLaplacianScheme_H +#define Foam_faLaplacianScheme_H #include "tmp.H" #include "areaFieldsFwd.H" @@ -51,9 +51,8 @@ SourceFiles namespace Foam { -template<class Type> -class faMatrix; - +// Forward Declarations +template<class Type> class faMatrix; class faMesh; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -70,12 +69,12 @@ class laplacianScheme : public refCount { - protected: - // Protected data + // Protected Data const faMesh& mesh_; + tmp<edgeInterpolationScheme<scalar>> tinterpGammaScheme_; tmp<lnGradScheme<Type>> tlnGradScheme_; @@ -116,30 +115,28 @@ public: //- Construct from mesh and Istream laplacianScheme(const faMesh& mesh, Istream& is) : - mesh_(mesh), - tinterpGammaScheme_(nullptr), - tlnGradScheme_(nullptr) + mesh_(mesh) { if (is.eof()) { - tinterpGammaScheme_ = tmp<edgeInterpolationScheme<scalar>> + tinterpGammaScheme_.reset ( new linearEdgeInterpolation<scalar>(mesh) ); - tlnGradScheme_ = tmp<lnGradScheme<Type>> + tlnGradScheme_.reset ( new correctedLnGrad<Type>(mesh) ); } else { - tinterpGammaScheme_ = tmp<edgeInterpolationScheme<scalar>> + tinterpGammaScheme_.reset ( edgeInterpolationScheme<scalar>::New(mesh, is) ); - tlnGradScheme_ = tmp<lnGradScheme<Type>> + tlnGradScheme_.reset ( lnGradScheme<Type>::New(mesh, is) ); @@ -218,11 +215,11 @@ public: \ namespace Foam \ { \ - namespace fa \ - { \ - laplacianScheme<Type>::addIstreamConstructorToTable<SS<Type>> \ - add##SS##Type##IstreamConstructorToTable_; \ - } \ + namespace fa \ + { \ + laplacianScheme<Type>::addIstreamConstructorToTable<SS<Type>> \ + add##SS##Type##IstreamConstructorToTable_; \ + } \ } diff --git a/src/finiteArea/finiteArea/laplacianSchemes/gaussFaLaplacianScheme/gaussFaLaplacianScheme.H b/src/finiteArea/finiteArea/laplacianSchemes/gaussFaLaplacianScheme/gaussFaLaplacianScheme.H index fac32562ccbf73f0effee23cd5a02a3dc5566f4f..7da23957004659a9fae23dc5c21288ba1a016b4c 100644 --- a/src/finiteArea/finiteArea/laplacianSchemes/gaussFaLaplacianScheme/gaussFaLaplacianScheme.H +++ b/src/finiteArea/finiteArea/laplacianSchemes/gaussFaLaplacianScheme/gaussFaLaplacianScheme.H @@ -35,8 +35,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef gaussFaLaplacianScheme_H -#define gaussFaLaplacianScheme_H +#ifndef Foam_gaussFaLaplacianScheme_H +#define Foam_gaussFaLaplacianScheme_H #include "faLaplacianScheme.H" @@ -76,7 +76,7 @@ public: // Constructors - //- Construct null + //- Construct from mesh gaussLaplacianScheme(const faMesh& mesh) : laplacianScheme<Type>(mesh) diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZoneList.C b/src/finiteVolume/cfdTools/general/MRF/MRFZoneList.C index c3b4084131433d013942a974a76d6b14b1901d9a..a66957b9ec8ced3faa1f7b1d1c8454b779724a13 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZoneList.C +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZoneList.C @@ -188,18 +188,13 @@ Foam::tmp<Foam::volVectorField> Foam::MRFZoneList::DDt const volVectorField& U ) const { - auto tacceleration = - tmp<volVectorField>::New - ( - IOobject - ( - "MRFZoneList:acceleration", - U.mesh().time().timeName(), - U.mesh().thisDb() - ), - U.mesh(), - dimensionedVector(U.dimensions()/dimTime, Zero) - ); + auto tacceleration = volVectorField::New + ( + IOobject::scopedName("MRFZoneList", "acceleration"), + IOobject::NO_REGISTER, + U.mesh(), + dimensionedVector(U.dimensions()/dimTime, Zero) + ); auto& acceleration = tacceleration.ref(); for (const auto& mrf: *this) @@ -263,10 +258,8 @@ Foam::tmp<Foam::surfaceScalarField> Foam::MRFZoneList::relative return rphi; } - else - { - return tmp<surfaceScalarField>(tphi, true); - } + + return tmp<surfaceScalarField>(tphi, true); } @@ -289,10 +282,8 @@ Foam::MRFZoneList::relative return rphi; } - else - { - return tmp<FieldField<fvsPatchField, scalar>>(tphi, true); - } + + return tmp<FieldField<fvsPatchField, scalar>>(tphi, true); } @@ -316,10 +307,8 @@ Foam::MRFZoneList::relative return rphi; } - else - { - return tmp<Field<scalar>>(tphi, true); - } + + return tmp<Field<scalar>>(tphi, true); } @@ -378,10 +367,8 @@ Foam::tmp<Foam::surfaceScalarField> Foam::MRFZoneList::absolute return rphi; } - else - { - return tmp<surfaceScalarField>(tphi, true); - } + + return tmp<surfaceScalarField>(tphi, true); } diff --git a/src/finiteVolume/cfdTools/general/SRF/SRFModel/SRFModel/SRFModel.C b/src/finiteVolume/cfdTools/general/SRF/SRFModel/SRFModel/SRFModel.C index 683f2a9c66b73fc19a4e4dd98aa8957edec93006..58b002be2d3645813543aba5018dcca612ef0a85 100644 --- a/src/finiteVolume/cfdTools/general/SRF/SRFModel/SRFModel/SRFModel.C +++ b/src/finiteVolume/cfdTools/general/SRF/SRFModel/SRFModel/SRFModel.C @@ -55,8 +55,9 @@ Foam::SRF::SRFModel::SRFModel "SRFProperties", Urel.time().constant(), Urel.db(), - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE + IOobject::READ_MODIFIED, + IOobject::NO_WRITE, + IOobject::REGISTER ) ), Urel_(Urel), @@ -118,19 +119,12 @@ const Foam::dimensionedVector& Foam::SRF::SRFModel::omega() const Foam::tmp<Foam::DimensionedField<Foam::vector, Foam::volMesh>> Foam::SRF::SRFModel::Fcoriolis() const { - return tmp<volVectorField::Internal> + return volVectorField::Internal::New ( - new volVectorField::Internal + "Fcoriolis", + IOobject::NO_REGISTER, ( - IOobject - ( - "Fcoriolis", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - 2.0*omega_ ^ Urel_ + 2.0*omega_ ^ Urel_.internalField() ) ); } @@ -139,18 +133,11 @@ Foam::SRF::SRFModel::Fcoriolis() const Foam::tmp<Foam::DimensionedField<Foam::vector, Foam::volMesh>> Foam::SRF::SRFModel::Fcentrifugal() const { - return tmp<volVectorField::Internal> + return volVectorField::Internal::New ( - new volVectorField::Internal + "Fcentrifugal", + IOobject::NO_REGISTER, ( - IOobject - ( - "Fcentrifugal", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), omega_ ^ (omega_ ^ (mesh_.C().internalField() - origin_)) ) ); @@ -169,14 +156,14 @@ Foam::vectorField Foam::SRF::SRFModel::velocity const vectorField& positions ) const { - tmp<vectorField> tfld = + return vectorField + ( omega_.value() ^ ( (positions - origin_.value()) - axis_*(axis_ & (positions - origin_.value())) - ); - - return tfld(); + ) + ); } @@ -186,18 +173,11 @@ Foam::tmp<Foam::volVectorField> Foam::SRF::SRFModel::U() const volVectorField::Boundary::localConsistency = 0; tmp<volVectorField> relPos(mesh_.C() - origin_); - tmp<volVectorField> tU + auto tU = volVectorField::New ( - new volVectorField + "Usrf", + IOobject::NO_REGISTER, ( - IOobject - ( - "Usrf", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), omega_ ^ (relPos() - axis_*(axis_ & relPos())) ) ); @@ -211,24 +191,13 @@ Foam::tmp<Foam::volVectorField> Foam::SRF::SRFModel::Uabs() const { tmp<volVectorField> Usrf = U(); - tmp<volVectorField> tUabs + auto tUabs = volVectorField::New ( - new volVectorField - ( - IOobject - ( - "Uabs", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - Usrf - ) + "Uabs", + IOobject::NO_REGISTER, + Usrf ); - - volVectorField& Uabs = tUabs.ref(); + auto& Uabs = tUabs.ref(); // Add SRF contribution to internal field Uabs.primitiveFieldRef() += Urel_.primitiveField(); diff --git a/src/finiteVolume/cfdTools/general/fvOptions/fvOptionListTemplates.C b/src/finiteVolume/cfdTools/general/fvOptions/fvOptionListTemplates.C index 8112e1c6899be879ecd575621fb95697f4408304..201ecb634dcf275c928459b43ad8db8d5971e10e 100644 --- a/src/finiteVolume/cfdTools/general/fvOptions/fvOptionListTemplates.C +++ b/src/finiteVolume/cfdTools/general/fvOptions/fvOptionListTemplates.C @@ -42,8 +42,8 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::fv::optionList::source { checkApplied(); - tmp<fvMatrix<Type>> tmtx(new fvMatrix<Type>(field, ds)); - fvMatrix<Type>& mtx = tmtx.ref(); + auto tmtx = tmp<fvMatrix<Type>>::New(field, ds); + auto& mtx = tmtx.ref(); for (fv::option& source : *this) { @@ -129,8 +129,8 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::fv::optionList::operator() rho.dimensions()*field.dimensions()/dimTime*dimVolume ); - tmp<fvMatrix<Type>> tmtx(new fvMatrix<Type>(field, ds)); - fvMatrix<Type>& mtx = tmtx.ref(); + auto tmtx = tmp<fvMatrix<Type>>::New(field, ds); + auto& mtx = tmtx.ref(); for (fv::option& source : *this) { @@ -198,8 +198,8 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::fv::optionList::operator() /dimTime*dimVolume ); - tmp<fvMatrix<Type>> tmtx(new fvMatrix<Type>(field, ds)); - fvMatrix<Type>& mtx = tmtx.ref(); + auto tmtx = tmp<fvMatrix<Type>>::New(field, ds); + auto& mtx = tmtx.ref(); for (fv::option& source : *this) { diff --git a/src/finiteVolume/cfdTools/general/levelSet/levelSet.C b/src/finiteVolume/cfdTools/general/levelSet/levelSet.C index 4e800b71a01acc79d9f6d126756cc74abe4b4408..2dcea81c816f65ab3bf03b9865c3828202f79da3 100644 --- a/src/finiteVolume/cfdTools/general/levelSet/levelSet.C +++ b/src/finiteVolume/cfdTools/general/levelSet/levelSet.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2017 OpenFOAM Foundation - Copyright (C) 2021 OpenCFD Ltd. + Copyright (C) 2021-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -42,21 +42,14 @@ Foam::levelSetFraction const bool above ) { - tmp<DimensionedField<scalar, volMesh>> tResult + auto tResult = DimensionedField<scalar, volMesh>::New ( - new DimensionedField<scalar, volMesh> - ( - IOobject - ( - "levelSetFraction", - mesh.time().timeName(), - mesh - ), - mesh, - dimensionedScalar(dimless, Zero) - ) + "levelSetFraction", + IOobject::NO_REGISTER, + mesh, + dimensionedScalar(dimless, Zero) ); - DimensionedField<scalar, volMesh>& result = tResult.ref(); + auto& result = tResult.ref(); forAll(result, cI) { @@ -113,8 +106,8 @@ Foam::tmp<Foam::scalarField> Foam::levelSetFraction const bool above ) { - tmp<scalarField> tResult(new scalarField(patch.size(), Zero)); - scalarField& result = tResult.ref(); + auto tResult = tmp<scalarField>::New(patch.size(), Zero); + auto& result = tResult.ref(); forAll(result, fI) { diff --git a/src/finiteVolume/cfdTools/general/levelSet/levelSetTemplates.C b/src/finiteVolume/cfdTools/general/levelSet/levelSetTemplates.C index f5e154f93b45769f712ecb8cc5e1318cf44a18ab..17b8e935ac7818d3f01d3b913199338017412e1e 100644 --- a/src/finiteVolume/cfdTools/general/levelSet/levelSetTemplates.C +++ b/src/finiteVolume/cfdTools/general/levelSet/levelSetTemplates.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2017 OpenFOAM Foundation - Copyright (C) 2021 OpenCFD Ltd. + Copyright (C) 2021-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -45,21 +45,14 @@ Foam::tmp<Foam::DimensionedField<Type, Foam::volMesh>> Foam::levelSetAverage const DimensionedField<Type, pointMesh>& negativeP ) { - tmp<DimensionedField<Type, volMesh>> tResult + auto tresult = DimensionedField<Type, volMesh>::New ( - new DimensionedField<Type, volMesh> - ( - IOobject - ( - positiveC.name() + ":levelSetAverage", - mesh.time().timeName(), - mesh - ), - mesh, - dimensioned<Type>(positiveC.dimensions(), Zero) - ) + IOobject::scopedName(positiveC.name(), "levelSetAverage"), + mesh, + Foam::zero{}, // value + positiveC.dimensions() ); - DimensionedField<Type, volMesh>& result = tResult.ref(); + auto& result = tresult.ref(); forAll(result, cI) { @@ -114,7 +107,7 @@ Foam::tmp<Foam::DimensionedField<Type, Foam::volMesh>> Foam::levelSetAverage result[cI] = r/v; } - return tResult; + return tresult; } @@ -132,8 +125,8 @@ Foam::tmp<Foam::Field<Type>> Foam::levelSetAverage { typedef typename outerProduct<Type, vector>::type sumType; - tmp<Field<Type>> tResult(new Field<Type>(patch.size(), Zero)); - Field<Type>& result = tResult.ref(); + auto tResult = tmp<Field<Type>>::New(patch.size(), Zero); + auto& result = tResult.ref(); forAll(result, fI) { diff --git a/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.C b/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.C index 2ac51692d2b85ff4422ea1b72a74344dd5e35e2d..5fbe22d28469d72997c1acd28d9cd351ed9e3f8d 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.C +++ b/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.C @@ -126,32 +126,18 @@ void Foam::porosityModels::DarcyForchheimer::calcTransformModelData() { volTensorField Dout ( - IOobject - ( - typeName + ":D", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), + mesh_.newIOobject(IOobject::scopedName(typeName, "D")), mesh_, dimensionedTensor(dXYZ_.dimensions(), Zero) ); + volTensorField Fout ( - IOobject - ( - typeName + ":F", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), + mesh_.newIOobject(IOobject::scopedName(typeName, "F")), mesh_, dimensionedTensor(fXYZ_.dimensions(), Zero) ); - forAll(cellZoneIDs_, zonei) { const labelList& cells = mesh_.cellZones()[cellZoneIDs_[zonei]]; diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C index 283e46f9aebd5e0b404fe2f47324314b9edc3f6d..eb4ea67311ed52c0a1bcabfc440c449c78f663ff 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C @@ -173,7 +173,7 @@ Foam::tmp<Foam::vectorField> Foam::porosityModel::porosityModel::force { transformModelData(); - tmp<vectorField> tforce(new vectorField(U.size(), Zero)); + auto tforce = tmp<vectorField>::New(U.size(), Zero); if (!cellZoneIDs_.empty()) { diff --git a/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.C index dd3731399d8a41abfc35bcef343700b5a4326cb8..8a567b715084e293fc3a2c39659157adcbd48c68 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.C @@ -119,10 +119,7 @@ Foam::fixedValueFvPatchField<Type>::valueInternalCoeffs const tmp<scalarField>& ) const { - return tmp<Field<Type>> - ( - new Field<Type>(this->size(), Zero) - ); + return tmp<Field<Type>>::New(this->size(), Foam::zero{}); } diff --git a/src/finiteVolume/fields/fvPatchFields/basic/zeroGradient/zeroGradientFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/zeroGradient/zeroGradientFvPatchField.C index 65f532974fcb76b2fd4c80d96c8d17d8632b590f..e7aad92d1acc1c6b928074f0cd9018071f62320a 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/zeroGradient/zeroGradientFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/zeroGradient/zeroGradientFvPatchField.C @@ -112,10 +112,7 @@ Foam::zeroGradientFvPatchField<Type>::valueInternalCoeffs const tmp<scalarField>& ) const { - return tmp<Field<Type>> - ( - new Field<Type>(this->size(), pTraits<Type>::one) - ); + return tmp<Field<Type>>::New(this->size(), pTraits<Type>::one); } @@ -126,10 +123,7 @@ Foam::zeroGradientFvPatchField<Type>::valueBoundaryCoeffs const tmp<scalarField>& ) const { - return tmp<Field<Type>> - ( - new Field<Type>(this->size(), Zero) - ); + return tmp<Field<Type>>::New(this->size(), Foam::zero{}); } @@ -137,10 +131,7 @@ template<class Type> Foam::tmp<Foam::Field<Type>> Foam::zeroGradientFvPatchField<Type>::gradientInternalCoeffs() const { - return tmp<Field<Type>> - ( - new Field<Type>(this->size(), Zero) - ); + return tmp<Field<Type>>::New(this->size(), Foam::zero{}); } @@ -148,10 +139,7 @@ template<class Type> Foam::tmp<Foam::Field<Type>> Foam::zeroGradientFvPatchField<Type>::gradientBoundaryCoeffs() const { - return tmp<Field<Type>> - ( - new Field<Type>(this->size(), Zero) - ); + return tmp<Field<Type>>::New(this->size(), Foam::zero{}); } diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C index 0d6dac5c1564422a277a4c5aa3fd942835817a0d..487bdb8dff59a34fd3ac5ce3c3057ee7455a63fa 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C @@ -134,8 +134,8 @@ Foam::cyclicFvPatchField<Type>::patchNeighbourField() const const labelUList& nbrFaceCells = cyclicPatch().cyclicPatch().neighbPatch().faceCells(); - tmp<Field<Type>> tpnf(new Field<Type>(this->size())); - Field<Type>& pnf = tpnf.ref(); + auto tpnf = tmp<Field<Type>>::New(this->size()); + auto& pnf = tpnf.ref(); if (doTransform()) diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.C index 3bc1a504bb374af1ec2aa75ab8ea5a3224690ab5..bda508ab3184bc428cbf77d54efd689799aba519 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicACMI/cyclicACMIFvPatchField.C @@ -881,7 +881,8 @@ Foam::cyclicACMIFvPatchField<Type>::coeffs matrix.lduMeshAssembly().cellBoundMap()[mat][index].size() ); - Field<scalar> mapCoeffs(nSubFaces, Zero); + auto tmapCoeffs = tmp<Field<scalar>>::New(nSubFaces, Zero); + auto& mapCoeffs = tmapCoeffs.ref(); const scalarListList& srcWeight = cyclicACMIPatch_.cyclicACMIPatch().AMI().srcWeights(); @@ -906,7 +907,7 @@ Foam::cyclicACMIFvPatchField<Type>::coeffs } } - return tmp<Field<scalar>>(new Field<scalar>(mapCoeffs)); + return tmapCoeffs; } diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/symmetryPlane/symmetryPlaneFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/symmetryPlane/symmetryPlaneFvPatchField.C index 53851b7e0073a49f26f38f61af8158f10034f946..b83f6c80a96ebc7d361df67f96fcd6e4743d7640 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/symmetryPlane/symmetryPlaneFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/symmetryPlane/symmetryPlaneFvPatchField.C @@ -157,27 +157,21 @@ Foam::symmetryPlaneFvPatchField<Type>::snGradTransformDiag() const { vector nHat(symmetryPlanePatch_.n()); - const vector diag - ( - mag(nHat.component(vector::X)), - mag(nHat.component(vector::Y)), - mag(nHat.component(vector::Z)) - ); + const vector diag(mag(nHat.x()), mag(nHat.y()), mag(nHat.z())); - return tmp<Field<Type>> + return tmp<Field<Type>>::New ( - new Field<Type> + this->size(), + transformMask<Type> ( - this->size(), - transformMask<Type> + //pow<vector, pTraits<Type>::rank>(diag) + pow ( - //pow<vector, pTraits<Type>::rank>(diag) - pow - ( - diag, - pTraits<typename powProduct<vector, pTraits<Type>::rank> - ::type>::zero - ) + diag, + pTraits + < + typename powProduct<vector, pTraits<Type>::rank>::type + >::zero ) ) ); diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/wedge/wedgeFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/wedge/wedgeFvPatchField.C index 8d63c8a5d8631b431fcc1429a84b8be8a772076e..e3fd64d58d2c4d87511e6137efd6a2680158bb0e 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/wedge/wedgeFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/wedge/wedgeFvPatchField.C @@ -157,19 +157,18 @@ Foam::wedgeFvPatchField<Type>::snGradTransformDiag() const const vector diagV(diagT.xx(), diagT.yy(), diagT.zz()); - return tmp<Field<Type>> + return tmp<Field<Type>>::New ( - new Field<Type> + this->size(), + transformMask<Type> ( - this->size(), - transformMask<Type> + pow ( - pow - ( - diagV, - pTraits<typename powProduct<vector, pTraits<Type>::rank> - ::type>::zero - ) + diagV, + pTraits + < + typename powProduct<vector, pTraits<Type>::rank>::type + >::zero ) ) ); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedPatchFieldBase.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedPatchFieldBase.C index 117913ff8e746a4c2b4b4ba3803212aa68576873..786ab2511b841e255c7eed0c7c2667bfd324a12b 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedPatchFieldBase.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedPatchFieldBase.C @@ -821,8 +821,8 @@ Foam::tmp<Foam::Field<Type>> Foam::mappedPatchFieldBase<Type>::mappedInternalField() const { // Swap to obtain full local values of neighbour internal field - tmp<Field<Type>> tnbrIntFld(new Field<Type>()); - Field<Type>& nbrIntFld = tnbrIntFld.ref(); + auto tnbrIntFld = tmp<Field<Type>>::New(); + auto& nbrIntFld = tnbrIntFld.ref(); if (mapper_.sameWorld()) { @@ -855,8 +855,8 @@ Foam::tmp<Foam::scalarField> Foam::mappedPatchFieldBase<Type>::mappedWeightField() const { // Swap to obtain full local values of neighbour internal field - tmp<scalarField> tnbrKDelta(new scalarField()); - scalarField& nbrKDelta = tnbrKDelta.ref(); + auto tnbrKDelta = tmp<scalarField>::New(); + auto& nbrKDelta = tnbrKDelta.ref(); if (mapper_.sameWorld()) { diff --git a/src/finiteVolume/fields/fvsPatchFields/basic/fixedValue/fixedValueFvsPatchField.C b/src/finiteVolume/fields/fvsPatchFields/basic/fixedValue/fixedValueFvsPatchField.C index e6818521035e229e8ac3346cb2c086b9e3308b63..f457b1d07dfb784d711320786c2b57d0299a1452 100644 --- a/src/finiteVolume/fields/fvsPatchFields/basic/fixedValue/fixedValueFvsPatchField.C +++ b/src/finiteVolume/fields/fvsPatchFields/basic/fixedValue/fixedValueFvsPatchField.C @@ -107,10 +107,7 @@ Foam::fixedValueFvsPatchField<Type>::valueInternalCoeffs const tmp<scalarField>& ) const { - return tmp<Field<Type>> - ( - new Field<Type>(this->size(), Zero) - ); + return tmp<Field<Type>>::New(this->size(), Foam::zero{}); } diff --git a/src/finiteVolume/finiteVolume/divSchemes/divScheme/divScheme.H b/src/finiteVolume/finiteVolume/divSchemes/divScheme/divScheme.H index 3cf30c8e4d5078e64bb34a6ebbcdbac12073aa40..61b4707f0778e246d44c956b582c529263e2833d 100644 --- a/src/finiteVolume/finiteVolume/divSchemes/divScheme/divScheme.H +++ b/src/finiteVolume/finiteVolume/divSchemes/divScheme/divScheme.H @@ -37,8 +37,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef divScheme_H -#define divScheme_H +#ifndef Foam_divScheme_H +#define Foam_divScheme_H #include "tmp.H" #include "volFieldsFwd.H" @@ -71,12 +71,12 @@ class divScheme : public refCount { - protected: // Protected data const fvMesh& mesh_; + tmp<surfaceInterpolationScheme<Type>> tinterpScheme_; @@ -120,8 +120,23 @@ public: divScheme(const fvMesh& mesh, Istream& is) : mesh_(mesh), - tinterpScheme_(surfaceInterpolationScheme<Type>::New(mesh, is)) - {} + tinterpScheme_(nullptr) + { + if (is.eof()) + { + tinterpScheme_.reset + ( + new linear<Type>(mesh) + ); + } + else + { + tinterpScheme_.reset + ( + surfaceInterpolationScheme<Type>::New(mesh, is) + ); + } + } // Selectors diff --git a/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.H b/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.H index a5ceacf97a63e2205f1ba77ddf80aa0416eff4b6..3b4b306f61880eb749bac72a6bdebc16179161f2 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.H +++ b/src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.H @@ -39,8 +39,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef gaussGrad_H -#define gaussGrad_H +#ifndef Foam_gaussGrad_H +#define Foam_gaussGrad_H #include "gradScheme.H" #include "surfaceInterpolationScheme.H" @@ -103,19 +103,17 @@ public: { if (is.eof()) { - tinterpScheme_ = - tmp<surfaceInterpolationScheme<Type>> - ( - new linear<Type>(mesh) - ); + tinterpScheme_.reset + ( + new linear<Type>(mesh) + ); } else { - tinterpScheme_ = - tmp<surfaceInterpolationScheme<Type>> - ( - surfaceInterpolationScheme<Type>::New(mesh, is) - ); + tinterpScheme_.reset + ( + surfaceInterpolationScheme<Type>::New(mesh, is) + ); } } diff --git a/src/finiteVolume/finiteVolume/laplacianSchemes/laplacianScheme/laplacianScheme.C b/src/finiteVolume/finiteVolume/laplacianSchemes/laplacianScheme/laplacianScheme.C index 8e032da8cc479c0795b1cbb7c5fbd95bb612e576..8de5e717cf8ae13d4733c4eb511b8f3d5e6fa99f 100644 --- a/src/finiteVolume/finiteVolume/laplacianSchemes/laplacianScheme/laplacianScheme.C +++ b/src/finiteVolume/finiteVolume/laplacianSchemes/laplacianScheme/laplacianScheme.C @@ -35,9 +35,6 @@ License namespace Foam { - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - namespace fv { @@ -112,9 +109,6 @@ laplacianScheme<Type, GType>::fvcLaplacian // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace fv - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - } // End namespace Foam // ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/laplacianSchemes/laplacianScheme/laplacianScheme.H b/src/finiteVolume/finiteVolume/laplacianSchemes/laplacianScheme/laplacianScheme.H index fe1eba20771e588b7d0f346f07c3f2ba2a6a4eba..ab8b82a211ae4b128c9466f5c900ee82239ee667 100644 --- a/src/finiteVolume/finiteVolume/laplacianSchemes/laplacianScheme/laplacianScheme.H +++ b/src/finiteVolume/finiteVolume/laplacianSchemes/laplacianScheme/laplacianScheme.H @@ -53,9 +53,8 @@ SourceFiles namespace Foam { -template<class Type> -class fvMatrix; - +// Forward Declarations +template<class Type> class fvMatrix; class fvMesh; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -72,19 +71,16 @@ class laplacianScheme : public refCount { - protected: - // Protected data + // Protected Data const fvMesh& mesh_; tmp<surfaceInterpolationScheme<GType>> tinterpGammaScheme_; tmp<snGradScheme<Type>> tsnGradScheme_; -private: - - // Private Member Functions + // Protected Member Functions //- No copy construct laplacianScheme(const laplacianScheme&) = delete; @@ -124,19 +120,25 @@ public: //- Construct from mesh and Istream laplacianScheme(const fvMesh& mesh, Istream& is) : - mesh_(mesh), - tinterpGammaScheme_(nullptr), - tsnGradScheme_(nullptr) + mesh_(mesh) { - tinterpGammaScheme_ = tmp<surfaceInterpolationScheme<GType>> - ( - surfaceInterpolationScheme<GType>::New(mesh, is) - ); - - tsnGradScheme_ = tmp<snGradScheme<Type>> - ( - snGradScheme<Type>::New(mesh, is) - ); + if (is.eof()) + { + tinterpGammaScheme_.reset(new linear<GType>(mesh)); + tsnGradScheme_.reset(new correctedSnGrad<Type>(mesh)); + } + else + { + tinterpGammaScheme_.reset + ( + surfaceInterpolationScheme<GType>::New(mesh, is) + ); + + tsnGradScheme_.reset + ( + snGradScheme<Type>::New(mesh, is) + ); + } } //- Construct from mesh, interpolation and snGradScheme schemes diff --git a/src/finiteVolume/finiteVolume/laplacianSchemes/relaxedNonOrthoGaussLaplacianScheme/relaxedNonOrthoGaussLaplacianScheme.C b/src/finiteVolume/finiteVolume/laplacianSchemes/relaxedNonOrthoGaussLaplacianScheme/relaxedNonOrthoGaussLaplacianScheme.C index d0732bf12414e737e983563f026fb960ac864b67..ef0efdb299fe2026b77b40934784c78cc711ef12 100644 --- a/src/finiteVolume/finiteVolume/laplacianSchemes/relaxedNonOrthoGaussLaplacianScheme/relaxedNonOrthoGaussLaplacianScheme.C +++ b/src/finiteVolume/finiteVolume/laplacianSchemes/relaxedNonOrthoGaussLaplacianScheme/relaxedNonOrthoGaussLaplacianScheme.C @@ -192,7 +192,7 @@ relaxedNonOrthoGaussLaplacianScheme<Type, GType>::fvmLaplacian const word corrName(tfaceFluxCorrection().name()); - tmp<SType> trelaxedCorrection(new SType(tfaceFluxCorrection())); + auto trelaxedCorrection = tmp<SType>::New(tfaceFluxCorrection()); const word oldName(corrName + "_0"); const scalar relax(vf.mesh().equationRelaxationFactor(oldName)); diff --git a/src/finiteVolume/finiteVolume/laplacianSchemes/relaxedNonOrthoGaussLaplacianScheme/relaxedNonOrthoGaussLaplacianSchemes.C b/src/finiteVolume/finiteVolume/laplacianSchemes/relaxedNonOrthoGaussLaplacianScheme/relaxedNonOrthoGaussLaplacianSchemes.C index 7aa0027ec98c39be9dd6a7e249fda1636e5644ec..ce32fd20fbbb7f9b4ed3f2494365640e9b1db887 100644 --- a/src/finiteVolume/finiteVolume/laplacianSchemes/relaxedNonOrthoGaussLaplacianScheme/relaxedNonOrthoGaussLaplacianSchemes.C +++ b/src/finiteVolume/finiteVolume/laplacianSchemes/relaxedNonOrthoGaussLaplacianScheme/relaxedNonOrthoGaussLaplacianSchemes.C @@ -66,7 +66,7 @@ fvmLaplacian \ const word corrName(tCorr().name()); \ tmp<SType> tfaceFluxCorrection(gammaMagSf*tCorr); \ \ - tmp<SType> trelaxedCorrection(new SType(tfaceFluxCorrection())); \ + auto trelaxedCorrection = tmp<SType>::New(tfaceFluxCorrection()); \ \ const word oldName(corrName + "_0"); \ const scalar relax(vf.mesh().equationRelaxationFactor(corrName)); \ diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/relaxedSnGrad/relaxedSnGrad.C b/src/finiteVolume/finiteVolume/snGradSchemes/relaxedSnGrad/relaxedSnGrad.C index 0b018126770a811d634eab17d209b5e9491627e5..0506e7dc1a7b1b38e7c6d571643dfd26c2577c3c 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/relaxedSnGrad/relaxedSnGrad.C +++ b/src/finiteVolume/finiteVolume/snGradSchemes/relaxedSnGrad/relaxedSnGrad.C @@ -61,7 +61,7 @@ Foam::fv::relaxedSnGrad<Type>::correction } // Return under/over-relaxed explicit correction field - tmp<SurfFieldType> trelaxedCorrection(new SurfFieldType(tcorrection())); + auto trelaxedCorrection = tmp<SurfFieldType>::New(tcorrection()); SurfFieldType& oldCorrection = obr.lookupObjectRef<SurfFieldType>(oldFieldName); diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C index 716a2b189604584f3d7bcbc5a8f4e57f6d7293c5..bf2ab42635a6bee80179197d9f820be4fd526238 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C @@ -2078,7 +2078,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator== ) { checkMethod(A, su, "=="); - tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); + auto tC = tmp<fvMatrix<Type>>::New(A); tC.ref().source() += su.mesh().V()*su.field(); return tC; } @@ -2091,7 +2091,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator== ) { checkMethod(A, tsu(), "=="); - tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); + auto tC = tmp<fvMatrix<Type>>::New(A); tC.ref().source() += tsu().mesh().V()*tsu().field(); tsu.clear(); return tC; @@ -2105,7 +2105,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator== ) { checkMethod(A, tsu(), "=="); - tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); + auto tC = tmp<fvMatrix<Type>>::New(A); tC.ref().source() += tsu().mesh().V()*tsu().primitiveField(); tsu.clear(); return tC; @@ -2160,7 +2160,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator== ) { checkMethod(A, su, "=="); - tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); + auto tC = tmp<fvMatrix<Type>>::New(A); tC.ref().source() += A.psi().mesh().V()*su.value(); return tC; } @@ -2206,7 +2206,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator- const fvMatrix<Type>& A ) { - tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); + auto tC = tmp<fvMatrix<Type>>::New(A); tC.ref().negate(); return tC; } @@ -2231,7 +2231,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator+ ) { checkMethod(A, B, "+"); - tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); + auto tC = tmp<fvMatrix<Type>>::New(A); tC.ref() += B; return tC; } @@ -2284,7 +2284,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator+ ) { checkMethod(A, su, "+"); - tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); + auto tC = tmp<fvMatrix<Type>>::New(A); tC.ref().source() -= su.mesh().V()*su.field(); return tC; } @@ -2297,7 +2297,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator+ ) { checkMethod(A, tsu(), "+"); - tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); + auto tC = tmp<fvMatrix<Type>>::New(A); tC.ref().source() -= tsu().mesh().V()*tsu().field(); tsu.clear(); return tC; @@ -2311,7 +2311,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator+ ) { checkMethod(A, tsu(), "+"); - tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); + auto tC = tmp<fvMatrix<Type>>::New(A); tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField(); tsu.clear(); return tC; @@ -2366,7 +2366,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator+ ) { checkMethod(A, su, "+"); - tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); + auto tC = tmp<fvMatrix<Type>>::New(A); tC.ref().source() -= su.mesh().V()*su.field(); return tC; } @@ -2379,7 +2379,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator+ ) { checkMethod(A, tsu(), "+"); - tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); + auto tC = tmp<fvMatrix<Type>>::New(A); tC.ref().source() -= tsu().mesh().V()*tsu().field(); tsu.clear(); return tC; @@ -2393,7 +2393,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator+ ) { checkMethod(A, tsu(), "+"); - tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); + auto tC = tmp<fvMatrix<Type>>::New(A); tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField(); tsu.clear(); return tC; @@ -2449,7 +2449,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator- ) { checkMethod(A, B, "-"); - tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); + auto tC = tmp<fvMatrix<Type>>::New(A); tC.ref() -= B; return tC; } @@ -2503,7 +2503,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator- ) { checkMethod(A, su, "-"); - tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); + auto tC = tmp<fvMatrix<Type>>::New(A); tC.ref().source() += su.mesh().V()*su.field(); return tC; } @@ -2516,7 +2516,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator- ) { checkMethod(A, tsu(), "-"); - tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); + auto tC = tmp<fvMatrix<Type>>::New(A); tC.ref().source() += tsu().mesh().V()*tsu().field(); tsu.clear(); return tC; @@ -2530,7 +2530,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator- ) { checkMethod(A, tsu(), "-"); - tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); + auto tC = tmp<fvMatrix<Type>>::New(A); tC.ref().source() += tsu().mesh().V()*tsu().primitiveField(); tsu.clear(); return tC; @@ -2585,7 +2585,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator- ) { checkMethod(A, su, "-"); - tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); + auto tC = tmp<fvMatrix<Type>>::New(A); tC.ref().negate(); tC.ref().source() -= su.mesh().V()*su.field(); return tC; @@ -2599,7 +2599,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator- ) { checkMethod(A, tsu(), "-"); - tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); + auto tC = tmp<fvMatrix<Type>>::New(A); tC.ref().negate(); tC.ref().source() -= tsu().mesh().V()*tsu().field(); tsu.clear(); @@ -2614,7 +2614,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator- ) { checkMethod(A, tsu(), "-"); - tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); + auto tC = tmp<fvMatrix<Type>>::New(A); tC.ref().negate(); tC.ref().source() -= tsu().mesh().V()*tsu().primitiveField(); tsu.clear(); @@ -2673,7 +2673,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator+ ) { checkMethod(A, su, "+"); - tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); + auto tC = tmp<fvMatrix<Type>>::New(A); tC.ref().source() -= su.value()*A.psi().mesh().V(); return tC; } @@ -2699,7 +2699,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator+ ) { checkMethod(A, su, "+"); - tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); + auto tC = tmp<fvMatrix<Type>>::New(A); tC.ref().source() -= su.value()*A.psi().mesh().V(); return tC; } @@ -2725,7 +2725,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator- ) { checkMethod(A, su, "-"); - tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); + auto tC = tmp<fvMatrix<Type>>::New(A); tC.ref().source() += su.value()*tC().psi().mesh().V(); return tC; } @@ -2751,7 +2751,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator- ) { checkMethod(A, su, "-"); - tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); + auto tC = tmp<fvMatrix<Type>>::New(A); tC.ref().negate(); tC.ref().source() -= su.value()*A.psi().mesh().V(); return tC; @@ -2779,7 +2779,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator* const fvMatrix<Type>& A ) { - tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); + auto tC = tmp<fvMatrix<Type>>::New(A); tC.ref() *= dsf; return tC; } @@ -2791,7 +2791,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator* const fvMatrix<Type>& A ) { - tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); + auto tC = tmp<fvMatrix<Type>>::New(A); tC.ref() *= tdsf; return tC; } @@ -2803,7 +2803,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator* const fvMatrix<Type>& A ) { - tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); + auto tC = tmp<fvMatrix<Type>>::New(A); tC.ref() *= tvsf; return tC; } @@ -2851,7 +2851,7 @@ Foam::tmp<Foam::fvMatrix<Type>> Foam::operator* const fvMatrix<Type>& A ) { - tmp<fvMatrix<Type>> tC(new fvMatrix<Type>(A)); + auto tC = tmp<fvMatrix<Type>>::New(A); tC.ref() *= ds; return tC; } diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C index 8fbd1150031b1d231bb0fdb1743087646e9cdce2..000306e352312b4bdbd80e8bd7ddcb24226bea9a 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C @@ -363,8 +363,8 @@ Foam::SolverPerformance<Type> Foam::fvMatrix<Type>::solve() template<class Type> Foam::tmp<Foam::Field<Type>> Foam::fvMatrix<Type>::residual() const { - tmp<Field<Type>> tres(new Field<Type>(source_)); - Field<Type>& res = tres.ref(); + auto tres = tmp<Field<Type>>::New(source_); + auto& res = tres.ref(); addBoundarySource(res); diff --git a/src/finiteVolume/fvMesh/fvGeometryScheme/averageNeighbour/averageNeighbourFvGeometryScheme.C b/src/finiteVolume/fvMesh/fvGeometryScheme/averageNeighbour/averageNeighbourFvGeometryScheme.C index 8476a24df4498d03d34de992203a403f98eef31e..6cfef0e9448818082d09814b2e889d6e2311d877 100644 --- a/src/finiteVolume/fvMesh/fvGeometryScheme/averageNeighbour/averageNeighbourFvGeometryScheme.C +++ b/src/finiteVolume/fvMesh/fvGeometryScheme/averageNeighbour/averageNeighbourFvGeometryScheme.C @@ -272,8 +272,8 @@ Foam::averageNeighbourFvGeometryScheme::averageNeighbourCentres const labelList& nei = mesh_.faceNeighbour(); - tmp<pointField> tcc(new pointField(mesh_.nCells(), Zero)); - pointField& cc = tcc.ref(); + auto tcc = tmp<pointField>::New(mesh_.nCells(), Zero); + auto& cc = tcc.ref(); Field<solveScalar> cellWeights(mesh_.nCells(), Zero); @@ -382,8 +382,8 @@ Foam::averageNeighbourFvGeometryScheme::averageCentres const labelList& nei = mesh_.faceNeighbour(); - tmp<pointField> tnewFc(new pointField(faceCentres)); - pointField& newFc = tnewFc.ref(); + auto tnewFc = tmp<pointField>::New(faceCentres); + auto& newFc = tnewFc.ref(); // Internal faces for (label facei = 0; facei < mesh_.nInternalFaces(); facei++) diff --git a/src/finiteVolume/fvMesh/fvMeshGeometry.C b/src/finiteVolume/fvMesh/fvMeshGeometry.C index e7afa733b174673484c3c668121b95b92214dcad..4b34dc5e27502a4e257bb75b5eb5a08c2fd68609 100644 --- a/src/finiteVolume/fvMesh/fvMeshGeometry.C +++ b/src/finiteVolume/fvMesh/fvMeshGeometry.C @@ -376,25 +376,22 @@ Foam::tmp<Foam::surfaceVectorField> Foam::fvMesh::delta() const { DebugInFunction << "Calculating face deltas" << endl; - tmp<surfaceVectorField> tdelta + auto tdelta = tmp<surfaceVectorField>::New ( - new surfaceVectorField + IOobject ( - IOobject - ( - "delta", - pointsInstance(), - meshSubDir, - *this, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), + "delta", + pointsInstance(), + meshSubDir, *this, - dimLength - ) + IOobject::NO_READ, + IOobject::NO_WRITE, + IOobject::NO_REGISTER + ), + *this, + dimLength ); - surfaceVectorField& delta = tdelta.ref(); + auto& delta = tdelta.ref(); delta.setOriented(); const volVectorField& C = this->C(); @@ -406,7 +403,7 @@ Foam::tmp<Foam::surfaceVectorField> Foam::fvMesh::delta() const delta[facei] = C[neighbour[facei]] - C[owner[facei]]; } - surfaceVectorField::Boundary& deltabf = delta.boundaryFieldRef(); + auto& deltabf = delta.boundaryFieldRef(); forAll(deltabf, patchi) { diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclic/cyclicFvPatch.C b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclic/cyclicFvPatch.C index a8eccd2c9fc1336bd5f445a1d18670939ae8f000..af2cb8a4ed0281f9a2b9516c6a5c73393b07241a 100644 --- a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclic/cyclicFvPatch.C +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclic/cyclicFvPatch.C @@ -64,8 +64,8 @@ Foam::tmp<Foam::vectorField> Foam::cyclicFvPatch::delta() const const vectorField patchD(coupledFvPatch::delta()); const vectorField nbrPatchD(neighbFvPatch().coupledFvPatch::delta()); - tmp<vectorField> tpdv(new vectorField(patchD.size())); - vectorField& pdv = tpdv.ref(); + auto tpdv = tmp<vectorField>::New(patchD.size()); + auto& pdv = tpdv.ref(); // To the transformation if necessary if (parallel()) diff --git a/src/finiteVolume/fvMesh/wallDist/patchDistMethods/Poisson/PoissonPatchDistMethod.C b/src/finiteVolume/fvMesh/wallDist/patchDistMethods/Poisson/PoissonPatchDistMethod.C index 5984f960c7cdfeebbda4fb1f956989dc3cd88ed8..7141a428d3d82a12a748f12335026db4baf9c4a1 100644 --- a/src/finiteVolume/fvMesh/wallDist/patchDistMethods/Poisson/PoissonPatchDistMethod.C +++ b/src/finiteVolume/fvMesh/wallDist/patchDistMethods/Poisson/PoissonPatchDistMethod.C @@ -81,23 +81,16 @@ bool Foam::patchDistMethods::Poisson::correct { if (!tyPsi_) { - tyPsi_ = tmp<volScalarField> + tyPsi_ = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "yPsi", - mesh_.time().timeName(), - mesh_ - ), - mesh_, - dimensionedScalar(sqr(dimLength), Zero), - y.boundaryFieldRef().types() - ) + "yPsi", + IOobject::NO_REGISTER, + mesh_, + dimensionedScalar(sqr(dimLength), Zero), + y.boundaryFieldRef().types() ); } - volScalarField& yPsi = tyPsi_.ref(); + auto& yPsi = tyPsi_.ref(); solve(fvm::laplacian(yPsi) == dimensionedScalar("1", dimless, -1.0)); diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/LimitedScheme/LimitedScheme.C b/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/LimitedScheme/LimitedScheme.C index e72725405bbacef24137e0af2ef59f6a66f7e294..a6beca477aa49d53bbc728608ea6dfefe61a8560 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/LimitedScheme/LimitedScheme.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/limitedSchemes/LimitedScheme/LimitedScheme.C @@ -184,19 +184,11 @@ Foam::LimitedScheme<Type, Limiter, LimitFunc>::limiter } else { - tmp<surfaceScalarField> tlimiterField + auto tlimiterField = surfaceScalarField::New ( - new surfaceScalarField - ( - IOobject - ( - limiterFieldName, - mesh.time().timeName(), - mesh - ), - mesh, - dimless - ) + limiterFieldName, + mesh, + dimless ); calcLimiter(phi, tlimiterField.ref()); diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/midPoint/midPoint.H b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/midPoint/midPoint.H index 8bfb0360dc222ebf3849235081cda8ebbf1e4456..5ad8ee370c90093a9e70a45e5ded5b91d3aa9ad8 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/midPoint/midPoint.H +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/midPoint/midPoint.H @@ -103,26 +103,15 @@ public: const GeometricField<Type, fvPatchField, volMesh>& ) const { - tmp<surfaceScalarField> taw + auto taw = surfaceScalarField::New ( - new surfaceScalarField - ( - IOobject - ( - "midPointWeights", - this->mesh().time().timeName(), - this->mesh().thisDb(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - this->mesh(), - dimensionedScalar("0.5", dimless, 0.5) - ) + "midPointWeights", + IOobject::NO_REGISTER, + this->mesh(), + dimensionedScalar("0.5", dimless, 0.5) ); - surfaceScalarField::Boundary& awBf = - taw.ref().boundaryFieldRef(); + auto& awBf = taw.ref().boundaryFieldRef(); forAll(awBf, patchi) { diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/reverseLinear/reverseLinear.H b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/reverseLinear/reverseLinear.H index 6ce1aa91e8f7c21d8dc3a50cda110e56991d4d44..f6964af2b43c573c6b8f10c035e6b0650057497f 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/reverseLinear/reverseLinear.H +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/reverseLinear/reverseLinear.H @@ -113,28 +113,19 @@ public: ); const surfaceScalarField& cdWeights = tcdWeights(); - tmp<surfaceScalarField> treverseLinearWeights + auto treverseLinearWeights = surfaceScalarField::New ( - new surfaceScalarField - ( - IOobject - ( - "reverseLinearWeights", - mesh.time().timeName(), - mesh - ), - mesh, - dimless - ) + "reverseLinearWeights", + IOobject::NO_REGISTER, + mesh, + dimless ); - surfaceScalarField& reverseLinearWeights = - treverseLinearWeights.ref(); + auto& reverseLinearWeights = treverseLinearWeights.ref(); reverseLinearWeights.primitiveFieldRef() = 1.0 - cdWeights.primitiveField(); - surfaceScalarField::Boundary& rlwbf = - reverseLinearWeights.boundaryFieldRef(); + auto& rlwbf = reverseLinearWeights.boundaryFieldRef(); forAll(mesh.boundary(), patchi) diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolate.C b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolate.C index edfdf8a9921eeb3b1e72908a475d0e13f1f4381f..15d99ffe65428e2ab394e5761763360f2bb24102 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolate.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolate.C @@ -278,22 +278,20 @@ Foam::fvc::interpolate const FieldField<fvPatchField, Type>& fvpff ) { - FieldField<fvsPatchField, Type>* fvspffPtr - ( - new FieldField<fvsPatchField, Type>(fvpff.size()) - ); + auto tresult = tmp<FieldField<fvsPatchField, Type>>::New(fvpff.size()); + auto& result = tresult.ref(); - forAll(*fvspffPtr, patchi) + forAll(result, patchi) { - fvspffPtr->set + result.set ( patchi, fvsPatchField<Type>::NewCalculatedType(fvpff[patchi].patch()).ptr() ); - (*fvspffPtr)[patchi] = fvpff[patchi]; + result[patchi] = fvpff[patchi]; } - return tmp<FieldField<fvsPatchField, Type>>(fvspffPtr); + return tresult; } diff --git a/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolate.C b/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolate.C index 798c3bf15256dd0cd5b9fc68e1df443320d947e6..fac2318f22d604e6dce51b34e045f175dda148b9 100644 --- a/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolate.C +++ b/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolate.C @@ -232,11 +232,8 @@ Foam::tmp<Foam::Field<Type>> Foam::volPointInterpolation::flatBoundaryField const fvMesh& mesh = vf.mesh(); const fvBoundaryMesh& bm = mesh.boundary(); - tmp<Field<Type>> tboundaryVals - ( - new Field<Type>(mesh.nBoundaryFaces()) - ); - Field<Type>& boundaryVals = tboundaryVals.ref(); + auto tboundaryVals = tmp<Field<Type>>::New(mesh.nBoundaryFaces()); + auto& boundaryVals = tboundaryVals.ref(); forAll(vf.boundaryField(), patchi) {