dune-grid  2.3beta2
albertagrid/intersection.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 #ifndef DUNE_ALBERTA_INTERSECTION_HH
4 #define DUNE_ALBERTA_INTERSECTION_HH
5 
7 
11 
12 #if HAVE_ALBERTA
13 
14 namespace Dune
15 {
16 
17  // External Forward Declarations
18  // -----------------------------
19 
20  template< int codim, int dim, class GridImp >
21  class AlbertaGridEntity;
22 
23 
24 
25  // AlbertaGridIntersectionBase
26  // ---------------------------
27 
28  template< class Grid >
30  {
32 
33  public:
34  typedef typename Grid::ctype ctype;
35 
36  static const int dimension = Grid::dimension;
38 
39  typedef FieldVector< ctype, dimensionworld > NormalVector;
40  typedef FieldVector< ctype, dimension-1 > LocalCoordType;
41 
42  typedef typename Grid::template Codim< 0 >::Entity Entity;
43  typedef typename Grid::template Codim< 0 >::EntityPointer EntityPointer;
44 
45  typedef typename Grid::template Codim< 1 >::Geometry Geometry;
46  typedef typename Grid::template Codim< 1 >::LocalGeometry LocalGeometry;
47 
49 
50  protected:
52 
53  typedef typename Grid::Traits::template Codim< 1 >::GeometryImpl GeometryImpl;
54  typedef typename Grid::Traits::template Codim< 1 >::LocalGeometryImpl LocalGeometryImpl;
55 
56  struct GlobalCoordReader;
57  struct LocalCoordReader;
58 
59  public:
60  AlbertaGridIntersectionBase ( const EntityImp &entity, const int oppVertex );
61 
62  EntityPointer inside () const;
63 
64  bool boundary () const;
65  int boundaryId () const;
66  size_t boundarySegmentIndex () const;
67 
68  int indexInInside () const;
69 
70  GeometryType type () const;
71 
75 
76  NormalVector integrationOuterNormal ( const LocalCoordType &local ) const;
77  NormalVector outerNormal ( const LocalCoordType &local ) const;
78  NormalVector unitOuterNormal ( const LocalCoordType &local ) const;
79 
80 
82 
83 
84  const Grid &grid () const;
85  const ElementInfo &elementInfo () const;
86 
87  protected:
88  const Grid *grid_;
91  };
92 
93 
94 
95  // AlbertaGridLeafIntersection
96  // ---------------------------
97 
98  template< class GridImp >
100  : public AlbertaGridIntersectionBase< GridImp >
101  {
104 
105  friend class AlbertaGridEntity< 0, GridImp::dimension, GridImp >;
106 
107  public:
109 
110  static const int dimension = Base::dimension;
112 
115 
116  typedef typename Base::Entity Entity;
118 
119  typedef typename Base::Geometry Geometry;
121 
122  typedef typename Base::ElementInfo ElementInfo;
123 
124  protected:
125  typedef typename Base::EntityImp EntityImp;
126 
129 
130  typedef typename Base::GlobalCoordReader GlobalCoordReader;
131  typedef typename Base::LocalCoordReader LocalCoordReader;
132 
133  public:
134  using Base::grid;
135  using Base::elementInfo;
136 
137  using Base::inside;
138 
139  AlbertaGridLeafIntersection ( const EntityImp &entity, const int n );
140 
141  AlbertaGridLeafIntersection ( const This &other );
142 
143  This &operator= ( const This &other );
144 
145  bool operator== ( const This &other ) const;
146 
147  void next ();
148 
149  EntityPointer outside () const;
150 
151  bool neighbor () const;
152 
153  bool conforming () const;
154 
157 
158  Geometry geometry () const;
159 
160  int indexInOutside () const;
161 
162 
163  int twistInInside () const;
164  int twistInOutside () const;
165 
166  protected:
167  using Base::oppVertex_;
168 
169  private:
170  mutable ElementInfo neighborInfo_;
171  };
172 
173 } // namespace Dune
174 
175 #endif // #if HAVE_ALBERTA
176 
177 #endif // #ifndef DUNE_ALBERTA_INTERSECTION_HH