1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
32 \*---------------------------------------------------------------------------*/
38 #include "SphericalTensorN.H"
39 #include "DiagTensorN.H"
41 // * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * //
43 template <class Cmpt, int length>
46 template <class Cmpt, int length>
47 class SphericalTensorN;
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 /*---------------------------------------------------------------------------*\
55 Class TensorN Declaration
56 \*---------------------------------------------------------------------------*/
58 template <class Cmpt, int length>
61 public VectorSpace<TensorN<Cmpt, length>, Cmpt, length*length>
70 rank = 2, // Rank of TensorN is 2
71 rowLength = length // Number of components in a row
75 // Static data members
77 static const char* const typeName;
79 static const TensorN zero;
80 static const TensorN one;
88 //- Construct given VectorSpace
91 const VectorSpace<TensorN<Cmpt, length>, Cmpt, length*length>&
94 //- Construct given component value. Special use only!
95 explicit inline TensorN(const Cmpt& tx);
97 //- Construct from Istream
103 //- Return direction given (i, j) indices
104 static inline direction cmpt
110 //- Return (i, j) component
111 inline const Cmpt& operator()
117 //- Return access to (i, j) component
118 inline Cmpt& operator()
125 inline DiagTensorN<Cmpt, length> diag() const;
128 inline TensorN<Cmpt, length> T() const;
130 //- Negative sum the vertical off-diagonal components
131 inline TensorN<Cmpt, length> negSumDiag() const;
135 //- Assign to a SphericalTensorN
136 inline void operator=(const SphericalTensorN<Cmpt, length>&);
138 //- Assign to a DiagTensorN
139 inline void operator=(const DiagTensorN<Cmpt, length>&);
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 } // End namespace Foam
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 // Include inline implementations
150 #include "TensorNI.H"
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 // ************************************************************************* //