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
gmsh.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:set syntax=cpp fenc=utf-8 ft=tcl et sw=4 ts=4 sts=4 tw=0
2 
3  This file is part of the Feel library
4 
5  Author(s): Christophe Prud'homme <christophe.prudhomme@feelpp.org>
6  Date: 2005-02-10
7 
8  Copyright (C) 2005,2006 EPFL
9  Copyright (C) 2007 Université Joseph Fourier (Grenoble I)
10 
11  This library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU Lesser General Public
13  License as published by the Free Software Foundation; either
14  version 3.0 of the License, or (at your option) any later version.
15 
16  This library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  Lesser General Public License for more details.
20 
21  You should have received a copy of the GNU Lesser General Public
22  License along with this library; if not, write to the Free Software
23  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 */
30 #ifndef __gmsh_H
31 #define __gmsh_H 1
32 
33 #include <boost/type_traits.hpp>
34 
35 #include <boost/filesystem.hpp>
36 #include <boost/assign/list_of.hpp>
37 #include <boost/range/algorithm/for_each.hpp>
38 #include <boost/icl/type_traits/is_map.hpp>
39 
40 #include <feel/feelcore/feel.hpp>
42 #include <feel/feelcore/parameter.hpp>
47 #include <feel/feelvf/vf.hpp>
48 #include <feel/feelmesh/meshmover.hpp>
49 
50 namespace Feel
51 {
52 extern const char* FEELPP_GMSH_FORMAT_VERSION;
53 }
54 
56 #include <feel/feelfilters/exportergmsh.hpp>
57 
58 namespace Feel
59 {
60 
100 class Gmsh
101 {
102 public:
103 
104  enum DomainType { GMSH_REFERENCE_DOMAIN = 0, GMSH_REAL_DOMAIN };
105 
106  struct Factory
107  {
109  };
110 
114 
115  Gmsh( int nDim = 1, int nOrder = GMSH_ORDER_ONE, WorldComm const& worldComm=Environment::worldComm() );
116  Gmsh( Gmsh const & __g );
117  virtual ~Gmsh();
118 
120 
124 
132  Gmsh& operator=( Gmsh const& __g );
133 
134  static boost::shared_ptr<Gmsh> New( po::variables_map const& vm );
135  static boost::shared_ptr<Gmsh> New( std::string const& shape, uint16_type d = 2, uint16_type o = 1, std::string const& ct = "simplex" );
136 
138 
142 
146  int dimension() const
147  {
148  return M_dimension;
149  }
150 
155  GMSH_ORDER order() const
156  {
157  return ( GMSH_ORDER ) M_order;
158  }
159 
163  std::string version() const
164  {
165  return M_version;
166  }
167 
171  GMSH_FORMAT format() const
172  {
173  return M_format;
174  }
175 
179  bool isASCIIFormat() const { return M_format == GMSH_FORMAT_ASCII; }
180 
184  bool isBinaryFormat() const { return M_format == GMSH_FORMAT_BINARY; }
185 
189  std::string prefix() const
190  {
191  return M_name;
192  }
193 
197  std::vector<std::pair<double,double> > const& boundingBox() const
198  {
199  return M_I;
200  }
201  double xmin() const
202  {
203  return M_I[0].first;
204  }
205  double xmax() const
206  {
207  return M_I[0].second;
208  }
209  double ymin() const
210  {
211  return M_I[1].first;
212  }
213  double ymax() const
214  {
215  return M_I[1].second;
216  }
217  double zmin() const
218  {
219  return M_I[2].first;
220  }
221  double zmax() const
222  {
223  return M_I[2].second;
224  }
225 
229  double const& h() const
230  {
231  return M_h;
232  }
233 
237  std::string description() const
238  {
239  std::string d = this->getDescription();
240 
241  if ( !d.empty() ) M_desc = d;
242 
243  return M_desc;
244  }
245 
251  double geoParameter( std::string const& _name )
252  {
253  return boost::lexical_cast<double>( M_geoParamMap.at( _name ) );
254  }
255 
258  std::map<std::string, std::string> geoParameters()
259  {
260  return M_geoParamMap;
261  }
262 
266  bool addMidPoint() const
267  {
268  return M_addmidpoint;
269  }
270 
274  bool usePhysicalNames() const
275  {
276  return M_usePhysicalNames;
277  }
278 
280  WorldComm const& worldComm() const
281  {
282  return M_worldComm;
283  }
284 
286  int numberOfPartitions() const
287  {
288  return M_partitions;
289  }
290 
292  bool mshFileByPartition() const
293  {
294  return M_partition_file;
295  }
296 
298  GMSH_PARTITIONER partitioner() const
299  {
300  return M_partitioner;
301  }
302 
304  double shear() const
305  {
306  return M_shear;
307  }
308 
310  bool recombine() const
311  {
312  return M_recombine;
313  }
314  int structuredMesh() const
315  {
316  return M_structured;
317  }
318  int refinementLevels() const
319  {
320  return M_refine_levels;
321  }
323 
327 
331  Gmsh& setDimension( int dim )
332  {
333  M_dimension = dim;
334  return *this;
335  }
336 
347  {
348  this->setReferenceDomain();
349  return *this;
350  }
351 
357  Gmsh& h( double _h )
358  {
359  this->setCharacteristicLength( _h );
360  return *this;
361  }
362 
370  void setOrder( int o )
371  {
372  M_order = ( GMSH_ORDER ) o;
373  M_geoParamMap["ElementOrder"]=boost::lexical_cast<std::string>(o);
374  }
375 
379  void setVersion( std::string version, GMSH_FORMAT format = GMSH_FORMAT_ASCII )
380  {
381  if ( version != "1" && version != "2" && version != FEELPP_GMSH_FORMAT_VERSION )
382  throw std::invalid_argument( "invalid gmsh file format version" );
383 
384  M_version = version;
385  M_format = format;
386  }
387 
391  void setFileFormat( GMSH_FORMAT format )
392  {
393  M_format = format;
394  }
395 
399  void setDescription( std::string const& desc )
400  {
401  M_desc = desc;
402  }
403  void setSubStructuring( bool substruct )
404  {
405  M_substructuring = substruct;
406  }
407  bool subStructuring() const
408  {
409  return M_substructuring;
410  }
414  void setPrefix( std::string const& name )
415  {
416  M_name = name;
417  }
418  virtual void setX( std::pair<double,double> const& x )
419  {
420  FEELPP_ASSERT( dimension() >= 1 )( dimension() ).error( "invalid dimension" );
421  M_I[0] = x;
422  M_geoParamMap["xmin"]=boost::lexical_cast<std::string>(x.first);
423  M_geoParamMap["xmax"]=boost::lexical_cast<std::string>(x.second);
424  }
425  virtual void setY( std::pair<double,double> const& y )
426  {
427  FEELPP_ASSERT( dimension() >= 2 )( dimension() ).warn( "invalid dimension" );
428 
429  if ( dimension() >= 2 )
430  {
431  M_I[1] = y;
432  M_geoParamMap["ymin"]=boost::lexical_cast<std::string>(y.first);
433  M_geoParamMap["ymax"]=boost::lexical_cast<std::string>(y.second);
434  }
435  }
436  virtual void setZ( std::pair<double,double> const& z )
437  {
438  FEELPP_ASSERT( dimension() >= 3 )( dimension() ).warn( "invalid dimension" );
439 
440  if ( dimension() >= 3 )
441  {
442  M_I[2] = z;
443  M_geoParamMap["zmin"]=boost::lexical_cast<std::string>(z.first);
444  M_geoParamMap["zmax"]=boost::lexical_cast<std::string>(z.second);
445  }
446  }
447 
449  virtual void setReferenceDomain()
450  {
451  if ( dimension() >= 1 )
452  M_I[0] = std::make_pair( -1, 1 );
453 
454  if ( dimension() >= 2 )
455  M_I[1] = std::make_pair( -1, 1 );
456 
457  if ( dimension() >= 3 )
458  M_I[2] = std::make_pair( -1, 1 );
459  }
460 
462  virtual void setCharacteristicLength( double _h )
463  {
464  M_h = _h;
465  }
466 
470  void setAddMidPoint( bool add )
471  {
472  M_addmidpoint = add;
473  }
474 
481  void setGeoParameter( std::string const& _name, double _value )
482  {
483  M_geoParamMap.at( _name ) = boost::lexical_cast<std::string>( _value );
484  }
485 
490  void setGeoParameters( std::map<std::string, std::string> const& geomap, bool _update=1 )
491  {
492  if( _update )
493  {
494  for( const auto& iter : geomap)
495  M_geoParamMap.at(iter.first) = iter.second;
496  }
497  else
498  M_geoParamMap = geomap;
499  }
500 
506  void usePhysicalNames( bool option )
507  {
508  M_usePhysicalNames = option;
509  }
510 
512  void setWorldComm( WorldComm const& _worldcomm )
513  {
514  M_worldComm = _worldcomm;
515  }
516 
518  void setNumberOfPartitions( int n )
519  {
520  M_partitions = n;
521  }
522 
524  void setMshFileByPartition( bool p )
525  {
526  M_partition_file = p;
527  }
528 
529  void setStructuredMesh( int s )
530  {
531  M_structured = s;
532  }
533  void setRefinementLevels( int levels )
534  {
535  M_refine_levels = levels;
536  }
538  void setPartitioner( GMSH_PARTITIONER const& p )
539  {
540  M_partitioner = p;
541  }
542 
544  void setShear( double _shear )
545  {
546  M_shear = _shear;
547  }
548 
549 
551  void setRecombine( bool _recombine )
552  {
553  M_recombine = _recombine;
554  }
555 
557 
561 
565  std::string generate( std::string const& name ) const;
566 
575  boost::tuple<std::string,bool>
576  generate( std::string const& name,
577  std::string const& geo,
578  bool const forceRebuild = false,
579  bool const parametric = false,
580  bool const modifGeo = true ) const;
581 
587  std::string refine( std::string const& name, int level = 1, bool const parametric = false ) const;
588 
590  std::string preamble() const;
591 
595  std::string getDescriptionFromFile( std::string const& file ) const;
596 
600  void rebuildPartitionMsh( std::string const& nameMshInput,std::string const& nameMshOutput ) const;
601 
605  std::map<std::string, std::string> retrieveGeoParameters( std::string const& geo ) const;
606 
613  static std::map<std::string, std::string> gpstr2map( std::string const& geopars );
614 
616 
617 protected:
618 
622  virtual std::string getDescription() const
623  {
624  return std::string();
625  }
626 
635  bool generateGeo( std::string const& name, std::string const& geo,bool const modifGeo=true ) const;
636 
637 private:
638 
639  void generate( std::string const& __name, uint16_type dim, bool parametric = false ) const;
640 
641  std::string prefix( std::string const& __name, uint16_type dim ) const;
642 
643 protected:
645  WorldComm M_worldComm;
646 
649 
651  int M_order;
652  // gmsh
653  std::string M_version;
654 
655  // gmsh file format (ascii or binary)
656  GMSH_FORMAT M_format;
657 
658  // name of the file
659  std::string M_name;
660 
661  // description of the geometry
662  mutable std::string M_desc;
663 
664  // geometry parameters map
665  std::map< std::string, std::string > M_geoParamMap;
666 
668  std::vector<std::pair<double,double> > M_I;
670  double M_h;
675 
677  GMSH_PARTITIONER M_partitioner;
683  double M_shear;
686  // build structured mesh
687  int M_structured;
690 
691  bool M_substructuring;
692 };
693 
695 typedef Gmsh gmsh_type;
697 typedef boost::shared_ptr<gmsh_type> gmsh_ptrtype;
698 
700 namespace detail
701 {
702 template<typename Args, typename Tag=tag::mesh>
703 struct mesh
704 {
705  typedef typename boost::remove_pointer<
706  typename boost::remove_const<
707  typename boost::remove_reference<
708  typename parameter::binding<Args, Tag>::type
709  >::type
710  >::type
711  >::type _type;
712 typedef typename mpl::if_<is_shared_ptr<_type>,
713  mpl::identity<typename _type::element_type>,
714  mpl::identity<_type> >::type::type type;
715 typedef boost::shared_ptr<type> ptrtype;
716 };
717 
718 template<typename Args, typename Tag=tag::geoentity>
719 struct meshFromGeoEntity
720 {
721  typedef typename boost::remove_pointer<
722  typename boost::remove_const<
723  typename boost::remove_reference<
724  typename parameter::binding<Args, Tag>::type
725  >::type
726  >::type
727  >::type _type;
728 
729  typedef typename _type::GeoShape GeoShape;
730  typedef typename mpl::if_< mpl::bool_<GeoShape::is_simplex>,
731  mpl::identity< Mesh< Simplex< GeoShape::nDim,GeoShape::nOrder,GeoShape::nRealDim> > >,
732  mpl::identity< Mesh< Hypercube< GeoShape::nDim,GeoShape::nOrder,GeoShape::nRealDim> > >
733  >::type::type type;
734 };
735 
736 
737 template <typename ElementSpaceType>
738 void
739 straightenMeshUpdateEdgesOnBoundaryIsolated( ElementSpaceType & straightener, mpl::int_<0> )
740 {}
741 template <typename ElementSpaceType>
742 void
743 straightenMeshUpdateEdgesOnBoundaryIsolated( ElementSpaceType & straightener, mpl::int_<1> )
744 {}
745 template <typename ElementSpaceType>
746 void
747 straightenMeshUpdateEdgesOnBoundaryIsolated( ElementSpaceType & straightener, mpl::int_<2> )
748 {}
749 template <typename ElementSpaceType>
750 void
751 straightenMeshUpdateEdgesOnBoundaryIsolated( ElementSpaceType & straightener, mpl::int_<3> )
752 {
753  typedef typename ElementSpaceType::functionspace_type space_type;
754  typedef typename space_type::mesh_type mesh_type;
755  typedef typename space_type::dof_type::fe_type fe_type;
756 
757  auto const ncdof = space_type::dof_type::nComponents;
758  auto const dofshift = fe_type::nDofPerVertex*mesh_type::element_type::numVertices;
759 
760  auto mesh = straightener.mesh();
761  auto const myrank = mesh->worldComm().localRank();
762 
763  std::set<size_type> edgeIdFoundToUpdate;
764 
765  auto itedge = mesh->beginEdgeOnBoundary();
766  auto const enedge = mesh->endEdgeOnBoundary();
767  for ( ; itedge!=enedge ; ++itedge )
768  {
769  if (itedge->processId()!=myrank || itedge->numberOfElementsGhost()==0 ) continue;
770 
771  auto const theedgeid = itedge->id();
772 
773  std::set<size_type> ghostFaceIdFoundOnBoundary;
774 
775  auto iteltghost = itedge->elementsGhost().begin();
776  auto const eneltghost = itedge->elementsGhost().end();
777  for ( ; iteltghost!=eneltghost ; ++iteltghost )
778  {
779  auto const& eltGhost = mesh->element(iteltghost->template get<1>(),iteltghost->template get<0>());
780  for ( uint16_type f = 0 ; f < mesh_type::element_type::numTopologicalFaces ; ++f )
781  {
782  auto const& theface = eltGhost.face(f);
783  if ( theface.isOnBoundary() )
784  {
785  bool findEdge=false;
786  for ( uint16_type e = 0; e < mesh_type::face_type::numEdges && !findEdge ; ++e )
787  {
788  if ( theface.edge(e).id() == theedgeid) { findEdge=true; ghostFaceIdFoundOnBoundary.insert(theface.id());}
789  }
790  }
791  }
792  }
793 
794  if (ghostFaceIdFoundOnBoundary.size()==2) edgeIdFoundToUpdate.insert(theedgeid);
795 
796  } // for ( ; itedge!=enedge ; ++itedge )
797 
798 
799  if (edgeIdFoundToUpdate.size() > 0)
800  {
801  auto iteltactif = mesh->beginElementOnBoundary();
802  auto const eneltactif = mesh->endElementOnBoundary();
803  for ( ; iteltactif!=eneltactif ; ++iteltactif )
804  {
805  //if (iteltactif->processId()!=myrank) continue;
806 
807  for ( uint16_type e = 0; e < mesh_type::element_type::numEdges ; ++e )
808  {
809  if ( edgeIdFoundToUpdate.find(iteltactif->edge(e).id()) != edgeIdFoundToUpdate.end())
810  {
811  //std::cout << "find edge " << std::endl;
812  auto const idEltFind = iteltactif->id();
813  for ( uint16_type locdof = 0 ; locdof<fe_type::nDofPerEdge ; ++locdof )
814  {
815  auto const local_id = dofshift + e*fe_type::nDofPerEdge + locdof;
816 
817  for ( uint16_type comp = 0; comp < ncdof; ++comp )
818  {
819  auto const globdof = straightener.functionSpace()->dof()->localToGlobal( idEltFind, local_id, comp ).template get<0>();
820  //std::cout << straightener.functionSpace()->dof()->dofPoint( globdof ).template get<0>() << std::endl;
821  straightener(globdof) = 0;
822  }
823  }
824  }
825  }
826 
827  } // for ( ; iteltactif!=eneltactif ; ++iteltactif )
828  } // if (edgeIdFoundToUpdate.size() > 0)
829 
830 
831 } // straightenMeshUpdateEdgesOnBoundaryIsolated
832 
833 } // namespace detail
835 
842 BOOST_PARAMETER_FUNCTION(
843  ( typename Feel::detail::mesh<Args>::ptrtype ), // return type
844  straightenMesh, // 2. function name
845 
846  tag, // 3. namespace of tag types
847 
848  ( required
849  ( mesh, * )
850  )
851  ( optional
852  ( refine, *( boost::is_integral<mpl::_> ), 0 )
853  ( save, *( boost::is_integral<mpl::_> ), 0 )
854  ( worldcomm, ( WorldComm ), Environment::worldComm() )
855  ) )
856 {
857  typedef typename Feel::detail::mesh<Args>::type _mesh_type;
858  typedef typename Feel::detail::mesh<Args>::ptrtype _mesh_ptrtype;
859 
860  VLOG(1) << "straighten mesh of order " << _mesh_type::nOrder << " start";
861 
862  _mesh_ptrtype _mesh( mesh );
863 
864  using namespace vf;
865  typedef FunctionSpace<_mesh_type,bases<Lagrange<_mesh_type::nOrder,Vectorial> > > space_t;
866 #if defined(FEELPP_ENABLE_MPI_MODE)
867  auto Xh = space_t::New( _mesh=_mesh, _worldscomm=std::vector<WorldComm>(1,worldcomm) );
868 #else
869  auto Xh = space_t::New( _mesh=_mesh );
870 #endif
871 
872  auto xHo = vf::project( _space=Xh, _range=elements( mesh ), _expr=vf::P(), _geomap=GeomapStrategyType::GEOMAP_HO );
873  auto xLo = vf::project( _space=Xh, _range=elements( mesh ), _expr=vf::P(), _geomap=GeomapStrategyType::GEOMAP_O1 );
874  auto xHoBdy = vf::project( _space=Xh, _range=boundaryfaces( mesh ), _expr=vf::P(), _geomap=GeomapStrategyType::GEOMAP_HO );
875  auto xLoBdy = vf::project( _space=Xh, _range=boundaryfaces( mesh ), _expr=vf::P(), _geomap=GeomapStrategyType::GEOMAP_O1 );
876 
877  auto straightener = Xh->element();
878  straightener=( xLo-xHo )-( xLoBdy-xHoBdy );
879 
880  if (worldcomm.localSize()>1)
881  Feel::detail::straightenMeshUpdateEdgesOnBoundaryIsolated( straightener,mpl::int_<_mesh_type::nDim>() );
882 
883  double norm_mean_value = integrate( _range=boundaryfaces( _mesh ), _expr=idv( straightener ) ).evaluate(true,worldcomm).norm();
884 
885  if ( norm_mean_value > 1e-12 )
886  std::cout << "the straightening process may have failed\n"
887  << "norm of component-wise mean value of displacement on the boundary should be 0"
888  << "norm_mean_value: " << norm_mean_value << "\n"
889  << "you should consider not using straightenMesh()\n"
890  << "\n";
891 
892  boost::shared_ptr<Exporter<_mesh_type,_mesh_type::nOrder> > exporter;
893 
894  if ( save )
895  {
896  exporter = Exporter<_mesh_type,_mesh_type::nOrder>::New( "gmsh"/*test_app->vm()*/, "straightener" );
897  exporter->step( 0 )->setMesh( _mesh );
898  exporter->step( 0 )->add( "xHo", xHo );
899  exporter->step( 0 )->add( "xLo", xLo );
900  exporter->step( 0 )->add( "xHoBdy", xHoBdy );
901  exporter->step( 0 )->add( "xLoBdy", xLoBdy );
902  exporter->step( 0 )->add( "straightener", straightener );
903  exporter->save();
904  }
905 
906  MeshMover<_mesh_type> meshmove;
907  meshmove.apply( _mesh, straightener );
908 
909  VLOG(1) << "straighten mesh of order " << _mesh_type::nOrder << " finish";
910 
911  return _mesh;
912 }
913 
924 BOOST_PARAMETER_FUNCTION(
925  ( typename Feel::detail::mesh<Args>::ptrtype ), // return type
926  loadGMSHMesh, // 2. function name
927 
928  tag, // 3. namespace of tag types
929 
930  ( required
931  ( mesh, * )
932  ( filename, * )
933  ) // 4. one required parameter, and
934 
935  ( optional
936  ( straighten, *( boost::is_integral<mpl::_> ), option(_name="gmsh.straighten").template as<bool>() )
937  ( refine, *( boost::is_integral<mpl::_> ), option(_name="gmsh.refine").template as<int>() )
938  ( update, *( boost::is_integral<mpl::_> ), 0 )
939  ( physical_are_elementary_regions, *, option(_name="gmsh.physical_are_elementary_regions").template as<bool>() )
940  ( worldcomm, *, Environment::worldComm() )
941  ( rebuild_partitions, (bool), option(_name="gmsh.partition").template as<bool>() )
942  ( rebuild_partitions_filename, *, filename )
943  ( partitions, *( boost::is_integral<mpl::_> ), worldcomm.globalSize() )
944  ( partitioner, *( boost::is_integral<mpl::_> ), option(_name="gmsh.partitioner").template as<int>() )
945  ( partition_file, *( boost::is_integral<mpl::_> ), 0 )
946  )
947  )
948 {
949  typedef typename Feel::detail::mesh<Args>::type _mesh_type;
950  typedef typename Feel::detail::mesh<Args>::ptrtype _mesh_ptrtype;
951 
952  _mesh_ptrtype _mesh( mesh );
953  _mesh->setWorldComm( worldcomm );
954 
955  std::string filename_with_path = Environment::findFile( filename );
956  if ( filename_with_path.empty() )
957  {
958  std::vector<std::string> plist = Environment::geoPathList();
959  std::ostringstream ostr;
960  std::for_each( plist.begin(), plist.end(), [&ostr]( std::string s ) { ostr << " - " << s << "\n"; } );
961  CHECK( !filename_with_path.empty() ) << "File " << filename << " cannot be found in the following paths list:\n " << ostr.str();
962  }
963 
964  Gmsh gmsh( _mesh_type::nDim,_mesh_type::nOrder, worldcomm );
965  gmsh.setRefinementLevels( refine );
966  gmsh.setNumberOfPartitions( partitions );
967  gmsh.setPartitioner( (GMSH_PARTITIONER)partitioner );
968  gmsh.setMshFileByPartition( partition_file );
969 
970 
971  // refinement if option is enabled to a value greater or equal to 1
972  if ( refine )
973  {
974  filename_with_path = gmsh.refine( filename_with_path, refine );
975  }
976  else if ( rebuild_partitions )
977  {
978  gmsh.rebuildPartitionMsh(filename_with_path,rebuild_partitions_filename);
979  filename_with_path=rebuild_partitions_filename;
980  }
981 
982  ImporterGmsh<_mesh_type> import( filename_with_path, FEELPP_GMSH_FORMAT_VERSION, worldcomm );
983 
984  // need to replace physical_region by elementary_region while reading
985  if ( physical_are_elementary_regions )
986  {
987  import.setElementRegionAsPhysicalRegion( physical_are_elementary_regions );
988  }
989 
990  _mesh->accept( import );
991 
992  if ( update )
993  {
994  _mesh->components().reset();
995  _mesh->components().set( update );
996  _mesh->updateForUse();
997  }
998 
999  else
1000  {
1001  _mesh->components().reset();
1002  }
1003 
1004  if ( straighten && _mesh_type::nOrder > 1 )
1005  return straightenMesh( _mesh=_mesh,
1006  _worldcomm=worldcomm.subWorldComm() );
1007 
1008  return _mesh;
1009 }
1010 
1018 BOOST_PARAMETER_FUNCTION(
1019  ( void ), // return type
1020  saveGMSHMesh, // 2. function name
1021  tag, // 3. namespace of tag types
1022  ( required
1023  ( mesh, * )
1024  ( filename, * ) ) // 4. one required parameter, and
1025  ( optional
1026  ( parametricnodes, *( boost::is_integral<mpl::_> ), 0 ) )
1027  )
1028 {
1029  typedef typename Feel::detail::mesh<Args>::type _mesh_type;
1030  typedef typename Feel::detail::mesh<Args>::ptrtype _mesh_ptrtype;
1031 
1032 #if BOOST_FILESYSTEM_VERSION == 3
1033  ExporterGmsh<_mesh_type,1> exporter( fs::path( filename ).stem().string(), 1, mesh->worldComm() );
1034 #elif BOOST_FILESYSTEM_VERSION == 2
1035  ExporterGmsh<_mesh_type,1> exporter( fs::path( filename ).stem(), 1, mesh->worldComm() );
1036 #endif
1037  exporter.saveMesh( filename, mesh, parametricnodes );
1038 
1039 }
1040 
1041 BOOST_PARAMETER_FUNCTION(
1042  ( void ), // return type
1043  saveGeoEntityAsGMSHMesh, // 2. function name
1044  tag, // 3. namespace of tag types
1045  ( required
1046  ( geoentity, * )
1047  ( filename, * ) ) // 4. one required parameter, and
1048  )
1049 {
1050  typedef typename Feel::detail::meshFromGeoEntity<Args>::type _mesh_type;
1051 
1052 #if BOOST_FILESYSTEM_VERSION == 3
1053  ExporterGmsh<_mesh_type,1> exporter( fs::path( filename ).stem().string(), 1, Environment::worldComm().subWorldCommSeq() );
1054 #elif BOOST_FILESYSTEM_VERSION == 2
1055  ExporterGmsh<_mesh_type,1> exporter( fs::path( filename ).stem(), 1, Environment::worldComm().subWorldCommSeq() );
1056 #endif
1057  exporter.gmshSaveOneElementAsMesh( filename, geoentity );
1058 }
1059 
1060 
1075 BOOST_PARAMETER_FUNCTION(
1076  ( typename Feel::detail::mesh<Args>::ptrtype ), // return type
1077  createGMSHMesh, // 2. function name
1078 
1079  tag, // 3. namespace of tag types
1080 
1081  ( required
1082  ( mesh, * )
1083  ( desc, * )
1084  ) // 4. one required parameter, and
1085 
1086  ( optional
1087  ( format, *, option(_name="gmsh.format").template as<int>() )
1088  ( h, *( boost::is_arithmetic<mpl::_> ), option(_name="gmsh.hsize").template as<double>() )
1089  ( geo_parameters, *( boost::icl::is_map<mpl::_> ), Gmsh::gpstr2map("") )
1090  ( parametricnodes, *( boost::is_integral<mpl::_> ), 0 )
1091  ( straighten, *( boost::is_integral<mpl::_> ), option(_name="gmsh.straighten").template as<bool>() )
1092  ( refine, *( boost::is_integral<mpl::_> ), option(_name="gmsh.refine").template as<int>() )
1093  ( structured, *( boost::is_integral<mpl::_> ), option(_name="gmsh.structured").template as<int>() )
1094  ( update, *( boost::is_integral<mpl::_> ), MESH_RENUMBER|MESH_UPDATE_EDGES|MESH_UPDATE_FACES|MESH_CHECK )
1095  ( force_rebuild, *( boost::is_integral<mpl::_> ), 0 )
1096  ( physical_are_elementary_regions, *,false )
1097  ( rebuild_partitions, (bool), option(_name="gmsh.partition").template as<bool>() )
1098  ( rebuild_partitions_filename, *( boost::is_convertible<mpl::_,std::string> ) , desc->prefix()+".msh" )
1099  ( worldcomm, *, Environment::worldComm() )
1100  ( partitions, *( boost::is_integral<mpl::_> ), worldcomm.globalSize() )
1101  ( partition_file, *( boost::is_integral<mpl::_> ), 0 )
1102  ( partitioner, *( boost::is_integral<mpl::_> ), GMSH_PARTITIONER_CHACO )
1103  )
1104  )
1105 {
1106  typedef typename Feel::detail::mesh<Args>::type _mesh_type;
1107  typedef typename Feel::detail::mesh<Args>::ptrtype _mesh_ptrtype;
1108 
1109  _mesh_ptrtype _mesh( mesh );
1110  _mesh->setWorldComm( worldcomm );
1111 
1112  if ( worldcomm.isActive() )
1113  {
1114  desc->setDimension( mesh->nDim );
1115  desc->setOrder( mesh->nOrder );
1116  desc->setWorldComm( worldcomm );
1117  desc->setNumberOfPartitions( partitions );
1118  desc->setPartitioner( (GMSH_PARTITIONER) partitioner );
1119  desc->setMshFileByPartition( partition_file );
1120  desc->setRefinementLevels( refine );
1121  desc->setFileFormat( (GMSH_FORMAT)format );
1122  desc->setStructuredMesh( structured );
1123 
1124  std::string fname;
1125  bool generated_or_modified;
1126  boost::tie( fname, generated_or_modified ) = desc->generate( desc->prefix(), desc->description(), force_rebuild, parametricnodes );
1127 
1128  // refinement if option is enabled to a value greater or equal to 1
1129  // do not refine if the mesh/geo file was previously generated or modified
1130  if ( refine && !generated_or_modified )
1131  {
1132  VLOG(1) << "Refine mesh ( level: " << refine << ")\n";
1133  fname = desc->refine( fname, refine, parametricnodes );
1134  }
1135 
1136  if ( rebuild_partitions )
1137  {
1138  desc->rebuildPartitionMsh(fname,rebuild_partitions_filename);
1139  fname=rebuild_partitions_filename;
1140  }
1141 
1142  ImporterGmsh<_mesh_type> import( fname, FEELPP_GMSH_FORMAT_VERSION, worldcomm );
1143 
1144  // need to replace physical_regions by elementary_regions for specific meshes
1145  if ( physical_are_elementary_regions )
1146  {
1147  import.setElementRegionAsPhysicalRegion( physical_are_elementary_regions );
1148  }
1149 
1150  _mesh->accept( import );
1151 
1152  if ( update )
1153  {
1154  _mesh->components().reset();
1155  _mesh->components().set( update );
1156  _mesh->updateForUse();
1157  }
1158 
1159  else
1160  {
1161  _mesh->components().reset();
1162  }
1163 
1164  if ( straighten && _mesh_type::nOrder > 1 )
1165  return straightenMesh( _mesh=_mesh,
1166  _worldcomm=worldcomm.subWorldComm() );
1167  }
1168  return _mesh;
1169 }
1170 
1171 
1195 BOOST_PARAMETER_FUNCTION(
1196  ( gmsh_ptrtype ), // return type
1197  domain, // 2. function name
1198  tag, // 3. namespace of tag types
1199  ( required
1200  ( name, *( boost::is_convertible<mpl::_,std::string> ) )
1201  )
1202  ( optional
1203  ( shape, *( boost::is_convertible<mpl::_,std::string> ), option(_name="gmsh.domain.shape").template as<std::string>() )
1204  ( shear, *( boost::is_arithmetic<mpl::_> ) , option(_name="gmsh.domain.shear").template as<double>() )
1205  ( recombine, *( boost::is_integral<mpl::_> ) , option(_name="gmsh.domain.recombine").template as<bool>() )
1206  ( dim, *( boost::is_integral<mpl::_> ), 3 )
1207  ( order, *( boost::is_integral<mpl::_> ), 1 )
1208  ( geo_parameters, *( boost::icl::is_map<mpl::_> ), Gmsh::gpstr2map("") )
1209  ( h, *( boost::is_arithmetic<mpl::_> ), option(_name="gmsh.hsize").template as<double>() )
1210  ( convex, *( boost::is_convertible<mpl::_,std::string> ), option(_name="gmsh.domain.convex").template as<std::string>() )
1211  ( addmidpoint, *( boost::is_integral<mpl::_> ), option(_name="gmsh.domain.addmidpoint").template as<bool>() )
1212  ( usenames, *( boost::is_integral<mpl::_> ), option(_name="gmsh.domain.usenames").template as<bool>() )
1213  ( xmin, *( boost::is_arithmetic<mpl::_> ), option(_name="gmsh.domain.xmin").template as<double>() )
1214  ( xmax, *( boost::is_arithmetic<mpl::_> ), option(_name="gmsh.domain.xmax").template as<double>())
1215  ( ymin, *( boost::is_arithmetic<mpl::_> ), option(_name="gmsh.domain.ymin").template as<double>() )
1216  ( ymax, *( boost::is_arithmetic<mpl::_> ), option(_name="gmsh.domain.ymax").template as<double>() )
1217  ( zmin, *( boost::is_arithmetic<mpl::_> ), option(_name="gmsh.domain.zmin").template as<double>() )
1218  ( zmax, *( boost::is_arithmetic<mpl::_> ), option(_name="gmsh.domain.zmax").template as<double>() )
1219  ( substructuring, *( boost::is_integral<mpl::_> ), option(_name="gmsh.domain.substructuring").template as<bool>() ) ) )
1220 {
1221  gmsh_ptrtype gmsh_ptr = Gmsh::New( shape, 3, 1, convex );
1222 
1223  gmsh_ptr->setPrefix( name );
1224  gmsh_ptr->setGeoParameters( gmsh_ptr->retrieveGeoParameters( gmsh_ptr->description() ), 0 );
1225  gmsh_ptr->setGeoParameters( geo_parameters );
1226  gmsh_ptr->setCharacteristicLength( h );
1227  gmsh_ptr->setAddMidPoint( addmidpoint );
1228  gmsh_ptr->usePhysicalNames( usenames );
1229  gmsh_ptr->setShear( shear );
1230  gmsh_ptr->setRecombine( recombine );
1231  gmsh_ptr->setX( std::make_pair( xmin, xmax ) );
1232  gmsh_ptr->setY( std::make_pair( ymin, ymax ) );
1233  gmsh_ptr->setZ( std::make_pair( zmin, zmax ) );
1234  gmsh_ptr->setSubStructuring( substructuring );
1235  return gmsh_ptr;
1236 }
1237 
1246 BOOST_PARAMETER_FUNCTION(
1247  ( gmsh_ptrtype ), // return type
1248  geo, // 2. function name
1249  tag, // 3. namespace of tag types
1250  ( required
1251  ( filename, *( boost::is_convertible<mpl::_,std::string> ) ) )
1252  ( optional
1253  ( h, *( boost::is_arithmetic<mpl::_> ), option(_name="gmsh.hsize").template as<double>() )
1254  ( geo_parameters, *( boost::icl::is_map<mpl::_> ), Gmsh::gpstr2map( option(_name="gmsh.geo-variables-list").template as<std::string>() ) )
1255  ( dim, *( boost::is_integral<mpl::_> ), 3 )
1256  ( order, *( boost::is_integral<mpl::_> ), 1 )
1257  ( files_path, *( boost::is_convertible<mpl::_,std::string> ), Environment::localGeoRepository() )
1258  ( depends, *( boost::is_convertible<mpl::_,std::string> ), option(_name="gmsh.depends").template as<std::string>() )
1259  ( worldcomm, (WorldComm), Environment::worldComm() ) )
1260  )
1261 
1262 {
1263  gmsh_ptrtype gmsh_ptr( new Gmsh( 3, 1, worldcomm ) );
1264 
1265  gmsh_ptr->setCharacteristicLength( h );
1266 #if BOOST_FILESYSTEM_VERSION == 3
1267  gmsh_ptr->setPrefix( fs::path( filename ).stem().string() );
1268 #elif BOOST_FILESYSTEM_VERSION == 2
1269  gmsh_ptr->setPrefix( fs::path( filename ).stem() );
1270 #endif
1271 
1272  std::string filename_with_path = Environment::findFile( filename );
1273  if ( filename_with_path.empty() )
1274  {
1275  std::vector<std::string> plist = Environment::geoPathList();
1276  std::ostringstream ostr;
1277  std::for_each( plist.begin(), plist.end(), [&ostr]( std::string s ) { ostr << " - " << s << "\n"; } );
1278  CHECK( !filename_with_path.empty() ) << "File " << filename << " cannot be found in the following paths list:\n " << ostr.str();
1279  }
1280 
1281  gmsh_ptr->setDescription( gmsh_ptr->getDescriptionFromFile( filename_with_path ) );
1282  gmsh_ptr->setGeoParameters( gmsh_ptr->retrieveGeoParameters( gmsh_ptr->description() ), 0 );
1283  gmsh_ptr->setGeoParameters( geo_parameters );
1284 
1285  if( worldcomm.globalRank() == worldcomm.masterRank() )
1286  {
1287  fs::path cp = fs::current_path();
1288  std::vector<std::string> depends_on_files;
1289  if ( !depends.empty() )
1290  algorithm::split( depends_on_files, depends, algorithm::is_any_of( ":,; " ), algorithm::token_compress_on );
1291  // copy include/merged files needed by geometry file
1292  boost::for_each( depends_on_files,
1293  [&cp, &files_path]( std::string const& _filename )
1294  {
1295  fs::path file_path( files_path );
1296  file_path /= _filename;
1297 
1298  try
1299  {
1300  boost::system::error_code ec;
1301 
1302  if ( !( fs::exists( file_path ) && fs::is_regular_file( file_path ) ) )
1303  std::cout << "File : " << file_path << " doesn't exist or is not a regular file" << std::endl;
1304 
1305  else if ( !fs::exists( cp / _filename ) )
1306  fs::copy_file( file_path, fs::path( _filename ), fs::copy_option::none );
1307 
1308  }
1309 
1310  catch ( const fs::filesystem_error& e )
1311  {
1312  std::cerr << "Error: " << e.what() << std::endl;
1313  }
1314  } );
1315  }
1316  worldcomm.barrier();
1317 
1318 
1319  return gmsh_ptr;
1320 
1321 }
1322 
1323 
1324 
1332 BOOST_PARAMETER_FUNCTION(
1333  ( gmsh_ptrtype ), // return type
1334  mshconvert, // 2. function name
1335  tag, // 3. namespace of tag types
1336  ( required
1337  ( filename, *( boost::is_convertible<mpl::_,std::string> ) ) )
1338  ( optional
1339  ( dim, *( boost::is_integral<mpl::_> ), 3 )
1340  ( order, *( boost::is_integral<mpl::_> ), 1 ) )
1341  )
1342 {
1343  gmsh_ptrtype gmsh_ptr( new Gmsh( 3, 1 ) );
1344 #if BOOST_FILESYSTEM_VERSION == 3
1345  gmsh_ptr->setPrefix( fs::path( filename ).stem().string() );
1346 #elif BOOST_FILESYSTEM_VERSION == 2
1347  gmsh_ptr->setPrefix( fs::path( filename ).stem() );
1348 #endif
1349 
1350  // first try in the current path
1351  if ( fs::exists( filename ) )
1352  gmsh_ptr->setDescription( ( boost::format( "Merge \"%1%\";\n" ) % filename ).str() );
1353 
1354  else if ( fs::exists( fs::path( Environment::localGeoRepository() ) / filename ) )
1355  gmsh_ptr->setDescription( ( boost::format( "Merge \"%1%\";\n" ) % ( fs::path( Environment::localGeoRepository() ) / filename ).string() ).str() );
1356 
1357  else if ( Environment::systemGeoRepository().template get<1>() &&
1358  fs::exists( fs::path( Environment::systemGeoRepository().get<0>() ) / filename ) )
1359  gmsh_ptr->setDescription( ( boost::format( "Merge \"%1%\";\n" ) % ( fs::path( Environment::systemGeoRepository().get<0>() ) / filename ).string() ).str() );
1360 
1361  else
1362  {
1363  std::ostringstream ostr;
1364  ostr << "File " << filename << " was not found neither in current directory or in " << Environment::localGeoRepository() << " or in " << Environment::systemGeoRepository();
1365  throw std::invalid_argument( ostr.str() );
1366  }
1367 
1368  return gmsh_ptr;
1369 }
1370 
1376 BOOST_PARAMETER_FUNCTION(
1377  ( std::string ), // return type
1378  img2msh, // 2. function name
1379  tag, // 3. namespace of tag types
1380  ( required
1381  ( filename, *( boost::is_convertible<mpl::_,std::string> ) ) )
1382  ( optional
1383  ( prefix, *( boost::is_convertible<mpl::_,std::string> ), fs::path( filename ).stem() ) )
1384  )
1385 {
1386  gmsh_ptrtype gmsh_ptr( new Gmsh( 2, 1 ) );
1387  gmsh_ptr->setPrefix( prefix );
1388  std::string meshname = ( boost::format( "%1%-0.msh" ) % prefix ).str();
1389 
1390  // first try in the current path
1391  if ( fs::exists( filename ) )
1392  gmsh_ptr->setDescription( ( boost::format( "Merge \"%1%\";\nSave View [0] \"%2%\";\n" ) % filename % meshname ).str() );
1393 
1394  else if ( fs::exists( fs::path( Environment::localGeoRepository() ) / filename ) )
1395  gmsh_ptr->setDescription( ( boost::format( "Merge \"%1%\";\nSave View [0] \"%2%\";\n" ) % ( fs::path( Environment::localGeoRepository() ) / filename ).string() % meshname ).str() );
1396 
1397  else if ( Environment::systemGeoRepository().template get<1>() &&
1398  fs::exists( fs::path( Environment::systemGeoRepository().get<0>() ) / filename ) )
1399  gmsh_ptr->setDescription( ( boost::format( "Merge \"%1%\";\nSave View [0] \"%2%\";\n" ) % ( fs::path( Environment::systemGeoRepository().get<0>() ) / filename ).string() % meshname ).str() );
1400 
1401  else
1402  {
1403  std::ostringstream ostr;
1404  ostr << "File " << filename << " was not found neither in current directory or in " << Environment::localGeoRepository() << " or in " << Environment::systemGeoRepository();
1405  throw std::invalid_argument( ostr.str() );
1406  }
1407 
1408  gmsh_ptr->generate( gmsh_ptr->prefix(), gmsh_ptr->description() );
1409  return meshname;
1410 }
1411 
1412 
1413 
1417 boost::shared_ptr<Mesh<Simplex<1> > > unitSegment( double h = option(_name="gmsh.hsize").as<double>() );
1418 
1422 boost::shared_ptr<Mesh<Simplex<2> > > unitSquare( double h = option(_name="gmsh.hsize").as<double>() );
1423 
1427 template<int Ngeo=1>
1428 inline
1429 boost::shared_ptr<Mesh<Simplex<2,Ngeo> > >
1430 unitCircle( double h = option(_name="gmsh.hsize").template as<double>() )
1431 {
1432  return createGMSHMesh(_mesh=new Mesh<Simplex<2,Ngeo> >,
1433  _desc=domain( _name="square",
1434  _shape="ellipsoid",
1435  _dim=2,
1436  _xmin=-1,
1437  _ymin=-1,
1438  _h=h ) );
1439 }
1440 
1444 template<int Ngeo=1>
1445 inline
1446 boost::shared_ptr<Mesh<Simplex<3,Ngeo> > >
1447 unitSphere( double h = option(_name="gmsh.hsize").template as<double>() )
1448 {
1449  return createGMSHMesh(_mesh=new Mesh<Simplex<3,Ngeo> >,
1450  _desc=domain( _name="sphere",
1451  _shape="ellipsoid",
1452  _dim=3,
1453  _xmin=-1,
1454  _ymin=-1,
1455  _zmin=-1,
1456  _h= h ) );
1457 }
1458 
1459 
1463 boost::shared_ptr<Mesh<Simplex<3> > > unitCube( double h = option(_name="gmsh.hsize").as<double>() );
1464 
1465 template<int Dim, typename Convex=Simplex<Dim>>
1466 inline
1467 boost::shared_ptr<Mesh<Convex> >
1468 unitHypercube( double h = option(_name="gmsh.hsize").template as<double>() )
1469 {
1470  return createGMSHMesh(_mesh=new Mesh<Convex>,
1471  _desc=domain( _name="hypercube",
1472  _shape="hypercube",
1473  _convex=Convex::type(),
1474  _dim=Dim,
1475  _h=h ) );
1476 }
1477 
1478 
1479 
1490 BOOST_PARAMETER_FUNCTION(
1491  ( typename Feel::detail::mesh<Args>::ptrtype ), // return type
1492  loadMesh, // 2. function name
1493 
1494  tag, // 3. namespace of tag types
1495 
1496  ( required
1497  ( mesh, *)
1498 
1499  ) // 4. one required parameter, and
1500 
1501  ( optional
1502  ( filename, *( boost::is_convertible<mpl::_,std::string> ), option(_name="gmsh.filename").template as<std::string>() )
1503  ( h, *( boost::is_arithmetic<mpl::_> ), option(_name="gmsh.hsize").template as<double>() )
1504  ( straighten, (bool), option(_name="gmsh.straighten").template as<bool>() )
1505  ( refine, *( boost::is_integral<mpl::_> ), option(_name="gmsh.refine").template as<int>() )
1506  ( update, *( boost::is_integral<mpl::_> ), MESH_CHECK|MESH_UPDATE_FACES|MESH_UPDATE_EDGES )
1507  ( physical_are_elementary_regions, (bool), option(_name="gmsh.physical_are_elementary_regions").template as<bool>() )
1508  ( worldcomm, (WorldComm), Environment::worldComm() )
1509  ( force_rebuild, *( boost::is_integral<mpl::_> ), option(_name="gmsh.rebuild").template as<bool>() )
1510  ( rebuild_partitions, (bool), option(_name="gmsh.partition").template as<bool>() )
1511  ( rebuild_partitions_filename, *( boost::is_convertible<mpl::_,std::string> ) , filename )
1512  ( partitions, *( boost::is_integral<mpl::_> ), worldcomm.globalSize() )
1513  ( partitioner, *( boost::is_integral<mpl::_> ), option(_name="gmsh.partitioner").template as<int>() )
1514  ( partition_file, *( boost::is_integral<mpl::_> ), 0 )
1515  ( depends, *( boost::is_convertible<mpl::_,std::string> ), option(_name="gmsh.depends").template as<std::string>() )
1516  )
1517  )
1518 {
1519 #if defined(__clang__)
1520 #pragma clang diagnostic push
1521 #pragma clang diagnostic ignored "-Wunsequenced"
1522 #endif
1523  typedef typename Feel::detail::mesh<Args>::type _mesh_type;
1524  typedef typename Feel::detail::mesh<Args>::ptrtype _mesh_ptrtype;
1525 
1526  // look for mesh_name in various directories (executable directory, current directory. ...)
1527  // return an empty string if the file is not found
1528 
1529  fs::path mesh_name=fs::path(Environment::findFile(filename));
1530  LOG_IF( WARNING, mesh_name.extension() != ".geo" && mesh_name.extension() != ".msh" )
1531  << "Invalid filename " << filename << " it should have either the .geo or .msh extension\n";
1532 
1533 
1534  if ( mesh_name.extension() == ".geo" )
1535  {
1536  return createGMSHMesh( _mesh=mesh,
1537  _desc=geo( _filename=mesh_name.string(),
1538  _h=h,_depends=depends,
1539  _worldcomm=worldcomm ),
1540  _h=h,
1541  _straighten=straighten,
1542  _refine=refine,
1543  _update=update,
1544  _physical_are_elementary_regions=physical_are_elementary_regions,
1545  _force_rebuild=force_rebuild,
1546  _worldcomm=worldcomm,
1547  _rebuild_partitions=rebuild_partitions,
1548  _rebuild_partitions_filename=rebuild_partitions_filename,
1549  _partitions=partitions,
1550  _partitioner=partitioner,
1551  _partition_file=partition_file
1552  );
1553  }
1554 
1555  if ( mesh_name.extension() == ".msh" )
1556  {
1557  return loadGMSHMesh( _mesh=mesh,
1558  _filename=mesh_name.string(),
1559  _straighten=straighten,
1560  _refine=refine,
1561  _update=update,
1562  _physical_are_elementary_regions=physical_are_elementary_regions,
1563  _worldcomm=worldcomm,
1564  _rebuild_partitions=rebuild_partitions,
1565  _rebuild_partitions_filename=rebuild_partitions_filename,
1566  _partitions=partitions,
1567  _partitioner=partitioner,
1568  _partition_file=partition_file
1569  );
1570 
1571  }
1572 
1573  LOG(WARNING) << "File " << mesh_name << " not found, generating instead an hypercube in " << _mesh_type::nDim << "D geometry and mesh...";
1574  return createGMSHMesh(_mesh=mesh,
1575  _desc=domain( _name=option(_name="gmsh.domain.shape").template as<std::string>(), _h=h ),
1576  _h=h,
1577  _refine=refine,
1578  _update=update,
1579  _physical_are_elementary_regions=physical_are_elementary_regions,
1580  _force_rebuild=force_rebuild,
1581  _worldcomm=worldcomm,
1582  _rebuild_partitions=rebuild_partitions,
1583  _rebuild_partitions_filename=rebuild_partitions_filename,
1584  _partitions=partitions,
1585  _partitioner=partitioner,
1586  _partition_file=partition_file );
1587 #if defined(__clang__)
1588 #pragma clang diagnostic pop
1589 #endif
1590 }
1591 
1592 } // Feel
1593 
1594 #endif /* __Gmsh_H */

Generated on Sun Oct 20 2013 08:24:59 for Feel++ by doxygen 1.8.4