From 20b845d01124e38c001fd7a57e1f04a4471d88fd Mon Sep 17 00:00:00 2001 From: eap Date: Tue, 1 Nov 2011 10:25:17 +0000 Subject: [PATCH] 0021405: EDF 1965 SMESH: In fillNgMesh(), add a node on VERTEX only if a VERTEX is shared by a not meshed EDGE --- src/NETGENPlugin/NETGENPlugin_Mesher.cxx | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx index a7a1cb7..325b3c7 100644 --- a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx +++ b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx @@ -860,9 +860,23 @@ bool NETGENPlugin_Mesher::fillNgMesh(const netgen::OCCGeometry& occgeom, case TopAbs_VERTEX: { // VERTEX // -------------------------- - SMDS_NodeIteratorPtr nodeIt = smDS->GetNodes(); - if ( nodeIt->more() ) - ngNodeId( nodeIt->next(), ngMesh, nodeNgIdMap ); + // issue 21405. Add node only if a VERTEX is shared by a not meshed EDGE, + // else netgen removes a free node and nodeVector becomes invalid + PShapeIteratorPtr ansIt = helper.GetAncestors( sm->GetSubShape(), + *sm->GetFather(), + TopAbs_EDGE ); + bool toAdd = false; + while ( const TopoDS_Shape* e = ansIt->next() ) + { + SMESH_subMesh* eSub = helper.GetMesh()->GetSubMesh( *e ); + if (( toAdd = eSub->IsEmpty() )) break; + } + if ( toAdd ) + { + SMDS_NodeIteratorPtr nodeIt = smDS->GetNodes(); + if ( nodeIt->more() ) + ngNodeId( nodeIt->next(), ngMesh, nodeNgIdMap ); + } break; } default:; -- 2.39.2