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