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 3D symmetric tensor derived from VectorSpace adding construction
29 from 6 components, element access using xx(), xy() etc. member functions
30 and the inner-product (dot-product) and outer-product of two Vectors
31 (tensor-product) operators.
36 \*---------------------------------------------------------------------------*/
38 #ifndef SymmTensorTemplate_H
39 #define SymmTensorTemplate_H
41 #include "VectorSpace.H"
42 #include "SphericalTensorTemplate.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 /*---------------------------------------------------------------------------*\
50 Class SymmTensor Declaration
51 \*---------------------------------------------------------------------------*/
56 public VectorSpace<SymmTensor<Cmpt>, Cmpt, 6>
61 //- Equivalent type of labels used for valid component indexing
62 typedef SymmTensor<label> labelType;
69 rank = 2 // Rank of SymmTensor is 2
73 // Static data members
75 static const char* const typeName;
76 static const char* componentNames[];
78 static const SymmTensor zero;
79 static const SymmTensor one;
80 static const SymmTensor max;
81 static const SymmTensor min;
84 //- Component labeling enumeration
85 enum components { XX, XY, XZ, YY, YZ, ZZ };
93 //- Construct given VectorSpace
94 inline SymmTensor(const VectorSpace<SymmTensor<Cmpt>, Cmpt, 6>&);
96 //- Construct given SphericalTensor
97 inline SymmTensor(const SphericalTensor<Cmpt>&);
99 //- Construct given the six components
102 const Cmpt txx, const Cmpt txy, const Cmpt txz,
103 const Cmpt tyy, const Cmpt tyz,
107 //- Construct from Istream
108 SymmTensor(Istream&);
115 inline const Cmpt& xx() const;
116 inline const Cmpt& xy() const;
117 inline const Cmpt& xz() const;
118 inline const Cmpt& yy() const;
119 inline const Cmpt& yz() const;
120 inline const Cmpt& zz() const;
130 inline const SymmTensor<Cmpt>& T() const;
135 //- Construct given SphericalTensor
136 inline void operator=(const SphericalTensor<Cmpt>&);
141 class symmTypeOfRank<Cmpt, 2>
145 typedef SymmTensor<Cmpt> type;
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 } // End namespace Foam
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 // Include inline implementations
156 #include "SymmTensorTemplateI.H"
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 // ************************************************************************* //