dune-fem  2.4.1-rc
boundaryidprovider.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_MISC_BOUNDARYIDPROVIDER_HH
2 #define DUNE_FEM_MISC_BOUNDARYIDPROVIDER_HH
3 
4 #if not DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS
5 #error "Experimental grid extensions required. Reconfigure with --enable-experimental-grid-extensions."
6 #endif // #if not DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS
7 
8 #if HAVE_DUNE_SPGRID
9 #include <dune/grid/spgrid/declaration.hh>
10 #endif // #if HAVE_DUNE_SPGRID
11 
13 
14 namespace Dune
15 {
16 
17  // External Forward Declarations
18  // -----------------------------
19 
20  template< class Grid >
22 
23 
24 
25  namespace Fem
26  {
27 
28  // Internal Forward Declarations
29  // -----------------------------
30 
31  template< class Grid >
33 
34 
35 
36  // BoundaryIdProvider for AlbertaGrid
37  // ----------------------------------
38 
39 #if HAVE_ALBERTA
40  template< int dim, int dimW >
41  struct BoundaryIdProvider< AlbertaGrid< dim, dimW > >
42  {
43  typedef AlbertaGrid< dim, dimW > GridType;
44 
45  template< class Intersection >
46  static int boundaryId ( const Intersection &intersection )
47  {
48  return intersection.impl().boundaryId();
49  }
50  };
51 #endif // #if HAVE_ALBERTA
52 
53 
54 
55  // BoundaryIdProvider for ALUGrid
56  // ------------------------------
57 
58 #if HAVE_ALUGRID || HAVE_DUNE_ALUGRID
59  template< int dim, int dimw, ALUGridElementType elType, ALUGridRefinementType refineType, class Comm >
60  struct BoundaryIdProvider< ALUGrid< dim, dimw, elType, refineType, Comm > >
61  {
62  typedef ALUGrid< dim, dimw, elType, refineType, Comm > GridType;
63 
64  template< class Intersection >
65  static int boundaryId ( const Intersection &intersection )
66  {
67  return intersection.impl().boundaryId();
68  }
69  };
70 #endif // #if HAVE_ALUGRID || HAVE_DUNE_ALUGRID
71 
72 
73 
74  // BoundaryIdProvider for ALUConformGrid
75  // -------------------------------------
76 
77 #if HAVE_ALUGRID
78  template< int dim, int dimw >
79  struct BoundaryIdProvider< ALUConformGrid< dim, dimw > >
80  {
81  typedef ALUConformGrid< dim, dimw > GridType;
82 
83  template< class Intersection >
84  static int boundaryId ( const Intersection &intersection )
85  {
86  return intersection.impl().boundaryId();
87  }
88  };
89 #endif // #if HAVE_ALUGRID
90 
91 
92 
93  // BoundaryIdProvider for ALUCubeGrid
94  // ----------------------------------
95 
96 #if HAVE_ALUGRID
97  template< int dim, int dimw >
98  struct BoundaryIdProvider< ALUCubeGrid< dim, dimw > >
99  {
100  typedef ALUCubeGrid< dim, dimw > GridType;
101 
102  template< class Intersection >
103  static int boundaryId ( const Intersection &intersection )
104  {
105  return intersection.impl().boundaryId();
106  }
107  };
108 #endif // #if HAVE_ALUGRID
109 
110 
111 
112  // BoundaryIdProvider for ALUSimplexGrid
113  // -------------------------------------
114 
115 #if HAVE_ALUGRID
116  template< int dim, int dimw >
117  struct BoundaryIdProvider< ALUSimplexGrid< dim, dimw > >
118  {
119  typedef ALUSimplexGrid< dim, dimw > GridType;
120 
121  template< class Intersection >
122  static int boundaryId ( const Intersection &intersection )
123  {
124  return intersection.impl().boundaryId();
125  }
126  };
127 #endif // #if HAVE_ALUGRID
128 
129 
130 
131  // BoundaryIdProvider for CacheItGrid
132  // ----------------------------------
133 
134 #if HAVE_DUNE_METAGRID
135  template< class HostGrid >
136  struct BoundaryIdProvider< CacheItGrid< HostGrid > >
137  {
138  typedef CacheItGrid< HostGrid > GridType;
139 
140  template< class Intersection >
141  static int boundaryId ( const Intersection &intersection )
142  {
145  }
146  };
147 #endif // #if HAVE_DUNE_METAGRID
148 
149 
150 
151  // BoundaryIdProvider for CartesianGrid
152  // ------------------------------------
153 
154 #if HAVE_DUNE_METAGRID
155  template< class HostGrid >
156  struct BoundaryIdProvider< CartesianGrid< HostGrid > >
157  {
158  typedef CartesianGrid< HostGrid > GridType;
159 
160  template< class Intersection >
161  static int boundaryId ( const Intersection &intersection )
162  {
165  }
166  };
167 #endif // #if HAVE_DUNE_METAGRID
168 
169 
170 
171  // BoundaryIdProvider for FilteredGrid
172  // -----------------------------------
173 
174 #if HAVE_DUNE_METAGRID
175  template< class HostGrid >
176  struct BoundaryIdProvider< FilteredGrid< HostGrid > >
177  {
178  typedef FilteredGrid< HostGrid > GridType;
179 
180  // todo: FilteredGrid is a filtering grid and, hence, needs a specialized
181  // version of boundaryId.
182  template< class Intersection >
183  static int boundaryId ( const Intersection &intersection )
184  {
185  if( !iHostGridAccess< GridType >::getIntersection( intersection ).boundary() )
186  DUNE_THROW( NotImplemented, "BoundaryIdProvider for artificial boundaries of FilteredGrid not implemented." );
189  }
190  };
191 #endif // #if HAVE_DUNE_METAGRID
192 
193 
194 
195  // BoundaryIdProvider for GeometryGrid
196  // -----------------------------------
197 
198  template< class HostGrid, class CoordFunction, class Allocator >
199  struct BoundaryIdProvider< GeometryGrid< HostGrid, CoordFunction, Allocator > >
200  {
201  typedef GeometryGrid< HostGrid, CoordFunction, Allocator > GridType;
202 
203  template< class Intersection >
204  static int boundaryId ( const Intersection &intersection )
205  {
208  }
209  };
210 
211 
212 
213  // BoundaryIdProvider for IdGrid
214  // -----------------------------
215 
216 #if HAVE_DUNE_METAGRID
217  template< class HostGrid >
218  struct BoundaryIdProvider< IdGrid< HostGrid > >
219  {
220  typedef IdGrid< HostGrid > GridType;
221 
222  template< class Intersection >
223  static int boundaryId ( const Intersection &intersection )
224  {
227  }
228  };
229 #endif // #if HAVE_DUNE_METAGRID
230 
231 
232 
233  // BoundaryIdProvider for OneDGrid
234  // -------------------------------
235 
236  template<>
237  struct BoundaryIdProvider< OneDGrid >
238  {
239  typedef OneDGrid GridType;
240 
241  template< class Intersection >
242  static int boundaryId ( const Intersection &intersection )
243  {
244  return intersection.boundarySegmentIndex();
245  }
246  };
247 
248 
249 
250  // BoundaryIdProvider for ParallelGrid
251  // -----------------------------------
252 
253 #if HAVE_DUNE_METAGRID
254  template< class HostGrid >
255  struct BoundaryIdProvider< ParallelGrid< HostGrid > >
256  {
257  typedef ParallelGrid< HostGrid > GridType;
258 
259  template< class Intersection >
260  static int boundaryId ( const Intersection &intersection )
261  {
264  }
265  };
266 #endif // #if HAVE_DUNE_METAGRID
267 
268 
269 
270  // BoundaryIdProvider for SGrid
271  // ----------------------------
272 
273  template< int dim, int dimw, class ctype >
274  struct BoundaryIdProvider< SGrid< dim, dimw, ctype > >
275  {
277 
278  template< class Intersection >
279  static int boundaryId ( const Intersection &intersection )
280  {
281  return (intersection.boundary() ? (intersection.indexInInside()+1) : 0);
282  }
283  };
284 
285 
286 
287  // BoundaryIdProvider for SphereGrid
288  // ---------------------------------
289 
290 #if HAVE_DUNE_METAGRID
291  template< class HostGrid, class MapToSphere >
292  struct BoundaryIdProvider< SphereGrid< HostGrid, MapToSphere > >
293  {
294  typedef SphereGrid< HostGrid, MapToSphere > GridType;
295 
296  template< class Intersection >
297  static int boundaryId ( const Intersection &intersection )
298  {
301  }
302  };
303 #endif // #if HAVE_DUNE_METAGRID
304 
305 
306 
307  // BoundaryIdProvider for SPGrid
308  // -----------------------------
309 
310 #if HAVE_DUNE_SPGRID
311  template< class ct, int dim, template< int > class Strategy, class Comm >
312  struct BoundaryIdProvider< SPGrid< ct, dim, Strategy, Comm > >
313  {
314  typedef SPGrid< ct, dim, Strategy, Comm > GridType;
315 
316  template< class Intersection >
317  static int boundaryId ( const Intersection &intersection )
318  {
319  return (intersection.boundary() ? (intersection.indexInInside()+1) : 0);
320  }
321  };
322 #endif // #if HAVE_DUNE_SPGRID
323 
324 
325 
326  // BoundaryIdProvider for UGGrid
327  // -----------------------------
328 
329  template< int dim >
330  struct BoundaryIdProvider< UGGrid< dim > >
331  {
333 
334  template< class Intersection >
335  static int boundaryId ( const Intersection &intersection )
336  {
337  return intersection.boundarySegmentIndex();
338  }
339  };
340 
341 
342 
343  // BoundaryIdProvider for YaspGrid
344  // -------------------------------
345 
346  template< int dim, class CoordCont >
347  struct BoundaryIdProvider< YaspGrid< dim, CoordCont > >
348  {
350 
351  template< class Intersection >
352  static int boundaryId ( const Intersection &intersection )
353  {
354  return (intersection.boundary() ? (intersection.indexInInside()+1) : 0);
355  }
356  };
357 
358  } // namespace Fem
359 
360 } // namespace Dune
361 
362 #endif // #ifndef DUNE_FEM_MISC_BOUNDARYIDPROVIDER_HH
Definition: griddeclaration.hh:41
Definition: griddeclaration.hh:38
Definition: griddeclaration.hh:44
SGrid< dim, dimw, ctype > GridType
Definition: boundaryidprovider.hh:276
static int boundaryId(const Intersection &intersection)
Definition: boundaryidprovider.hh:204
Definition: boundaryidprovider.hh:21
GeometryGrid< HostGrid, CoordFunction, Allocator > GridType
Definition: boundaryidprovider.hh:201
static int boundaryId(const Intersection &intersection)
Definition: boundaryidprovider.hh:242
static int boundaryId(const Intersection &intersection)
Definition: boundaryidprovider.hh:352
Definition: griddeclaration.hh:35
YaspGrid< dim, CoordCont > GridType
Definition: boundaryidprovider.hh:349
Definition: boundaryidprovider.hh:32
OneDGrid GridType
Definition: boundaryidprovider.hh:239
Definition: coordinate.hh:4
static int boundaryId(const Intersection &intersection)
Definition: boundaryidprovider.hh:335
UGGrid< dim > GridType
Definition: boundaryidprovider.hh:332
static int boundaryId(const Intersection &intersection)
Definition: boundaryidprovider.hh:279