1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
5 \\ / A nd | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37 inline SphericalTensor2D<Cmpt>::SphericalTensor2D()
41 // Construct given VectorSpace
43 inline SphericalTensor2D<Cmpt>::SphericalTensor2D
45 const VectorSpace<SphericalTensor2D<Cmpt>, Cmpt, 1>& vs
48 VectorSpace<SphericalTensor2D<Cmpt>, Cmpt, 1>(vs)
52 // Construct given three Cmpts
54 inline SphericalTensor2D<Cmpt>::SphericalTensor2D(const Cmpt& stii)
60 // Construct from Istream
62 inline SphericalTensor2D<Cmpt>::SphericalTensor2D(Istream& is)
64 VectorSpace<SphericalTensor2D<Cmpt>, Cmpt, 1>(is)
68 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
71 inline const Cmpt& SphericalTensor2D<Cmpt>::ii() const
78 inline Cmpt& SphericalTensor2D<Cmpt>::ii()
84 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
86 //- Inner-product between two spherical tensors
88 inline SphericalTensor2D<Cmpt>
91 const SphericalTensor2D<Cmpt>& st1,
92 const SphericalTensor2D<Cmpt>& st2
95 return SphericalTensor2D<Cmpt>(st1.ii()*st2.ii());
99 //- Inner-product between a spherical tensor and a vector
100 template <class Cmpt>
101 inline Vector2D<Cmpt>
102 operator&(const SphericalTensor2D<Cmpt>& st, const Vector2D<Cmpt>& v)
104 return Vector2D<Cmpt>
112 //- Inner-product between a vector and a spherical tensor
113 template <class Cmpt>
114 inline Vector2D<Cmpt>
115 operator&(const Vector2D<Cmpt>& v, const SphericalTensor2D<Cmpt>& st)
117 return Vector2D<Cmpt>
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)
130 return SphericalTensor2D<Cmpt>(s/st.ii());
134 //- Return the trace of a spherical tensor
135 template <class Cmpt>
136 inline Cmpt tr(const SphericalTensor2D<Cmpt>& st)
142 //- Return the spherical part of a spherical tensor, i.e. itself
143 template <class Cmpt>
144 inline SphericalTensor2D<Cmpt> sph(const SphericalTensor2D<Cmpt>& st)
150 //- Return the determinant of a spherical tensor
151 template <class Cmpt>
152 inline Cmpt det(const SphericalTensor2D<Cmpt>& st)
154 return st.ii()*st.ii();
158 //- Return the inverse of a symmetric tensor
159 template <class Cmpt>
160 inline SphericalTensor2D<Cmpt> inv(const SphericalTensor2D<Cmpt>& st)
162 return SphericalTensor2D<Cmpt>(1.0/st.ii());
167 class outerProduct<SphericalTensor2D<Cmpt>, Cmpt>
171 typedef SphericalTensor2D<Cmpt> type;
175 class outerProduct<Cmpt, SphericalTensor2D<Cmpt> >
179 typedef SphericalTensor2D<Cmpt> type;
184 class innerProduct<SphericalTensor2D<Cmpt>, SphericalTensor2D<Cmpt> >
188 typedef SphericalTensor2D<Cmpt> type;
193 class innerProduct<SphericalTensor2D<Cmpt>, Vector2D<Cmpt> >
197 typedef Vector2D<Cmpt> type;
201 class innerProduct<Vector2D<Cmpt>, SphericalTensor2D<Cmpt> >
205 typedef Vector2D<Cmpt> type;
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 } // End namespace Foam
213 // ************************************************************************* //