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 NXN DiagTensor derived from VectorSpace adding construction from
30 N components, and the inner-product (dot-product) and outer-product operators.
35 \*---------------------------------------------------------------------------*/
41 #include "SphericalTensorN.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 /*---------------------------------------------------------------------------*\
49 Class DiagTensor Declaration
50 \*---------------------------------------------------------------------------*/
52 template <class Cmpt, int length>
55 public VectorSpace<DiagTensorN<Cmpt, length>, Cmpt, length>
64 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 DiagTensorN zero;
74 static const DiagTensorN one;
75 static const DiagTensorN I;
83 //- Construct given VectorSpace
84 inline DiagTensorN(const VectorSpace<DiagTensorN<Cmpt, length>, Cmpt, length>&);
86 //- Construct from Istream
87 inline DiagTensorN(Istream&);
89 //- Construct given component value. Special use only!
90 explicit inline DiagTensorN(const Cmpt& tx);
96 inline DiagTensorN<Cmpt, length> diag() const;
99 inline DiagTensorN<Cmpt, length> T() const;
103 //- Assign to a SphericalTensorN
104 inline void operator=(const SphericalTensorN<Cmpt, length>&);
109 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
111 } // End namespace Foam
113 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
115 // Include inline implementations
116 #include "DiagTensorNI.H"
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122 // ************************************************************************* //