From 0767e21d8c8e22d9d6f6bb38e9384c44f0ca82fc Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 2 Jan 2023 09:33:00 +0100 Subject: [PATCH] ENH: more consistent convenience macros for creating patchFields --- applications/test/fvc2D/Test-fvc2D.C | 7 +- .../pointPatchField/pointPatchField.H | 84 +------- .../pointPatchField/pointPatchFieldMacros.H | 143 ++++++++++++++ .../pointPatchField/pointPatchFields.C | 26 +-- .../basicSymmetryFaPatchFields.H | 7 +- .../calculated/calculatedFaPatchFields.H | 16 +- .../basic/coupled/coupledFaPatchFields.H | 7 +- .../fixedGradientFaPatchFields.H | 16 +- .../fixedValue/fixedValueFaPatchFields.H | 7 +- .../basic/mixed/mixedFaPatchFields.H | 7 +- .../basic/transform/transformFaPatchFields.H | 15 +- .../zeroGradient/zeroGradientFaPatchFields.H | 13 +- .../constraint/cyclic/cyclicFaPatchFields.H | 7 +- .../constraint/empty/emptyFaPatchFields.H | 12 +- .../processor/processorFaPatchFields.H | 3 +- .../symmetry/symmetryFaPatchFields.H | 7 +- .../constraint/wedge/wedgeFaPatchFields.H | 7 +- .../clampedPlate/clampedPlateFaPatchFields.H | 7 +- .../fixedValueOutflowFaPatchFields.H | 7 +- .../inletOutlet/inletOutletFaPatchFields.H | 7 +- .../derived/slip/slipFaPatchFields.H | 7 +- ...imeVaryingUniformFixedValueFaPatchFields.H | 7 +- .../faPatchFields/faPatchField/faPatchField.H | 93 +-------- .../faPatchField/faPatchFieldMacros.H | 142 ++++++++++++++ .../faPatchField/faPatchFields.C | 25 +-- .../faPatchField/faPatchFields.H | 5 +- .../faPatchField/faPatchFieldsFwd.H | 7 +- .../calculated/calculatedFaePatchFields.H | 7 +- .../basic/coupled/coupledFaePatchFields.C | 6 +- .../basic/coupled/coupledFaePatchFields.H | 7 +- .../fixedValue/fixedValueFaePatchFields.H | 7 +- .../constraint/cyclic/cyclicFaePatchFields.H | 7 +- .../constraint/empty/emptyFaePatchFields.H | 7 +- .../processor/processorFaePatchFields.H | 7 +- .../symmetry/symmetryFaePatchFields.H | 7 +- .../constraint/wedge/wedgeFaePatchFields.H | 7 +- .../faePatchField/faePatchField.H | 61 +----- .../faePatchField/faePatchFieldMacros.H | 142 ++++++++++++++ .../faePatchField/faePatchFields.C | 26 +-- .../faePatchField/faePatchFields.H | 7 +- .../faePatchField/faePatchFieldsFwd.H | 8 +- .../derived/fan/fanFvPatchFields.C | 16 +- .../fixedNormalSlipFvPatchFields.C | 14 +- .../mappedMixedFieldFvPatchFields.C | 1 - .../mappedMixed/mappedMixedFvPatchFields.C | 1 - ...turbulentDigitalFilterInletFvPatchFields.C | 4 +- .../fvPatchFields/fvPatchField/fvPatchField.H | 100 +--------- .../fvPatchField/fvPatchFieldMacros.H | 180 ++++++++++++++++++ .../fvPatchField/fvPatchFields.C | 19 +- .../fvsPatchField/fvsPatchField.H | 60 +----- .../fvsPatchField/fvsPatchFieldMacros.H | 143 ++++++++++++++ .../fvsPatchField/fvsPatchFields.C | 25 +-- 52 files changed, 917 insertions(+), 643 deletions(-) create mode 100644 src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchFieldMacros.H create mode 100644 src/finiteArea/fields/faPatchFields/faPatchField/faPatchFieldMacros.H create mode 100644 src/finiteArea/fields/faePatchFields/faePatchField/faePatchFieldMacros.H create mode 100644 src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldMacros.H create mode 100644 src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchFieldMacros.H diff --git a/applications/test/fvc2D/Test-fvc2D.C b/applications/test/fvc2D/Test-fvc2D.C index aea43f20c4..768de44a91 100644 --- a/applications/test/fvc2D/Test-fvc2D.C +++ b/applications/test/fvc2D/Test-fvc2D.C @@ -35,15 +35,18 @@ Description #include "vector2D.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + namespace Foam { typedef GeometricField volVector2DField; + typedef fvPatchField fvPatchVector2DField; defineTemplateTypeNameAndDebug(volVector2DField::Internal, 0); defineTemplateTypeNameAndDebug(volVector2DField, 0); - typedef fvPatchField fvPatchVector2DField; - makeFvPatchField(fvPatchVector2DField) + defineTemplateRunTimeSelectionTable(fvPatchVector2DField, patch); + defineTemplateRunTimeSelectionTable(fvPatchVector2DField, patchMapper); + defineTemplateRunTimeSelectionTable(fvPatchVector2DField, dictionary); } diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H index 97723a1a94..010b19a0e6 100644 --- a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H @@ -589,90 +589,8 @@ const pointPatchField& operator+ #include "zeroGradientPointPatchField.H" #endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Runtime selection macros - -#define addToPointPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField) \ - addToRunTimeSelectionTable \ - ( \ - PatchTypeField, \ - typePatchTypeField, \ - patch \ - ); \ - addToRunTimeSelectionTable \ - ( \ - PatchTypeField, \ - typePatchTypeField, \ - patchMapper \ - ); \ - addToRunTimeSelectionTable \ - ( \ - PatchTypeField, \ - typePatchTypeField, \ - dictionary \ - ); - - -// for non-templated patch fields -#define makePointPatchTypeField(PatchTypeField,typePatchTypeField) \ - defineTypeNameAndDebug(typePatchTypeField, 0); \ - addToPointPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField) - - -// for templated patch fields -#define makeTemplatePointPatchTypeField(PatchTypeField, typePatchTypeField) \ - defineNamedTemplateTypeNameAndDebug(typePatchTypeField, 0); \ - addToPointPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField) - - -#define makePointPatchFields(type) \ - makeTemplatePointPatchTypeField \ - ( \ - pointPatchScalarField, \ - type##PointPatchScalarField \ - ); \ - makeTemplatePointPatchTypeField \ - ( \ - pointPatchVectorField, \ - type##PointPatchVectorField \ - ); \ - makeTemplatePointPatchTypeField \ - ( \ - pointPatchSphericalTensorField, \ - type##PointPatchSphericalTensorField \ - ); \ - makeTemplatePointPatchTypeField \ - ( \ - pointPatchSymmTensorField, \ - type##PointPatchSymmTensorField \ - ); \ - makeTemplatePointPatchTypeField \ - ( \ - pointPatchTensorField, \ - type##PointPatchTensorField \ - ); - - -#define makePointPatchFieldsTypeName(type) \ - defineNamedTemplateTypeNameAndDebug(type##PointPatchScalarField, 0); \ - defineNamedTemplateTypeNameAndDebug(type##PointPatchVectorField, 0); \ - defineNamedTemplateTypeNameAndDebug \ - ( \ - type##PointPatchSphericalTensorField, 0 \ - ); \ - defineNamedTemplateTypeNameAndDebug(type##PointPatchSymmTensorField, 0); \ - defineNamedTemplateTypeNameAndDebug(type##PointPatchTensorField, 0) - - -#define makePointPatchFieldTypedefs(type) \ - typedef type##PointPatchField type##PointPatchScalarField; \ - typedef type##PointPatchField type##PointPatchVectorField; \ - typedef type##PointPatchField \ - type##PointPatchSphericalTensorField; \ - typedef type##PointPatchField type##PointPatchSymmTensorField;\ - typedef type##PointPatchField type##PointPatchTensorField; - +#include "pointPatchFieldMacros.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchFieldMacros.H b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchFieldMacros.H new file mode 100644 index 0000000000..640662c4a9 --- /dev/null +++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchFieldMacros.H @@ -0,0 +1,143 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2011 OpenFOAM Foundation + Copyright (C) 2023 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Description + Macros for creating pointPatchField types. + +\*---------------------------------------------------------------------------*/ + +#ifndef Foam_pointPatchFieldMacros_H +#define Foam_pointPatchFieldMacros_H + +#include "fieldTypes.H" +#include "pointPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Runtime selection macros + +#define addToPointPatchFieldRunTimeSelection\ +(PatchTypeField, typePatchTypeField)\ + addToRunTimeSelectionTable \ + ( \ + PatchTypeField, \ + typePatchTypeField, \ + patch \ + ); \ + addToRunTimeSelectionTable \ + ( \ + PatchTypeField, \ + typePatchTypeField, \ + patchMapper \ + ); \ + addToRunTimeSelectionTable \ + ( \ + PatchTypeField, \ + typePatchTypeField, \ + dictionary \ + ); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// For non-templated (or typedef) patch fields. +//- Define a concrete pointPatchField type and add to run-time tables +//- Example, (pointPatchScalarField, calculatedPointPatchScalarField) +#define makePointPatchTypeField(PatchTypeField, typePatchTypeField) \ + \ + defineTypeNameAndDebug(typePatchTypeField, 0); \ + addToPointPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField); + +//- Define a pointPatchField type for a specific field type +//- Example, (scalar, calculated) +#define makePointPatchFieldTypeName(fieldType, bcType) \ + defineNamedTemplateTypeNameAndDebug \ + ( \ + CAT4(bcType, PointPatch, CAPITALIZE(fieldType), Field), \ + 0 \ + ); + +//- Add runTime selection for pointPatchField type of a specific field type +//- Example, (scalar, calculated) +#define addPointPatchFieldTypeRunTime(fieldType, bcType) \ + addToPointPatchFieldRunTimeSelection \ + ( \ + CAT3(pointPatch, CAPITALIZE(fieldType), Field), \ + CAT4(bcType, PointPatch, CAPITALIZE(fieldType), Field) \ + ); + +// For templated patch fields +#define makePointPatchFieldType(fieldType, bcType) \ + makePointPatchFieldTypeName(fieldType, bcType) \ + addPointPatchFieldTypeRunTime(fieldType, bcType) + +//- Declare a typedef for a pointPatchField. +//- Example, (scalar, calculated) +#define makePointPatchFieldTypedef(fieldType, bcType) \ + typedef \ + bcType##PointPatchField \ + CAT4(bcType, PointPatch, CAPITALIZE(fieldType), Field); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +//- For all standard field types: +//- define a pointPatchField type and add to run-time tables +#define makePointPatchFields(bcType) \ + \ + makePointPatchFieldType(scalar, bcType); \ + makePointPatchFieldType(vector, bcType); \ + makePointPatchFieldType(sphericalTensor, bcType); \ + makePointPatchFieldType(symmTensor, bcType); \ + makePointPatchFieldType(tensor, bcType); + + +//- For all standard field types: define a pointPatchField type +//- Example, (calculated) +#define makePointPatchFieldsTypeName(bcType) \ + \ + makePointPatchFieldTypeName(scalar, bcType); \ + makePointPatchFieldTypeName(vector, bcType); \ + makePointPatchFieldTypeName(sphericalTensor, bcType); \ + makePointPatchFieldTypeName(symmTensor, bcType); \ + makePointPatchFieldTypeName(tensor, bcType); + + +//- For all standard field types: define typedefs for the pointPatchField +//- Example, (calculated) +#define makePointPatchFieldTypedefs(bcType) \ + \ + makePointPatchFieldTypedef(scalar, bcType); \ + makePointPatchFieldTypedef(vector, bcType); \ + makePointPatchFieldTypedef(sphericalTensor, bcType); \ + makePointPatchFieldTypedef(symmTensor, bcType); \ + makePointPatchFieldTypedef(tensor, bcType); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchFields.C b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchFields.C index 7a9d947842..b9b962e175 100644 --- a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchFields.C +++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchFields.C @@ -27,27 +27,21 @@ License #include "pointPatchFields.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +#define makePointPatchField(PatchTypeField) \ + defineTemplateRunTimeSelectionTable(PatchTypeField, patch); \ + defineTemplateRunTimeSelectionTable(PatchTypeField, patchMapper); \ + defineTemplateRunTimeSelectionTable(PatchTypeField, dictionary); -#define makePointPatchField(pointPatchTypeField) \ - \ -defineTemplateRunTimeSelectionTable(pointPatchTypeField, patch); \ -defineTemplateRunTimeSelectionTable(pointPatchTypeField, patchMapper); \ -defineTemplateRunTimeSelectionTable(pointPatchTypeField, dictionary); - -makePointPatchField(pointPatchScalarField) -makePointPatchField(pointPatchVectorField) -makePointPatchField(pointPatchSphericalTensorField) -makePointPatchField(pointPatchSymmTensorField) -makePointPatchField(pointPatchTensorField) - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +makePointPatchField(pointPatchScalarField); +makePointPatchField(pointPatchVectorField); +makePointPatchField(pointPatchSphericalTensorField); +makePointPatchField(pointPatchSymmTensorField); +makePointPatchField(pointPatchTensorField); } // End namespace Foam diff --git a/src/finiteArea/fields/faPatchFields/basic/basicSymmetry/basicSymmetryFaPatchFields.H b/src/finiteArea/fields/faPatchFields/basic/basicSymmetry/basicSymmetryFaPatchFields.H index 5ed1455267..fd22338394 100644 --- a/src/finiteArea/fields/faPatchFields/basic/basicSymmetry/basicSymmetryFaPatchFields.H +++ b/src/finiteArea/fields/faPatchFields/basic/basicSymmetry/basicSymmetryFaPatchFields.H @@ -25,11 +25,10 @@ License \*---------------------------------------------------------------------------*/ -#ifndef basicSymmetryFaPatchFields_H -#define basicSymmetryFaPatchFields_H +#ifndef Foam_basicSymmetryFaPatchFields_H +#define Foam_basicSymmetryFaPatchFields_H #include "basicSymmetryFaPatchField.H" -#include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -38,7 +37,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeFaPatchTypeFieldTypedefs(basicSymmetry) +makeFaPatchTypeFieldTypedefs(basicSymmetry); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faPatchFields/basic/calculated/calculatedFaPatchFields.H b/src/finiteArea/fields/faPatchFields/basic/calculated/calculatedFaPatchFields.H index 0c8ee738f9..2a3f522e09 100644 --- a/src/finiteArea/fields/faPatchFields/basic/calculated/calculatedFaPatchFields.H +++ b/src/finiteArea/fields/faPatchFields/basic/calculated/calculatedFaPatchFields.H @@ -23,22 +23,12 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Class - Foam::calculatedFaPatchFields - -Description - -SourceFiles - calculatedFaPatchFields.C - - \*---------------------------------------------------------------------------*/ -#ifndef calculatedFaPatchFields_H -#define calculatedFaPatchFields_H +#ifndef Foam_calculatedFaPatchFields_H +#define Foam_calculatedFaPatchFields_H #include "calculatedFaPatchField.H" -#include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -47,7 +37,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeFaPatchTypeFieldTypedefs(calculated) +makeFaPatchTypeFieldTypedefs(calculated); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faPatchFields/basic/coupled/coupledFaPatchFields.H b/src/finiteArea/fields/faPatchFields/basic/coupled/coupledFaPatchFields.H index eefbc84a2b..84d92206c2 100644 --- a/src/finiteArea/fields/faPatchFields/basic/coupled/coupledFaPatchFields.H +++ b/src/finiteArea/fields/faPatchFields/basic/coupled/coupledFaPatchFields.H @@ -25,11 +25,10 @@ License \*---------------------------------------------------------------------------*/ -#ifndef coupledFaPatchFields_H -#define coupledFaPatchFields_H +#ifndef Foam_coupledFaPatchFields_H +#define Foam_coupledFaPatchFields_H #include "coupledFaPatchField.H" -#include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -38,7 +37,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeFaPatchTypeFieldTypedefs(coupled) +makeFaPatchTypeFieldTypedefs(coupled); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faPatchFields/basic/fixedGradient/fixedGradientFaPatchFields.H b/src/finiteArea/fields/faPatchFields/basic/fixedGradient/fixedGradientFaPatchFields.H index 0fabeb87da..b2509d2c56 100644 --- a/src/finiteArea/fields/faPatchFields/basic/fixedGradient/fixedGradientFaPatchFields.H +++ b/src/finiteArea/fields/faPatchFields/basic/fixedGradient/fixedGradientFaPatchFields.H @@ -23,22 +23,12 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Class - Foam::fixedGradientFaPatchFields - -Description - -SourceFiles - fixedGradientFaPatchFields.C - - \*---------------------------------------------------------------------------*/ -#ifndef fixedGradientFaPatchFields_H -#define fixedGradientFaPatchFields_H +#ifndef Foam_fixedGradientFaPatchFields_H +#define Foam_fixedGradientFaPatchFields_H #include "fixedGradientFaPatchField.H" -#include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -47,7 +37,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeFaPatchTypeFieldTypedefs(fixedGradient) +makeFaPatchTypeFieldTypedefs(fixedGradient); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faPatchFields/basic/fixedValue/fixedValueFaPatchFields.H b/src/finiteArea/fields/faPatchFields/basic/fixedValue/fixedValueFaPatchFields.H index fc3774111d..1ba6cd94cd 100644 --- a/src/finiteArea/fields/faPatchFields/basic/fixedValue/fixedValueFaPatchFields.H +++ b/src/finiteArea/fields/faPatchFields/basic/fixedValue/fixedValueFaPatchFields.H @@ -25,11 +25,10 @@ License \*---------------------------------------------------------------------------*/ -#ifndef fixedValueFaPatchFields_H -#define fixedValueFaPatchFields_H +#ifndef Foam_fixedValueFaPatchFields_H +#define Foam_fixedValueFaPatchFields_H #include "fixedValueFaPatchField.H" -#include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -38,7 +37,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeFaPatchTypeFieldTypedefs(fixedValue) +makeFaPatchTypeFieldTypedefs(fixedValue); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faPatchFields/basic/mixed/mixedFaPatchFields.H b/src/finiteArea/fields/faPatchFields/basic/mixed/mixedFaPatchFields.H index f40d7d529f..8e227b5214 100644 --- a/src/finiteArea/fields/faPatchFields/basic/mixed/mixedFaPatchFields.H +++ b/src/finiteArea/fields/faPatchFields/basic/mixed/mixedFaPatchFields.H @@ -25,11 +25,10 @@ License \*---------------------------------------------------------------------------*/ -#ifndef mixedFaPatchFields_H -#define mixedFaPatchFields_H +#ifndef Foam_mixedFaPatchFields_H +#define Foam_mixedFaPatchFields_H #include "mixedFaPatchField.H" -#include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -38,7 +37,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeFaPatchTypeFieldTypedefs(mixed) +makeFaPatchTypeFieldTypedefs(mixed); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faPatchFields/basic/transform/transformFaPatchFields.H b/src/finiteArea/fields/faPatchFields/basic/transform/transformFaPatchFields.H index 3e14b9bb75..1321fc17a8 100644 --- a/src/finiteArea/fields/faPatchFields/basic/transform/transformFaPatchFields.H +++ b/src/finiteArea/fields/faPatchFields/basic/transform/transformFaPatchFields.H @@ -23,21 +23,12 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Class - Foam::transformFaPatchFields - -Description - -SourceFiles - transformFaPatchFields.C - \*---------------------------------------------------------------------------*/ -#ifndef transformFaPatchFields_H -#define transformFaPatchFields_H +#ifndef Foam_transformFaPatchFields_H +#define Foam_transformFaPatchFields_H #include "transformFaPatchField.H" -#include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -46,7 +37,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeFaPatchTypeFieldTypedefs(transform) +makeFaPatchTypeFieldTypedefs(transform); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faPatchFields/basic/zeroGradient/zeroGradientFaPatchFields.H b/src/finiteArea/fields/faPatchFields/basic/zeroGradient/zeroGradientFaPatchFields.H index 65f04da9d9..721dbe70c3 100644 --- a/src/finiteArea/fields/faPatchFields/basic/zeroGradient/zeroGradientFaPatchFields.H +++ b/src/finiteArea/fields/faPatchFields/basic/zeroGradient/zeroGradientFaPatchFields.H @@ -23,19 +23,12 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Description - -SourceFiles - zeroGradientFaPatchFields.C - - \*---------------------------------------------------------------------------*/ -#ifndef zeroGradientFaPatchFields_H -#define zeroGradientFaPatchFields_H +#ifndef Foam_zeroGradientFaPatchFields_H +#define Foam_zeroGradientFaPatchFields_H #include "zeroGradientFaPatchField.H" -#include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -44,7 +37,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeFaPatchTypeFieldTypedefs(zeroGradient) +makeFaPatchTypeFieldTypedefs(zeroGradient); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faPatchFields/constraint/cyclic/cyclicFaPatchFields.H b/src/finiteArea/fields/faPatchFields/constraint/cyclic/cyclicFaPatchFields.H index 939e93115d..a2576a86bb 100644 --- a/src/finiteArea/fields/faPatchFields/constraint/cyclic/cyclicFaPatchFields.H +++ b/src/finiteArea/fields/faPatchFields/constraint/cyclic/cyclicFaPatchFields.H @@ -25,11 +25,10 @@ License \*---------------------------------------------------------------------------*/ -#ifndef cyclicFaPatchFields_H -#define cyclicFaPatchFields_H +#ifndef Foam_cyclicFaPatchFields_H +#define Foam_cyclicFaPatchFields_H #include "cyclicFaPatchField.H" -#include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -38,7 +37,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeFaPatchTypeFieldTypedefs(cyclic) +makeFaPatchTypeFieldTypedefs(cyclic); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faPatchFields/constraint/empty/emptyFaPatchFields.H b/src/finiteArea/fields/faPatchFields/constraint/empty/emptyFaPatchFields.H index 7f9cc4f55b..b3a2340296 100644 --- a/src/finiteArea/fields/faPatchFields/constraint/empty/emptyFaPatchFields.H +++ b/src/finiteArea/fields/faPatchFields/constraint/empty/emptyFaPatchFields.H @@ -23,18 +23,12 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Description - -SourceFiles - emptyFaPatchFields.C - \*---------------------------------------------------------------------------*/ -#ifndef emptyFaPatchFields_H -#define emptyFaPatchFields_H +#ifndef Foam_emptyFaPatchFields_H +#define Foam_emptyFaPatchFields_H #include "emptyFaPatchField.H" -#include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -43,7 +37,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeFaPatchTypeFieldTypedefs(empty) +makeFaPatchTypeFieldTypedefs(empty); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchFields.H b/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchFields.H index 7b3fe7ca53..74a8cd2b30 100644 --- a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchFields.H +++ b/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchFields.H @@ -29,7 +29,6 @@ License #define Foam_processorFaPatchFields_H #include "processorFaPatchField.H" -#include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -38,7 +37,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeFaPatchTypeFieldTypedefs(processor) +makeFaPatchTypeFieldTypedefs(processor); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faPatchFields/constraint/symmetry/symmetryFaPatchFields.H b/src/finiteArea/fields/faPatchFields/constraint/symmetry/symmetryFaPatchFields.H index 5431ce100e..d414ed219e 100644 --- a/src/finiteArea/fields/faPatchFields/constraint/symmetry/symmetryFaPatchFields.H +++ b/src/finiteArea/fields/faPatchFields/constraint/symmetry/symmetryFaPatchFields.H @@ -25,11 +25,10 @@ License \*---------------------------------------------------------------------------*/ -#ifndef symmetryFaPatchFields_H -#define symmetryFaPatchFields_H +#ifndef Foam_symmetryFaPatchFields_H +#define Foam_symmetryFaPatchFields_H #include "symmetryFaPatchField.H" -#include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -38,7 +37,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeFaPatchTypeFieldTypedefs(symmetry) +makeFaPatchTypeFieldTypedefs(symmetry); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faPatchFields/constraint/wedge/wedgeFaPatchFields.H b/src/finiteArea/fields/faPatchFields/constraint/wedge/wedgeFaPatchFields.H index f27c1b909f..7b71d0f059 100644 --- a/src/finiteArea/fields/faPatchFields/constraint/wedge/wedgeFaPatchFields.H +++ b/src/finiteArea/fields/faPatchFields/constraint/wedge/wedgeFaPatchFields.H @@ -25,11 +25,10 @@ License \*---------------------------------------------------------------------------*/ -#ifndef wedgeFaPatchFields_H -#define wedgeFaPatchFields_H +#ifndef Foam_wedgeFaPatchFields_H +#define Foam_wedgeFaPatchFields_H #include "wedgeFaPatchField.H" -#include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -38,7 +37,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeFaPatchTypeFieldTypedefs(wedge) +makeFaPatchTypeFieldTypedefs(wedge); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faPatchFields/derived/clampedPlate/clampedPlateFaPatchFields.H b/src/finiteArea/fields/faPatchFields/derived/clampedPlate/clampedPlateFaPatchFields.H index 4a3a054907..4d67a2beb1 100644 --- a/src/finiteArea/fields/faPatchFields/derived/clampedPlate/clampedPlateFaPatchFields.H +++ b/src/finiteArea/fields/faPatchFields/derived/clampedPlate/clampedPlateFaPatchFields.H @@ -25,11 +25,10 @@ License \*---------------------------------------------------------------------------*/ -#ifndef clampedPlateFaPatchFields_H -#define clampedPlateFaPatchFields_H +#ifndef Foam_clampedPlateFaPatchFields_H +#define Foam_clampedPlateFaPatchFields_H #include "clampedPlateFaPatchField.H" -#include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -38,7 +37,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeFaPatchTypeFieldTypedefs(clampedPlate) +makeFaPatchTypeFieldTypedefs(clampedPlate); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faPatchFields/derived/fixedValueOutflow/fixedValueOutflowFaPatchFields.H b/src/finiteArea/fields/faPatchFields/derived/fixedValueOutflow/fixedValueOutflowFaPatchFields.H index edef365227..ad2bb79108 100644 --- a/src/finiteArea/fields/faPatchFields/derived/fixedValueOutflow/fixedValueOutflowFaPatchFields.H +++ b/src/finiteArea/fields/faPatchFields/derived/fixedValueOutflow/fixedValueOutflowFaPatchFields.H @@ -25,11 +25,10 @@ License \*---------------------------------------------------------------------------*/ -#ifndef fixedValueOutflowFaPatchFields_H -#define fixedValueOutflowFaPatchFields_H +#ifndef Foam_fixedValueOutflowFaPatchFields_H +#define Foam_fixedValueOutflowFaPatchFields_H #include "fixedValueOutflowFaPatchField.H" -#include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -38,7 +37,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeFaPatchTypeFieldTypedefs(fixedValueOutflow) +makeFaPatchTypeFieldTypedefs(fixedValueOutflow); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faPatchFields/derived/inletOutlet/inletOutletFaPatchFields.H b/src/finiteArea/fields/faPatchFields/derived/inletOutlet/inletOutletFaPatchFields.H index 5d37298787..ae61e29d17 100644 --- a/src/finiteArea/fields/faPatchFields/derived/inletOutlet/inletOutletFaPatchFields.H +++ b/src/finiteArea/fields/faPatchFields/derived/inletOutlet/inletOutletFaPatchFields.H @@ -25,11 +25,10 @@ License \*---------------------------------------------------------------------------*/ -#ifndef inletOutletFaPatchFields_H -#define inletOutletFaPatchFields_H +#ifndef Foam_inletOutletFaPatchFields_H +#define Foam_inletOutletFaPatchFields_H #include "inletOutletFaPatchField.H" -#include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -38,7 +37,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeFaPatchTypeFieldTypedefs(inletOutlet) +makeFaPatchTypeFieldTypedefs(inletOutlet); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faPatchFields/derived/slip/slipFaPatchFields.H b/src/finiteArea/fields/faPatchFields/derived/slip/slipFaPatchFields.H index 33069264d3..a1d4140ad1 100644 --- a/src/finiteArea/fields/faPatchFields/derived/slip/slipFaPatchFields.H +++ b/src/finiteArea/fields/faPatchFields/derived/slip/slipFaPatchFields.H @@ -25,11 +25,10 @@ License \*---------------------------------------------------------------------------*/ -#ifndef slipFaPatchFields_H -#define slipFaPatchFields_H +#ifndef Foam_slipFaPatchFields_H +#define Foam_slipFaPatchFields_H #include "slipFaPatchField.H" -#include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -38,7 +37,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeFaPatchTypeFieldTypedefs(slip) +makeFaPatchTypeFieldTypedefs(slip); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFields.H b/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFields.H index 46bfc57c73..d99c594ba6 100644 --- a/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFields.H +++ b/src/finiteArea/fields/faPatchFields/derived/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFields.H @@ -26,11 +26,10 @@ License \*---------------------------------------------------------------------------*/ -#ifndef timeVaryingUniformFixedValueFaPatchFields_H -#define timeVaryingUniformFixedValueFaPatchFields_H +#ifndef Foam_timeVaryingUniformFixedValueFaPatchFields_H +#define Foam_timeVaryingUniformFixedValueFaPatchFields_H #include "timeVaryingUniformFixedValueFaPatchField.H" -#include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -39,7 +38,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeFaPatchTypeFieldTypedefs(timeVaryingUniformFixedValue) +makeFaPatchTypeFieldTypedefs(timeVaryingUniformFixedValue); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faPatchFields/faPatchField/faPatchField.H b/src/finiteArea/fields/faPatchFields/faPatchField/faPatchField.H index fd8196ddfb..7025ed2b63 100644 --- a/src/finiteArea/fields/faPatchFields/faPatchField/faPatchField.H +++ b/src/finiteArea/fields/faPatchFields/faPatchField/faPatchField.H @@ -52,6 +52,7 @@ SourceFiles #include "faPatch.H" #include "DimensionedField.H" #include "fieldTypes.H" +#include "scalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -66,6 +67,7 @@ class areaMesh; template class faPatchField; template class calculatedFaPatchField; +template class zeroGradientFaPatchField; template Ostream& operator<<(Ostream&, const faPatchField&); @@ -383,10 +385,10 @@ public: //- Return a pointer to a new calculatedFaPatchField created on //- freestore without setting patchField values - template + template static tmp> NewCalculatedType ( - const faPatchField& + const faPatchField& pf ); @@ -589,93 +591,8 @@ public: #include "zeroGradientFaPatchField.H" #endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Runtime selection macros - -#define addToFaPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField) \ - \ -addToRunTimeSelectionTable \ -( \ - PatchTypeField, typePatchTypeField, patch \ -); \ - \ -addToRunTimeSelectionTable \ -( \ - PatchTypeField, \ - typePatchTypeField, \ - patchMapper \ -); \ - \ -addToRunTimeSelectionTable \ -( \ - PatchTypeField, typePatchTypeField, dictionary \ -); - - -#define makeFaPatchTypeFieldTypeName(typePatchTypeField) \ - \ -defineNamedTemplateTypeNameAndDebug(typePatchTypeField, 0); - - -#define makeFaPatchFieldsTypeName(typePatchField) \ - \ -makeFaPatchTypeFieldTypeName(typePatchField##FaPatchScalarField); \ -makeFaPatchTypeFieldTypeName(typePatchField##FaPatchVectorField); \ -makeFaPatchTypeFieldTypeName(typePatchField##FaPatchSphericalTensorField); \ -makeFaPatchTypeFieldTypeName(typePatchField##FaPatchSymmTensorField); \ -makeFaPatchTypeFieldTypeName(typePatchField##FaPatchTensorField); - - -#define makeFaPatchTypeField(PatchTypeField, typePatchTypeField) \ - \ -defineTypeNameAndDebug(typePatchTypeField, 0); \ - \ -addToFaPatchFieldRunTimeSelection \ -( \ - PatchTypeField, typePatchTypeField \ -); - -#define makeTemplateFaPatchTypeField(PatchTypeField, typePatchTypeField) \ - \ -defineNamedTemplateTypeNameAndDebug(typePatchTypeField, 0); \ - \ -addToFaPatchFieldRunTimeSelection \ -( \ - PatchTypeField, typePatchTypeField \ -); - - -#define makeFaPatchFields(type) \ - \ -makeTemplateFaPatchTypeField(faPatchScalarField, type##FaPatchScalarField); \ -makeTemplateFaPatchTypeField(faPatchVectorField, type##FaPatchVectorField); \ -makeTemplateFaPatchTypeField \ -( \ - faPatchSphericalTensorField, \ - type##FaPatchSphericalTensorField \ -); \ -makeTemplateFaPatchTypeField \ -( \ - faPatchSymmTensorField, \ - type##FaPatchSymmTensorField \ -); \ -makeTemplateFaPatchTypeField \ -( \ - faPatchTensorField, \ - type##FaPatchTensorField \ -); - - -#define makeFaPatchTypeFieldTypedefs(type) \ - \ -typedef type##FaPatchField type##FaPatchScalarField; \ -typedef type##FaPatchField type##FaPatchVectorField; \ -typedef type##FaPatchField \ - type##FaPatchSphericalTensorField; \ -typedef type##FaPatchField type##FaPatchSymmTensorField; \ -typedef type##FaPatchField type##FaPatchTensorField; - +#include "faPatchFieldMacros.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faPatchFields/faPatchField/faPatchFieldMacros.H b/src/finiteArea/fields/faPatchFields/faPatchField/faPatchFieldMacros.H new file mode 100644 index 0000000000..bc98115100 --- /dev/null +++ b/src/finiteArea/fields/faPatchFields/faPatchField/faPatchFieldMacros.H @@ -0,0 +1,142 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2016 Wikki Ltd + Copyright (C) 2023 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Description + Macros for creating faPatchField types. + +\*---------------------------------------------------------------------------*/ + +#ifndef Foam_faPatchFieldMacros_H +#define Foam_faPatchFieldMacros_H + +#include "fieldTypes.H" +#include "faPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Runtime selection macros + +#define addToFaPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField) \ + \ + addToRunTimeSelectionTable \ + ( \ + PatchTypeField, \ + typePatchTypeField, \ + patch \ + ); \ + addToRunTimeSelectionTable \ + ( \ + PatchTypeField, \ + typePatchTypeField, \ + patchMapper \ + ); \ + addToRunTimeSelectionTable \ + ( \ + PatchTypeField, \ + typePatchTypeField, \ + dictionary \ + ); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// For non-templated (or typedef) patch fields. +//- Define a concrete faPatchField type and add to run-time tables +//- Example, (faPatchScalarField, calculatedFaPatchScalarField) +#define makeFaPatchTypeField(PatchTypeField, typePatchTypeField) \ + \ + defineTypeNameAndDebug(typePatchTypeField, 0); \ + addToFaPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField); + +//- Define a faPatchField type for a specific field type +//- Example, (scalar, calculated) +#define makeFaPatchFieldTypeName(fieldType, bcType) \ + defineNamedTemplateTypeNameAndDebug \ + ( \ + CAT4(bcType, FaPatch, CAPITALIZE(fieldType), Field), \ + 0 \ + ); + +//- Add runTime selection for faPatchField type of a specific field type +//- Example, (scalar, calculated) +#define addFaPatchFieldTypeRunTime(fieldType, bcType) \ + addToFaPatchFieldRunTimeSelection \ + ( \ + CAT3(faPatch, CAPITALIZE(fieldType), Field), \ + CAT4(bcType, FaPatch, CAPITALIZE(fieldType), Field) \ + ); + +// For templated patch fields +#define makeFaPatchFieldType(fieldType, bcType) \ + makeFaPatchFieldTypeName(fieldType, bcType) \ + addFaPatchFieldTypeRunTime(fieldType, bcType) \ + +//- Declare a typedef for a faPatchField. Example, (scalar, calculated) +#define makeFaPatchFieldTypedef(fieldType, bcType) \ + typedef \ + bcType##FaPatchField \ + CAT4(bcType, FaPatch, CAPITALIZE(fieldType), Field); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +//- For all standard field types: +//- define a faPatchField type and add to run-time tables +#define makeFaPatchFields(bcType) \ + \ + makeFaPatchFieldType(scalar, bcType); \ + makeFaPatchFieldType(vector, bcType); \ + makeFaPatchFieldType(sphericalTensor, bcType); \ + makeFaPatchFieldType(symmTensor, bcType); \ + makeFaPatchFieldType(tensor, bcType); + + +//- For all standard field types: define a faPatchField type. +//- Example, (calculated) +#define makeFaPatchFieldsTypeName(bcType) \ + \ + makeFaPatchFieldTypeName(scalar, bcType); \ + makeFaPatchFieldTypeName(vector, bcType); \ + makeFaPatchFieldTypeName(sphericalTensor, bcType); \ + makeFaPatchFieldTypeName(symmTensor, bcType); \ + makeFaPatchFieldTypeName(tensor, bcType); + + +//- For all standard field types: define typedefs for the faPatchField. +//- Example, (calculated) +#define makeFaPatchTypeFieldTypedefs(bcType) \ + \ + makeFaPatchFieldTypedef(scalar, bcType); \ + makeFaPatchFieldTypedef(vector, bcType); \ + makeFaPatchFieldTypedef(sphericalTensor, bcType); \ + makeFaPatchFieldTypedef(symmTensor, bcType); \ + makeFaPatchFieldTypedef(tensor, bcType); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteArea/fields/faPatchFields/faPatchField/faPatchFields.C b/src/finiteArea/fields/faPatchFields/faPatchField/faPatchFields.C index 1cfadb9c9c..1cff858480 100644 --- a/src/finiteArea/fields/faPatchFields/faPatchField/faPatchFields.C +++ b/src/finiteArea/fields/faPatchFields/faPatchField/faPatchFields.C @@ -28,26 +28,21 @@ License #include "faPatchFields.H" #include "areaFaMesh.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +#define makeFaPatchField(PatchTypeField) \ + defineTemplateRunTimeSelectionTable(PatchTypeField, patch); \ + defineTemplateRunTimeSelectionTable(PatchTypeField, patchMapper); \ + defineTemplateRunTimeSelectionTable(PatchTypeField, dictionary); -#define makeFaPatchField(faPatchTypeField) \ - \ -defineTemplateRunTimeSelectionTable(faPatchTypeField, patch); \ -defineTemplateRunTimeSelectionTable(faPatchTypeField, patchMapper); \ -defineTemplateRunTimeSelectionTable(faPatchTypeField, dictionary); - -makeFaPatchField(faPatchScalarField) -makeFaPatchField(faPatchVectorField) -makeFaPatchField(faPatchSphericalTensorField) -makeFaPatchField(faPatchSymmTensorField) -makeFaPatchField(faPatchTensorField) - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +makeFaPatchField(faPatchScalarField); +makeFaPatchField(faPatchVectorField); +makeFaPatchField(faPatchSphericalTensorField); +makeFaPatchField(faPatchSymmTensorField); +makeFaPatchField(faPatchTensorField); } // End namespace Foam diff --git a/src/finiteArea/fields/faPatchFields/faPatchField/faPatchFields.H b/src/finiteArea/fields/faPatchFields/faPatchField/faPatchFields.H index 21acf6ab74..cd11bfd3d3 100644 --- a/src/finiteArea/fields/faPatchFields/faPatchField/faPatchFields.H +++ b/src/finiteArea/fields/faPatchFields/faPatchField/faPatchFields.H @@ -23,6 +23,9 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . +Description + Declarations for faPatchField types + \*---------------------------------------------------------------------------*/ #ifndef Foam_faPatchFields_H @@ -31,8 +34,6 @@ License #include "faPatchField.H" #include "faPatchFieldsFwd.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - #endif // ************************************************************************* // diff --git a/src/finiteArea/fields/faPatchFields/faPatchField/faPatchFieldsFwd.H b/src/finiteArea/fields/faPatchFields/faPatchField/faPatchFieldsFwd.H index 9f04cd897f..67584bb3cb 100644 --- a/src/finiteArea/fields/faPatchFields/faPatchField/faPatchFieldsFwd.H +++ b/src/finiteArea/fields/faPatchFields/faPatchField/faPatchFieldsFwd.H @@ -23,10 +23,13 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . +Description + Forward declarations for faPatchField types + \*---------------------------------------------------------------------------*/ -#ifndef faPatchFieldsFwd_H -#define faPatchFieldsFwd_H +#ifndef Foam_faPatchFieldsFwd_H +#define Foam_faPatchFieldsFwd_H #include "fieldTypes.H" diff --git a/src/finiteArea/fields/faePatchFields/basic/calculated/calculatedFaePatchFields.H b/src/finiteArea/fields/faePatchFields/basic/calculated/calculatedFaePatchFields.H index b435e788eb..9553681d3f 100644 --- a/src/finiteArea/fields/faePatchFields/basic/calculated/calculatedFaePatchFields.H +++ b/src/finiteArea/fields/faePatchFields/basic/calculated/calculatedFaePatchFields.H @@ -25,11 +25,10 @@ License \*---------------------------------------------------------------------------*/ -#ifndef calculatedFaePatchFields_H -#define calculatedFaePatchFields_H +#ifndef Foam_calculatedFaePatchFields_H +#define Foam_calculatedFaePatchFields_H #include "calculatedFaePatchField.H" -#include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -38,7 +37,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeFaePatchTypeFieldTypedefs(calculated) +makeFaePatchTypeFieldTypedefs(calculated); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faePatchFields/basic/coupled/coupledFaePatchFields.C b/src/finiteArea/fields/faePatchFields/basic/coupled/coupledFaePatchFields.C index d6b95a6026..336c5e3910 100644 --- a/src/finiteArea/fields/faePatchFields/basic/coupled/coupledFaePatchFields.C +++ b/src/finiteArea/fields/faePatchFields/basic/coupled/coupledFaePatchFields.C @@ -29,17 +29,13 @@ License #include "coupledFaePatchFields.H" #include "addToRunTimeSelectionTable.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - makeFaePatchFieldsTypeName(coupled); -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - } // End namespace Foam // ************************************************************************* // diff --git a/src/finiteArea/fields/faePatchFields/basic/coupled/coupledFaePatchFields.H b/src/finiteArea/fields/faePatchFields/basic/coupled/coupledFaePatchFields.H index 39ee68269e..cced89e837 100644 --- a/src/finiteArea/fields/faePatchFields/basic/coupled/coupledFaePatchFields.H +++ b/src/finiteArea/fields/faePatchFields/basic/coupled/coupledFaePatchFields.H @@ -25,11 +25,10 @@ License \*---------------------------------------------------------------------------*/ -#ifndef coupledFaePatchFields_H -#define coupledFaePatchFields_H +#ifndef Foam_coupledFaePatchFields_H +#define Foam_coupledFaePatchFields_H #include "coupledFaePatchField.H" -#include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -38,7 +37,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeFaePatchTypeFieldTypedefs(coupled) +makeFaePatchTypeFieldTypedefs(coupled); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faePatchFields/basic/fixedValue/fixedValueFaePatchFields.H b/src/finiteArea/fields/faePatchFields/basic/fixedValue/fixedValueFaePatchFields.H index 5fa29c54ca..030b4c17b7 100644 --- a/src/finiteArea/fields/faePatchFields/basic/fixedValue/fixedValueFaePatchFields.H +++ b/src/finiteArea/fields/faePatchFields/basic/fixedValue/fixedValueFaePatchFields.H @@ -25,11 +25,10 @@ License \*---------------------------------------------------------------------------*/ -#ifndef fixedValueFaePatchFields_H -#define fixedValueFaePatchFields_H +#ifndef Foam_fixedValueFaePatchFields_H +#define Foam_fixedValueFaePatchFields_H #include "fixedValueFaePatchField.H" -#include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -38,7 +37,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeFaePatchTypeFieldTypedefs(fixedValue) +makeFaePatchTypeFieldTypedefs(fixedValue); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faePatchFields/constraint/cyclic/cyclicFaePatchFields.H b/src/finiteArea/fields/faePatchFields/constraint/cyclic/cyclicFaePatchFields.H index 50760a14fc..04e6582054 100644 --- a/src/finiteArea/fields/faePatchFields/constraint/cyclic/cyclicFaePatchFields.H +++ b/src/finiteArea/fields/faePatchFields/constraint/cyclic/cyclicFaePatchFields.H @@ -25,11 +25,10 @@ License \*---------------------------------------------------------------------------*/ -#ifndef cyclicFaePatchFields_H -#define cyclicFaePatchFields_H +#ifndef Foam_cyclicFaePatchFields_H +#define Foam_cyclicFaePatchFields_H #include "cyclicFaePatchField.H" -#include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -38,7 +37,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeFaePatchTypeFieldTypedefs(cyclic) +makeFaePatchTypeFieldTypedefs(cyclic); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faePatchFields/constraint/empty/emptyFaePatchFields.H b/src/finiteArea/fields/faePatchFields/constraint/empty/emptyFaePatchFields.H index 2577a79440..bba651b777 100644 --- a/src/finiteArea/fields/faePatchFields/constraint/empty/emptyFaePatchFields.H +++ b/src/finiteArea/fields/faePatchFields/constraint/empty/emptyFaePatchFields.H @@ -25,11 +25,10 @@ License \*---------------------------------------------------------------------------*/ -#ifndef emptyFaePatchFields_H -#define emptyFaePatchFields_H +#ifndef Foam_emptyFaePatchFields_H +#define Foam_emptyFaePatchFields_H #include "emptyFaePatchField.H" -#include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -38,7 +37,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeFaePatchTypeFieldTypedefs(empty) +makeFaePatchTypeFieldTypedefs(empty); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faePatchFields/constraint/processor/processorFaePatchFields.H b/src/finiteArea/fields/faePatchFields/constraint/processor/processorFaePatchFields.H index 11f9b08d05..907809c4b5 100644 --- a/src/finiteArea/fields/faePatchFields/constraint/processor/processorFaePatchFields.H +++ b/src/finiteArea/fields/faePatchFields/constraint/processor/processorFaePatchFields.H @@ -25,11 +25,10 @@ License \*---------------------------------------------------------------------------*/ -#ifndef processorFaePatchFields_H -#define processorFaePatchFields_H +#ifndef Foam_processorFaePatchFields_H +#define Foam_processorFaePatchFields_H #include "processorFaePatchField.H" -#include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -38,7 +37,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeFaePatchTypeFieldTypedefs(processor) +makeFaePatchTypeFieldTypedefs(processor); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faePatchFields/constraint/symmetry/symmetryFaePatchFields.H b/src/finiteArea/fields/faePatchFields/constraint/symmetry/symmetryFaePatchFields.H index 9a7fb05cfe..41044c71e8 100644 --- a/src/finiteArea/fields/faePatchFields/constraint/symmetry/symmetryFaePatchFields.H +++ b/src/finiteArea/fields/faePatchFields/constraint/symmetry/symmetryFaePatchFields.H @@ -25,11 +25,10 @@ License \*---------------------------------------------------------------------------*/ -#ifndef symmetryFaePatchFields_H -#define symmetryFaePatchFields_H +#ifndef Foam_symmetryFaePatchFields_H +#define Foam_symmetryFaePatchFields_H #include "symmetryFaePatchField.H" -#include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -38,7 +37,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeFaePatchTypeFieldTypedefs(symmetry) +makeFaePatchTypeFieldTypedefs(symmetry); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faePatchFields/constraint/wedge/wedgeFaePatchFields.H b/src/finiteArea/fields/faePatchFields/constraint/wedge/wedgeFaePatchFields.H index f90c531f70..2fbd4ef28a 100644 --- a/src/finiteArea/fields/faePatchFields/constraint/wedge/wedgeFaePatchFields.H +++ b/src/finiteArea/fields/faePatchFields/constraint/wedge/wedgeFaePatchFields.H @@ -25,11 +25,10 @@ License \*---------------------------------------------------------------------------*/ -#ifndef wedgeFaePatchFields_H -#define wedgeFaePatchFields_H +#ifndef Foam_wedgeFaePatchFields_H +#define Foam_wedgeFaePatchFields_H #include "wedgeFaePatchField.H" -#include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -38,7 +37,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makeFaePatchTypeFieldTypedefs(wedge) +makeFaePatchTypeFieldTypedefs(wedge); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faePatchFields/faePatchField/faePatchField.H b/src/finiteArea/fields/faePatchFields/faePatchField/faePatchField.H index d4b73f5b13..69c355333c 100644 --- a/src/finiteArea/fields/faePatchFields/faePatchField/faePatchField.H +++ b/src/finiteArea/fields/faePatchFields/faePatchField/faePatchField.H @@ -472,67 +472,8 @@ public: #include "calculatedFaePatchField.H" #endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Runtime selection macros - -#define makeFaePatchTypeFieldTypeName(typePatchTypeField) \ - \ -defineNamedTemplateTypeNameAndDebug(typePatchTypeField, 0); - -#define makeFaePatchFieldsTypeName(typePatchField) \ - \ -makeFaePatchTypeFieldTypeName(typePatchField##FaePatchScalarField); \ -makeFaePatchTypeFieldTypeName(typePatchField##FaePatchVectorField); \ -makeFaePatchTypeFieldTypeName(typePatchField##FaePatchSphericalTensorField); \ -makeFaePatchTypeFieldTypeName(typePatchField##FaePatchSymmTensorField); \ -makeFaePatchTypeFieldTypeName(typePatchField##FaePatchTensorField); - - -#define makeFaePatchTypeField(PatchTypeField, typePatchTypeField) \ - \ -defineNamedTemplateTypeNameAndDebug(typePatchTypeField, 0); \ - \ -addToRunTimeSelectionTable \ -( \ - PatchTypeField, typePatchTypeField, patch \ -); \ - \ -addToRunTimeSelectionTable \ -( \ - PatchTypeField, \ - typePatchTypeField, \ - patchMapper \ -); \ - \ -addToRunTimeSelectionTable \ -( \ - PatchTypeField, typePatchTypeField, dictionary \ -); - - -#define makeFaePatchFields(type) \ - \ -makeFaePatchTypeField(faePatchScalarField, type##FaePatchScalarField); \ -makeFaePatchTypeField(faePatchVectorField, type##FaePatchVectorField); \ -makeFaePatchTypeField \ -( \ - faePatchSphericalTensorField, \ - type##FaePatchSphericalTensorField \ -); \ -makeFaePatchTypeField(faePatchSymmTensorField, type##FaePatchSymmTensorField); \ -makeFaePatchTypeField(faePatchTensorField, type##FaePatchTensorField); - - -#define makeFaePatchTypeFieldTypedefs(type) \ - \ -typedef type##FaePatchField type##FaePatchScalarField; \ -typedef type##FaePatchField type##FaePatchVectorField; \ -typedef type##FaePatchField \ - type##FaePatchSphericalTensorField; \ -typedef type##FaePatchField type##FaePatchSymmTensorField; \ -typedef type##FaePatchField type##FaePatchTensorField; - +#include "faePatchFieldMacros.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteArea/fields/faePatchFields/faePatchField/faePatchFieldMacros.H b/src/finiteArea/fields/faePatchFields/faePatchField/faePatchFieldMacros.H new file mode 100644 index 0000000000..090faa273b --- /dev/null +++ b/src/finiteArea/fields/faePatchFields/faePatchField/faePatchFieldMacros.H @@ -0,0 +1,142 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2016 Wikki Ltd + Copyright (C) 2023 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Description + Macros for creating faePatchField types. + +\*---------------------------------------------------------------------------*/ + +#ifndef Foam_faePatchFieldMacros_H +#define Foam_faePatchFieldMacros_H + +#include "fieldTypes.H" +#include "faePatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Runtime selection macros + +#define addToFaePatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField)\ + \ + addToRunTimeSelectionTable \ + ( \ + PatchTypeField, \ + typePatchTypeField, \ + patch \ + ); \ + addToRunTimeSelectionTable \ + ( \ + PatchTypeField, \ + typePatchTypeField, \ + patchMapper \ + ); \ + addToRunTimeSelectionTable \ + ( \ + PatchTypeField, \ + typePatchTypeField, \ + dictionary \ + ); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// For non-templated (or typedef) patch fields. +//- Define a concrete faePatchField type and add to run-time tables +//- Example, (faePatchScalarField, calculatedFaePatchScalarField) +#define makeFaePatchTypeField(PatchTypeField, typePatchTypeField) \ + \ + defineTypeNameAndDebug(typePatchTypeField, 0); \ + addToFaePatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField); + +//- Define a faePatchField type for a specific field type +//- Example, (scalar, calculated) +#define makeFaePatchFieldTypeName(fieldType, bcType) \ + defineNamedTemplateTypeNameAndDebug \ + ( \ + CAT4(bcType, FaePatch, CAPITALIZE(fieldType), Field), \ + 0 \ + ); + +//- Add runTime selection for faePatchField type of a specific field type +//- Example, (scalar, calculated) +#define addFaePatchFieldTypeRunTime(fieldType, bcType) \ + addToFaePatchFieldRunTimeSelection \ + ( \ + CAT3(faePatch, CAPITALIZE(fieldType), Field), \ + CAT4(bcType, FaePatch, CAPITALIZE(fieldType), Field) \ + ); + +// For templated patch fields +#define makeFaePatchFieldType(fieldType, bcType) \ + makeFaePatchFieldTypeName(fieldType, bcType) \ + addFaePatchFieldTypeRunTime(fieldType, bcType) + +//- Declare a typedef for a faePatchField. Example, (scalar, calculated) +#define makeFaePatchFieldTypedef(fieldType, bcType) \ + typedef \ + bcType##FaePatchField \ + CAT4(bcType, FaePatch, CAPITALIZE(fieldType), Field); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +//- For all standard field types: +//- define a faePatchField type and add to run-time tables +#define makeFaePatchFields(bcType) \ + \ + makeFaePatchFieldType(scalar, bcType); \ + makeFaePatchFieldType(vector, bcType); \ + makeFaePatchFieldType(sphericalTensor, bcType); \ + makeFaePatchFieldType(symmTensor, bcType); \ + makeFaePatchFieldType(tensor, bcType); + + +//- For all standard field types: define a faePatchField type +//- Example, (calculated) +#define makeFaePatchFieldsTypeName(bcType) \ + \ + makeFaePatchFieldTypeName(scalar, bcType); \ + makeFaePatchFieldTypeName(vector, bcType); \ + makeFaePatchFieldTypeName(sphericalTensor, bcType); \ + makeFaePatchFieldTypeName(symmTensor, bcType); \ + makeFaePatchFieldTypeName(tensor, bcType); + + +//- For all standard field types: define typedefs for the faePatchField +//- Example, (calculated) +#define makeFaePatchTypeFieldTypedefs(bcType) \ + \ + makeFaePatchFieldTypedef(scalar, bcType); \ + makeFaePatchFieldTypedef(vector, bcType); \ + makeFaePatchFieldTypedef(sphericalTensor, bcType); \ + makeFaePatchFieldTypedef(symmTensor, bcType); \ + makeFaePatchFieldTypedef(tensor, bcType); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteArea/fields/faePatchFields/faePatchField/faePatchFields.C b/src/finiteArea/fields/faePatchFields/faePatchField/faePatchFields.C index 29dcc54e3c..cba506b3a9 100644 --- a/src/finiteArea/fields/faePatchFields/faePatchField/faePatchFields.C +++ b/src/finiteArea/fields/faePatchFields/faePatchField/faePatchFields.C @@ -28,27 +28,21 @@ License #include "faePatchFields.H" #include "edgeFaMesh.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +#define makeFaePatchField(PatchTypeField) \ + defineTemplateRunTimeSelectionTable(PatchTypeField, patch); \ + defineTemplateRunTimeSelectionTable(PatchTypeField, patchMapper); \ + defineTemplateRunTimeSelectionTable(PatchTypeField, dictionary); -#define makeFaePatchField(faePatchTypeField) \ - \ -defineTemplateRunTimeSelectionTable(faePatchTypeField, patch); \ -defineTemplateRunTimeSelectionTable(faePatchTypeField, patchMapper); \ -defineTemplateRunTimeSelectionTable(faePatchTypeField, dictionary); - -makeFaePatchField(faePatchScalarField) -makeFaePatchField(faePatchVectorField) -makeFaePatchField(faePatchSphericalTensorField) -makeFaePatchField(faePatchSymmTensorField) -makeFaePatchField(faePatchTensorField) - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +makeFaePatchField(faePatchScalarField); +makeFaePatchField(faePatchVectorField); +makeFaePatchField(faePatchSphericalTensorField); +makeFaePatchField(faePatchSymmTensorField); +makeFaePatchField(faePatchTensorField); } // End namespace Foam diff --git a/src/finiteArea/fields/faePatchFields/faePatchField/faePatchFields.H b/src/finiteArea/fields/faePatchFields/faePatchField/faePatchFields.H index f3bc8dc854..822e6b1c5d 100644 --- a/src/finiteArea/fields/faePatchFields/faePatchField/faePatchFields.H +++ b/src/finiteArea/fields/faePatchFields/faePatchField/faePatchFields.H @@ -23,11 +23,8 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Class - Foam::faePatchField - Description - Finite area edge-based patch fields + Declarations for faePatchField types \*---------------------------------------------------------------------------*/ @@ -37,8 +34,6 @@ Description #include "faePatchField.H" #include "faePatchFieldsFwd.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - #endif // ************************************************************************* // diff --git a/src/finiteArea/fields/faePatchFields/faePatchField/faePatchFieldsFwd.H b/src/finiteArea/fields/faePatchFields/faePatchField/faePatchFieldsFwd.H index 30bf953ec4..36e49bdf5e 100644 --- a/src/finiteArea/fields/faePatchFields/faePatchField/faePatchFieldsFwd.H +++ b/src/finiteArea/fields/faePatchFields/faePatchField/faePatchFieldsFwd.H @@ -23,15 +23,13 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Class - Foam::faePatchField - Description + Forward declarations for faePatchField types \*---------------------------------------------------------------------------*/ -#ifndef faePatchFieldsFwd_H -#define faePatchFieldsFwd_H +#ifndef Foam_faePatchFieldsFwd_H +#define Foam_faePatchFieldsFwd_H #include "fieldTypes.H" diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C index 6028845530..e3e0b3a481 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C @@ -31,6 +31,14 @@ License #include "volFields.H" #include "surfaceFields.H" +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchFieldType(scalar, fan); +} + + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template<> @@ -102,12 +110,4 @@ void Foam::fanFvPatchField::calcFanJump() } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - makeTemplatePatchTypeField(scalar, fan); -} - - // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchFields.C index b382a51f42..1975af0b2b 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchFields.C @@ -29,18 +29,12 @@ License #include "addToRunTimeSelectionTable.H" #include "volFields.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -makeTemplatePatchTypeField(vector, fixedNormalSlip); -makeTemplatePatchTypeField(tensor, fixedNormalSlip); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam + makePatchFieldType(vector, fixedNormalSlip); + makePatchFieldType(tensor, fixedNormalSlip); +} // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedMixedFieldFvPatchField/mappedMixedFieldFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedMixedFieldFvPatchField/mappedMixedFieldFvPatchFields.C index 6eed3da77b..5fec5ef25a 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedMixedFieldFvPatchField/mappedMixedFieldFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedMixedFieldFvPatchField/mappedMixedFieldFvPatchFields.C @@ -36,7 +36,6 @@ namespace Foam // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -//makeTemplatePatchTypeField(scalar, mappedMixedField); makePatchFields(mappedMixedField); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedMixed/mappedMixedFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedMixed/mappedMixedFvPatchFields.C index e7b8d4c915..4c4ace9e78 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedMixed/mappedMixedFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedMixed/mappedMixedFvPatchFields.C @@ -36,7 +36,6 @@ namespace Foam // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -//makeTemplatePatchTypeField(scalar, mappedMixed); makePatchFields(mappedMixed); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDigitalFilterInlet/turbulentDigitalFilterInletFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDigitalFilterInlet/turbulentDigitalFilterInletFvPatchFields.C index 2dd5baaf48..40a36703ee 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDigitalFilterInlet/turbulentDigitalFilterInletFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDigitalFilterInlet/turbulentDigitalFilterInletFvPatchFields.C @@ -36,8 +36,8 @@ namespace Foam // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -makeTemplatePatchTypeField(scalar, turbulentDigitalFilterInlet); -makeTemplatePatchTypeField(vector, turbulentDigitalFilterInlet); +makePatchFieldType(scalar, turbulentDigitalFilterInlet); +makePatchFieldType(vector, turbulentDigitalFilterInlet); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H index 3d23bc0a2c..cf86b37bd7 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H @@ -716,106 +716,8 @@ public: #include "zeroGradientFvPatchField.H" #endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Runtime selection macros - -#define makeFvPatchField(fvPatchTypeField) \ - \ -defineTemplateRunTimeSelectionTable(fvPatchTypeField, patch); \ -defineTemplateRunTimeSelectionTable(fvPatchTypeField, patchMapper); \ -defineTemplateRunTimeSelectionTable(fvPatchTypeField, dictionary); - - -#undef addToPatchFieldRunTimeSelection -#define addToPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField) \ - addToRunTimeSelectionTable \ - ( \ - PatchTypeField, \ - typePatchTypeField, \ - patch \ - ); \ - addToRunTimeSelectionTable \ - ( \ - PatchTypeField, \ - typePatchTypeField, \ - patchMapper \ - ); \ - addToRunTimeSelectionTable \ - ( \ - PatchTypeField, \ - typePatchTypeField, \ - dictionary \ - ); - - -// Use with caution -#undef addRemovableToPatchFieldRunTimeSelection -#define addRemovableToPatchFieldRunTimeSelection\ -(PatchTypeField, typePatchTypeField) \ - \ - addRemovableToRunTimeSelectionTable \ - ( \ - PatchTypeField, \ - typePatchTypeField, \ - patch \ - ); \ - addRemovableToRunTimeSelectionTable \ - ( \ - PatchTypeField, \ - typePatchTypeField, \ - patchMapper \ - ); \ - addRemovableToRunTimeSelectionTable \ - ( \ - PatchTypeField, \ - typePatchTypeField, \ - dictionary \ - ); - - -// For non-templated patch fields -#define makePatchTypeField(PatchTypeField, typePatchTypeField) \ - defineTypeNameAndDebug(typePatchTypeField, 0); \ - addToPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField) - -// For non-templated patch fields - use with caution -#define makeRemovablePatchTypeField(PatchTypeField, typePatchTypeField) \ - defineTypeNameAndDebug(typePatchTypeField, 0); \ - addRemovableToPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField) - -// For templated patch fields -#define makeTemplatePatchTypeField(fieldType, type) \ - defineNamedTemplateTypeNameAndDebug \ - ( \ - CAT4(type, FvPatch, CAPITALIZE(fieldType), Field), \ - 0 \ - ); \ - addToPatchFieldRunTimeSelection \ - ( \ - CAT3(fvPatch, CAPITALIZE(fieldType), Field), \ - CAT4(type, FvPatch, CAPITALIZE(fieldType), Field) \ - ) - -#define makePatchFields(type) \ - FOR_ALL_FIELD_TYPES(makeTemplatePatchTypeField, type) - -#define makePatchFieldTypeName(fieldType, type) \ - defineNamedTemplateTypeNameAndDebug \ - ( \ - CAT4(type, FvPatch, CAPITALIZE(fieldType), Field), \ - 0 \ - ); - -#define makePatchFieldTypeNames(type) \ - FOR_ALL_FIELD_TYPES(makePatchFieldTypeName, type) - -#define makePatchTypeFieldTypedef(fieldType, type) \ - typedef type##FvPatchField \ - CAT4(type, FvPatch, CAPITALIZE(fieldType), Field); - -#define makePatchTypeFieldTypedefs(type) \ - FOR_ALL_FIELD_TYPES(makePatchTypeFieldTypedef, type) +#include "fvPatchFieldMacros.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldMacros.H b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldMacros.H new file mode 100644 index 0000000000..1cf00e951d --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldMacros.H @@ -0,0 +1,180 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2011 OpenFOAM Foundation + Copyright (C) 2023 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Description + Macros for creating fvPatchField types. + +\*---------------------------------------------------------------------------*/ + +#ifndef Foam_fvPatchFieldMacros_H +#define Foam_fvPatchFieldMacros_H + +#include "fieldTypes.H" +#include "fvPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Runtime selection macros + +#undef addToPatchFieldRunTimeSelection +#define addToPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField) \ + addToRunTimeSelectionTable \ + ( \ + PatchTypeField, \ + typePatchTypeField, \ + patch \ + ); \ + addToRunTimeSelectionTable \ + ( \ + PatchTypeField, \ + typePatchTypeField, \ + patchMapper \ + ); \ + addToRunTimeSelectionTable \ + ( \ + PatchTypeField, \ + typePatchTypeField, \ + dictionary \ + ); + + +// Use with caution +#undef addRemovableToPatchFieldRunTimeSelection +#define addRemovableToPatchFieldRunTimeSelection\ +(PatchTypeField, typePatchTypeField) \ + \ + addRemovableToRunTimeSelectionTable \ + ( \ + PatchTypeField, \ + typePatchTypeField, \ + patch \ + ); \ + addRemovableToRunTimeSelectionTable \ + ( \ + PatchTypeField, \ + typePatchTypeField, \ + patchMapper \ + ); \ + addRemovableToRunTimeSelectionTable \ + ( \ + PatchTypeField, \ + typePatchTypeField, \ + dictionary \ + ); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// For non-templated (or typedef) patch fields. +//- Define a concrete fvPatchField type and add to run-time tables +//- Example, (fvPatchScalarField, calculatedFvPatchScalarField) +#define makePatchTypeField(PatchTypeField, typePatchTypeField) \ + \ + defineTypeNameAndDebug(typePatchTypeField, 0); \ + addToPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField); + +// For non-templated patch fields - use with caution +#define makeRemovablePatchTypeField(PatchTypeField, typePatchTypeField) \ + defineTypeNameAndDebug(typePatchTypeField, 0); \ + addRemovableToPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField) + + +//- Define a fvPatchField type for a specific field type +//- Example, (scalar, calculated) +#define makePatchFieldTypeName(fieldType, bcType) \ + defineNamedTemplateTypeNameAndDebug \ + ( \ + CAT4(bcType, FvPatch, CAPITALIZE(fieldType), Field), \ + 0 \ + ); + +//- Add runTime selection for fvPatchField type of a specific field type +//- Example, (scalar, calculated) +#define addPatchFieldTypeRunTime(fieldType, bcType) \ + addToPatchFieldRunTimeSelection \ + ( \ + CAT3(fvPatch, CAPITALIZE(fieldType), Field), \ + CAT4(bcType, FvPatch, CAPITALIZE(fieldType), Field) \ + ); + +// For templated patch fields +#define makePatchFieldType(fieldType, bcType) \ + makePatchFieldTypeName(fieldType, bcType) \ + addPatchFieldTypeRunTime(fieldType, bcType) + +//- Declare a typedef for a fvPatchField. Example, (scalar, calculated) +#define makePatchTypeFieldTypedef(fieldType, bcType) \ + typedef \ + bcType##FvPatchField \ + CAT4(bcType, FvPatch, CAPITALIZE(fieldType), Field); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +//- For all standard field types: +//- define a faPatchField type and add to run-time tables +#define makePatchFields(bcType) \ + \ + makePatchFieldType(scalar, bcType); \ + makePatchFieldType(vector, bcType); \ + makePatchFieldType(sphericalTensor, bcType); \ + makePatchFieldType(symmTensor, bcType); \ + makePatchFieldType(tensor, bcType); + + +//- For all standard field types: define a faPatchField type. +//- Example, (calculated) +#define makePatchFieldTypeNames(bcType) \ + \ + makePatchFieldTypeName(scalar, bcType); \ + makePatchFieldTypeName(vector, bcType); \ + makePatchFieldTypeName(sphericalTensor, bcType); \ + makePatchFieldTypeName(symmTensor, bcType); \ + makePatchFieldTypeName(tensor, bcType); + + +//- For all standard field types: define typedefs for the faPatchField +//- Example, (calculated) +#define makePatchTypeFieldTypedefs(bcType) \ + \ + makePatchTypeFieldTypedef(scalar, bcType); \ + makePatchTypeFieldTypedef(vector, bcType); \ + makePatchTypeFieldTypedef(sphericalTensor, bcType); \ + makePatchTypeFieldTypedef(symmTensor, bcType); \ + makePatchTypeFieldTypedef(tensor, bcType); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Compatibility: OpenFOAM-v2212 and earlier + +#define makeTemplatePatchTypeField(fldType, bcType) \ + makePatchFieldType(fldType, bcType) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFields.C index 15fa4f1052..d9905d8fe7 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFields.C @@ -27,20 +27,21 @@ License #include "fvPatchFields.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +#define makeFvPatchField(PatchTypeField) \ + defineTemplateRunTimeSelectionTable(PatchTypeField, patch); \ + defineTemplateRunTimeSelectionTable(PatchTypeField, patchMapper); \ + defineTemplateRunTimeSelectionTable(PatchTypeField, dictionary); -makeFvPatchField(fvPatchScalarField) -makeFvPatchField(fvPatchVectorField) -makeFvPatchField(fvPatchSphericalTensorField) -makeFvPatchField(fvPatchSymmTensorField) -makeFvPatchField(fvPatchTensorField) - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +makeFvPatchField(fvPatchScalarField); +makeFvPatchField(fvPatchVectorField); +makeFvPatchField(fvPatchSphericalTensorField); +makeFvPatchField(fvPatchSymmTensorField); +makeFvPatchField(fvPatchTensorField); } // End namespace Foam diff --git a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H index 1eb422705a..3527c89dfb 100644 --- a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H +++ b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H @@ -473,66 +473,8 @@ public: #include "calculatedFvsPatchField.H" #endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Runtime selection macros - -#define makeFvsPatchTypeFieldTypeName(type) \ - \ -defineNamedTemplateTypeNameAndDebug(type, 0); - -#define makeFvsPatchFieldsTypeName(type) \ - \ -makeFvsPatchTypeFieldTypeName(type##FvsPatchScalarField); \ -makeFvsPatchTypeFieldTypeName(type##FvsPatchVectorField); \ -makeFvsPatchTypeFieldTypeName(type##FvsPatchSphericalTensorField); \ -makeFvsPatchTypeFieldTypeName(type##FvsPatchSymmTensorField); \ -makeFvsPatchTypeFieldTypeName(type##FvsPatchTensorField); - -#define makeFvsPatchTypeField(PatchTypeField, typePatchTypeField) \ - \ -defineNamedTemplateTypeNameAndDebug(typePatchTypeField, 0); \ - \ -addToRunTimeSelectionTable \ -( \ - PatchTypeField, typePatchTypeField, patch \ -); \ - \ -addToRunTimeSelectionTable \ -( \ - PatchTypeField, \ - typePatchTypeField, \ - patchMapper \ -); \ - \ -addToRunTimeSelectionTable \ -( \ - PatchTypeField, typePatchTypeField, dictionary \ -); - - -#define makeFvsPatchFields(type) \ - \ -makeFvsPatchTypeField(fvsPatchScalarField, type##FvsPatchScalarField); \ -makeFvsPatchTypeField(fvsPatchVectorField, type##FvsPatchVectorField); \ -makeFvsPatchTypeField \ -( \ - fvsPatchSphericalTensorField, \ - type##FvsPatchSphericalTensorField \ -); \ -makeFvsPatchTypeField(fvsPatchSymmTensorField, type##FvsPatchSymmTensorField); \ -makeFvsPatchTypeField(fvsPatchTensorField, type##FvsPatchTensorField); - - -#define makeFvsPatchTypeFieldTypedefs(type) \ - \ -typedef type##FvsPatchField type##FvsPatchScalarField; \ -typedef type##FvsPatchField type##FvsPatchVectorField; \ -typedef type##FvsPatchField \ - type##FvsPatchSphericalTensorField; \ -typedef type##FvsPatchField type##FvsPatchSymmTensorField; \ -typedef type##FvsPatchField type##FvsPatchTensorField; - +#include "fvsPatchFieldMacros.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchFieldMacros.H b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchFieldMacros.H new file mode 100644 index 0000000000..62828eaf92 --- /dev/null +++ b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchFieldMacros.H @@ -0,0 +1,143 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2011 OpenFOAM Foundation + Copyright (C) 2023 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Description + Macros for creating fvsPatchField types. + +\*---------------------------------------------------------------------------*/ + +#ifndef Foam_fvsPatchFieldMacros_H +#define Foam_fvsPatchFieldMacros_H + +#include "fieldTypes.H" +#include "fvsPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Runtime selection macros + +#define addToFvsPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField)\ + \ + addToRunTimeSelectionTable \ + ( \ + PatchTypeField, \ + typePatchTypeField, \ + patch \ + ); \ + addToRunTimeSelectionTable \ + ( \ + PatchTypeField, \ + typePatchTypeField, \ + patchMapper \ + ); \ + addToRunTimeSelectionTable \ + ( \ + PatchTypeField, \ + typePatchTypeField, \ + dictionary \ + ); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// For non-templated (or typedef) patch fields. +//- Define a concrete fvsPatchField type and add to run-time tables +//- Example, (fvsPatchScalarField, calculatedFvsPatchScalarField) +#define makeFvsPatchTypeField(PatchTypeField, typePatchTypeField) \ + \ + defineTypeNameAndDebug(typePatchTypeField, 0); \ + addToFvsPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField); + + +//- Define a fvsPatchField type for a specific field type +//- Example, (scalar, calculated) +#define makeFvsPatchFieldTypeName(fieldType, bcType) \ + defineNamedTemplateTypeNameAndDebug \ + ( \ + CAT4(bcType, FvsPatch, CAPITALIZE(fieldType), Field), \ + 0 \ + ); + +//- Add runTime selection for fvsPatchField type of a specific field type +//- Example, (scalar, calculated) +#define addFvsPatchFieldTypeRunTime(fieldType, bcType) \ + addToFvsPatchFieldRunTimeSelection \ + ( \ + CAT3(fvsPatch, CAPITALIZE(fieldType), Field), \ + CAT4(bcType, FvsPatch, CAPITALIZE(fieldType), Field) \ + ); + +// For templated patch fields +#define makeFvsPatchFieldType(fieldType, bcType) \ + makeFvsPatchFieldTypeName(fieldType, bcType) \ + addFvsPatchFieldTypeRunTime(fieldType, bcType) + +//- Declare a typedef for a fvsPatchField. Example, (scalar, calculated) +#define makeFvsPatchFieldTypedef(fieldType, bcType) \ + typedef \ + bcType##FvsPatchField \ + CAT4(bcType, FvsPatch, CAPITALIZE(fieldType), Field); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +//- For all standard field types: +//- define a fvsPatchField type and add to run-time tables +#define makeFvsPatchFields(bcType) \ + \ + makeFvsPatchFieldType(scalar, bcType); \ + makeFvsPatchFieldType(vector, bcType); \ + makeFvsPatchFieldType(sphericalTensor, bcType); \ + makeFvsPatchFieldType(symmTensor, bcType); \ + makeFvsPatchFieldType(tensor, bcType); + + +//- For all standard field types: define a fvsPatchField type +//- Example, (calculated) +#define makeFvsPatchFieldsTypeName(bcType) \ + \ + makeFvsPatchFieldTypeName(scalar, bcType); \ + makeFvsPatchFieldTypeName(vector, bcType); \ + makeFvsPatchFieldTypeName(sphericalTensor, bcType); \ + makeFvsPatchFieldTypeName(symmTensor, bcType); \ + makeFvsPatchFieldTypeName(tensor, bcType); + + +//- For all standard field types: define typedefs for the fvsPatchField +//- Example, (calculated) +#define makeFvsPatchTypeFieldTypedefs(bcType) \ + \ + makeFvsPatchFieldTypedef(scalar, bcType); \ + makeFvsPatchFieldTypedef(vector, bcType); \ + makeFvsPatchFieldTypedef(sphericalTensor, bcType); \ + makeFvsPatchFieldTypedef(symmTensor, bcType); \ + makeFvsPatchFieldTypedef(tensor, bcType); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchFields.C b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchFields.C index bd696c9ec1..40f12db9b8 100644 --- a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchFields.C +++ b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchFields.C @@ -27,26 +27,21 @@ License #include "fvsPatchFields.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +#define makeFvsPatchField(PatchTypeField) \ + defineTemplateRunTimeSelectionTable(PatchTypeField, patch); \ + defineTemplateRunTimeSelectionTable(PatchTypeField, patchMapper); \ + defineTemplateRunTimeSelectionTable(PatchTypeField, dictionary); -#define makeFvsPatchField(fvsPatchTypeField) \ - \ -defineTemplateRunTimeSelectionTable(fvsPatchTypeField, patch); \ -defineTemplateRunTimeSelectionTable(fvsPatchTypeField, patchMapper); \ -defineTemplateRunTimeSelectionTable(fvsPatchTypeField, dictionary); - -makeFvsPatchField(fvsPatchScalarField) -makeFvsPatchField(fvsPatchVectorField) -makeFvsPatchField(fvsPatchSphericalTensorField) -makeFvsPatchField(fvsPatchSymmTensorField) -makeFvsPatchField(fvsPatchTensorField) - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +makeFvsPatchField(fvsPatchScalarField); +makeFvsPatchField(fvsPatchVectorField); +makeFvsPatchField(fvsPatchSphericalTensorField); +makeFvsPatchField(fvsPatchSymmTensorField); +makeFvsPatchField(fvsPatchTensorField); } // End namespace Foam