OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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-2009 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 the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     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, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::SphericalTensor
00027 
00028 Description
00029     Templated 3D SphericalTensor derived from VectorSpace adding construction
00030     from 1 component, element access using th ii() member function and the
00031     inner-product (dot-product) and outer-product operators.
00032 
00033 SourceFiles
00034     SphericalTensorI.H
00035 
00036 \*---------------------------------------------------------------------------*/
00037 
00038 #ifndef SphericalTensor_H
00039 #define SphericalTensor_H
00040 
00041 #include "VectorSpace.H"
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 /*---------------------------------------------------------------------------*\
00049                            Class SphericalTensor Declaration
00050 \*---------------------------------------------------------------------------*/
00051 
00052 template<class Cmpt>
00053 class SphericalTensor
00054 :
00055     public VectorSpace<SphericalTensor<Cmpt>, Cmpt, 1>
00056 {
00057 
00058 public:
00059 
00060     //- Equivalent type of labels used for valid component indexing
00061     typedef SphericalTensor<label> labelType;
00062 
00063 
00064     // Member constants
00065 
00066         enum
00067         {
00068             rank = 2 // Rank of SphericalTensor is 2
00069         };
00070 
00071 
00072     // Static data members
00073 
00074         static const char* const typeName;
00075         static const char* componentNames[];
00076         static const SphericalTensor zero;
00077         static const SphericalTensor one;
00078         static const SphericalTensor max;
00079         static const SphericalTensor min;
00080         static const SphericalTensor I;
00081         static const SphericalTensor oneThirdI;
00082         static const SphericalTensor twoThirdsI;
00083 
00084 
00085     //- Component labeling enumeration
00086     enum components { II };
00087 
00088 
00089     // Constructors
00090 
00091         //- Construct null
00092         inline SphericalTensor();
00093 
00094         //- Construct given VectorSpace
00095         inline SphericalTensor
00096         (
00097             const VectorSpace<SphericalTensor<Cmpt>, Cmpt, 1>&
00098         );
00099 
00100         //- Construct given the component
00101         inline SphericalTensor(const Cmpt& tii);
00102 
00103         //- Construct from Istream
00104         inline SphericalTensor(Istream&);
00105 
00106 
00107     // Member Functions
00108 
00109         // Access
00110 
00111             inline const Cmpt& ii() const;
00112             inline Cmpt& ii();
00113 
00114 
00115         //- Transpose
00116         inline const SphericalTensor<Cmpt>& T() const;
00117 };
00118 
00119 
00120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00121 
00122 } // End namespace Foam
00123 
00124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00125 
00126 // Include inline implementations
00127 #include "SphericalTensorI.H"
00128 
00129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00130 
00131 #endif
00132 
00133 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd