From 87eed5e3b83de5d317fc025eae50c818cf23a77f Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 23 Mar 2023 16:27:32 +0100 Subject: [PATCH] ENH: place more patch field attributes under template invariant Base - attributes such as assignable(), coupled() etc - common patchField types: calculatedType(), zeroGradientType() etc. This simplifies reference to these types without actually needing a typed patchField version. ENH: add some basic patchField types to fieldTypes namespace - allows more general use of the names ENH: set extrapolated/calculated from patchInternalField directly - avoids intermediate tmp --- .../T/smoluchowskiJumpTFvPatchScalarField.C | 3 +- .../tractionDisplacementFvPatchVectorField.C | 4 +- ...DisplacementCorrectionFvPatchVectorField.C | 4 +- .../test/pointField/Test-PointField.C | 8 +- src/OpenFOAM/fields/Fields/fieldTypes.C | 25 +++++- src/OpenFOAM/fields/Fields/fieldTypes.H | 48 +++++++++-- .../calculated/calculatedPointPatchField.C | 9 -- .../calculated/calculatedPointPatchField.H | 3 +- .../fixedValue/fixedValuePointPatchField.H | 13 +-- .../zeroGradientPointPatchField.C | 9 -- .../zeroGradientPointPatchField.H | 2 +- .../constraint/empty/emptyPointPatchField.H | 7 +- .../pointPatchField/pointPatchField.H | 72 +++++++++------- .../fixedShearStressFvPatchVectorField.C | 2 +- .../epsilonWallFunctionFvPatchScalarField.C | 2 +- .../omegaWallFunctionFvPatchScalarField.C | 2 +- ...entHeatFluxTemperatureFvPatchScalarField.C | 4 +- .../freeSurfaceVelocityFvPatchVectorField.C | 2 +- .../basic/calculated/calculatedFaPatchField.C | 9 -- .../basic/calculated/calculatedFaPatchField.H | 15 +--- .../extrapolatedCalculatedFaPatchField.C | 3 +- .../extrapolatedCalculatedFaPatchField.H | 1 + .../basic/fixedValue/fixedValueFaPatchField.H | 13 +-- .../basic/mixed/mixedFaPatchField.H | 13 +-- .../basic/sliced/slicedFaPatchField.H | 4 +- .../zeroGradient/zeroGradientFaPatchField.C | 12 +-- .../zeroGradient/zeroGradientFaPatchField.H | 14 ++-- .../clampedPlate/clampedPlateFaPatchField.C | 3 +- .../fixedValueOutflowFaPatchField.H | 13 +-- .../faPatchFields/faPatchField/faPatchField.H | 69 ++++++++++------ .../calculated/calculatedFaePatchField.C | 9 -- .../calculated/calculatedFaePatchField.H | 13 +-- .../fixedValue/fixedValueFaePatchField.H | 15 ++-- .../basic/sliced/slicedFaePatchField.H | 2 - .../constraint/empty/emptyFaePatchField.H | 2 +- .../faePatchField/faePatchField.H | 53 +++++++----- .../basic/calculated/calculatedFvPatchField.C | 9 -- .../basic/calculated/calculatedFvPatchField.H | 16 +--- .../directionMixedFvPatchField.H | 20 ++--- .../extrapolatedCalculatedFvPatchField.C | 6 +- .../extrapolatedCalculatedFvPatchField.H | 1 + .../basic/fixedValue/fixedValueFvPatchField.H | 20 ++--- .../basic/mixed/mixedFvPatchField.H | 20 ++--- .../basic/sliced/slicedFvPatchField.H | 20 ++--- .../basic/transform/transformFvPatchField.H | 12 +-- .../zeroGradient/zeroGradientFvPatchField.C | 16 +--- .../zeroGradient/zeroGradientFvPatchField.H | 12 +-- .../cyclicAMI/cyclicAMIFvPatchField.C | 2 +- .../constraint/empty/emptyFvPatchField.H | 7 +- .../processor/processorFvPatchField.C | 2 +- .../derived/advective/advectiveFvPatchField.C | 2 +- .../codedFixedValueFvPatchField.C | 2 +- ...lectrostaticDepositionFvPatchScalarField.C | 2 +- .../fixedFluxPressureFvPatchScalarField.C | 2 +- ...malInletOutletVelocityFvPatchVectorField.H | 11 +-- .../fixedNormalSlipFvPatchField.H | 10 +-- .../fluxCorrectedVelocityFvPatchVectorField.C | 2 +- .../inletOutlet/inletOutletFvPatchField.H | 9 +- .../outletMappedUniformInletFvPatchField.C | 6 +- ...utletPhaseMeanVelocityFvPatchVectorField.C | 2 +- .../partialSlip/partialSlipFvPatchField.H | 9 +- ...aseHydrostaticPressureFvPatchScalarField.H | 11 +-- ...tedInletOutletVelocityFvPatchVectorField.H | 11 +-- ...eDirectedInletVelocityFvPatchVectorField.H | 10 +-- ...tOutletParSlipVelocityFvPatchVectorField.H | 11 +-- ...ureInletOutletVelocityFvPatchVectorField.H | 11 +-- ...reInletUniformVelocityFvPatchVectorField.H | 11 +-- .../pressureInletVelocityFvPatchVectorField.H | 11 +-- ...malInletOutletVelocityFvPatchVectorField.H | 11 +-- ...phaInletOutletVelocityFvPatchVectorField.H | 9 +- .../supersonicFreestreamFvPatchVectorField.C | 2 +- .../uniformInletOutletFvPatchField.H | 9 +- .../variableHeightFlowRateFvPatchField.C | 5 +- .../fvPatchFields/fvPatchField/fvPatchField.C | 4 +- .../fvPatchFields/fvPatchField/fvPatchField.H | 82 ++++++++++++------- .../calculated/calculatedFvsPatchField.C | 8 -- .../calculated/calculatedFvsPatchField.H | 20 ++--- .../fixedValue/fixedValueFvsPatchField.H | 13 +-- .../basic/sliced/slicedFvsPatchField.H | 15 +--- .../constraint/empty/emptyFvsPatchField.H | 7 +- .../fvsPatchField/fvsPatchField.H | 53 +++++++----- .../fields/volFields/volFieldsFwd.H | 5 +- ...oupledTemperatureMixedFvPatchScalarField.C | 2 +- .../oversetPolyPatch/oversetFvPatchField.C | 2 +- ...ilmHeightInletVelocityFvPatchVectorField.H | 11 +-- ...fixedIncidentRadiationFvPatchScalarField.C | 4 +- .../sorptionWallFunctionFvPatchScalarField.C | 5 +- ...haContactAngleTwoPhaseFvPatchScalarField.C | 3 +- 88 files changed, 462 insertions(+), 586 deletions(-) diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C b/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C index 1445e56940..270e07d797 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C @@ -105,7 +105,8 @@ Foam::smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField if (!this->readValueEntry(dict)) { - fvPatchField::operator=(patchInternalField()); + // Fallback: set to the internal field + fvPatchField::patchInternalField(*this); } refValue() = *this; diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/tractionDisplacement/tractionDisplacementFvPatchVectorField.C b/applications/solvers/stressAnalysis/solidDisplacementFoam/tractionDisplacement/tractionDisplacementFvPatchVectorField.C index 1e9619c65e..4db517c658 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/tractionDisplacement/tractionDisplacementFvPatchVectorField.C +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/tractionDisplacement/tractionDisplacementFvPatchVectorField.C @@ -47,7 +47,7 @@ tractionDisplacementFvPatchVectorField traction_(p.size(), Zero), pressure_(p.size(), Zero) { - fvPatchVectorField::operator=(patchInternalField()); + fvPatchField::patchInternalField(*this); gradient() = Zero; } @@ -79,7 +79,7 @@ tractionDisplacementFvPatchVectorField traction_("traction", dict, p.size()), pressure_("pressure", dict, p.size()) { - fvPatchVectorField::operator=(patchInternalField()); + fvPatchField::patchInternalField(*this); gradient() = Zero; } diff --git a/applications/solvers/stressAnalysis/solidEquilibriumDisplacementFoam/tractionDisplacementCorrection/tractionDisplacementCorrectionFvPatchVectorField.C b/applications/solvers/stressAnalysis/solidEquilibriumDisplacementFoam/tractionDisplacementCorrection/tractionDisplacementCorrectionFvPatchVectorField.C index be853da48b..20b3a8c8cf 100644 --- a/applications/solvers/stressAnalysis/solidEquilibriumDisplacementFoam/tractionDisplacementCorrection/tractionDisplacementCorrectionFvPatchVectorField.C +++ b/applications/solvers/stressAnalysis/solidEquilibriumDisplacementFoam/tractionDisplacementCorrection/tractionDisplacementCorrectionFvPatchVectorField.C @@ -47,7 +47,7 @@ tractionDisplacementCorrectionFvPatchVectorField traction_(p.size(), Zero), pressure_(p.size(), Zero) { - fvPatchVectorField::operator=(patchInternalField()); + fvPatchField::patchInternalField(*this); gradient() = Zero; } @@ -79,7 +79,7 @@ tractionDisplacementCorrectionFvPatchVectorField traction_("traction", dict, p.size()), pressure_("pressure", dict, p.size()) { - fvPatchVectorField::operator=(patchInternalField()); + fvPatchField::patchInternalField(*this); gradient() = Zero; } diff --git a/applications/test/pointField/Test-PointField.C b/applications/test/pointField/Test-PointField.C index 2665d4b515..3591279c54 100644 --- a/applications/test/pointField/Test-PointField.C +++ b/applications/test/pointField/Test-PointField.C @@ -53,13 +53,13 @@ int main(int argc, char *argv[]) ( "U", runTime.timeName(), - mesh, + pMesh.thisDb(), IOobject::NO_READ, - IOobject::AUTO_WRITE + IOobject::NO_WRITE ), pMesh, - dimensionedVector(dimLength, Zero), - pointPatchVectorField::calculatedType() + dimensionedVector(dimLength, Zero) + // pointPatchFieldBase::calculatedType() ); pointVectorField V(U + 2*U); diff --git a/src/OpenFOAM/fields/Fields/fieldTypes.C b/src/OpenFOAM/fields/Fields/fieldTypes.C index cf21360c75..943ecdd46f 100644 --- a/src/OpenFOAM/fields/Fields/fieldTypes.C +++ b/src/OpenFOAM/fields/Fields/fieldTypes.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -42,4 +42,27 @@ const Foam::wordList Foam::fieldTypes::basic }); +// Commonly used patch field types + +const Foam::word Foam::fieldTypes::emptyType +( + Foam::fieldTypes::emptyTypeName_() +); + +const Foam::word Foam::fieldTypes::calculatedType +( + Foam::fieldTypes::calculatedTypeName_() +); + +const Foam::word Foam::fieldTypes::extrapolatedCalculatedType +( + Foam::fieldTypes::extrapolatedCalculatedTypeName_() +); + +const Foam::word Foam::fieldTypes::zeroGradientType +( + Foam::fieldTypes::zeroGradientTypeName_() +); + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/fields/Fields/fieldTypes.H b/src/OpenFOAM/fields/Fields/fieldTypes.H index 2c2a87a59a..9f279730a1 100644 --- a/src/OpenFOAM/fields/Fields/fieldTypes.H +++ b/src/OpenFOAM/fields/Fields/fieldTypes.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -24,8 +24,15 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . +Namespace + Foam::fieldTypes + Description - Header files for all the primitive types that Fields are instantiated for. + Collection of common field types + +Note + The fieldTypes header contains macros for primitive types + that Fields are instantiated for. \*---------------------------------------------------------------------------*/ @@ -69,9 +76,40 @@ namespace Foam { namespace fieldTypes { - //- Standard basic field types (label, scalar, vector, tensor, etc) - // These also correspond to cloud output fields. - extern const wordList basic; + +//- Standard basic field types (label, scalar, vector, tensor, etc) +// These also correspond to cloud output fields. +extern const wordList basic; + + +// Commonly used patch field types + +//- An \c empty patch field type +inline const char* emptyTypeName_() noexcept { return "empty"; } + +//- An \c empty patch field type +extern const word emptyType; + +//- A \c calculated patch field type +inline const char* calculatedTypeName_() noexcept { return "calculated"; } + +//- A \c calculated patch field type +extern const word calculatedType; + +//- A combined \c zero-gradient and \c calculated patch field type +inline const char* extrapolatedCalculatedTypeName_() noexcept +{ + return "extrapolatedCalculated"; +} + +//- A combined \c zero-gradient and \c calculated patch field type +extern const word extrapolatedCalculatedType; + +//- A \c zeroGradient patch field type +inline const char* zeroGradientTypeName_() noexcept { return "zeroGradient"; } + +//- A \c zeroGradient patch field type +extern const word zeroGradientType; } // End namespace fieldTypes } // End namespace Foam diff --git a/src/OpenFOAM/fields/pointPatchFields/basic/calculated/calculatedPointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/basic/calculated/calculatedPointPatchField.C index eee6cf809a..44c460d5c6 100644 --- a/src/OpenFOAM/fields/pointPatchFields/basic/calculated/calculatedPointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/basic/calculated/calculatedPointPatchField.C @@ -28,15 +28,6 @@ License #include "calculatedPointPatchField.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -template -const Foam::word& Foam::pointPatchField::calculatedType() -{ - return Foam::calculatedPointPatchField::typeName; -} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template diff --git a/src/OpenFOAM/fields/pointPatchFields/basic/calculated/calculatedPointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/basic/calculated/calculatedPointPatchField.H index 1ceaba98a4..42189f5a27 100644 --- a/src/OpenFOAM/fields/pointPatchFields/basic/calculated/calculatedPointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/basic/calculated/calculatedPointPatchField.H @@ -53,11 +53,10 @@ class calculatedPointPatchField : public pointPatchField { - public: //- Runtime type information - TypeName("calculated"); + TypeName("calculated"); // fieldTypes::calculatedTypeName_() // Constructors diff --git a/src/OpenFOAM/fields/pointPatchFields/basic/fixedValue/fixedValuePointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/basic/fixedValue/fixedValuePointPatchField.H index 9c7c53a45e..ff6437ae20 100644 --- a/src/OpenFOAM/fields/pointPatchFields/basic/fixedValue/fixedValuePointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/basic/fixedValue/fixedValuePointPatchField.H @@ -139,18 +139,13 @@ public: } - // Member functions + // Member Functions - // Access - - //- Return true if this patch field fixes a value - virtual bool fixesValue() const - { - return true; - } + //- True: this patch field fixes a value. + virtual bool fixesValue() const { return true; } - // Member operators + // Member Operators // Disable assignment operators diff --git a/src/OpenFOAM/fields/pointPatchFields/basic/zeroGradient/zeroGradientPointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/basic/zeroGradient/zeroGradientPointPatchField.C index 9e01a4df9f..1cc3430ddc 100644 --- a/src/OpenFOAM/fields/pointPatchFields/basic/zeroGradient/zeroGradientPointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/basic/zeroGradient/zeroGradientPointPatchField.C @@ -27,15 +27,6 @@ License #include "zeroGradientPointPatchField.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -template -const Foam::word& Foam::pointPatchField::zeroGradientType() -{ - return Foam::zeroGradientPointPatchField::typeName; -} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template diff --git a/src/OpenFOAM/fields/pointPatchFields/basic/zeroGradient/zeroGradientPointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/basic/zeroGradient/zeroGradientPointPatchField.H index 1026efac17..ca91d23cff 100644 --- a/src/OpenFOAM/fields/pointPatchFields/basic/zeroGradient/zeroGradientPointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/basic/zeroGradient/zeroGradientPointPatchField.H @@ -56,7 +56,7 @@ class zeroGradientPointPatchField public: //- Runtime type information - TypeName("zeroGradient"); + TypeName("zeroGradient"); // fieldTypes::zeroGradientTypeName_() // Constructors diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/empty/emptyPointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/constraint/empty/emptyPointPatchField.H index 146c79dfdc..dc2c9fc903 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/empty/emptyPointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/empty/emptyPointPatchField.H @@ -34,8 +34,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef emptyPointPatchField_H -#define emptyPointPatchField_H +#ifndef Foam_emptyPointPatchField_H +#define Foam_emptyPointPatchField_H #include "pointPatchField.H" #include "emptyPointPatch.H" @@ -54,11 +54,10 @@ class emptyPointPatchField : public pointPatchField { - public: //- Runtime type information - TypeName(emptyPointPatch::typeName_()); + TypeName(emptyPointPatch::typeName_()); // fieldTypes::emptyTypeName_() // Constructors diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H index feaf899d28..85d2b582c7 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-2022 OpenCFD Ltd. + Copyright (C) 2019-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -140,8 +140,50 @@ public: virtual ~pointPatchFieldBase() = default; + // Static Member Functions + + //- The type name for \c empty patch fields + static const word& emptyType() noexcept + { + return Foam::fieldTypes::emptyType; + } + + //- The type name for \c calculated patch fields + static const word& calculatedType() noexcept + { + return Foam::fieldTypes::calculatedType; + } + + //- The type name for \c zeroGradient patch fields + static const word& zeroGradientType() noexcept + { + return Foam::fieldTypes::zeroGradientType; + } + + // Member Functions + // Attributes + + //- True if the patch field fixes a value + virtual bool fixesValue() const + { + return false; + } + + //- True if the patch field is coupled + virtual bool coupled() const + { + return false; + } + + //- The constraint type the pointPatchField implements + virtual const word& constraintType() const + { + return word::null; + } + + // Access //- The associated objectRegistry @@ -366,34 +408,6 @@ public: // Member Functions - //- The type name for calculated patch fields - static const word& calculatedType(); - - //- The type name for zeroGradient patch fields - static const word& zeroGradientType(); - - - // Attributes - - //- True if this patch field fixes a value - virtual bool fixesValue() const - { - return false; - } - - //- True if this patch field is coupled - virtual bool coupled() const - { - return false; - } - - //- The constraint type this pointPatchField implements. - virtual const word& constraintType() const - { - return word::null; - } - - // Access //- Return the patch size diff --git a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C index 744eb7df3e..da6fc26d91 100644 --- a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C +++ b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C @@ -56,7 +56,7 @@ Foam::fixedShearStressFvPatchVectorField::fixedShearStressFvPatchVectorField fixedValueFvPatchVectorField(p, iF, dict, IOobjectOption::NO_READ), tau0_(dict.getOrDefault("tau", Zero)) { - fvPatchField::operator=(patchInternalField()); + fvPatchField::patchInternalField(*this); } diff --git a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C index 724c4c2ceb..b4175b385b 100644 --- a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C +++ b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C @@ -366,7 +366,7 @@ epsilonWallFunctionFvPatchScalarField cornerWeights_() { // Apply zero-gradient condition on start-up - this->operator==(patchInternalField()); + fvPatchField::patchInternalField(*this); } diff --git a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C index e4c67849be..ec53d93776 100644 --- a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C +++ b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C @@ -359,7 +359,7 @@ Foam::omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField cornerWeights_() { // apply zero-gradient condition on start-up - this->operator==(patchInternalField()); + fvPatchField::patchInternalField(*this); } diff --git a/src/atmosphericModels/derivedFvPatchFields/atmTurbulentHeatFluxTemperature/atmTurbulentHeatFluxTemperatureFvPatchScalarField.C b/src/atmosphericModels/derivedFvPatchFields/atmTurbulentHeatFluxTemperature/atmTurbulentHeatFluxTemperatureFvPatchScalarField.C index cedb9bdc9a..d6563ca590 100644 --- a/src/atmosphericModels/derivedFvPatchFields/atmTurbulentHeatFluxTemperature/atmTurbulentHeatFluxTemperatureFvPatchScalarField.C +++ b/src/atmosphericModels/derivedFvPatchFields/atmTurbulentHeatFluxTemperature/atmTurbulentHeatFluxTemperatureFvPatchScalarField.C @@ -114,8 +114,8 @@ atmTurbulentHeatFluxTemperatureFvPatchScalarField } else { - fvPatchField::operator=(patchInternalField()); - gradient() = 0.0; + fvPatchField::patchInternalField(*this); + gradient() = Zero; } } diff --git a/src/dynamicFaMesh/interfaceTrackingFvMesh/fvPatchFields/freeSurfaceVelocity/freeSurfaceVelocityFvPatchVectorField.C b/src/dynamicFaMesh/interfaceTrackingFvMesh/fvPatchFields/freeSurfaceVelocity/freeSurfaceVelocityFvPatchVectorField.C index 30076a0f3c..2091fb1a56 100644 --- a/src/dynamicFaMesh/interfaceTrackingFvMesh/fvPatchFields/freeSurfaceVelocity/freeSurfaceVelocityFvPatchVectorField.C +++ b/src/dynamicFaMesh/interfaceTrackingFvMesh/fvPatchFields/freeSurfaceVelocity/freeSurfaceVelocityFvPatchVectorField.C @@ -70,7 +70,7 @@ freeSurfaceVelocityFvPatchVectorField fixedGradientFvPatchVectorField(p, iF) { fvPatchFieldBase::readDict(dict); - fvPatchVectorField::operator=(patchInternalField()); + fvPatchField::patchInternalField(*this); } diff --git a/src/finiteArea/fields/faPatchFields/basic/calculated/calculatedFaPatchField.C b/src/finiteArea/fields/faPatchFields/basic/calculated/calculatedFaPatchField.C index 7e9ddfa6b1..4ea2400fef 100644 --- a/src/finiteArea/fields/faPatchFields/basic/calculated/calculatedFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/basic/calculated/calculatedFaPatchField.C @@ -29,15 +29,6 @@ License #include "calculatedFaPatchField.H" #include "faPatchFieldMapper.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -template -const Foam::word& Foam::faPatchField::calculatedType() -{ - return Foam::calculatedFaPatchField::typeName; -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template diff --git a/src/finiteArea/fields/faPatchFields/basic/calculated/calculatedFaPatchField.H b/src/finiteArea/fields/faPatchFields/basic/calculated/calculatedFaPatchField.H index a6d93302e9..4cda540f43 100644 --- a/src/finiteArea/fields/faPatchFields/basic/calculated/calculatedFaPatchField.H +++ b/src/finiteArea/fields/faPatchFields/basic/calculated/calculatedFaPatchField.H @@ -60,7 +60,7 @@ class calculatedFaPatchField public: //- Runtime type information - TypeName("calculated"); + TypeName("calculated"); // fieldTypes::calculatedTypeName_() // Constructors @@ -126,17 +126,10 @@ public: } - // Member functions + // Member Functions - // Access - - //- Return true if this patch field fixes a value. - // Needed to check if a level has to be specified while solving - // Poissons equations. - virtual bool fixesValue() const - { - return true; - } + //- True: this patch field fixes a value. + virtual bool fixesValue() const { return true; } // Evaluation functions diff --git a/src/finiteArea/fields/faPatchFields/basic/extrapolatedCalculated/extrapolatedCalculatedFaPatchField.C b/src/finiteArea/fields/faPatchFields/basic/extrapolatedCalculated/extrapolatedCalculatedFaPatchField.C index 0b2b6ad6e0..d605cd73db 100644 --- a/src/finiteArea/fields/faPatchFields/basic/extrapolatedCalculated/extrapolatedCalculatedFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/basic/extrapolatedCalculated/extrapolatedCalculatedFaPatchField.C @@ -54,7 +54,8 @@ extrapolatedCalculatedFaPatchField : calculatedFaPatchField(p, iF, dict, IOobjectOption::NO_READ) { - calculatedFaPatchField::operator==(this->patchInternalField()); + // Set to the internal field + faPatchField::patchInternalField(*this); } diff --git a/src/finiteArea/fields/faPatchFields/basic/extrapolatedCalculated/extrapolatedCalculatedFaPatchField.H b/src/finiteArea/fields/faPatchFields/basic/extrapolatedCalculated/extrapolatedCalculatedFaPatchField.H index e0f2c6e635..c326fe3d63 100644 --- a/src/finiteArea/fields/faPatchFields/basic/extrapolatedCalculated/extrapolatedCalculatedFaPatchField.H +++ b/src/finiteArea/fields/faPatchFields/basic/extrapolatedCalculated/extrapolatedCalculatedFaPatchField.H @@ -73,6 +73,7 @@ public: //- Runtime type information TypeName("extrapolatedCalculated"); + // fieldTypes::extrapolatedCalculatedTypeName_() // Constructors diff --git a/src/finiteArea/fields/faPatchFields/basic/fixedValue/fixedValueFaPatchField.H b/src/finiteArea/fields/faPatchFields/basic/fixedValue/fixedValueFaPatchField.H index 3788cc1058..399e628e44 100644 --- a/src/finiteArea/fields/faPatchFields/basic/fixedValue/fixedValueFaPatchField.H +++ b/src/finiteArea/fields/faPatchFields/basic/fixedValue/fixedValueFaPatchField.H @@ -127,17 +127,10 @@ public: } - // Member functions + // Member Functions - // Access - - //- Return true if this patch field fixes a value. - // Needed to check if a level has to be specified while solving - // Poissons equations. - virtual bool fixesValue() const - { - return true; - } + //- True: this patch field fixes a value. + virtual bool fixesValue() const { return true; } // Evaluation functions diff --git a/src/finiteArea/fields/faPatchFields/basic/mixed/mixedFaPatchField.H b/src/finiteArea/fields/faPatchFields/basic/mixed/mixedFaPatchField.H index c64af5442f..5109e64920 100644 --- a/src/finiteArea/fields/faPatchFields/basic/mixed/mixedFaPatchField.H +++ b/src/finiteArea/fields/faPatchFields/basic/mixed/mixedFaPatchField.H @@ -164,17 +164,10 @@ public: } - // Member functions + // Member Functions - // Access - - //- Return true if this patch field fixes a value. - // Needed to check if a level has to be specified while solving - // Poissons equations. - virtual bool fixesValue() const - { - return true; - } + //- True: the patch field fixes a value. + virtual bool fixesValue() const { return true; } // Return defining fields diff --git a/src/finiteArea/fields/faPatchFields/basic/sliced/slicedFaPatchField.H b/src/finiteArea/fields/faPatchFields/basic/sliced/slicedFaPatchField.H index cc8b4a778a..8afba50b8e 100644 --- a/src/finiteArea/fields/faPatchFields/basic/sliced/slicedFaPatchField.H +++ b/src/finiteArea/fields/faPatchFields/basic/sliced/slicedFaPatchField.H @@ -139,12 +139,10 @@ public: // Member Functions - // Attributes - //- True: this patch field fixes a value. virtual bool fixesValue() const { return true; } - //- False: this patch field is not altered by assignment + //- False: this patch field is not altered by assignment. virtual bool assignable() const { return false; } diff --git a/src/finiteArea/fields/faPatchFields/basic/zeroGradient/zeroGradientFaPatchField.C b/src/finiteArea/fields/faPatchFields/basic/zeroGradient/zeroGradientFaPatchField.C index 1465c0a8c3..edaa2ded0a 100644 --- a/src/finiteArea/fields/faPatchFields/basic/zeroGradient/zeroGradientFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/basic/zeroGradient/zeroGradientFaPatchField.C @@ -28,15 +28,6 @@ License #include "zeroGradientFaPatchField.H" #include "faPatchFieldMapper.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -template -const Foam::word& Foam::faPatchField::zeroGradientType() -{ - return Foam::zeroGradientFaPatchField::typeName; -} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template @@ -109,7 +100,8 @@ void Foam::zeroGradientFaPatchField::evaluate(const Pstream::commsTypes) this->updateCoeffs(); } - this->operator==(this->patchInternalField()); + // Set to the internal field + faPatchField::patchInternalField(*this); faPatchField::evaluate(); } diff --git a/src/finiteArea/fields/faPatchFields/basic/zeroGradient/zeroGradientFaPatchField.H b/src/finiteArea/fields/faPatchFields/basic/zeroGradient/zeroGradientFaPatchField.H index 3a0c3ef6cc..ba4a9dff76 100644 --- a/src/finiteArea/fields/faPatchFields/basic/zeroGradient/zeroGradientFaPatchField.H +++ b/src/finiteArea/fields/faPatchFields/basic/zeroGradient/zeroGradientFaPatchField.H @@ -38,8 +38,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef zeroGradientFaPatchField_H -#define zeroGradientFaPatchField_H +#ifndef Foam_zeroGradientFaPatchField_H +#define Foam_zeroGradientFaPatchField_H #include "faPatchField.H" @@ -60,7 +60,7 @@ class zeroGradientFaPatchField public: //- Runtime type information - TypeName("zeroGradient"); + TypeName("zeroGradient"); // fieldTypes::zeroGradientTypeName_() // Constructors @@ -132,16 +132,14 @@ public: //- Return gradient at boundary virtual tmp> snGrad() const { - return tmp> - ( - new Field(this->size(), Zero) - ); + return tmp>::New(this->size(), Zero); } //- Evaluate the patch field virtual void evaluate ( - const Pstream::commsTypes commsType = Pstream::commsTypes::blocking + const Pstream::commsTypes commsType = + Pstream::commsTypes::blocking ); //- Return the matrix diagonal coefficients corresponding to the diff --git a/src/finiteArea/fields/faPatchFields/derived/clampedPlate/clampedPlateFaPatchField.C b/src/finiteArea/fields/faPatchFields/derived/clampedPlate/clampedPlateFaPatchField.C index 77fde57095..f7bf73b384 100644 --- a/src/finiteArea/fields/faPatchFields/derived/clampedPlate/clampedPlateFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/derived/clampedPlate/clampedPlateFaPatchField.C @@ -58,7 +58,8 @@ clampedPlateFaPatchField::clampedPlateFaPatchField : faPatchField(p, iF, dict, IOobjectOption::NO_READ) { - faPatchField::operator=(this->patchInternalField()); + // Set to the internal field + faPatchField::patchInternalField(*this); } diff --git a/src/finiteArea/fields/faPatchFields/derived/fixedValueOutflow/fixedValueOutflowFaPatchField.H b/src/finiteArea/fields/faPatchFields/derived/fixedValueOutflow/fixedValueOutflowFaPatchField.H index cc90c9ddf0..d6b63c61c4 100644 --- a/src/finiteArea/fields/faPatchFields/derived/fixedValueOutflow/fixedValueOutflowFaPatchField.H +++ b/src/finiteArea/fields/faPatchFields/derived/fixedValueOutflow/fixedValueOutflowFaPatchField.H @@ -125,17 +125,10 @@ public: } - // Member functions + // Member Functions - // Access - - //- Return true if this patch field fixes a value. - // Needed to check if a level has to be specified while solving - // Poissons equations. - virtual bool fixesValue() const - { - return true; - } + //- True: the patch field fixes a value. + virtual bool fixesValue() const { return true; } // Evaluation functions diff --git a/src/finiteArea/fields/faPatchFields/faPatchField/faPatchField.H b/src/finiteArea/fields/faPatchFields/faPatchField/faPatchField.H index 00a9fcb409..93b73c61ff 100644 --- a/src/finiteArea/fields/faPatchFields/faPatchField/faPatchField.H +++ b/src/finiteArea/fields/faPatchFields/faPatchField/faPatchField.H @@ -145,8 +145,53 @@ public: virtual ~faPatchFieldBase() = default; + // Static Member Functions + + //- The type name for \c empty patch fields + static const word& emptyType() noexcept + { + return Foam::fieldTypes::emptyType; + } + + //- The type name for \c calculated patch fields + static const word& calculatedType() noexcept + { + return Foam::fieldTypes::calculatedType; + } + + //- The type name for \c extrapolatedCalculated patch fields + //- combines \c zero-gradient and \c calculated + static const word& extrapolatedCalculatedType() noexcept + { + return Foam::fieldTypes::extrapolatedCalculatedType; + } + + //- The type name for \c zeroGradient patch fields + static const word& zeroGradientType() noexcept + { + return Foam::fieldTypes::zeroGradientType; + } + + // Member Functions + // Attributes + + //- True if the patch field fixes a value. + // Needed to check if a level has to be specified while solving + // Poissons equations. + virtual bool fixesValue() const + { + return false; + } + + //- True if the patch field is coupled + virtual bool coupled() const + { + return false; + } + + // Access //- The associated objectRegistry @@ -411,30 +456,6 @@ public: // Member Functions - //- The type name for calculated patch fields - static const word& calculatedType(); - - //- The type name for zeroGradient patch fields - static const word& zeroGradientType(); - - - // Attributes - - //- True if this patch field fixes a value. - // Needed to check if a level has to be specified while solving - // Poissons equations. - virtual bool fixesValue() const - { - return false; - } - - //- True if this patch field is coupled - virtual bool coupled() const - { - return false; - } - - // Access //- Return const-reference to the dimensioned internal field diff --git a/src/finiteArea/fields/faePatchFields/basic/calculated/calculatedFaePatchField.C b/src/finiteArea/fields/faePatchFields/basic/calculated/calculatedFaePatchField.C index 181683faa7..ab40effddc 100644 --- a/src/finiteArea/fields/faePatchFields/basic/calculated/calculatedFaePatchField.C +++ b/src/finiteArea/fields/faePatchFields/basic/calculated/calculatedFaePatchField.C @@ -29,15 +29,6 @@ License #include "calculatedFaePatchField.H" #include "faPatchFieldMapper.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -template -const Foam::word& Foam::faePatchField::calculatedType() -{ - return Foam::calculatedFaePatchField::typeName; -} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template diff --git a/src/finiteArea/fields/faePatchFields/basic/calculated/calculatedFaePatchField.H b/src/finiteArea/fields/faePatchFields/basic/calculated/calculatedFaePatchField.H index 61d3b13a64..f63080c194 100644 --- a/src/finiteArea/fields/faePatchFields/basic/calculated/calculatedFaePatchField.H +++ b/src/finiteArea/fields/faePatchFields/basic/calculated/calculatedFaePatchField.H @@ -60,7 +60,7 @@ class calculatedFaePatchField public: //- Runtime type information - TypeName("calculated"); + TypeName("calculated"); // fieldTypes::calculatedTypeName_() // Constructors @@ -128,16 +128,11 @@ public: // Member Functions - // Access + //- True: the patch field fixes a value. + virtual bool fixesValue() const { return true; } - //- Return true if this patch field fixes a value. - // Needed to check if a level has to be specified while solving - // Poissons equations. - virtual bool fixesValue() const - { - return true; - } + // Other //- Write virtual void write(Ostream&) const; diff --git a/src/finiteArea/fields/faePatchFields/basic/fixedValue/fixedValueFaePatchField.H b/src/finiteArea/fields/faePatchFields/basic/fixedValue/fixedValueFaePatchField.H index beb7d4c751..9892f9923c 100644 --- a/src/finiteArea/fields/faePatchFields/basic/fixedValue/fixedValueFaePatchField.H +++ b/src/finiteArea/fields/faePatchFields/basic/fixedValue/fixedValueFaePatchField.H @@ -130,24 +130,19 @@ public: virtual ~fixedValueFaePatchField() = default; - // Member functions + // Member Functions - // Access + //- True: this patch field fixes a value. + virtual bool fixesValue() const { return true; } - //- Return true if this patch field fixes a value. - // Needed to check if a level has to be specified while solving - // Poissons equations. - virtual bool fixesValue() const - { - return true; - } + // Other //- Write virtual void write(Ostream&) const; - // Member operators + // Member Operators virtual void operator=(const UList&) {} diff --git a/src/finiteArea/fields/faePatchFields/basic/sliced/slicedFaePatchField.H b/src/finiteArea/fields/faePatchFields/basic/sliced/slicedFaePatchField.H index 40caa47ba1..c56b7a9ffe 100644 --- a/src/finiteArea/fields/faePatchFields/basic/sliced/slicedFaePatchField.H +++ b/src/finiteArea/fields/faePatchFields/basic/sliced/slicedFaePatchField.H @@ -132,8 +132,6 @@ public: // Member Functions - // Attributes - //- True: this patch field fixes a value. virtual bool fixesValue() const { return true; } diff --git a/src/finiteArea/fields/faePatchFields/constraint/empty/emptyFaePatchField.H b/src/finiteArea/fields/faePatchFields/constraint/empty/emptyFaePatchField.H index 03b86c0cda..a539268742 100644 --- a/src/finiteArea/fields/faePatchFields/constraint/empty/emptyFaePatchField.H +++ b/src/finiteArea/fields/faePatchFields/constraint/empty/emptyFaePatchField.H @@ -61,7 +61,7 @@ class emptyFaePatchField public: //- Runtime type information - TypeName("empty"); + TypeName(emptyFaPatch::typeName_()); // fieldTypes::emptyTypeName_() // Constructors diff --git a/src/finiteArea/fields/faePatchFields/faePatchField/faePatchField.H b/src/finiteArea/fields/faePatchFields/faePatchField/faePatchField.H index 16df2ca380..b2fe67f877 100644 --- a/src/finiteArea/fields/faePatchFields/faePatchField/faePatchField.H +++ b/src/finiteArea/fields/faePatchFields/faePatchField/faePatchField.H @@ -131,8 +131,40 @@ public: virtual ~faePatchFieldBase() = default; + // Static Member Functions + + //- The type name for \c empty patch fields + static const word& emptyType() noexcept + { + return Foam::fieldTypes::emptyType; + } + + //- The type name for \c calculated patch fields + static const word& calculatedType() noexcept + { + return Foam::fieldTypes::calculatedType; + } + + // Member Functions + // Attributes + + //- True if the patch field fixes a value. + // Needed to check if a level has to be specified while solving + // Poissons equations. + virtual bool fixesValue() const + { + return false; + } + + //- True if the patch field is coupled + virtual bool coupled() const + { + return false; + } + + // Access //- The associated objectRegistry @@ -390,27 +422,6 @@ public: // Member Functions - //- The type name for calculated patch fields - static const word& calculatedType(); - - - // Attributes - - //- True if this patch field fixes a value. - // Needed to check if a level has to be specified while solving - // Poissons equations. - virtual bool fixesValue() const - { - return false; - } - - //- True if this patch field is coupled - virtual bool coupled() const - { - return false; - } - - // Access //- Return const-reference to the dimensioned internal field diff --git a/src/finiteVolume/fields/fvPatchFields/basic/calculated/calculatedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/calculated/calculatedFvPatchField.C index e0720407f6..03e44871b4 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/calculated/calculatedFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/calculated/calculatedFvPatchField.C @@ -29,15 +29,6 @@ License #include "calculatedFvPatchField.H" #include "fvPatchFieldMapper.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -template -const Foam::word& Foam::fvPatchField::calculatedType() -{ - return Foam::calculatedFvPatchField::typeName; -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template diff --git a/src/finiteVolume/fields/fvPatchFields/basic/calculated/calculatedFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/basic/calculated/calculatedFvPatchField.H index a97ccbdd6c..59089a4b4d 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/calculated/calculatedFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/basic/calculated/calculatedFvPatchField.H @@ -69,11 +69,10 @@ class calculatedFvPatchField : public fvPatchField { - public: //- Runtime type information - TypeName("calculated"); + TypeName("calculated"); // fieldTypes::calculatedTypeName_() // Constructors @@ -154,17 +153,10 @@ public: } - // Member functions + // Member Functions - // Attributes - - //- Return true if this patch field fixes a value. - // Needed to check if a level has to be specified while solving - // Poissons equations. - virtual bool fixesValue() const - { - return true; - } + //- True: this patch field fixes a value. + virtual bool fixesValue() const { return true; } // Evaluation functions diff --git a/src/finiteVolume/fields/fvPatchFields/basic/directionMixed/directionMixedFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/basic/directionMixed/directionMixedFvPatchField.H index e1d6c59d0d..d56bc7113a 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/directionMixed/directionMixedFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/basic/directionMixed/directionMixedFvPatchField.H @@ -130,23 +130,13 @@ public: } - // Member functions + // Member Functions - // Attributes + //- True: this patch field fixes a value. + virtual bool fixesValue() const { return true; } - //- Return true: this patch field fixes a value. - // Needed to check if a level has to be specified while solving - // Poissons equations. - virtual bool fixesValue() const - { - return true; - } - - //- Return false: this patch field is not altered by assignment - virtual bool assignable() const - { - return false; - } + //- False: this patch field is not altered by assignment. + virtual bool assignable() const { return false; } // Mapping functions diff --git a/src/finiteVolume/fields/fvPatchFields/basic/extrapolatedCalculated/extrapolatedCalculatedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/extrapolatedCalculated/extrapolatedCalculatedFvPatchField.C index 105e23c4f8..a1442f4e1a 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/extrapolatedCalculated/extrapolatedCalculatedFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/extrapolatedCalculated/extrapolatedCalculatedFvPatchField.C @@ -54,7 +54,8 @@ extrapolatedCalculatedFvPatchField : calculatedFvPatchField(p, iF, dict, IOobjectOption::NO_READ) { - calculatedFvPatchField::operator==(this->patchInternalField()); + // Set to the internal field + fvPatchField::patchInternalField(*this); } @@ -108,7 +109,8 @@ void Foam::extrapolatedCalculatedFvPatchField::evaluate this->updateCoeffs(); } - calculatedFvPatchField::operator==(this->patchInternalField()); + // Set to the internal field + fvPatchField::patchInternalField(*this); calculatedFvPatchField::evaluate(); } diff --git a/src/finiteVolume/fields/fvPatchFields/basic/extrapolatedCalculated/extrapolatedCalculatedFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/basic/extrapolatedCalculated/extrapolatedCalculatedFvPatchField.H index 6ca1a44557..dad65d55ff 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/extrapolatedCalculated/extrapolatedCalculatedFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/basic/extrapolatedCalculated/extrapolatedCalculatedFvPatchField.H @@ -72,6 +72,7 @@ public: //- Runtime type information TypeName("extrapolatedCalculated"); + // fieldTypes::extrapolatedCalculatedTypeName_() // Constructors diff --git a/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.H index 3643d82925..d8c09c5717 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.H @@ -166,23 +166,13 @@ public: } - // Member functions + // Member Functions - // Attributes + //- True: this patch field fixes a value. + virtual bool fixesValue() const { return true; } - //- Return true if this patch field fixes a value. - // Needed to check if a level has to be specified while solving - // Poissons equations. - virtual bool fixesValue() const - { - return true; - } - - //- Return false: this patch field is not altered by assignment - virtual bool assignable() const - { - return false; - } + //- False: this patch field is not altered by assignment. + virtual bool assignable() const { return false; } // Evaluation functions diff --git a/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.H index 87c2f8b5c3..143df47f4f 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.H @@ -188,23 +188,13 @@ public: } - // Member functions + // Member Functions - // Access + //- True: this patch field fixes a value. + virtual bool fixesValue() const { return true; } - //- Return true if this patch field fixes a value. - // Needed to check if a level has to be specified while solving - // Poissons equations. - virtual bool fixesValue() const - { - return true; - } - - //- Return false: this patch field is not altered by assignment - virtual bool assignable() const - { - return false; - } + //- False: this patch field is not altered by assignment. + virtual bool assignable() const { return false; } // Return defining fields diff --git a/src/finiteVolume/fields/fvPatchFields/basic/sliced/slicedFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/basic/sliced/slicedFvPatchField.H index e41db62955..6b7a51733e 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/sliced/slicedFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/basic/sliced/slicedFvPatchField.H @@ -136,23 +136,13 @@ public: virtual ~slicedFvPatchField(); - // Member functions + // Member Functions - // Attributes + //- True: this patch field fixes a value. + virtual bool fixesValue() const { return true; } - //- Return true if this patch field fixes a value. - // Needed to check if a level has to be specified while solving - // Poissons equations. - virtual bool fixesValue() const - { - return true; - } - - //- Return false: this patch field is not altered by assignment - virtual bool assignable() const - { - return false; - } + //- False: this patch field is not altered by assignment. + virtual bool assignable() const { return false; } // Evaluation functions diff --git a/src/finiteVolume/fields/fvPatchFields/basic/transform/transformFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/basic/transform/transformFvPatchField.H index 4bb2e5016f..89042ab751 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/transform/transformFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/basic/transform/transformFvPatchField.H @@ -113,16 +113,10 @@ public: ) const = 0; - // Member functions + // Member Functions - // Attributes - - //- Return true if the value of the patch field - // is altered by assignment - virtual bool assignable() const - { - return true; - } + //- True: this patch field is altered by assignment. + virtual bool assignable() const { return true; } // Evaluation functions diff --git a/src/finiteVolume/fields/fvPatchFields/basic/zeroGradient/zeroGradientFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/zeroGradient/zeroGradientFvPatchField.C index b7ee3544fe..fd5dfca10d 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/zeroGradient/zeroGradientFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/zeroGradient/zeroGradientFvPatchField.C @@ -28,16 +28,6 @@ License #include "zeroGradientFvPatchField.H" #include "fvPatchFieldMapper.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -template -const Foam::word& Foam::fvPatchField::zeroGradientType() -{ - return zeroGradientFvPatchField::typeName; -} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template @@ -61,7 +51,8 @@ Foam::zeroGradientFvPatchField::zeroGradientFvPatchField : fvPatchField(p, iF, dict, IOobjectOption::NO_READ) { - fvPatchField::operator=(this->patchInternalField()); + // Set to the internal field + fvPatchField::patchInternalField(*this); } @@ -109,7 +100,8 @@ void Foam::zeroGradientFvPatchField::evaluate(const Pstream::commsTypes) this->updateCoeffs(); } - fvPatchField::operator==(this->patchInternalField()); + // Set to the internal field + fvPatchField::patchInternalField(*this); fvPatchField::evaluate(); } diff --git a/src/finiteVolume/fields/fvPatchFields/basic/zeroGradient/zeroGradientFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/basic/zeroGradient/zeroGradientFvPatchField.H index 05cc20e4b5..65d8582bc2 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/zeroGradient/zeroGradientFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/basic/zeroGradient/zeroGradientFvPatchField.H @@ -47,8 +47,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef zeroGradientFvPatchField_H -#define zeroGradientFvPatchField_H +#ifndef Foam_zeroGradientFvPatchField_H +#define Foam_zeroGradientFvPatchField_H #include "fvPatchField.H" @@ -66,11 +66,10 @@ class zeroGradientFvPatchField : public fvPatchField { - public: //- Runtime type information - TypeName("zeroGradient"); + TypeName("zeroGradient"); // fieldTypes::zeroGradientTypeName_() // Constructors @@ -142,10 +141,7 @@ public: //- Return gradient at boundary virtual tmp> snGrad() const { - return tmp> - ( - new Field(this->size(), Zero) - ); + return tmp>::New(this->size(), Zero); } //- Evaluate the patch field diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C index 7cbf4c5d53..8f983958ef 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C @@ -77,7 +77,7 @@ Foam::cyclicAMIFvPatchField::cyclicAMIFvPatchField } else { - fvPatchField::operator=(this->patchInternalField()); + fvPatchField::patchInternalField(*this); } } } diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/empty/emptyFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/empty/emptyFvPatchField.H index e7d87356aa..6d97bc67ed 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/empty/emptyFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/empty/emptyFvPatchField.H @@ -49,8 +49,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef emptyFvPatchField_H -#define emptyFvPatchField_H +#ifndef Foam_emptyFvPatchField_H +#define Foam_emptyFvPatchField_H #include "fvPatchField.H" #include "emptyFvPatch.H" @@ -69,11 +69,10 @@ class emptyFvPatchField : public fvPatchField { - public: //- Runtime type information - TypeName(emptyFvPatch::typeName_()); + TypeName(emptyFvPatch::typeName_()); // fieldTypes::emptyTypeName_() // Constructors diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C index eaa4786d12..b5350e4f3f 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C @@ -89,7 +89,7 @@ Foam::processorFvPatchField::processorFvPatchField // Use 'value' supplied, or set to internal field if (!this->readValueEntry(dict)) { - fvPatchField::operator=(this->patchInternalField()); + fvPatchField::patchInternalField(*this); } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C index 7e989ae29c..47285e9e8f 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C @@ -91,7 +91,7 @@ Foam::advectiveFvPatchField::advectiveFvPatchField // Use 'value' supplied, or set to internal field if (!this->readValueEntry(dict)) { - fvPatchField::operator=(this->patchInternalField()); + fvPatchField::patchInternalField(*this); } this->refValue() = *this; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C index 59228d43b1..1eb6787657 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C @@ -189,7 +189,7 @@ Foam::codedFixedValueFvPatchField::codedFixedValueFvPatchField if (!this->readValueEntry(dict)) { // Assign dummy value to get redirectPatchField not fail - this->operator==(this->patchInternalField()); + fvPatchField::patchInternalField(*this); this->evaluate(Pstream::commsTypes::blocking); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/electrostaticDeposition/electrostaticDepositionFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/electrostaticDeposition/electrostaticDepositionFvPatchScalarField.C index 9786b53ace..7ee4400f50 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/electrostaticDeposition/electrostaticDepositionFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/electrostaticDeposition/electrostaticDepositionFvPatchScalarField.C @@ -208,7 +208,7 @@ electrostaticDepositionFvPatchScalarField { if (!this->readValueEntry(dict)) { - fvPatchScalarField::operator=(patchInternalField()); + fvPatchField::patchInternalField(*this); } // If flow is multiphase diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C index 32a98f9f11..3187bf0a3b 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C @@ -65,7 +65,7 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField } else { - fvPatchField::operator=(patchInternalField()); + fvPatchField::patchInternalField(*this); gradient() = Zero; } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalInletOutletVelocity/fixedNormalInletOutletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalInletOutletVelocity/fixedNormalInletOutletVelocityFvPatchVectorField.H index 5ef9e8bda8..0ebb2f934e 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalInletOutletVelocity/fixedNormalInletOutletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalInletOutletVelocity/fixedNormalInletOutletVelocityFvPatchVectorField.H @@ -188,15 +188,10 @@ public: } - // Member functions + // Member Functions - // Attributes - - //- Return true: this patch field is altered by assignment - virtual bool assignable() const - { - return true; - } + //- True: this patch field is altered by assignment. + virtual bool assignable() const { return true; } // Access diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.H index 1588c53328..d811f125f5 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.H @@ -178,13 +178,11 @@ public: // Member Functions - // Access + //- False: this patch field is not altered by assignment. + virtual bool assignable() const { return false; } - //- This patch field is not altered by assignment - virtual bool assignable() const - { - return false; - } + + // Access //- User-defined input field (modifiable field) virtual Field& fixedValue() diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C index fd02bf04bc..820552d8b8 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C @@ -75,7 +75,7 @@ fluxCorrectedVelocityFvPatchVectorField rhoName_(dict.getOrDefault("rho", "rho")) { fvPatchFieldBase::readDict(dict); - fvPatchVectorField::operator=(patchInternalField()); + fvPatchField::patchInternalField(*this); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.H index 0462c6bc0e..ac1e29355b 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/inletOutlet/inletOutletFvPatchField.H @@ -166,13 +166,8 @@ public: // Member functions - // Attributes - - //- Return true: this patch field is altered by assignment - virtual bool assignable() const - { - return true; - } + //- True: this patch field is altered by assignment. + virtual bool assignable() const { return true; } //- Update the coefficients associated with the patch field diff --git a/src/finiteVolume/fields/fvPatchFields/derived/outletMappedUniformInlet/outletMappedUniformInletFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/outletMappedUniformInlet/outletMappedUniformInletFvPatchField.C index 7a16714c53..9c3ac4ac2e 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/outletMappedUniformInlet/outletMappedUniformInletFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/outletMappedUniformInlet/outletMappedUniformInletFvPatchField.C @@ -170,7 +170,8 @@ outletMappedUniformInletFvPatchField if (!this->readValueEntry(dict)) { - fvPatchField::operator=(this->patchInternalField()); + // Fallback: set to the internal field + fvPatchField::patchInternalField(*this); } } @@ -203,7 +204,8 @@ outletMappedUniformInletFvPatchField } else { - fvPatchField::operator=(this->patchInternalField()); + // Fallback: set to the internal field + fvPatchField::patchInternalField(*this); } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/outletPhaseMeanVelocity/outletPhaseMeanVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/outletPhaseMeanVelocity/outletPhaseMeanVelocityFvPatchVectorField.C index 44b8b317d3..4f9e0f9036 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/outletPhaseMeanVelocity/outletPhaseMeanVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/outletPhaseMeanVelocity/outletPhaseMeanVelocityFvPatchVectorField.C @@ -86,7 +86,7 @@ Foam::outletPhaseMeanVelocityFvPatchVectorField if (!this->readValueEntry(dict)) { - fvPatchVectorField::operator=(patchInternalField()); + fvPatchField::patchInternalField(*this); } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.H index 320e3f313e..c9b3f27834 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.H @@ -166,13 +166,10 @@ public: // Member Functions - // Access/attributes + //- False: this patch field is not altered by assignment + virtual bool assignable() const { return false; } - //- This patch field is not altered by assignment - virtual bool assignable() const - { - return false; - } + // Access virtual Field& refValue() { diff --git a/src/finiteVolume/fields/fvPatchFields/derived/phaseHydrostaticPressure/phaseHydrostaticPressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/phaseHydrostaticPressure/phaseHydrostaticPressureFvPatchScalarField.H index 79362f5447..ca1f4c4d2d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/phaseHydrostaticPressure/phaseHydrostaticPressureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/phaseHydrostaticPressure/phaseHydrostaticPressureFvPatchScalarField.H @@ -184,15 +184,10 @@ public: } - // Member functions + // Member Functions - // Attributes - - //- Return true: this patch field is altered by assignment - virtual bool assignable() const - { - return true; - } + //- True: this patch field is altered by assignment + virtual bool assignable() const { return true; } // Access diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.H index a7f58e6681..85bf2b931d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.H @@ -176,15 +176,10 @@ public: } - // Member functions + // Member Functions - // Attributes - - //- Return true: this patch field is altered by assignment - virtual bool assignable() const - { - return true; - } + //- True: this patch field is altered by assignment + virtual bool assignable() const { return true; } // Access diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.H index cfc7ce6c1b..080c250af7 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.H @@ -172,15 +172,11 @@ public: } - // Member functions + // Member Functions - // Attributes + //- True: this patch field is altered by assignment + virtual bool assignable() const { return true; } - //- Return true: this patch field is altered by assignment - virtual bool assignable() const - { - return true; - } // Access diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.H index d420e30f6a..f4f52f7c22 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.H @@ -172,15 +172,10 @@ public: } - // Member functions + // Member Functions - // Attributes - - //- Return true: this patch field is altered by assignment - virtual bool assignable() const - { - return true; - } + //- True: this patch field is altered by assignment + virtual bool assignable() const { return true; } // Access diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.H index 478c3f1d4a..766c68b026 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.H @@ -162,15 +162,10 @@ public: } - // Member functions + // Member Functions - // Attributes - - //- Return true: this patch field is altered by assignment - virtual bool assignable() const - { - return true; - } + //- True: this patch field is altered by assignment + virtual bool assignable() const { return true; } // Access diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletUniformVelocity/pressureInletUniformVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletUniformVelocity/pressureInletUniformVelocityFvPatchVectorField.H index a6ad0a7320..e4af130ac2 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletUniformVelocity/pressureInletUniformVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletUniformVelocity/pressureInletUniformVelocityFvPatchVectorField.H @@ -137,15 +137,10 @@ public: } - // Member functions + // Member Functions - // Attributes - - //- Return true: this patch field is altered by assignment - virtual bool assignable() const - { - return true; - } + //- True: this patch field is altered by assignment + virtual bool assignable() const { return true; } //- Update the coefficients associated with the patch field diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.H index 2876980117..3db2a464eb 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.H @@ -155,15 +155,10 @@ public: } - // Member functions + // Member Functions - // Attributes - - //- Return true: this patch field is altered by assignment - virtual bool assignable() const - { - return true; - } + //- True: this patch field is altered by assignment + virtual bool assignable() const { return true; } // Access diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureNormalInletOutletVelocity/pressureNormalInletOutletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/pressureNormalInletOutletVelocity/pressureNormalInletOutletVelocityFvPatchVectorField.H index c97e5d226d..1ea26624f3 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureNormalInletOutletVelocity/pressureNormalInletOutletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureNormalInletOutletVelocity/pressureNormalInletOutletVelocityFvPatchVectorField.H @@ -171,15 +171,10 @@ public: } - // Member functions + // Member Functions - // Attributes - - //- Return true: this patch field is altered by assignment - virtual bool assignable() const - { - return true; - } + //- True: this patch field is altered by assignment + virtual bool assignable() const { return true; } // Access diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressurePermeableAlphaInletOutletVelocity/pressurePermeableAlphaInletOutletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/pressurePermeableAlphaInletOutletVelocity/pressurePermeableAlphaInletOutletVelocityFvPatchVectorField.H index f087b5cae5..d09ab668d9 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressurePermeableAlphaInletOutletVelocity/pressurePermeableAlphaInletOutletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressurePermeableAlphaInletOutletVelocity/pressurePermeableAlphaInletOutletVelocityFvPatchVectorField.H @@ -194,13 +194,8 @@ public: // Member Functions - // Attributes - - //- Return true: this patch field is altered by assignment - virtual bool assignable() const - { - return true; - } + //- True: this patch field is altered by assignment + virtual bool assignable() const { return true; } // Access diff --git a/src/finiteVolume/fields/fvPatchFields/derived/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C index ec336b2354..4962f0bf82 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C @@ -76,7 +76,7 @@ supersonicFreestreamFvPatchVectorField if (!this->readValueEntry(dict)) { - fvPatchField::operator=(patchInternalField()); + fvPatchField::patchInternalField(*this); } refValue() = *this; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.H index 9382071b8f..fc2bca0339 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.H @@ -169,13 +169,8 @@ public: // Member functions - // Attributes - - //- Return true: this patch field is altered by assignment - virtual bool assignable() const - { - return true; - } + //- True: this patch field is altered by assignment + virtual bool assignable() const { return true; } // Mapping functions diff --git a/src/finiteVolume/fields/fvPatchFields/derived/variableHeightFlowRate/variableHeightFlowRateFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/variableHeightFlowRate/variableHeightFlowRateFvPatchField.C index c7609a9053..a569a669dc 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/variableHeightFlowRate/variableHeightFlowRateFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/variableHeightFlowRate/variableHeightFlowRateFvPatchField.C @@ -82,13 +82,14 @@ Foam::variableHeightFlowRateFvPatchScalarField upperBound_(dict.get("upperBound")) { fvPatchFieldBase::readDict(dict); - this->refValue() = 0.0; if (!this->readValueEntry(dict)) { - fvPatchScalarField::operator=(this->patchInternalField()); + // Fallback: set to the internal field + fvPatchField::patchInternalField(*this); } + this->refValue() = 0.0; this->refGrad() = 0.0; this->valueFraction() = 0.0; } diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C index 99e4a31719..d0f5908b10 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C @@ -169,7 +169,7 @@ Foam::fvPatchField::fvPatchField // For unmapped faces set to internal field value (zero-gradient) if (notNull(iF) && mapper.hasUnmapped()) { - fvPatchField::operator=(this->patchInternalField()); + fvPatchField::patchInternalField(*this); } this->map(ptf, mapper); } @@ -241,7 +241,7 @@ void Foam::fvPatchField::autoMap if (!this->size() && !mapper.distributed()) { - f.setSize(mapper.size()); + f.resize_nocopy(mapper.size()); if (f.size()) { f = this->patchInternalField(); diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H index 6df6c018e6..1382ab356c 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H @@ -154,8 +154,59 @@ public: virtual ~fvPatchFieldBase() = default; + // Static Member Functions + + //- The type name for \c empty patch fields + static const word& emptyType() noexcept + { + return Foam::fieldTypes::emptyType; + } + + //- The type name for \c calculated patch fields + static const word& calculatedType() noexcept + { + return Foam::fieldTypes::calculatedType; + } + + //- The type name for \c extrapolatedCalculated patch fields + //- combines \c zero-gradient and \c calculated + static const word& extrapolatedCalculatedType() noexcept + { + return Foam::fieldTypes::extrapolatedCalculatedType; + } + + //- The type name for \c zeroGradient patch fields + static const word& zeroGradientType() noexcept + { + return Foam::fieldTypes::zeroGradientType; + } + + // Member Functions + // Attributes + + //- True if the value of the patch field is altered by assignment + virtual bool assignable() const + { + return true; + } + + //- True if the patch field fixes a value. + // Needed to check if a level has to be specified while solving + // Poissons equations. + virtual bool fixesValue() const + { + return false; + } + + //- True if the patch field is coupled + virtual bool coupled() const + { + return false; + } + + // Access //- The associated objectRegistry @@ -473,37 +524,6 @@ public: // Member Functions - //- The type name for calculated patch fields - static const word& calculatedType(); - - //- The type name for zeroGradient patch fields - static const word& zeroGradientType(); - - - // Attributes - - //- True if this patch field fixes a value. - // Needed to check if a level has to be specified while solving - // Poissons equations. - virtual bool fixesValue() const - { - return false; - } - - //- True if the value of the patch field - //- is altered by assignment (the default) - virtual bool assignable() const - { - return true; - } - - //- True if this patch field is coupled - virtual bool coupled() const - { - return false; - } - - // Access //- Return const-reference to the dimensioned internal field diff --git a/src/finiteVolume/fields/fvsPatchFields/basic/calculated/calculatedFvsPatchField.C b/src/finiteVolume/fields/fvsPatchFields/basic/calculated/calculatedFvsPatchField.C index 35f82e8b04..443ab350aa 100644 --- a/src/finiteVolume/fields/fvsPatchFields/basic/calculated/calculatedFvsPatchField.C +++ b/src/finiteVolume/fields/fvsPatchFields/basic/calculated/calculatedFvsPatchField.C @@ -29,14 +29,6 @@ License #include "calculatedFvsPatchField.H" #include "fvPatchFieldMapper.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -template -const Foam::word& Foam::fvsPatchField::calculatedType() -{ - return Foam::calculatedFvsPatchField::typeName; -} - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template diff --git a/src/finiteVolume/fields/fvsPatchFields/basic/calculated/calculatedFvsPatchField.H b/src/finiteVolume/fields/fvsPatchFields/basic/calculated/calculatedFvsPatchField.H index 838f03b2ff..56982775be 100644 --- a/src/finiteVolume/fields/fvsPatchFields/basic/calculated/calculatedFvsPatchField.H +++ b/src/finiteVolume/fields/fvsPatchFields/basic/calculated/calculatedFvsPatchField.H @@ -34,8 +34,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef calculatedFvsPatchField_H -#define calculatedFvsPatchField_H +#ifndef Foam_calculatedFvsPatchField_H +#define Foam_calculatedFvsPatchField_H #include "fvsPatchField.H" @@ -53,11 +53,10 @@ class calculatedFvsPatchField : public fvsPatchField { - public: //- Runtime type information - TypeName("calculated"); + TypeName("calculated"); // fieldTypes::calculatedTypeName_() // Constructors @@ -121,17 +120,10 @@ public: } - // Member functions + // Member Functions - // Access - - //- Return true if this patch field fixes a value. - // Needed to check if a level has to be specified while solving - // Poissons equations. - virtual bool fixesValue() const - { - return true; - } + //- True: this patch field fixes a value. + virtual bool fixesValue() const { return true; } }; diff --git a/src/finiteVolume/fields/fvsPatchFields/basic/fixedValue/fixedValueFvsPatchField.H b/src/finiteVolume/fields/fvsPatchFields/basic/fixedValue/fixedValueFvsPatchField.H index 6d3d19f7e3..5189bfd2a2 100644 --- a/src/finiteVolume/fields/fvsPatchFields/basic/fixedValue/fixedValueFvsPatchField.H +++ b/src/finiteVolume/fields/fvsPatchFields/basic/fixedValue/fixedValueFvsPatchField.H @@ -122,17 +122,10 @@ public: } - // Member functions + // Member Functions - // Access - - //- Return true if this patch field fixes a value. - // Needed to check if a level has to be specified while solving - // Poissons equations. - virtual bool fixesValue() const - { - return true; - } + //- True: this patch field fixes a value. + virtual bool fixesValue() const { return true; } // Evaluation functions diff --git a/src/finiteVolume/fields/fvsPatchFields/basic/sliced/slicedFvsPatchField.H b/src/finiteVolume/fields/fvsPatchFields/basic/sliced/slicedFvsPatchField.H index d5ce648c96..64aeaeb486 100644 --- a/src/finiteVolume/fields/fvsPatchFields/basic/sliced/slicedFvsPatchField.H +++ b/src/finiteVolume/fields/fvsPatchFields/basic/sliced/slicedFvsPatchField.H @@ -130,20 +130,13 @@ public: virtual ~slicedFvsPatchField(); - // Member functions + // Member Functions - // Access - - //- Return true if this patch field fixes a value. - // Needed to check if a level has to be specified while solving - // Poissons equations. - virtual bool fixesValue() const - { - return true; - } + //- True: this patch field fixes a value. + virtual bool fixesValue() const { return true; } - // Member operators + // Member Operators virtual void operator=(const UList&) {} diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/empty/emptyFvsPatchField.H b/src/finiteVolume/fields/fvsPatchFields/constraint/empty/emptyFvsPatchField.H index c0ecbc9b21..1d96c1c568 100644 --- a/src/finiteVolume/fields/fvsPatchFields/constraint/empty/emptyFvsPatchField.H +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/empty/emptyFvsPatchField.H @@ -34,8 +34,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef emptyFvsPatchField_H -#define emptyFvsPatchField_H +#ifndef Foam_emptyFvsPatchField_H +#define Foam_emptyFvsPatchField_H #include "fvsPatchField.H" #include "emptyFvPatch.H" @@ -54,11 +54,10 @@ class emptyFvsPatchField : public fvsPatchField { - public: //- Runtime type information - TypeName(emptyFvPatch::typeName_()); + TypeName(emptyFvPatch::typeName_()); // fieldTypes::emptyTypeName_() // Constructors diff --git a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H index 00a3737be7..3d305997a5 100644 --- a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H +++ b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H @@ -126,8 +126,40 @@ public: virtual ~fvsPatchFieldBase() = default; + // Static Member Functions + + //- The type name for \c empty patch fields + static const word& emptyType() noexcept + { + return Foam::fieldTypes::emptyType; + } + + //- The type name for \c calculated patch fields + static const word& calculatedType() noexcept + { + return Foam::fieldTypes::calculatedType; + } + + // Member Functions + // Attributes + + //- True if the patch field fixes a value. + // Needed to check if a level has to be specified while solving + // Poissons equations. + virtual bool fixesValue() const + { + return false; + } + + //- True if the patch field is coupled + virtual bool coupled() const + { + return false; + } + + // Access //- The associated objectRegistry @@ -403,27 +435,6 @@ public: // Member Functions - //- The type name for calculated patch fields - static const word& calculatedType(); - - - // Attributes - - //- True if this patch field fixes a value. - // Needed to check if a level has to be specified while solving - // Poissons equations. - virtual bool fixesValue() const - { - return false; - } - - //- True if this patch field is coupled - virtual bool coupled() const - { - return false; - } - - // Access //- Return const-reference to the dimensioned internal field diff --git a/src/finiteVolume/fields/volFields/volFieldsFwd.H b/src/finiteVolume/fields/volFields/volFieldsFwd.H index 8d1293f421..e4daf9f73b 100644 --- a/src/finiteVolume/fields/volFields/volFieldsFwd.H +++ b/src/finiteVolume/fields/volFields/volFieldsFwd.H @@ -24,11 +24,8 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Namespace - Foam::fieldTypes - Description - Collection of common field types + Forwards and collection of common volume field types SourceFiles volFields.C diff --git a/src/functionObjects/field/externalCoupled/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.C b/src/functionObjects/field/externalCoupled/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.C index 7e4af42bf4..7dad174696 100644 --- a/src/functionObjects/field/externalCoupled/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.C +++ b/src/functionObjects/field/externalCoupled/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.C @@ -160,7 +160,7 @@ externalCoupledTemperatureMixedFvPatchScalarField // or extrapolated value if (!this->readValueEntry(dict)) { - fvPatchField::operator=(this->patchInternalField()); + fvPatchField::patchInternalField(*this); } // Initialise as a fixed value diff --git a/src/overset/oversetPolyPatch/oversetFvPatchField.C b/src/overset/oversetPolyPatch/oversetFvPatchField.C index 9f27a7a248..0329d406fc 100644 --- a/src/overset/oversetPolyPatch/oversetFvPatchField.C +++ b/src/overset/oversetPolyPatch/oversetFvPatchField.C @@ -113,7 +113,7 @@ Foam::oversetFvPatchField::oversetFvPatchField // Use 'value' supplied, or set to internal field if (!this->readValueEntry(dict)) { - Field::operator=(this->patchInternalField()); + fvPatchField::patchInternalField(*this); } } diff --git a/src/regionModels/surfaceFilmModels/derivedFvPatchFields/filmHeightInletVelocity/filmHeightInletVelocityFvPatchVectorField.H b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/filmHeightInletVelocity/filmHeightInletVelocityFvPatchVectorField.H index 9c489b8205..91b6940c3b 100644 --- a/src/regionModels/surfaceFilmModels/derivedFvPatchFields/filmHeightInletVelocity/filmHeightInletVelocityFvPatchVectorField.H +++ b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/filmHeightInletVelocity/filmHeightInletVelocityFvPatchVectorField.H @@ -176,15 +176,10 @@ public: } - // Member functions + // Member Functions - // Attributes - - //- Return true: this patch field is altered by assignment - virtual bool assignable() const - { - return true; - } + //- True: this patch field is altered by assignment + virtual bool assignable() const { return true; } // Access diff --git a/src/thermoTools/derivedFvPatchFields/fixedIncidentRadiation/fixedIncidentRadiationFvPatchScalarField.C b/src/thermoTools/derivedFvPatchFields/fixedIncidentRadiation/fixedIncidentRadiationFvPatchScalarField.C index 177f94c3d6..d74e60c07b 100644 --- a/src/thermoTools/derivedFvPatchFields/fixedIncidentRadiation/fixedIncidentRadiationFvPatchScalarField.C +++ b/src/thermoTools/derivedFvPatchFields/fixedIncidentRadiation/fixedIncidentRadiationFvPatchScalarField.C @@ -86,8 +86,8 @@ fixedIncidentRadiationFvPatchScalarField else { // Still reading so cannot yet evaluate. Make up a value. - fvPatchField::operator=(patchInternalField()); - gradient() = 0.0; + fvPatchField::patchInternalField(*this); + gradient() = Zero; } } diff --git a/src/thermoTools/derivedFvPatchFields/wallFunctions/sorptionWallFunction/sorptionWallFunctionFvPatchScalarField.C b/src/thermoTools/derivedFvPatchFields/wallFunctions/sorptionWallFunction/sorptionWallFunctionFvPatchScalarField.C index a3ce1f2b72..3bf82af083 100644 --- a/src/thermoTools/derivedFvPatchFields/wallFunctions/sorptionWallFunction/sorptionWallFunctionFvPatchScalarField.C +++ b/src/thermoTools/derivedFvPatchFields/wallFunctions/sorptionWallFunction/sorptionWallFunctionFvPatchScalarField.C @@ -311,8 +311,9 @@ sorptionWallFunctionFvPatchScalarField::sorptionWallFunctionFvPatchScalarField } else { - fvPatchField::operator=(patchInternalField()); - gradient() = 0.0; + // Fallback: set to zero-gradient + fvPatchField::patchInternalField(*this); + gradient() = Zero; } } diff --git a/src/transportModels/interfaceProperties/alphaContactAngle/alphaContactAngleTwoPhaseFvPatchScalarField.C b/src/transportModels/interfaceProperties/alphaContactAngle/alphaContactAngleTwoPhaseFvPatchScalarField.C index 9cc864c752..216b17537c 100644 --- a/src/transportModels/interfaceProperties/alphaContactAngle/alphaContactAngleTwoPhaseFvPatchScalarField.C +++ b/src/transportModels/interfaceProperties/alphaContactAngle/alphaContactAngleTwoPhaseFvPatchScalarField.C @@ -80,7 +80,8 @@ alphaContactAngleTwoPhaseFvPatchScalarField } else { - fvPatchField::operator=(patchInternalField()); + // Fallback: set to zero-gradient + fvPatchField::patchInternalField(*this); gradient() = Zero; } }