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

DiagTensor_.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::DiagTensor
00026 
00027 Description
00028     Templated 3D DiagTensor derived from VectorSpace.
00029 
00030     Adding construction from 3 components, element access using xx(), yy()
00031     and zz() member functions and the inner-product (dot-product) and
00032     outer-product operators.
00033 
00034 SourceFiles
00035     DiagTensorI.H
00036 
00037 \*---------------------------------------------------------------------------*/
00038 
00039 #ifndef DiagTensor_H
00040 #define DiagTensor_H
00041 
00042 #include <OpenFOAM/Tensor_.H>
00043 
00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00045 
00046 namespace Foam
00047 {
00048 
00049 /*---------------------------------------------------------------------------*\
00050                            Class DiagTensor Declaration
00051 \*---------------------------------------------------------------------------*/
00052 
00053 template <class Cmpt>
00054 class DiagTensor
00055 :
00056     public VectorSpace<DiagTensor<Cmpt>, Cmpt, 3>
00057 {
00058 
00059 public:
00060 
00061     // Member constants
00062 
00063         enum
00064         {
00065             rank = 2 // Rank of DiagTensor is 2
00066         };
00067 
00068 
00069     // Static data members
00070 
00071         static const char* const typeName;
00072         static const char* componentNames[];
00073         static const DiagTensor zero;
00074         static const DiagTensor one;
00075         static const DiagTensor max;
00076         static const DiagTensor min;
00077 
00078 
00079     //- Component labeling enumeration
00080     enum components { XX, YY, ZZ };
00081 
00082 
00083     // Constructors
00084 
00085         //- Construct null
00086         inline DiagTensor();
00087 
00088         //- Construct given VectorSpace
00089         inline DiagTensor(const VectorSpace<DiagTensor<Cmpt>, Cmpt, 3>&);
00090 
00091         //- Construct given three components
00092         inline DiagTensor(const Cmpt& txx, const Cmpt& tyy, const Cmpt& tzz);
00093 
00094         //- Construct from Istream
00095         inline DiagTensor(Istream&);
00096 
00097 
00098     // Member Functions
00099 
00100         // Access
00101 
00102             inline const Cmpt& xx() const;
00103             inline const Cmpt& yy() const;
00104             inline const Cmpt& zz() const;
00105 
00106             inline Cmpt& xx();
00107             inline Cmpt& yy();
00108             inline Cmpt& zz();
00109 };
00110 
00111 
00112 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00113 
00114 } // End namespace Foam
00115 
00116 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00117 
00118 // Include inline implementations
00119 #include "DiagTensorI_.H"
00120 
00121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00122 
00123 #endif
00124 
00125 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines