albertagrid/intersection.hh
00001 #ifndef DUNE_ALBERTA_INTERSECTION_HH
00002 #define DUNE_ALBERTA_INTERSECTION_HH
00003
00004 #include <dune/grid/common/intersection.hh>
00005 #include <dune/grid/common/intersectioniterator.hh>
00006
00007 #include <dune/grid/albertagrid/transformation.hh>
00008 #include <dune/grid/albertagrid/agmemory.hh>
00009 #include <dune/grid/albertagrid/elementinfo.hh>
00010 #include <dune/grid/albertagrid/geometry.hh>
00011
00012 namespace Dune
00013 {
00014
00015
00016
00017
00018 template< int codim, int dim, class GridImp >
00019 class AlbertaGridEntity;
00020
00021
00022
00023
00024
00025
00033 template< class GridImp >
00034 class AlbertaGridIntersectionIterator
00035 {
00036 typedef AlbertaGridIntersectionIterator This;
00037
00038 friend class AlbertaGridEntity< 0, GridImp::dimension, GridImp >;
00039
00040 public:
00042 typedef typename GridImp::ctype ctype;
00043
00045 static const int dimension = GridImp::dimension;
00047 static const int dimensionworld = GridImp::dimensionworld;
00048
00051 typedef FieldVector< ctype, GridImp::dimensionworld > NormalVector;
00052 typedef FieldVector< ctype, GridImp::dimension-1 > LocalCoordType;
00053
00054 typedef Dune::Intersection< GridImp, Dune::AlbertaGridIntersectionIterator >
00055 Intersection;
00056 typedef This ImplementationType;
00057
00058 typedef AGMemoryProvider< This > StorageType;
00059 typedef typename GridImp::template Codim<0>::Entity Entity;
00060 typedef typename GridImp::template Codim<0>::EntityPointer EntityPointer;
00061
00062 typedef typename GridImp::template Codim<1>::Geometry Geometry;
00063 typedef typename GridImp::template Codim<1>::LocalGeometry LocalGeometry;
00064
00065 typedef Alberta::ElementInfo< dimension > ElementInfo;
00066
00067 private:
00068 typedef AlbertaGridEntity< 0, dimension, GridImp > EntityImp;
00069 typedef AlbertaGridGeometry< dimension-1, dimensionworld, GridImp > GeometryImp;
00070 typedef AlbertaGridGeometry< dimension-1, dimension, GridImp > LocalGeometryImp;
00071
00072 struct GlobalCoordReader;
00073 struct LocalCoordReader;
00074
00075 public:
00077 AlbertaGridIntersectionIterator ( const GridImp &grid, int level );
00078
00080 AlbertaGridIntersectionIterator( const This &other );
00081
00082 const Intersection &dereference () const
00083 {
00084 return reinterpret_cast< const Intersection & >( *this );
00085 }
00086
00088 bool equals ( const This &other ) const;
00089
00091 void increment();
00092
00094 EntityPointer outside () const;
00095
00097 EntityPointer inside () const;
00098
00100 void assign ( const This &other );
00101
00103 bool boundary () const;
00104
00106 bool neighbor () const;
00107
00109 int boundaryId () const;
00110
00112 bool conforming () const;
00113
00114 AlbertaTransformation transformation () const;
00115
00120 const LocalGeometry &intersectionSelfLocal () const;
00121
00125 const LocalGeometry &intersectionNeighborLocal () const;
00126
00130 const Geometry &intersectionGlobal () const;
00131
00132 GeometryType type () const;
00133
00135 int numberInSelf () const;
00136
00138 int numberInNeighbor () const;
00139
00141 int twistInSelf () const;
00142
00144 int twistInNeighbor () const;
00145
00146 const NormalVector unitOuterNormal ( const LocalCoordType &local ) const;
00147
00150 const NormalVector outerNormal ( const LocalCoordType &local ) const;
00151
00154 const NormalVector integrationOuterNormal ( const LocalCoordType &local ) const;
00155
00156
00157
00158
00159
00160
00161 void first ( const EntityImp &entity, int level );
00162
00163
00164 void done ();
00165
00166 private:
00167
00168 bool neighborHasSameLevel () const;
00169
00171 void setupVirtEn () const;
00172
00174 void calcOuterNormal ( NormalVector &n ) const;
00175
00177
00179
00181 const GridImp &grid_;
00182
00184 mutable int neighborCount_;
00185
00186 ElementInfo elementInfo_;
00187
00188
00189 mutable MakeableInterfaceObject< LocalGeometry > fakeNeighObj_;
00190 mutable MakeableInterfaceObject< LocalGeometry > fakeSelfObj_;
00191 mutable MakeableInterfaceObject< Geometry > neighGlobObj_;
00192
00194 mutable ElementInfo neighborInfo_;
00195 };
00196
00197 }
00198
00199 #endif