dune-grid-dev-howto  2.2.0
identitygridgeometry.hh
Go to the documentation of this file.
1 #ifndef DUNE_IDENTITYGRIDGEOMETRY_HH
2 #define DUNE_IDENTITYGRIDGEOMETRY_HH
3 
8 #include <dune/common/fmatrix.hh>
9 #include <dune/common/typetraits.hh>
10 #include <dune/grid/common/geometry.hh>
11 
12 namespace Dune {
13 
14 template<int mydim, int coorddim, class GridImp>
16  public GeometryDefaultImplementation <mydim, coorddim, GridImp, IdentityGridGeometry>
17 {
18  private:
19 
20  typedef typename GridImp::ctype ctype;
21 
22 
23  public:
24 
25  // The codimension of this entitypointer wrt the host grid
26  enum {CodimInHostGrid = GridImp::HostGridType::dimension - mydim};
27  enum {DimensionWorld = GridImp::HostGridType::dimensionworld};
28 
30  typedef FieldMatrix< ctype, mydim, coorddim > JacobianTransposed;
31 
32  // select appropiate hostgrid geometry via typeswitch
33  typedef typename GridImp::HostGridType::Traits::template Codim<CodimInHostGrid>::Geometry HostGridGeometryType;
34  typedef typename GridImp::HostGridType::Traits::template Codim<CodimInHostGrid>::Geometry HostGridLocalGeometryType;
35 
36  typedef typename SelectType<coorddim==DimensionWorld, HostGridGeometryType, HostGridLocalGeometryType>::Type HostGridGeometry;
37 
38 
42  : hostGeometry_(hostGeometry)
43  {
44  }
45 
46 
49  GeometryType type () const {
50  return hostGeometry_.type();
51  }
52 
53  // return wether we have an affine mapping
54  bool affine() const {
55  return hostGeometry_.affine();
56  }
57 
59  int corners () const {
60  return hostGeometry_.corners();
61  }
62 
63 
65  const FieldVector<ctype, coorddim> corner (int i) const {
66  return hostGeometry_.corner(i);
67  }
68 
69 
72  FieldVector<ctype, coorddim> global (const FieldVector<ctype, mydim>& local) const{
73  return hostGeometry_.global(local);
74  }
75 
78  const JacobianTransposed &
79  jacobianTransposed ( const FieldVector<ctype, mydim>& local ) const {
80  return hostGeometry_.jacobianTransposed(local);
81  }
82 
85  FieldVector<ctype, mydim> local (const FieldVector<ctype, coorddim>& global) const {
86  return hostGeometry_.local(global);
87  }
88 
89 
91  bool checkInside(const FieldVector<ctype, mydim> &local) const {
92  return hostGeometry_.checkInside(local);
93  }
94 
95 
98  ctype integrationElement (const FieldVector<ctype, mydim>& local) const {
99  return hostGeometry_.integrationElement(local);
100  }
101 
102 
104  const FieldMatrix<ctype, coorddim,mydim>& jacobianInverseTransposed (const FieldVector<ctype, mydim>& local) const {
105  return hostGeometry_.jacobianInverseTransposed(local);
106  }
107 
108 
110 
111 };
112 
113 
114 namespace FacadeOptions
115 {
116 
117 template< int mydim, int coorddim, class GridImp >
118 struct StoreGeometryReference< mydim, coorddim, GridImp, IdentityGridGeometry >
119 {
120  static const bool v = false;
121 };
122 
123 } // namespace FacadeOptions
124 
125 
126 } // namespace Dune
127 
128 #endif