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
00011 namespace Dune {
00012
00013 template<int mydim, int coorddim, class GridImp>
00014 class IdentityGridGeometry :
00015 public GeometryDefaultImplementation <mydim, coorddim, GridImp, IdentityGridGeometry>
00016 {
00017 private:
00018
00019 typedef typename GridImp::ctype ctype;
00020
00021
00022 public:
00023
00024
00025 enum {CodimInHostGrid = GridImp::HostGridType::dimension - mydim};
00026 enum {DimensionWorld = GridImp::HostGridType::dimensionworld};
00027
00028
00029 typedef typename GridImp::HostGridType::Traits::template Codim<CodimInHostGrid>::Geometry HostGridGeometryType;
00030 typedef typename GridImp::HostGridType::Traits::template Codim<CodimInHostGrid>::Geometry HostGridLocalGeometryType;
00031
00032 typedef typename SelectType<coorddim==DimensionWorld, HostGridGeometryType, HostGridLocalGeometryType>::Type HostGridGeometry;
00033
00034
00037 IdentityGridGeometry(const HostGridGeometry& hostGeometry)
00038 : hostGeometry_(hostGeometry)
00039 {
00040 }
00041
00042
00045 GeometryType type () const {
00046 return hostGeometry_.type();
00047 }
00048
00049
00051 int corners () const {
00052 return hostGeometry_.corners();
00053 }
00054
00055
00057 const FieldVector<ctype, coorddim>& operator[] (int i) const {
00058 return hostGeometry_[i];
00059 }
00060
00061
00064 FieldVector<ctype, coorddim> global (const FieldVector<ctype, mydim>& local) const{
00065 return hostGeometry_.global(local);
00066 }
00067
00068
00071 FieldVector<ctype, mydim> local (const FieldVector<ctype, coorddim>& global) const {
00072 return hostGeometry_.local(global);
00073 }
00074
00075
00077 bool checkInside(const FieldVector<ctype, mydim> &local) const {
00078 return hostGeometry_.checkInside(local);
00079 }
00080
00081
00084 ctype integrationElement (const FieldVector<ctype, mydim>& local) const {
00085 return hostGeometry_.integrationElement(local);
00086 }
00087
00088
00090 const FieldMatrix<ctype, coorddim,mydim>& jacobianInverseTransposed (const FieldVector<ctype, mydim>& local) const {
00091 return hostGeometry_.jacobianInverseTransposed(local);
00092 }
00093
00094
00095 const HostGridGeometry& hostGeometry_;
00096
00097 };
00098
00099
00100 }
00101
00102 #endif