dune-grid-dev-howto  2.2.1
identitygridintersections.hh
Go to the documentation of this file.
1 #ifndef DUNE_IDENTITYGRID_INTERSECTIONS_HH
2 #define DUNE_IDENTITYGRID_INTERSECTIONS_HH
3 
5 
10 namespace Dune {
11 
12 
13 // External forward declarations
14 template< class Grid >
15 struct HostGridAccess;
16 
17 
26 template<class GridImp>
28 {
29 
30  friend class IdentityGridLeafIntersectionIterator<GridImp>;
31 
32  friend struct HostGridAccess< typename remove_const< GridImp >::type >;
33 
34  enum {dim=GridImp::dimension};
35 
36  enum {dimworld=GridImp::dimensionworld};
37 
38  // The type used to store coordinates
39  typedef typename GridImp::ctype ctype;
40 
41  typedef typename GridImp::HostGridType::template Codim<0>::Entity::LeafIntersectionIterator HostLeafIntersectionIterator;
42 
43 public:
44 
45  typedef typename GridImp::template Codim<0>::EntityPointer EntityPointer;
46  typedef typename GridImp::template Codim<1>::Geometry Geometry;
47  typedef typename GridImp::template Codim<1>::LocalGeometry LocalGeometry;
48  typedef typename GridImp::template Codim<0>::Entity Entity;
49  typedef FieldVector<ctype, dimworld> NormalVector;
50 
51  IdentityGridLeafIntersection(const GridImp* identityGrid,
52  const HostLeafIntersectionIterator& hostIterator)
53  : identityGrid_(identityGrid),
54  hostIterator_(hostIterator)
55  {}
56 
60  return IdentityGridEntityPointer<0,GridImp> (identityGrid_, hostIterator_->inside());
61  }
62 
63 
67  return IdentityGridEntityPointer<0,GridImp> (identityGrid_, hostIterator_->outside());
68  }
69 
70 
72  bool boundary () const {
73  return hostIterator_->boundary();
74  }
75 
82  return hostIterator_->centerUnitOuterNormal();
83  }
84 
86  bool neighbor () const {
87  return hostIterator_->neighbor();
88  }
89 
90 
92  int boundaryId () const {
93  return hostIterator_->boundaryId();
94  }
95 
97  size_t boundarySegmentIndex() const {
98  return hostIterator_->boundarySegmentIndex();
99  }
100 
102  bool conforming () const {
103  return hostIterator_->conforming();
104  }
105 
107  GeometryType type () const {
108  return hostIterator_->type();
109  }
110 
111 
117  {
118  return LocalGeometry( hostIterator_->geometryInInside() );
119  }
120 
124  {
125  return LocalGeometry( hostIterator_->geometryInOutside() );
126  }
127 
131  {
132  return Geometry( hostIterator_->geometry() );
133  }
134 
135 
137  int indexInInside () const {
138  return hostIterator_->indexInInside();
139  }
140 
141 
143  int indexInOutside () const {
144  return hostIterator_->indexInOutside();
145  }
146 
147 
149  FieldVector<ctype, GridImp::dimensionworld> outerNormal (const FieldVector<ctype, GridImp::dimension-1>& local) const {
150  return hostIterator_->outerNormal(local);
151  }
152 
154  FieldVector<ctype, GridImp::dimensionworld> integrationOuterNormal (const FieldVector<ctype, GridImp::dimension-1>& local) const {
155  return hostIterator_->integrationOuterNormal(local);
156  }
157 
159  FieldVector<ctype, GridImp::dimensionworld> unitOuterNormal (const FieldVector<ctype, GridImp::dimension-1>& local) const {
160  return hostIterator_->unitOuterNormal(local);
161  }
162 
163 
164  private:
165  //**********************************************************
166  // private methods
167  //**********************************************************
168 
169  const GridImp* identityGrid_;
170 
171  HostLeafIntersectionIterator hostIterator_;
172 };
173 
174 
175 
176 
178 template<class GridImp>
180 {
181 
183 
184  friend struct HostGridAccess< typename remove_const< GridImp >::type >;
185 
186  enum {dim=GridImp::dimension};
187 
188  enum {dimworld=GridImp::dimensionworld};
189 
190  // The type used to store coordinates
191  typedef typename GridImp::ctype ctype;
192 
193  typedef typename GridImp::HostGridType::template Codim<0>::Entity::LevelIntersectionIterator HostLevelIntersectionIterator;
194 
195  public:
196 
197  typedef typename GridImp::template Codim<0>::EntityPointer EntityPointer;
198  typedef typename GridImp::template Codim<1>::Geometry Geometry;
199  typedef typename GridImp::template Codim<1>::LocalGeometry LocalGeometry;
200  typedef typename GridImp::template Codim<0>::Entity Entity;
201  typedef FieldVector<ctype, dimworld> NormalVector;
202 
203  IdentityGridLevelIntersection(const GridImp* identityGrid,
204  const HostLevelIntersectionIterator& hostIterator)
205  : identityGrid_(identityGrid), hostIterator_(hostIterator)
206  {}
207 
211  return IdentityGridEntityPointer<0,GridImp> (identityGrid_, hostIterator_->inside());
212  }
213 
214 
218  return IdentityGridEntityPointer<0,GridImp> (identityGrid_, hostIterator_->outside());
219  }
220 
221 
224  bool boundary () const {
225  return hostIterator_->boundary();
226  }
227 
234  return hostIterator_->centerUnitOuterNormal();
235  }
236 
238  bool neighbor () const {
239  return hostIterator_->neighbor();
240  }
241 
242 
244  int boundaryId () const {
245  return hostIterator_->boundaryId();
246  }
247 
249  size_t boundarySegmentIndex() const {
250  return hostIterator_->boundarySegmentIndex();
251  }
252 
254  bool conforming () const {
255  return hostIterator_->conforming();
256  }
257 
259  GeometryType type () const {
260  return hostIterator_->type();
261  }
262 
263 
269  {
270  return LocalGeometry( hostIterator_->geometryInInside() );
271  }
272 
276  {
277  return LocalGeometry( hostIterator_->geometryInOutside() );
278  }
279 
283  {
284  return Geometry( hostIterator_->geometry() );
285  }
286 
287 
289  int indexInInside () const {
290  return hostIterator_->indexInInside();
291  }
292 
293 
295  int indexInOutside () const {
296  return hostIterator_->indexInOutside();
297  }
298 
299 
301  FieldVector<ctype, dimworld> outerNormal (const FieldVector<ctype, dim-1>& local) const {
302  return hostIterator_->outerNormal(local);
303  }
304 
306  FieldVector<ctype, dimworld> integrationOuterNormal (const FieldVector<ctype, dim-1>& local) const {
307  return hostIterator_->integrationOuterNormal(local);
308  }
309 
311  FieldVector<ctype, dimworld> unitOuterNormal (const FieldVector<ctype, dim-1>& local) const {
312  return hostIterator_->unitOuterNormal(local);
313  }
314 
315  private:
316 
317  const GridImp* identityGrid_;
318 
319  HostLevelIntersectionIterator hostIterator_;
320 
321 };
322 
323 
324 } // namespace Dune
325 
326 #endif