gridview.hh
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
00044 template< class ViewTraits >
00045 class GridView
00046 {
00047 typedef GridView< ViewTraits > ThisType;
00048
00049 public:
00050 typedef typename ViewTraits :: GridViewImp GridViewImp;
00051
00053 typedef ViewTraits Traits;
00054
00056 typedef typename Traits :: Grid Grid;
00057
00059 typedef typename Traits :: IndexSet IndexSet;
00060
00062 typedef typename Traits :: Intersection Intersection;
00063
00065 typedef typename Traits :: IntersectionIterator IntersectionIterator;
00066
00068 typedef typename Traits :: CollectiveCommunication CollectiveCommunication;
00069
00071 template< int cd >
00072 struct Codim : public Traits :: template Codim<cd> {};
00073
00075 enum { conforming = Traits :: conforming };
00076
00078 enum { dimension = Grid :: dimension };
00079
00081 enum { dimensionworld = Grid :: dimensionworld };
00082
00083 public:
00084 GridView ( const GridViewImp& imp)
00085 : imp_( imp )
00086 {}
00087
00089 GridView ( const ThisType &other )
00090 : imp_( other.imp_ )
00091 {}
00092
00093 private:
00094
00095 ThisType &operator= ( const ThisType & );
00096
00097 public:
00099 const Grid &grid () const
00100 {
00101 return asImp().grid();
00102 }
00103
00105 const IndexSet &indexSet () const
00106 {
00107 return asImp().indexSet();
00108 }
00109
00111 int size ( int codim ) const
00112 {
00113 return asImp().size( codim );
00114 }
00115
00117 int size ( const GeometryType &type ) const
00118 {
00119 return asImp().size( type );
00120 }
00121
00123 template< int cd >
00124 typename Codim< cd > :: Iterator begin () const
00125 {
00126 return asImp().template begin<cd>();
00127 }
00128
00130 template< int cd >
00131 typename Codim< cd > :: Iterator end () const
00132 {
00133 return asImp().template end<cd>();
00134 }
00135
00137 template< int cd , PartitionIteratorType pitype >
00138 typename Codim< cd > :: template Partition< pitype > :: Iterator
00139 begin () const
00140 {
00141 return asImp().template begin<cd,pitype>();
00142 }
00143
00145 template< int cd, PartitionIteratorType pitype >
00146 typename Codim< cd > :: template Partition< pitype > :: Iterator
00147 end () const
00148 {
00149 return asImp().template end<cd,pitype>();
00150 }
00151
00153 IntersectionIterator
00154 ibegin ( const typename Codim< 0 > :: Entity &entity ) const
00155 {
00156 return asImp().ibegin(entity);
00157 }
00158
00160 IntersectionIterator
00161 iend ( const typename Codim< 0 > :: Entity &entity ) const
00162 {
00163 return asImp().iend(entity);
00164 }
00165
00167 const CollectiveCommunication &comm () const
00168 {
00169 return asImp().comm();
00170 }
00171
00173 template< class DataHandleImp, class DataType >
00174 void communicate ( CommDataHandleIF< DataHandleImp, DataType > &data,
00175 InterfaceType iftype,
00176 CommunicationDirection dir ) const
00177 {
00178 asImp().communicate(data,iftype,dir);
00179 }
00180
00181 protected:
00182 GridViewImp& asImp ()
00183 {
00184 return imp_;
00185 }
00186
00187 const GridViewImp& asImp () const
00188 {
00189 return imp_;
00190 }
00191
00192 private:
00193 GridViewImp imp_;
00194 };
00195
00196 }
00197
00198 #endif