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
33 \*---------------------------------------------------------------------------*/
39 #include "SphericalTensorN.H"
40 #include "DiagTensorN.H"
42 // * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * //
44 template <class Cmpt, int length>
47 template <class Cmpt, int length>
48 class SphericalTensorN;
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 /*---------------------------------------------------------------------------*\
56 Class TensorN Declaration
57 \*---------------------------------------------------------------------------*/
59 template <class Cmpt, int length>
62 public VectorSpace<TensorN<Cmpt, length>, Cmpt, length*length>
71 rank = 2, // Rank of TensorN is 2
72 rowLength = length // Number of components in a row
76 // Static data members
78 static const char* const typeName;
80 static const TensorN zero;
81 static const TensorN one;
89 //- Construct given VectorSpace
92 const VectorSpace<TensorN<Cmpt, length>, Cmpt, length*length>&
95 //- Construct given component value. Special use only!
96 explicit inline TensorN(const Cmpt& tx);
98 //- Construct from Istream
104 //- Return (i, j) component
105 inline const Cmpt& operator()
111 //- Return access to (i, j) component
112 inline Cmpt& operator()
119 inline DiagTensorN<Cmpt, length> diag() const;
122 inline TensorN<Cmpt, length> T() const;
124 //- Negative sum the vertical off-diagonal components
125 inline TensorN<Cmpt, length> negSumDiag() const;
129 //- Assign to a SphericalTensorN
130 inline void operator=(const SphericalTensorN<Cmpt, length>&);
132 //- Assign to a DiagTensorN
133 inline void operator=(const DiagTensorN<Cmpt, length>&);
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 } // End namespace Foam
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 // Include inline implementations
144 #include "TensorNI.H"
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 // ************************************************************************* //