From: Afeef Date: Fri, 23 Jul 2021 13:37:06 +0000 (+0200) Subject: Fixes compound mesh failur [spns 24411] X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=617786330ca3fdc81b2b9ff8d75d3c9c2f5ecc6b;p=plugins%2Fgmshplugin.git Fixes compound mesh failur [spns 24411] 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() --- diff --git a/src/GMSHPlugin/GMSHPlugin_Mesher.cxx b/src/GMSHPlugin/GMSHPlugin_Mesher.cxx index 1b7984d..c9fc7bb 100644 --- a/src/GMSHPlugin/GMSHPlugin_Mesher.cxx +++ b/src/GMSHPlugin/GMSHPlugin_Mesher.cxx @@ -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 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 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