FreeFOAM The Cross-Platform CFD Toolkit
SphericalTensor2DI_.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 | Copyright (C) 1991-2010 OpenCFD Ltd.
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 #include <OpenFOAM/Vector2D_.H>
27 
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32 
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 
35 // Construct null
36 template <class Cmpt>
38 {}
39 
40 
41 // Construct given VectorSpace
42 template <class Cmpt>
44 (
45  const VectorSpace<SphericalTensor2D<Cmpt>, Cmpt, 1>& vs
46 )
47 :
49 {}
50 
51 
52 // Construct given three Cmpts
53 template <class Cmpt>
55 {
56  this->v_[II] = stii;
57 }
58 
59 
60 // Construct from Istream
61 template <class Cmpt>
63 :
64  VectorSpace<SphericalTensor2D<Cmpt>, Cmpt, 1>(is)
65 {}
66 
67 
68 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
69 
70 template <class Cmpt>
71 inline const Cmpt& SphericalTensor2D<Cmpt>::ii() const
72 {
73  return this->v_[II];
74 }
75 
76 
77 template <class Cmpt>
79 {
80  return this->v_[II];
81 }
82 
83 
84 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
85 
86 //- Inner-product between two spherical tensors
87 template <class Cmpt>
89 operator&
90 (
91  const SphericalTensor2D<Cmpt>& st1,
92  const SphericalTensor2D<Cmpt>& st2
93 )
94 {
95  return SphericalTensor2D<Cmpt>(st1.ii()*st2.ii());
96 }
97 
98 
99 //- Inner-product between a spherical tensor and a vector
100 template <class Cmpt>
101 inline Vector2D<Cmpt>
103 {
104  return Vector2D<Cmpt>
105  (
106  st.ii()*v.x(),
107  st.ii()*v.y()
108  );
109 }
110 
111 
112 //- Inner-product between a vector and a spherical tensor
113 template <class Cmpt>
114 inline Vector2D<Cmpt>
116 {
117  return Vector2D<Cmpt>
118  (
119  v.x()*st.ii(),
120  v.y()*st.ii()
121  );
122 }
123 
124 
125 //- Division of a scalar by a sphericalTensor2D
126 template <class Cmpt>
127 inline SphericalTensor2D<Cmpt>
128 operator/(const scalar s, const SphericalTensor2D<Cmpt>& st)
129 {
130  return SphericalTensor2D<Cmpt>(s/st.ii());
131 }
132 
133 
134 //- Return the trace of a spherical tensor
135 template <class Cmpt>
136 inline Cmpt tr(const SphericalTensor2D<Cmpt>& st)
137 {
138  return 2*st.ii();
139 }
140 
141 
142 //- Return the spherical part of a spherical tensor, i.e. itself
143 template <class Cmpt>
145 {
146  return st;
147 }
148 
149 
150 //- Return the determinant of a spherical tensor
151 template <class Cmpt>
152 inline Cmpt det(const SphericalTensor2D<Cmpt>& st)
153 {
154  return st.ii()*st.ii();
155 }
156 
157 
158 //- Return the inverse of a symmetric tensor
159 template <class Cmpt>
161 {
162  return SphericalTensor2D<Cmpt>(1.0/st.ii());
163 }
164 
165 
166 template<class Cmpt>
167 class outerProduct<SphericalTensor2D<Cmpt>, Cmpt>
168 {
169 public:
170 
172 };
173 
174 template<class Cmpt>
175 class outerProduct<Cmpt, SphericalTensor2D<Cmpt> >
176 {
177 public:
178 
180 };
181 
182 
183 template<class Cmpt>
185 {
186 public:
187 
189 };
190 
191 
192 template<class Cmpt>
194 {
195 public:
196 
198 };
199 
200 template<class Cmpt>
202 {
203 public:
204 
206 };
207 
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 } // End namespace Foam
212 
213 // ************************ vim: set sw=4 sts=4 et: ************************ //