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

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