]> SALOME platform Git repositories - plugins/gmshplugin.git/commitdiff
Salome HOME
Fixes compound mesh failur [spns 24411]
authorAfeef <afeef.badri@gmail.com>
Fri, 23 Jul 2021 13:37:06 +0000 (15:37 +0200)
committereap <eap@opencascade.com>
Fri, 17 Sep 2021 11:18:30 +0000 (14:18 +0300)
Since gmsh version 4.3 when compund meshing is involved Gmsh
produces extra discrete surfaces apart from the original topology
 Gmsh meshing procedure needs acess to each of the original topology
and the meshed topology.

Hence we bypass the additional DiscreteSurface mesh in case compound
meshing is involved. This bypass is needed during the GMSHPlugin_Mesher::FillSMesh()

src/GMSHPlugin/GMSHPlugin_Mesher.cxx

index 1b7984d2aa316fad931c255e9a00117ac9ac72b6..c9fc7bbea2f577a18d712d70e27695e232bdaa5b 100644 (file)
@@ -83,22 +83,21 @@ namespace
                           std::vector< ShapeBounds > & topoEdges )
   {
     topoEdges.clear();
-#if GMSH_MAJOR_VERSION >=4
-#if GMSH_MINOR_VERSION >=3
+#if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=3
     for ( size_t i = 0; i < gEdge->compound.size(); ++i )
     {
       GEdge* gE = static_cast< GEdge* >( gEdge->compound[ i ]);
       topoEdges.push_back( ShapeBounds{ gE->bounds(), *((TopoDS_Edge*)gE->getNativePtr()) });
     }
 #endif
-#if GMSH_MINOR_VERSION <3
+#if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION <3
     for ( size_t i = 0; i < gEdge->_compound.size(); ++i )
     {
       GEdge* gE = static_cast< GEdge* >( gEdge->_compound[ i ]);
       topoEdges.push_back( ShapeBounds{ gE->bounds(), *((TopoDS_Edge*)gE->getNativePtr()) });
     }
 #endif
-#else
+#if GMSH_MAJOR_VERSION <4
     if ( gEdge->geomType() == GEntity::CompoundCurve )
     {
       std::vector<GEdge*> gEdges = ((GEdgeCompound*)gEdge)->getCompounds();
@@ -122,22 +121,21 @@ namespace
                           std::vector< ShapeBounds > & topoFaces )
   {
     topoFaces.clear();
-#if GMSH_MAJOR_VERSION >=4
-#if GMSH_MINOR_VERSION >=3
+#if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=3
     for ( size_t i = 0; i < gFace->compound.size(); ++i )
     {
       GFace* gF = static_cast< GFace* >( gFace->compound[ i ]);
       topoFaces.push_back( ShapeBounds{ gF->bounds(), *((TopoDS_Face*)gF->getNativePtr()) });
     }
 #endif
-#if GMSH_MINOR_VERSION <3
+#if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION <3
     for ( size_t i = 0; i < gFace->_compound.size(); ++i )
     {
       GFace* gF = static_cast< GFace* >( gFace->_compound[ i ]);
       topoFaces.push_back( ShapeBounds{ gF->bounds(), *((TopoDS_Face*)gF->getNativePtr()) });
     }
 #endif
-#else
+#if GMSH_MAJOR_VERSION <4
     if ( gFace->geomType() == GEntity::CompoundSurface )
     {
       std::list<GFace*> gFaces = ((GFaceCompound*)gFace)->getCompounds();
@@ -464,10 +462,8 @@ void GMSHPlugin_Mesher::FillSMesh()
     // GET topoEdge CORRESPONDING TO gEdge
     TopoDS_Edge topoEdge;
     std::vector< ShapeBounds > topoEdges;
-#if GMSH_MAJOR_VERSION >=4
-#if GMSH_MINOR_VERSION >=3
+#if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=3
     if(gEdge->haveParametrization())
-#endif
 #else
     if ( gEdge->geomType() != GEntity::CompoundCurve )
 #endif
@@ -558,14 +554,22 @@ void GMSHPlugin_Mesher::FillSMesh()
   {
     GFace *gFace = *it;
 
+#if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=3
+    // Gmsh since version 4.3 is now producing extra surface and mesh when
+    // compounds are involved. Since in Gmsh meshing procedure needs acess
+    // to each of the original topology and the meshed topology. Hence  we
+    // bypass the additional mesh in case of compounds. Note, similar cri-
+    // teria also occus in the following 'for' loop.
+    if ( _compounds.size() && gFace->geomType() == GEntity::DiscreteSurface )
+      continue;
+#endif
+
     // GET topoFace CORRESPONDING TO gFace
     TopoDS_Face topoFace;
     std::vector< ShapeBounds > topoFaces;
 
-#if GMSH_MAJOR_VERSION >=4
-#if GMSH_MINOR_VERSION >=3
+#if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=3
     if(gFace->haveParametrization())
-#endif
 #else
     if ( gFace->geomType() != GEntity::CompoundSurface )
 #endif
@@ -601,13 +605,15 @@ void GMSHPlugin_Mesher::FillSMesh()
   {
     GFace *gFace = *it;
 
-#if GMSH_MAJOR_VERSION >=4
-#if GMSH_MINOR_VERSION >=3
+#if GMSH_MAJOR_VERSION >=4 && GMSH_MINOR_VERSION >=3
+    if ( _compounds.size() && gFace->geomType() == GEntity::DiscreteSurface )
+      continue;
+
     bool isCompound = (!gFace->haveParametrization());
-#endif
 #else
     bool isCompound = ( gFace->geomType() == GEntity::CompoundSurface );
 #endif
+
     if ( !isCompound && gFace->getVisibility() == 0 )
       continue;  // belongs to a compound