dune-grid
2.1.1
|
00001 // $Id: mapper.hh 6692 2010-05-20 14:06:15Z sander $ 00002 00003 #ifndef DUNE_MAPPER2_HH 00004 #define DUNE_MAPPER2_HH 00005 00006 #include <iostream> 00007 #include <dune/common/exceptions.hh> 00008 00009 #include <dune/common/bartonnackmanifcheck.hh> 00010 00011 #include <dune/grid/genericgeometry/conversion.hh> 00012 00090 namespace Dune 00091 { 00110 template <typename G, typename MapperImp> 00111 class Mapper { 00112 public: 00113 00119 template<class EntityType> 00120 int map (const EntityType& e) const 00121 { 00122 CHECK_INTERFACE_IMPLEMENTATION((asImp().map(e))); 00123 return asImp().map(e); 00124 } 00125 00126 00134 int map (const typename G::Traits::template Codim<0>::Entity& e, 00135 int i, 00136 unsigned int codim) const 00137 { 00138 CHECK_INTERFACE_IMPLEMENTATION((asImp().map(e,i,codim))); 00139 return asImp().map(e,i,codim); 00140 } 00141 00150 int size () const 00151 { 00152 CHECK_INTERFACE_IMPLEMENTATION((asImp().size())); 00153 return asImp().size(); 00154 } 00155 00156 00164 template<class EntityType> 00165 bool contains (const EntityType& e, int& result) const 00166 { 00167 CHECK_INTERFACE_IMPLEMENTATION((asImp().contains(e,result ))); 00168 return asImp().contains(e,result ); 00169 } 00170 00171 00181 bool contains (const typename G::Traits::template Codim<0>::Entity& e, int i, int cc, int& result) const 00182 { 00183 CHECK_INTERFACE_IMPLEMENTATION((asImp().contains(e,i,cc,result))) 00184 return asImp().contains(e,i,cc,result); 00185 } 00186 00189 void update () 00190 { 00191 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION((asImp().update())); 00192 } 00193 00194 private: 00196 MapperImp& asImp () {return static_cast<MapperImp &> (*this);} 00198 const MapperImp& asImp () const {return static_cast<const MapperImp &>(*this);} 00199 }; 00200 00203 #undef CHECK_INTERFACE_IMPLEMENTATION 00204 #undef CHECK_AND_CALL_INTERFACE_IMPLEMENTATION 00205 00206 } 00207 #endif