SphericalTensorI.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) 2011-2013 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 #include "Vector.H"
27 
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32 
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 
35 template<class Cmpt>
37 {}
38 
39 
40 template<class Cmpt>
41 template<class Cmpt2>
43 (
44  const VectorSpace<SphericalTensor<Cmpt2>, Cmpt2, 1>& vs
45 )
46 :
48 {}
49 
50 
51 template<class Cmpt>
53 {
54  this->v_[II] = stii;
55 }
56 
57 
58 template<class Cmpt>
60 :
61  VectorSpace<SphericalTensor<Cmpt>, Cmpt, 1>(is)
62 {}
63 
64 
65 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
66 
67 template<class Cmpt>
68 inline const Cmpt& SphericalTensor<Cmpt>::ii() const
69 {
70  return this->v_[II];
71 }
72 
73 
74 template<class Cmpt>
76 {
77  return this->v_[II];
78 }
79 
80 
81 template<class Cmpt>
83 {
84  return *this;
85 }
86 
87 
88 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
89 
90 //- Inner-product between two spherical tensors
91 template<class Cmpt>
94 {
95  return SphericalTensor<Cmpt>(st1.ii()*st2.ii());
96 }
97 
98 
99 //- Inner-product between a spherical tensor and a vector
100 template<class Cmpt>
101 inline Vector<Cmpt>
103 {
104  return Vector<Cmpt>
105  (
106  st.ii()*v.x(),
107  st.ii()*v.y(),
108  st.ii()*v.z()
109  );
110 }
111 
112 
113 //- Inner-product between a vector and a spherical tensor
114 template<class Cmpt>
115 inline Vector<Cmpt>
117 {
118  return Vector<Cmpt>
119  (
120  v.x()*st.ii(),
121  v.y()*st.ii(),
122  v.z()*st.ii()
123  );
124 }
125 
126 
127 //- Double-dot-product between a spherical tensor and a spherical tensor
128 template<class Cmpt>
129 inline Cmpt
131 {
132  return 3*st1.ii()*st2.ii();
133 }
134 
135 
136 //- Division of a scalar by a sphericalTensor
137 template<class Cmpt>
139 operator/(const scalar s, const SphericalTensor<Cmpt>& st)
140 {
141  return SphericalTensor<Cmpt>(s/st.ii());
142 }
143 
144 
145 template<class Cmpt>
146 inline Cmpt magSqr(const SphericalTensor<Cmpt>& st)
147 {
148  return 3*magSqr(st.ii());
149 }
150 
151 
152 //- Return the trace of a spherical tensor
153 template<class Cmpt>
154 inline Cmpt tr(const SphericalTensor<Cmpt>& st)
155 {
156  return 3*st.ii();
157 }
158 
159 
160 //- Return the spherical part of a spherical tensor, i.e. itself
161 template<class Cmpt>
163 {
164  return st;
165 }
166 
167 
168 //- Return the determinant of a spherical tensor
169 template<class Cmpt>
170 inline Cmpt det(const SphericalTensor<Cmpt>& st)
171 {
172  return st.ii()*st.ii()*st.ii();
173 }
174 
175 
176 //- Return the inverse of a spherical tensor
177 template<class Cmpt>
179 {
180  return SphericalTensor<Cmpt>(1.0/st.ii());
181 }
182 
183 
184 template<class Cmpt>
185 class outerProduct<SphericalTensor<Cmpt>, Cmpt>
186 {
187 public:
188 
190 };
191 
192 template<class Cmpt>
193 class outerProduct<Cmpt, SphericalTensor<Cmpt> >
194 {
195 public:
196 
198 };
199 
200 
201 template<class Cmpt>
203 {
204 public:
205 
207 };
208 
209 
210 template<class Cmpt>
211 class innerProduct<SphericalTensor<Cmpt>, Vector<Cmpt> >
212 {
213 public:
214 
216 };
217 
218 template<class Cmpt>
219 class innerProduct<Vector<Cmpt>, SphericalTensor<Cmpt> >
220 {
221 public:
222 
224 };
225 
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 } // End namespace Foam
230 
231 // ************************************************************************* //
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject( name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE ))
tmp< GeometricField< Type, fvPatchField, volMesh > > operator&(const fvMatrix< Type > &, const DimensionedField< Type, volMesh > &)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
const SphericalTensor< Cmpt > & T() const
Transpose.
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
Templated 3D SphericalTensor derived from VectorSpace adding construction from 1 component, element access using th ii() member function and the inner-product (dot-product) and outer-product operators.
Templated 3D Vector derived from VectorSpace adding construction from 3 components, element access using x(), y() and z() member functions and the inner-product (dot-product) and cross product operators.
Definition: Vector.H:57
Namespace for OpenFOAM.
SphericalTensor()
Construct null.
const Cmpt & ii() const
const Cmpt & y() const
Definition: VectorI.H:71
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
Cmpt v_[nCmpt]
The components of this vector space.
Definition: VectorSpace.H:95
dimensionedScalar operator/(const scalar s1, const dimensionedScalar &ds2)
dimensionedScalar det(const dimensionedSphericalTensor &dt)
const Cmpt & x() const
Definition: VectorI.H:65
const Cmpt & z() const
Definition: VectorI.H:77
SphericalTensor< Cmpt > sph(const DiagTensor< Cmpt > &dt)
Return the spherical part of a diagonal tensor.
Definition: DiagTensorI.H:281
Templated vector space.
Definition: VectorSpace.H:52
dimensioned< typename scalarProduct< Type1, Type2 >::type > operator&&(const dimensioned< Type1 > &, const dimensioned< Type2 > &)