From: eap Date: Thu, 11 Feb 2010 08:28:13 +0000 (+0000) Subject: 0020676: EDF 1212 GEOM: Partition operation creates vertices which causes mesh comput... X-Git-Tag: V5_1_4a1~18 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f8b902ad9a752c2376a903ae89fc6eecfd3ace22;p=plugins%2Fnetgenplugin.git 0020676: EDF 1212 GEOM: Partition operation creates vertices which causes mesh computation to fail with netgen * Fix for internal edges --- diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx index f2e9441..9942198 100644 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx @@ -209,6 +209,7 @@ static TError AddSegmentsToMesh(netgen::Mesh& ngMesh, int firstPointID = ngMesh.GetNP() + 1; int edgeID = 1, posID = -2; + bool isInternalEdge = false; for ( int i = 0; i < wire->NbSegments(); ++i ) // loop on segments { // Add the first point of a segment @@ -257,6 +258,7 @@ static TError AddSegmentsToMesh(netgen::Mesh& ngMesh, const TopoDS_Edge& edge = wire->Edge( wire->EdgeIndex( normParam )); edgeID = geom.emap.FindIndex( edge ); posID = posShapeID; + isInternalEdge = ( edge.Orientation() == TopAbs_INTERNAL ); if ( onVertex ) // param on curve is different on each of two edges seg.epgeominfo[ iEnd ].dist = helper.GetNodeU( edge, pnt.node ); } @@ -274,14 +276,41 @@ static TError AddSegmentsToMesh(netgen::Mesh& ngMesh, // << "\tp1 param: " << seg.epgeominfo[ 1 ].dist << endl // << "\tp1 uv: " << seg.epgeominfo[ 1 ].u <<", "<< seg.epgeominfo[ 1 ].v << endl // << "\tp1 edge: " << seg.epgeominfo[ 1 ].edgenr << endl; - } - Segment& seg = ngMesh.LineSegment( ngMesh.GetNSeg() ); + + if ( isInternalEdge ) + { #ifdef NETGEN_NEW - seg.pnums[1] = firstPointID; + swap (seg.pnums[0], seg.pnums[1]); #else - seg.p2 = firstPointID; + swap (seg.p1, seg.p2); #endif - } + swap( seg.epgeominfo[0], seg.epgeominfo[1] ); + seg.edgenr = ngMesh.GetNSeg() + 1; // segment id + ngMesh.AddSegment (seg); + } + } // loop on segments on a wire + + // close chain of segments + bool isClosedWire = ( wire->FirstVertex().IsSame( wire->LastVertex() )); + if ( isClosedWire ) + { + Segment& seg = ngMesh.LineSegment( ngMesh.GetNSeg() ); +#ifdef NETGEN_NEW + seg.pnums[1] = firstPointID; +#else + seg.p2 = firstPointID; +#endif + } + else // INTERNAL wire (Issue 0020676) + { + const SMDS_MeshNode * n = uvPtVec.back().node; + nodeVec.push_back( n ); + + MeshPoint mp( Point<3> (n->X(), n->Y(), n->Z()) ); + ngMesh.AddPoint ( mp, 1, EDGEPOINT ); + } + + } // loop on wires of a face ngMesh.CalcSurfacesOfNode();