identitygridgeometry.hh

Go to the documentation of this file.
00001 #ifndef DUNE_IDENTITYGRIDGEOMETRY_HH
00002 #define DUNE_IDENTITYGRIDGEOMETRY_HH
00003 
00008 #include <dune/common/fmatrix.hh>
00009 #include <dune/common/typetraits.hh>
00010 #include <dune/grid/common/geometry.hh>
00011 
00012 namespace Dune {
00013 
00014 template<int mydim, int coorddim, class GridImp>
00015 class IdentityGridGeometry :
00016     public GeometryDefaultImplementation <mydim, coorddim, GridImp, IdentityGridGeometry>
00017 {
00018     private:
00019     
00020         typedef typename GridImp::ctype ctype;
00021     
00022     
00023     public:
00024     
00025         // The codimension of this entitypointer wrt the host grid
00026         enum {CodimInHostGrid = GridImp::HostGridType::dimension - mydim};
00027         enum {DimensionWorld = GridImp::HostGridType::dimensionworld};
00028     
00030         typedef FieldMatrix< ctype, mydim, coorddim > JacobianTransposed;
00031 
00032         // select appropiate hostgrid geometry via typeswitch
00033         typedef typename GridImp::HostGridType::Traits::template Codim<CodimInHostGrid>::Geometry HostGridGeometryType;
00034         typedef typename GridImp::HostGridType::Traits::template Codim<CodimInHostGrid>::Geometry HostGridLocalGeometryType;
00035         
00036         typedef typename SelectType<coorddim==DimensionWorld, HostGridGeometryType, HostGridLocalGeometryType>::Type HostGridGeometry;
00037         
00038         
00041         IdentityGridGeometry(const HostGridGeometry& hostGeometry)
00042             : hostGeometry_(hostGeometry)
00043         {
00044         }
00045     
00046         
00049         GeometryType type () const {
00050             return hostGeometry_.type();
00051         }
00052 
00053         // return wether we have an affine mapping
00054         bool affine() const {
00055             return hostGeometry_.affine();
00056         }
00057 
00059         int corners () const {
00060             return hostGeometry_.corners();
00061         }
00062     
00063         
00065         const FieldVector<ctype, coorddim> corner (int i) const {
00066             return hostGeometry_.corner(i);
00067         }
00068     
00069         
00072         FieldVector<ctype, coorddim> global (const FieldVector<ctype, mydim>& local) const{
00073             return hostGeometry_.global(local);
00074         }
00075     
00078         const JacobianTransposed &
00079         jacobianTransposed ( const FieldVector<ctype, mydim>& local ) const {
00080             return hostGeometry_.jacobianTransposed(local);
00081         }
00082 
00085         FieldVector<ctype, mydim> local (const FieldVector<ctype, coorddim>& global) const {
00086             return hostGeometry_.local(global);
00087         }
00088     
00089         
00091         bool checkInside(const FieldVector<ctype, mydim> &local) const {
00092             return hostGeometry_.checkInside(local);
00093         }
00094     
00095         
00098         ctype integrationElement (const FieldVector<ctype, mydim>& local) const {
00099             return hostGeometry_.integrationElement(local);
00100         }
00101     
00102         
00104         const FieldMatrix<ctype, coorddim,mydim>& jacobianInverseTransposed (const FieldVector<ctype, mydim>& local) const {
00105             return hostGeometry_.jacobianInverseTransposed(local);
00106         }
00107     
00108         
00109         const HostGridGeometry& hostGeometry_;
00110         
00111 };
00112 
00113 
00114 }  // namespace Dune
00115 
00116 #endif
Generated on Sat Apr 24 11:13:38 2010 for dune-grid-dev-howto by  doxygen 1.6.3