diff --git a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/laserDTRM/DTRMParticle/DTRMParticle.H b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/laserDTRM/DTRMParticle/DTRMParticle.H index 5ad00275d599d3701aca4e189ea497732a6122a8..47c381aa8cab3c5702304b721cb375ad03c6b9a5 100644 --- a/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/laserDTRM/DTRMParticle/DTRMParticle.H +++ b/applications/solvers/multiphase/icoReactingMultiphaseInterFoam/laserDTRM/DTRMParticle/DTRMParticle.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017-2019 OpenCFD Ltd + Copyright (C) 2017-2024 OpenCFD Ltd ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -206,9 +206,13 @@ public: //- Construct as copy DTRMParticle(const DTRMParticle& p); + //- Return a clone + virtual autoPtr<particle> clone() const + { + return particle::Clone(*this); + } - //- Factory class to read-construct particles used for - // parallel transfer + //- Factory class to read-construct particles (for parallel transfer) class iNew { const polyMesh& mesh_; diff --git a/applications/utilities/parallelProcessing/redistributePar/parFvFieldDistributorTemplates.C b/applications/utilities/parallelProcessing/redistributePar/parFvFieldDistributorTemplates.C index 2f65cef903786488e500d2b5521fc5861bf02dfb..97c5c3103ac6dcb1926c2a9dd51da00732cb5031 100644 --- a/applications/utilities/parallelProcessing/redistributePar/parFvFieldDistributorTemplates.C +++ b/applications/utilities/parallelProcessing/redistributePar/parFvFieldDistributorTemplates.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2015 OpenFOAM Foundation - Copyright (C) 2016-2023 OpenCFD Ltd. + Copyright (C) 2016-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -30,9 +30,8 @@ License #include "Time.H" #include "PtrList.H" #include "fvPatchFields.H" +#include "fvsPatchFields.H" #include "emptyFvPatch.H" -#include "emptyFvPatchField.H" -#include "emptyFvsPatchField.H" #include "IOobjectList.H" #include "mapDistributePolyMesh.H" #include "processorFvPatch.H" @@ -123,15 +122,19 @@ Foam::parFvFieldDistributor::distributeField { if (patchFaceMaps_.set(patchi)) { - // Clone local patch field - oldPatchFields.set(patchi, bfld[patchi].clone()); - distributedFvPatchFieldMapper mapper ( labelUList::null(), patchFaceMaps_[patchi] ); + // Clone local patch field + oldPatchFields.set + ( + patchi, + bfld[patchi].clone(fld.internalField()) + ); + // Map into local copy oldPatchFields[patchi].autoMap(mapper); } @@ -159,7 +162,7 @@ Foam::parFvFieldDistributor::distributeField ( pfld, tgtMesh_.boundary()[patchi], - DimensionedField<Type, volMesh>::null(), + fvPatchField<Type>::Internal::null(), dummyMapper ) ); @@ -178,9 +181,9 @@ Foam::parFvFieldDistributor::distributeField patchi, fvPatchField<Type>::New ( - emptyFvPatchField<Type>::typeName, + fvPatchFieldBase::emptyType(), tgtMesh_.boundary()[patchi], - DimensionedField<Type, volMesh>::null() + fvPatchField<Type>::Internal::null() ) ); } @@ -268,15 +271,19 @@ Foam::parFvFieldDistributor::distributeField { if (patchFaceMaps_.set(patchi)) { - // Clone local patch field - oldPatchFields.set(patchi, bfld[patchi].clone()); - distributedFvPatchFieldMapper mapper ( labelUList::null(), patchFaceMaps_[patchi] ); + // Clone local patch field + oldPatchFields.set + ( + patchi, + bfld[patchi].clone(fld.internalField()) + ); + // Map into local copy oldPatchFields[patchi].autoMap(mapper); } @@ -303,7 +310,7 @@ Foam::parFvFieldDistributor::distributeField ( pfld, tgtMesh_.boundary()[patchi], - DimensionedField<Type, surfaceMesh>::null(), + fvsPatchField<Type>::Internal::null(), dummyMapper ) ); @@ -321,9 +328,9 @@ Foam::parFvFieldDistributor::distributeField patchi, fvsPatchField<Type>::New ( - emptyFvsPatchField<Type>::typeName, + fvsPatchFieldBase::emptyType(), tgtMesh_.boundary()[patchi], - DimensionedField<Type, surfaceMesh>::null() + fvsPatchField<Type>::Internal::null() ) ); } diff --git a/applications/utilities/parallelProcessing/redistributePar/parPointFieldDistributorTemplates.C b/applications/utilities/parallelProcessing/redistributePar/parPointFieldDistributorTemplates.C index 4c1964f076870709f0ed77ce3d7d339f40914b42..f1d1361b29093f5339ca08b40ca118d85558de95 100644 --- a/applications/utilities/parallelProcessing/redistributePar/parPointFieldDistributorTemplates.C +++ b/applications/utilities/parallelProcessing/redistributePar/parPointFieldDistributorTemplates.C @@ -26,11 +26,11 @@ License \*---------------------------------------------------------------------------*/ #include "Time.H" -#include "emptyPointPatchField.H" #include "IOobjectList.H" #include "mapDistributePolyMesh.H" #include "distributedFieldMapper.H" #include "distributedPointPatchFieldMapper.H" +#include "emptyPointPatch.H" #include "pointFields.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -108,7 +108,7 @@ Foam::parPointFieldDistributor::distributeField ( bfld[patchi], tgtMesh.boundary()[patchi], // pointPatch - DimensionedField<Type, pointMesh>::null(), + pointPatchField<Type>::Internal::null(), mapper ) ); @@ -122,7 +122,7 @@ Foam::parPointFieldDistributor::distributeField // bfld[patchi].clone // ( // tgtMesh.boundary()[patchi], - // DimensionedField<Type, pointMesh>::null(), + // pointPatchField<Type>::Internal::null(), // mapper // ) //); @@ -140,9 +140,9 @@ Foam::parPointFieldDistributor::distributeField patchi, pointPatchField<Type>::New ( - emptyPointPatchField<Type>::typeName, + pointPatchFieldBase::emptyType(), tgtMesh.boundary()[patchi], - DimensionedField<Type, pointMesh>::null() + pointPatchField<Type>::Internal::null() ) ); } diff --git a/applications/utilities/parallelProcessing/redistributePar/passivePositionParticle.H b/applications/utilities/parallelProcessing/redistributePar/passivePositionParticle.H index 394f64e4909ea03ca9c8c291a0fed17c01b64168..89821165c3783947b1e6fc9c4a60394da8a28d11 100644 --- a/applications/utilities/parallelProcessing/redistributePar/passivePositionParticle.H +++ b/applications/utilities/parallelProcessing/redistributePar/passivePositionParticle.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017-2022 OpenCFD Ltd. + Copyright (C) 2017-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -100,10 +100,10 @@ public: cachedPosition_(p.cachedPosition_) {} - //- Construct and return a clone + //- Return a clone virtual autoPtr<particle> clone() const { - return autoPtr<particle>(new passivePositionParticle(*this)); + return particle::Clone(*this); } diff --git a/etc/codeTemplates/dynamicCode/codedFunction1Template.H b/etc/codeTemplates/dynamicCode/codedFunction1Template.H index 3b2de974a937201c76899149d3902fc4c947ee72..d54e4a350cca9f2a7f051bb28b668eee119def41 100644 --- a/etc/codeTemplates/dynamicCode/codedFunction1Template.H +++ b/etc/codeTemplates/dynamicCode/codedFunction1Template.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2021 OpenCFD Ltd. + Copyright (C) 2021-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -86,13 +86,10 @@ public: const ${typeName}Function1_${TemplateType}& rhs ) = default; - //- Construct and return a clone + //- Return a clone virtual tmp<Function1<${TemplateType}>> clone() const { - return tmp<Function1<${TemplateType}>> - ( - new ${typeName}Function1_${TemplateType}(*this) - ); + return Function1<${TemplateType}>::Clone(*this); } diff --git a/etc/codeTemplates/dynamicCode/codedPatchFunction1Template.H b/etc/codeTemplates/dynamicCode/codedPatchFunction1Template.H index c67d16001272039e067b1f2165930a5484158cf8..16b38abecc9c643368ba4fc281b094c0475c6f6d 100644 --- a/etc/codeTemplates/dynamicCode/codedPatchFunction1Template.H +++ b/etc/codeTemplates/dynamicCode/codedPatchFunction1Template.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2020-2021 OpenCFD Ltd. + Copyright (C) 2020-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -85,12 +85,6 @@ public: const bool faceValues = true ); - //- Copy construct - ${typeName}PatchFunction1${FieldType} - ( - const ${typeName}PatchFunction1${FieldType}& rhs - ) = default; - //- Copy construct, resetting patch ${typeName}PatchFunction1${FieldType} ( @@ -98,25 +92,25 @@ public: const polyPatch& pp ); - //- Construct and return a clone + //- Copy construct + ${typeName}PatchFunction1${FieldType} + ( + const ${typeName}PatchFunction1${FieldType}& rhs + ) = default; + + //- Return a clone virtual tmp<PatchFunction1<${TemplateType}>> clone() const { - return tmp<PatchFunction1<${TemplateType}>> - ( - new ${typeName}PatchFunction1${FieldType}(*this) - ); + return PatchFunction1<${TemplateType}>::Clone(*this); } - //- Construct and return a clone setting patch + //- Return a clone, setting the patch virtual tmp<PatchFunction1<${TemplateType}>> clone ( const polyPatch& pp ) const { - return tmp<PatchFunction1<${TemplateType}>> - ( - new ${typeName}PatchFunction1${FieldType}(*this, pp) - ); + return PatchFunction1<${TemplateType}>::Clone(*this, pp); } diff --git a/src/OpenFOAM/expressions/Function1/Function1Expression.H b/src/OpenFOAM/expressions/Function1/Function1Expression.H index 69ecf324246bf27abe368a0dc3101cf5170fffef..25917790883dd91fb3fdc1ff84753d5d8375a899 100644 --- a/src/OpenFOAM/expressions/Function1/Function1Expression.H +++ b/src/OpenFOAM/expressions/Function1/Function1Expression.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2020-2021 OpenCFD Ltd. + Copyright (C) 2020-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -65,8 +65,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef Function1Types_expression_H -#define Function1Types_expression_H +#ifndef Foam_Function1Types_expression_H +#define Foam_Function1Types_expression_H #include "Function1.H" #include "fieldExprDriver.H" @@ -124,10 +124,10 @@ public: //- Copy construct explicit Function1Expression(const Function1Expression<Type>& rhs); - //- Construct and return a clone + //- Return a clone virtual tmp<Function1<Type>> clone() const { - return tmp<Function1<Type>>(new Function1Expression<Type>(*this)); + return Function1<Type>::Clone(*this); } diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H index d66463a46d9c055b23aeb8f70591d2e9a57c566b..011569f452cd1237c47ed9183180c79bc64033f8 100644 --- a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2019-2023 OpenCFD Ltd. + Copyright (C) 2019-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -240,26 +240,32 @@ class pointPatchField : public pointPatchFieldBase { - // Private Data +public: - //- Reference to internal field - const DimensionedField<Type, pointMesh>& internalField_; + // Public Data Types + //- The patch type for the patch field + typedef pointPatch Patch; -public: + //- The value_type for the patch field + typedef Type value_type; + + //- The internal field type associated with the patch field + typedef DimensionedField<Type, pointMesh> Internal; - //- The Field value_type - typedef Type value_type; + //- Type for a \em calculated patch + typedef calculatedPointPatchField<Type> Calculated; - //- The internal field type associated with the patch field - typedef DimensionedField<Type, pointMesh> Internal; - //- The patch type for the patch field - typedef pointPatch Patch; +private: + + // Private Data + + //- Reference to internal field + const DimensionedField<Type, pointMesh>& internalField_; - //- Type for a \em calculated patch - typedef calculatedPointPatchField<Type> Calculated; +public: // Declare run-time constructor selection tables diff --git a/src/OpenFOAM/primitives/coordinate/rotation/EulerCoordinateRotation.H b/src/OpenFOAM/primitives/coordinate/rotation/EulerCoordinateRotation.H index f5053531540d6cf8cfaaec2d3b3e298b6a782883..5dfaf1e9df1a6048875f590a46959c2adf37bce8 100644 --- a/src/OpenFOAM/primitives/coordinate/rotation/EulerCoordinateRotation.H +++ b/src/OpenFOAM/primitives/coordinate/rotation/EulerCoordinateRotation.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2017-2021 OpenCFD Ltd. + Copyright (C) 2017-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -133,9 +133,7 @@ public: //- Return clone autoPtr<coordinateRotation> clone() const { - return - autoPtr<coordinateRotation>::NewFrom - <coordinateRotations::euler>(*this); + return coordinateRotation::Clone(*this); } diff --git a/src/OpenFOAM/primitives/coordinate/rotation/STARCDCoordinateRotation.H b/src/OpenFOAM/primitives/coordinate/rotation/STARCDCoordinateRotation.H index 057c6f699b1372838177e422faf8a28218636ff7..d6f4bed516da6e478d2cc15ed84b255702f6dc3d 100644 --- a/src/OpenFOAM/primitives/coordinate/rotation/STARCDCoordinateRotation.H +++ b/src/OpenFOAM/primitives/coordinate/rotation/STARCDCoordinateRotation.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2017-2022 OpenCFD Ltd. + Copyright (C) 2017-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -115,9 +115,7 @@ public: //- Return clone autoPtr<coordinateRotation> clone() const { - return - autoPtr<coordinateRotation>::NewFrom - <coordinateRotations::starcd>(*this); + return coordinateRotation::Clone(*this); } diff --git a/src/OpenFOAM/primitives/coordinate/rotation/axesRotation.H b/src/OpenFOAM/primitives/coordinate/rotation/axesRotation.H index cd693981a78ebba9fc736e80fb2e2d0f9bc302f2..775f9bb0068d94e5d8efeacc5d30090f826fe1b7 100644 --- a/src/OpenFOAM/primitives/coordinate/rotation/axesRotation.H +++ b/src/OpenFOAM/primitives/coordinate/rotation/axesRotation.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2017-2022 OpenCFD Ltd. + Copyright (C) 2017-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -144,9 +144,7 @@ public: //- Return clone autoPtr<coordinateRotation> clone() const { - return - autoPtr<coordinateRotation>::NewFrom - <coordinateRotations::axes>(*this); + return coordinateRotation::Clone(*this); } diff --git a/src/OpenFOAM/primitives/coordinate/rotation/axisAngleRotation.H b/src/OpenFOAM/primitives/coordinate/rotation/axisAngleRotation.H index 0914d4b1c237e208affb8275eb4eb0daee80ed1a..5ff65b483eea55685814eba54ac7277820c82160 100644 --- a/src/OpenFOAM/primitives/coordinate/rotation/axisAngleRotation.H +++ b/src/OpenFOAM/primitives/coordinate/rotation/axisAngleRotation.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018-2022 OpenCFD Ltd. + Copyright (C) 2018-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -120,9 +120,7 @@ public: //- Return clone autoPtr<coordinateRotation> clone() const { - return - autoPtr<coordinateRotation>::NewFrom - <coordinateRotations::axisAngle>(*this); + return coordinateRotation::Clone(*this); } diff --git a/src/OpenFOAM/primitives/coordinate/rotation/coordinateRotation.H b/src/OpenFOAM/primitives/coordinate/rotation/coordinateRotation.H index 32c5e81493ae6cadb6ced61fea782ea9f47917b1..6a2ccd372410ebd3a417951de017023ed40754bd 100644 --- a/src/OpenFOAM/primitives/coordinate/rotation/coordinateRotation.H +++ b/src/OpenFOAM/primitives/coordinate/rotation/coordinateRotation.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018-2022 OpenCFD Ltd. + Copyright (C) 2018-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -109,11 +109,18 @@ public: // Uses all default constructors - //- Construct and return a clone + //- Return a clone virtual autoPtr<coordinateRotation> clone() const = 0; - // Selectors + // Factory Methods + + //- Clone a coordinate rotation + template<class Derived> + static autoPtr<coordinateRotation> Clone(const Derived& crot) + { + return autoPtr<coordinateRotation>(new Derived(crot)); + } //- Select construct the specified coordinate rotation type // diff --git a/src/OpenFOAM/primitives/coordinate/rotation/cylindricalRotation.H b/src/OpenFOAM/primitives/coordinate/rotation/cylindricalRotation.H index 59a1acd0fb2ea20f3b8c47de53442dc7ff825d79..ca9c1d987b69081a53c9812f80bae5346a76824e 100644 --- a/src/OpenFOAM/primitives/coordinate/rotation/cylindricalRotation.H +++ b/src/OpenFOAM/primitives/coordinate/rotation/cylindricalRotation.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018-2021 OpenCFD Ltd. + Copyright (C) 2018-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -89,9 +89,7 @@ public: //- Return clone autoPtr<coordinateRotation> clone() const { - return - autoPtr<coordinateRotation>::NewFrom - <coordinateRotations::cylindrical>(*this); + return coordinateRotation::Clone(*this); } diff --git a/src/OpenFOAM/primitives/coordinate/rotation/identityRotation.H b/src/OpenFOAM/primitives/coordinate/rotation/identityRotation.H index 80fe1efec67e465870dcad86713883bf703f73a6..ede44c3c2876c46215594613c55ec6d3cb9f3d92 100644 --- a/src/OpenFOAM/primitives/coordinate/rotation/identityRotation.H +++ b/src/OpenFOAM/primitives/coordinate/rotation/identityRotation.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018-2021 OpenCFD Ltd. + Copyright (C) 2018-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -93,9 +93,7 @@ public: //- Return clone autoPtr<coordinateRotation> clone() const { - return - autoPtr<coordinateRotation>::NewFrom - <coordinateRotations::identity>(*this); + return coordinateRotation::Clone(*this); } diff --git a/src/OpenFOAM/primitives/coordinate/rotation/specifiedRotation.H b/src/OpenFOAM/primitives/coordinate/rotation/specifiedRotation.H index 6d41c8ce554e4627a57e937e20e271ce00082400..f2f0971f0c0d033b1dc1974d0258957455e64334 100644 --- a/src/OpenFOAM/primitives/coordinate/rotation/specifiedRotation.H +++ b/src/OpenFOAM/primitives/coordinate/rotation/specifiedRotation.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2021 OpenCFD Ltd. + Copyright (C) 2021-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -89,9 +89,7 @@ public: //- Return clone autoPtr<coordinateRotation> clone() const { - return - autoPtr<coordinateRotation>::NewFrom - <coordinateRotations::specified>(*this); + return coordinateRotation::Clone(*this); } diff --git a/src/OpenFOAM/primitives/coordinate/systems/cartesianCS.H b/src/OpenFOAM/primitives/coordinate/systems/cartesianCS.H index 111db8100e0760a676e57443cbeac720068214e7..4b8c95429aa2f1acc7456eec1e7db33744cb29a3 100644 --- a/src/OpenFOAM/primitives/coordinate/systems/cartesianCS.H +++ b/src/OpenFOAM/primitives/coordinate/systems/cartesianCS.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2013 OpenFOAM Foundation - Copyright (C) 2018-2022 OpenCFD Ltd. + Copyright (C) 2018-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -149,7 +149,7 @@ public: //- Return clone virtual autoPtr<coordinateSystem> clone() const { - return autoPtr<coordinateSystem>::NewFrom<cartesian>(*this); + return coordinateSystem::Clone(*this); } diff --git a/src/OpenFOAM/primitives/coordinate/systems/coordinateSystem.H b/src/OpenFOAM/primitives/coordinate/systems/coordinateSystem.H index 7703525b1a59272de2bd41f8a24e93e8c03a53a0..d835ddeaad59766d32b3dbe605182585e1959a31 100644 --- a/src/OpenFOAM/primitives/coordinate/systems/coordinateSystem.H +++ b/src/OpenFOAM/primitives/coordinate/systems/coordinateSystem.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018-2022 OpenCFD Ltd. + Copyright (C) 2018-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -453,7 +453,26 @@ public: ); - // Selectors + // Factory Methods + + //- Clone a coordinate system + template<class Derived> + static autoPtr<coordinateSystem> Clone(const Derived& csys) + { + return autoPtr<coordinateSystem>(new Derived(csys)); + } + + //- Select construct the specified coordinate system type + //- with reference to objectRegistry for indirect entries. + // + // An empty modelType will be treated as "cartesian" + static autoPtr<coordinateSystem> Clone + ( + const word& modelType, + const objectRegistry& obr, + const dictionary& dict, + IOobjectOption::readOption readOrigin = IOobjectOption::MUST_READ + ); //- Select construct the specified coordinate system type //- with reference to objectRegistry for indirect entries. diff --git a/src/OpenFOAM/primitives/coordinate/systems/cylindricalCS.H b/src/OpenFOAM/primitives/coordinate/systems/cylindricalCS.H index 47d39e5fa582cb575b7c05e63dcf578e72b990a9..a6a08e7a19dd854a808f542dde9b5f0f8e63dc9b 100644 --- a/src/OpenFOAM/primitives/coordinate/systems/cylindricalCS.H +++ b/src/OpenFOAM/primitives/coordinate/systems/cylindricalCS.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2014 OpenFOAM Foundation - Copyright (C) 2018-2022 OpenCFD Ltd. + Copyright (C) 2018-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -191,7 +191,7 @@ public: //- Return clone virtual autoPtr<coordinateSystem> clone() const { - return autoPtr<coordinateSystem>::NewFrom<cylindrical>(*this); + return coordinateSystem::Clone(*this); } diff --git a/src/OpenFOAM/primitives/coordinate/systems/indirectCS.H b/src/OpenFOAM/primitives/coordinate/systems/indirectCS.H index 26565d46f232d9696f813aa4c3753885721f8753..bf40e9a6a28c178a731457bd25750a59025b7bbf 100644 --- a/src/OpenFOAM/primitives/coordinate/systems/indirectCS.H +++ b/src/OpenFOAM/primitives/coordinate/systems/indirectCS.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018-2022 OpenCFD Ltd. + Copyright (C) 2018-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -149,7 +149,7 @@ public: //- Return clone virtual autoPtr<coordinateSystem> clone() const { - return autoPtr<coordinateSystem>::NewFrom<indirect>(*this); + return coordinateSystem::Clone(*this); } diff --git a/src/OpenFOAM/primitives/functions/Function1/CSV/CSV.H b/src/OpenFOAM/primitives/functions/Function1/CSV/CSV.H index 486744c04f3f3589381b7cea8bcc224242318c9d..bb7341047cf046c2ab65b38bb1544a8bcde03fbc 100644 --- a/src/OpenFOAM/primitives/functions/Function1/CSV/CSV.H +++ b/src/OpenFOAM/primitives/functions/Function1/CSV/CSV.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2017-2023 OpenCFD Ltd. + Copyright (C) 2017-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -140,10 +140,10 @@ public: //- Copy construct explicit CSV(const CSV<Type>& csv); - //- Construct and return a clone + //- Return a clone virtual tmp<Function1<Type>> clone() const { - return tmp<Function1<Type>>(new CSV<Type>(*this)); + return Function1<Type>::Clone(*this); } diff --git a/src/OpenFOAM/primitives/functions/Function1/Coded/CodedFunction1.H b/src/OpenFOAM/primitives/functions/Function1/Coded/CodedFunction1.H index ed8dbfe01e410c92c25e099d06f908058a4a7283..3884d5caa5998d516793437ea082e6893feb8adb 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Coded/CodedFunction1.H +++ b/src/OpenFOAM/primitives/functions/Function1/Coded/CodedFunction1.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2021 OpenCFD Ltd. + Copyright (C) 2021-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -84,8 +84,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef Function1Types_CodedFunction1_H -#define Function1Types_CodedFunction1_H +#ifndef Foam_Function1Types_CodedFunction1_H +#define Foam_Function1Types_CodedFunction1_H #include "Function1.H" #include "codedBase.H" @@ -184,10 +184,10 @@ public: //- Copy construct explicit CodedFunction1(const CodedFunction1<Type>& rhs); - //- Construct and return a clone + //- Return a clone virtual tmp<Function1<Type>> clone() const { - return tmp<Function1<Type>>(new CodedFunction1<Type>(*this)); + return Function1<Type>::Clone(*this); } diff --git a/src/OpenFOAM/primitives/functions/Function1/Constant/Constant.H b/src/OpenFOAM/primitives/functions/Function1/Constant/Constant.H index 3ddc1ed6709baf321899cf1f4d97625f77985653..84072468b22d876a7b603e9eaab25f1f24ef6a1d 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Constant/Constant.H +++ b/src/OpenFOAM/primitives/functions/Function1/Constant/Constant.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2015-2021 OpenCFD Ltd. + Copyright (C) 2015-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -53,8 +53,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef Function1Types_Constant_H -#define Function1Types_Constant_H +#ifndef Foam_Function1Types_Constant_H +#define Foam_Function1Types_Constant_H #include "Function1.H" @@ -118,10 +118,10 @@ public: //- Copy constructor explicit Constant(const Constant<Type>& rhs); - //- Construct and return a clone + //- Return a clone virtual tmp<Function1<Type>> clone() const { - return tmp<Function1<Type>>(new Constant<Type>(*this)); + return Function1<Type>::Clone(*this); } diff --git a/src/OpenFOAM/primitives/functions/Function1/Cosine/Cosine.H b/src/OpenFOAM/primitives/functions/Function1/Cosine/Cosine.H index 5c00ed1a2ca8739eb605a487a0fc53392c89857f..6342c5066a8afb9a322b59c23d9bba680b69f919 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Cosine/Cosine.H +++ b/src/OpenFOAM/primitives/functions/Function1/Cosine/Cosine.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2020-2022 OpenCFD Ltd. + Copyright (C) 2020-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -96,8 +96,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef Function1Types_Cosine_H -#define Function1Types_Cosine_H +#ifndef Foam_Function1Types_Cosine_H +#define Foam_Function1Types_Cosine_H #include "Sine.H" @@ -148,10 +148,10 @@ public: Sine<Type>(rhs) {} - //- Construct and return a clone + //- Return a clone virtual tmp<Function1<Type>> clone() const { - return tmp<Function1<Type>>(new Cosine<Type>(*this)); + return Function1<Type>::Clone(*this); } diff --git a/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.C b/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.C index cfcde22801497c3ff6cb3e36d77564810ebd67a1..27fc4e660494d1378087c374677375cb4e634990 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.C +++ b/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.C @@ -134,17 +134,6 @@ Foam::FieldFunction1<Function1Type>::FieldFunction1 {} -template<class Function1Type> -Foam::tmp<Foam::Function1<typename Function1Type::returnType>> -Foam::FieldFunction1<Function1Type>::clone() const -{ - return tmp<Function1<Type>> - ( - new FieldFunction1<Function1Type>(*this) - ); -} - - template<class Function1Type> Foam::tmp<Foam::Field<typename Function1Type::returnType>> Foam::FieldFunction1<Function1Type>::integrate diff --git a/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.H b/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.H index fa64f4f0cd96e55f3a65b9f2610314607bc411d7..107a857b0b8eee8dffb2171d0972db00d9c665ef 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.H +++ b/src/OpenFOAM/primitives/functions/Function1/Function1/Function1.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2018-2023 OpenCFD Ltd. + Copyright (C) 2018-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -164,11 +164,18 @@ public: //- Copy construct explicit Function1(const Function1<Type>& rhs); - //- Construct and return a clone + //- Return a clone virtual tmp<Function1<Type>> clone() const = 0; - // Selectors + // Factory Methods + + //- Clone a Function1 + template<class Derived> + static tmp<Function1<Type>> Clone(const Derived& fun) + { + return tmp<Function1<Type>>(new Derived(fun)); + } //- Selector, with fallback redirection static autoPtr<Function1<Type>> New @@ -321,8 +328,11 @@ public: const objectRegistry* obrPtr = nullptr ); - //- Construct and return a clone - virtual tmp<Function1<Type>> clone() const; + //- Return a clone + virtual tmp<Function1<Type>> clone() const + { + return Function1<Type>::Clone(*this); + } //- Destructor diff --git a/src/OpenFOAM/primitives/functions/Function1/Function1/Function1Fwd.H b/src/OpenFOAM/primitives/functions/Function1/Function1/Function1Fwd.H index b3ac5b7337365c7304c2fb2e0069812c2a0bbca4..c8f0053ec5ee8cf80e84e9976f9c5f8a277e25f4 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Function1/Function1Fwd.H +++ b/src/OpenFOAM/primitives/functions/Function1/Function1/Function1Fwd.H @@ -25,8 +25,8 @@ License \*---------------------------------------------------------------------------*/ -#ifndef Function1Fwd_H -#define Function1Fwd_H +#ifndef Foam_Function1Fwd_H +#define Foam_Function1Fwd_H #include "Function1.H" #include "vector.H" diff --git a/src/OpenFOAM/primitives/functions/Function1/FunctionObjectTrigger/FunctionObjectTrigger.H b/src/OpenFOAM/primitives/functions/Function1/FunctionObjectTrigger/FunctionObjectTrigger.H index 9e2d876bf5fab06a8af0ef9b72048af863ef688d..4bc989a8402c4df69b0811b6c69c943f93809ae0 100644 --- a/src/OpenFOAM/primitives/functions/Function1/FunctionObjectTrigger/FunctionObjectTrigger.H +++ b/src/OpenFOAM/primitives/functions/Function1/FunctionObjectTrigger/FunctionObjectTrigger.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2021 OpenCFD Ltd. + Copyright (C) 2021-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -58,8 +58,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef Function1Types_FunctionObjectTrigger_H -#define Function1Types_FunctionObjectTrigger_H +#ifndef Foam_Function1Types_FunctionObjectTrigger_H +#define Foam_Function1Types_FunctionObjectTrigger_H #include "Function1.H" #include "labelList.H" @@ -80,7 +80,6 @@ class FunctionObjectTrigger : public Function1<Type> { - // Private Data //- Trigger indices when it is considered active @@ -124,10 +123,10 @@ public: //- Copy construct explicit FunctionObjectTrigger(const FunctionObjectTrigger<Type>& rhs); - //- Construct and return a clone + //- Return a clone virtual tmp<Function1<Type>> clone() const { - return tmp<Function1<Type>>(new FunctionObjectTrigger<Type>(*this)); + return Function1<Type>::Clone(*this); } diff --git a/src/OpenFOAM/primitives/functions/Function1/FunctionObjectValue/FunctionObjectValue.H b/src/OpenFOAM/primitives/functions/Function1/FunctionObjectValue/FunctionObjectValue.H index 03f00ade901c128c59c151a4017bbb30bf097db4..c2e7f7919c9342ceea6d958c10a749484af47161 100644 --- a/src/OpenFOAM/primitives/functions/Function1/FunctionObjectValue/FunctionObjectValue.H +++ b/src/OpenFOAM/primitives/functions/Function1/FunctionObjectValue/FunctionObjectValue.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2021 OpenCFD Ltd. + Copyright (C) 2021-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -49,8 +49,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef Function1Types_FunctionObjectValue_H -#define Function1Types_FunctionObjectValue_H +#ifndef Foam_Function1Types_FunctionObjectValue_H +#define Foam_Function1Types_FunctionObjectValue_H #include "Function1.H" @@ -116,10 +116,10 @@ public: //- Copy construct explicit FunctionObjectValue(const FunctionObjectValue<Type>& rhs); - //- Construct and return a clone + //- Return a clone virtual tmp<Function1<Type>> clone() const { - return tmp<Function1<Type>>(new FunctionObjectValue<Type>(*this)); + return Function1<Type>::Clone(*this); } diff --git a/src/OpenFOAM/primitives/functions/Function1/InputValueMapper/InputValueMapper.H b/src/OpenFOAM/primitives/functions/Function1/InputValueMapper/InputValueMapper.H index c7edfc49fe7737a9853ec4a10263f0d4776fd45a..a59a89ae638213b5b965d98e4041c394c63b5fba 100644 --- a/src/OpenFOAM/primitives/functions/Function1/InputValueMapper/InputValueMapper.H +++ b/src/OpenFOAM/primitives/functions/Function1/InputValueMapper/InputValueMapper.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2020-2021 OpenCFD Ltd. + Copyright (C) 2020-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -104,8 +104,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef Function1Types_InputValueMapper_H -#define Function1Types_InputValueMapper_H +#ifndef Foam_Function1Types_InputValueMapper_H +#define Foam_Function1Types_InputValueMapper_H #include "Function1.H" #include "Enum.H" @@ -201,10 +201,10 @@ public: //- Copy construct explicit InputValueMapper(const InputValueMapper<Type>& rhs); - //- Construct and return a clone + //- Return a clone virtual tmp<Function1<Type>> clone() const { - return tmp<Function1<Type>>(new InputValueMapper<Type>(*this)); + return Function1<Type>::Clone(*this); } diff --git a/src/OpenFOAM/primitives/functions/Function1/None/NoneFunction1.H b/src/OpenFOAM/primitives/functions/Function1/None/NoneFunction1.H index 2faa535cfb6a49bbb98ae10f8e468a014fd2c565..c3b67156fbc88afecc04028eb295c2722afc43df 100644 --- a/src/OpenFOAM/primitives/functions/Function1/None/NoneFunction1.H +++ b/src/OpenFOAM/primitives/functions/Function1/None/NoneFunction1.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2021-2022 OpenCFD Ltd. + Copyright (C) 2021-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -86,10 +86,10 @@ public: const objectRegistry* obrPtr = nullptr ); - //- Construct and return a clone + //- Return a clone virtual tmp<Function1<Type>> clone() const { - return tmp<Function1<Type>>(new None<Type>(*this)); + return Function1<Type>::Clone(*this); } diff --git a/src/OpenFOAM/primitives/functions/Function1/One/OneConstant.H b/src/OpenFOAM/primitives/functions/Function1/One/OneConstant.H index 84d496afb232ce5ca980651c0973dcc464ad30c4..8dc2bff57b62e3e079aec0584c6fd12a99a476d3 100644 --- a/src/OpenFOAM/primitives/functions/Function1/One/OneConstant.H +++ b/src/OpenFOAM/primitives/functions/Function1/One/OneConstant.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2017 OpenFOAM Foundation - Copyright (C) 2020-2022 OpenCFD Ltd. + Copyright (C) 2020-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -40,8 +40,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef Function1Types_OneConstant_H -#define Function1Types_OneConstant_H +#ifndef Foam_Function1Types_OneConstant_H +#define Foam_Function1Types_OneConstant_H #include "Function1.H" @@ -93,10 +93,10 @@ public: const objectRegistry* obrPtr = nullptr ); - //- Construct and return a clone + //- Return a clone virtual tmp<Function1<Type>> clone() const { - return tmp<Function1<Type>>(new OneConstant<Type>(*this)); + return Function1<Type>::Clone(*this); } diff --git a/src/OpenFOAM/primitives/functions/Function1/Polynomial/PolynomialEntry.H b/src/OpenFOAM/primitives/functions/Function1/Polynomial/PolynomialEntry.H index bf165ed22d228d09f70904622489e11237f0ceb6..61a5ba4daa5d6f5653d17f0f5e4414bdbee53155 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Polynomial/PolynomialEntry.H +++ b/src/OpenFOAM/primitives/functions/Function1/Polynomial/PolynomialEntry.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2021 OpenCFD Ltd. + Copyright (C) 2021-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -59,8 +59,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef Function1Types_Polynomial_H -#define Function1Types_Polynomial_H +#ifndef Foam_Function1Types_Polynomial_H +#define Foam_Function1Types_Polynomial_H #include "Function1.H" #include "Tuple2.H" @@ -127,10 +127,10 @@ public: //- Copy constructor explicit Polynomial(const Polynomial& poly); - //- Construct and return a clone + //- Return a clone virtual tmp<Function1<Type>> clone() const { - return tmp<Function1<Type>>(new Polynomial<Type>(*this)); + return Function1<Type>::Clone(*this); } diff --git a/src/OpenFOAM/primitives/functions/Function1/Scale/Scale.H b/src/OpenFOAM/primitives/functions/Function1/Scale/Scale.H index fe3c7ff0a68491a341d993e9db7ab6ffb36cc047..7df092c4ba3ee87029f26537b1ad67c31315e4d3 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Scale/Scale.H +++ b/src/OpenFOAM/primitives/functions/Function1/Scale/Scale.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2017 OpenFOAM Foundation - Copyright (C) 2020-2021 OpenCFD Ltd. + Copyright (C) 2020-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -72,8 +72,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef Function1Types_Scale_H -#define Function1Types_Scale_H +#ifndef Foam_Function1Types_Scale_H +#define Foam_Function1Types_Scale_H #include "Function1.H" @@ -133,10 +133,10 @@ public: //- Copy construct explicit Scale(const Scale<Type>& rhs); - //- Construct and return a clone + //- Return a clone virtual tmp<Function1<Type>> clone() const { - return tmp<Function1<Type>>(new Scale<Type>(*this)); + return Function1<Type>::Clone(*this); } diff --git a/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.H b/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.H index 58f255cba3779616c134c5c92480ece59b007b10..db86c65986e2c02541aa475daf11ff3a71f5e363 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.H +++ b/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 OpenFOAM Foundation - Copyright (C) 2020-2022 OpenCFD Ltd. + Copyright (C) 2020-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -98,8 +98,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef Function1Types_Sine_H -#define Function1Types_Sine_H +#ifndef Foam_Function1Types_Sine_H +#define Foam_Function1Types_Sine_H #include "Function1.H" @@ -192,10 +192,10 @@ public: //- Copy construct explicit Sine(const Sine<Type>& rhs); - //- Construct and return a clone + //- Return a clone virtual tmp<Function1<Type>> clone() const { - return tmp<Function1<Type>>(new Sine<Type>(*this)); + return Function1<Type>::Clone(*this); } diff --git a/src/OpenFOAM/primitives/functions/Function1/Square/Square.H b/src/OpenFOAM/primitives/functions/Function1/Square/Square.H index 0aa61cf6c51e9adc3c68fc3a1a4b504db5daa575..01d1aa4a04baa9bb1a48e5a03e4e5227460e97a7 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Square/Square.H +++ b/src/OpenFOAM/primitives/functions/Function1/Square/Square.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 OpenFOAM Foundation - Copyright (C) 2020-2021 OpenCFD Ltd. + Copyright (C) 2020-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -101,8 +101,8 @@ Note \*---------------------------------------------------------------------------*/ -#ifndef Function1Types_Square_H -#define Function1Types_Square_H +#ifndef Foam_Function1Types_Square_H +#define Foam_Function1Types_Square_H #include "Sine.H" @@ -155,10 +155,10 @@ public: //- Copy construct explicit Square(const Square<Type>& rhs); - //- Construct and return a clone + //- Return a clone virtual tmp<Function1<Type>> clone() const { - return tmp<Function1<Type>>(new Square<Type>(*this)); + return Function1<Type>::Clone(*this); } diff --git a/src/OpenFOAM/primitives/functions/Function1/Table/Table.H b/src/OpenFOAM/primitives/functions/Function1/Table/Table.H index c9832de5c0b5ca0fa882724cbc871fea6dac7c66..cdb2b4f5ca51420d2013e82fee65f15fa2e90a16 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Table/Table.H +++ b/src/OpenFOAM/primitives/functions/Function1/Table/Table.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2019-2021 OpenCFD Ltd. + Copyright (C) 2019-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -79,8 +79,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef Function1Types_Table_H -#define Function1Types_Table_H +#ifndef Foam_Function1Types_Table_H +#define Foam_Function1Types_Table_H #include "TableBase.H" @@ -130,10 +130,10 @@ public: //- Copy construct explicit Table(const Table<Type>& tbl); - //- Construct and return a clone + //- Return a clone virtual tmp<Function1<Type>> clone() const { - return tmp<Function1<Type>>(new Table<Type>(*this)); + return Function1<Type>::Clone(*this); } diff --git a/src/OpenFOAM/primitives/functions/Function1/TableFile/TableFile.H b/src/OpenFOAM/primitives/functions/Function1/TableFile/TableFile.H index 9cd1319d6d33a1f62aec4940d494f3dc8469b400..c622c8653ccfaafd5bc2d885d03892840fff2ff8 100644 --- a/src/OpenFOAM/primitives/functions/Function1/TableFile/TableFile.H +++ b/src/OpenFOAM/primitives/functions/Function1/TableFile/TableFile.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2019-2021 OpenCFD Ltd. + Copyright (C) 2019-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -59,8 +59,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef Function1Types_TableFile_H -#define Function1Types_TableFile_H +#ifndef Foam_Function1Types_TableFile_H +#define Foam_Function1Types_TableFile_H #include "TableBase.H" @@ -111,10 +111,10 @@ public: //- Copy construct explicit TableFile(const TableFile<Type>& tbl); - //- Construct and return a clone + //- Return a clone virtual tmp<Function1<Type>> clone() const { - return tmp<Function1<Type>>(new TableFile<Type>(*this)); + return Function1<Type>::Clone(*this); } diff --git a/src/OpenFOAM/primitives/functions/Function1/Uniform/Uniform.H b/src/OpenFOAM/primitives/functions/Function1/Uniform/Uniform.H index 1b17a7a355fe1926b0a40afa8f282a74ef11eb2f..22919c77ff11a31f487e4b9628d01d9835ae49fd 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Uniform/Uniform.H +++ b/src/OpenFOAM/primitives/functions/Function1/Uniform/Uniform.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2017 OpenFOAM Foundation - Copyright (C) 2020-2022 OpenCFD Ltd. + Copyright (C) 2020-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -40,8 +40,8 @@ Description \*---------------------------------------------------------------------------*/ -#ifndef Function1Types_Uniform_H -#define Function1Types_Uniform_H +#ifndef Foam_Function1Types_Uniform_H +#define Foam_Function1Types_Uniform_H #include "Constant.H" @@ -89,10 +89,10 @@ public: Constant<Type>(entryName, dict, obrPtr) {} - //- Construct and return a clone + //- Return a clone virtual tmp<Function1<Type>> clone() const { - return tmp<Function1<Type>>(new Uniform<Type>(*this)); + return Function1<Type>::Clone(*this); } }; diff --git a/src/OpenFOAM/primitives/functions/Function1/Zero/ZeroConstant.H b/src/OpenFOAM/primitives/functions/Function1/Zero/ZeroConstant.H index 3437ffc4a1a50189ddeb3b439f78f2215f32eaec..b457844b1bdee048368c9caee083b878e77a1465 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Zero/ZeroConstant.H +++ b/src/OpenFOAM/primitives/functions/Function1/Zero/ZeroConstant.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2017 OpenFOAM Foundation - Copyright (C) 2020-2022 OpenCFD Ltd. + Copyright (C) 2020-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -49,8 +49,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef Function1Types_ZeroConstant_H -#define Function1Types_ZeroConstant_H +#ifndef Foam_Function1Types_ZeroConstant_H +#define Foam_Function1Types_ZeroConstant_H #include "Function1.H" @@ -102,10 +102,10 @@ public: const objectRegistry* obrPtr = nullptr ); - //- Construct and return a clone + //- Return a clone virtual tmp<Function1<Type>> clone() const { - return tmp<Function1<Type>>(new ZeroConstant<Type>(*this)); + return Function1<Type>::Clone(*this); } diff --git a/src/finiteArea/distributed/faMeshDistributorTemplates.C b/src/finiteArea/distributed/faMeshDistributorTemplates.C index 19ddc494040cda42badc3744459b0a4a18eb6d9f..9215cc3b2bf31b15a99dd9d22f93c5b8d11d72f5 100644 --- a/src/finiteArea/distributed/faMeshDistributorTemplates.C +++ b/src/finiteArea/distributed/faMeshDistributorTemplates.C @@ -26,8 +26,8 @@ License \*---------------------------------------------------------------------------*/ #include "Time.H" -#include "emptyFaPatchField.H" -#include "emptyFaePatchField.H" +#include "faPatchFields.H" +#include "faePatchFields.H" #include "IOobjectList.H" #include "polyMesh.H" #include "polyPatch.H" @@ -49,10 +49,6 @@ Foam::faMeshDistributor::distributeField const GeometricField<Type, faPatchField, areaMesh>& fld ) const { - typedef typename - GeometricField<Type, faPatchField, areaMesh>::Patch - PatchFieldType; - if (tgtMesh_.boundary().size() && patchEdgeMaps_.empty()) { createPatchMaps(); @@ -87,7 +83,7 @@ Foam::faMeshDistributor::distributeField // Create patchFields by remote mapping - PtrList<PatchFieldType> newPatchFields(tgtMesh_.boundary().size()); + PtrList<faPatchField<Type>> newPatchFields(tgtMesh_.boundary().size()); const auto& bfld = fld.boundaryField(); @@ -107,11 +103,11 @@ Foam::faMeshDistributor::distributeField newPatchFields.set ( patchi, - PatchFieldType::New + faPatchField<Type>::New ( bfld[patchi], tgtMesh_.boundary()[patchi], - DimensionedField<Type, areaMesh>::null(), + faPatchField<Type>::Internal::null(), mapper ) ); @@ -127,11 +123,11 @@ Foam::faMeshDistributor::distributeField newPatchFields.set ( patchi, - PatchFieldType::New + faPatchField<Type>::New ( - emptyFaPatchField<Type>::typeName, + faPatchFieldBase::emptyType(), tgtMesh_.boundary()[patchi], - DimensionedField<Type, areaMesh>::null() + faPatchField<Type>::Internal::null() ) ); } @@ -158,10 +154,6 @@ Foam::faMeshDistributor::distributeField const GeometricField<Type, faePatchField, edgeMesh>& fld ) const { - typedef typename - GeometricField<Type, faePatchField, edgeMesh>::Patch - PatchFieldType; - if (!internalEdgeMap_) { createInternalEdgeMap(); @@ -197,7 +189,7 @@ Foam::faMeshDistributor::distributeField // Create patchFields by remote mapping - PtrList<PatchFieldType> newPatchFields(tgtMesh_.boundary().size()); + PtrList<faePatchField<Type>> newPatchFields(tgtMesh_.boundary().size()); const auto& bfld = fld.boundaryField(); @@ -217,11 +209,11 @@ Foam::faMeshDistributor::distributeField newPatchFields.set ( patchi, - PatchFieldType::New + faePatchField<Type>::New ( bfld[patchi], tgtMesh_.boundary()[patchi], - DimensionedField<Type, edgeMesh>::null(), + faePatchField<Type>::Internal::null(), mapper ) ); @@ -237,11 +229,11 @@ Foam::faMeshDistributor::distributeField newPatchFields.set ( patchi, - PatchFieldType::New + faePatchField<Type>::New ( - emptyFaePatchField<Type>::typeName, + faePatchFieldBase::emptyType(), tgtMesh_.boundary()[patchi], - DimensionedField<Type, edgeMesh>::null() + faePatchField<Type>::Internal::null() ) ); } diff --git a/src/finiteArea/faMesh/faMeshSubset/faMeshSubsetTemplates.C b/src/finiteArea/faMesh/faMeshSubset/faMeshSubsetTemplates.C index 93340446e483ed9f3d1314d918f790a3d10e3d9c..28a147b7b4a8da836d54dab61916399bfcddb08d 100644 --- a/src/finiteArea/faMesh/faMeshSubset/faMeshSubsetTemplates.C +++ b/src/finiteArea/faMesh/faMeshSubset/faMeshSubsetTemplates.C @@ -60,7 +60,7 @@ Foam::faMeshSubset::interpolate ( faPatchFieldBase::calculatedType(), sMesh.boundary()[patchi], - DimensionedField<Type, areaMesh>::null() + faPatchField<Type>::Internal::null() ) ); } @@ -167,7 +167,7 @@ Foam::faMeshSubset::interpolate ( faePatchFieldBase::calculatedType(), sMesh.boundary()[patchi], - DimensionedField<Type, edgeMesh>::null() + faePatchField<Type>::Internal::null() ) ); } diff --git a/src/finiteArea/fields/faPatchFields/faPatchField/faPatchField.H b/src/finiteArea/fields/faPatchFields/faPatchField/faPatchField.H index e1f208e274f7b4bb5c5ab594205385904d95e471..f2c438325badd8ca55a5780db486612c13221900 100644 --- a/src/finiteArea/fields/faPatchFields/faPatchField/faPatchField.H +++ b/src/finiteArea/fields/faPatchFields/faPatchField/faPatchField.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 Wikki Ltd - Copyright (C) 2019-2023 OpenCFD Ltd. + Copyright (C) 2019-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -238,11 +238,31 @@ class faPatchField public faPatchFieldBase, public Field<Type> { +public: + + // Public Data Types + + //- The patch type for the patch field + typedef faPatch Patch; + + //- The value_type for the patch field + typedef Type value_type; + + //- The internal field type associated with the patch field + typedef DimensionedField<Type, areaMesh> Internal; + + //- Type for a \em calculated patch + typedef calculatedFaPatchField<Type> Calculated; + + +private: + // Private Data //- Reference to internal field const DimensionedField<Type, areaMesh>& internalField_; + protected: // Protected Member Functions @@ -268,16 +288,6 @@ protected: public: - //- The internal field type associated with the patch field - typedef DimensionedField<Type, areaMesh> Internal; - - //- The patch type for the patch field - typedef faPatch Patch; - - //- Type for a \em calculated patch - typedef calculatedFaPatchField<Type> Calculated; - - // Declare run-time constructor selection tables declareRunTimeSelectionTable diff --git a/src/finiteArea/fields/faePatchFields/faePatchField/faePatchField.H b/src/finiteArea/fields/faePatchFields/faePatchField/faePatchField.H index d009f72dc8b99fd55dca7e8ba8e6ad9ef9b0d8c2..b484b702b5fd63a33255660b0ccb075efee0632a 100644 --- a/src/finiteArea/fields/faePatchFields/faePatchField/faePatchField.H +++ b/src/finiteArea/fields/faePatchFields/faePatchField/faePatchField.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 Wikki Ltd - Copyright (C) 2019-2023 OpenCFD Ltd. + Copyright (C) 2019-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -211,6 +211,25 @@ class faePatchField public faePatchFieldBase, public Field<Type> { +public: + + // Public Data Types + + //- The patch type for the patch field + typedef faPatch Patch; + + //- The value_type for the patch field + typedef Type value_type; + + //- The internal field type associated with the patch field + typedef DimensionedField<Type, edgeMesh> Internal; + + //- Type for a \em calculated patch + typedef calculatedFaePatchField<Type> Calculated; + + +private: + // Private Data //- Reference to internal field @@ -238,16 +257,6 @@ protected: public: - //- The internal field type associated with the patch field - typedef DimensionedField<Type, edgeMesh> Internal; - - //- The patch type for the patch field - typedef faPatch Patch; - - //- Type for a \em calculated patch - typedef calculatedFaePatchField<Type> Calculated; - - // Declare run-time constructor selection tables declareRunTimeSelectionTable diff --git a/src/finiteVolume/expressions/PatchFunction1/PatchFunction1Expression.C b/src/finiteVolume/expressions/PatchFunction1/PatchFunction1Expression.C index a342dc4b57cf8c1dfbdede94ea59b3043b8487ad..554e74e8a3862617d6294a2d21b36194ffe5f55b 100644 --- a/src/finiteVolume/expressions/PatchFunction1/PatchFunction1Expression.C +++ b/src/finiteVolume/expressions/PatchFunction1/PatchFunction1Expression.C @@ -65,24 +65,24 @@ Foam::PatchFunction1Types::PatchExprField<Type>::PatchExprField template<class Type> Foam::PatchFunction1Types::PatchExprField<Type>::PatchExprField ( - const PatchExprField<Type>& rhs + const PatchExprField<Type>& rhs, + const polyPatch& pp ) : - PatchExprField<Type>(rhs, rhs.patch()) + PatchFunction1<Type>(rhs, pp), + dict_(rhs.dict_), // Deep copy + valueExpr_(rhs.valueExpr_), + driver_(fvPatch::lookupPatch(this->patch()), rhs.driver_, dict_) {} template<class Type> Foam::PatchFunction1Types::PatchExprField<Type>::PatchExprField ( - const PatchExprField<Type>& rhs, - const polyPatch& pp + const PatchExprField<Type>& rhs ) : - PatchFunction1<Type>(rhs, pp), - dict_(rhs.dict_), // Deep copy - valueExpr_(rhs.valueExpr_), - driver_(fvPatch::lookupPatch(this->patch()), rhs.driver_, dict_) + PatchExprField<Type>(rhs, rhs.patch()) {} diff --git a/src/finiteVolume/expressions/PatchFunction1/PatchFunction1Expression.H b/src/finiteVolume/expressions/PatchFunction1/PatchFunction1Expression.H index 4a66dbc66986cf3bd6255a5f98cbc6e0eb713e31..ac3620918c34b9f737f6c7639751d67b35b106fa 100644 --- a/src/finiteVolume/expressions/PatchFunction1/PatchFunction1Expression.H +++ b/src/finiteVolume/expressions/PatchFunction1/PatchFunction1Expression.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -122,9 +122,6 @@ public: const bool faceValues = true ); - //- Copy construct - explicit PatchExprField(const PatchExprField<Type>& rhs); - //- Copy construct setting patch explicit PatchExprField ( @@ -132,22 +129,19 @@ public: const polyPatch& pp ); - //- Construct and return a clone + //- Copy construct + explicit PatchExprField(const PatchExprField<Type>& rhs); + + //- Return a clone virtual tmp<PatchFunction1<Type>> clone() const { - return tmp<PatchFunction1<Type>> - ( - new PatchExprField<Type>(*this) - ); + return PatchFunction1<Type>::Clone(*this); } - //- Construct and return a clone setting patch + //- Return a clone, setting the patch virtual tmp<PatchFunction1<Type>> clone(const polyPatch& pp) const { - return tmp<PatchFunction1<Type>> - ( - new PatchExprField<Type>(*this, pp) - ); + return PatchFunction1<Type>::Clone(*this, pp); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/Sampled/Sampled.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/Sampled/Sampled.C index 45601fe236525f609a4e196670dc2e54a5c8df4f..7cc3c3048de4f6fd7f6fbd3d7ae69530475bdec1 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/Sampled/Sampled.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/Sampled/Sampled.C @@ -73,16 +73,6 @@ Foam::PatchFunction1Types::Sampled<Type>::Sampled } -template<class Type> -Foam::PatchFunction1Types::Sampled<Type>::Sampled -( - const Sampled<Type>& rhs -) -: - Sampled<Type>(rhs, rhs.patch()) -{} - - template<class Type> Foam::PatchFunction1Types::Sampled<Type>::Sampled ( @@ -99,6 +89,16 @@ Foam::PatchFunction1Types::Sampled<Type>::Sampled {} +template<class Type> +Foam::PatchFunction1Types::Sampled<Type>::Sampled +( + const Sampled<Type>& rhs +) +: + Sampled<Type>(rhs, rhs.patch()) +{} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/Sampled/Sampled.H b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/Sampled/Sampled.H index a92ae7fd7a5c825babf3d0be92a2b925c4f5d5ee..7a64493489a9b91e4c916f88f340b17efc8bbca0 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/Sampled/Sampled.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/Sampled/Sampled.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018-2020 OpenCFD Ltd. + Copyright (C) 2018-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -149,9 +149,6 @@ public: const bool faceValues = true ); - //- Copy construct - explicit Sampled(const Sampled<Type>& rhs); - //- Copy construct setting patch explicit Sampled ( @@ -159,22 +156,19 @@ public: const polyPatch& pp ); - //- Construct and return a clone + //- Copy construct + explicit Sampled(const Sampled<Type>& rhs); + + //- Return a clone virtual tmp<PatchFunction1<Type>> clone() const { - return tmp<PatchFunction1<Type>> - ( - new Sampled<Type>(*this) - ); + return PatchFunction1<Type>::Clone(*this); } - //- Construct and return a clone setting patch + //- Return a clone, setting the patch virtual tmp<PatchFunction1<Type>> clone(const polyPatch& pp) const { - return tmp<PatchFunction1<Type>> - ( - new Sampled<Type>(*this, pp) - ); + return PatchFunction1<Type>::Clone(*this, pp); } diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H index 6237d679d883de88edbcba3946bd771d8fea52a0..1d993b178ba4d48ad2065df2da451a89a27d1492 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2019-2023 OpenCFD Ltd. + Copyright (C) 2019-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -281,11 +281,31 @@ class fvPatchField public fvPatchFieldBase, public Field<Type> { +public: + + // Public Data Types + + //- The patch type for the patch field + typedef fvPatch Patch; + + //- The value_type for the patch field + typedef Type value_type; + + //- The internal field type associated with the patch field + typedef DimensionedField<Type, volMesh> Internal; + + //- Type for a \em calculated patch + typedef calculatedFvPatchField<Type> Calculated; + + +private: + // Private Data //- Reference to internal field const DimensionedField<Type, volMesh>& internalField_; + protected: // Protected Member Functions @@ -311,16 +331,6 @@ protected: public: - //- The internal field type associated with the patch field - typedef DimensionedField<Type, volMesh> Internal; - - //- The patch type for the patch field - typedef fvPatch Patch; - - //- Type for a \em calculated patch - typedef calculatedFvPatchField<Type> Calculated; - - // Declare run-time constructor selection tables declareRunTimeSelectionTable diff --git a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H index c6ab5ffc0448ce07bbbf8b3ca2acb11f6385f125..d4b9ff1c180a2d12e48ad86e9130db317b3451bc 100644 --- a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H +++ b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019-2023 OpenCFD Ltd. + Copyright (C) 2019-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -205,11 +205,31 @@ class fvsPatchField public fvsPatchFieldBase, public Field<Type> { +public: + + // Public Data Types + + //- The patch type for the patch field + typedef fvPatch Patch; + + //- The value_type for the patch field + typedef Type value_type; + + //- The internal field type associated with the patch field + typedef DimensionedField<Type, surfaceMesh> Internal; + + //- Type for a \em calculated patch + typedef calculatedFvsPatchField<Type> Calculated; + + +private: + // Private Data //- Reference to internal field const DimensionedField<Type, surfaceMesh>& internalField_; + protected: // Protected Member Functions @@ -232,16 +252,6 @@ protected: public: - //- The internal field type associated with the patch field - typedef DimensionedField<Type, surfaceMesh> Internal; - - //- The patch type for the patch field - typedef fvPatch Patch; - - //- Type for a \em calculated patch - typedef calculatedFvsPatchField<Type> Calculated; - - // Declare run-time constructor selection tables declareRunTimeSelectionTable diff --git a/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubsetTemplates.C b/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubsetTemplates.C index 8d5da86172a61ad7f7a20309100f987b6885a8ea..9dd83ab0e0aed4058f4c5659be6cb1bd59cb60e2 100644 --- a/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubsetTemplates.C +++ b/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubsetTemplates.C @@ -67,7 +67,7 @@ Foam::fvMeshSubset::interpolate new emptyFvPatchField<Type> ( sMesh.boundary()[patchi], - DimensionedField<Type, volMesh>::null() + fvPatchField<Type>::Internal::null() ) ); } @@ -80,7 +80,7 @@ Foam::fvMeshSubset::interpolate ( fvPatchFieldBase::calculatedType(), sMesh.boundary()[patchi], - DimensionedField<Type, volMesh>::null() + fvPatchField<Type>::Internal::null() ) ); } @@ -248,7 +248,7 @@ Foam::fvMeshSubset::interpolate new emptyFvsPatchField<Type> ( sMesh.boundary()[patchi], - DimensionedField<Type, surfaceMesh>::null() + fvsPatchField<Type>::Internal::null() ) ); } @@ -261,7 +261,7 @@ Foam::fvMeshSubset::interpolate ( fvsPatchFieldBase::calculatedType(), sMesh.boundary()[patchi], - DimensionedField<Type, surfaceMesh>::null() + fvsPatchField<Type>::Internal::null() ) ); } @@ -435,7 +435,7 @@ Foam::fvMeshSubset::interpolate new emptyPointPatchField<Type> ( sMesh.boundary()[patchi], - DimensionedField<Type, pointMesh>::null() + pointPatchField<Type>::Internal::null() ) ); } @@ -448,7 +448,7 @@ Foam::fvMeshSubset::interpolate ( pointPatchFieldBase::calculatedType(), sMesh.boundary()[patchi], - DimensionedField<Type, pointMesh>::null() + pointPatchField<Type>::Internal::null() ) ); } diff --git a/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMeshInterpolate.C b/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMeshInterpolate.C index 767a08ff88ba1d858ade866d249217cfa65bc447..312b763fcc2fcd37a529f91fc74ebc3a40060828 100644 --- a/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMeshInterpolate.C +++ b/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMeshInterpolate.C @@ -55,7 +55,7 @@ tmp<GeometricField<Type, fvPatchField, volMesh>> singleCellFvMesh::interpolate ( fvPatchFieldBase::calculatedType(), boundary()[patchi], - DimensionedField<Type, volMesh>::null() + fvPatchField<Type>::Internal::null() ) ); } diff --git a/src/functionObjects/field/nearWallFields/findCellParticle.H b/src/functionObjects/field/nearWallFields/findCellParticle.H index c4238a66bae10cab29722e66fad5d83b417a5e3c..3c120921356985580115d395b32a90ee6215c740 100644 --- a/src/functionObjects/field/nearWallFields/findCellParticle.H +++ b/src/functionObjects/field/nearWallFields/findCellParticle.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2017 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -144,14 +144,13 @@ public: bool newFormat = true ); - //- Construct and return a clone - autoPtr<particle> clone() const + //- Return a clone + virtual autoPtr<particle> clone() const { - return autoPtr<particle>(new findCellParticle(*this)); + return particle::Clone(*this); } - //- Factory class to read-construct particles used for - // parallel transfer + //- Factory class to read-construct particles (for parallel transfer) class iNew { const polyMesh& mesh_; diff --git a/src/functionObjects/field/streamLine/streamLineParticle.H b/src/functionObjects/field/streamLine/streamLineParticle.H index 9f8045f00bf392ae641aecd0be60a3c0b8797a50..53cec863832dfab9c0df23bd52740cb3498a153f 100644 --- a/src/functionObjects/field/streamLine/streamLineParticle.H +++ b/src/functionObjects/field/streamLine/streamLineParticle.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2022 OpenCFD Ltd. + Copyright (C) 2022-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -170,10 +170,10 @@ public: //- Construct copy streamLineParticle(const streamLineParticle& p); - //- Construct and return a clone - autoPtr<particle> clone() const + //- Return a clone + virtual autoPtr<particle> clone() const { - return autoPtr<particle>(new streamLineParticle(*this)); + return particle::Clone(*this); } //- Factory class to read-construct particles used for parallel transfer diff --git a/src/functionObjects/field/wallBoundedStreamLine/wallBoundedParticle.H b/src/functionObjects/field/wallBoundedStreamLine/wallBoundedParticle.H index 9a49d00b16a0dfbcf0aa93c003a18173d06482b9..451b83a0ba0941bc49bdd2e1f0bf0d0b1bb32ab6 100644 --- a/src/functionObjects/field/wallBoundedStreamLine/wallBoundedParticle.H +++ b/src/functionObjects/field/wallBoundedStreamLine/wallBoundedParticle.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2019 OpenCFD Ltd. + Copyright (C) 2017-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -41,7 +41,6 @@ SourceFiles #define Foam_wallBoundedParticle_H #include "particle.H" -#include "autoPtr.H" #include "InfoProxy.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -176,14 +175,13 @@ public: //- Construct copy wallBoundedParticle(const wallBoundedParticle& p); - //- Construct and return a clone - autoPtr<particle> clone() const + //- Return a clone + virtual autoPtr<particle> clone() const { - return autoPtr<particle>(new wallBoundedParticle(*this)); + return particle::Clone(*this); } - //- Factory class to read-construct particles used for - // parallel transfer + //- Factory class to read-construct particles (for parallel transfer) class iNew { const polyMesh& mesh_; diff --git a/src/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.H b/src/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.H index a40535ee15cc44f047832faef34547426d32af5a..d2f4548448f4139df5181e6631bf63981d3c90bd 100644 --- a/src/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.H +++ b/src/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLineParticle.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2022 OpenCFD Ltd. + Copyright (C) 2017-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -40,7 +40,6 @@ SourceFiles #define Foam_wallBoundedStreamLineParticle_H #include "wallBoundedParticle.H" -#include "autoPtr.H" #include "interpolation.H" #include "vectorList.H" #include "InfoProxy.H" @@ -181,14 +180,13 @@ public: //- Construct copy wallBoundedStreamLineParticle(const wallBoundedStreamLineParticle& p); - //- Construct and return a clone + //- Return a clone autoPtr<particle> clone() const { - return autoPtr<particle>(new wallBoundedStreamLineParticle(*this)); + return particle::Clone(*this); } - //- Factory class to read-construct particles used for - // parallel transfer + //- Factory class to read-construct particles (for parallel transfer) class iNew { const polyMesh& mesh_; diff --git a/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.H b/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.H index d2946bc2adf20319d96828627607fd30c0adb9d1..a4982401490f8dae75e05418d5ac5febda89b015 100644 --- a/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.H +++ b/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2016 OpenCFD Ltd. + Copyright (C) 2016-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -42,7 +42,6 @@ SourceFiles #include "particle.H" #include "IOstream.H" -#include "autoPtr.H" #include "contiguous.H" #include "DSMCCloud.H" @@ -193,14 +192,13 @@ public: bool newFormat = true ); - //- Construct and return a clone + //- Return a clone virtual autoPtr<particle> clone() const { - return autoPtr<particle>(new DSMCParcel<ParcelType>(*this)); + return particle::Clone(*this); } - //- Factory class to read-construct particles used for - // parallel transfer + //- Factory class to read-construct particles (for parallel transfer) class iNew { const polyMesh& mesh_; diff --git a/src/lagrangian/basic/indexedParticle/indexedParticle.H b/src/lagrangian/basic/indexedParticle/indexedParticle.H index e08f525de66972eea4dee0e50410011bb2a095ec..66103eea8f9964ff3fd17becbaa6496b9a32eeb7 100644 --- a/src/lagrangian/basic/indexedParticle/indexedParticle.H +++ b/src/lagrangian/basic/indexedParticle/indexedParticle.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -40,7 +40,6 @@ SourceFiles #include "particle.H" #include "IOstream.H" -#include "autoPtr.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -109,13 +108,14 @@ public: //- Construct as a copy indexedParticle(const indexedParticle& p) : - particle(p) + particle(p), + index_(p.index_) {} - //- Construct and return a clone + //- Return a clone virtual autoPtr<particle> clone() const { - return autoPtr<particle>(new indexedParticle(*this)); + return particle::Clone(*this); } diff --git a/src/lagrangian/basic/injectedParticle/injectedParticle.H b/src/lagrangian/basic/injectedParticle/injectedParticle.H index 294108a7f34199f9c269e1f1cc5fbdd6e3e5ac5e..124fcf67f674b3105b7ab5bce9515c168a5ec033 100644 --- a/src/lagrangian/basic/injectedParticle/injectedParticle.H +++ b/src/lagrangian/basic/injectedParticle/injectedParticle.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016-2019 OpenCFD Ltd. + Copyright (C) 2016-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -46,7 +46,6 @@ SeeAlso #include "particle.H" #include "IOstream.H" -#include "autoPtr.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -147,20 +146,19 @@ public: //- Construct as a copy injectedParticle(const injectedParticle& p, const polyMesh& mesh); - //- Construct and return a (basic particle) clone + //- Return a (basic particle) clone virtual autoPtr<particle> clone() const { - return autoPtr<particle>(new injectedParticle(*this)); + return particle::Clone(*this); } //- Construct and return a (basic particle) clone virtual autoPtr<particle> clone(const polyMesh& mesh) const { - return autoPtr<particle>(new injectedParticle(*this, mesh)); + return particle::Clone(*this, mesh); } - //- Factory class to read-construct particles used for - // parallel transfer + //- Factory class to read-construct particles (for parallel transfer) class iNew { const polyMesh& mesh_; @@ -174,10 +172,7 @@ public: autoPtr<injectedParticle> operator()(Istream& is) const { - return autoPtr<injectedParticle> - ( - new injectedParticle(mesh_, is, true) - ); + return autoPtr<injectedParticle>::New(mesh_, is, true); } }; diff --git a/src/lagrangian/basic/particle/particle.C b/src/lagrangian/basic/particle/particle.C index 2ddea84408d4090b3182072da41ef260c50d466b..2939c3a6f39c4ebff4b4240c31f3ef845cec78f0 100644 --- a/src/lagrangian/basic/particle/particle.C +++ b/src/lagrangian/basic/particle/particle.C @@ -599,9 +599,9 @@ Foam::particle::particle } -Foam::particle::particle(const particle& p) +Foam::particle::particle(const particle& p, const polyMesh& mesh) : - mesh_(p.mesh_), + mesh_(mesh), coordinates_(p.coordinates_), celli_(p.celli_), tetFacei_(p.tetFacei_), @@ -615,19 +615,9 @@ Foam::particle::particle(const particle& p) {} -Foam::particle::particle(const particle& p, const polyMesh& mesh) +Foam::particle::particle(const particle& p) : - mesh_(mesh), - coordinates_(p.coordinates_), - celli_(p.celli_), - tetFacei_(p.tetFacei_), - tetPti_(p.tetPti_), - facei_(p.facei_), - stepFraction_(p.stepFraction_), - behind_(p.behind_), - nBehind_(p.nBehind_), - origProc_(p.origProc_), - origId_(p.origId_) + particle(p, p.mesh()) {} diff --git a/src/lagrangian/basic/particle/particle.H b/src/lagrangian/basic/particle/particle.H index 10e282e12ae6d7336a618e7471c349c70b91e257..97702a4ee6256b0126688d8f24fa5f9c6c09c0bd 100644 --- a/src/lagrangian/basic/particle/particle.H +++ b/src/lagrangian/basic/particle/particle.H @@ -417,18 +417,35 @@ public: const bool doLocate = true ); - //- Construct as a copy - particle(const particle& p); - - //- Construct as a copy with reference to a new mesh + //- Construct as a copy with reference to a mesh particle(const particle& p, const polyMesh& mesh); + //- Copy construct + particle(const particle& p); + //- Construct a clone virtual autoPtr<particle> clone() const { return autoPtr<particle>::New(*this); } + + // Factory Methods + + //- Clone a particle + template<class Derived> + static autoPtr<particle> Clone(const Derived& p) + { + return autoPtr<particle>(new Derived(p)); + } + + //- Clone a particle with a mesh reference + template<class Derived> + static autoPtr<particle> Clone(const Derived& p, const polyMesh& mesh) + { + return autoPtr<particle>(new Derived(p, mesh)); + } + //- Factory class to read-construct particles (for parallel transfer) class iNew { diff --git a/src/lagrangian/basic/passiveParticle/passiveParticle.H b/src/lagrangian/basic/passiveParticle/passiveParticle.H index 46593237ecee8968c96d1be1b8b236878870bd1b..13c1f18024596b115ee6cbca1cc71dcc9dc15698 100644 --- a/src/lagrangian/basic/passiveParticle/passiveParticle.H +++ b/src/lagrangian/basic/passiveParticle/passiveParticle.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -40,7 +40,6 @@ SourceFiles #include "particle.H" #include "IOstream.H" -#include "autoPtr.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -106,10 +105,10 @@ public: {} - //- Construct and return a clone + //- Return a clone virtual autoPtr<particle> clone() const { - return autoPtr<particle>(new passiveParticle(*this)); + return particle::Clone(*this); } diff --git a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcel.H b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcel.H index 7741b6195f7a4c9dfa92e52a7998505e44ad6542..ee46e5e4e5b0eb7d4fc15c122cbc6b8af4461a79 100644 --- a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcel.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2016-2019 OpenCFD Ltd. + Copyright (C) 2016-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -226,20 +226,19 @@ public: //- Construct as a copy CollidingParcel(const CollidingParcel& p, const polyMesh& mesh); - //- Construct and return a (basic particle) clone + //- Return a (basic particle) clone virtual autoPtr<particle> clone() const { - return autoPtr<particle>(new CollidingParcel(*this)); + return particle::Clone(*this); } - //- Construct and return a (basic particle) clone + //- Return a (basic particle) clone virtual autoPtr<particle> clone(const polyMesh& mesh) const { - return autoPtr<particle>(new CollidingParcel(*this, mesh)); + return particle::Clone(*this, mesh); } - //- Factory class to read-construct particles used for - // parallel transfer + //- Factory class to read-construct particles (for parallel transfer) class iNew { const polyMesh& mesh_; diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H index 14efa73daf272c7125d4574905762c02c19894e9..d8362c1ba0eeb70ba6577c2aa145676aabc849f9 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2016-2021 OpenCFD Ltd. + Copyright (C) 2016-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -52,7 +52,6 @@ SourceFiles #include "particle.H" #include "IOstream.H" -#include "autoPtr.H" #include "interpolation.H" #include "demandDrivenEntry.H" #include "labelFieldIOField.H" @@ -433,20 +432,19 @@ public: //- Construct as a copy KinematicParcel(const KinematicParcel& p, const polyMesh& mesh); - //- Construct and return a (basic particle) clone + //- Return a (basic particle) clone virtual autoPtr<particle> clone() const { - return autoPtr<particle>(new KinematicParcel(*this)); + return particle::Clone(*this); } - //- Construct and return a (basic particle) clone + //- Return a (basic particle) clone virtual autoPtr<particle> clone(const polyMesh& mesh) const { - return autoPtr<particle>(new KinematicParcel(*this, mesh)); + return particle::Clone(*this, mesh); } - //- Factory class to read-construct particles used for - // parallel transfer + //- Factory class to read-construct particles (for parallel transfer) class iNew { const polyMesh& mesh_; diff --git a/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcel.H b/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcel.H index 59cc4044fceb5b531bd1fdb54c8cbd00e19eea27..e62261d6d2cb2890c67a3d8286ef86ec314a3cb0 100644 --- a/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcel.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2017 OpenFOAM Foundation - Copyright (C) 2016-2019 OpenCFD Ltd. + Copyright (C) 2016-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -238,20 +238,19 @@ public: //- Construct as a copy MPPICParcel(const MPPICParcel& p, const polyMesh& mesh); - //- Construct and return a (basic particle) clone + //- Return a (basic particle) clone virtual autoPtr<particle> clone() const { - return autoPtr<particle>(new MPPICParcel(*this)); + return particle::Clone(*this); } - //- Construct and return a (basic particle) clone + //- Return a (basic particle) clone virtual autoPtr<particle> clone(const polyMesh& mesh) const { - return autoPtr<particle>(new MPPICParcel(*this, mesh)); + return particle::Clone(*this, mesh); } - //- Factory class to read-construct particles used for - // parallel transfer + //- Factory class to read-construct particles (for parallel transfer) class iNew { const polyMesh& mesh_; diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingHeterogeneousParcel/ReactingHeterogeneousParcel.H b/src/lagrangian/intermediate/parcels/Templates/ReactingHeterogeneousParcel/ReactingHeterogeneousParcel.H index 120cfcd4abb101f7a860855c7783eb75907257b7..fc589fac93383e4d2fcff2db6d844ad17cec0693 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingHeterogeneousParcel/ReactingHeterogeneousParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingHeterogeneousParcel/ReactingHeterogeneousParcel.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018-2019 OpenCFD Ltd. + Copyright (C) 2018-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -280,23 +280,19 @@ public: const polyMesh& mesh ); - //- Construct and return a (basic particle) clone + //- Return a (basic particle) clone virtual autoPtr<particle> clone() const { - return autoPtr<particle>(new ReactingHeterogeneousParcel(*this)); + return particle::Clone(*this); } - //- Construct and return a (basic particle) clone + //- Return a (basic particle) clone virtual autoPtr<particle> clone(const polyMesh& mesh) const { - return autoPtr<particle> - ( - new ReactingHeterogeneousParcel(*this, mesh) - ); + return particle::Clone(*this, mesh); } - //- Factory class to read-construct particles used for - // parallel transfer + //- Factory class to read-construct particles (for parallel transfer) class iNew { const polyMesh& mesh_; diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H index 757dc1bc5db572f9d94660294ed5d58bbc68b830..a2dd7c434e0cbb05dbe739be629a3ea23cb2e190 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2016-2019 OpenCFD Ltd. + Copyright (C) 2016-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -357,20 +357,19 @@ public: const polyMesh& mesh ); - //- Construct and return a (basic particle) clone + //- Return a (basic particle) clone virtual autoPtr<particle> clone() const { - return autoPtr<particle>(new ReactingMultiphaseParcel(*this)); + return particle::Clone(*this); } - //- Construct and return a (basic particle) clone + //- Return a (basic particle) clone virtual autoPtr<particle> clone(const polyMesh& mesh) const { - return autoPtr<particle>(new ReactingMultiphaseParcel(*this, mesh)); + return particle::Clone(*this, mesh); } - //- Factory class to read-construct particles used for - // parallel transfer + //- Factory class to read-construct particles (for parallel transfer) class iNew { const polyMesh& mesh_; diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H index 4491c506cc016776c6fff99c77b29f209c8e0ec6..a2975634172c9071b9a715b3f3ea340af448b590 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -327,23 +327,19 @@ public: //- Construct as a copy ReactingParcel(const ReactingParcel& p); - //- Construct and return a (basic particle) clone + //- Return a (basic particle) clone virtual autoPtr<particle> clone() const { - return autoPtr<particle>(new ReactingParcel<ParcelType>(*this)); + return particle::Clone(*this); } - //- Construct and return a (basic particle) clone + //- Return a (basic particle) clone virtual autoPtr<particle> clone(const polyMesh& mesh) const { - return autoPtr<particle> - ( - new ReactingParcel<ParcelType>(*this, mesh) - ); + return particle::Clone(*this, mesh); } - //- Factory class to read-construct particles used for - // parallel transfer + //- Factory class to read-construct particles (for parallel transfer) class iNew { const polyMesh& mesh_; diff --git a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H index dbbf70ffad050540d9be24986fe68e6fac47c94a..d22c06958aaad71da96c160ab129ec6694d946bb 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2016-2019 OpenCFD Ltd. + Copyright (C) 2016-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -348,20 +348,19 @@ public: //- Construct as a copy ThermoParcel(const ThermoParcel& p, const polyMesh& mesh); - //- Construct and return a (basic particle) clone + //- Return a (basic particle) clone virtual autoPtr<particle> clone() const { - return autoPtr<particle>(new ThermoParcel(*this)); + return particle::Clone(*this); } - //- Construct and return a (basic particle) clone + //- Return a (basic particle) clone virtual autoPtr<particle> clone(const polyMesh& mesh) const { - return autoPtr<particle>(new ThermoParcel(*this, mesh)); + return particle::Clone(*this, mesh); } - //- Factory class to read-construct particles used for - // parallel transfer + //- Factory class to read-construct particles (for parallel transfer) class iNew { const polyMesh& mesh_; diff --git a/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H b/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H index e11827c5c0340365d660434baa2c2956bb24d4fc..26dd41c15b4f7168106113aa14385f3b0c832b43 100644 --- a/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H +++ b/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2016 OpenCFD Ltd. + Copyright (C) 2016-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -42,7 +42,6 @@ SourceFiles #include "particle.H" #include "IOstream.H" -#include "autoPtr.H" #include "diagTensor.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -283,14 +282,13 @@ public: bool newFormat = true ); - //- Construct and return a clone - autoPtr<particle> clone() const + //- Return a clone + virtual autoPtr<particle> clone() const { - return autoPtr<particle>(new molecule(*this)); + return particle::Clone(*this); } - //- Factory class to read-construct particles used for - // parallel transfer + //- Factory class to read-construct particles (for parallel transfer) class iNew { const polyMesh& mesh_; diff --git a/src/lagrangian/solidParticle/solidParticle.H b/src/lagrangian/solidParticle/solidParticle.H index b82f7bc7e02fc37af16f5606c4c2e88718e26a9f..4f9375b91f36ef97b3e570b18784da6b96b7fc8a 100644 --- a/src/lagrangian/solidParticle/solidParticle.H +++ b/src/lagrangian/solidParticle/solidParticle.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2016-2019 OpenCFD Ltd. + Copyright (C) 2016-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -43,7 +43,6 @@ SourceFiles #include "particle.H" #include "IOstream.H" -#include "autoPtr.H" #include "interpolationCellPoint.H" #include "contiguous.H" @@ -185,10 +184,10 @@ public: bool newFormat = true ); - //- Construct and return a clone + //- Return a clone virtual autoPtr<particle> clone() const { - return autoPtr<particle>(new solidParticle(*this)); + return particle::Clone(*this); } //- Factory class to read-construct particles (for parallel transfer) diff --git a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.H b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.H index f77c4b2955ae0d9eb18af63ef4645165eba16fd5..eb47be3b227be3ba6f350abc8b71737bcb059065 100644 --- a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.H +++ b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2016-2019 OpenCFD Ltd. + Copyright (C) 2016-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -275,23 +275,19 @@ public: //- Construct as a copy SprayParcel(const SprayParcel& p); - //- Construct and return a (basic particle) clone + //- Return a (basic particle) clone virtual autoPtr<particle> clone() const { - return autoPtr<particle>(new SprayParcel<ParcelType>(*this)); + return particle::Clone(*this); } - //- Construct and return a (basic particle) clone + //- Return a (basic particle) clone virtual autoPtr<particle> clone(const polyMesh& mesh) const { - return autoPtr<particle> - ( - new SprayParcel<ParcelType>(*this, mesh) - ); + return particle::Clone(*this, mesh); } - //- Factory class to read-construct particles used for - // parallel transfer + //- Factory class to read-construct particles (for parallel transfer) class iNew { const polyMesh& mesh_; diff --git a/src/mesh/snappyHexMesh/trackedParticle/trackedParticle.H b/src/mesh/snappyHexMesh/trackedParticle/trackedParticle.H index a4ae212678aef027839d2827ea9976f803f1b8fb..ce831e5238a07bae2a1dc4758cecf0069f5f114a 100644 --- a/src/mesh/snappyHexMesh/trackedParticle/trackedParticle.H +++ b/src/mesh/snappyHexMesh/trackedParticle/trackedParticle.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2017-2019 OpenCFD Ltd. + Copyright (C) 2017-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -41,7 +41,6 @@ SourceFiles #include "bitSet.H" #include "particle.H" -#include "autoPtr.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -164,14 +163,13 @@ public: bool newFormat = true ); - //- Construct and return a clone - autoPtr<particle> clone() const + //- Return a clone + virtual autoPtr<particle> clone() const { - return autoPtr<particle>::NewFrom<trackedParticle>(*this); + return particle::Clone(*this); } - //- Factory class to read-construct particles used for - // parallel transfer + //- Factory class to read-construct particles (for parallel transfer) class iNew { const polyMesh& mesh_; diff --git a/src/meshTools/PatchFunction1/CodedField/CodedField.C b/src/meshTools/PatchFunction1/CodedField/CodedField.C index 8cea612466b573cfed98b885440837347645bb3e..d4a39fa793c11e55d5a9210c577b84eb5b30b8d9 100644 --- a/src/meshTools/PatchFunction1/CodedField/CodedField.C +++ b/src/meshTools/PatchFunction1/CodedField/CodedField.C @@ -168,24 +168,24 @@ Foam::PatchFunction1Types::CodedField<Type>::CodedField template<class Type> Foam::PatchFunction1Types::CodedField<Type>::CodedField ( - const CodedField<Type>& rhs + const CodedField<Type>& rhs, + const polyPatch& pp ) : - CodedField<Type>(rhs, rhs.patch()) + PatchFunction1<Type>(rhs, pp), + codedBase(), + dict_(rhs.dict_), + redirectName_(rhs.redirectName_) {} template<class Type> Foam::PatchFunction1Types::CodedField<Type>::CodedField ( - const CodedField<Type>& rhs, - const polyPatch& pp + const CodedField<Type>& rhs ) : - PatchFunction1<Type>(rhs, pp), - codedBase(), - dict_(rhs.dict_), - redirectName_(rhs.redirectName_) + CodedField<Type>(rhs, rhs.patch()) {} diff --git a/src/meshTools/PatchFunction1/CodedField/CodedField.H b/src/meshTools/PatchFunction1/CodedField/CodedField.H index 54cf23076e1f941b0503dd18a8731f5f197fdca2..ba3228d57115802c9d3b947865c7f2fdc16184c3 100644 --- a/src/meshTools/PatchFunction1/CodedField/CodedField.H +++ b/src/meshTools/PatchFunction1/CodedField/CodedField.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2020-2021 OpenCFD Ltd. + Copyright (C) 2020-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -181,9 +181,6 @@ public: const bool faceValues = true ); - //- Copy construct - explicit CodedField(const CodedField<Type>& rhs); - //- Copy construct, setting patch explicit CodedField ( @@ -191,22 +188,19 @@ public: const polyPatch& pp ); - //- Construct and return a clone + //- Copy construct + explicit CodedField(const CodedField<Type>& rhs); + + //- Return a clone virtual tmp<PatchFunction1<Type>> clone() const { - return tmp<PatchFunction1<Type>> - ( - new CodedField<Type>(*this) - ); + return PatchFunction1<Type>::Clone(*this); } - //- Construct and return a clone setting patch + //- Return a clone, setting the patch virtual tmp<PatchFunction1<Type>> clone(const polyPatch& pp) const { - return tmp<PatchFunction1<Type>> - ( - new CodedField<Type>(*this, pp) - ); + return PatchFunction1<Type>::Clone(*this, pp); } diff --git a/src/meshTools/PatchFunction1/ConstantField/ConstantField.C b/src/meshTools/PatchFunction1/ConstantField/ConstantField.C index 262fb5d7bf80ab3a11bf2cc8654f1932e0e454ee..abf183487acae505adbf2838dec9f618c6b05bbf 100644 --- a/src/meshTools/PatchFunction1/ConstantField/ConstantField.C +++ b/src/meshTools/PatchFunction1/ConstantField/ConstantField.C @@ -248,16 +248,6 @@ Foam::PatchFunction1Types::ConstantField<Type>::ConstantField {} -template<class Type> -Foam::PatchFunction1Types::ConstantField<Type>::ConstantField -( - const ConstantField<Type>& rhs -) -: - ConstantField<Type>(rhs, rhs.patch()) -{} - - template<class Type> Foam::PatchFunction1Types::ConstantField<Type>::ConstantField ( @@ -280,6 +270,16 @@ Foam::PatchFunction1Types::ConstantField<Type>::ConstantField } +template<class Type> +Foam::PatchFunction1Types::ConstantField<Type>::ConstantField +( + const ConstantField<Type>& rhs +) +: + ConstantField<Type>(rhs, rhs.patch()) +{} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> diff --git a/src/meshTools/PatchFunction1/ConstantField/ConstantField.H b/src/meshTools/PatchFunction1/ConstantField/ConstantField.H index 267897593067751772057b10b87a6036d7a1b0b2..9d66bd343c49344205ac30ca24de2584f26dad0d 100644 --- a/src/meshTools/PatchFunction1/ConstantField/ConstantField.H +++ b/src/meshTools/PatchFunction1/ConstantField/ConstantField.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018-2022 OpenCFD Ltd. + Copyright (C) 2018-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -147,9 +147,6 @@ public: const bool faceValues = true ); - //- Copy construct - explicit ConstantField(const ConstantField<Type>& rhs); - //- Copy construct setting patch explicit ConstantField ( @@ -157,19 +154,19 @@ public: const polyPatch& pp ); - //- Construct and return a clone + //- Copy construct + explicit ConstantField(const ConstantField<Type>& rhs); + + //- Return a clone virtual tmp<PatchFunction1<Type>> clone() const { - return tmp<PatchFunction1<Type>>(new ConstantField<Type>(*this)); + return PatchFunction1<Type>::Clone(*this); } - //- Construct and return a clone setting patch + //- Return a clone, setting the patch virtual tmp<PatchFunction1<Type>> clone(const polyPatch& pp) const { - return tmp<PatchFunction1<Type>> - ( - new ConstantField<Type>(*this, pp) - ); + return PatchFunction1<Type>::Clone(*this, pp); } diff --git a/src/meshTools/PatchFunction1/MappedFile/MappedFile.C b/src/meshTools/PatchFunction1/MappedFile/MappedFile.C index 6d6138017aac29615a66739457e94d2bfbe6287f..98f54c33342edf8fee13d471ad3bda9ec4954e08 100644 --- a/src/meshTools/PatchFunction1/MappedFile/MappedFile.C +++ b/src/meshTools/PatchFunction1/MappedFile/MappedFile.C @@ -167,16 +167,6 @@ Foam::PatchFunction1Types::MappedFile<Type>::MappedFile {} -template<class Type> -Foam::PatchFunction1Types::MappedFile<Type>::MappedFile -( - const MappedFile<Type>& rhs -) -: - MappedFile<Type>(rhs, rhs.patch()) -{} - - template<class Type> Foam::PatchFunction1Types::MappedFile<Type>::MappedFile ( @@ -214,6 +204,16 @@ Foam::PatchFunction1Types::MappedFile<Type>::MappedFile } +template<class Type> +Foam::PatchFunction1Types::MappedFile<Type>::MappedFile +( + const MappedFile<Type>& rhs +) +: + MappedFile<Type>(rhs, rhs.patch()) +{} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> diff --git a/src/meshTools/PatchFunction1/MappedFile/MappedFile.H b/src/meshTools/PatchFunction1/MappedFile/MappedFile.H index 7a87184340448b1fa7c9e7c9eb167526d1bbcefa..3116b04abab33bacf263661ff7e8e63e0eefb146 100644 --- a/src/meshTools/PatchFunction1/MappedFile/MappedFile.H +++ b/src/meshTools/PatchFunction1/MappedFile/MappedFile.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018-2022 OpenCFD Ltd. + Copyright (C) 2018-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -219,9 +219,6 @@ public: const bool faceValues = true ); - //- Copy construct - explicit MappedFile(const MappedFile<Type>& rhs); - //- Copy construct setting patch explicit MappedFile ( @@ -229,22 +226,19 @@ public: const polyPatch& pp ); - //- Construct and return a clone + //- Copy construct + explicit MappedFile(const MappedFile<Type>& rhs); + + //- Return a clone virtual tmp<PatchFunction1<Type>> clone() const { - return tmp<PatchFunction1<Type>> - ( - new MappedFile<Type>(*this) - ); + return PatchFunction1<Type>::Clone(*this, this->patch()); } - //- Construct and return a clone setting patch + //- Return a clone, setting the patch virtual tmp<PatchFunction1<Type>> clone(const polyPatch& pp) const { - return tmp<PatchFunction1<Type>> - ( - new MappedFile<Type>(*this, pp) - ); + return PatchFunction1<Type>::Clone(*this, pp); } diff --git a/src/meshTools/PatchFunction1/PatchFunction1/PatchFunction1.C b/src/meshTools/PatchFunction1/PatchFunction1/PatchFunction1.C index 2e6c728f58805d6ec04c0be2191d1a8806d57367..f5ce15c8cdb546770b3b99d1a0a318b93d9a8fe7 100644 --- a/src/meshTools/PatchFunction1/PatchFunction1/PatchFunction1.C +++ b/src/meshTools/PatchFunction1/PatchFunction1/PatchFunction1.C @@ -58,13 +58,6 @@ Foam::PatchFunction1<Type>::PatchFunction1 {} -template<class Type> -Foam::PatchFunction1<Type>::PatchFunction1(const PatchFunction1<Type>& rhs) -: - PatchFunction1<Type>(rhs, rhs.patch()) -{} - - template<class Type> Foam::PatchFunction1<Type>::PatchFunction1 ( @@ -77,6 +70,13 @@ Foam::PatchFunction1<Type>::PatchFunction1 {} +template<class Type> +Foam::PatchFunction1<Type>::PatchFunction1(const PatchFunction1<Type>& rhs) +: + PatchFunction1<Type>(rhs, rhs.patch()) +{} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> diff --git a/src/meshTools/PatchFunction1/PatchFunction1/PatchFunction1.H b/src/meshTools/PatchFunction1/PatchFunction1/PatchFunction1.H index b8e075e5f590466b0d486ec9f96a9abf1b88af84..3c9754674335c9582180f24a15921b03df05ddb2 100644 --- a/src/meshTools/PatchFunction1/PatchFunction1/PatchFunction1.H +++ b/src/meshTools/PatchFunction1/PatchFunction1/PatchFunction1.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018-2022 OpenCFD Ltd. + Copyright (C) 2018-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -147,9 +147,6 @@ public: const bool faceValues = true ); - //- Copy construct - explicit PatchFunction1(const PatchFunction1<Type>& rhs); - //- Copy construct setting patch explicit PatchFunction1 ( @@ -157,6 +154,9 @@ public: const polyPatch& pp ); + //- Copy construct + explicit PatchFunction1(const PatchFunction1<Type>& rhs); + //- Return a clone virtual tmp<PatchFunction1<Type>> clone() const = 0; @@ -164,7 +164,24 @@ public: virtual tmp<PatchFunction1<Type>> clone(const polyPatch& pp) const = 0; - // Selectors + // Factory Methods + + //- Clone a PatchFunction1 + template<class Derived> + static tmp<PatchFunction1<Type>> + Clone(const Derived& fun) + { + return tmp<PatchFunction1<Type>>(new Derived(fun)); + } + + //- Clone a PatchFunction1 with a patch + template<class Derived> + static tmp<PatchFunction1<Type>> + Clone(const Derived& fun, const polyPatch& pp) + { + return tmp<PatchFunction1<Type>>(new Derived(fun, pp)); + } + //- Selector static autoPtr<PatchFunction1<Type>> New diff --git a/src/meshTools/PatchFunction1/UniformValueField/UniformValueField.C b/src/meshTools/PatchFunction1/UniformValueField/UniformValueField.C index aafc6abdc2e467d2f87558480bc3854c5939d8ef..7204c9ed67b6f48b6c102326013a70d8ab72ced7 100644 --- a/src/meshTools/PatchFunction1/UniformValueField/UniformValueField.C +++ b/src/meshTools/PatchFunction1/UniformValueField/UniformValueField.C @@ -54,16 +54,6 @@ Foam::PatchFunction1Types::UniformValueField<Type>::UniformValueField {} -template<class Type> -Foam::PatchFunction1Types::UniformValueField<Type>::UniformValueField -( - const UniformValueField<Type>& rhs -) -: - UniformValueField<Type>(rhs, rhs.patch()) -{} - - template<class Type> Foam::PatchFunction1Types::UniformValueField<Type>::UniformValueField ( @@ -81,6 +71,16 @@ Foam::PatchFunction1Types::UniformValueField<Type>::UniformValueField } +template<class Type> +Foam::PatchFunction1Types::UniformValueField<Type>::UniformValueField +( + const UniformValueField<Type>& rhs +) +: + UniformValueField<Type>(rhs, rhs.patch()) +{} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> diff --git a/src/meshTools/PatchFunction1/UniformValueField/UniformValueField.H b/src/meshTools/PatchFunction1/UniformValueField/UniformValueField.H index 789aa3d70dad42f90964d9e133a464a0870f29dc..01a107c0852b13af5394b15a3c6112045e4f3b5c 100644 --- a/src/meshTools/PatchFunction1/UniformValueField/UniformValueField.H +++ b/src/meshTools/PatchFunction1/UniformValueField/UniformValueField.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018-2021 OpenCFD Ltd. + Copyright (C) 2018-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -40,8 +40,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef PatchFunction1Types_UniformValueField_H -#define PatchFunction1Types_UniformValueField_H +#ifndef Foam_PatchFunction1Types_UniformValueField_H +#define Foam_PatchFunction1Types_UniformValueField_H #include "PatchFunction1.H" #include "Function1.H" @@ -92,9 +92,6 @@ public: const bool faceValues = true ); - //- Copy construct - explicit UniformValueField(const UniformValueField<Type>& rhs); - //- Copy construct setting patch explicit UniformValueField ( @@ -102,22 +99,19 @@ public: const polyPatch& pp ); - //- Construct and return a clone + //- Copy construct + explicit UniformValueField(const UniformValueField<Type>& rhs); + + //- Return a clone virtual tmp<PatchFunction1<Type>> clone() const { - return tmp<PatchFunction1<Type>> - ( - new UniformValueField<Type>(*this) - ); + return PatchFunction1<Type>::Clone(*this); } - //- Construct and return a clone setting patch + //- Return a clone, setting the patch virtual tmp<PatchFunction1<Type>> clone(const polyPatch& pp) const { - return tmp<PatchFunction1<Type>> - ( - new UniformValueField<Type>(*this, pp) - ); + return PatchFunction1<Type>::Clone(*this, pp); } diff --git a/src/parallel/decompose/decompose/fvFieldDecomposerTemplates.C b/src/parallel/decompose/decompose/fvFieldDecomposerTemplates.C index caa7884053f10100264be19078c10d1b80dee1b7..007ee5d3d0fd9c0ff68db940aa28b81037507d76 100644 --- a/src/parallel/decompose/decompose/fvFieldDecomposerTemplates.C +++ b/src/parallel/decompose/decompose/fvFieldDecomposerTemplates.C @@ -89,7 +89,7 @@ Foam::fvFieldDecomposer::decomposeField ( fvPatchFieldBase::calculatedType(), procMesh_.boundary()[patchi], - DimensionedField<Type, volMesh>::null() + fvPatchField<Type>::Internal::null() ) ); } @@ -262,7 +262,7 @@ Foam::fvFieldDecomposer::decomposeField ( fvsPatchFieldBase::calculatedType(), procMesh_.boundary()[patchi], - DimensionedField<Type, surfaceMesh>::null() + fvsPatchField<Type>::Internal::null() ) ); } diff --git a/src/parallel/decompose/decompose/pointFieldDecomposerTemplates.C b/src/parallel/decompose/decompose/pointFieldDecomposerTemplates.C index b42fbc1a21fb14ea681ee5cb9b9cceaf1614e1df..0c01857cd7eba0f9d53be2fdb30a37a1e70a387d 100644 --- a/src/parallel/decompose/decompose/pointFieldDecomposerTemplates.C +++ b/src/parallel/decompose/decompose/pointFieldDecomposerTemplates.C @@ -56,7 +56,7 @@ Foam::pointFieldDecomposer::decomposeField ( field.boundaryField()[boundaryAddressing_[patchi]], procMesh_.boundary()[patchi], - DimensionedField<Type, pointMesh>::null(), + pointPatchField<Type>::Internal::null(), patchFieldDecomposerPtrs_[patchi] ) ); @@ -69,7 +69,7 @@ Foam::pointFieldDecomposer::decomposeField new processorPointPatchField<Type> ( procMesh_.boundary()[patchi], - DimensionedField<Type, pointMesh>::null() + pointPatchField<Type>::Internal::null() ) ); } diff --git a/src/parallel/decompose/faDecompose/faFieldDecomposerTemplates.C b/src/parallel/decompose/faDecompose/faFieldDecomposerTemplates.C index 2c6cfb251f750d614fd0dddea06b221070362ccb..ee072e7a67cbb979e5096dd85bcbfeddb2dc9615 100644 --- a/src/parallel/decompose/faDecompose/faFieldDecomposerTemplates.C +++ b/src/parallel/decompose/faDecompose/faFieldDecomposerTemplates.C @@ -60,7 +60,7 @@ Foam::faFieldDecomposer::decomposeField ( field.boundaryField()[oldPatchi], procMesh_.boundary()[patchi], - DimensionedField<Type, areaMesh>::null(), + faPatchField<Type>::Internal::null(), patchFieldDecomposerPtrs_[patchi] ) ); @@ -73,7 +73,7 @@ Foam::faFieldDecomposer::decomposeField new processorFaPatchField<Type> ( procMesh_.boundary()[patchi], - DimensionedField<Type, areaMesh>::null(), + faPatchField<Type>::Internal::null(), Field<Type> ( field.internalField(), @@ -171,7 +171,7 @@ Foam::faFieldDecomposer::decomposeField ( field.boundaryField()[oldPatchi], procMesh_.boundary()[patchi], - DimensionedField<Type, edgeMesh>::null(), + faePatchField<Type>::Internal::null(), patchFieldDecomposerPtrs_[patchi] ) ); @@ -184,7 +184,7 @@ Foam::faFieldDecomposer::decomposeField new processorFaePatchField<Type> ( procMesh_.boundary()[patchi], - DimensionedField<Type, edgeMesh>::null(), + faePatchField<Type>::Internal::null(), Field<Type> ( allEdgeField, diff --git a/src/parallel/reconstruct/faReconstruct/faFieldReconstructorTemplates.C b/src/parallel/reconstruct/faReconstruct/faFieldReconstructorTemplates.C index e5c27951ff7cefbcf5f5f2b1445c1991725cb849..15d1fb3b63db1a89097b082754d86c06ac0f795c 100644 --- a/src/parallel/reconstruct/faReconstruct/faFieldReconstructorTemplates.C +++ b/src/parallel/reconstruct/faReconstruct/faFieldReconstructorTemplates.C @@ -29,10 +29,9 @@ License #include "faFieldReconstructor.H" #include "Time.H" #include "PtrList.H" -#include "faPatchFields.H" #include "emptyFaPatch.H" -#include "emptyFaPatchField.H" -#include "emptyFaePatchField.H" +#include "faPatchFields.H" +#include "faePatchFields.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -130,7 +129,7 @@ Foam::faFieldReconstructor::reconstructField ( procField.boundaryField()[patchI], mesh_.boundary()[curBPatch], - DimensionedField<Type, areaMesh>::null(), + faPatchField<Type>::Internal::null(), faPatchFieldReconstructor ( mesh_.boundary()[curBPatch].size(), @@ -204,7 +203,7 @@ Foam::faFieldReconstructor::reconstructField ( mesh_.boundary()[curBPatch].type(), mesh_.boundary()[curBPatch], - DimensionedField<Type, areaMesh>::null() + faPatchField<Type>::Internal::null() ) ); } @@ -238,9 +237,9 @@ Foam::faFieldReconstructor::reconstructField patchI, faPatchField<Type>::New ( - emptyFaPatchField<Type>::typeName, + faPatchFieldBase::emptyType(), mesh_.boundary()[patchI], - DimensionedField<Type, areaMesh>::null() + faPatchField<Type>::Internal::null() ) ); } @@ -371,7 +370,7 @@ Foam::faFieldReconstructor::reconstructField ( procField.boundaryField()[patchI], mesh_.boundary()[curBPatch], - DimensionedField<Type, edgeMesh>::null(), + faePatchField<Type>::Internal::null(), faPatchFieldReconstructor ( mesh_.boundary()[curBPatch].size(), @@ -448,8 +447,7 @@ Foam::faFieldReconstructor::reconstructField ( mesh_.boundary()[curBPatch].type(), mesh_.boundary()[curBPatch], - DimensionedField<Type, edgeMesh> - ::null() + faePatchField<Type>::Internal::null() ) ); } @@ -489,9 +487,9 @@ Foam::faFieldReconstructor::reconstructField patchI, faePatchField<Type>::New ( - emptyFaePatchField<Type>::typeName, + faePatchFieldBase::emptyType(), mesh_.boundary()[patchI], - DimensionedField<Type, edgeMesh>::null() + faePatchField<Type>::Internal::null() ) ); } diff --git a/src/parallel/reconstruct/reconstruct/fvFieldReconstructorTemplates.C b/src/parallel/reconstruct/reconstruct/fvFieldReconstructorTemplates.C index 70a31ea8ccc7abc68821b0eedf8c2967e1d7f49e..1549abe4e78f3286b56ba9ba8b9c837408a9fc79 100644 --- a/src/parallel/reconstruct/reconstruct/fvFieldReconstructorTemplates.C +++ b/src/parallel/reconstruct/reconstruct/fvFieldReconstructorTemplates.C @@ -29,10 +29,9 @@ License #include "fvFieldReconstructor.H" #include "Time.H" #include "PtrList.H" -#include "fvPatchFields.H" #include "emptyFvPatch.H" -#include "emptyFvPatchField.H" -#include "emptyFvsPatchField.H" +#include "fvPatchFields.H" +#include "fvsPatchFields.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -125,7 +124,7 @@ Foam::fvFieldReconstructor::reconstructField ( procField.boundaryField()[patchi], mesh_.boundary()[curBPatch], - DimensionedField<Type, volMesh>::null(), + fvPatchField<Type>::Internal::null(), fvPatchFieldReconstructor ( mesh_.boundary()[curBPatch].size() @@ -193,7 +192,7 @@ Foam::fvFieldReconstructor::reconstructField ( mesh_.boundary()[curBPatch].type(), mesh_.boundary()[curBPatch], - DimensionedField<Type, volMesh>::null() + fvPatchField<Type>::Internal::null() ) ); } @@ -225,9 +224,9 @@ Foam::fvFieldReconstructor::reconstructField patchi, fvPatchField<Type>::New ( - emptyFvPatchField<Type>::typeName, + fvPatchFieldBase::emptyType(), mesh_.boundary()[patchi], - DimensionedField<Type, volMesh>::null() + fvPatchField<Type>::Internal::null() ) ); } @@ -323,7 +322,7 @@ Foam::fvFieldReconstructor::reconstructField ( procField.boundaryField()[patchi], mesh_.boundary()[curBPatch], - DimensionedField<Type, surfaceMesh>::null(), + fvsPatchField<Type>::Internal::null(), fvPatchFieldReconstructor ( mesh_.boundary()[curBPatch].size() @@ -379,8 +378,7 @@ Foam::fvFieldReconstructor::reconstructField ( mesh_.boundary()[curBPatch].type(), mesh_.boundary()[curBPatch], - DimensionedField<Type, surfaceMesh> - ::null() + fvsPatchField<Type>::Internal::null() ) ); } @@ -418,9 +416,9 @@ Foam::fvFieldReconstructor::reconstructField patchi, fvsPatchField<Type>::New ( - emptyFvsPatchField<Type>::typeName, + fvsPatchFieldBase::emptyType(), mesh_.boundary()[patchi], - DimensionedField<Type, surfaceMesh>::null() + fvsPatchField<Type>::Internal::null() ) ); } diff --git a/src/parallel/reconstruct/reconstruct/passivePositionParticle.H b/src/parallel/reconstruct/reconstruct/passivePositionParticle.H index b7cb6bab060d93ac880dc264e10068006cf800e8..392b109d4321facd42a88b326b73b99a4c8a649f 100644 --- a/src/parallel/reconstruct/reconstruct/passivePositionParticle.H +++ b/src/parallel/reconstruct/reconstruct/passivePositionParticle.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2021-2022 OpenCFD Ltd. + Copyright (C) 2021-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -43,7 +43,6 @@ SourceFiles #include "particle.H" #include "IOstream.H" -#include "autoPtr.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -131,17 +130,17 @@ public: //- Construct as copy passivePositionParticle(const passivePositionParticle& p) : - particle(p) + particle(p), + location_(p.location_) {} - //- Construct and return a clone + //- Return a clone virtual autoPtr<particle> clone() const { - return autoPtr<particle>(new passivePositionParticle(*this)); + return particle::Clone(*this); } - //- Factory class to read-construct particles (for parallel transfer) class iNew { diff --git a/src/parallel/reconstruct/reconstruct/pointFieldReconstructorTemplates.C b/src/parallel/reconstruct/reconstruct/pointFieldReconstructorTemplates.C index ae49e24b1b7f9bed9076b946288398b51b58ac7c..bc7b03167a29a2990f2fdb4cc9eb01d5fdc3aed8 100644 --- a/src/parallel/reconstruct/reconstruct/pointFieldReconstructorTemplates.C +++ b/src/parallel/reconstruct/reconstruct/pointFieldReconstructorTemplates.C @@ -79,7 +79,7 @@ Foam::pointFieldReconstructor::reconstructField ( procField.boundaryField()[patchi], mesh_.boundary()[curBPatch], - DimensionedField<Type, pointMesh>::null(), + pointPatchField<Type>::Internal::null(), pointPatchFieldReconstructor ( mesh_.boundary()[curBPatch].size() diff --git a/src/sampling/functions/Function1/Sample/SampleFunction1.H b/src/sampling/functions/Function1/Sample/SampleFunction1.H index 5500abab7dfda4730687304fa73ece0cc45e736b..513c847352dd9d4a11229bd25cea636c327cd7cf 100644 --- a/src/sampling/functions/Function1/Sample/SampleFunction1.H +++ b/src/sampling/functions/Function1/Sample/SampleFunction1.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2021 OpenCFD Ltd. + Copyright (C) 2021-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -45,8 +45,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef Function1Types_Sample_H -#define Function1Types_Sample_H +#ifndef Foam_Function1Types_Sample_H +#define Foam_Function1Types_Sample_H #include "Function1.H" #include "point.H" @@ -121,10 +121,10 @@ public: //- Copy constructor explicit Sample(const Sample& poly); - //- Construct and return a clone + //- Return a clone virtual tmp<Function1<Type>> clone() const { - return tmp<Function1<Type>>(new Sample<Type>(*this)); + return Function1<Type>::Clone(*this); } diff --git a/src/sampling/meshToMesh/meshToMeshTemplates.C b/src/sampling/meshToMesh/meshToMeshTemplates.C index afea1c70b69c2d253eb65bcc6938e0db3608b6da..a1f8b6f637b466d3adb0a38ac226dd35dd9df35b 100644 --- a/src/sampling/meshToMesh/meshToMeshTemplates.C +++ b/src/sampling/meshToMesh/meshToMeshTemplates.C @@ -612,7 +612,7 @@ Foam::meshToMesh::mapSrcToTgt ( srcBfld[srcPatchi], tgtMesh.boundary()[tgtPatchi], - DimensionedField<Type, volMesh>::null(), + fvPatchField<Type>::Internal::null(), directFvPatchFieldMapper ( labelList(tgtMesh.boundary()[tgtPatchi].size(), -1) @@ -636,7 +636,7 @@ Foam::meshToMesh::mapSrcToTgt ( fvPatchFieldBase::calculatedType(), tgtMesh.boundary()[tgtPatchi], - DimensionedField<Type, volMesh>::null() + fvPatchField<Type>::Internal::null() ) ); } @@ -843,7 +843,7 @@ Foam::meshToMesh::mapTgtToSrc ( tgtBfld[tgtPatchi], srcMesh.boundary()[srcPatchi], - DimensionedField<Type, volMesh>::null(), + fvPatchField<Type>::Internal::null(), directFvPatchFieldMapper ( labelList(srcMesh.boundary()[srcPatchi].size(), -1) @@ -867,7 +867,7 @@ Foam::meshToMesh::mapTgtToSrc ( fvPatchFieldBase::calculatedType(), srcMesh.boundary()[srcPatchi], - DimensionedField<Type, volMesh>::null() + fvPatchField<Type>::Internal::null() ) ); } diff --git a/src/sampling/meshToMesh0/meshToMesh0Templates.C b/src/sampling/meshToMesh0/meshToMesh0Templates.C index c40298f4bd38b40cd1eb5b46846261e647ea2466..8daeb7a09a153d94391f82b5d2ab56db24481faa 100644 --- a/src/sampling/meshToMesh0/meshToMesh0Templates.C +++ b/src/sampling/meshToMesh0/meshToMesh0Templates.C @@ -395,7 +395,7 @@ Foam::meshToMesh0::interpolate ( fromVf.boundaryField()[patchi], toMesh_.boundary()[patchi], - DimensionedField<Type, volMesh>::null(), + fvPatchField<Type>::Internal::null(), patchFieldInterpolator ( boundaryAddressing_[patchi] diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/Ar/Ar.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/Ar/Ar.H index de9273f625636ac32556ed7b1e5493dcab0deb58..3d71c0b79fb799917bfe5021f6053b21212d2d82 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/Ar/Ar.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/Ar/Ar.H @@ -114,10 +114,10 @@ public: //- Construct from dictionary Ar(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<Ar>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C10H22/C10H22.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C10H22/C10H22.H index 164da673a0370c7e0bedd3c1eee0f6b5b557591a..0f544d1154913ae413faadf2ca3506386310eebf 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C10H22/C10H22.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C10H22/C10H22.H @@ -114,10 +114,10 @@ public: //- Construct from dictionary C10H22(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<C10H22>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C12H26/C12H26.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C12H26/C12H26.H index 45346e3feeb7de2b0fa5e34f21b2db4668b06dbc..3d91dd881fbc9fc068e4df43669bcf8654bde8b3 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C12H26/C12H26.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C12H26/C12H26.H @@ -114,10 +114,10 @@ public: //- Construct from dictionary C12H26(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<C12H26>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C13H28/C13H28.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C13H28/C13H28.H index b45b57d01926a9dcee450b183aa4a05adcc9856b..4b0fab59ef8c13bb22d96db7d46636704897051a 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C13H28/C13H28.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C13H28/C13H28.H @@ -114,10 +114,10 @@ public: //- Construct from dictionary C13H28(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<C13H28>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C14H30/C14H30.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C14H30/C14H30.H index a1ad7431a7a2e18639209eb9672f3fec14ba11a2..0eeb8cc1a185b3e29d67ede59b9878ef286adabd 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C14H30/C14H30.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C14H30/C14H30.H @@ -114,10 +114,10 @@ public: //- Construct from dictionary C14H30(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<C14H30>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C16H34/C16H34.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C16H34/C16H34.H index 47a1a5e3eab96558e27d8f80ada260f368ebdbfc..a8f4bb6a7350bbd51496a42b0adadbb2829eaec6 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C16H34/C16H34.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C16H34/C16H34.H @@ -114,10 +114,10 @@ public: //- Construct from dictionary C16H34(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<C16H34>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C2H5OH/C2H5OH.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C2H5OH/C2H5OH.H index dc6a2f2477e3684575e2dc920b45f6ea587c0474..8d184291608dad09527ab09023be47b69219311a 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C2H5OH/C2H5OH.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C2H5OH/C2H5OH.H @@ -114,10 +114,10 @@ public: //- Construct from dictionary C2H5OH(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<C2H5OH>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C2H6/C2H6.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C2H6/C2H6.H index 656656cac384d1792256c876334ef5cd796807f7..204160cf66fe6041176b076328026974447675e8 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C2H6/C2H6.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C2H6/C2H6.H @@ -114,10 +114,10 @@ public: //- Construct from dictionary C2H6(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<C2H6>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C2H6O/C2H6O.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C2H6O/C2H6O.H index 9c608556aef94b34a65cbc7ac1058bc6c501232b..538f4c2c92f8276a5c549f8df47ee533b263a92c 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C2H6O/C2H6O.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C2H6O/C2H6O.H @@ -114,10 +114,10 @@ public: //- Construct from dictionary C2H6O(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<C2H6O>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C3H6O/C3H6O.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C3H6O/C3H6O.H index 61e482f73e0c29b5c71f124c477fdab4d0e5a6f6..1efc92fd242bd4799be7c251c0cb7e92a66dcce7 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C3H6O/C3H6O.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C3H6O/C3H6O.H @@ -114,10 +114,10 @@ public: //- Construct from dictionary C3H6O(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<C3H6O>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C3H8/C3H8.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C3H8/C3H8.H index 4222ea2d98d865e2bf15eb75ddcae8ac2aac892e..ef9d85e3b575f5de6c05fe002724ddd55596fbe6 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C3H8/C3H8.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C3H8/C3H8.H @@ -114,10 +114,10 @@ public: //- Construct from dictionary C3H8(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<C3H8>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C4H10O/C4H10O.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C4H10O/C4H10O.H index 83d8fe1d06d17017b372f3da00843daff72b77a2..ed5e1326da77f95bc3e1c9e6d4dbd9882918e2e8 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C4H10O/C4H10O.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C4H10O/C4H10O.H @@ -114,10 +114,10 @@ public: //- Construct from dictionary C4H10O(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<C4H10O>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C6H14/C6H14.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C6H14/C6H14.H index 83b49d09a81013009e2c511c9d19adb613198f8a..ebe60044dd43db252affe5663688f9bd60e77453 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C6H14/C6H14.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C6H14/C6H14.H @@ -114,10 +114,10 @@ public: //- Construct from dictionary C6H14(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<C6H14>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C6H6/C6H6.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C6H6/C6H6.H index e67f2e5e081dc106db8d5701b1c101f5388a73b1..81be1a18dde1374e03377b7d80bc208ccdc7cf3a 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C6H6/C6H6.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C6H6/C6H6.H @@ -114,10 +114,10 @@ public: //- Construct from dictionary C6H6(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<C6H6>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C7H16/C7H16.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C7H16/C7H16.H index 5f713fda2ec8de7efd705d128959711e7ec03ff1..27b3485714f409cf3f4d7ea0e4be77553f7b7545 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C7H16/C7H16.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C7H16/C7H16.H @@ -114,10 +114,10 @@ public: //- Construct from dictionary C7H16(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<C7H16>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C7H8/C7H8.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C7H8/C7H8.H index 51a66c69b516123080abcf53186c32c7a9df9405..6dfabef59ec292b2addacdd4c79a5f89e33e385f 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C7H8/C7H8.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C7H8/C7H8.H @@ -114,10 +114,10 @@ public: //- Construct from dictionary C7H8(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<C7H8>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C8H10/C8H10.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C8H10/C8H10.H index 2b337d0a9df8f78255ae4e8593d45a4e68301b51..66f2622904365fbae9f0854b5938d81c972a2a0d 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C8H10/C8H10.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C8H10/C8H10.H @@ -113,10 +113,10 @@ public: //- Construct from dictionary C8H10(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<C8H10>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C8H18/C8H18.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C8H18/C8H18.H index a2300872696c78151af3ce77e935b31051dbce22..6b0446c4ec211bc495c539a520c219e3274b98f0 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C8H18/C8H18.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C8H18/C8H18.H @@ -114,10 +114,10 @@ public: //- Construct from dictionary C8H18(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<C8H18>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C9H20/C9H20.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C9H20/C9H20.H index 6206617bd8abc1655b5dba303ae504b2444d2022..dc38c2d753f295b3b4d97cf491f4b9a1d0b2b1d9 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C9H20/C9H20.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/C9H20/C9H20.H @@ -114,10 +114,10 @@ public: //- Construct from dictionary C9H20(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<C9H20>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/CH3OH/CH3OH.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/CH3OH/CH3OH.H index d9e034f4297ca98e7c070734d24afccf2854e81e..c2a8001939eaf2235573d19773b508069e1be06a 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/CH3OH/CH3OH.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/CH3OH/CH3OH.H @@ -114,10 +114,10 @@ public: //- Construct from dictionary CH3OH(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<CH3OH>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/CH4N2O/CH4N2O.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/CH4N2O/CH4N2O.H index 628c9845226336a05052d12416008f91a5b3c2c3..b6992f526607ded32db6d11ae20a52d116cb1a97 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/CH4N2O/CH4N2O.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/CH4N2O/CH4N2O.H @@ -114,10 +114,10 @@ public: //- Construct from dictionary CH4N2O(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<CH4N2O>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/H2O/H2O.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/H2O/H2O.H index d96d82ff9de73f0e06fb799c468639a0f3d6462b..764316c57954ba5613bd739437acd3372bcd8561 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/H2O/H2O.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/H2O/H2O.H @@ -113,10 +113,10 @@ public: //- Construct from dictionary H2O(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<H2O>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/IC8H18/IC8H18.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/IC8H18/IC8H18.H index d1689a8bfa642a880734725ca0b22a3459735f06..e6d492faf3fcdcc410848c8114d0554ecd85f658 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/IC8H18/IC8H18.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/IC8H18/IC8H18.H @@ -114,10 +114,10 @@ public: //- Construct from dictionary IC8H18(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<IC8H18>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/IDEA/IDEA.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/IDEA/IDEA.H index c9a5e6b7bff29ffee13b3b636e6db02e3d0bc771..1f7a6c9de1220135182d7219f2f49c2b0eddc658 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/IDEA/IDEA.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/IDEA/IDEA.H @@ -136,10 +136,10 @@ public: //- Construct from dictionary IDEA(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<IDEA>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/MB/MB.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/MB/MB.H index fbb7fb049a36f0d00fb380989e2f60d52d621f37..3ed033af167a51715f435d80d8ae2f6cba705ecf 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/MB/MB.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/MB/MB.H @@ -114,10 +114,10 @@ public: //- Construct from dictionary MB(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<MB>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/N2/N2.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/N2/N2.H index d57624c57cf3c6a69bd7fbbec7fbfbbc57adcd3b..72015b13e553488d46e92be935eac91b4d19dd6f 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/N2/N2.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/N2/N2.H @@ -114,10 +114,10 @@ public: //- Construct from dictionary N2(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<N2>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/aC10H7CH3/aC10H7CH3.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/aC10H7CH3/aC10H7CH3.H index 6d07dacbe6a244018f0936798ab8e478ee73248e..fb6c4bed3139e7006731afb09c2f7fb06872d0e7 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/aC10H7CH3/aC10H7CH3.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/aC10H7CH3/aC10H7CH3.H @@ -114,10 +114,10 @@ public: //- Construct from dictionary aC10H7CH3(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<aC10H7CH3>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/bC10H7CH3/bC10H7CH3.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/bC10H7CH3/bC10H7CH3.H index 93e4c0db6a701b10a4901410372d17338786734a..a8a45ecd650213ee7ebad8db2bde7cee5618939e 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/bC10H7CH3/bC10H7CH3.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/bC10H7CH3/bC10H7CH3.H @@ -114,10 +114,10 @@ public: //- Construct from dictionary bC10H7CH3(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<bC10H7CH3>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/iC3H8O/iC3H8O.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/iC3H8O/iC3H8O.H index ffbea5673594f6858f2849d10586595f4549cb66..6144243c726d32bcea745f325c6a99adaecc54b9 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/iC3H8O/iC3H8O.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/iC3H8O/iC3H8O.H @@ -112,10 +112,10 @@ public: //- Construct from dictionary iC3H8O(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<iC3H8O>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquid/liquid.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquid/liquid.H index 21b152c36aa23da9ea20c95e0d5487cd9d1c0134..fc6f69ea2c3831a6045699ea995cfc542f7ed196 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquid/liquid.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquid/liquid.H @@ -37,8 +37,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef liquid_H -#define liquid_H +#ifndef Foam_liquid_H +#define Foam_liquid_H #include "liquidProperties.H" #include "Function1.H" @@ -90,10 +90,10 @@ public: liquid(const liquid& rhs); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>(new liquid(*this)); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquidProperties/liquidProperties.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquidProperties/liquidProperties.H index 220f962f753ea6f8e1d8b2fe8506e6ca19a56628..589865f29225b4b968907c5ccf756fe06a6c7f47 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquidProperties/liquidProperties.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquidProperties/liquidProperties.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -35,8 +35,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef liquidProperties_H -#define liquidProperties_H +#ifndef Foam_liquidProperties_H +#define Foam_liquidProperties_H #include "thermophysicalProperties.H" @@ -137,7 +137,14 @@ public: virtual autoPtr<liquidProperties> clone() const = 0; - // Selectors + // Factory Methods + + //- Clone liquidProperties + template<class Derived> + static autoPtr<liquidProperties> Clone(const Derived& prop) + { + return autoPtr<liquidProperties>(new Derived(prop)); + } //- Return a pointer to a new liquidProperties created from name static autoPtr<liquidProperties> New(const word& name); diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/nC3H8O/nC3H8O.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/nC3H8O/nC3H8O.H index b5729a0ffa0def21e18733cd12f17f34478bf236..388375dc7250c834627815763f16e9686438d89b 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/nC3H8O/nC3H8O.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/nC3H8O/nC3H8O.H @@ -112,10 +112,10 @@ public: //- Construct from dictionary nC3H8O(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<liquidProperties> clone() const { - return autoPtr<liquidProperties>::NewFrom<nC3H8O>(*this); + return liquidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/solidProperties/C/C.H b/src/thermophysicalModels/thermophysicalProperties/solidProperties/C/C.H index 471498121fc9dae625ee7b48a0c4274b9131259f..5ff8dda5ea042e5537e375039d7968130780d302 100644 --- a/src/thermophysicalModels/thermophysicalProperties/solidProperties/C/C.H +++ b/src/thermophysicalModels/thermophysicalProperties/solidProperties/C/C.H @@ -67,10 +67,10 @@ public: //- Construct from dictionary C(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<solidProperties> clone() const { - return autoPtr<solidProperties>::NewFrom<C>(*this); + return solidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/solidProperties/CaCO3/CaCO3.H b/src/thermophysicalModels/thermophysicalProperties/solidProperties/CaCO3/CaCO3.H index fce234a3f0a4bb8cfa0b5957e38b973177ee3382..b8baf048a39552d7ad696e5edaf071c05a402ff8 100644 --- a/src/thermophysicalModels/thermophysicalProperties/solidProperties/CaCO3/CaCO3.H +++ b/src/thermophysicalModels/thermophysicalProperties/solidProperties/CaCO3/CaCO3.H @@ -67,10 +67,10 @@ public: //- Construct from dictionary CaCO3(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<solidProperties> clone() const { - return autoPtr<solidProperties>::NewFrom<CaCO3>(*this); + return solidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/solidProperties/ash/ash.H b/src/thermophysicalModels/thermophysicalProperties/solidProperties/ash/ash.H index 7297af2785b95df9e69c79dbfc3adb905a2fa3aa..34e759813dccdd9dee59e288af56e0f5c594f23a 100644 --- a/src/thermophysicalModels/thermophysicalProperties/solidProperties/ash/ash.H +++ b/src/thermophysicalModels/thermophysicalProperties/solidProperties/ash/ash.H @@ -67,10 +67,10 @@ public: //- Construct from dictionary ash(const dictionary& dict); - //- Construct and return clone + //- Return a clone virtual autoPtr<solidProperties> clone() const { - return autoPtr<solidProperties>::NewFrom<ash>(*this); + return solidProperties::Clone(*this); } diff --git a/src/thermophysicalModels/thermophysicalProperties/solidProperties/solidProperties/solidProperties.H b/src/thermophysicalModels/thermophysicalProperties/solidProperties/solidProperties/solidProperties.H index 3d8729acc36295aa327f760bc1c6b629936cbf65..313f3c37ab1adfb7bfba37c51646714c3fce1a09 100644 --- a/src/thermophysicalModels/thermophysicalProperties/solidProperties/solidProperties/solidProperties.H +++ b/src/thermophysicalModels/thermophysicalProperties/solidProperties/solidProperties/solidProperties.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2018-2019 OpenCFD Ltd. + Copyright (C) 2018-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -35,8 +35,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef solidProperties_H -#define solidProperties_H +#ifndef Foam_solidProperties_H +#define Foam_solidProperties_H #include "typeInfo.H" #include "autoPtr.H" @@ -133,7 +133,14 @@ public: } - // Selectors + // Factory Methods + + //- Clone solidProperties + template<class Derived> + static autoPtr<solidProperties> Clone(const Derived& prop) + { + return autoPtr<solidProperties>(new Derived(prop)); + } //- Return a pointer to a new solidProperties created from name static autoPtr<solidProperties> New(const word& name);