1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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 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 symmetric tensor derived from VectorSpace adding construction
30 from 6 components, element access using xx(), xy() etc. member functions
31 and the inner-product (dot-product) and outer-product of two Vectors
32 (tensor-product) operators.
37 \*---------------------------------------------------------------------------*/
42 #include <OpenFOAM/VectorSpace.H>
43 #include <OpenFOAM/SphericalTensor_.H>
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 /*---------------------------------------------------------------------------*\
51 Class SymmTensor Declaration
52 \*---------------------------------------------------------------------------*/
57 public VectorSpace<SymmTensor<Cmpt>, Cmpt, 6>
62 //- Equivalent type of labels used for valid component indexing
63 typedef SymmTensor<label> labelType;
70 rank = 2 // Rank of SymmTensor is 2
74 // Static data members
76 static const char* const typeName;
77 static const char* componentNames[];
79 static const SymmTensor zero;
80 static const SymmTensor one;
81 static const SymmTensor max;
82 static const SymmTensor min;
85 //- Component labeling enumeration
86 enum components { XX, XY, XZ, YY, YZ, ZZ };
94 //- Construct given VectorSpace
95 inline SymmTensor(const VectorSpace<SymmTensor<Cmpt>, Cmpt, 6>&);
97 //- Construct given SphericalTensor
98 inline SymmTensor(const SphericalTensor<Cmpt>&);
100 //- Construct given the six components
103 const Cmpt txx, const Cmpt txy, const Cmpt txz,
104 const Cmpt tyy, const Cmpt tyz,
108 //- Construct from Istream
109 SymmTensor(Istream&);
116 inline const Cmpt& xx() const;
117 inline const Cmpt& xy() const;
118 inline const Cmpt& xz() const;
119 inline const Cmpt& yy() const;
120 inline const Cmpt& yz() const;
121 inline const Cmpt& zz() const;
131 inline const SymmTensor<Cmpt>& T() const;
136 //- Construct given SphericalTensor
137 inline void operator=(const SphericalTensor<Cmpt>&);
142 class symmTypeOfRank<Cmpt, 2>
146 typedef SymmTensor<Cmpt> type;
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 } // End namespace Foam
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 // Include inline implementations
157 #include "SymmTensorI_.H"
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 // ************************ vim: set sw=4 sts=4 et: ************************ //