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