initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / OpenFOAM / primitives / SphericalTensor / SphericalTensor.H
blob56c51a48d8b8be3f361aced6a32564b1b8c1dae2
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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
25 Class
26     Foam::SphericalTensor
28 Description
29     Templated 3D SphericalTensor derived from VectorSpace adding construction
30     from 1 component, element access using th ii() member function and the
31     inner-product (dot-product) and outer-product operators.
33 SourceFiles
34     SphericalTensorI.H
36 \*---------------------------------------------------------------------------*/
38 #ifndef SphericalTensor_H
39 #define SphericalTensor_H
41 #include "VectorSpace.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 namespace Foam
48 /*---------------------------------------------------------------------------*\
49                            Class SphericalTensor Declaration
50 \*---------------------------------------------------------------------------*/
52 template<class Cmpt>
53 class SphericalTensor
55     public VectorSpace<SphericalTensor<Cmpt>, Cmpt, 1>
58 public:
60     //- Equivalent type of labels used for valid component indexing
61     typedef SphericalTensor<label> labelType;
64     // Member constants
66         enum
67         {
68             rank = 2 // Rank of SphericalTensor is 2
69         };
72     // Static data members
74         static const char* const typeName;
75         static const char* componentNames[];
76         static const SphericalTensor zero;
77         static const SphericalTensor one;
78         static const SphericalTensor max;
79         static const SphericalTensor min;
80         static const SphericalTensor I;
81         static const SphericalTensor oneThirdI;
82         static const SphericalTensor twoThirdsI;
85     //- Component labeling enumeration
86     enum components { II };
89     // Constructors
91         //- Construct null
92         inline SphericalTensor();
94         //- Construct given VectorSpace
95         inline SphericalTensor
96         (
97             const VectorSpace<SphericalTensor<Cmpt>, Cmpt, 1>&
98         );
100         //- Construct given the component
101         inline SphericalTensor(const Cmpt& tii);
103         //- Construct from Istream
104         inline SphericalTensor(Istream&);
107     // Member Functions
109         // Access
111             inline const Cmpt& ii() const;
112             inline Cmpt& ii();
115         //- Transpose
116         inline const SphericalTensor<Cmpt>& T() const;
120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122 } // End namespace Foam
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 // Include inline implementations
127 #include "SphericalTensorI.H"
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 #endif
133 // ************************************************************************* //