dune-grid-dev-howto  2.3beta2
identitygridintersections.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_IDENTITYGRID_INTERSECTIONS_HH
4 #define DUNE_IDENTITYGRID_INTERSECTIONS_HH
5 
7 
12 namespace Dune {
13 
14 
15  // External forward declarations
16  template< class Grid >
17  struct HostGridAccess;
18 
19 
28  template<class GridImp>
30  {
31 
32  friend class IdentityGridLeafIntersectionIterator<GridImp>;
33 
34  friend struct HostGridAccess< typename remove_const< GridImp >::type >;
35 
36  enum {dim=GridImp::dimension};
37 
38  enum {dimworld=GridImp::dimensionworld};
39 
40  // The type used to store coordinates
41  typedef typename GridImp::ctype ctype;
42 
43  typedef typename GridImp::HostGridType::template Codim<0>::Entity::LeafIntersectionIterator HostLeafIntersectionIterator;
44 
45  public:
46 
47  typedef typename GridImp::template Codim<0>::EntityPointer EntityPointer;
48  typedef typename GridImp::template Codim<1>::Geometry Geometry;
49  typedef typename GridImp::template Codim<1>::LocalGeometry LocalGeometry;
50  typedef typename GridImp::template Codim<0>::Entity Entity;
51  typedef FieldVector<ctype, dimworld> NormalVector;
52 
53  IdentityGridLeafIntersection(const GridImp* identityGrid,
54  const HostLeafIntersectionIterator& hostIterator)
55  : identityGrid_(identityGrid),
56  hostIterator_(hostIterator)
57  {}
58 
62  return IdentityGridEntityPointer<0,GridImp> (identityGrid_, hostIterator_->inside());
63  }
64 
65 
69  return IdentityGridEntityPointer<0,GridImp> (identityGrid_, hostIterator_->outside());
70  }
71 
72 
74  bool boundary () const {
75  return hostIterator_->boundary();
76  }
77 
84  return hostIterator_->centerUnitOuterNormal();
85  }
86 
88  bool neighbor () const {
89  return hostIterator_->neighbor();
90  }
91 
92 
94  int boundaryId () const {
95  return hostIterator_->boundaryId();
96  }
97 
99  size_t boundarySegmentIndex() const {
100  return hostIterator_->boundarySegmentIndex();
101  }
102 
104  bool conforming () const {
105  return hostIterator_->conforming();
106  }
107 
109  GeometryType type () const {
110  return hostIterator_->type();
111  }
112 
113 
119  {
120  return LocalGeometry( hostIterator_->geometryInInside() );
121  }
122 
126  {
127  return LocalGeometry( hostIterator_->geometryInOutside() );
128  }
129 
133  {
134  return Geometry( hostIterator_->geometry() );
135  }
136 
137 
139  int indexInInside () const {
140  return hostIterator_->indexInInside();
141  }
142 
143 
145  int indexInOutside () const {
146  return hostIterator_->indexInOutside();
147  }
148 
149 
151  FieldVector<ctype, GridImp::dimensionworld> outerNormal (const FieldVector<ctype, GridImp::dimension-1>& local) const {
152  return hostIterator_->outerNormal(local);
153  }
154 
156  FieldVector<ctype, GridImp::dimensionworld> integrationOuterNormal (const FieldVector<ctype, GridImp::dimension-1>& local) const {
157  return hostIterator_->integrationOuterNormal(local);
158  }
159 
161  FieldVector<ctype, GridImp::dimensionworld> unitOuterNormal (const FieldVector<ctype, GridImp::dimension-1>& local) const {
162  return hostIterator_->unitOuterNormal(local);
163  }
164 
165 
166  private:
167  //**********************************************************
168  // private methods
169  //**********************************************************
170 
171  const GridImp* identityGrid_;
172 
173  HostLeafIntersectionIterator hostIterator_;
174  };
175 
176 
177 
178 
180  template<class GridImp>
182  {
183 
185 
186  friend struct HostGridAccess< typename remove_const< GridImp >::type >;
187 
188  enum {dim=GridImp::dimension};
189 
190  enum {dimworld=GridImp::dimensionworld};
191 
192  // The type used to store coordinates
193  typedef typename GridImp::ctype ctype;
194 
195  typedef typename GridImp::HostGridType::template Codim<0>::Entity::LevelIntersectionIterator HostLevelIntersectionIterator;
196 
197  public:
198 
199  typedef typename GridImp::template Codim<0>::EntityPointer EntityPointer;
200  typedef typename GridImp::template Codim<1>::Geometry Geometry;
201  typedef typename GridImp::template Codim<1>::LocalGeometry LocalGeometry;
202  typedef typename GridImp::template Codim<0>::Entity Entity;
203  typedef FieldVector<ctype, dimworld> NormalVector;
204 
205  IdentityGridLevelIntersection(const GridImp* identityGrid,
206  const HostLevelIntersectionIterator& hostIterator)
207  : identityGrid_(identityGrid), hostIterator_(hostIterator)
208  {}
209 
213  return IdentityGridEntityPointer<0,GridImp> (identityGrid_, hostIterator_->inside());
214  }
215 
216 
220  return IdentityGridEntityPointer<0,GridImp> (identityGrid_, hostIterator_->outside());
221  }
222 
223 
226  bool boundary () const {
227  return hostIterator_->boundary();
228  }
229 
236  return hostIterator_->centerUnitOuterNormal();
237  }
238 
240  bool neighbor () const {
241  return hostIterator_->neighbor();
242  }
243 
244 
246  int boundaryId () const {
247  return hostIterator_->boundaryId();
248  }
249 
251  size_t boundarySegmentIndex() const {
252  return hostIterator_->boundarySegmentIndex();
253  }
254 
256  bool conforming () const {
257  return hostIterator_->conforming();
258  }
259 
261  GeometryType type () const {
262  return hostIterator_->type();
263  }
264 
265 
271  {
272  return LocalGeometry( hostIterator_->geometryInInside() );
273  }
274 
278  {
279  return LocalGeometry( hostIterator_->geometryInOutside() );
280  }
281 
285  {
286  return Geometry( hostIterator_->geometry() );
287  }
288 
289 
291  int indexInInside () const {
292  return hostIterator_->indexInInside();
293  }
294 
295 
297  int indexInOutside () const {
298  return hostIterator_->indexInOutside();
299  }
300 
301 
303  FieldVector<ctype, dimworld> outerNormal (const FieldVector<ctype, dim-1>& local) const {
304  return hostIterator_->outerNormal(local);
305  }
306 
308  FieldVector<ctype, dimworld> integrationOuterNormal (const FieldVector<ctype, dim-1>& local) const {
309  return hostIterator_->integrationOuterNormal(local);
310  }
311 
313  FieldVector<ctype, dimworld> unitOuterNormal (const FieldVector<ctype, dim-1>& local) const {
314  return hostIterator_->unitOuterNormal(local);
315  }
316 
317  private:
318 
319  const GridImp* identityGrid_;
320 
321  HostLevelIntersectionIterator hostIterator_;
322 
323  };
324 
325 
326 } // namespace Dune
327 
328 #endif