From: eap Date: Tue, 6 Oct 2015 11:36:06 +0000 (+0300) Subject: IPAL52905: NETGEN 1D-2D-3D creates sliver elements in case of finer sub-meshes X-Git-Tag: V7_7_0_WIN~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=28e133bb1f9f171b3365066d6cf74b8e3ca5bfb8;p=plugins%2Fnetgenplugin.git IPAL52905: NETGEN 1D-2D-3D creates sliver elements in case of finer sub-meshes --- diff --git a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx index 69100bd..cda4863 100644 --- a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx +++ b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx @@ -700,15 +700,22 @@ double NETGENPlugin_Mesher::GetDefaultMinSize(const TopoDS_Shape& geom, void NETGENPlugin_Mesher::RestrictLocalSize(netgen::Mesh& ngMesh, const gp_XYZ& p, - const double size, + double size, const bool overrideMinH) { if ( size <= std::numeric_limits::min() ) return; - if ( overrideMinH && netgen::mparam.minh > size ) + if ( netgen::mparam.minh > size ) { - ngMesh.SetMinimalH( size ); - netgen::mparam.minh = size; + if ( overrideMinH ) + { + ngMesh.SetMinimalH( size ); + netgen::mparam.minh = size; + } + else + { + size = netgen::mparam.minh; + } } netgen::Point3d pi(p.X(), p.Y(), p.Z()); ngMesh.RestrictLocalH( pi, size ); @@ -968,7 +975,7 @@ bool NETGENPlugin_Mesher::FillNgMesh(netgen::OCCGeometry& occgeom, netgen::Element2d tri(3); tri.SetIndex ( faceNgID ); - + SMESH_TNodeXYZ xyz[3]; #ifdef DUMP_TRIANGLES cout << "SMESH face " << helper.GetMeshDS()->ShapeToIndex( geomFace ) @@ -987,7 +994,7 @@ bool NETGENPlugin_Mesher::FillNgMesh(netgen::OCCGeometry& occgeom, if ( const TopoDS_Shape * solid = solidIt->next() ) sm = _mesh->GetSubMesh( *solid ); SMESH_ComputeErrorPtr& smError = sm->GetComputeError(); - smError.reset( new SMESH_ComputeError(COMPERR_BAD_INPUT_MESH,"Not triangle submesh")); + smError.reset( new SMESH_ComputeError(COMPERR_BAD_INPUT_MESH,"Not triangle sub-mesh")); smError->myBadElements.push_back( f ); return false; } @@ -995,14 +1002,17 @@ bool NETGENPlugin_Mesher::FillNgMesh(netgen::OCCGeometry& occgeom, for ( int i = 0; i < 3; ++i ) { const SMDS_MeshNode* node = f->GetNode( i ), * inFaceNode=0; + xyz[i].Set( node ); // get node UV on face int shapeID = node->getshapeId(); if ( helper.IsSeamShape( shapeID )) + { if ( helper.IsSeamShape( f->GetNodeWrap( i+1 )->getshapeId() )) inFaceNode = f->GetNodeWrap( i-1 ); else inFaceNode = f->GetNodeWrap( i+1 ); + } gp_XY uv = helper.GetNodeUV( geomFace, node, inFaceNode ); int ind = reverse ? 3-i : i+1; @@ -1011,6 +1021,13 @@ bool NETGENPlugin_Mesher::FillNgMesh(netgen::OCCGeometry& occgeom, tri.PNum (ind) = ngNodeId( node, ngMesh, nodeNgIdMap ); } + // pass a triangle size to NG size-map + double size = ( ( xyz[0] - xyz[1] ).Modulus() + + ( xyz[1] - xyz[2] ).Modulus() + + ( xyz[2] - xyz[0] ).Modulus() ) / 3; + gp_XYZ gc = ( xyz[0] + xyz[1] + xyz[2] ) / 3; + RestrictLocalSize( ngMesh, gc, size, /*overrideMinH=*/false ); + ngMesh.AddSurfaceElement (tri); #ifdef DUMP_TRIANGLES cout << tri << endl; diff --git a/src/NETGENPlugin/NETGENPlugin_Mesher.hxx b/src/NETGENPlugin/NETGENPlugin_Mesher.hxx index 52b2b74..a5ca8a1 100644 --- a/src/NETGENPlugin/NETGENPlugin_Mesher.hxx +++ b/src/NETGENPlugin/NETGENPlugin_Mesher.hxx @@ -135,7 +135,7 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Mesher static void RestrictLocalSize(netgen::Mesh& ngMesh, const gp_XYZ& p, - const double size, + double size, const bool overrideMinH=true); static int FillSMesh(const netgen::OCCGeometry& occgeom,