BarycentricTensorI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2017-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
27 
28 template<class Cmpt>
30 {}
31 
32 
33 template<class Cmpt>
35 :
37 {}
38 
39 
40 template<class Cmpt>
42 (
43  const Barycentric<Cmpt>& x,
44  const Barycentric<Cmpt>& y,
45  const Barycentric<Cmpt>& z
46 )
47 {
48  this->v_[XA] = x.a();
49  this->v_[XB] = x.b();
50  this->v_[XC] = x.c();
51  this->v_[XD] = x.d();
52 
53  this->v_[YA] = y.a();
54  this->v_[YB] = y.b();
55  this->v_[YC] = y.c();
56  this->v_[YD] = y.d();
57 
58  this->v_[ZA] = z.a();
59  this->v_[ZB] = z.b();
60  this->v_[ZC] = z.c();
61  this->v_[ZD] = z.d();
62 }
63 
64 
65 template<class Cmpt>
67 (
68  const Vector<Cmpt>& a,
69  const Vector<Cmpt>& b,
70  const Vector<Cmpt>& c,
71  const Vector<Cmpt>& d
72 )
73 {
74  this->v_[XA] = a.x();
75  this->v_[XB] = b.x();
76  this->v_[XC] = c.x();
77  this->v_[XD] = d.x();
78 
79  this->v_[YA] = a.y();
80  this->v_[YB] = b.y();
81  this->v_[YC] = c.y();
82  this->v_[YD] = d.y();
83 
84  this->v_[ZA] = a.z();
85  this->v_[ZB] = b.z();
86  this->v_[ZC] = c.z();
87  this->v_[ZD] = d.z();
88 }
89 
90 
91 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
92 
93 template<class Cmpt>
95 {
96  return
98  (
99  this->v_[XA],
100  this->v_[XB],
101  this->v_[XC],
102  this->v_[XD]
103  );
104 }
105 
106 
107 template<class Cmpt>
109 {
110  return
112  (
113  this->v_[YA],
114  this->v_[YB],
115  this->v_[YC],
116  this->v_[YD]
117  );
118 }
119 
120 
121 template<class Cmpt>
123 {
124  return
126  (
127  this->v_[ZA],
128  this->v_[ZB],
129  this->v_[ZC],
130  this->v_[ZD]
131  );
132 }
133 
134 
135 template<class Cmpt>
137 {
138  return Vector<Cmpt>(this->v_[XA], this->v_[YA], this->v_[ZA]);
139 }
140 
141 
142 template<class Cmpt>
144 {
145  return Vector<Cmpt>(this->v_[XB], this->v_[YB], this->v_[ZB]);
146 }
147 
148 
149 template<class Cmpt>
151 {
152  return Vector<Cmpt>(this->v_[XC], this->v_[YC], this->v_[ZC]);
153 }
154 
155 
156 template<class Cmpt>
158 {
159  return Vector<Cmpt>(this->v_[XD], this->v_[YD], this->v_[ZD]);
160 }
161 
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 namespace Foam
166 {
167 
168 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
169 
170 template<class Cmpt>
171 inline Vector<Cmpt> operator&
172 (
173  const BarycentricTensor<Cmpt>& T,
174  const Barycentric<Cmpt>& b
175 )
176 {
177  return Vector<Cmpt>(T.x() & b, T.y() & b, T.z() & b);
178 }
179 
180 
181 template<class Cmpt>
182 inline Barycentric<Cmpt> operator&
183 (
184  const Vector<Cmpt>& v,
186 )
187 {
188  return Barycentric<Cmpt>(v & T.a(), v & T.b(), v & T.c(), v & T.d());
189 }
190 
191 
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 
194 } // End namespace Foam
195 
196 // ************************************************************************* //
scalar y
Templated 4x3 tensor derived from VectorSpace. Has 12 components. Can represent a barycentric transfo...
Barycentric< Cmpt > y() const
Vector< Cmpt > d() const
Vector< Cmpt > b() const
Vector< Cmpt > c() const
BarycentricTensor()
Construct null.
Barycentric< Cmpt > z() const
Barycentric< Cmpt > x() const
Vector< Cmpt > a() const
Templated 3D Barycentric derived from VectorSpace. Has 4 components, one of which is redundant.
Definition: Barycentric.H:53
const Cmpt & a() const
Definition: BarycentricI.H:59
const Cmpt & b() const
Definition: BarycentricI.H:66
const Cmpt & c() const
Definition: BarycentricI.H:73
const Cmpt & d() const
Definition: BarycentricI.H:80
Templated matrix space.
Definition: MatrixSpace.H:58
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
Definition: Vector.H:60
const Cmpt & z() const
Definition: VectorI.H:87
const Cmpt & y() const
Definition: VectorI.H:81
const Cmpt & x() const
Definition: VectorI.H:75
A class representing the concept of 0 used to avoid unnecessary manipulations for objects that are kn...
Definition: zero.H:50
volScalarField & b
Definition: createFields.H:25
const dimensionedScalar c
Speed of light in a vacuum.
Namespace for OpenFOAM.
static const zero Zero
Definition: zero.H:97
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)