1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, 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 \*---------------------------------------------------------------------------*/
42 #include "SphericalTensor2D.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;
133 inline Tensor2D<Cmpt> T() const;
138 //- Copy SphericalTensor2D
139 inline void operator=(const SphericalTensor2D<Cmpt>&);
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 } // End namespace Foam
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 // Include inline implementations
150 #include "Tensor2DI.H"
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 // ************************************************************************* //