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

Tensor2D.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::Tensor2D
00027 
00028 Description
00029     Templated 2D tensor derived from VectorSpace adding construction from
00030     4 components, element access using xx(), xy(), yx() and yy() member
00031     functions and the iner-product (dot-product) and outer-product of two
00032     Vector2Ds (tensor-product) operators.
00033 
00034 SourceFiles
00035     Tensor2DI.H
00036 
00037 \*---------------------------------------------------------------------------*/
00038 
00039 #ifndef Tensor2D_H
00040 #define Tensor2D_H
00041 
00042 #include "Vector2D.H"
00043 #include "SphericalTensor2D.H"
00044 
00045 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00046 
00047 namespace Foam
00048 {
00049 
00050 /*---------------------------------------------------------------------------*\
00051                            Class Tensor2D Declaration
00052 \*---------------------------------------------------------------------------*/
00053 
00054 template <class Cmpt>
00055 class Tensor2D
00056 :
00057     public VectorSpace<Tensor2D<Cmpt>, Cmpt, 4>
00058 {
00059 
00060 public:
00061 
00062     // Member constants
00063 
00064         enum
00065         {
00066             rank = 2 // Rank of Tensor2D is 2
00067         };
00068 
00069 
00070     // Static data members
00071 
00072         static const char* const typeName;
00073         static const char* componentNames[];
00074 
00075         static const Tensor2D zero;
00076         static const Tensor2D one;
00077         static const Tensor2D max;
00078         static const Tensor2D min;
00079 
00080 
00081     //- Component labeling enumeration
00082     enum components { XX, XY, YX, YY };
00083 
00084 
00085     // Constructors
00086 
00087         //- Construct null
00088         inline Tensor2D();
00089 
00090         //- Construct given VectorSpace
00091         inline Tensor2D(const VectorSpace<Tensor2D<Cmpt>, Cmpt, 4>&);
00092 
00093         //- Construct given SphericalTensor2D
00094         inline Tensor2D(const SphericalTensor2D<Cmpt>&);
00095 
00096         //- Construct given the nine components
00097         inline Tensor2D
00098         (
00099             const Cmpt txx, const Cmpt txy,
00100             const Cmpt tyx, const Cmpt tyy
00101         );
00102 
00103         //- Construct from Istream
00104         Tensor2D(Istream&);
00105 
00106 
00107     // Member Functions
00108 
00109         // Access
00110 
00111             inline const Vector2D<Cmpt>& x() const;
00112             inline const Vector2D<Cmpt>& y() const;
00113 
00114             inline Vector2D<Cmpt>& x();
00115             inline Vector2D<Cmpt>& y();
00116 
00117             inline const Cmpt& xx() const;
00118             inline const Cmpt& xy() const;
00119             inline const Cmpt& yx() const;
00120             inline const Cmpt& yy() const;
00121 
00122             inline Cmpt& xx();
00123             inline Cmpt& xy();
00124             inline Cmpt& yx();
00125             inline Cmpt& yy();
00126 
00127         //- Transpose
00128         inline Tensor2D<Cmpt> T() const;
00129 
00130 
00131     // Member Operators
00132 
00133         //- Construct given SphericalTensor2D
00134         inline void operator=(const SphericalTensor2D<Cmpt>&);
00135 };
00136 
00137 
00138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00139 
00140 } // End namespace Foam
00141 
00142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00143 
00144 // Include inline implementations
00145 #include "Tensor2DI.H"
00146 
00147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00148 
00149 #endif
00150 
00151 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd