addToMemberFunctionSelectionTable.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 InClass
28  Foam::memberFunctionSelectionTables
29 
30 Description
31  Macros for easy insertion into member function selection tables
32 
33 Note
34  The helper macro names used here must remain synchronized with
35  definitions in memberFunctionSelectionTables.H
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef addToMemberFunctionSelectionTable_H
40 #define addToMemberFunctionSelectionTable_H
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 //- Add to hash-table of functions with typeName as the key.
45 #define addToMemberFunctionSelectionTable\
46 (baseType,thisType,funcName,argNames) \
47  \
48  /* Add thisType funcName to the table */ \
49  baseType::add##funcName##argNames##MemberFunctionToTable<thisType> \
50  add##thisType##funcName##argNames##MemberFunctionTo##baseType##Table_
51 
52 
53 //- Add to hash-table of functions with 'lookupName' as the key.
54 #define addNamedToMemberFunctionSelectionTable\
55 (baseType,thisType,funcName,argNames,lookupName) \
56  \
57  /* Add thisType funcName to the table, find by lookup name */ \
58  baseType::add##funcName##argNames##MemberFunctionToTable<thisType> \
59  add##thisType##funcName##argNames##MemberFunctionTo## \
60  baseType##Table_##lookupName##_(#lookupName)
61 
62 
63 //- Add lookup alias for runTime member selection.
64 #define addAliasToMemberFunctionSelectionTable\
65 (baseType,thisType,funcName,argNames,lookup,other,ver) \
66  \
67  /* Add thisType funcName to the table, find by lookup name */ \
68  baseType::addAlias##funcName##argNames##MemberFunctionToTable<thisType> \
69  add##thisType##funcName##argNames##MemberFunctionTo##baseType##Table_ \
70  ##lookup##_##other##_(#lookup,#other,ver)
71 
72 
73 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
74 
75 //- Add to hash-table of functions with typeName as the key.
76 // Use when baseType doesn't need a template argument (eg, is a typedef)
77 #define addTemplateToMemberFunctionSelectionTable\
78 (baseType,thisType,Targ,funcName,argNames) \
79  \
80  /* Add thisType funcName to the table */ \
81  baseType::add##funcName##argNames##MemberFunctionToTable<thisType<Targ>> \
82  add##thisType##Targ##funcName##argNames##MemberFunctionTo## \
83  baseType##Table_
84 
85 
86 //- Add to hash-table of functions with 'lookupName' as the key.
87 // Use when baseType doesn't need a template argument (eg, is a typedef)
88 #define addNamedTemplateToMemberFunctionSelectionTable\
89 (baseType,thisType,Targ,funcName,argNames,lookupName) \
90  \
91  /* Add thisType funcName to the table, find by lookupName */ \
92  baseType::add##funcName##argNames##MemberFunctionToTable<thisType<Targ>> \
93  add##thisType##Targ##funcName##argNames##MemberFunctionTo## \
94  baseType##Table_##lookupName##_(#lookupName)
95 
96 
97 //- Add lookup alias for runTime member selection.
98 #define addAliasTemplateToMemberFunctionSelectionTable\
99 (baseType,thisType,Targ,funcName,argNames,lookup,other,ver) \
100  \
101  /* Add thisType funcName to the table, find by lookup name */ \
102  baseType::addAlias##funcName##argNames##MemberFunctionToTable \
103  <thisType<Targ>> \
104  add##thisType##Targ##funcName##argNames##MemberFunctionTo##baseType \
105  ##lookup##_##other##_(#lookup,#other,ver)
106 
107 
108 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
109 
110 //- Add to hash-table of functions with typeName as the key.
111 // Use when baseType requires the Targ template argument as well
112 #define addTemplatedToMemberFunctionSelectionTable\
113 (baseType,thisType,Targ,funcName,argNames) \
114  \
115  /* Add thisType funcName to the table */ \
116  baseType<Targ>::add##funcName##argNames##MemberFunctionToTable \
117  <thisType<Targ>> \
118  add##thisType##Targ##funcName##argNames##MemberFunctionTo## \
119  baseType##Targ##Table_
120 
121 //- Add to hash-table of functions with 'lookupName' as the key.
122 // Use when baseType requires the Targ template argument as well
123 #define addNamedTemplatedToMemberFunctionSelectionTable\
124 (baseType,thisType,Targ,funcName,argNames,lookupName) \
125  \
126  /* Add thisType funcName to the table, find by lookupName */ \
127  baseType<Targ>::add##funcName##argNames##MemberFunctionToTable \
128  <thisType<Targ>> \
129  add##thisType##Targ##funcName##argNames##MemberFunctionTo## \
130  baseType##Targ##Table_##lookupName##_(#lookupName)
131 
132 //- Add lookup alias for runTime member selection.
133 #define addAliasTemplatedToMemberFunctionSelectionTable\
134 (baseType,thisType,Targ,funcName,argNames,lookup,other,ver) \
135  \
136  /* Add thisType funcName to the table, find by lookup name */ \
137  baseType<Targ>::addAlias##funcName##argNames##MemberFunctionToTable \
138  <thisType<Targ>> \
139  add##thisType##Targ##funcName##argNames##MemberFunctionTo##baseType## \
140  Targ##Table_##lookup##_##other##_(#lookup,#other,ver)
141 
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 
145 #endif
146 
147 // ************************************************************************* //
addNamedTemplateToMemberFunctionSelectionTable
#define addNamedTemplateToMemberFunctionSelectionTable(baseType, thisType, Targ, funcName, argNames, lookupName)
Add to hash-table of functions with 'lookupName' as the key.
Definition: addToMemberFunctionSelectionTable.H:88
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
addNamedTemplatedToMemberFunctionSelectionTable
#define addNamedTemplatedToMemberFunctionSelectionTable(baseType, thisType, Targ, funcName, argNames, lookupName)
Add to hash-table of functions with 'lookupName' as the key.
Definition: addToMemberFunctionSelectionTable.H:123
addTemplatedToMemberFunctionSelectionTable
#define addTemplatedToMemberFunctionSelectionTable(baseType, thisType, Targ, funcName, argNames)
Add to hash-table of functions with typeName as the key.
Definition: addToMemberFunctionSelectionTable.H:112
addTemplateToMemberFunctionSelectionTable
#define addTemplateToMemberFunctionSelectionTable(baseType, thisType, Targ, funcName, argNames)
Add to hash-table of functions with typeName as the key.
Definition: addToMemberFunctionSelectionTable.H:77