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) 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 "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>
78 inline Cmpt& SphericalTensor2D<Cmpt>::ii()
79 {
80  return this->v_[II];
81 }
82 
83 
84 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
85 
86 //- Inner-product between two spherical tensors
87 template<class Cmpt>
88 inline SphericalTensor2D<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 // ************************************************************************* //
Foam::innerProduct< SphericalTensor2D< Cmpt >, SphericalTensor2D< Cmpt > >::type
SphericalTensor2D< Cmpt > type
Definition: SphericalTensor2DI.H:188
Foam::operator&
tmp< GeometricField< Type, fvPatchField, volMesh > > operator&(const fvMatrix< Type > &, const DimensionedField< Type, volMesh > &)
Foam::innerProduct
Definition: products.H:89
Foam::Vector2D
Templated 2D Vector derived from VectorSpace adding construction from 2 components,...
Definition: Vector2D.H:51
Foam::VectorSpace
Templated vector space.
Definition: VectorSpace.H:52
Foam::Vector2D::y
const Cmpt & y() const
Definition: Vector2DI.H:73
Vector2D.H
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::inv
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
Definition: dimensionedSphericalTensor.C:71
Foam::Vector2D::x
const Cmpt & x() const
Definition: Vector2DI.H:67
Foam::sph
SphericalTensor< Cmpt > sph(const DiagTensor< Cmpt > &dt)
Return the spherical part of a diagonal tensor.
Definition: DiagTensorI.H:281
Foam::outerProduct< SphericalTensor2D< Cmpt >, Cmpt >::type
SphericalTensor2D< Cmpt > type
Definition: SphericalTensor2DI.H:171
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
s
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))
Foam::operator/
dimensionedScalar operator/(const scalar s1, const dimensionedScalar &ds2)
Definition: dimensionedScalar.C:65
Foam::innerProduct< Vector2D< Cmpt >, SphericalTensor2D< Cmpt > >::type
Vector2D< Cmpt > type
Definition: SphericalTensor2DI.H:205
Foam::outerProduct< Cmpt, SphericalTensor2D< Cmpt > >::type
SphericalTensor2D< Cmpt > type
Definition: SphericalTensor2DI.H:179
Foam::SphericalTensor2D::ii
const Cmpt & ii() const
Definition: SphericalTensor2DI.H:71
Foam::tr
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
Definition: dimensionedSphericalTensor.C:49
Foam::det
dimensionedScalar det(const dimensionedSphericalTensor &dt)
Definition: dimensionedSphericalTensor.C:60
Foam::SphericalTensor2D::SphericalTensor2D
SphericalTensor2D()
Construct null.
Definition: SphericalTensor2DI.H:37
Foam::innerProduct< SphericalTensor2D< Cmpt >, Vector2D< Cmpt > >::type
Vector2D< Cmpt > type
Definition: SphericalTensor2DI.H:197
Foam::outerProduct
Definition: products.H:64
Foam::SphericalTensor2D
Templated 2D sphericalTensor derived from VectorSpace adding construction from 1 component,...
Definition: SphericalTensor2D.H:51