products.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) 2019 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 InNamespace
28  Foam
29 
30 Description
31  Traits classes for inner and outer products of primitives.
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef products_H
36 #define products_H
37 
38 #include "direction.H"
39 #include "pTraits.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 //- Abstract template class to provide the form resulting from
49 //- the inner-product of two forms
50 template<class Cmpt, class Form1, class Form2>
52 {};
53 
54 //- Abstract template class to provide the form resulting from
55 //- the outer-product of two forms
56 template<class Cmpt, class Form1, class Form2>
58 {};
59 
60 //- Abstract template class to provide the transpose form of a form
61 template<class Cmpt, class Form>
63 {};
64 
65 
66 template<class Cmpt, direction rank>
68 {};
69 
70 
71 template<class Cmpt, direction rank>
73 {};
74 
75 
76 //- The extended precision type (solveScalar for float)
77 template<class Type>
79 {
80 public:
81 
82  typedef Type type;
83 };
84 
85 
86 //- The magnitude type for given argument.
87 template<class arg1>
88 class typeOfMag
89 {
90 public:
91 
92  typedef typename pTraits<typename pTraits<arg1>::cmptType>::magType type;
93 };
94 
95 
96 template<class arg1, class arg2>
97 class typeOfSum
98 {
99 public:
100 
101  typedef arg1 type;
102 };
103 
104 
105 template<class arg1, class arg2>
107 {
108 public:
109 
110  typedef typename typeOfRank
111  <
112  typename pTraits<arg1>::cmptType,
115 };
116 
117 
118 //- Outer-product of identical types
119 template<class arg1>
121 :
122  public outerProduct<arg1, arg1>
123 {
124 public:
125 };
126 
127 
128 template<class arg1, class arg2>
130 {
131 public:
132 
133  typedef typename typeOfRank
134  <
135  typename pTraits<arg2>::cmptType,
138 };
139 
140 template<class arg1, class arg2>
142 {
143 public:
144 
145  typedef typename typeOfRank
146  <
147  typename pTraits<arg1>::cmptType,
150 };
151 
152 template<class arg1, class arg2>
154 {
155 public:
156 
157  typedef typename pTraits<arg1>::cmptType type;
158 };
159 
160 
161 template<class arg1, direction arg2>
163 {
164 public:
165 
166  typedef typename symmTypeOfRank
167  <
168  typename pTraits<arg1>::cmptType,
171 };
172 
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 // Partial Specializations for non-VectorSpace quantities
177 
178 template<class Cmpt>
179 class typeOfRank<Cmpt, 0>
180 {
181 public:
182 
183  typedef Cmpt type;
184 };
185 
186 
187 template<class Cmpt>
188 class symmTypeOfRank<Cmpt, 0>
189 {
190 public:
191 
192  typedef Cmpt type;
193 };
194 
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 } // End namespace Foam
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 #endif
203 
204 // ************************************************************************* //
Foam::typeOfTranspose
Abstract template class to provide the transpose form of a form.
Definition: products.H:62
Foam::innerProduct
Definition: products.H:141
Foam::outerProduct< arg1, arg1 >::type
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg1 >::rank) >::type type
Definition: products.H:114
Foam::typeOfSum::type
arg1 type
Definition: products.H:101
Foam::typeOfRank< Cmpt, 0 >::type
Cmpt type
Definition: products.H:183
Foam::crossProduct
Definition: products.H:129
Foam::typeOfSolve
The extended precision type (solveScalar for float)
Definition: products.H:78
Foam::powProduct::type
symmTypeOfRank< typename pTraits< arg1 >::cmptType, arg2 *direction(pTraits< arg1 >::rank) >::type type
Definition: products.H:170
Foam::scalarProduct
Definition: products.H:153
Foam::typeOfSum
Definition: products.H:97
Foam::scalarProduct::type
pTraits< arg1 >::cmptType type
Definition: products.H:157
Foam::symmTypeOfRank< Cmpt, 0 >::type
Cmpt type
Definition: products.H:192
Foam::typeOfMag
The magnitude type for given argument.
Definition: products.H:88
pTraits.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::powProduct
Definition: products.H:162
Foam::crossProduct::type
typeOfRank< typename pTraits< arg2 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) - 1 >::type type
Definition: products.H:137
Foam::symmTypeOfRank
Definition: products.H:72
Foam::typeOfRank
Definition: products.H:67
direction.H
Direction is an 8-bit unsigned integer type used to represent Cartesian directions,...
Foam::typeOfOuterProduct
Definition: products.H:57
Foam::pTraits
A traits class, which is primarily used for primitives.
Definition: pTraits.H:56
Foam::typeOfInnerProduct
Definition: products.H:51
Foam::direction
uint8_t direction
Definition: direction.H:52
Foam::typeOfSolve::type
Type type
Definition: products.H:82
Foam::outerProduct1
Outer-product of identical types.
Definition: products.H:120
Foam::typeOfMag::type
pTraits< typename pTraits< arg1 >::cmptType >::magType type
Definition: products.H:92
Foam::outerProduct
Definition: products.H:106
Foam::innerProduct< vector, Type >::type
typeOfRank< typename pTraits< vector >::cmptType, direction(pTraits< vector >::rank)+direction(pTraits< Type >::rank) - 2 >::type type
Definition: products.H:149