FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

SphericalTensor_.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::SphericalTensor
00026 
00027 Description
00028     Templated 3D SphericalTensor derived from VectorSpace adding construction
00029     from 1 component, element access using th ii() member function and the
00030     inner-product (dot-product) and outer-product operators.
00031 
00032 SourceFiles
00033     SphericalTensorI.H
00034 
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #ifndef SphericalTensor_H
00038 #define SphericalTensor_H
00039 
00040 #include <OpenFOAM/VectorSpace.H>
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 namespace Foam
00045 {
00046 
00047 /*---------------------------------------------------------------------------*\
00048                            Class SphericalTensor Declaration
00049 \*---------------------------------------------------------------------------*/
00050 
00051 template<class Cmpt>
00052 class SphericalTensor
00053 :
00054     public VectorSpace<SphericalTensor<Cmpt>, Cmpt, 1>
00055 {
00056 
00057 public:
00058 
00059     //- Equivalent type of labels used for valid component indexing
00060     typedef SphericalTensor<label> labelType;
00061 
00062 
00063     // Member constants
00064 
00065         enum
00066         {
00067             rank = 2 // Rank of SphericalTensor is 2
00068         };
00069 
00070 
00071     // Static data members
00072 
00073         static const char* const typeName;
00074         static const char* componentNames[];
00075         static const SphericalTensor zero;
00076         static const SphericalTensor one;
00077         static const SphericalTensor max;
00078         static const SphericalTensor min;
00079         static const SphericalTensor I;
00080         static const SphericalTensor oneThirdI;
00081         static const SphericalTensor twoThirdsI;
00082 
00083 
00084     //- Component labeling enumeration
00085     enum components { II };
00086 
00087 
00088     // Constructors
00089 
00090         //- Construct null
00091         inline SphericalTensor();
00092 
00093         //- Construct given VectorSpace
00094         inline SphericalTensor
00095         (
00096             const VectorSpace<SphericalTensor<Cmpt>, Cmpt, 1>&
00097         );
00098 
00099         //- Construct given the component
00100         inline SphericalTensor(const Cmpt& tii);
00101 
00102         //- Construct from Istream
00103         inline SphericalTensor(Istream&);
00104 
00105 
00106     // Member Functions
00107 
00108         // Access
00109 
00110             inline const Cmpt& ii() const;
00111             inline Cmpt& ii();
00112 
00113 
00114         //- Transpose
00115         inline const SphericalTensor<Cmpt>& T() const;
00116 };
00117 
00118 
00119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00120 
00121 } // End namespace Foam
00122 
00123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00124 
00125 // Include inline implementations
00126 #include "SphericalTensorI_.H"
00127 
00128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00129 
00130 #endif
00131 
00132 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines