Loading...
Searching...
No Matches
fvPatchFieldMacros.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-------------------------------------------------------------------------------
11License
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
27Description
28 Macros for creating fvPatchField types.
29
30\*---------------------------------------------------------------------------*/
31
32#ifndef Foam_fvPatchFieldMacros_H
33#define Foam_fvPatchFieldMacros_H
34
35#include "fieldTypes.H"
37
38// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39// Runtime selection macros
40
41#undef addToPatchFieldRunTimeSelection
42#define addToPatchFieldRunTimeSelection(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// Use with caution
64#undef addRemovableToPatchFieldRunTimeSelection
65#define addRemovableToPatchFieldRunTimeSelection\
66(PatchTypeField, typePatchTypeField) \
67 \
68 addRemovableToRunTimeSelectionTable \
69 ( \
70 PatchTypeField, \
71 typePatchTypeField, \
72 patch \
73 ); \
74 addRemovableToRunTimeSelectionTable \
75 ( \
76 PatchTypeField, \
77 typePatchTypeField, \
78 patchMapper \
79 ); \
80 addRemovableToRunTimeSelectionTable \
81 ( \
82 PatchTypeField, \
83 typePatchTypeField, \
84 dictionary \
85 );
86
87
88// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
90// For non-templated (or typedef) patch fields.
91//- Define a concrete fvPatchField type and add to run-time tables
92//- Example, (fvPatchScalarField, calculatedFvPatchScalarField)
93#define makePatchTypeField(PatchTypeField, typePatchTypeField) \
94 \
95 defineTypeNameAndDebug(typePatchTypeField, 0); \
96 addToPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField);
97
98// For non-templated patch fields - use with caution
99#define makeRemovablePatchTypeField(PatchTypeField, typePatchTypeField) \
100 defineTypeNameAndDebug(typePatchTypeField, 0); \
101 addRemovableToPatchFieldRunTimeSelection(PatchTypeField, typePatchTypeField)
102
103
104//- Define a fvPatchField type for a specific field type
105//- Example, (scalar, calculated)
106#define makePatchFieldTypeName(fieldType, bcType) \
107 defineNamedTemplateTypeNameAndDebug \
108 ( \
109 CAT4(bcType, FvPatch, CAPITALIZE(fieldType), Field), \
110 0 \
111 );
112
113//- Add runTime selection for fvPatchField type of a specific field type
114//- Example, (scalar, calculated)
115#define addPatchFieldTypeRunTime(fieldType, bcType) \
116 addToPatchFieldRunTimeSelection \
117 ( \
118 CAT3(fvPatch, CAPITALIZE(fieldType), Field), \
119 CAT4(bcType, FvPatch, CAPITALIZE(fieldType), Field) \
120 );
121
122// For templated patch fields
123#define makePatchFieldType(fieldType, bcType) \
124 makePatchFieldTypeName(fieldType, bcType) \
125 addPatchFieldTypeRunTime(fieldType, bcType)
126
127//- Declare a typedef for a fvPatchField. Example, (scalar, calculated)
128#define makePatchTypeFieldTypedef(fieldType, bcType) \
129 typedef \
130 bcType##FvPatchField<fieldType> \
131 CAT4(bcType, FvPatch, CAPITALIZE(fieldType), Field);
132
133
134// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135
136//- For all standard field types:
137//- define a faPatchField type and add to run-time tables
138#define makePatchFields(bcType) \
139 \
140 makePatchFieldType(scalar, bcType); \
141 makePatchFieldType(vector, bcType); \
142 makePatchFieldType(sphericalTensor, bcType); \
143 makePatchFieldType(symmTensor, bcType); \
144 makePatchFieldType(tensor, bcType);
145
146
147//- For all standard field types: define a faPatchField type.
148//- Example, (calculated)
149#define makePatchFieldTypeNames(bcType) \
150 \
151 makePatchFieldTypeName(scalar, bcType); \
152 makePatchFieldTypeName(vector, bcType); \
153 makePatchFieldTypeName(sphericalTensor, bcType); \
154 makePatchFieldTypeName(symmTensor, bcType); \
155 makePatchFieldTypeName(tensor, bcType);
156
157
158//- For all standard field types: define typedefs for the faPatchField
159//- Example, (calculated)
160#define makePatchTypeFieldTypedefs(bcType) \
161 \
162 makePatchTypeFieldTypedef(scalar, bcType); \
163 makePatchTypeFieldTypedef(vector, bcType); \
164 makePatchTypeFieldTypedef(sphericalTensor, bcType); \
165 makePatchTypeFieldTypedef(symmTensor, bcType); \
166 makePatchTypeFieldTypedef(tensor, bcType);
167
169// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170
171// Compatibility: OpenFOAM-v2212 and earlier
172
173#define makeTemplatePatchTypeField(fldType, bcType) \
174 makePatchFieldType(fldType, bcType)
175
176// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177
178#endif
179
180// ************************************************************************* //