addToRunTimeSelectionTable.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-2016 OpenFOAM Foundation
9  Copyright (C) 2021 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 easy insertion into run-time selection tables
29 
30 Note
31  The helper macro names used here must remain synchronized with
32  definitions in runTimeSelectionTables.H
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef addToRunTimeSelectionTable_H
37 #define addToRunTimeSelectionTable_H
38 
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 
41 //- Add to construction table with typeName as the key
42 #define addToRunTimeSelectionTable\
43 (baseType,thisType,argNames) \
44  \
45  /* Add thisType factory method to the table */ \
46  baseType::add##argNames##ConstructorToTable<thisType> \
47  add##thisType##argNames##ConstructorTo##baseType##Table_
48 
49 
50 //- Add to construction table with typeName as the key
51 #define addRemovableToRunTimeSelectionTable\
52 (baseType,thisType,argNames) \
53  \
54  /* Add thisType factory method to the table */ \
55  baseType::addRemovable##argNames##ConstructorToTable<thisType> \
56  addRemovable##thisType##argNames##ConstructorTo##baseType##Table_
57 
58 
59 //- Add to construction table with 'lookupName' as the key
60 #define addNamedToRunTimeSelectionTable\
61 (baseType,thisType,argNames,lookupName) \
62  \
63  /* Add thisType factory method to the table, find by lookupName */ \
64  baseType::add##argNames##ConstructorToTable<thisType> \
65  add##thisType##argNames##ConstructorTo## \
66  baseType##Table_##lookupName##_(#lookupName)
67 
68 
69 //- Add to construction table with 'lookupName' as the key
70 #define addRemovableNamedToRunTimeSelectionTable\
71 (baseType,thisType,argNames,lookupName) \
72  \
73  /* Add thisType factory method to the table, find by lookupName */ \
74  baseType::addRemovable##argNames##ConstructorToTable<thisType> \
75  addRemovable##thisType##argNames##ConstructorTo## \
76  baseType##Table_##lookupName##_(#lookupName)
77 
78 
79 //- Add lookup alias for runTime selection
80 #define addAliasToRunTimeSelectionTable\
81 (baseType,thisType,argNames,lookup,other,ver) \
82  \
83  /* Add thisType constructor function to the table, find by lookup */ \
84  baseType::addAlias##argNames##ConstructorToTable<thisType> \
85  add##thisType##argNames##ConstructorTo##baseType##Table_ \
86  ##lookup##_##other##_(#lookup,#other,ver)
87 
88 
89 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
90 
91 //- Add to construction table with typeName as the key.
92 // Use when baseType doesn't need a template argument (eg, is a typedef)
93 #define addTemplateToRunTimeSelectionTable\
94 (baseType,thisType,Targ,argNames) \
95  \
96  /* Add thisType factory method to the table */ \
97  baseType::add##argNames##ConstructorToTable<thisType<Targ>> \
98  add##thisType##Targ##argNames##ConstructorTo##baseType##Table_
99 
100 
101 //- Add to construction table with 'lookupName' as the key.
102 // Use when baseType doesn't need a template argument (eg, is a typedef)
103 #define addNamedTemplateToRunTimeSelectionTable\
104 (baseType,thisType,Targ,argNames,lookupName) \
105  \
106  /* Add thisType factory method to the table, find by lookupName */ \
107  baseType::add##argNames##ConstructorToTable<thisType<Targ>> \
108  add##thisType##Targ##argNames##ConstructorTo## \
109  baseType##Table_##lookupName##_(#lookupName)
110 
111 
112 //- Add lookup alias for for runTime selection
113 #define addAliasTemplateToRunTimeSelectionTable\
114 (baseType,thisType,Targ,argNames,lookup,other,ver) \
115  \
116  /* Add thisType constructor function to the table, find by lookup */ \
117  baseType::addAlias##argNames##ConstructorToTable<thisType<Targ>> \
118  add##thisType##Targs##argNames##ConstructorTo##baseType##Table_ \
119  ##lookup##_##other##_(#lookup,#other,ver)
120 
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 //- Add to construction table with typeName as the key.
125 // Use when baseType requires the Targ template argument as well
126 #define addTemplatedToRunTimeSelectionTable\
127 (baseType,thisType,Targ,argNames) \
128  \
129  /* Add thisType factory method to the table */ \
130  baseType<Targ>::add##argNames##ConstructorToTable<thisType<Targ>> \
131  add##thisType##Targ##argNames##ConstructorTo##baseType##Targ##Table_
132 
133 
134 //- Add to construction table with 'lookupName' as the key.
135 // Use when baseType requires the Targ template argument as well
136 #define addNamedTemplatedToRunTimeSelectionTable\
137 (baseType,thisType,Targ,argNames,lookupName) \
138  \
139  /* Add thisType factory method to the table, find by lookupName */ \
140  baseType<Targ>::add##argNames##ConstructorToTable<thisType<Targ>> \
141  add##thisType##Targ##argNames##ConstructorTo## \
142  baseType##Targ##Table_##lookupName##_(#lookupName)
143 
144 
145 //- Add lookup alias for for runTime selection
146 // Use when baseType requires the Targ template argument as well
147 #define addAliasTemplatedToRunTimeSelectionTable\
148 (baseType,thisType,Targ,argNames,lookup,other,ver) \
149  \
150  /* Add the thisType constructor function to the table, find by lookup */ \
151  baseType<Targ>::add##argNames##ConstructorToTable<thisType<Targ>> \
152  add##thisType##Targ##argNames##ConstructorTo##baseType##Targ## \
153  Table_##lookup##_##other##_(#lookup,#other,ver)
154 
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 #endif
159 
160 // ************************************************************************* //
addNamedTemplatedToRunTimeSelectionTable
#define addNamedTemplatedToRunTimeSelectionTable(baseType, thisType, Targ, argNames, lookupName)
Add to construction table with 'lookupName' as the key.
Definition: addToRunTimeSelectionTable.H:136
Foam::add
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Definition: FieldFieldFunctions.C:939
addTemplateToRunTimeSelectionTable
#define addTemplateToRunTimeSelectionTable(baseType, thisType, Targ, argNames)
Add to construction table with typeName as the key.
Definition: addToRunTimeSelectionTable.H:93
addNamedTemplateToRunTimeSelectionTable
#define addNamedTemplateToRunTimeSelectionTable(baseType, thisType, Targ, argNames, lookupName)
Add to construction table with 'lookupName' as the key.
Definition: addToRunTimeSelectionTable.H:103
addTemplatedToRunTimeSelectionTable
#define addTemplatedToRunTimeSelectionTable(baseType, thisType, Targ, argNames)
Add to construction table with typeName as the key.
Definition: addToRunTimeSelectionTable.H:126