fvsPatchFieldMacros.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 fvsPatchField types.
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #ifndef Foam_fvsPatchFieldMacros_H
33 #define Foam_fvsPatchFieldMacros_H
34 
35 #include "fieldTypes.H"
36 #include "fvsPatchField.H"
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 // Runtime selection macros
40 
41 #define addToFvsPatchFieldRunTimeSelection(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 fvsPatchField type and add to run-time tables
67 //- Example, (fvsPatchScalarField, calculatedFvsPatchScalarField)
68 #define makeFvsPatchTypeField(PatchTypeField, typePatchTypeField) \
69  \
70  defineTypeNameAndDebug(typePatchTypeField, 0); \
71  addToFvsPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField);
72 
73 
74 //- Define a fvsPatchField type for a specific field type
75 //- Example, (scalar, calculated)
76 #define makeFvsPatchFieldTypeName(fieldType, bcType) \
77  defineNamedTemplateTypeNameAndDebug \
78  ( \
79  CAT4(bcType, FvsPatch, CAPITALIZE(fieldType), Field), \
80  0 \
81  );
82 
83 //- Add runTime selection for fvsPatchField type of a specific field type
84 //- Example, (scalar, calculated)
85 #define addFvsPatchFieldTypeRunTime(fieldType, bcType) \
86  addToFvsPatchFieldRunTimeSelection \
87  ( \
88  CAT3(fvsPatch, CAPITALIZE(fieldType), Field), \
89  CAT4(bcType, FvsPatch, CAPITALIZE(fieldType), Field) \
90  );
91 
92 // For templated patch fields
93 #define makeFvsPatchFieldType(fieldType, bcType) \
94  makeFvsPatchFieldTypeName(fieldType, bcType) \
95  addFvsPatchFieldTypeRunTime(fieldType, bcType)
96 
97 //- Declare a typedef for a fvsPatchField. Example, (scalar, calculated)
98 #define makeFvsPatchFieldTypedef(fieldType, bcType) \
99  typedef \
100  bcType##FvsPatchField<fieldType> \
101  CAT4(bcType, FvsPatch, CAPITALIZE(fieldType), Field);
102 
103 
104 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
105 
106 //- For all standard field types:
107 //- define a fvsPatchField type and add to run-time tables
108 #define makeFvsPatchFields(bcType) \
109  \
110  makeFvsPatchFieldType(scalar, bcType); \
111  makeFvsPatchFieldType(vector, bcType); \
112  makeFvsPatchFieldType(sphericalTensor, bcType); \
113  makeFvsPatchFieldType(symmTensor, bcType); \
114  makeFvsPatchFieldType(tensor, bcType);
115 
116 
117 //- For all standard field types: define a fvsPatchField type
118 //- Example, (calculated)
119 #define makeFvsPatchFieldsTypeName(bcType) \
120  \
121  makeFvsPatchFieldTypeName(scalar, bcType); \
122  makeFvsPatchFieldTypeName(vector, bcType); \
123  makeFvsPatchFieldTypeName(sphericalTensor, bcType); \
124  makeFvsPatchFieldTypeName(symmTensor, bcType); \
125  makeFvsPatchFieldTypeName(tensor, bcType);
126 
127 
128 //- For all standard field types: define typedefs for the fvsPatchField
129 //- Example, (calculated)
130 #define makeFvsPatchTypeFieldTypedefs(bcType) \
131  \
132  makeFvsPatchFieldTypedef(scalar, bcType); \
133  makeFvsPatchFieldTypedef(vector, bcType); \
134  makeFvsPatchFieldTypedef(sphericalTensor, bcType); \
135  makeFvsPatchFieldTypedef(symmTensor, bcType); \
136  makeFvsPatchFieldTypedef(tensor, bcType);
137 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 #endif
142 
143 // ************************************************************************* //