dune-grid  2.2.0
albertagrid/intersection.hh
Go to the documentation of this file.
00001 #ifndef DUNE_ALBERTA_INTERSECTION_HH
00002 #define DUNE_ALBERTA_INTERSECTION_HH
00003 
00004 #include <dune/grid/common/intersection.hh>
00005 
00006 #include <dune/grid/albertagrid/transformation.hh>
00007 #include <dune/grid/albertagrid/elementinfo.hh>
00008 #include <dune/grid/albertagrid/geometry.hh>
00009 
00010 #if HAVE_ALBERTA
00011 
00012 namespace Dune
00013 {
00014 
00015   // External Forward Declarations
00016   // -----------------------------
00017 
00018   template< int codim, int dim, class GridImp >
00019   class AlbertaGridEntity;
00020 
00021 
00022 
00023   // AlbertaGridIntersectionBase
00024   // ---------------------------
00025 
00026   template< class Grid >
00027   class AlbertaGridIntersectionBase
00028   {
00029     typedef AlbertaGridIntersectionBase< Grid > This;
00030 
00031   public:
00032     typedef typename Grid::ctype ctype;
00033 
00034     static const int dimension = Grid::dimension;
00035     static const int dimensionworld = Grid::dimensionworld;
00036 
00037     typedef FieldVector< ctype, dimensionworld > NormalVector;
00038     typedef FieldVector< ctype, dimension-1 > LocalCoordType;
00039   
00040     typedef typename Grid::template Codim< 0 >::Entity Entity;
00041     typedef typename Grid::template Codim< 0 >::EntityPointer EntityPointer;
00042 
00043     typedef typename Grid::template Codim< 1 >::Geometry Geometry;
00044     typedef typename Grid::template Codim< 1 >::LocalGeometry LocalGeometry;
00045 
00046     typedef Alberta::ElementInfo< dimension > ElementInfo;
00047 
00048   protected:
00049     typedef AlbertaGridEntity< 0, dimension, Grid > EntityImp;
00050 
00051     typedef typename Grid::Traits::template Codim< 1 >::GeometryImpl GeometryImpl;
00052     typedef typename Grid::Traits::template Codim< 1 >::LocalGeometryImpl LocalGeometryImpl;
00053 
00054     struct GlobalCoordReader;
00055     struct LocalCoordReader;
00056 
00057   public:
00058     AlbertaGridIntersectionBase ( const EntityImp &entity, const int oppVertex );
00059 
00060     EntityPointer inside () const;
00061 
00062     bool boundary () const;
00063     int boundaryId () const;
00064     size_t boundarySegmentIndex () const;
00065 
00066     int indexInInside () const;
00067 
00068     GeometryType type () const;
00069 
00070     NormalVector centerIntegrationOuterNormal () const;
00071     NormalVector centerOuterNormal () const;
00072     NormalVector centerUnitOuterNormal () const;
00073 
00074     NormalVector integrationOuterNormal ( const LocalCoordType &local ) const;
00075     NormalVector outerNormal ( const LocalCoordType &local ) const;
00076     NormalVector unitOuterNormal ( const LocalCoordType &local ) const;
00077 
00078 
00079     AlbertaTransformation transformation () const;
00080 
00081 
00082     const Grid &grid () const;
00083     const ElementInfo &elementInfo () const;
00084 
00085   protected:
00086     const Grid *grid_;
00087     ElementInfo elementInfo_;
00088     int oppVertex_;
00089   };
00090 
00091 
00092 
00093   // AlbertaGridLeafIntersection
00094   // ---------------------------
00095 
00096   template< class GridImp >
00097   class AlbertaGridLeafIntersection
00098   : public AlbertaGridIntersectionBase< GridImp >
00099   {
00100     typedef AlbertaGridLeafIntersection< GridImp > This;
00101     typedef AlbertaGridIntersectionBase< GridImp > Base;
00102 
00103     friend class AlbertaGridEntity< 0, GridImp::dimension, GridImp >;
00104 
00105   public:
00106     typedef This ImplementationType;
00107 
00108     static const int dimension = Base::dimension;
00109     static const int dimensionworld = Base::dimensionworld;
00110 
00111     typedef typename Base::NormalVector NormalVector;
00112     typedef typename Base::LocalCoordType LocalCoordType;
00113 
00114     typedef typename Base::Entity Entity;
00115     typedef typename Base::EntityPointer EntityPointer;
00116 
00117     typedef typename Base::Geometry Geometry;
00118     typedef typename Base::LocalGeometry LocalGeometry;
00119 
00120     typedef typename Base::ElementInfo ElementInfo;
00121 
00122   protected:
00123     typedef typename Base::EntityImp EntityImp;
00124 
00125     typedef typename Base::GeometryImpl GeometryImpl;
00126     typedef typename Base::LocalGeometryImpl LocalGeometryImpl;
00127 
00128     typedef typename Base::GlobalCoordReader GlobalCoordReader;
00129     typedef typename Base::LocalCoordReader LocalCoordReader;
00130 
00131   public:
00132     using Base::grid;
00133     using Base::elementInfo;
00134 
00135     using Base::inside;
00136 
00137     AlbertaGridLeafIntersection ( const EntityImp &entity, const int n );
00138 
00139     AlbertaGridLeafIntersection ( const This &other );
00140 
00141     This &operator= ( const This &other );
00142 
00143     bool operator== ( const This &other ) const;
00144 
00145     void next ();
00146 
00147     EntityPointer outside () const;
00148 
00149     bool neighbor () const; 
00150 
00151     bool conforming () const;
00152 
00153     LocalGeometry geometryInInside () const;
00154     LocalGeometry geometryInOutside () const;
00155 
00156     Geometry geometry () const;
00157 
00158     int indexInOutside () const;
00159 
00160 
00161     int twistInInside () const;
00162     int twistInOutside () const;
00163 
00164   protected:
00165     using Base::oppVertex_;
00166 
00167   private:
00168     mutable ElementInfo neighborInfo_;
00169   };
00170 
00171 } // namespace Dune
00172 
00173 #endif // #if HAVE_ALBERTA
00174 
00175 #endif // #ifndef DUNE_ALBERTA_INTERSECTION_HH