- Home
- About DUNE
- Download
- Documentation
- Community
- Development
00001 #ifndef DUNE_GRIDVIEW_HH 00002 #define DUNE_GRIDVIEW_HH 00003 00004 #include <dune/common/geometrytype.hh> 00005 #include <dune/grid/common/datahandleif.hh> 00006 #include <dune/grid/common/gridenums.hh> 00007 00008 namespace Dune 00009 { 00010 00011 template< int, int, class, class > 00012 class GridDefaultImplementation; 00013 00014 00015 00052 template< class ViewTraits > 00053 class GridView 00054 { 00055 typedef GridView< ViewTraits > ThisType; 00056 00057 public: 00058 typedef typename ViewTraits :: GridViewImp GridViewImp; 00059 00060 protected: 00061 typedef GridViewImp ImplementationType; 00062 00063 public: 00065 typedef ViewTraits Traits; 00066 00068 typedef typename Traits :: Grid Grid; 00069 00071 typedef typename Traits :: IndexSet IndexSet; 00072 00074 typedef typename Traits :: Intersection Intersection; 00075 00077 typedef typename Traits :: IntersectionIterator IntersectionIterator; 00078 00080 typedef typename Traits :: CollectiveCommunication CollectiveCommunication; 00081 00085 template< int cd > 00086 struct Codim { 00088 typedef typename Traits :: template Codim<cd> :: Iterator Iterator; 00089 00091 typedef typename Traits :: template Codim<cd> :: EntityPointer EntityPointer; 00092 00094 typedef typename Traits :: template Codim<cd> :: Entity Entity; 00095 00097 typedef typename Traits :: template Codim<cd> :: Geometry Geometry; 00098 00100 typedef typename Traits :: template Codim<cd> :: LocalGeometry LocalGeometry; 00101 00103 template< PartitionIteratorType pit > 00104 struct Partition 00105 { 00107 typedef typename Traits :: template Codim< cd > 00108 :: template Partition< pit > :: Iterator Iterator; 00109 }; 00110 }; //: public Traits :: template Codim<cd> {}; 00111 00112 enum { 00114 conforming = Traits :: conforming }; 00115 00117 typedef typename Grid::ctype ctype; 00118 00119 enum { 00120 dimension = Grid :: dimension }; 00121 00122 enum { 00123 dimensionworld = Grid :: dimensionworld }; 00124 00125 public: 00127 GridView ( const GridViewImp& imp) 00128 : imp_( imp ) 00129 {} 00130 00132 GridView ( const ThisType &other ) 00133 : imp_( other.imp_ ) 00134 {} 00135 00137 ThisType &operator= ( const ThisType &other ) 00138 { 00139 imp_ = other.imp_; 00140 return *this; 00141 } 00142 00143 public: 00145 const Grid &grid () const 00146 { 00147 return asImp().grid(); 00148 } 00149 00151 const IndexSet &indexSet () const 00152 { 00153 return asImp().indexSet(); 00154 } 00155 00157 int size ( int codim ) const 00158 { 00159 return asImp().size( codim ); 00160 } 00161 00163 int size ( const GeometryType &type ) const 00164 { 00165 return asImp().size( type ); 00166 } 00167 00174 template<class EntityType> 00175 bool contains (const EntityType& e) const 00176 { 00177 return asImp().indexSet().contains(e); 00178 } 00179 00181 template< int cd > 00182 typename Codim< cd > :: Iterator begin () const 00183 { 00184 return asImp().template begin<cd>(); 00185 } 00186 00188 template< int cd > 00189 typename Codim< cd > :: Iterator end () const 00190 { 00191 return asImp().template end<cd>(); 00192 } 00193 00195 template< int cd , PartitionIteratorType pitype > 00196 typename Codim< cd > :: template Partition< pitype > :: Iterator 00197 begin () const 00198 { 00199 return asImp().template begin<cd,pitype>(); 00200 } 00201 00203 template< int cd, PartitionIteratorType pitype > 00204 typename Codim< cd > :: template Partition< pitype > :: Iterator 00205 end () const 00206 { 00207 return asImp().template end<cd,pitype>(); 00208 } 00209 00211 IntersectionIterator 00212 ibegin ( const typename Codim< 0 > :: Entity &entity ) const 00213 { 00214 return asImp().ibegin(entity); 00215 } 00216 00218 IntersectionIterator 00219 iend ( const typename Codim< 0 > :: Entity &entity ) const 00220 { 00221 return asImp().iend(entity); 00222 } 00223 00225 const CollectiveCommunication &comm () const 00226 { 00227 return asImp().comm(); 00228 } 00229 00231 int overlapSize(int codim) const 00232 { 00233 return asImp().overlapSize(codim); 00234 } 00235 00237 int ghostSize(int codim) const 00238 { 00239 return asImp().ghostSize(codim); 00240 } 00241 00243 template< class DataHandleImp, class DataType > 00244 void communicate ( CommDataHandleIF< DataHandleImp, DataType > &data, 00245 InterfaceType iftype, 00246 CommunicationDirection dir ) const 00247 { 00248 asImp().communicate(data,iftype,dir); 00249 } 00250 00251 protected: 00252 ImplementationType &getRealImp () 00253 { 00254 return imp_; 00255 } 00256 00257 const ImplementationType &getRealImp () const 00258 { 00259 return imp_; 00260 } 00261 00262 GridViewImp& asImp () 00263 { 00264 return imp_; 00265 } 00266 00267 const GridViewImp& asImp () const 00268 { 00269 return imp_; 00270 } 00271 00272 private: 00273 friend class GridDefaultImplementation 00274 < dimension, dimensionworld, ctype, typename Grid::GridFamily >; 00275 00276 GridViewImp imp_; 00277 }; 00278 00279 } 00280 00281 #endif
Generated on Fri Apr 29 2011 with Doxygen (ver 1.7.1) [doxygen-log,error-log].