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 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 \*---------------------------------------------------------------------------*/
41 #include "VectorSpace.H"
42 #include "SphericalTensor.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 "SymmTensorI.H"
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 // ************************************************************************* //