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 3D tensor derived from VectorSpace adding construction from
30 9 components, element access using xx(), xy() etc. member functions and
31 the inner-product (dot-product) and outer-product of two Vectors
32 (tensor-product) operators.
37 \*---------------------------------------------------------------------------*/
43 #include "SphericalTensor.H"
44 #include "SymmTensor.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 /*---------------------------------------------------------------------------*\
52 Class Tensor Declaration
53 \*---------------------------------------------------------------------------*/
58 public VectorSpace<Tensor<Cmpt>, Cmpt, 9>
63 //- Equivalent type of labels used for valid component indexing
64 typedef Tensor<label> labelType;
71 rank = 2 // Rank of Tensor is 2
75 // Static data members
77 static const char* const typeName;
78 static const char* componentNames[];
80 static const Tensor zero;
81 static const Tensor one;
82 static const Tensor max;
83 static const Tensor min;
86 //- Component labeling enumeration
87 enum components { XX, XY, XZ, YX, YY, YZ, ZX, ZY, ZZ };
95 //- Construct given VectorSpace
96 inline Tensor(const VectorSpace<Tensor<Cmpt>, Cmpt, 9>&);
98 //- Construct given SphericalTensor
99 inline Tensor(const SphericalTensor<Cmpt>&);
101 //- Construct given SymmTensor
102 inline Tensor(const SymmTensor<Cmpt>&);
104 //- Construct given the nine components
107 const Cmpt txx, const Cmpt txy, const Cmpt txz,
108 const Cmpt tyx, const Cmpt tyy, const Cmpt tyz,
109 const Cmpt tzx, const Cmpt tzy, const Cmpt tzz
112 //- Construct from Istream
120 inline const Vector<Cmpt>& x() const;
121 inline const Vector<Cmpt>& y() const;
122 inline const Vector<Cmpt>& z() const;
124 inline Vector<Cmpt>& x();
125 inline Vector<Cmpt>& y();
126 inline Vector<Cmpt>& z();
128 inline const Cmpt& xx() const;
129 inline const Cmpt& xy() const;
130 inline const Cmpt& xz() const;
131 inline const Cmpt& yx() const;
132 inline const Cmpt& yy() const;
133 inline const Cmpt& yz() const;
134 inline const Cmpt& zx() const;
135 inline const Cmpt& zy() const;
136 inline const Cmpt& zz() const;
149 inline Tensor<Cmpt> T() const;
154 //- Assign to a SphericalTensor
155 inline void operator=(const SphericalTensor<Cmpt>&);
157 //- Assign to a SymmTensor
158 inline void operator=(const SymmTensor<Cmpt>&);
163 class typeOfRank<Cmpt, 2>
167 typedef Tensor<Cmpt> type;
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 } // End namespace Foam
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 // Include inline implementations
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 // ************************************************************************* //