42 #include <feel/feelcore/parameter.hpp>
45 #include <boost/preprocessor/tuple/elem.hpp>
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 ) \
78 # define GEOTOOL_MARKER_POINT_LINE \
79 ( 2, ( ( 1, 1, ( 1 ) ), \
84 # define GEOTOOL_MARKER_LINE_LINE \
85 ( 1, ( ( 1, 1, ( 1 ) ) ) \
91 # define GEOTOOL_MARKER_POINT_TRIANGLE \
92 ( 3, ( ( 1, 1, ( 1 ) ), \
98 # define GEOTOOL_MARKER_LINE_TRIANGLE \
99 ( 3, ( ( 1, 1, ( 1 ) ), \
104 # define GEOTOOL_MARKER_SURFACE_TRIANGLE \
105 ( 1, ( ( 1, 1, ( 1 ) ) ) \
111 # define GEOTOOL_MARKER_POINT_RECTANGLE \
112 ( 4, ( ( 1, 1, ( 1 ) ), \
118 # define GEOTOOL_MARKER_LINE_RECTANGLE \
119 ( 4, ( ( 1, 1, ( 1 ) ), \
125 # define GEOTOOL_MARKER_SURFACE_RECTANGLE \
126 ( 1, ( ( 1, 1, ( 1 ) ) ) \
132 # define GEOTOOL_MARKER_POINT_QUADRANGLE \
133 ( 4, ( ( 1, 1, ( 1 ) ), \
139 # define GEOTOOL_MARKER_LINE_QUADRANGLE \
140 ( 4, ( ( 1, 1, ( 1 ) ), \
146 # define GEOTOOL_MARKER_SURFACE_QUADRANGLE \
147 ( 1, ( ( 1, 1, ( 1 ) ) ) \
153 # define GEOTOOL_MARKER_POINT_PENTAGON \
154 ( 5, ( ( 1, 1, ( 1 ) ), \
161 # define GEOTOOL_MARKER_LINE_PENTAGON \
162 ( 5, ( ( 1, 1, ( 1 ) ), \
169 # define GEOTOOL_MARKER_SURFACE_PENTAGON \
170 ( 1, ( ( 1, 1, ( 1 ) ) ) \
177 # define GEOTOOL_MARKER_POINT_HEXAGON \
178 ( 6, ( ( 1, 1, ( 1 ) ), \
186 # define GEOTOOL_MARKER_LINE_HEXAGON \
187 ( 6, ( ( 1, 1, ( 1 ) ), \
195 # define GEOTOOL_MARKER_SURFACE_HEXAGON \
196 ( 1, ( ( 1, 1, ( 1 ) ) ) \
202 # define GEOTOOL_MARKER_POINT_CIRCLE \
203 ( 2, ( ( 1, 2, ( 1,3 ) ), \
207 # define GEOTOOL_MARKER_LINE_CIRCLE \
208 ( 1, ( ( 1, 2, ( 1,2 ) ) ) \
212 # define GEOTOOL_MARKER_SURFACE_CIRCLE \
213 ( 1, ( ( 1, 1, ( 1 ) ) ) \
219 # define GEOTOOL_MARKER_POINT_ELLIPSE \
220 ( 2, ( ( 1, 4, ( 2,3,4,5 ) ), \
224 # define GEOTOOL_MARKER_LINE_ELLIPSE \
225 ( 1, ( ( 1, 4, ( 1,2,3,4 ) ) ) \
229 # define GEOTOOL_MARKER_SURFACE_ELLIPSE \
230 ( 1, ( ( 1, 1, ( 1 ) ) ) \
236 # define GEOTOOL_MARKER_POINT_PIE \
237 ( 2, ( ( 1, 2, ( 1,3 ) ), \
241 # define GEOTOOL_MARKER_LINE_PIE \
242 ( 2, ( ( 1, 4, ( 1,2,3,4 ) ), \
247 # define GEOTOOL_MARKER_SURFACE_PIE \
248 ( 1, ( ( 1, 1, ( 1 ) ) ) \
254 # define GEOTOOL_MARKER_POINT_SPECIAL_1A \
255 ( 1, ( ( 1, 24, ( 1,2,3,4,5,6, \
258 19,20,21,22,23,24 ) ) ) ) \
260 # define GEOTOOL_MARKER_LINE_SPECIAL_1A \
261 ( 4, ( ( 1, 2, ( 1,5 ) ), \
264 ( 4, 2, ( 4,8 ) ) ) \
267 # define GEOTOOL_MARKER_SURFACE_SPECIAL_1A \
268 ( 1, ( ( 1, 2, ( 1,2 ) ) ) \
274 # define GEOTOOL_MARKER_POINT_SPECIAL_1B \
275 ( 1, ( ( 1, 12, ( 1,2,3,4,5,6, \
276 7,8,9,10,11,12 ) ) ) ) \
278 # define GEOTOOL_MARKER_LINE_SPECIAL_1B \
279 ( 3, ( ( 1, 2, ( 1,2 ) ), \
285 # define GEOTOOL_MARKER_SURFACE_SPECIAL_1B \
286 ( 1, ( ( 1, 1, ( 1 ) ) ) \
291 # define GEOTOOL_MARKER_POINT_PEANUT \
292 ( 1, ( ( 1, 8, ( 1,2,3,4,5,6,7,8 ) ) ) ) \
294 # define GEOTOOL_MARKER_LINE_PEANUT \
295 ( 1, ( ( 1, 1, ( 1 ) ) ) ) \
297 # define GEOTOOL_MARKER_SURFACE_PEANUT \
298 ( 1, ( ( 1, 1, ( 1 ) ) ) ) \
302 # define GEOTOOL_MARKER_POINT_CYLINDRE \
303 ( 1, ( ( 1, 10, ( 1,2,3,4,5,6, \
306 # define GEOTOOL_MARKER_LINE_CYLINDRE \
307 ( 12, ( ( 1, 1, ( 1 ) ), \
322 # define GEOTOOL_MARKER_SURFACE_CYLINDRE \
323 ( 3, ( ( 1, 1, ( 1 ) ), \
325 ( 3, 4, ( 3,4,5,6 ) ) \
329 # define GEOTOOL_MARKER_VOLUME_CYLINDRE \
330 ( 1, ( ( 1, 1, ( 1 ) ) ) \
335 # define GEOTOOL_MARKER_POINT_TUBE \
336 ( 1, ( ( 1, 18, ( 1,2,3,4,5,6, \
338 13,14,15,16,17,18 ) ) ) ) \
340 # define GEOTOOL_MARKER_LINE_TUBE \
341 ( 12, ( ( 1, 1, ( 1 ) ), \
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 ) ) \
365 # define GEOTOOL_MARKER_VOLUME_TUBE \
366 ( 1, ( ( 1, 4, ( 1,2,3,4 ) ) ) \
371 # define GEOTOOL_MARKER_POINT_SPHERE \
372 ( 1, ( ( 1, 7, ( 1,2,3,4,5,6,7 ) ) ) ) \
374 # define GEOTOOL_MARKER_LINE_SPHERE \
375 ( 12, ( ( 1, 1, ( 1 ) ), \
390 # define GEOTOOL_MARKER_SURFACE_SPHERE \
391 ( 1, ( ( 1, 8, ( 1,2,3,4,5,6,7,8 ) ) \
395 # define GEOTOOL_MARKER_VOLUME_SPHERE \
396 ( 1, ( ( 1, 1, ( 1 ) ) ) \
402 # define GEOTOOL_MARKER_POINT_HEXAEDRE \
403 ( 1, ( ( 1, 8, ( 1,2,3,4,5,6,7,8 ) ) ) ) \
405 # define GEOTOOL_MARKER_LINE_HEXAEDRE \
406 ( 12, ( ( 1, 1, ( 1 ) ), \
421 # define GEOTOOL_MARKER_SURFACE_HEXAEDRE \
422 ( 6, ( ( 1, 1, ( 1 ) ), \
431 # define GEOTOOL_MARKER_VOLUME_HEXAEDRE \
432 ( 1, ( ( 1, 1, ( 1 ) ) ) \
437 # define GEOTOOL_MARKER_POINT_CUBE \
438 ( 1, ( ( 1, 8, ( 1,2,3,4,5,6,7,8 ) ) ) ) \
440 # define GEOTOOL_MARKER_LINE_CUBE \
441 ( 12, ( ( 1, 1, ( 1 ) ), \
456 # define GEOTOOL_MARKER_SURFACE_CUBE \
457 ( 6, ( ( 1, 1, ( 1 ) ), \
466 # define GEOTOOL_MARKER_VOLUME_CUBE \
467 ( 1, ( ( 1, 1, ( 1 ) ) ) \
474 # define GEOTOOL_MARKER_POINT_SPECIAL3D_1 \
475 ( 1, ( ( 1, 12, ( 1,2,3,4,5,6,7,8,9,10,11,12 ) ) ) ) \
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 ) ) ) ) \
480 # define GEOTOOL_MARKER_SURFACE_SPECIAL3D_1 \
481 ( 2, ( ( 1, 5, ( 1,2,3,4,5 ) ), \
482 ( 3, 4, ( 6,7,8,9 ) ) \
486 # define GEOTOOL_MARKER_VOLUME_SPECIAL3D_1 \
487 ( 1, ( ( 1, 1, ( 1 ) ) ) \
496 # define GEOTOOL_MARKER_SURFACE_DEFAULT \
497 ( 1, ( ( 1, 1, ( 1 ) ) ) \
504 # define GEOTOOL_MARKER_VOLUME_DEFAULT \
505 ( 1, ( ( 1, 1, ( 1 ) ) ) \
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))
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)))
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)))
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)))
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)))
556 typedef node<double>::type node_type;
559 typedef boost::shared_ptr< GeoGMSHTool> GeoGMSHTool_ptrtype;
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;
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;
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;
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;
575 typedef std::map<int,std::list<int> > map_surfaceLoop_type;
579 typedef boost::tuple< GeoGMSHTool_ptrtype,
580 vec_map_data_ptrtype,
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;
591 void run( data_geo_ptrtype __dg );
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)) \
608 #define GEOTOOL_INSTANTIATES_FOR_INCR(r, state) \
610 BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(2, 0, state)), \
611 BOOST_PP_TUPLE_ELEM(2, 1, state) ) \
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); \
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 )
650 M_node( new node_type() )
654 M_node( new node_type( 1 ) )
656 ( *M_node )( 0 )=__x;
659 Node(
double __x,
double __y ) :
660 M_node( new node_type( 2 ) )
662 ( *M_node )( 0 )=__x;
663 ( *M_node )( 1 )=__y;
666 Node(
double __x,
double __y,
double __z ) :
667 M_node( new node_type( 3 ) )
669 ( *M_node )( 0 )=__x;
670 ( *M_node )( 1 )=__y;
671 ( *M_node )( 2 )=__z;
674 Node( Node
const & m )
681 M_node.reset(
new node_type( *( m.M_node ) ) );
685 double operator()( uint16_type n )
const
687 return this->getNode()( n );
690 double & operator()( uint16_type n )
692 return ( *M_node )( n );
707 boost::shared_ptr<node_type> M_node;
716 Loop( Loop
const & L ) : M_loop( L.M_loop ) {}
725 this->M_loop=m.M_loop;
727 Loop operator>>(
int __n )
729 M_loop.push_back( __n );
735 return M_loop.size();
738 std::list<int>::const_iterator begin()
const
740 return M_loop.begin();
742 std::list<int>::const_iterator end()
const
747 std::list<int> M_loop;
764 typedef node<double>::type node_type;
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;
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;
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;
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;
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;
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;
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;
820 GeoGMSHTool( uint16_type __dim, std::string __shape=
"NO_SHAPE", std::string __name=
"NO_NAME",
double __meshSize=0.1 );
822 GeoGMSHTool( uint16_type __dim, std::string
const & geoUserStr,
double __meshSize=0.1, std::string __shape=
"NO_SHAPE", std::string __name=
"NO_NAME" );
824 GeoGMSHTool( GeoGMSHTool
const & m );
830 GeoGMSHTool operator+(
const GeoGMSHTool & m );
831 GeoGMSHTool operator-(
const GeoGMSHTool & m );
833 GeoGMSHTool opFusion(
const GeoGMSHTool & m,
int __typeop );
835 void init(
int orderGeo,
836 std::string gmshFormatVersion,
837 double hmin=0,
double hmax=1e22,
839 bool optimize3dNetgen=
true,
840 GMSH_PARTITIONER partitioner=GMSH_PARTITIONER_CHACO,
842 bool partition_file=
false );
847 void initData( std::string __shape,
850 std::vector<GeoTool::Node> & __param,
852 uint16_type __nbligne,
853 uint16_type __nbsurface,
854 uint16_type __nbvolume );
860 void updateData( GeoGMSHTool
const & m );
865 void updateOstr( std::string __str )
880 M_ostr.reset(
new std::ostringstream() );
887 BOOST_PARAMETER_MEMBER_FUNCTION(
888 (
typename Feel::detail::mesh<Args>::ptrtype ),
893 ( name, ( std::string ) )
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 )
909 typedef typename Feel::detail::mesh<Args>::type _mesh_type;
910 typedef typename Feel::detail::mesh<Args>::ptrtype _mesh_ptrtype;
912 _mesh_ptrtype _mesh( mesh );
913 _mesh->setWorldComm( worldcomm );
915 if ( worldcomm.isActive() )
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(),
930 partitioner,partitions,partition_file );
932 std::string geostring;
934 if ( M_geoIsDefineByUser )
936 geostring= M_ostrDefineByUser->str();
942 geostring = M_ostr->str();
948 boost::tie( fname, gen ) = gmsh.generate( name,
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();
957 if ( straighten && _mesh_type::nOrder > 1 )
958 return straightenMesh( _mesh=_mesh,
959 _worldcomm=worldcomm.subWorldComm() );
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() )
972 boost::shared_ptr<mesh_type> mesh(
new mesh_type );
973 mesh->setWorldComm( worldcomm );
975 if ( worldcomm.isActive() )
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 );
984 this->init( mesh_type::nOrder,gmsh.version() );
986 std::string geostring;
988 if ( M_geoIsDefineByUser )
990 geostring= M_ostrDefineByUser->str();
996 geostring = M_ostr->str();
999 std::string fname = gmsh.generate( name,
1000 geostring,
false,
false,
false );
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();
1007 if ( straighten && mesh_type::nOrder > 1 )
1008 return straightenMesh( mesh );
1020 uint16_type dim()
const
1024 uint16_type cptPt()
const
1029 uint16_type cptLine()
const
1033 uint16_type cptLineLoop()
const
1035 return M_cptLineLoop;
1037 uint16_type cptSurface()
const
1039 return M_cptSurface;
1041 uint16_type cptTableau()
const
1043 return M_cptTableau;
1045 uint16_type cptSurfaceLoop()
const
1047 return M_cptSurfaceLoop;
1049 uint16_type cptVolume()
const
1058 parameter_shape_const_iterator_type
1059 paramShapeBegin()
const
1061 return M_paramShape->begin();
1064 parameter_shape_const_iterator_type paramShapeEnd()
const
1066 return M_paramShape->end();
1069 parameter_name_const_iterator_type
1070 paramNameBegin( std::string __shape )
const
1072 return M_paramShape->find( __shape )->second.begin();
1075 parameter_name_const_iterator_type
1076 paramNameEnd( std::string __shape )
const
1078 return M_paramShape->find( __shape )->second.end();
1081 parameter_rectangle_type
1082 getParameter( std::string __shape, std::string __name )
const
1084 return M_paramShape->find( __shape )->second.find( __name )->second;
1104 marker_type_const_iterator_type
1105 markerTypeBegin( )
const
1108 return M_markShape->begin();
1111 marker_type_const_iterator_type
1112 markerTypeEnd( )
const
1115 return M_markShape->end();
1124 marker_markerName_const_iterator_type
1125 markerMarkerNameBegin( std::string __type )
const
1128 return M_markShape->find( __type )->second.begin();
1131 marker_markerName_const_iterator_type
1132 markerMarkerNameEnd( std::string __type )
const
1135 return M_markShape->find( __type )->second.end();
1138 marker_markerName_type
1139 markerMarkerName( std::string __type )
const
1142 return M_markShape->find( __type )->second;
1145 std::list<marker_base_type>::const_iterator
1146 markerListIndiceBegin( std::string __type ,std::string __markerName )
const
1148 return M_markShape->find( __type )->second.find( __markerName )->second.begin();
1151 std::list<marker_base_type>::const_iterator
1152 markerListIndiceEnd( std::string __type ,std::string __markerName )
const
1155 return M_markShape->find( __type )->second.find( __markerName )->second.end();
1159 std::list<marker_base_type>
1160 getMarkerName( std::string __type ,std::string __markerName )
const
1163 return M_markShape->find( __type )->second.find( __markerName )->second;
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;
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;
1190 boost::shared_ptr<std::ostringstream> M_ostrExtrude;
1191 boost::shared_ptr<std::ostringstream> M_ostrSurfaceLoop;
1196 boost::shared_ptr<parameter_shape_type> M_paramShape;
1198 boost::shared_ptr<marker_type_type> M_markShape;
1201 boost::shared_ptr<std::ostringstream> M_ostr;
1203 boost::shared_ptr<std::ostringstream> M_ostrDefineByUser;
1204 bool M_geoIsDefineByUser;
1216 void run( data_geo_ptrtype __dg );
1218 template <u
int16_type Numero>
1220 param( data_geo_ptrtype __dg );
1224 writePoint( uint16_type __numLoc, data_geo_ptrtype __dg ,
double __x1,
double __x2=0,
double __x3=0 );
1227 writeLine( uint16_type __numLoc, data_geo_ptrtype __dg ,uint16_type __n1, uint16_type __n2 );
1230 writeCircle( uint16_type __numLoc, data_geo_ptrtype __dg ,uint16_type __n1, uint16_type __n2, uint16_type __n3 );
1233 writeEllipse( uint16_type __numLoc, data_geo_ptrtype __dg ,uint16_type __n1, uint16_type __n2, uint16_type __n3, uint16_type __n4 );
1236 writeSpline( uint16_type __numLoc, data_geo_ptrtype __dg ,Loop __loop );
1239 writeBSpline( uint16_type __numLoc, data_geo_ptrtype __dg ,Loop __loop );
1242 writeLineLoop( uint16_type __numLoc, data_geo_ptrtype __dg , Loop __loop );
1245 writePlaneSurface( uint16_type __numLoc, data_geo_ptrtype __dg , uint16_type __ind );
1248 writeRuledSurface( uint16_type __numLoc, data_geo_ptrtype __dg , uint16_type __ind );
1251 writeExtrudeSurface( uint16_type __numLoc,data_geo_ptrtype __dg , uint16_type __ind,Loop __loop );
1254 writePtInSurface( data_geo_ptrtype __dg , uint16_type __indPt,uint16_type __indSurf );
1257 writeSurfaceLoop( uint16_type __numLoc, data_geo_ptrtype __dg , Loop __loop );
1260 writeVolume( uint16_type __numLoc, data_geo_ptrtype __dg , uint16_type __ind );
1262 boost::tuple<Node,Node,Node>
1263 computeBasisOrthogonal( node_type dir,node_type centre );
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)) \
1285 #define GEOTOOL_FOR_INCR2(r, state) \
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) ) \
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) ) \
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) ) \
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) ) \
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) ), \
1339 BOOST_PP_TUPLE_ELEM(4, 2, state), \
1340 BOOST_PP_TUPLE_ELEM(4, 0, state) ) \
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)), \
1358 BOOST_PP_TUPLE_ELEM(4, 2, state), \
1359 BOOST_PP_TUPLE_ELEM(4, 0, state) ) \
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) ) \
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), \
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) \
1394 GEOTOOL_FOR_COMP2, GEOTOOL_FOR_INCR2, GEOTOOL_FOR_MARKER_POINT_MACRO2) \
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), \
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) \
1413 GEOTOOL_FOR_COMP2, GEOTOOL_FOR_INCR2, GEOTOOL_FOR_MARKER_LINE_MACRO2) \
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), \
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) \
1433 GEOTOOL_FOR_COMP2, GEOTOOL_FOR_INCR2, GEOTOOL_FOR_MARKER_SURFACE_MACRO2) \
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), \
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)), \
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) \
1454 GEOTOOL_FOR_COMP2, GEOTOOL_FOR_INCR2, GEOTOOL_FOR_MARKER_SURFACE_MACRO2) \
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), \
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)),\
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) \
1478 GEOTOOL_FOR_COMP2, GEOTOOL_FOR_INCR2, GEOTOOL_FOR_MARKER_VOLUME_MACRO2) \
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), \
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) \
1497 GEOTOOL_FOR_COMP2, GEOTOOL_FOR_INCR2, GEOTOOL_FOR_MARKER_VOLUME_MACRO2) \
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)) \
1515 #define GEOTOOL_FOR_INCR1(r, state) \
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) ) \
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)) \
1532 #define GEOTOOL_FOR_INCR(r, state) \
1534 BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(2, 0, state)), \
1535 BOOST_PP_TUPLE_ELEM(2, 1, state) ) \
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) ); \
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() \
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) ), \
1557 GEOTOOL_SHAPE_FOR_PARAM_SIGNATURE) \
1562 #define GEOTOOL_SHAPE_CLASS(r,state) \
1563 class GEOTOOL_SHAPE_NAME_CLASS(BOOST_PP_TUPLE_ELEM(2,0,state)) : public GeoGMSHTool \
1567 typedef GeoGMSHTool::node_type node_type; \
1568 typedef GeoTool::Node Node; \
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 ) \
1576 GeoGMSHTool( GEOTOOL_SHAPE_DIM(BOOST_PP_TUPLE_ELEM(2,0,state)),shape(), __name, __meshSize), \
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) ), \
1583 GEOTOOL_SHAPE_PARAM); \
1589 GEOTOOL_SHAPE_DIM(BOOST_PP_TUPLE_ELEM(2,0,state)), \
1591 GEOTOOL_SHAPE_NBSURFACE(BOOST_PP_TUPLE_ELEM(2,0,state)), \
1592 GEOTOOL_SHAPE_NBVOLUME(BOOST_PP_TUPLE_ELEM(2,0,state))); \
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) \
1601 M_param(m.M_param) \
1604 BOOST_PARAMETER_MEMBER_FUNCTION( \
1609 ( type, (std::string)) \
1610 ( name, (std::string)) ) \
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) \
1643 std::list<marker_base_type > __listMarker = (*(M_markShape))[type][name]; \
1646 if (type=="point") \
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) \
1655 else if (type=="line") \
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) \
1664 else if (type=="surface") \
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), \
1675 else if (type=="volume") \
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), \
1687 (*(M_markShape))[type][name] = __listMarker; \
1691 std::string M_name; \
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;} \
1697 std::vector<GeoTool::Node> M_param; \
1709 BOOST_PP_FOR( ( 0, BOOST_PP_SUB( BOOST_PP_ARRAY_SIZE( GEOTOOL_SHAPE ),1 ) ),
1712 GEOTOOL_SHAPE_CLASS )
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 )
1723 boost::shared_ptr<mesh_type> mesh(
new mesh_type );
1724 mesh->setWorldComm( worldcomm );
1726 if ( !worldcomm.isActive() )
return mesh;
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 );
1735 std::ostringstream ostr;
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"
1744 <<
"Mesh.Algorithm3D = 4;\n"
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";
1752 std::string contenu;
1753 std::ifstream ifstr( geofile.c_str(), std::ios::in );
1758 while ( getline( ifstr, contenu ) )
1759 ostr << contenu<<
"\n";
1767 boost::tie( fname, generated ) = gmsh.generate( name,
1768 ostr.str(),
false,
false,true );
1770 ImporterGmsh<mesh_type>
import( fname, FEELPP_GMSH_FORMAT_VERSION, worldcomm );
1772 mesh->accept(
import );
1773 mesh->components().set ( MESH_RENUMBER|MESH_UPDATE_EDGES|MESH_UPDATE_FACES|MESH_CHECK );
1774 mesh->updateForUse();
1776 if ( straighten && mesh_type::nOrder > 1 )
1777 return straightenMesh( _mesh=mesh, _worldcomm=worldcomm.subWorldComm() );