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 SphericalTensor derived from VectorSpace adding construction from
30 N components, and the inner-product (dot-product) and outer-product operators.
35 \*---------------------------------------------------------------------------*/
37 #ifndef SphericalTensorN_H
38 #define SphericalTensorN_H
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 /*---------------------------------------------------------------------------*\
48 Class DiagTensor Declaration
49 \*---------------------------------------------------------------------------*/
51 template <class Cmpt, int length>
52 class SphericalTensorN
54 public VectorSpace<SphericalTensorN<Cmpt, length>, Cmpt, 1>
63 rank = 2, // Rank of DiagTensor is 2
68 // Static data members
70 static const char* const typeName;
71 static const char* componentNames[];
72 static const SphericalTensorN zero;
73 static const SphericalTensorN one;
74 static const SphericalTensorN I;
80 inline SphericalTensorN();
82 //- Construct given VectorSpace
83 inline SphericalTensorN(const VectorSpace<SphericalTensorN<Cmpt, length>, Cmpt, 1>&);
85 //- Construct from Istream
86 inline SphericalTensorN(Istream&);
88 //- Construct given component value. Special use only!
89 explicit inline SphericalTensorN(const Cmpt& tx);
95 inline SphericalTensorN<Cmpt, length> diag() const;
98 inline SphericalTensorN<Cmpt, length> T() const;
102 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
104 } // End namespace Foam
106 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
108 // Include inline implementations
109 #include "SphericalTensorNI.H"
111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
115 // ************************************************************************* //