From 8c00b47731370f619b0d277453f6d9a52703209d Mon Sep 17 00:00:00 2001 From: eap Date: Mon, 6 Jun 2022 14:44:04 +0300 Subject: [PATCH] Fix double nodes --- src/GMSHPlugin/GMSHPlugin_Mesher.cxx | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/GMSHPlugin/GMSHPlugin_Mesher.cxx b/src/GMSHPlugin/GMSHPlugin_Mesher.cxx index 3368163..0222b03 100644 --- a/src/GMSHPlugin/GMSHPlugin_Mesher.cxx +++ b/src/GMSHPlugin/GMSHPlugin_Mesher.cxx @@ -486,8 +486,14 @@ const SMDS_MeshNode* GMSHPlugin_Mesher::Node( const MVertex* v, bool checkMap ) SMESHDS_SubMesh* GMSHPlugin_Mesher::HasSubMesh( const TopoDS_Shape& s ) { - SMESHDS_SubMesh* sm = _mesh->GetMeshDS()->MeshElements( s ); - return ( sm && sm->NbElements() > 0 ) ? sm : nullptr; + if ( SMESHDS_SubMesh* sm = _mesh->GetMeshDS()->MeshElements( s )) + { + if ( s.ShapeType() == TopAbs_VERTEX ) + return ( sm->NbNodes() > 0 ) ? sm : nullptr; + else + return ( sm->NbElements() > 0 ) ? sm : nullptr; + } + return nullptr; } //================================================================================ @@ -514,6 +520,8 @@ void GMSHPlugin_Mesher::FillSMesh() sm->SetIsAlwaysComputed(true); // prevent from displaying errors continue; } + if ( HasSubMesh( topoVertex )) + continue; // a meshed sub-mesh // FILL SMESH FOR topoVertex //nodes @@ -673,6 +681,8 @@ void GMSHPlugin_Mesher::FillSMesh() sm->SetIsAlwaysComputed(true); // prevent from displaying errors continue; } + if ( HasSubMesh( topoFace )) + continue; // a meshed sub-mesh } bool isCompound = getBoundsOfShapes( gFace, topoFaces ); @@ -716,13 +726,16 @@ void GMSHPlugin_Mesher::FillSMesh() else topoFace = *((TopoDS_Face*)gFace->getNativePtr()); + if ( HasSubMesh( topoFace )) + continue; // a meshed sub-mesh + // check if there is a meshed sub-mesh on FACE boundary bool hasSubMesh = false; for ( TopExp_Explorer edgeIt( topoFace, TopAbs_EDGE ); edgeIt.More(); edgeIt.Next() ) { if (( hasSubMesh = HasSubMesh( edgeIt.Current() ))) break; - } + } //elements std::vector verts; -- 2.39.2