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 DiagTensor derived from VectorSpace.
30 Adding construction from 3 components, element access using xx(), yy()
31 and zz() member functions and the inner-product (dot-product) and
32 outer-product operators.
37 \*---------------------------------------------------------------------------*/
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 /*---------------------------------------------------------------------------*\
50 Class DiagTensor Declaration
51 \*---------------------------------------------------------------------------*/
56 public VectorSpace<DiagTensor<Cmpt>, Cmpt, 3>
65 rank = 2 // Rank of DiagTensor is 2
69 // Static data members
71 static const char* const typeName;
72 static const char* componentNames[];
73 static const DiagTensor zero;
74 static const DiagTensor one;
75 static const DiagTensor max;
76 static const DiagTensor min;
79 //- Component labeling enumeration
80 enum components { XX, YY, ZZ };
88 //- Construct given VectorSpace
89 inline DiagTensor(const VectorSpace<DiagTensor<Cmpt>, Cmpt, 3>&);
91 //- Construct given three components
92 inline DiagTensor(const Cmpt& txx, const Cmpt& tyy, const Cmpt& tzz);
94 //- Construct from Istream
95 inline DiagTensor(Istream&);
102 inline const Cmpt& xx() const;
103 inline const Cmpt& yy() const;
104 inline const Cmpt& zz() const;
112 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
114 } // End namespace Foam
116 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
118 // Include inline implementations
119 #include "DiagTensorI.H"
121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 // ************************************************************************* //