1 // Copyright (C) 2012-2015 ALNEOS
2 // Copyright (C) 2016 EDF R&D
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.alneos.com/ or email : contact@alneos.fr
20 #include "GMSHPlugin_Mesher.hxx"
21 #include "GMSHPlugin_Hypothesis_2D.hxx"
23 #include <SMDS_FaceOfNodes.hxx>
24 #include <SMDS_MeshElement.hxx>
25 #include <SMDS_MeshNode.hxx>
26 #include <SMESHDS_Mesh.hxx>
27 #include <SMESH_Block.hxx>
28 #include <SMESH_Comment.hxx>
29 #include <SMESH_ComputeError.hxx>
30 #include <SMESH_File.hxx>
31 #include <SMESH_Gen_i.hxx>
32 #include <SMESH_Mesh.hxx>
33 #include <SMESH_MesherHelper.hxx>
34 #include <SMESH_subMesh.hxx>
35 #include <utilities.h>
40 #include <BRep_Tool.hxx>
41 #include <Bnd_B3d.hxx>
42 #include <GCPnts_AbscissaPoint.hxx>
43 #include <GeomAdaptor_Curve.hxx>
44 #include <NCollection_Map.hxx>
45 #include <OSD_File.hxx>
46 #include <OSD_Path.hxx>
47 #include <Standard_ErrorHandler.hxx>
48 #include <Standard_ProgramError.hxx>
49 #include <TCollection_AsciiString.hxx>
51 #include <TopExp_Explorer.hxx>
52 #include <TopTools_DataMapIteratorOfDataMapOfShapeInteger.hxx>
53 #include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
54 #include <TopTools_DataMapOfShapeInteger.hxx>
55 #include <TopTools_DataMapOfShapeShape.hxx>
56 #include <TopTools_ListIteratorOfListOfShape.hxx>
57 #include <TopTools_MapOfShape.hxx>
62 //=============================================================================
66 //=============================================================================
68 GMSHPlugin_Mesher::GMSHPlugin_Mesher (SMESH_Mesh* mesh,
69 const TopoDS_Shape& aShape)
73 // il faudra peut être mettre un truc par defaut si l'utilisateur ne rentre rien en para
74 //defaultParameters();
77 //void GMSHPlugin_Mesher::defaultParameters(){}
79 void GMSHPlugin_Mesher::SetParameters(const GMSHPlugin_Hypothesis* hyp)
83 _algo2d = hyp->Get2DAlgo();
84 _algo3d = hyp->Get3DAlgo();
85 _recomb2DAlgo = hyp->GetRecomb2DAlgo();
86 _recombineAll = hyp->GetRecombineAll();
87 _subdivAlgo = hyp->GetSubdivAlgo();
88 _remeshAlgo = hyp->GetRemeshAlgo();
89 _remeshPara = hyp->GetRemeshPara();
90 _smouthSteps = hyp->GetSmouthSteps();
91 _sizeFactor = hyp->GetSizeFactor();
92 _minSize = hyp->GetMinSize();
93 _maxSize = hyp->GetMaxSize();
94 _secondOrder = hyp->GetSecondOrder();
95 _useIncomplElem = hyp->GetUseIncomplElem();
96 _is2d = hyp->GetIs2d();
97 _compounds = hyp->GetCompoundOnEntries();
104 _recombineAll = false;
112 _secondOrder = false;
113 _useIncomplElem = true;
118 //================================================================================
120 * \brief Set Gmsh Options
122 //================================================================================
124 void GMSHPlugin_Mesher::SetGmshOptions()
126 MESSAGE("GMSHPlugin_Mesher::SetGmshOptions");
128 printf("We chose _algo2d %d \n", _algo2d );
129 printf("We chose _algo3d %d \n", _algo3d );
130 printf("We chose _recomb2DAlgo %d \n", _recomb2DAlgo );
131 printf("We chose _recombineAll %d \n", (_recombineAll)?1:0);
132 printf("We chose _subdivAlgo %d \n", _subdivAlgo );
133 printf("We chose _remeshAlgo %d \n", _remeshAlgo );
134 printf("We chose _remeshPara %d \n", _remeshPara );
135 printf("We chose _smouthSteps %e \n", _smouthSteps );
136 printf("We chose _sizeFactor %e \n", _sizeFactor );
137 printf("We chose _minSize %e \n", _minSize );
138 printf("We chose _maxSize %e \n", _maxSize );
139 printf("We chose _secondOrder %d \n", (_secondOrder)?1:0);
140 printf("We chose _useIncomplElem %d \n", (_useIncomplElem)?1:0);
141 printf("We are in dimension %d \n", (_is2d)?2:3);
144 std::map <int,double> mapAlgo2d;
145 mapAlgo2d[0]=2; mapAlgo2d[1]=1; mapAlgo2d[2]=5; mapAlgo2d[3]=6; mapAlgo2d[4]=8;
146 std::map <int,double> mapAlgo3d;
147 mapAlgo3d[0]=1; mapAlgo3d[1]=4; mapAlgo3d[2]=5; mapAlgo3d[3]=6; mapAlgo3d[4]=7; mapAlgo3d[4]=9;
150 ok = GmshSetOption("Mesh", "Algorithm" , mapAlgo2d[_algo2d]) ;
154 ok = GmshSetOption("Mesh", "Algorithm3D" , mapAlgo2d[_algo3d]) ;
157 ok = GmshSetOption("Mesh", "RecombinationAlgorithm" , (double)_recomb2DAlgo) ;
159 ok = GmshSetOption("Mesh", "RecombineAll" , (_recombineAll)?1.:0.) ;
161 ok = GmshSetOption("Mesh", "SubdivisionAlgorithm" , (double)_subdivAlgo) ;
163 ok = GmshSetOption("Mesh", "RemeshAlgorithm" , (double)_remeshAlgo) ;
165 ok = GmshSetOption("Mesh", "RemeshParametrization" , (double)_remeshPara) ;
167 ok = GmshSetOption("Mesh", "Smoothing" , (double)_smouthSteps) ;
169 ok = GmshSetOption("Mesh", "CharacteristicLengthFactor", _sizeFactor) ;
171 ok = GmshSetOption("Mesh", "CharacteristicLengthMin" , _minSize) ;
173 ok = GmshSetOption("Mesh", "CharacteristicLengthMax" , _maxSize) ;
175 ok = GmshSetOption("Mesh", "ElementOrder" , (_secondOrder)?2.:1.) ;
179 ok = GmshSetOption("Mesh", "SecondOrderIncomplete" ,(_useIncomplElem)?1.:0.);
184 //================================================================================
186 * \brief Create and add Compounds into GModel _gModel.
188 //================================================================================
190 void GMSHPlugin_Mesher::CreateGmshCompounds()
192 MESSAGE("GMSHPlugin_Mesher::CreateGmshCompounds");
194 SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
196 OCC_Internals* occgeo = _gModel->getOCCInternals();
198 for(std::set<std::string>::const_iterator its = _compounds.begin();its != _compounds.end(); ++its )
200 GEOM::GEOM_Object_var aGeomObj;
201 TopoDS_Shape geomShape = TopoDS_Shape();
202 SALOMEDS::SObject_var aSObj = SMESH_Gen_i::getStudyServant()->FindObjectID( (*its).c_str() );
203 SALOMEDS::GenericAttribute_var anAttr;
204 if (!aSObj->_is_nil() && aSObj->FindAttribute(anAttr, "AttributeIOR"))
206 SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
207 CORBA::String_var aVal = anIOR->Value();
208 CORBA::Object_var obj = SMESH_Gen_i::getStudyServant()->ConvertIORToObject(aVal);
209 aGeomObj = GEOM::GEOM_Object::_narrow(obj);
211 if ( !aGeomObj->_is_nil() )
212 geomShape = smeshGen_i->GeomObjectToShape( aGeomObj.in() );
214 TopAbs_ShapeEnum geomType = geomShape.ShapeType();
215 if (geomShape.ShapeType() == TopAbs_COMPOUND)// voir s'il ne faut pas mettre une erreur dans le cas contraire
217 MESSAGE("shapeType == TopAbs_COMPOUND");
218 TopoDS_Iterator it(geomShape);
219 TopAbs_ShapeEnum shapeType = it.Value().ShapeType();
221 if (shapeType == TopAbs_EDGE)
223 MESSAGE(" shapeType == TopAbs_EDGE :");
224 int num = _gModel->getNumEdges()+1;
225 Curve *curve = CreateCurve(num, MSH_SEGM_COMPOUND, 1, NULL, NULL, -1, -1, 0., 1.);
226 for (it; it.More(); it.Next())
228 TopoDS_Shape topoShape = it.Value();
229 ASSERT(topoShape.ShapeType() == shapeType);
230 curve->compound.push_back(occgeo->addEdgeToModel(_gModel, (TopoDS_Edge&)topoShape)->tag());
232 Tree_Add(_gModel->getGEOInternals()->Curves, &curve);
233 //_gModel->importGEOInternals();
236 else if (shapeType == TopAbs_FACE)
238 MESSAGE(" shapeType == TopAbs_FACE :");
239 int num = _gModel->getNumFaces()+1;
240 Surface *surface = CreateSurface(num, MSH_SURF_COMPOUND);
241 for (it; it.More(); it.Next())
243 TopoDS_Shape topoShape = it.Value();
244 ASSERT(topoShape.ShapeType() == shapeType);
245 surface->compound.push_back(occgeo->addFaceToModel(_gModel, (TopoDS_Face&)topoShape)->tag());
247 Tree_Add(_gModel->getGEOInternals()->Surfaces, &surface);
248 _gModel->getGEOInternals()->synchronize(_gModel);
254 //================================================================================
256 * \brief Write mesh from GModel instance to SMESH instance
258 //================================================================================
260 void GMSHPlugin_Mesher::FillSMesh()
262 MESSAGE("GMSHPlugin_Mesher::FillSMesh");
263 // GET MESH FROM SMESH
264 SMESHDS_Mesh* meshDS = _mesh->GetMeshDS();
267 for(GModel::viter it = _gModel->firstVertex(); it != _gModel->lastVertex(); ++it){
268 GVertex *gVertex = *it;
270 // GET topoVertex CORRESPONDING TO gVertex
271 TopoDS_Vertex topoVertex = *((TopoDS_Vertex*)gVertex->getNativePtr());
273 if (gVertex->getVisibility() == 0) // belongs to a compound
275 SMESH_subMesh* sm = _mesh->GetSubMesh(topoVertex);
276 sm->SetIsAlwaysComputed(true); // prevent from displaying errors
280 // FILL SMESH FOR topoVertex
282 for(unsigned int i = 0; i < gVertex->mesh_vertices.size(); i++)
284 MVertex *v = gVertex->mesh_vertices[i];
285 if(v->getIndex() >= 0)
287 SMDS_MeshNode *node = meshDS->AddNodeWithID(v->x(),v->y(),v->z(),v->getNum());
288 meshDS->SetNodeOnVertex( node, topoVertex );
292 for(unsigned int i = 0; i < gVertex->getNumMeshElements(); i++)
294 MElement *e = gVertex->getMeshElement(i);
295 std::vector<MVertex*> verts;
296 e->getVertices(verts);
297 ASSERT(verts.size()==1);
298 SMDS_Mesh0DElement* zeroDElement = 0;
299 // WE DONT ADD 0D ELEMENTS because it does not follow the salome meshers philosophy
300 //zeroDElement = meshDS->Add0DElementWithID(verts[0]->getNum(),e->getNum());
301 //meshDS->SetMeshElementOnShape(zeroDElement, topoVertex);
306 for(GModel::eiter it = _gModel->firstEdge(); it != _gModel->lastEdge(); ++it){
309 // GET topoEdge CORRESPONDING TO gEdge (map if compound)
310 TopoDS_Edge topoEdge;
311 std::map<GEdge*,TopoDS_Edge> topoEdges;
313 if(gEdge->geomType() != GEntity::CompoundCurve)
315 topoEdge = *((TopoDS_Edge*)gEdge->getNativePtr());
316 if (gEdge->getVisibility() == 0) // belongs to a compound
318 SMESH_subMesh* sm = _mesh->GetSubMesh(topoEdge);
319 sm->SetIsAlwaysComputed(true); // prevent from displaying errors
325 // compound case, map construction GEdge/TopoDS_Edge
326 std::vector<GEdge*> gEdges = ((GEdgeCompound*)gEdge)->getCompounds();
327 for(std::vector<GEdge*>::const_iterator itv = gEdges.begin();itv != gEdges.end(); ++itv)
329 topoEdges.insert( pair<GEdge*,TopoDS_Edge>(*itv,*((TopoDS_Edge*)(*itv)->getNativePtr())) );
333 // FILL SMESH FOR topoEdge
335 for(unsigned int i = 0; i < gEdge->mesh_vertices.size(); i++)
337 MVertex *v = gEdge->mesh_vertices[i];
338 if(v->getIndex() >= 0)
340 SMDS_MeshNode *node = meshDS->AddNodeWithID(v->x(),v->y(),v->z(),v->getNum());
342 if (topoEdges.size() != 0)
344 // get back corresponding topoEdge in compound case
346 SPoint3 point = v->point();
347 float distmin = std::numeric_limits<float>::max();
348 for(map<GEdge*,TopoDS_Edge>::const_iterator itm=topoEdges.begin();itm != topoEdges.end(); itm++)
350 SBoundingBox3d bounds = (*itm).first->bounds();
351 float dist = DistBoundingBox(bounds,point);
354 topoEdge = (*itm).second;
362 meshDS->SetNodeOnEdge( node, topoEdge );
366 for(unsigned int i = 0; i < gEdge->getNumMeshElements(); i++)
368 MElement *e = gEdge->getMeshElement(i);
369 std::vector<MVertex*> verts;
370 e->getVertices(verts);
371 SMDS_MeshEdge* edge = 0;
373 if (topoEdges.size() !=0)
375 // get back corresponding topoEdge in compound case
377 SPoint3 point = e->barycenter();
378 float distmin = std::numeric_limits<float>::max();
379 for(map<GEdge*,TopoDS_Edge>::const_iterator itm=topoEdges.begin();itm != topoEdges.end(); itm++)
381 SBoundingBox3d bounds = (*itm).first->bounds();
382 float dist = DistBoundingBox(bounds,point);
385 topoEdge = (*itm).second;
393 // if a node wasn't set, it is assigned here
394 for (unsigned j = 0; j < verts.size(); j++)
396 if(verts[j]->onWhat()->getVisibility() == 0)
398 SMDS_MeshNode *node = meshDS->AddNodeWithID(verts[i]->x(),verts[j]->y(),verts[j]->z(),verts[j]->getNum());
399 meshDS->SetNodeOnEdge( node, topoEdge );
400 verts[j]->setEntity(gEdge);
404 switch (verts.size())
407 edge = meshDS->AddEdgeWithID(verts[0]->getNum(),
408 verts[1]->getNum(),e->getNum());
411 edge = meshDS->AddEdgeWithID(verts[0]->getNum(),
413 verts[2]->getNum(),e->getNum());
419 meshDS->SetMeshElementOnShape(edge, topoEdge);
424 for(GModel::fiter it = _gModel->firstFace(); it != _gModel->lastFace(); ++it){
427 // GET topoFace CORRESPONDING TO gFace (map if compound)
428 TopoDS_Face topoFace;
429 std::map<GFace*,TopoDS_Face> topoFaces;
431 if(gFace->geomType() != GEntity::CompoundSurface)
433 topoFace = *((TopoDS_Face*)gFace->getNativePtr());
434 if (gFace->getVisibility() == 0) // belongs to a compound
436 SMESH_subMesh* sm = _mesh->GetSubMesh(topoFace);
437 sm->SetIsAlwaysComputed(true); // prevent from displaying errors
443 // compound case, map construction GFace/TopoDS_Face
444 std::list<GFace*> gFaces = ((GFaceCompound*)gFace)->getCompounds();
445 for(std::list<GFace*>::const_iterator itl = gFaces.begin();itl != gFaces.end(); ++itl)
447 topoFaces.insert( pair<GFace*,TopoDS_Face>(*itl,*((TopoDS_Face*)(*itl)->getNativePtr())) );
451 // FILL SMESH FOR topoFace
453 for(unsigned int i = 0; i < gFace->mesh_vertices.size(); i++)
455 MVertex *v = gFace->mesh_vertices[i];
456 if(v->getIndex() >= 0)
458 SMDS_MeshNode *node = meshDS->AddNodeWithID(v->x(),v->y(),v->z(),v->getNum());
460 if (topoFaces.size() != 0)
462 // get back corresponding topoFace in compound case
464 SPoint3 point = v->point();
465 float distmin = std::numeric_limits<float>::max();
466 for(map<GFace*,TopoDS_Face>::const_iterator itm=topoFaces.begin();itm != topoFaces.end(); itm++)
468 SBoundingBox3d bounds = (*itm).first->bounds();
469 float dist = DistBoundingBox(bounds,point);
472 topoFace = (*itm).second;
480 meshDS->SetNodeOnFace( node, topoFace );
484 for(unsigned int i = 0; i < gFace->getNumMeshElements(); i++)
486 MElement *e = gFace->getMeshElement(i);
487 std::vector<MVertex*> verts;
488 e->getVertices(verts);
489 SMDS_MeshFace* face = 0;
491 if (topoFaces.size() !=0)
493 // get back corresponding topoFace in compound case
495 SPoint3 point = e->barycenter();
496 float distmin = std::numeric_limits<float>::max();
497 for(map<GFace*,TopoDS_Face>::const_iterator itm=topoFaces.begin();itm != topoFaces.end(); itm++)
499 SBoundingBox3d bounds = (*itm).first->bounds();
500 float dist = DistBoundingBox(bounds,point);
503 topoFace = (*itm).second;
511 // if a node wasn't set, it is assigned here
512 for (unsigned j = 0; j < verts.size(); j++)
514 if(verts[j]->onWhat()->getVisibility() == 0)
516 SMDS_MeshNode *node = meshDS->AddNodeWithID(verts[j]->x(),verts[j]->y(),verts[j]->z(),verts[j]->getNum());
517 meshDS->SetNodeOnFace( node, topoFace );
518 verts[i]->setEntity(gFace);
521 switch (verts.size())
524 face = meshDS->AddFaceWithID(verts[0]->getNum(),
526 verts[2]->getNum(),e->getNum());
529 face = meshDS->AddFaceWithID(verts[0]->getNum(),
532 verts[3]->getNum(),e->getNum());
535 face = meshDS->AddFaceWithID(verts[0]->getNum(),
540 verts[5]->getNum(),e->getNum());
543 face = meshDS->AddFaceWithID(verts[0]->getNum(),
550 verts[7]->getNum(),e->getNum());
553 face = meshDS->AddFaceWithID(verts[0]->getNum(),
561 verts[8]->getNum(),e->getNum());
567 meshDS->SetMeshElementOnShape(face, topoFace);
572 for(GModel::riter it = _gModel->firstRegion(); it != _gModel->lastRegion(); ++it){
573 GRegion *gRegion = *it;
574 if (gRegion->getVisibility() == 0)
577 // GET topoSolid CORRESPONDING TO gRegion
578 TopoDS_Solid topoSolid = *((TopoDS_Solid*)gRegion->getNativePtr());
580 //printf("volume %d (%d) contains %d elements\n", meshDS->ShapeToIndex(topoSolid), gRegion->tag(), gRegion->getNumMeshElements());
581 // FILL SMESH FOR topoSolid
584 for(unsigned int i = 0; i < gRegion->mesh_vertices.size(); i++)
586 MVertex *v = gRegion->mesh_vertices[i];
587 if(v->getIndex() >= 0)
589 SMDS_MeshNode *node = meshDS->AddNodeWithID(v->x(),v->y(),v->z(),v->getNum());
590 meshDS->SetNodeInVolume( node, topoSolid );
595 for(unsigned int i = 0; i < gRegion->getNumMeshElements(); i++)
597 MElement *e = gRegion->getMeshElement(i);
598 std::vector<MVertex*> verts;
599 e->getVertices(verts);
600 SMDS_MeshVolume* volume = 0;
601 switch (verts.size()){
603 volume = meshDS->AddVolumeWithID(verts[0]->getNum(),
606 verts[3]->getNum(),e->getNum());
609 volume = meshDS->AddVolumeWithID(verts[0]->getNum(),
613 verts[4]->getNum(),e->getNum());
616 volume = meshDS->AddVolumeWithID(verts[0]->getNum(),
621 verts[4]->getNum(),e->getNum());
624 volume = meshDS->AddVolumeWithID(verts[0]->getNum(),
631 verts[5]->getNum(),e->getNum());
634 volume = meshDS->AddVolumeWithID(verts[0]->getNum(),
643 verts[9]->getNum(),e->getNum());
646 volume = meshDS->AddVolumeWithID(verts[0]->getNum(),
658 verts[9]->getNum(),e->getNum());
660 case 14: // same as case 13, because no pyra14 in smesh
661 volume = meshDS->AddVolumeWithID(verts[0]->getNum(),
673 verts[9]->getNum(),e->getNum());
676 volume = meshDS->AddVolumeWithID(verts[0]->getNum(),
690 verts[10]->getNum(),e->getNum());
692 case 18: // same as case 15, because no penta18 in smesh
693 volume = meshDS->AddVolumeWithID(verts[0]->getNum(),
707 verts[10]->getNum(),e->getNum());
710 volume = meshDS->AddVolumeWithID(verts[0]->getNum(),
729 verts[12]->getNum(),e->getNum());
732 volume = meshDS->AddVolumeWithID(verts[0]->getNum(),
765 meshDS->SetMeshElementOnShape(volume, topoSolid);
772 //================================================================================
774 * \brief Find if SPoint point is in SBoundingBox3d bounds
776 //================================================================================
778 float GMSHPlugin_Mesher::DistBoundingBox(SBoundingBox3d& bounds,SPoint3& point)
780 SPoint3 min = bounds.min();
781 SPoint3 max = bounds.max();
785 if (point.x() < min.x())
786 x = min.x()-point.x();
787 else if (point.x() > max.x())
788 x = point.x()-max.x();
792 if (point.y() < min.y())
793 y = min.y()-point.y();
794 else if (point.y() > max.y())
795 y = point.y()-max.y();
799 if (point.z() < min.z())
800 z = min.z()-point.z();
801 else if (point.z() > max.z())
802 z = point.z()-max.z();
806 return sqrt(x*x+y*y+z*z);
808 //================================================================================
810 * \brief Reimplemented GmshMessage call. Actions done if errors occurs
811 * during gmsh meshing. We define here what to display and what to do.
813 //================================================================================
814 void GMSHPlugin_Mesher::mymsg::operator()(std::string level, std::string msg)
816 //MESSAGE("level="<< level.c_str() << ", msg=" << msg.c_str()<< "\n");
817 printf("level=%s msg=%s\n", level.c_str(), msg.c_str());
819 if(level == "Fatal" || level == "Error")
821 std::ostringstream oss;
822 if (level == "Fatal")
823 oss << "Fatal error during Generation of Gmsh Mesh\n";
825 oss << "Error during Generation of Gmsh Mesh\n";
826 oss << " " << msg.c_str() << "\n";
827 GEntity *e = _gModel->getCurrentMeshEntity();
830 oss << " error occurred while meshing entity:\n" <<
831 " tag=" << e->tag() << "\n" <<
832 " dimension=" << e->dim() << "\n" <<
833 " native pointer=" << e->getNativePtr();
834 //if(e->geomType() != GEntity::CompoundCurve and e->geomType() != GEntity::CompoundSurface)
836 //SMESH_subMesh *sm = _mesh->GetSubMesh(*((TopoDS_Shape*)e->getNativePtr()));
837 //SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
838 //SMESH_Comment comment;
839 //comment << SMESH_Comment(oss.str);
840 //std::string str = oss.str();
841 //smError.reset( new SMESH_ComputeError( str ));
843 // plutot que de faire de la merde ici, on pourait simplement
844 // remplir une liste pour dire sur quelles entités gmsh se plante
845 // (puis faire le fillsmesh)
846 // puis faire une nouvelle routine qui réécrit les messages d'erreur
847 // probleme : gmsh peut planté en Fatal, dans ce cas pas de fillsmesh
850 if (level == "Fatal")
852 CTX::instance()->lock = 0;
856 printf(oss.str().c_str());
860 //=============================================================================
862 * Here we are going to use the GMSH mesher
864 //=============================================================================
866 bool GMSHPlugin_Mesher::Compute()
868 MESSAGE("GMSHPlugin_Mesher::Compute");
874 _gModel = new GModel();
876 GmshSetMessageHandler(&msg);
877 _gModel->importOCCShape((void*)&_shape);
878 if (_compounds.size() > 0) CreateGmshCompounds();
879 MESSAGE("GModel::Mesh");
882 _gModel->mesh((_is2d)?2:3);
883 #ifdef WITH_SMESH_CANCEL_COMPUTE
887 catch (std::string& str)
895 MESSAGE("Unrecoverable error during Generation of Gmsh Mesh");
900 if (_compounds.size() > 0) _gModel->setCompoundVisibility();
905 MESSAGE("GMSHPlugin_Mesher::Compute:End");