Remove trailing whitespace systematically
[foam-extend-3.2.git] / src / foam / primitives / SphericalTensor2D / SphericalTensor2DI.H
blobc6a06b1d194d9cd7e5c47613d6e04ca3095a61d9
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     |
5     \\  /    A nd           | For copyright notice see file Copyright
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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 \*---------------------------------------------------------------------------*/
26 #include "Vector2D.H"
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 namespace Foam
33 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
35 // Construct null
36 template <class Cmpt>
37 inline SphericalTensor2D<Cmpt>::SphericalTensor2D()
41 // Construct given VectorSpace
42 template <class Cmpt>
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
53 template <class Cmpt>
54 inline SphericalTensor2D<Cmpt>::SphericalTensor2D(const Cmpt& stii)
56     this->v_[II] = stii;
60 // Construct from Istream
61 template <class Cmpt>
62 inline SphericalTensor2D<Cmpt>::SphericalTensor2D(Istream& is)
64     VectorSpace<SphericalTensor2D<Cmpt>, Cmpt, 1>(is)
68 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
70 template <class Cmpt>
71 inline const Cmpt&  SphericalTensor2D<Cmpt>::ii() const
73     return this->v_[II];
77 template <class Cmpt>
78 inline Cmpt& SphericalTensor2D<Cmpt>::ii()
80     return this->v_[II];
84 // * * * * * * * * * * * * * * * Global Operators  * * * * * * * * * * * * * //
86 //- Inner-product between two spherical tensors
87 template <class Cmpt>
88 inline SphericalTensor2D<Cmpt>
89 operator&
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>
105     (
106         st.ii()*v.x(),
107                        st.ii()*v.y()
108     );
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>
118     (
119         v.x()*st.ii(),
120                        v.y()*st.ii()
121     );
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)
138     return 2*st.ii();
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)
146     return 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());
166 template<class Cmpt>
167 class outerProduct<SphericalTensor2D<Cmpt>, Cmpt>
169 public:
171     typedef SphericalTensor2D<Cmpt> type;
174 template<class Cmpt>
175 class outerProduct<Cmpt, SphericalTensor2D<Cmpt> >
177 public:
179     typedef SphericalTensor2D<Cmpt> type;
183 template<class Cmpt>
184 class innerProduct<SphericalTensor2D<Cmpt>, SphericalTensor2D<Cmpt> >
186 public:
188     typedef SphericalTensor2D<Cmpt> type;
192 template<class Cmpt>
193 class innerProduct<SphericalTensor2D<Cmpt>, Vector2D<Cmpt> >
195 public:
197     typedef Vector2D<Cmpt> type;
200 template<class Cmpt>
201 class innerProduct<Vector2D<Cmpt>, SphericalTensor2D<Cmpt> >
203 public:
205     typedef Vector2D<Cmpt> type;
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 } // End namespace Foam
213 // ************************************************************************* //