1 #ifndef DUNE_FEM_GRIDPART_LEAFGRIDPART_HH 2 #define DUNE_FEM_GRIDPART_LEAFGRIDPART_HH 3 4 #include <dune/grid/common/capabilities.hh> 5 6 #include <dune/fem/gridpart/common/capabilities.hh> 7 #include <dune/fem/gridpart/common/gridview2gridpart.hh> 8 9 namespace Dune 10 { 11 12 namespace Fem 13 { 14 15 // LeafGridPart 16 // ------------ 17 18 template< class Grid > 19 class LeafGridPart 20 : public GridView2GridPart< typename Grid::LeafGridView, LeafGridPart< Grid > > 21 { 22 typedef GridView2GridPart< typename Grid::LeafGridView, LeafGridPart< Grid > > BaseType; 23 24 public: 25 /** \copydoc Dune::Fem::GridPartInterface::GridType */ 26 typedef typename BaseType::GridType GridType; 27 28 /** \name Construction 29 * \{ 30 */ LeafGridPart(GridType & grid)31 explicit LeafGridPart ( GridType &grid ) 32 : BaseType( grid.leafGridView() ), 33 grid_( grid ) 34 {} 35 36 /** \} */ 37 38 /** \name Public member methods 39 * \{ 40 */ 41 42 using BaseType::grid; 43 44 /** \copydoc Dune::Fem::GridPartInterface::grid */ grid()45 GridType &grid () { return grid_; } 46 47 /** \copydoc Dune::Fem::GridPartInterface::level */ level() const48 int level () const { return grid().maxLevel(); } 49 50 /** \} */ 51 52 private: 53 GridType &grid_; 54 }; 55 56 57 58 namespace GridPartCapabilities 59 { 60 61 template< class Grid > 62 struct hasGrid< LeafGridPart< Grid > > 63 { 64 static const bool v = true; 65 }; 66 67 template< class Grid > 68 struct hasSingleGeometryType< LeafGridPart< Grid > > 69 : public Dune::Capabilities::hasSingleGeometryType< Grid > 70 {}; 71 72 template< class Grid > 73 struct isCartesian< LeafGridPart< Grid > > 74 : public Dune::Capabilities::isCartesian< Grid > 75 {}; 76 77 template< class Grid, int codim > 78 struct hasEntity< LeafGridPart< Grid >, codim > 79 : public Dune::Capabilities::hasEntity< Grid, codim > 80 {}; 81 82 template< class Grid, int codim > 83 struct canCommunicate< LeafGridPart< Grid >, codim > 84 : public Dune::Capabilities::canCommunicate< Grid, codim > 85 {}; 86 87 template< class Grid > 88 struct isConforming< LeafGridPart< Grid > > 89 { 90 static const bool v = Dune::Capabilities::isLeafwiseConforming< Grid >::v; 91 }; 92 93 } // namespace GridPartCapabilities 94 95 } // namespace Fem 96 97 } // namespace Dune 98 99 #endif // #ifndef DUNE_FEM_GRIDPART_LEAFGRIDPART_HH 100