pointPatchFieldMacros.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011 OpenFOAM Foundation
9  Copyright (C) 2023 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Description
28  Macros for creating pointPatchField types.
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #ifndef Foam_pointPatchFieldMacros_H
33 #define Foam_pointPatchFieldMacros_H
34 
35 #include "fieldTypes.H"
36 #include "pointPatchField.H"
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 // Runtime selection macros
40 
41 #define addToPointPatchFieldRunTimeSelection\
42 (PatchTypeField, typePatchTypeField)\
43  addToRunTimeSelectionTable \
44  ( \
45  PatchTypeField, \
46  typePatchTypeField, \
47  patch \
48  ); \
49  addToRunTimeSelectionTable \
50  ( \
51  PatchTypeField, \
52  typePatchTypeField, \
53  patchMapper \
54  ); \
55  addToRunTimeSelectionTable \
56  ( \
57  PatchTypeField, \
58  typePatchTypeField, \
59  dictionary \
60  );
61 
62 
63 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64 
65 // For non-templated (or typedef) patch fields.
66 //- Define a concrete pointPatchField type and add to run-time tables
67 //- Example, (pointPatchScalarField, calculatedPointPatchScalarField)
68 #define makePointPatchTypeField(PatchTypeField, typePatchTypeField) \
69  \
70  defineTypeNameAndDebug(typePatchTypeField, 0); \
71  addToPointPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField);
72 
73 //- Define a pointPatchField type for a specific field type
74 //- Example, (scalar, calculated)
75 #define makePointPatchFieldTypeName(fieldType, bcType) \
76  defineNamedTemplateTypeNameAndDebug \
77  ( \
78  CAT4(bcType, PointPatch, CAPITALIZE(fieldType), Field), \
79  0 \
80  );
81 
82 //- Add runTime selection for pointPatchField type of a specific field type
83 //- Example, (scalar, calculated)
84 #define addPointPatchFieldTypeRunTime(fieldType, bcType) \
85  addToPointPatchFieldRunTimeSelection \
86  ( \
87  CAT3(pointPatch, CAPITALIZE(fieldType), Field), \
88  CAT4(bcType, PointPatch, CAPITALIZE(fieldType), Field) \
89  );
90 
91 // For templated patch fields
92 #define makePointPatchFieldType(fieldType, bcType) \
93  makePointPatchFieldTypeName(fieldType, bcType) \
94  addPointPatchFieldTypeRunTime(fieldType, bcType)
95 
96 //- Declare a typedef for a pointPatchField.
97 //- Example, (scalar, calculated)
98 #define makePointPatchFieldTypedef(fieldType, bcType) \
99  typedef \
100  bcType##PointPatchField<fieldType> \
101  CAT4(bcType, PointPatch, CAPITALIZE(fieldType), Field);
102 
103 
104 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
105 
106 //- For all standard field types:
107 //- define a pointPatchField type and add to run-time tables
108 #define makePointPatchFields(bcType) \
109  \
110  makePointPatchFieldType(scalar, bcType); \
111  makePointPatchFieldType(vector, bcType); \
112  makePointPatchFieldType(sphericalTensor, bcType); \
113  makePointPatchFieldType(symmTensor, bcType); \
114  makePointPatchFieldType(tensor, bcType);
115 
116 
117 //- For all standard field types: define a pointPatchField type
118 //- Example, (calculated)
119 #define makePointPatchFieldsTypeName(bcType) \
120  \
121  makePointPatchFieldTypeName(scalar, bcType); \
122  makePointPatchFieldTypeName(vector, bcType); \
123  makePointPatchFieldTypeName(sphericalTensor, bcType); \
124  makePointPatchFieldTypeName(symmTensor, bcType); \
125  makePointPatchFieldTypeName(tensor, bcType);
126 
127 
128 //- For all standard field types: define typedefs for the pointPatchField
129 //- Example, (calculated)
130 #define makePointPatchFieldTypedefs(bcType) \
131  \
132  makePointPatchFieldTypedef(scalar, bcType); \
133  makePointPatchFieldTypedef(vector, bcType); \
134  makePointPatchFieldTypedef(sphericalTensor, bcType); \
135  makePointPatchFieldTypedef(symmTensor, bcType); \
136  makePointPatchFieldTypedef(tensor, bcType);
137 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 #endif
142 
143 // ************************************************************************* //