1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Templated 2D tensor derived from VectorSpace adding construction from
30 4 components, element access using xx(), xy(), yx() and yy() member
31 functions and the iner-product (dot-product) and outer-product of two
32 Vector2Ds (tensor-product) operators.
37 \*---------------------------------------------------------------------------*/
43 #include "SphericalTensor2D.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 /*---------------------------------------------------------------------------*\
51 Class Tensor2D Declaration
52 \*---------------------------------------------------------------------------*/
57 public VectorSpace<Tensor2D<Cmpt>, Cmpt, 4>
66 rank = 2 // Rank of Tensor2D is 2
70 // Static data members
72 static const char* const typeName;
73 static const char* componentNames[];
75 static const Tensor2D zero;
76 static const Tensor2D one;
77 static const Tensor2D max;
78 static const Tensor2D min;
81 //- Component labeling enumeration
82 enum components { XX, XY, YX, YY };
90 //- Construct given VectorSpace
91 inline Tensor2D(const VectorSpace<Tensor2D<Cmpt>, Cmpt, 4>&);
93 //- Construct given SphericalTensor2D
94 inline Tensor2D(const SphericalTensor2D<Cmpt>&);
96 //- Construct given the nine components
99 const Cmpt txx, const Cmpt txy,
100 const Cmpt tyx, const Cmpt tyy
103 //- Construct from Istream
111 inline const Vector2D<Cmpt>& x() const;
112 inline const Vector2D<Cmpt>& y() const;
114 inline Vector2D<Cmpt>& x();
115 inline Vector2D<Cmpt>& y();
117 inline const Cmpt& xx() const;
118 inline const Cmpt& xy() const;
119 inline const Cmpt& yx() const;
120 inline const Cmpt& yy() const;
128 inline Tensor2D<Cmpt> T() const;
133 //- Copy SphericalTensor2D
134 inline void operator=(const SphericalTensor2D<Cmpt>&);
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 } // End namespace Foam
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 // Include inline implementations
145 #include "Tensor2DI.H"
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 // ************************************************************************* //