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
geotool.hpp
Go to the documentation of this file.
1 /* -*- mode: c++; coding: utf-8; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; show-trailing-whitespace: t -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2 
3  This file is part of the Feel library
4 
5  Author(s): Vincent Chabannes <vincent.chabannes@imag.fr>
6  Date: 2011-03-03
7 
8  Copyright (C) 2011 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 3.0 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 */
31 #ifndef __geotool_H
32 #define __geotool_H 1
33 
34 #include <iostream>
35 #include <string>
36 #include <sstream>
37 #include <list>
38 #include <map>
39 #include <feel/feelalg/glas.hpp>
40 //#include <boost/parameter/keyword.hpp>
41 //#include <boost/parameter/preprocessor.hpp>
42 #include <feel/feelcore/parameter.hpp>
44 
45 #include <boost/preprocessor/tuple/elem.hpp>
46 
47 
48 
49 /*_________________________________________________*/
50 /*_________________________________________________*/
51 /*_________________________________________________*/
52 
53 # define GEOTOOL_SHAPE \
54  ( 18, ( ( Line , 1, 0, 0, "line" , 2, LINE ), \
55  ( Triangle , 2, 1, 0, "triangle" , 3, TRIANGLE ), \
56  ( Rectangle , 2, 1, 0, "rectangle" , 2, RECTANGLE ), \
57  ( Quadrangle , 2, 1, 0, "quadrangle" , 4, QUADRANGLE ), \
58  ( Pentagon , 2, 1, 0, "pentagon" , 5, PENTAGON ), \
59  ( Hexagon , 2, 1, 0, "hexagon" , 6, HEXAGON ), \
60  ( Circle , 2, 1, 0, "circle" , 2, CIRCLE ), \
61  ( Ellipse , 2, 1, 0, "ellipse" , 3, ELLIPSE ), \
62  ( Pie , 2, 1, 0, "pie" , 3, PIE ), \
63  ( Special_1a , 2, 2, 0, "special_1a" , 1, SPECIAL_1A ), \
64  ( Special_1b , 2, 1, 0, "special_1b" , 1, SPECIAL_1B ), \
65  ( Peanut , 2, 1, 0, "peanut" , 4, PEANUT ), \
66  ( Hexaedre , 3, 6, 1, "hexaedre" , 8, HEXAEDRE ), \
67  ( Cube , 3, 6, 1, "cube" , 2, CUBE ), \
68  ( Cylindre , 3, 6, 1, "cylindre" , 4, CYLINDRE ), \
69  ( Sphere , 3, 8, 1, "sphere" , 2, SPHERE ), \
70  ( Tube , 3,20, 4, "tube" , 5, TUBE ), \
71  ( Special3D_1 , 3, 9, 1, "special3D_1" , 1, SPECIAL3D_1 ) \
72  ) \
73  ) \
74 
75 
76 /*_________________________________________________*/
77 
78 # define GEOTOOL_MARKER_POINT_LINE \
79  ( 2, ( ( 1, 1, ( 1 ) ), \
80  ( 2, 1, ( 2 ) ) ) \
81  ) \
82 
83 
84 # define GEOTOOL_MARKER_LINE_LINE \
85  ( 1, ( ( 1, 1, ( 1 ) ) ) \
86  ) \
87 
88 
89 /*_________________________________________________*/
90 
91 # define GEOTOOL_MARKER_POINT_TRIANGLE \
92  ( 3, ( ( 1, 1, ( 1 ) ), \
93  ( 2, 1, ( 2 ) ), \
94  ( 3, 1, ( 3 ) ) ) \
95  ) \
96 
97 
98 # define GEOTOOL_MARKER_LINE_TRIANGLE \
99  ( 3, ( ( 1, 1, ( 1 ) ), \
100  ( 2, 1, ( 2 ) ), \
101  ( 3, 1, ( 3 ) ) ) \
102  ) \
103 
104 # define GEOTOOL_MARKER_SURFACE_TRIANGLE \
105  ( 1, ( ( 1, 1, ( 1 ) ) ) \
106  ) \
107 
108 
109 /*_________________________________________________*/
110 
111 # define GEOTOOL_MARKER_POINT_RECTANGLE \
112  ( 4, ( ( 1, 1, ( 1 ) ), \
113  ( 2, 1, ( 2 ) ), \
114  ( 3, 1, ( 3 ) ), \
115  ( 4, 1, ( 4 ) ) ) \
116  ) \
117 
118 # define GEOTOOL_MARKER_LINE_RECTANGLE \
119  ( 4, ( ( 1, 1, ( 1 ) ), \
120  ( 2, 1, ( 2 ) ), \
121  ( 3, 1, ( 3 ) ), \
122  ( 4, 1, ( 4 ) ) ) \
123  ) \
124 
125 # define GEOTOOL_MARKER_SURFACE_RECTANGLE \
126  ( 1, ( ( 1, 1, ( 1 ) ) ) \
127  ) \
128 
129 
130 /*_________________________________________________*/
131 
132 # define GEOTOOL_MARKER_POINT_QUADRANGLE \
133  ( 4, ( ( 1, 1, ( 1 ) ), \
134  ( 2, 1, ( 2 ) ), \
135  ( 3, 1, ( 3 ) ), \
136  ( 4, 1, ( 4 ) ) ) \
137  ) \
138 
139 # define GEOTOOL_MARKER_LINE_QUADRANGLE \
140  ( 4, ( ( 1, 1, ( 1 ) ), \
141  ( 2, 1, ( 2 ) ), \
142  ( 3, 1, ( 3 ) ), \
143  ( 4, 1, ( 4 ) ) ) \
144  ) \
145 
146 # define GEOTOOL_MARKER_SURFACE_QUADRANGLE \
147  ( 1, ( ( 1, 1, ( 1 ) ) ) \
148  ) \
149 
150 
151 /*_________________________________________________*/
152 
153 # define GEOTOOL_MARKER_POINT_PENTAGON \
154  ( 5, ( ( 1, 1, ( 1 ) ), \
155  ( 2, 1, ( 2 ) ), \
156  ( 3, 1, ( 3 ) ), \
157  ( 4, 1, ( 4 ) ), \
158  ( 5, 1, ( 5 ) ) ) \
159  ) \
160 
161 # define GEOTOOL_MARKER_LINE_PENTAGON \
162  ( 5, ( ( 1, 1, ( 1 ) ), \
163  ( 2, 1, ( 2 ) ), \
164  ( 3, 1, ( 3 ) ), \
165  ( 4, 1, ( 4 ) ), \
166  ( 5, 1, ( 5 ) ) ) \
167  ) \
168 
169 # define GEOTOOL_MARKER_SURFACE_PENTAGON \
170  ( 1, ( ( 1, 1, ( 1 ) ) ) \
171  ) \
172 
173 
174 /*_________________________________________________*/
175 
176 
177 # define GEOTOOL_MARKER_POINT_HEXAGON \
178  ( 6, ( ( 1, 1, ( 1 ) ), \
179  ( 2, 1, ( 2 ) ), \
180  ( 3, 1, ( 3 ) ), \
181  ( 4, 1, ( 4 ) ), \
182  ( 5, 1, ( 5 ) ), \
183  ( 6, 1, ( 6 ) ) ) \
184  ) \
185 
186 # define GEOTOOL_MARKER_LINE_HEXAGON \
187  ( 6, ( ( 1, 1, ( 1 ) ), \
188  ( 2, 1, ( 2 ) ), \
189  ( 3, 1, ( 3 ) ), \
190  ( 4, 1, ( 4 ) ), \
191  ( 5, 1, ( 5 ) ), \
192  ( 6, 1, ( 6 ) ) ) \
193  ) \
194 
195 # define GEOTOOL_MARKER_SURFACE_HEXAGON \
196  ( 1, ( ( 1, 1, ( 1 ) ) ) \
197  ) \
198 
199 
200 /*_________________________________________________*/
201 
202 # define GEOTOOL_MARKER_POINT_CIRCLE \
203  ( 2, ( ( 1, 2, ( 1,3 ) ), \
204  ( 2, 1, ( 2 ) ) ) \
205  ) \
206 
207 # define GEOTOOL_MARKER_LINE_CIRCLE \
208  ( 1, ( ( 1, 2, ( 1,2 ) ) ) \
209  ) \
210 
211 
212 # define GEOTOOL_MARKER_SURFACE_CIRCLE \
213  ( 1, ( ( 1, 1, ( 1 ) ) ) \
214  ) \
215 
216 
217 /*_________________________________________________*/
218 
219 # define GEOTOOL_MARKER_POINT_ELLIPSE \
220  ( 2, ( ( 1, 4, ( 2,3,4,5 ) ), \
221  ( 2, 1, ( 1 ) ) ) \
222  ) \
223 
224 # define GEOTOOL_MARKER_LINE_ELLIPSE \
225  ( 1, ( ( 1, 4, ( 1,2,3,4 ) ) ) \
226  ) \
227 
228 
229 # define GEOTOOL_MARKER_SURFACE_ELLIPSE \
230  ( 1, ( ( 1, 1, ( 1 ) ) ) \
231  ) \
232 
233 
234 /*_________________________________________________*/
235 //false : must be fix!
236 # define GEOTOOL_MARKER_POINT_PIE \
237  ( 2, ( ( 1, 2, ( 1,3 ) ), \
238  ( 2, 1, ( 2 ) ) ) \
239  ) \
240 
241 # define GEOTOOL_MARKER_LINE_PIE \
242  ( 2, ( ( 1, 4, ( 1,2,3,4 ) ), \
243  ( 2, 1, ( 5 ) ) ) \
244  ) \
245 
246 
247 # define GEOTOOL_MARKER_SURFACE_PIE \
248  ( 1, ( ( 1, 1, ( 1 ) ) ) \
249  ) \
250 
251 
252 /*_________________________________________________*/
253 
254 # define GEOTOOL_MARKER_POINT_SPECIAL_1A \
255  ( 1, ( ( 1, 24, ( 1,2,3,4,5,6, \
256  7,8,9,10,11,12, \
257  13,14,15,16,17,18, \
258  19,20,21,22,23,24 ) ) ) ) \
259 
260 # define GEOTOOL_MARKER_LINE_SPECIAL_1A \
261  ( 4, ( ( 1, 2, ( 1,5 ) ), \
262  ( 2, 2, ( 2,6 ) ), \
263  ( 3, 2, ( 3,7 ) ), \
264  ( 4, 2, ( 4,8 ) ) ) \
265  ) \
266 
267 # define GEOTOOL_MARKER_SURFACE_SPECIAL_1A \
268  ( 1, ( ( 1, 2, ( 1,2 ) ) ) \
269  ) \
270 
271 
272 /*_________________________________________________*/
273 
274 # define GEOTOOL_MARKER_POINT_SPECIAL_1B \
275  ( 1, ( ( 1, 12, ( 1,2,3,4,5,6, \
276  7,8,9,10,11,12 ) ) ) ) \
277 
278 # define GEOTOOL_MARKER_LINE_SPECIAL_1B \
279  ( 3, ( ( 1, 2, ( 1,2 ) ), \
280  ( 2, 1, ( 3 ) ), \
281  ( 3, 1, ( 4 ) ) \
282  ) \
283  ) \
284 
285 # define GEOTOOL_MARKER_SURFACE_SPECIAL_1B \
286  ( 1, ( ( 1, 1, ( 1 ) ) ) \
287  ) \
288 
289 /*_________________________________________________*/
290 
291 # define GEOTOOL_MARKER_POINT_PEANUT \
292  ( 1, ( ( 1, 8, ( 1,2,3,4,5,6,7,8 ) ) ) ) \
293 
294 # define GEOTOOL_MARKER_LINE_PEANUT \
295  ( 1, ( ( 1, 1, ( 1 ) ) ) ) \
296 
297 # define GEOTOOL_MARKER_SURFACE_PEANUT \
298  ( 1, ( ( 1, 1, ( 1 ) ) ) ) \
299 
300 /*_________________________________________________*/
301 
302 # define GEOTOOL_MARKER_POINT_CYLINDRE \
303  ( 1, ( ( 1, 10, ( 1,2,3,4,5,6, \
304  7,8,9,10 ) ) ) ) \
305 
306 # define GEOTOOL_MARKER_LINE_CYLINDRE \
307  ( 12, ( ( 1, 1, ( 1 ) ), \
308  ( 2, 1, ( 2 ) ), \
309  ( 3, 1, ( 3 ) ), \
310  ( 4, 1, ( 4 ) ), \
311  ( 5, 1, ( 5 ) ), \
312  ( 6, 1, ( 6 ) ), \
313  ( 7, 1, ( 7 ) ), \
314  ( 8, 1, ( 8 ) ), \
315  ( 9, 1, ( 9 ) ), \
316  ( 10, 1, ( 10 ) ), \
317  ( 11, 1, ( 11 ) ), \
318  ( 12, 1, ( 12 ) ) \
319  ) \
320  ) \
321 
322 # define GEOTOOL_MARKER_SURFACE_CYLINDRE \
323  ( 3, ( ( 1, 1, ( 1 ) ), \
324  ( 2, 1, ( 2 ) ), \
325  ( 3, 4, ( 3,4,5,6 ) ) \
326  ) \
327  ) \
328 
329 # define GEOTOOL_MARKER_VOLUME_CYLINDRE \
330  ( 1, ( ( 1, 1, ( 1 ) ) ) \
331  ) \
332 
333 /*_________________________________________________*/
334 
335 # define GEOTOOL_MARKER_POINT_TUBE \
336  ( 1, ( ( 1, 18, ( 1,2,3,4,5,6, \
337  7,8,9,10,11,12, \
338  13,14,15,16,17,18 ) ) ) ) \
339 
340 # define GEOTOOL_MARKER_LINE_TUBE \
341  ( 12, ( ( 1, 1, ( 1 ) ), \
342  ( 2, 1, ( 2 ) ), \
343  ( 3, 1, ( 3 ) ), \
344  ( 4, 1, ( 4 ) ), \
345  ( 5, 1, ( 5 ) ), \
346  ( 6, 1, ( 6 ) ), \
347  ( 7, 1, ( 7 ) ), \
348  ( 8, 1, ( 8 ) ), \
349  ( 9, 1, ( 9 ) ), \
350  ( 10, 1, ( 10 ) ), \
351  ( 11, 1, ( 11 ) ), \
352  ( 12, 1, ( 12 ) ) \
353  ) \
354  ) \
355 
356 # define GEOTOOL_MARKER_SURFACE_TUBE \
357  ( 5, ( ( 1, 4, ( 1,2,3,4 ) ), \
358  ( 2, 4, ( 5,6,7,8 ) ), \
359  ( 3, 4, ( 9,10,11,12 ) ),\
360  ( 4, 4, ( 13,14,15,16 ) ), \
361  ( 5, 4, ( 17,18,19,20 ) ) \
362  ) \
363  ) \
364 
365 # define GEOTOOL_MARKER_VOLUME_TUBE \
366  ( 1, ( ( 1, 4, ( 1,2,3,4 ) ) ) \
367  ) \
368 
369 /*_________________________________________________*/
370 
371 # define GEOTOOL_MARKER_POINT_SPHERE \
372  ( 1, ( ( 1, 7, ( 1,2,3,4,5,6,7 ) ) ) ) \
373 
374 # define GEOTOOL_MARKER_LINE_SPHERE \
375  ( 12, ( ( 1, 1, ( 1 ) ), \
376  ( 2, 1, ( 2 ) ), \
377  ( 3, 1, ( 3 ) ), \
378  ( 4, 1, ( 4 ) ), \
379  ( 5, 1, ( 5 ) ), \
380  ( 6, 1, ( 6 ) ), \
381  ( 7, 1, ( 7 ) ), \
382  ( 8, 1, ( 8 ) ), \
383  ( 9, 1, ( 9 ) ), \
384  ( 10, 1, ( 10 ) ), \
385  ( 11, 1, ( 11 ) ), \
386  ( 12, 1, ( 12 ) ) \
387  ) \
388  ) \
389 
390 # define GEOTOOL_MARKER_SURFACE_SPHERE \
391  ( 1, ( ( 1, 8, ( 1,2,3,4,5,6,7,8 ) ) \
392  ) \
393  ) \
394 
395 # define GEOTOOL_MARKER_VOLUME_SPHERE \
396  ( 1, ( ( 1, 1, ( 1 ) ) ) \
397  ) \
398 
399 
400 /*_________________________________________________*/
401 
402 # define GEOTOOL_MARKER_POINT_HEXAEDRE \
403  ( 1, ( ( 1, 8, ( 1,2,3,4,5,6,7,8 ) ) ) ) \
404 
405 # define GEOTOOL_MARKER_LINE_HEXAEDRE \
406  ( 12, ( ( 1, 1, ( 1 ) ), \
407  ( 2, 1, ( 2 ) ), \
408  ( 3, 1, ( 3 ) ), \
409  ( 4, 1, ( 4 ) ), \
410  ( 5, 1, ( 5 ) ), \
411  ( 6, 1, ( 6 ) ), \
412  ( 7, 1, ( 7 ) ), \
413  ( 8, 1, ( 8 ) ), \
414  ( 9, 1, ( 9 ) ), \
415  ( 10, 1, ( 10 ) ), \
416  ( 11, 1, ( 11 ) ), \
417  ( 12, 1, ( 12 ) ) \
418  ) \
419  ) \
420 
421 # define GEOTOOL_MARKER_SURFACE_HEXAEDRE \
422  ( 6, ( ( 1, 1, ( 1 ) ), \
423  ( 2, 1, ( 2 ) ), \
424  ( 3, 1, ( 3 ) ), \
425  ( 4, 1, ( 4 ) ), \
426  ( 5, 1, ( 5 ) ), \
427  ( 6, 1, ( 6 ) ) \
428  ) \
429  ) \
430 
431 # define GEOTOOL_MARKER_VOLUME_HEXAEDRE \
432  ( 1, ( ( 1, 1, ( 1 ) ) ) \
433  ) \
434 
435 /*_________________________________________________*/
436 
437 # define GEOTOOL_MARKER_POINT_CUBE \
438  ( 1, ( ( 1, 8, ( 1,2,3,4,5,6,7,8 ) ) ) ) \
439 
440 # define GEOTOOL_MARKER_LINE_CUBE \
441  ( 12, ( ( 1, 1, ( 1 ) ), \
442  ( 2, 1, ( 2 ) ), \
443  ( 3, 1, ( 3 ) ), \
444  ( 4, 1, ( 4 ) ), \
445  ( 5, 1, ( 5 ) ), \
446  ( 6, 1, ( 6 ) ), \
447  ( 7, 1, ( 7 ) ), \
448  ( 8, 1, ( 8 ) ), \
449  ( 9, 1, ( 9 ) ), \
450  ( 10, 1, ( 10 ) ), \
451  ( 11, 1, ( 11 ) ), \
452  ( 12, 1, ( 12 ) ) \
453  ) \
454  ) \
455 
456 # define GEOTOOL_MARKER_SURFACE_CUBE \
457  ( 6, ( ( 1, 1, ( 1 ) ), \
458  ( 2, 1, ( 2 ) ), \
459  ( 3, 1, ( 3 ) ), \
460  ( 4, 1, ( 4 ) ), \
461  ( 5, 1, ( 5 ) ), \
462  ( 6, 1, ( 6 ) ) \
463  ) \
464  ) \
465 
466 # define GEOTOOL_MARKER_VOLUME_CUBE \
467  ( 1, ( ( 1, 1, ( 1 ) ) ) \
468  ) \
469 
470 
471 /*_________________________________________________*/
472 //special3D_1
473 
474 # define GEOTOOL_MARKER_POINT_SPECIAL3D_1 \
475  ( 1, ( ( 1, 12, ( 1,2,3,4,5,6,7,8,9,10,11,12 ) ) ) ) \
476 
477 # define GEOTOOL_MARKER_LINE_SPECIAL3D_1 \
478  ( 1, ( ( 1, 17, ( 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17 ) ) ) ) \
479 
480 # define GEOTOOL_MARKER_SURFACE_SPECIAL3D_1 \
481  ( 2, ( ( 1, 5, ( 1,2,3,4,5 ) ), \
482  ( 3, 4, ( 6,7,8,9 ) ) \
483  ) \
484  ) \
485 
486 # define GEOTOOL_MARKER_VOLUME_SPECIAL3D_1 \
487  ( 1, ( ( 1, 1, ( 1 ) ) ) \
488  ) \
489 
490 
491 
492 
493 /*_________________________________________________*/
494 
495 #if 0
496 # define GEOTOOL_MARKER_SURFACE_DEFAULT \
497  ( 1, ( ( 1, 1, ( 1 ) ) ) \
498  ) \
499 
500 
501 
502 
503 
504 # define GEOTOOL_MARKER_VOLUME_DEFAULT \
505  ( 1, ( ( 1, 1, ( 1 ) ) ) \
506  ) \
507 
508 
509 #endif
510 
511 // Accessors
512 
513 # define GEOTOOL_SHAPE_NAME_CLASS(i) BOOST_PP_TUPLE_ELEM(7, 0, BOOST_PP_ARRAY_ELEM(i,GEOTOOL_SHAPE))
514 # define GEOTOOL_SHAPE_DIM(i) BOOST_PP_TUPLE_ELEM(7, 1, BOOST_PP_ARRAY_ELEM(i,GEOTOOL_SHAPE))
515 # define GEOTOOL_SHAPE_NBSURFACE(i) BOOST_PP_TUPLE_ELEM(7, 2, BOOST_PP_ARRAY_ELEM(i,GEOTOOL_SHAPE))
516 # define GEOTOOL_SHAPE_NBVOLUME(i) BOOST_PP_TUPLE_ELEM(7, 3, BOOST_PP_ARRAY_ELEM(i,GEOTOOL_SHAPE))
517 # define GEOTOOL_SHAPE_NAME_STR(i) BOOST_PP_TUPLE_ELEM(7, 4, BOOST_PP_ARRAY_ELEM(i,GEOTOOL_SHAPE))
518 # define GEOTOOL_SHAPE_NBPARAM(i) BOOST_PP_TUPLE_ELEM(7, 5, BOOST_PP_ARRAY_ELEM(i,GEOTOOL_SHAPE))
519 # define GEOTOOL_SHAPE_NAME_MACRO(i) BOOST_PP_TUPLE_ELEM(7, 6, BOOST_PP_ARRAY_ELEM(i,GEOTOOL_SHAPE))
520 
521 # define GEOTOOL_MARKER_POINT_INDICE(O) BOOST_PP_TUPLE_ELEM(3, 0, O)
522 # define GEOTOOL_MARKER_POINT_NBMARK(F,i) BOOST_PP_TUPLE_ELEM(3, 1, BOOST_PP_ARRAY_ELEM(i,F))
523 # define GEOTOOL_MARKER_POINT_ARRAYMARK(O) BOOST_PP_TUPLE_ELEM(3, 2, O)
524 # define GEOTOOL_MARKER_POINT_MARKVALUE(F,i,j) \
525  BOOST_PP_TUPLE_ELEM( GEOTOOL_MARKER_POINT_NBMARK(F,i),j,GEOTOOL_MARKER_POINT_ARRAYMARK(BOOST_PP_ARRAY_ELEM(i, F)))
526 
527 # define GEOTOOL_MARKER_LINE_INDICE(O) BOOST_PP_TUPLE_ELEM(3, 0, O)
528 # define GEOTOOL_MARKER_LINE_NBMARK(F,i) BOOST_PP_TUPLE_ELEM(3, 1, BOOST_PP_ARRAY_ELEM(i,F))
529 # define GEOTOOL_MARKER_LINE_ARRAYMARK(O) BOOST_PP_TUPLE_ELEM(3, 2, O)
530 # define GEOTOOL_MARKER_LINE_MARKVALUE(F,i,j) \
531  BOOST_PP_TUPLE_ELEM( GEOTOOL_MARKER_LINE_NBMARK(F,i),j,GEOTOOL_MARKER_LINE_ARRAYMARK(BOOST_PP_ARRAY_ELEM(i, F)))
532 
533 # define GEOTOOL_MARKER_SURFACE_INDICE(O) BOOST_PP_TUPLE_ELEM(3, 0, O)
534 # define GEOTOOL_MARKER_SURFACE_NBMARK(F,i) BOOST_PP_TUPLE_ELEM(3, 1, BOOST_PP_ARRAY_ELEM(i,F))
535 # define GEOTOOL_MARKER_SURFACE_ARRAYMARK(O) BOOST_PP_TUPLE_ELEM(3, 2, O)
536 # define GEOTOOL_MARKER_SURFACE_MARKVALUE(F,i,j) \
537  BOOST_PP_TUPLE_ELEM( GEOTOOL_MARKER_SURFACE_NBMARK(F,i),j,GEOTOOL_MARKER_SURFACE_ARRAYMARK(BOOST_PP_ARRAY_ELEM(i, F)))
538 
539 # define GEOTOOL_MARKER_VOLUME_INDICE(O) BOOST_PP_TUPLE_ELEM(3, 0, O)
540 # define GEOTOOL_MARKER_VOLUME_NBMARK(F,i) BOOST_PP_TUPLE_ELEM(3, 1, BOOST_PP_ARRAY_ELEM(i,F))
541 # define GEOTOOL_MARKER_VOLUME_ARRAYMARK(O) BOOST_PP_TUPLE_ELEM(3, 2, O)
542 # define GEOTOOL_MARKER_VOLUME_MARKVALUE(F,i,j) \
543  BOOST_PP_TUPLE_ELEM( GEOTOOL_MARKER_VOLUME_NBMARK(F,i),j,GEOTOOL_MARKER_VOLUME_ARRAYMARK(BOOST_PP_ARRAY_ELEM(i, F)))
544 
545 /*_________________________________________________*/
546 /*_________________________________________________*/
547 /*_________________________________________________*/
548 
549 
550 namespace Feel
551 {
552 
553 namespace GeoTool
554 {
555 
556 typedef node<double>::type node_type;
557 
558 class GeoGMSHTool;
559 typedef boost::shared_ptr< GeoGMSHTool> GeoGMSHTool_ptrtype;
560 
561 typedef std::map<uint16_type,uint16_type> map_data_type;
562 typedef std::vector<map_data_type> vec_map_data_type;
563 typedef boost::shared_ptr<vec_map_data_type> vec_map_data_ptrtype;
564 
565 //if bool=true => surface stoker dans un tableau gmsh
566 typedef std::vector<std::map<uint16_type,bool> > vec_map_data_surf1_type;
567 typedef boost::shared_ptr<vec_map_data_surf1_type> vec_map_data_surf1_ptrtype;
568 //=> la string est le nom de ce tableau
569 typedef std::vector<std::map<uint16_type,std::string> > vec_map_data_surf2_type;
570 typedef boost::shared_ptr<vec_map_data_surf2_type> vec_map_data_surf2_ptrtype;
571 // list of pt define in more in the surface
572 typedef std::vector<std::map<uint16_type,std::list<uint16_type> > > vec_map_data_ptsinsurf_type;
573 typedef boost::shared_ptr<vec_map_data_ptsinsurf_type> vec_map_data_ptsinsurf_ptrtype;
574 
575 typedef std::map<int,std::list<int> > map_surfaceLoop_type;
576 //typedef boost::shared_ptr<map_surfaceLoop_type> map_surfaceLoop_ptrtype;
577 
578 
579 typedef boost::tuple< GeoGMSHTool_ptrtype,
580  vec_map_data_ptrtype,
581  std::string,
582  std::string,
583  vec_map_data_surf1_ptrtype,
584  vec_map_data_surf2_ptrtype,
585  vec_map_data_surf1_ptrtype,
586  vec_map_data_ptsinsurf_ptrtype,
587  map_surfaceLoop_type > data_geo_type;
588 typedef boost::shared_ptr<data_geo_type> data_geo_ptrtype;
589 
590 
591 void run( data_geo_ptrtype __dg );
592 
593 //A faire avec les BoostPP
594 //void runRectangle(data_geo_ptrtype dg);
595 //void runCircle(data_geo_ptrtype dg);
596 //void runHexaedre(data_geo_ptrtype dg);
597 
598 
599 
600 #define GEOTOOL_INSTANTIATES_FOR_COMP(r, state) \
601  BOOST_PP_NOT_EQUAL( BOOST_PP_TUPLE_ELEM(2, 0, state), \
602  BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(2, 1, state)) \
603  ) \
604 
605 /*_________________________________________________*/
606 /* */
607 
608 #define GEOTOOL_INSTANTIATES_FOR_INCR(r, state) \
609  ( \
610  BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(2, 0, state)), \
611  BOOST_PP_TUPLE_ELEM(2, 1, state) ) \
612 
613 /*_________________________________________________*/
614 /* */
615 
616 #define GEOTOOL_INSTANTIATES_FOR(r,state) \
617  void BOOST_PP_CAT(run,GEOTOOL_SHAPE_NAME_CLASS(BOOST_PP_TUPLE_ELEM(2,0,state))) (data_geo_ptrtype dg); \
618 
619 /*_________________________________________________*/
620 /* */
621 
622 BOOST_PP_FOR( ( 0, BOOST_PP_SUB( BOOST_PP_ARRAY_SIZE( GEOTOOL_SHAPE ),1 ) ),
623  GEOTOOL_INSTANTIATES_FOR_COMP,
624  GEOTOOL_INSTANTIATES_FOR_INCR,
625  GEOTOOL_INSTANTIATES_FOR )
626 
627 
628 
629 
630 } // namespace GeoTool
631 
632 namespace GeoTool
633 {
634 
635 /*_________________________________________________*
636  *_________________________________________________*
637  *_________________________________________________*
638  * GeoGMSHTool : *
639  *_________________________________________________*
640  *_________________________________________________*
641  *_________________________________________________*/
642 
643 
644 class Node
645 {
646 public :
647 
648  Node()
649  :
650  M_node( new node_type() )
651  {}
652 
653  Node( double __x ) :
654  M_node( new node_type( 1 ) )
655  {
656  ( *M_node )( 0 )=__x;
657  }
658 
659  Node( double __x, double __y ) :
660  M_node( new node_type( 2 ) )
661  {
662  ( *M_node )( 0 )=__x;
663  ( *M_node )( 1 )=__y;
664  }
665 
666  Node( double __x, double __y, double __z ) :
667  M_node( new node_type( 3 ) )
668  {
669  ( *M_node )( 0 )=__x;
670  ( *M_node )( 1 )=__y;
671  ( *M_node )( 2 )=__z;
672  }
673 
674  Node( Node const & m )
675  :
676  M_node( m.M_node )
677  {}
678 
679  Node operator=( Node const & m )
680  {
681  M_node.reset( new node_type( *( m.M_node ) ) );
682  return *this;
683  }
684 
685  double operator()( uint16_type n ) const
686  {
687  return this->getNode()( n );
688  }
689 
690  double & operator()( uint16_type n )
691  {
692  return ( *M_node )( n );
693  }
694 
695  node_type
696  getNode() const
697  {
698  return *M_node;
699  }
700 
701  node_type &
702  getNode()
703  {
704  return *M_node;
705  }
706 
707  boost::shared_ptr<node_type> M_node;
708 };
709 
710 /*_________________________________________________*/
711 
712 class Loop
713 {
714 public :
715 
716  Loop( Loop const & L ) : M_loop( L.M_loop ) {}
717 
718  Loop()
719  {
720  M_loop.clear();
721  }
722 
723  void operator=( Loop m )
724  {
725  this->M_loop=m.M_loop;
726  }
727  Loop operator>>( int __n )
728  {
729  M_loop.push_back( __n );
730  return *this;
731  }
732 
733  uint16_type size()
734  {
735  return M_loop.size();
736  }
737 
738  std::list<int>::const_iterator begin() const
739  {
740  return M_loop.begin();
741  }
742  std::list<int>::const_iterator end() const
743  {
744  return M_loop.end();
745  }
746 
747  std::list<int> M_loop;
748 };
749 
750 
751 /*_________________________________________________*
752  *_________________________________________________*
753  *_________________________________________________*
754  * GeoGMSHTool : *
755  *_________________________________________________*
756  *_________________________________________________*
757  *_________________________________________________*/
758 
759 
760 class GeoGMSHTool
761 {
762 public:
763 
764  typedef node<double>::type node_type;
765 
766  /* // list de < nameMesh, meshSize >
767  typedef boost::tuple<std::string,double> names_base_type;
768  typedef std::list< names_base_type > names_type;
769  typedef std::map< std::string, names_type > map_shape_names_type;
770  typedef names_type::const_iterator names_const_iterator_type;
771  typedef map_shape_names_type::const_iterator map_shape_names_const_iterator_type;
772  */
773  typedef boost::tuple<std::string,std::string,uint16_type> marker_base_type;
774  typedef std::map<std::string,std::list<marker_base_type > > marker_markerName_type;
775  typedef std::map< std::string, marker_markerName_type > marker_type_type;
776  typedef std::map< std::string, marker_type_type > marker_name_type;
777  typedef std::map< std::string, marker_type_type > marker_shape_type;
778 
779  typedef marker_markerName_type::const_iterator marker_markerName_const_iterator_type;
780  typedef marker_type_type::const_iterator marker_type_const_iterator_type;
781  typedef marker_name_type::const_iterator marker_name_const_iterator_type;
782  typedef marker_shape_type::const_iterator marker_shape_const_iterator_type;
783 
784  typedef std::vector<node_type> parameter_rectangle_type;
785  typedef std::map<std::string, parameter_rectangle_type > parameter_name_type;
786  typedef std::map<std::string, parameter_name_type > parameter_shape_type;
787  typedef parameter_name_type::const_iterator parameter_name_const_iterator_type;
788  typedef parameter_shape_type::const_iterator parameter_shape_const_iterator_type;
789 
790 
791  // gestion des lignes : shape,name,value,meshSize
792  typedef boost::tuple<std::string,std::string,uint16_type,double > ligne_type;
793  typedef std::list< ligne_type > ligne_type_type;
794  typedef std::list< ligne_type_type > ligne_name_type;
795  typedef ligne_type_type::const_iterator ligne_type_const_iterator_type;
796  typedef ligne_name_type::const_iterator ligne_name_const_iterator_type;
797 
798  // gestion des surfaces : shape,name,(numGlobSurface,valueOfLineloop),meshSize
799  typedef boost::tuple<std::string,std::string,std::pair<int,int>,double > surface_type;
800  typedef std::list< surface_type > surface_type_type;
801  typedef std::list< surface_type_type > surface_name_type;
802  typedef surface_type_type::const_iterator surface_type_const_iterator_type;
803  typedef surface_name_type::const_iterator surface_name_const_iterator_type;
804 
805  // gestion des volumes : shape,name,(numGlobVolume,value),meshSize
806  typedef boost::tuple<std::string,std::string, std::pair<int,int>,double > volume_type;
807  typedef std::list< volume_type > volume_type_type;
808  typedef std::list< volume_type_type > volume_name_type;
809  typedef volume_type_type::const_iterator volume_type_const_iterator_type;
810  typedef volume_name_type::const_iterator volume_name_const_iterator_type;
811 
812  // gestion des surfaceLoop : shape,name, numLoopLoc->list<value>
813  typedef boost::tuple<std::string,std::string, std::map< int, std::list<int> > > surfaceloop_type;
814  typedef std::list< surfaceloop_type > surfaceloop_type_type;
815  typedef std::list< surfaceloop_type_type > surfaceloop_name_type;
816  typedef surfaceloop_type_type::const_iterator surfaceloop_type_const_iterator_type;
817  typedef surfaceloop_name_type::const_iterator surfaceloop_name_const_iterator_type;
818 
819 
820  GeoGMSHTool( uint16_type __dim, std::string __shape="NO_SHAPE", std::string __name="NO_NAME", double __meshSize=0.1 );
821 
822  GeoGMSHTool( uint16_type __dim, std::string const & geoUserStr, double __meshSize=0.1, std::string __shape="NO_SHAPE", std::string __name="NO_NAME" );
823 
824  GeoGMSHTool( GeoGMSHTool const & m );
825 
826  void zeroCpt();
827 
828  void operator=( GeoGMSHTool const & m );
829 
830  GeoGMSHTool operator+( const GeoGMSHTool & m );
831  GeoGMSHTool operator-( const GeoGMSHTool & m );
832 
833  GeoGMSHTool opFusion( const GeoGMSHTool & m,int __typeop );
834 
835  void init( int orderGeo,
836  std::string gmshFormatVersion,
837  double hmin=0,double hmax=1e22,
838  int refine=0,
839  bool optimize3dNetgen=true,
840  GMSH_PARTITIONER partitioner=GMSH_PARTITIONER_CHACO,
841  int partitions=1,
842  bool partition_file=false );
843 
844  /*
845  *
846  */
847  void initData( std::string __shape,
848  std::string __name,
849  double __meshSize,
850  std::vector<GeoTool::Node> & __param,
851  uint16_type dim,
852  uint16_type __nbligne,
853  uint16_type __nbsurface,
854  uint16_type __nbvolume );
855 
856  /*
857  *Utile pour la fct geoStr()
858  *Pas de maj pour cptSurface et cptVolume car traitement different
859  */
860  void updateData( GeoGMSHTool const & m );
861 
862  /*
863  * Update the output stringstream wich generate the gmsh code
864  */
865  void updateOstr( std::string __str )
866  {
867  *M_ostr << __str;
868  }
869 
870  /*
871  * Generate the gmsh code
872  */
873  void geoStr();
874 
875  /*
876  * Clean
877  */
878  void cleanOstr()
879  {
880  M_ostr.reset( new std::ostringstream() );
881  }
882 
883 
884 
885 
886 
887  BOOST_PARAMETER_MEMBER_FUNCTION(
888  ( typename Feel::detail::mesh<Args>::ptrtype ), // return type
889  createMesh, // function name
890  tag,
891  ( required
892  ( mesh, * )
893  ( name, ( std::string ) )
894  ) //required
895  ( optional
896  ( format, *, option(_name="gmsh.format").template as<int>() )
897  ( straighten, *( boost::is_integral<mpl::_> ), 1 )
898  ( refine, *( boost::is_integral<mpl::_> ), 0 )
899  ( partitions, *( boost::is_integral<mpl::_> ), Environment::worldComm().size() )
900  ( partition_file, *( boost::is_integral<mpl::_> ), 0 )
901  ( partitioner, *( boost::is_integral<mpl::_> ), GMSH_PARTITIONER_CHACO )
902  ( worldcomm, *, Environment::worldComm() )
903  ( hmin, ( double ), 0 )
904  ( hmax, ( double ), 1e22 )
905  ( optimize3d_netgen, *( boost::is_integral<mpl::_> ), true )
906  ) //optional
907  )
908  {
909  typedef typename Feel::detail::mesh<Args>::type _mesh_type;
910  typedef typename Feel::detail::mesh<Args>::ptrtype _mesh_ptrtype;
911 
912  _mesh_ptrtype _mesh( mesh );
913  _mesh->setWorldComm( worldcomm );
914 
915  if ( worldcomm.isActive() )
916  {
917 
918  this->cleanOstr();
919  this->zeroCpt();
920  Gmsh gmsh( _mesh_type::nDim, _mesh_type::nOrder, worldcomm );
921  gmsh.setRecombine( _mesh_type::shape_type::is_hypercube );
922  gmsh.setRefinementLevels( refine );
923  gmsh.setFileFormat( (GMSH_FORMAT)format );
924  gmsh.setNumberOfPartitions( partitions );
925  gmsh.setPartitioner( partitioner );
926  gmsh.setMshFileByPartition( partition_file );
927  this->init( _mesh_type::nOrder,gmsh.version(),
928  hmin,hmax,refine,
929  optimize3d_netgen,
930  partitioner,partitions,partition_file );
931 
932  std::string geostring;
933 
934  if ( M_geoIsDefineByUser )
935  {
936  geostring= M_ostrDefineByUser->str();
937  }
938 
939  else
940  {
941  this->geoStr();
942  geostring = M_ostr->str();
943  }
944 
945 
946  std::string fname;
947  bool gen;
948  boost::tie( fname, gen ) = gmsh.generate( name,
949  geostring,
950  false,false,false );
951 
952  ImporterGmsh<_mesh_type> import( fname, FEELPP_GMSH_FORMAT_VERSION, worldcomm );
953  _mesh->accept( import );
954  _mesh->components().set ( MESH_RENUMBER|MESH_UPDATE_EDGES|MESH_UPDATE_FACES|MESH_CHECK );
955  _mesh->updateForUse();
956 
957  if ( straighten && _mesh_type::nOrder > 1 )
958  return straightenMesh( _mesh=_mesh,
959  _worldcomm=worldcomm.subWorldComm() );
960 
961  } // if (worldcomm.isActive())
962 
963  return _mesh;
964  }
965 
966 
967 #if 0 // old function
968  template<typename mesh_type>
969  boost::shared_ptr<mesh_type>
970  createMesh( std::string name, int straighten = 1, WorldComm const& worldcomm=Environment::worldComm() )
971  {
972  boost::shared_ptr<mesh_type> mesh( new mesh_type );
973  mesh->setWorldComm( worldcomm );
974 
975  if ( worldcomm.isActive() )
976  {
977  this->cleanOstr();
978  this->zeroCpt();
979 
980  Gmsh gmsh( mesh_type::nDim,mesh_type::nOrder, worldcomm );
981  gmsh.setOrder( mesh_type::nOrder );
982  gmsh.setRecombine( mesh_type::shape_type::is_hypercube );
983 
984  this->init( mesh_type::nOrder,gmsh.version() );
985 
986  std::string geostring;
987 
988  if ( M_geoIsDefineByUser )
989  {
990  geostring= M_ostrDefineByUser->str();
991  }
992 
993  else
994  {
995  this->geoStr();
996  geostring = M_ostr->str();
997  }
998 
999  std::string fname = gmsh.generate( name,
1000  geostring,false,false,false );
1001 
1002  ImporterGmsh<mesh_type> import( fname, FEELPP_GMSH_FORMAT_VERSION, worldcomm );
1003  mesh->accept( import );
1004  mesh->components().set ( MESH_RENUMBER|MESH_UPDATE_EDGES|MESH_UPDATE_FACES|MESH_CHECK );
1005  mesh->updateForUse();
1006 
1007  if ( straighten && mesh_type::nOrder > 1 )
1008  return straightenMesh( mesh );
1009  } // if (worldcomm.isActive())
1010 
1011  return mesh;
1012  }
1013 #endif
1014  /*_________________________________________________*
1015  *_________________________________________________*
1016  * Accessor *
1017  *_________________________________________________*
1018  *_________________________________________________*/
1019 
1020  uint16_type dim() const
1021  {
1022  return M_dim;
1023  }
1024  uint16_type cptPt() const
1025  {
1026 
1027  return M_cptPt;
1028  }
1029  uint16_type cptLine() const
1030  {
1031  return M_cptLine;
1032  }
1033  uint16_type cptLineLoop() const
1034  {
1035  return M_cptLineLoop;
1036  }
1037  uint16_type cptSurface() const
1038  {
1039  return M_cptSurface;
1040  }
1041  uint16_type cptTableau() const
1042  {
1043  return M_cptTableau; //voir les extrudes par exemple
1044  }
1045  uint16_type cptSurfaceLoop() const
1046  {
1047  return M_cptSurfaceLoop;
1048  }
1049  uint16_type cptVolume() const
1050  {
1051  return M_cptVolume;
1052  }
1053 
1054  /*_________________________________________________*
1055  * Parameter
1056  *_________________________________________________*/
1057 
1058  parameter_shape_const_iterator_type
1059  paramShapeBegin() const
1060  {
1061  return M_paramShape->begin();
1062  }
1063 
1064  parameter_shape_const_iterator_type paramShapeEnd() const
1065  {
1066  return M_paramShape->end();
1067  }
1068 
1069  parameter_name_const_iterator_type
1070  paramNameBegin( std::string __shape ) const
1071  {
1072  return M_paramShape->find( __shape )->second.begin();
1073  }
1074 
1075  parameter_name_const_iterator_type
1076  paramNameEnd( std::string __shape ) const
1077  {
1078  return M_paramShape->find( __shape )->second.end();
1079  }
1080 
1081  parameter_rectangle_type
1082  getParameter( std::string __shape, std::string __name ) const
1083  {
1084  return M_paramShape->find( __shape )->second.find( __name )->second;
1085  }
1086 
1087  /*_________________________________________________*
1088  * Marker
1089  *_________________________________________________*/
1090  /*
1091  marker_shape_const_iterator_type
1092  markShapeBegin() const
1093  {
1094  return M_markShape->begin();
1095  }
1096 
1097  marker_shape_const_iterator_type
1098  markShapeEnd() const
1099  {
1100  return M_markShape->end();
1101  }*/
1102 
1103 
1104  marker_type_const_iterator_type
1105  markerTypeBegin( /*std::string __shape*/ ) const
1106  {
1107  //return M_markShape->find(__shape)->second.begin();
1108  return M_markShape->begin();
1109  }
1110 
1111  marker_type_const_iterator_type
1112  markerTypeEnd( /*std::string __shape*/ ) const
1113  {
1114  //return M_markShape->find(__shape)->second.end();
1115  return M_markShape->end();
1116  }
1117  /*
1118  marker_type_type
1119  markerType(std::string __shape) const
1120  {
1121  //return M_markShape->find(__shape)->second;
1122  }*/
1123 
1124  marker_markerName_const_iterator_type
1125  markerMarkerNameBegin( /*std::string __shape,*/ std::string __type ) const
1126  {
1127  //return M_markShape->find(__shape)->second.find(__type)->second.begin();
1128  return M_markShape->find( __type )->second.begin();
1129  }
1130 
1131  marker_markerName_const_iterator_type
1132  markerMarkerNameEnd( /*std::string __shape,*/ std::string __type ) const
1133  {
1134  //return M_markShape->find(__shape)->second.find(__type)->second.end();
1135  return M_markShape->find( __type )->second.end();
1136  }
1137 
1138  marker_markerName_type
1139  markerMarkerName( /*std::string __shape,*/ std::string __type ) const
1140  {
1141  //return M_markShape->find(__shape)->second.find(__type)->second;
1142  return M_markShape->find( __type )->second;
1143  }
1144 
1145  std::list<marker_base_type>::const_iterator
1146  markerListIndiceBegin( /*std::string __shape,*/ std::string __type ,std::string __markerName ) const
1147  {
1148  return M_markShape->find( __type )->second.find( __markerName )->second.begin();
1149  }
1150 
1151  std::list<marker_base_type>::const_iterator
1152  markerListIndiceEnd( /*std::string __shape,*/ std::string __type ,std::string __markerName ) const
1153  {
1154  //return M_markShape->find(__shape)->second.find(__type)->second.find(__markerName)->second.end();
1155  return M_markShape->find( __type )->second.find( __markerName )->second.end();
1156  }
1157 
1158 
1159  std::list<marker_base_type>
1160  getMarkerName( /*std::string __shape,*/ std::string __type ,std::string __markerName ) const
1161  {
1162  //return M_markShape->find(__shape)->second.find(__type)->second.find(__markerName)->second;
1163  return M_markShape->find( __type )->second.find( __markerName )->second;
1164  }
1165 
1166  /*_________________________________________________*
1167  *_________________________________________________*
1168  * Members *
1169  *_________________________________________________*
1170  *_________________________________________________*/
1171 
1172  uint16_type M_dim;
1173  // memory
1174  uint16_type M_cptPt;
1175  uint16_type M_cptLine;
1176  uint16_type M_cptLineLoop;
1177  uint16_type M_cptSurface;
1178  uint16_type M_cptTableau;
1179  uint16_type M_cptSurfaceLoop;
1180  uint16_type M_cptVolume;
1181 
1182  // gestion des surface : shape,name,value
1183  // value is the marker associated to the planeSurface (init to 0 and to use when call geoStr())
1184  //std::list< std::list< boost::tuple<std::string,std::string, uint16_type > > > M_surfaceList;
1185  boost::shared_ptr<ligne_name_type> M_ligneList;
1186  boost::shared_ptr<surface_name_type> M_surfaceList;
1187  boost::shared_ptr<volume_name_type> M_volumeList;
1188  boost::shared_ptr<surfaceloop_name_type> M_surfaceLoopList;
1189 
1190  boost::shared_ptr<std::ostringstream> M_ostrExtrude;
1191  boost::shared_ptr<std::ostringstream> M_ostrSurfaceLoop;
1192 
1193 
1194  // data containers
1195  //boost::shared_ptr<map_shape_names_type> M_map_Shape;
1196  boost::shared_ptr<parameter_shape_type> M_paramShape;
1197  //boost::shared_ptr<marker_shape_type> M_markShape;
1198  boost::shared_ptr<marker_type_type> M_markShape;
1199 
1200  // output string
1201  boost::shared_ptr<std::ostringstream> M_ostr;
1202 
1203  boost::shared_ptr<std::ostringstream> M_ostrDefineByUser;
1204  bool M_geoIsDefineByUser;
1205 };
1206 
1207 /*_________________________________________________*
1208  *_________________________________________________*
1209  *_________________________________________________*
1210  * Function on the namespace *
1211  *_________________________________________________*
1212  *_________________________________________________*
1213  *_________________________________________________*/
1214 
1215 
1216 void run( data_geo_ptrtype __dg );
1217 
1218 template <uint16_type Numero>
1219 node_type
1220 param( data_geo_ptrtype __dg );
1221 
1222 
1223 void
1224 writePoint( uint16_type __numLoc, data_geo_ptrtype __dg ,double __x1,double __x2=0, double __x3=0 );
1225 
1226 void
1227 writeLine( uint16_type __numLoc, data_geo_ptrtype __dg ,uint16_type __n1, uint16_type __n2 );
1228 
1229 void
1230 writeCircle( uint16_type __numLoc, data_geo_ptrtype __dg ,uint16_type __n1, uint16_type __n2, uint16_type __n3 );
1231 
1232 void
1233 writeEllipse( uint16_type __numLoc, data_geo_ptrtype __dg ,uint16_type __n1, uint16_type __n2, uint16_type __n3, uint16_type __n4 );
1234 
1235 void
1236 writeSpline( uint16_type __numLoc, data_geo_ptrtype __dg ,Loop __loop );
1237 
1238 void
1239 writeBSpline( uint16_type __numLoc, data_geo_ptrtype __dg ,Loop __loop );
1240 
1241 void
1242 writeLineLoop( uint16_type __numLoc, data_geo_ptrtype __dg , Loop /*const*/ __loop );
1243 
1244 void
1245 writePlaneSurface( uint16_type __numLoc, data_geo_ptrtype __dg , uint16_type __ind );
1246 
1247 void
1248 writeRuledSurface( uint16_type __numLoc, data_geo_ptrtype __dg , uint16_type __ind );
1249 
1250 void
1251 writeExtrudeSurface( uint16_type __numLoc,data_geo_ptrtype __dg , uint16_type __ind,Loop /*const*/ __loop );
1252 
1253 void
1254 writePtInSurface( data_geo_ptrtype __dg , uint16_type __indPt,uint16_type __indSurf );
1255 
1256 void
1257 writeSurfaceLoop( uint16_type __numLoc, data_geo_ptrtype __dg , Loop /*const*/ __loop );
1258 
1259 void
1260 writeVolume( uint16_type __numLoc, data_geo_ptrtype __dg , uint16_type __ind );
1261 
1262 boost::tuple<Node,Node,Node>
1263 computeBasisOrthogonal( node_type dir,node_type centre );
1264 
1265 
1266 /*_________________________________________________*
1267  *_________________________________________________*
1268  *_________________________________________________*
1269  * PREPROCESSOR METHODS *
1270  *_________________________________________________*
1271  *_________________________________________________*
1272  *_________________________________________________*/
1273 
1274 
1275 
1276 
1277 #define GEOTOOL_FOR_COMP2(r, state) \
1278  BOOST_PP_NOT_EQUAL( BOOST_PP_TUPLE_ELEM(4, 0, state), \
1279  BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(4, 1, state)) \
1280  ) \
1281 
1282 /*_________________________________________________*/
1283 /* */
1284 
1285 #define GEOTOOL_FOR_INCR2(r, state) \
1286  ( \
1287  BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(4, 0, state)), \
1288  BOOST_PP_TUPLE_ELEM(4, 1, state), \
1289  BOOST_PP_TUPLE_ELEM(4, 2, state), \
1290  BOOST_PP_TUPLE_ELEM(4, 3, state) ) \
1291 
1292 /*_________________________________________________*/
1293 /* */
1294 
1295 #define GEOTOOL_FOR_MARKER_POINT_MACRO2(r, state) \
1296  __listMarker.push_back(boost::make_tuple(this->shape(),this->name(), \
1297  GEOTOOL_MARKER_POINT_MARKVALUE( BOOST_PP_CAT(GEOTOOL_MARKER_POINT_, \
1298  GEOTOOL_SHAPE_NAME_MACRO(BOOST_PP_TUPLE_ELEM(4,3,state) )), \
1299  BOOST_PP_TUPLE_ELEM(4, 2, state), \
1300  BOOST_PP_TUPLE_ELEM(4, 0, state) ) \
1301  ) \
1302  ); \
1303 
1304 /*_________________________________________________*/
1305 /* */
1306 
1307 #define GEOTOOL_FOR_MARKER_LINE_MACRO2(r, state) \
1308  __listMarker.push_back(boost::make_tuple(this->shape(),this->name(), \
1309  GEOTOOL_MARKER_LINE_MARKVALUE( BOOST_PP_CAT(GEOTOOL_MARKER_LINE_, \
1310  GEOTOOL_SHAPE_NAME_MACRO(BOOST_PP_TUPLE_ELEM(4,3,state) )), \
1311  BOOST_PP_TUPLE_ELEM(4, 2, state), \
1312  BOOST_PP_TUPLE_ELEM(4, 0, state) ) \
1313  ) \
1314  ); \
1315 
1316 /*_________________________________________________*/
1317 /* */
1318 
1319 #if 1
1320 #define GEOTOOL_FOR_MARKER_SURFACE_MACRO2(r, state) \
1321  __listMarker.push_back(boost::make_tuple(this->shape(),this->name(), \
1322  GEOTOOL_MARKER_SURFACE_MARKVALUE( BOOST_PP_CAT(GEOTOOL_MARKER_SURFACE_, \
1323  GEOTOOL_SHAPE_NAME_MACRO(BOOST_PP_TUPLE_ELEM(4,3,state) )), \
1324  BOOST_PP_TUPLE_ELEM(4, 2, state), \
1325  BOOST_PP_TUPLE_ELEM(4, 0, state) ) \
1326  ) \
1327  ); \
1328 
1329 /*_________________________________________________*/
1330 /* */
1331 
1332 #else
1333 #define GEOTOOL_FOR_MARKER_SURFACE_MACRO2(r, state) \
1334  __listMarker.push_back(boost::make_tuple(this->shape(),this->name(), \
1335  GEOTOOL_MARKER_SURFACE_MARKVALUE( BOOST_PP_CAT(GEOTOOL_MARKER_SURFACE_, \
1336  BOOST_PP_IF(BOOST_PP_GREATER(GEOTOOL_SHAPE_NBSURFACE(BOOST_PP_TUPLE_ELEM(4,3,state)) ,0), \
1337  GEOTOOL_SHAPE_NAME_MACRO(BOOST_PP_TUPLE_ELEM(4,3,state) ), \
1338  DEFAULT)), \
1339  BOOST_PP_TUPLE_ELEM(4, 2, state), \
1340  BOOST_PP_TUPLE_ELEM(4, 0, state) ) \
1341  ) \
1342  ); \
1343 
1344 /*_________________________________________________*/
1345 /* */
1346 
1347 
1348 #endif
1349 
1350 
1351 #if 0
1352 #define GEOTOOL_FOR_MARKER_VOLUME_MACRO2(r, state) \
1353  __listMarker.push_back(boost::make_tuple(this->shape(),this->name(), \
1354  GEOTOOL_MARKER_VOLUME_MARKVALUE( BOOST_PP_CAT(GEOTOOL_MARKER_VOLUME_, \
1355  BOOST_PP_IF(BOOST_PP_GREATER(GEOTOOL_SHAPE_NBVOLUME(BOOST_PP_TUPLE_ELEM(4,3,state)) ,0), \
1356  GEOTOOL_SHAPE_NAME_MACRO(BOOST_PP_TUPLE_ELEM(4,3,state)), \
1357  DEFAULT)), \
1358  BOOST_PP_TUPLE_ELEM(4, 2, state), \
1359  BOOST_PP_TUPLE_ELEM(4, 0, state) ) \
1360  ) \
1361  ); \
1362 
1363 /*_________________________________________________*/
1364 /* */
1365 
1366 #else
1367 #define GEOTOOL_FOR_MARKER_VOLUME_MACRO2(r, state) \
1368  __listMarker.push_back(boost::make_tuple(this->shape(),this->name(), \
1369  GEOTOOL_MARKER_VOLUME_MARKVALUE( BOOST_PP_CAT(GEOTOOL_MARKER_VOLUME_, \
1370  GEOTOOL_SHAPE_NAME_MACRO(BOOST_PP_TUPLE_ELEM(4,3,state) )), \
1371  BOOST_PP_TUPLE_ELEM(4, 2, state), \
1372  BOOST_PP_TUPLE_ELEM(4, 0, state) ) \
1373  ) \
1374  ); \
1375 
1376 /*_________________________________________________*/
1377 /* */
1378 
1379 #endif
1380 
1381 
1382 #define GEOTOOL_FOR_MARKER_POINT_MACRO(r, state) \
1383  if (BOOST_PP_CAT(marker, \
1384  BOOST_PP_ADD(BOOST_PP_TUPLE_ELEM(3, 0, state), \
1385  1 ) ) ) \
1386  { \
1387  BOOST_PP_FOR( (0, \
1388  BOOST_PP_SUB(GEOTOOL_MARKER_POINT_NBMARK(BOOST_PP_CAT(GEOTOOL_MARKER_POINT_, \
1389  GEOTOOL_SHAPE_NAME_MACRO(BOOST_PP_TUPLE_ELEM(3,2,state))), \
1390  BOOST_PP_TUPLE_ELEM(3, 0, state) ),1), \
1391  BOOST_PP_TUPLE_ELEM(3, 0, state), \
1392  BOOST_PP_TUPLE_ELEM(3, 2, state) \
1393  ), \
1394  GEOTOOL_FOR_COMP2, GEOTOOL_FOR_INCR2, GEOTOOL_FOR_MARKER_POINT_MACRO2) \
1395  } \
1396 
1397 
1398 /*_________________________________________________*/
1399 /* */
1400 
1401 #define GEOTOOL_FOR_MARKER_LINE_MACRO(r, state) \
1402  if (BOOST_PP_CAT(marker, \
1403  BOOST_PP_ADD(BOOST_PP_TUPLE_ELEM(3, 0, state), \
1404  1 ) ) ) \
1405  { \
1406  BOOST_PP_FOR( (0, \
1407  BOOST_PP_SUB(GEOTOOL_MARKER_LINE_NBMARK(BOOST_PP_CAT(GEOTOOL_MARKER_LINE_, \
1408  GEOTOOL_SHAPE_NAME_MACRO(BOOST_PP_TUPLE_ELEM(3,2,state))), \
1409  BOOST_PP_TUPLE_ELEM(3, 0, state) ),1), \
1410  BOOST_PP_TUPLE_ELEM(3, 0, state), \
1411  BOOST_PP_TUPLE_ELEM(3, 2, state) \
1412  ), \
1413  GEOTOOL_FOR_COMP2, GEOTOOL_FOR_INCR2, GEOTOOL_FOR_MARKER_LINE_MACRO2) \
1414  } \
1415 
1416 
1417 /*_________________________________________________*/
1418 /* */
1419 
1420 #if 1
1421 #define GEOTOOL_FOR_MARKER_SURFACE_MACRO(r, state) \
1422  if (BOOST_PP_CAT(marker, \
1423  BOOST_PP_ADD(BOOST_PP_TUPLE_ELEM(3, 0, state), \
1424  1 ) ) ) \
1425  { \
1426  BOOST_PP_FOR( (0, \
1427  BOOST_PP_SUB(GEOTOOL_MARKER_SURFACE_NBMARK(BOOST_PP_CAT(GEOTOOL_MARKER_SURFACE_, \
1428  GEOTOOL_SHAPE_NAME_MACRO(BOOST_PP_TUPLE_ELEM(3,2,state)) ), \
1429  BOOST_PP_TUPLE_ELEM(3, 0, state) ),1), \
1430  BOOST_PP_TUPLE_ELEM(3, 0, state), \
1431  BOOST_PP_TUPLE_ELEM(3, 2, state) \
1432  ), \
1433  GEOTOOL_FOR_COMP2, GEOTOOL_FOR_INCR2, GEOTOOL_FOR_MARKER_SURFACE_MACRO2) \
1434  } \
1435 
1436 /*_________________________________________________*/
1437 /* */
1438 
1439 #else
1440 #define GEOTOOL_FOR_MARKER_SURFACE_MACRO(r, state) \
1441  if (BOOST_PP_CAT(marker, \
1442  BOOST_PP_ADD(BOOST_PP_TUPLE_ELEM(3, 0, state), \
1443  1 ) ) ) \
1444  { \
1445  BOOST_PP_FOR( (0, \
1446  BOOST_PP_SUB(GEOTOOL_MARKER_SURFACE_NBMARK(BOOST_PP_CAT(GEOTOOL_MARKER_SURFACE_, \
1447  BOOST_PP_IF(BOOST_PP_GREATER(GEOTOOL_SHAPE_NBSURFACE(BOOST_PP_TUPLE_ELEM(3,2,state)),0), \
1448  GEOTOOL_SHAPE_NAME_MACRO(BOOST_PP_TUPLE_ELEM(3,2,state)), \
1449  DEFAULT )), \
1450  BOOST_PP_TUPLE_ELEM(3, 0, state) ),1) , \
1451  BOOST_PP_TUPLE_ELEM(3, 0, state), \
1452  BOOST_PP_TUPLE_ELEM(3, 2, state) \
1453  ), \
1454  GEOTOOL_FOR_COMP2, GEOTOOL_FOR_INCR2, GEOTOOL_FOR_MARKER_SURFACE_MACRO2) \
1455  } \
1456 
1457 /*_________________________________________________*/
1458 /* */
1459 
1460 
1461 #endif
1462 
1463 #if 0
1464 #define GEOTOOL_FOR_MARKER_VOLUME_MACRO(r, state) \
1465  if (BOOST_PP_CAT(marker, \
1466  BOOST_PP_ADD(BOOST_PP_TUPLE_ELEM(3, 0, state), \
1467  1 ) ) ) \
1468  { \
1469  BOOST_PP_FOR( (0, \
1470  BOOST_PP_SUB(GEOTOOL_MARKER_VOLUME_NBMARK(BOOST_PP_CAT(GEOTOOL_MARKER_VOLUME_, \
1471  BOOST_PP_IF(BOOST_PP_GREATER(GEOTOOL_SHAPE_NBVOLUME(BOOST_PP_TUPLE_ELEM(3,2,state)) ,0), \
1472  GEOTOOL_SHAPE_NAME_MACRO(BOOST_PP_TUPLE_ELEM(3,2,state)),\
1473  DEFAULT )), \
1474  BOOST_PP_TUPLE_ELEM(3, 0, state) ),1), \
1475  BOOST_PP_TUPLE_ELEM(3, 0, state), \
1476  BOOST_PP_TUPLE_ELEM(3, 2, state) \
1477  ), \
1478  GEOTOOL_FOR_COMP2, GEOTOOL_FOR_INCR2, GEOTOOL_FOR_MARKER_VOLUME_MACRO2) \
1479  } \
1480 
1481 /*_________________________________________________*/
1482 /* */
1483 
1484 #else
1485 #define GEOTOOL_FOR_MARKER_VOLUME_MACRO(r, state) \
1486  if (BOOST_PP_CAT(marker, \
1487  BOOST_PP_ADD(BOOST_PP_TUPLE_ELEM(3, 0, state), \
1488  1 ) ) ) \
1489  { \
1490  BOOST_PP_FOR( (0, \
1491  BOOST_PP_SUB(GEOTOOL_MARKER_VOLUME_NBMARK(BOOST_PP_CAT(GEOTOOL_MARKER_VOLUME_, \
1492  GEOTOOL_SHAPE_NAME_MACRO(BOOST_PP_TUPLE_ELEM(3,2,state)) ), \
1493  BOOST_PP_TUPLE_ELEM(3, 0, state) ),1), \
1494  BOOST_PP_TUPLE_ELEM(3, 0, state), \
1495  BOOST_PP_TUPLE_ELEM(3, 2, state) \
1496  ), \
1497  GEOTOOL_FOR_COMP2, GEOTOOL_FOR_INCR2, GEOTOOL_FOR_MARKER_VOLUME_MACRO2) \
1498  } \
1499 
1500 /*_________________________________________________*/
1501 /* */
1502 
1503 
1504 #endif
1505 
1506 
1507 #define GEOTOOL_FOR_COMP1(r, state) \
1508  BOOST_PP_NOT_EQUAL( BOOST_PP_TUPLE_ELEM(3, 0, state), \
1509  BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(3, 1, state)) \
1510  ) \
1511 
1512 /*_________________________________________________*/
1513 /* */
1514 
1515 #define GEOTOOL_FOR_INCR1(r, state) \
1516  ( \
1517  BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(3, 0, state)), \
1518  BOOST_PP_TUPLE_ELEM(3, 1, state), \
1519  BOOST_PP_TUPLE_ELEM(3, 2, state) ) \
1520 
1521 /*_________________________________________________*/
1522 /* */
1523 
1524 #define GEOTOOL_FOR_COMP(r, state) \
1525  BOOST_PP_LESS( BOOST_PP_TUPLE_ELEM(2, 0, state), \
1526  BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(2, 1, state)) \
1527  ) \
1528 
1529 /*_________________________________________________*/
1530 /* */
1531 
1532 #define GEOTOOL_FOR_INCR(r, state) \
1533  ( \
1534  BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(2, 0, state)), \
1535  BOOST_PP_TUPLE_ELEM(2, 1, state) ) \
1536 
1537 /*_________________________________________________*/
1538 /* */
1539 
1540 #define GEOTOOL_SHAPE_PARAM(r, state) \
1541  M_param[BOOST_PP_TUPLE_ELEM(2,0,state)] = BOOST_PP_CAT( __param, \
1542  BOOST_PP_TUPLE_ELEM(2,0,state) ); \
1543 
1544 /*_________________________________________________*/
1545 /* */
1546 
1547 #define GEOTOOL_SHAPE_FOR_PARAM_SIGNATURE(r, state) \
1548  Node BOOST_PP_CAT( __param, BOOST_PP_TUPLE_ELEM(2,0,state) ) = Node(0,0,0) BOOST_PP_COMMA() \
1549 
1550 /*_________________________________________________*/
1551 /* */
1552 
1553 #define GEOTOOL_SHAPE_PARAM_SIGNATURE(state) \
1554  BOOST_PP_FOR( (0, BOOST_PP_SUB(GEOTOOL_SHAPE_NBPARAM(BOOST_PP_TUPLE_ELEM(2,0,state)),1) ), \
1555  GEOTOOL_FOR_COMP, \
1556  GEOTOOL_FOR_INCR, \
1557  GEOTOOL_SHAPE_FOR_PARAM_SIGNATURE) \
1558 
1559 /*_________________________________________________*/
1560 /* */
1561 
1562 #define GEOTOOL_SHAPE_CLASS(r,state) \
1563  class GEOTOOL_SHAPE_NAME_CLASS(BOOST_PP_TUPLE_ELEM(2,0,state)) : public GeoGMSHTool \
1564  { \
1565  public : \
1566  \
1567  typedef GeoGMSHTool::node_type node_type; \
1568  typedef GeoTool::Node Node; \
1569  \
1570  \
1571  GEOTOOL_SHAPE_NAME_CLASS(BOOST_PP_TUPLE_ELEM(2,0,state))(double __meshSize, \
1572  std::string __name, \
1573  GEOTOOL_SHAPE_PARAM_SIGNATURE(state) \
1574  uint16_type type = 0 ) /*Ne sert a rien, juste a cause de la virgule au dessus)*/ \
1575  : \
1576  GeoGMSHTool( GEOTOOL_SHAPE_DIM(BOOST_PP_TUPLE_ELEM(2,0,state)),shape(), __name, __meshSize), \
1577  M_name(__name) \
1578  { \
1579  M_param.resize( GEOTOOL_SHAPE_NBPARAM(BOOST_PP_TUPLE_ELEM(2,0,state))); \
1580  BOOST_PP_FOR( (0, BOOST_PP_SUB(GEOTOOL_SHAPE_NBPARAM(BOOST_PP_TUPLE_ELEM(2,0,state)),1) ), \
1581  GEOTOOL_FOR_COMP, \
1582  GEOTOOL_FOR_INCR, \
1583  GEOTOOL_SHAPE_PARAM); \
1584  \
1585  initData(shape(), \
1586  __name, \
1587  __meshSize, \
1588  M_param, \
1589  GEOTOOL_SHAPE_DIM(BOOST_PP_TUPLE_ELEM(2,0,state)), \
1590  1, \
1591  GEOTOOL_SHAPE_NBSURFACE(BOOST_PP_TUPLE_ELEM(2,0,state)), \
1592  GEOTOOL_SHAPE_NBVOLUME(BOOST_PP_TUPLE_ELEM(2,0,state))); \
1593  } \
1594  \
1595  \
1596  \
1597  \
1598  GEOTOOL_SHAPE_NAME_CLASS(BOOST_PP_TUPLE_ELEM(2,0,state))(const GEOTOOL_SHAPE_NAME_CLASS(BOOST_PP_TUPLE_ELEM(2,0,state)) & m) \
1599  : \
1600  GeoGMSHTool(m), \
1601  M_param(m.M_param) \
1602  {} \
1603  \
1604  BOOST_PARAMETER_MEMBER_FUNCTION( \
1605  (void), \
1606  setMarker, \
1607  tag, \
1608  (required \
1609  ( type, (std::string)) \
1610  ( name, (std::string)) ) \
1611  (optional \
1612  (markerAll, (bool), false) \
1613  (marker1, (bool), false) \
1614  (marker2, (bool), false) \
1615  (marker3, (bool), false) \
1616  (marker4, (bool), false) \
1617  (marker5, (bool), false) \
1618  (marker6, (bool), false) \
1619  (marker7, (bool), false) \
1620  (marker8, (bool), false) \
1621  (marker9, (bool), false) \
1622  (marker10, (bool), false) \
1623  (marker11, (bool), false) \
1624  (marker12, (bool), false) \
1625  )) \
1626  { \
1627  \
1628  if (markerAll) { \
1629  marker1=true; \
1630  marker2=true; \
1631  marker3=true; \
1632  marker4=true; \
1633  marker5=true; \
1634  marker6=true; \
1635  marker7=true; \
1636  marker8=true; \
1637  marker9=true; \
1638  marker10=true; \
1639  marker11=true; \
1640  marker12=true; \
1641  } \
1642  \
1643  std::list<marker_base_type > __listMarker = (*(M_markShape))[type][name]; \
1644  \
1645  \
1646  if (type=="point") \
1647  { \
1648  BOOST_PP_FOR( (0, BOOST_PP_SUB(BOOST_PP_ARRAY_SIZE( BOOST_PP_CAT(GEOTOOL_MARKER_POINT_, \
1649  GEOTOOL_SHAPE_NAME_MACRO( BOOST_PP_TUPLE_ELEM(2,0,state)))), \
1650  1), BOOST_PP_TUPLE_ELEM(2,0,state)), \
1651  GEOTOOL_FOR_COMP1, \
1652  GEOTOOL_FOR_INCR1, \
1653  GEOTOOL_FOR_MARKER_POINT_MACRO) \
1654  } \
1655  else if (type=="line") \
1656  { \
1657  BOOST_PP_FOR( (0, BOOST_PP_SUB(BOOST_PP_ARRAY_SIZE( BOOST_PP_CAT(GEOTOOL_MARKER_LINE_, \
1658  GEOTOOL_SHAPE_NAME_MACRO( BOOST_PP_TUPLE_ELEM(2,0,state)))), \
1659  1), BOOST_PP_TUPLE_ELEM(2,0,state)), \
1660  GEOTOOL_FOR_COMP1, \
1661  GEOTOOL_FOR_INCR1, \
1662  GEOTOOL_FOR_MARKER_LINE_MACRO) \
1663  } \
1664  else if (type=="surface") \
1665  { \
1666  BOOST_PP_IF(BOOST_PP_NOT_EQUAL(GEOTOOL_SHAPE_NBSURFACE(BOOST_PP_TUPLE_ELEM(2,0,state)),0), \
1667  BOOST_PP_FOR( (0, BOOST_PP_SUB(BOOST_PP_ARRAY_SIZE( BOOST_PP_CAT(GEOTOOL_MARKER_SURFACE_, \
1668  GEOTOOL_SHAPE_NAME_MACRO( BOOST_PP_TUPLE_ELEM(2,0,state)))), \
1669  1), BOOST_PP_TUPLE_ELEM(2,0,state)), \
1670  GEOTOOL_FOR_COMP1, \
1671  GEOTOOL_FOR_INCR1, \
1672  GEOTOOL_FOR_MARKER_SURFACE_MACRO), \
1673  ) \
1674  } \
1675  else if (type=="volume") \
1676  { \
1677  BOOST_PP_IF(BOOST_PP_NOT_EQUAL(GEOTOOL_SHAPE_NBVOLUME(BOOST_PP_TUPLE_ELEM(2,0,state)),0), \
1678  BOOST_PP_FOR( (0, BOOST_PP_SUB(BOOST_PP_ARRAY_SIZE( BOOST_PP_CAT(GEOTOOL_MARKER_VOLUME_, \
1679  GEOTOOL_SHAPE_NAME_MACRO( BOOST_PP_TUPLE_ELEM(2,0,state)))), \
1680  1), BOOST_PP_TUPLE_ELEM(2,0,state)), \
1681  GEOTOOL_FOR_COMP1, \
1682  GEOTOOL_FOR_INCR1, \
1683  GEOTOOL_FOR_MARKER_VOLUME_MACRO), \
1684  ) \
1685  } \
1686  \
1687  (*(M_markShape))[type][name] = __listMarker; \
1688  } \
1689  \
1690  \
1691  std::string M_name; \
1692  \
1693  static const std::string shape() { return GEOTOOL_SHAPE_NAME_STR(BOOST_PP_TUPLE_ELEM(2,0, state));} \
1694  const std::string name() const {return M_name;} \
1695  \
1696  \
1697  std::vector<GeoTool::Node> M_param; \
1698  \
1699  }; \
1700 
1701 /*_________________________________________________*/
1702 /*_________________________________________________*/
1703 /* */
1704 
1705 
1706 
1707 
1708 //creation des classes representants les objets geotool
1709 BOOST_PP_FOR( ( 0, BOOST_PP_SUB( BOOST_PP_ARRAY_SIZE( GEOTOOL_SHAPE ),1 ) ),
1710  GEOTOOL_FOR_COMP,
1711  GEOTOOL_FOR_INCR,
1712  GEOTOOL_SHAPE_CLASS )
1713 
1714 
1715 
1716 template<typename mesh_type>
1717 boost::shared_ptr<mesh_type>
1718 createMeshFromGeoFile( std::string geofile,std::string name,double meshSize,int straighten = 1,
1719  int partitions=1, WorldComm worldcomm=Environment::worldComm(),
1720  int partition_file = 0, GMSH_PARTITIONER partitioner = GMSH_PARTITIONER_CHACO )
1721 {
1722 
1723  boost::shared_ptr<mesh_type> mesh( new mesh_type );
1724  mesh->setWorldComm( worldcomm );
1725 
1726  if ( !worldcomm.isActive() ) return mesh;
1727 
1728  Gmsh gmsh( mesh_type::nDim,mesh_type::nOrder,worldcomm );
1729  gmsh.setCharacteristicLength( meshSize );
1730  gmsh.setNumberOfPartitions( partitions );
1731  gmsh.setPartitioner( partitioner );
1732  gmsh.setMshFileByPartition( partition_file );
1733  gmsh.setRecombine( mesh_type::shape_type::is_hypercube );
1734 
1735  std::ostringstream ostr;
1736 
1737  // preambule :
1738  ostr << "Mesh.MshFileVersion = " << gmsh.version() << ";\n"
1739  << "Mesh.CharacteristicLengthExtendFromBoundary=1;\n"
1740  << "Mesh.CharacteristicLengthFromPoints=1;\n"
1741  << "Mesh.ElementOrder=" << gmsh.order() << ";\n"
1742  << "Mesh.SecondOrderIncomplete = 0;\n"
1743  << "Mesh.Algorithm = 6;\n" // 2D mesh algorithm (1=MeshAdapt, 2=Automatic, 5=Delaunay, 6=Frontal, 7=bamg, 8=delquad)
1744  << "Mesh.Algorithm3D = 4;\n" // 3D mesh algorithm (1=Delaunay, 4=Frontal, 5=Frontal Delaunay, 6=Frontal Hex, 7=MMG3D)
1745  << "Mesh.OptimizeNetgen=1;\n"
1746  << "// partitioning data\n"
1747  << "Mesh.Partitioner=" << partitioner << ";\n"
1748  << "Mesh.NbPartitions=" << partitions << ";\n"
1749  << "Mesh.MshFilePartitioned=" << partition_file << ";\n";
1750 
1751 
1752  std::string contenu;
1753  std::ifstream ifstr( geofile.c_str(), std::ios::in );
1754 
1755  if ( ifstr )
1756  {
1757  // each line of the stream is appended in contenu
1758  while ( getline( ifstr, contenu ) )
1759  ostr << contenu<<"\n";
1760 
1761  ifstr.close();
1762  }
1763 
1764 
1765  std::string fname;
1766  bool generated;
1767  boost::tie( fname, generated ) = gmsh.generate( name,
1768  ostr.str(),false,false,true );
1769 
1770  ImporterGmsh<mesh_type> import( fname, FEELPP_GMSH_FORMAT_VERSION, worldcomm );
1771 
1772  mesh->accept( import );
1773  mesh->components().set ( MESH_RENUMBER|MESH_UPDATE_EDGES|MESH_UPDATE_FACES|MESH_CHECK );
1774  mesh->updateForUse();
1775 
1776  if ( straighten && mesh_type::nOrder > 1 )
1777  return straightenMesh( _mesh=mesh, _worldcomm=worldcomm.subWorldComm() );
1778 
1779  return mesh;
1780 }
1781 
1782 
1783 
1784 }//GeoTool
1785 
1786 } //Feel
1787 #endif /* __geotool_H */

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