1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | 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/>.
28 Templated 2D tensor derived from VectorSpace adding construction from
29 4 components, element access using xx(), xy(), yx() and yy() member
30 functions and the iner-product (dot-product) and outer-product of two
31 Vector2Ds (tensor-product) operators.
36 \*---------------------------------------------------------------------------*/
38 #ifndef Tensor2DTemplate_H
39 #define Tensor2DTemplate_H
41 #include "Vector2DTemplate.H"
42 #include "SphericalTensor2DTemplate.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 /*---------------------------------------------------------------------------*\
50 Class Tensor2D Declaration
51 \*---------------------------------------------------------------------------*/
56 public VectorSpace<Tensor2D<Cmpt>, Cmpt, 4>
65 rank = 2 // Rank of Tensor2D is 2
69 // Static data members
71 static const char* const typeName;
72 static const char* componentNames[];
74 static const Tensor2D zero;
75 static const Tensor2D one;
76 static const Tensor2D max;
77 static const Tensor2D min;
80 //- Component labeling enumeration
81 enum components { XX, XY, YX, YY };
89 //- Construct given VectorSpace
90 inline Tensor2D(const VectorSpace<Tensor2D<Cmpt>, Cmpt, 4>&);
92 //- Construct given SphericalTensor2D
93 inline Tensor2D(const SphericalTensor2D<Cmpt>&);
95 //- Construct given the two vectors
98 const Vector2D<Cmpt>& x,
99 const Vector2D<Cmpt>& y
102 //- Construct given the four components
105 const Cmpt txx, const Cmpt txy,
106 const Cmpt tyx, const Cmpt tyy
109 //- Construct from Istream
117 inline const Cmpt& xx() const;
118 inline const Cmpt& xy() const;
119 inline const Cmpt& yx() const;
120 inline const Cmpt& yy() const;
127 // Access vector components.
129 inline Vector2D<Cmpt> x() const;
130 inline Vector2D<Cmpt> y() const;
132 //- Return (i, j) component. Consistency with VectorN
133 inline const Cmpt& operator()
139 //- Return access to (i, j) component. Consistency with VectorN
140 inline Cmpt& operator()
148 inline Tensor2D<Cmpt> T() const;
153 //- Copy SphericalTensor2D
154 inline void operator=(const SphericalTensor2D<Cmpt>&);
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 } // End namespace Foam
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 // Include inline implementations
165 #include "Tensor2DTemplateI.H"
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 // ************************************************************************* //