faPatchFieldMacros.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) 2016 Wikki Ltd
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 faPatchField types.
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #ifndef Foam_faPatchFieldMacros_H
33 #define Foam_faPatchFieldMacros_H
34 
35 #include "fieldTypes.H"
36 #include "faPatchField.H"
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 // Runtime selection macros
40 
41 #define addToFaPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField) \
42  \
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 faPatchField type and add to run-time tables
67 //- Example, (faPatchScalarField, calculatedFaPatchScalarField)
68 #define makeFaPatchTypeField(PatchTypeField, typePatchTypeField) \
69  \
70  defineTypeNameAndDebug(typePatchTypeField, 0); \
71  addToFaPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField);
72 
73 //- Define a faPatchField type for a specific field type
74 //- Example, (scalar, calculated)
75 #define makeFaPatchFieldTypeName(fieldType, bcType) \
76  defineNamedTemplateTypeNameAndDebug \
77  ( \
78  CAT4(bcType, FaPatch, CAPITALIZE(fieldType), Field), \
79  0 \
80  );
81 
82 //- Add runTime selection for faPatchField type of a specific field type
83 //- Example, (scalar, calculated)
84 #define addFaPatchFieldTypeRunTime(fieldType, bcType) \
85  addToFaPatchFieldRunTimeSelection \
86  ( \
87  CAT3(faPatch, CAPITALIZE(fieldType), Field), \
88  CAT4(bcType, FaPatch, CAPITALIZE(fieldType), Field) \
89  );
90 
91 // For templated patch fields
92 #define makeFaPatchFieldType(fieldType, bcType) \
93  makeFaPatchFieldTypeName(fieldType, bcType) \
94  addFaPatchFieldTypeRunTime(fieldType, bcType) \
95 
96 //- Declare a typedef for a faPatchField. Example, (scalar, calculated)
97 #define makeFaPatchFieldTypedef(fieldType, bcType) \
98  typedef \
99  bcType##FaPatchField<fieldType> \
100  CAT4(bcType, FaPatch, CAPITALIZE(fieldType), Field);
101 
102 
103 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
104 
105 //- For all standard field types:
106 //- define a faPatchField type and add to run-time tables
107 #define makeFaPatchFields(bcType) \
108  \
109  makeFaPatchFieldType(scalar, bcType); \
110  makeFaPatchFieldType(vector, bcType); \
111  makeFaPatchFieldType(sphericalTensor, bcType); \
112  makeFaPatchFieldType(symmTensor, bcType); \
113  makeFaPatchFieldType(tensor, bcType);
114 
115 
116 //- For all standard field types: define a faPatchField type.
117 //- Example, (calculated)
118 #define makeFaPatchFieldsTypeName(bcType) \
119  \
120  makeFaPatchFieldTypeName(scalar, bcType); \
121  makeFaPatchFieldTypeName(vector, bcType); \
122  makeFaPatchFieldTypeName(sphericalTensor, bcType); \
123  makeFaPatchFieldTypeName(symmTensor, bcType); \
124  makeFaPatchFieldTypeName(tensor, bcType);
125 
126 
127 //- For all standard field types: define typedefs for the faPatchField.
128 //- Example, (calculated)
129 #define makeFaPatchTypeFieldTypedefs(bcType) \
130  \
131  makeFaPatchFieldTypedef(scalar, bcType); \
132  makeFaPatchFieldTypedef(vector, bcType); \
133  makeFaPatchFieldTypedef(sphericalTensor, bcType); \
134  makeFaPatchFieldTypedef(symmTensor, bcType); \
135  makeFaPatchFieldTypedef(tensor, bcType);
136 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 #endif
141 
142 // ************************************************************************* //