Logo  0.95.0-final
Finite Element Embedded Library and Language in C++
Feel++ Feel++ on Github Feel++ community
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
simplexordering.hpp
1 /* -*- mode: c++; coding: utf-8; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; show-trailing-whitespace: t -*-
2 
3  This file is part of the Feel library
4 
5  Author(s): Christophe Prud'homme <christophe.prudhomme@feelpp.org>
6  Date: 2010-11-28
7 
8  Copyright (C) 2010 Université Joseph Fourier (Grenoble I)
9 
10  This library is free software; you can redistribute it and/or
11  modify it under the terms of the GNU Lesser General Public
12  License as published by the Free Software Foundation; either
13  version 2.1 of the License, or (at your option) any later version.
14 
15  This library is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public
21  License along with this library; if not, write to the Free Software
22  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 */
29 #ifndef __SimplexOrdering_H
30 #define __SimplexOrdering_H 1
31 
33 
34 namespace Feel
35 {
37 namespace details
38 {
52 template<uint16_type Order >
53 struct triangle
54 {
55  static uint16_type f2e( uint16_type /*f*/, uint16_type e )
56  {
57  return __f2e[e];
58  }
59  static const uint16_type __f2e[3];
60  // f2eLoc : (num face,num edge glob)->num edge loc in face
61  static uint16_type f2eLoc( uint16_type /*f*/, uint16_type e )
62  {
63  return __f2e[e];
64  }
65  static uint16_type f2p( uint16_type /*f*/, uint16_type p )
66  {
67  return __f2p[p];
68  }
69  static const uint16_type __f2p[21];
70 
71  static uint16_type e2p( uint16_type e, uint16_type p )
72  {
73  return e2p( e,p,boost::mpl::int_<Order>() );
74  }
75 
76  static uint16_type e2p( uint16_type e, uint16_type p,boost::mpl::int_<1> )
77  {
78  return __e2p_order1[2*e+p];
79  }
80  static uint16_type e2p( uint16_type e, uint16_type p,boost::mpl::int_<2> )
81  {
82  return __e2p_order2[3*e+p];
83  }
84  static uint16_type e2p( uint16_type e, uint16_type p,boost::mpl::int_<3> )
85  {
86  return __e2p_order3[4*e+p];
87  }
88  static uint16_type e2p( uint16_type e, uint16_type p,boost::mpl::int_<4> )
89  {
90  return __e2p_order4[5*e+p];
91  }
92  static uint16_type e2p( uint16_type e, uint16_type p,boost::mpl::int_<5> )
93  {
94  return __e2p_order5[6*e+p];
95  }
96 
97  static const uint16_type __e2p_order1[6];
98  static const uint16_type __e2p_order2[9];
99  static const uint16_type __e2p_order3[12];
100  static const uint16_type __e2p_order4[15];
101  static const uint16_type __e2p_order5[18];
102 
103 
104  std::vector<uint16_type> entity( uint16_type /*topo_dim*/, uint16_type id ) const
105  {
106  std::vector<uint16_type> __entity( 2 );
107  __entity[0] = __e2p_order1[2*id];
108  __entity[1] = __e2p_order1[2*id+1];
109  return __entity;
110  }
111 };
112 template<uint16_type Order>
113 const uint16_type triangle<Order>::__e2p_order1[6] =
114 {
115  1, 2, // edge 0
116  2, 0, // edge 1
117  0, 1 // edge 2
118 };
119 template<uint16_type Order>
120 const uint16_type triangle<Order>::__e2p_order2[9] =
121 {
122  1, 2, 3, // edge 0
123  2, 0, 4, // edge 1
124  0, 1, 5 // edge 2
125 };
126 template<uint16_type Order>
127 const uint16_type triangle<Order>::__e2p_order3[12] =
128 {
129  1, 2, 3, 4, // edge 0
130  2, 0, 5, 6, // edge 1
131  0, 1, 7, 8 // edge 2
132 };
133 template<uint16_type Order>
134 const uint16_type triangle<Order>::__e2p_order4[15] =
135 {
136  1, 2, 3, 4, 5, // edge 0
137  2, 0, 6, 7, 8, // edge 1
138  0, 1, 9,10,11 // edge 2
139 };
140 template<uint16_type Order>
141 const uint16_type triangle<Order>::__e2p_order5[18] =
142 {
143  1, 2, 3, 4, 5, 6, // edge 0
144  2, 0, 7, 8, 9,10, // edge 1
145  0, 1,11,12,13,14 // edge 2
146 };
147 
148 
149 template<uint16_type Order>
150 const uint16_type triangle<Order>::__f2p[21] =
151 {
152  0, // point 0 - vertex
153  1, // point 1 - vertex
154  2, // point 2 - vertex
155  3, 4, 5, 6, 7, 8, 9, // edge
156  10, 11, 12, 13, 14, // edge
157  15, 16, 17, 18, 19, 20 // interior points
158 
159 };
160 
161 template<uint16_type Order>
162 const uint16_type triangle<Order>::__f2e[3] =
163 {
164  0, // edge 0
165  1, // edge 1
166  2 // edge 2
167 };
168 
184 template<uint16_type Order >
185 struct tetra
186 {
187  static uint16_type f2e( uint16_type f, uint16_type e )
188  {
189  return __f2e[3*f+e];
190  }
191  static const uint16_type __f2e[12];
192  // f2eLoc : (num face,num edge glob)->num edge loc in face
193  static uint16_type f2eLoc( uint16_type f, uint16_type e )
194  {
195  return __f2eLoc[6*f+e];
196  }
197  static const uint16_type __f2eLoc[24];
198  static int16_type f2eOrientation( uint16_type f, uint16_type e )
199  {
200  return __f2e_orientation[3*f+e];
201  }
202  static const int16_type __f2e_orientation[12];
203 
204 
205  static uint16_type f2p( uint16_type e, uint16_type p )
206  {
207  return f2p( e,p,boost::mpl::int_<( Order>4 )?1:Order>() );
208  }
209  static uint16_type f2p( uint16_type f, uint16_type p, boost::mpl::int_<1> )
210  {
211  return __f2p_order1[3*f+p];
212  }
213  static uint16_type f2p( uint16_type f, uint16_type p, boost::mpl::int_<2> )
214  {
215  return __f2p_order2[6*f+p];
216  }
217  static uint16_type f2p( uint16_type f, uint16_type p, boost::mpl::int_<3> )
218  {
219  return __f2p_order3[10*f+p];
220  }
221  static uint16_type f2p( uint16_type f, uint16_type p, boost::mpl::int_<4> )
222  {
223  return __f2p_order4[15*f+p];
224  }
225  static const uint16_type __f2p_order1[12];
226  static const uint16_type __f2p_order2[24];
227  static const uint16_type __f2p_order3[40];
228  static const uint16_type __f2p_order4[60];
229 
230  static uint16_type e2p( uint16_type e, uint16_type p )
231  {
232  return e2p( e,p,boost::mpl::int_<Order>() );
233  }
234  static uint16_type e2p( uint16_type e, uint16_type p,boost::mpl::int_<1> )
235  {
236  return __e2p_order1[2*e+p];
237  }
238  static uint16_type e2p( uint16_type e, uint16_type p,boost::mpl::int_<2> )
239  {
240  return __e2p_order2[3*e+p];
241  }
242  static uint16_type e2p( uint16_type e, uint16_type p,boost::mpl::int_<3> )
243  {
244  return __e2p_order3[4*e+p];
245  }
246  static uint16_type e2p( uint16_type e, uint16_type p,boost::mpl::int_<4> )
247  {
248  return __e2p_order4[5*e+p];
249  }
250  static uint16_type e2p( uint16_type e, uint16_type p,boost::mpl::int_<5> )
251  {
252  return __e2p_order5[6*e+p];
253  }
254 
255  static const uint16_type __e2p_order1[12];
256  static const uint16_type __e2p_order2[18];
257  static const uint16_type __e2p_order3[24];
258  static const uint16_type __e2p_order4[30];
259  static const uint16_type __e2p_order5[36];
260 
261  std::vector<uint16_type> entity( uint16_type topo_dim, uint16_type id ) const
262  {
263  std::vector<uint16_type> __entity( topo_dim+1 );
264 
265  if ( topo_dim == 1 )
266  {
267  __entity[0] = __e2p_order1[2*id];
268  __entity[1] = __e2p_order1[2*id+1];
269 
270  }
271 
272  else if ( topo_dim == 2 )
273  {
274  __entity[0] = __f2p_order1[3*id];
275  __entity[1] = __f2p_order1[3*id+1];
276  __entity[2] = __f2p_order1[3*id+2];
277  }
278 
279  return __entity;
280  }
281 };
282 template<uint16_type Order >
283 const uint16_type tetra<Order>::__e2p_order1[12] =
284 {
285  1, 2, // edge 0
286  2, 0, // edge 1
287  0, 1, // edge 2
288  0, 3, // edge 3
289  1, 3, // edge 4
290  2, 3 // edge 5
291 };
292 
293 template<uint16_type Order >
294 const uint16_type tetra<Order>::__e2p_order2[18] =
295 {
296  1, 2, 4, // edge 0
297  2, 0, 5, // edge 1
298  0, 1, 6, // edge 2
299  0, 3, 7, // edge 3
300  1, 3, 8, // edge 4
301  2, 3, 9 // edge 5
302 };
303 
304 template<uint16_type Order >
305 const uint16_type tetra<Order>::__e2p_order3[24] =
306 {
307  1, 2, 4, 5, // edge 0
308  2, 0, 6, 7, // edge 1
309  0, 1, 8, 9, // edge 2
310  0, 3,10,11, // edge 3
311  1, 3,12,13, // edge 4
312  2, 3,14,15 // edge 5
313 };
314 
315 template<uint16_type Order >
316 const uint16_type tetra<Order>::__e2p_order4[30] =
317 {
318  1, 2, 4, 5, 6, // edge 0
319  2, 0, 7, 8, 9, // edge 1
320  0, 1, 10, 11, 12, // edge 2
321  0, 3, 13, 14, 15, // edge 3
322  1, 3, 16, 17, 18, // edge 4
323  2, 3, 19, 20, 21 // edge 5
324 };
325 
326 
327 template<uint16_type Order >
328 const uint16_type tetra<Order>::__e2p_order5[36] =
329 {
330  1, 2, 4, 5, 6, 7, // edge 0
331  2, 0, 8, 9, 10, 11, // edge 1
332  0, 1, 12, 13, 14, 15, // edge 2
333  0, 3, 16, 17, 18, 19, // edge 3
334  1, 3, 20, 21, 22, 23, // edge 4
335  2, 3, 25, 26, 27, 28 // edge 5
336 };
337 
338 
339 template<uint16_type Order >
340 const uint16_type tetra<Order>::__f2p_order1[12] =
341 {
342  1, 2, 3, // face 0
343  0, 2, 3, // face 1
344  0, 1, 3, // face 2
345  0, 1, 2 // face 3
346 };
347 
348 template<uint16_type Order >
349 const uint16_type tetra<Order>::__f2p_order2[24] =
350 {
351  1, 2, 3, 9, 8, 4, // face 0
352  0, 2, 3, 9, 7, 5, // face 1
353  0, 1, 3, 8, 7, 6, // face 2
354  0, 1, 2, 4, 5, 6 // face 3
355 };
356 
357 template<uint16_type Order >
358 const uint16_type tetra<Order>::__f2p_order3[40] =
359 {
360  1, 2, 3, 14, 15, 13, 12, 4, 5, 16, // face 0
361  0, 2, 3, 14, 15, 11, 10, 7, 6, 17, // face 1
362  0, 1, 3, 12, 13, 11, 10, 8, 9, 18, // face 2
363  0, 1, 2, 4, 5, 6, 7, 8, 9, 19 // face 3
364 };
365 
366 template<uint16_type Order >
367 const uint16_type tetra<Order>::__f2p_order4[60] =
368 {
369  1, 2, 3, 19, 20, 21, 18, 17, 16, 4, 5, 6, 22, 23, 24, // face 0
370  0, 2, 3, 19, 20, 21, 15, 14, 13, 9, 8, 7, 25, 26, 27, // face 1
371  0, 1, 3, 16, 17, 18, 15, 14, 13, 10, 11, 12, 28, 29, 30, // face 2
372  0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 31, 32, 33 // face 3
373 };
374 
375 template<uint16_type Order >
376 const uint16_type tetra<Order>::__f2e[12] =
377 {
378  5, 4, 0, // face 0
379  5, 3, 1, // face 1
380  4, 3, 2, // face 2
381  0, 1, 2 // face 3
382 };
383 
384 //99 for bad value
385 template<uint16_type Order >
386 const uint16_type tetra<Order>:: __f2eLoc[24] =
387 {
388  2 , 99, 99, 99, 1, 0, // face 0
389  99, 2, 99, 1, 99, 0, // face 1
390  99, 99, 2, 1, 0, 99, // face 2
391  0 , 1, 2, 99, 99, 99 // face 3
392 };
393 
394 template<uint16_type Order >
395 const int16_type tetra<Order>::__f2e_orientation[12] =
396 {
397  1, -1, 1, // face 0
398  1, -1,-1, // face 1
399  1, -1, 1, // face 2
400  1, 1, 1 // face 3
401 };
402 
403 } // details
405 
406 }
407 #endif /* __SimplexOrdering_H */

Generated on Fri Oct 25 2013 14:24:24 for Feel++ by doxygen 1.8.4