From 37cd0123d45370eb2fff3960302da328dcbddc53 Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 14 Mar 2014 19:41:30 +0400 Subject: [PATCH] For the case of SALOME_TESTS/Grids/smesh/3D_mesh_NETGEN_05/F6 1) Make "Fuse Nodes on Edges ..." be true by default 2) Set an error only to a SOLID on which bad elements lie. --- src/NETGENPlugin/NETGENPlugin_Hypothesis.cxx | 2 +- src/NETGENPlugin/NETGENPlugin_Mesher.cxx | 40 ++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/NETGENPlugin/NETGENPlugin_Hypothesis.cxx b/src/NETGENPlugin/NETGENPlugin_Hypothesis.cxx index a377d8e..5bef9fd 100644 --- a/src/NETGENPlugin/NETGENPlugin_Hypothesis.cxx +++ b/src/NETGENPlugin/NETGENPlugin_Hypothesis.cxx @@ -316,7 +316,7 @@ void NETGENPlugin_Hypothesis::SetFuseEdges(bool theVal) //============================================================================= bool NETGENPlugin_Hypothesis::GetDefaultFuseEdges() { - return false; + return true; // false; -- for SALOME_TESTS/Grids/smesh/3D_mesh_NETGEN_05/F6 } //============================================================================= diff --git a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx index 0bfc178..dddb8d2 100644 --- a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx +++ b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx @@ -2095,6 +2095,39 @@ namespace return str; } + //================================================================================ + /*! + * \brief Looks for triangles lying on a SOLID + */ + //================================================================================ + + bool hasBadElemOnSolid( const list& elems, + SMESH_subMesh* solidSM ) + { + TopTools_IndexedMapOfShape solidSubs; + TopExp::MapShapes( solidSM->GetSubShape(), solidSubs ); + SMESHDS_Mesh* mesh = solidSM->GetFather()->GetMeshDS(); + + list::const_iterator e = elems.begin(); + for ( ; e != elems.end(); ++e ) + { + const SMDS_MeshElement* elem = *e; + if ( elem->GetType() != SMDSAbs_Face ) + continue; + int nbNodesOnSolid = 0; + SMDS_NodeIteratorPtr nIt = elem->nodeIterator(); + while ( nIt->more() ) + { + const SMDS_MeshNode* n = nIt->next(); + const TopoDS_Shape& s = mesh->IndexToShape( n->getshapeId() ); + nbNodesOnSolid += ( !s.IsNull() && solidSubs.Contains( s )); + if ( nbNodesOnSolid > 2 ) + return true; + } + } + return false; + } + const double edgeMeshingTime = 0.001; const double faceMeshingTime = 0.019; const double edgeFaceMeshingTime = edgeMeshingTime + faceMeshingTime; @@ -2698,7 +2731,14 @@ bool NETGENPlugin_Mesher::Compute() { smError.reset( new SMESH_ComputeError( *error )); if ( nbVol && SMESH_Algo::GetMeshError( sm ) == SMESH_Algo::MEr_OK ) + { smError->myName = COMPERR_WARNING; + } + else if ( !smError->myBadElements.empty() ) // bad surface mesh + { + if ( !hasBadElemOnSolid( smError->myBadElements, sm )) + smError.reset(); + } } pb3D = pb3D || ( smError && smError->IsKO() ); } -- 2.39.2