From cb834de9a07a57a7ab4389712f7ca7a2e1c26cab Mon Sep 17 00:00:00 2001 From: eap Date: Tue, 15 Mar 2016 16:02:21 +0300 Subject: [PATCH] 53057: NETGEN-1D2D3D issues "Ignored" warning for faces of a sub-mesh --- src/NETGENPlugin/NETGENPlugin_Mesher.cxx | 26 +++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx index 9728a3c..eb8febf 100644 --- a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx +++ b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx @@ -83,6 +83,12 @@ namespace netgen { extern MeshingParameters mparam; extern volatile multithreadt multithread; extern bool merge_solids; + + // values used for occgeo.facemeshstatus + enum EFaceMeshStatus { FACE_NOT_TREATED = 0, + FACE_FAILED = -1, + FACE_MESHED_OK = 1, + }; } #include @@ -594,6 +600,8 @@ void NETGENPlugin_Mesher::PrepareOCCgeometry(netgen::OCCGeometry& occgeo, rootSM.push_back( mesh.GetSubMesh( it.Value() )); } + int totNbFaces = 0; + // add subshapes of empty submeshes list< SMESH_subMesh* >::iterator rootIt = rootSM.begin(), rootEnd = rootSM.end(); for ( ; rootIt != rootEnd; ++rootIt ) { @@ -605,8 +613,9 @@ void NETGENPlugin_Mesher::PrepareOCCgeometry(netgen::OCCGeometry& occgeo, TopExp::MapShapes(root->GetSubShape(), subShapes); while ( smIt->more() ) { - SMESH_subMesh* sm = smIt->next(); + SMESH_subMesh* sm = smIt->next(); TopoDS_Shape shape = sm->GetSubShape(); + totNbFaces += ( shape.ShapeType() == TopAbs_FACE ); if ( intern && intern->isShapeToPrecompute( shape )) continue; if ( !meshedSM || sm->IsEmpty() ) @@ -631,11 +640,11 @@ void NETGENPlugin_Mesher::PrepareOCCgeometry(netgen::OCCGeometry& occgeo, } } } - occgeo.facemeshstatus.SetSize (occgeo.fmap.Extent()); + occgeo.facemeshstatus.SetSize (totNbFaces); occgeo.facemeshstatus = 0; - occgeo.face_maxh_modified.SetSize(occgeo.fmap.Extent()); + occgeo.face_maxh_modified.SetSize(totNbFaces); occgeo.face_maxh_modified = 0; - occgeo.face_maxh.SetSize(occgeo.fmap.Extent()); + occgeo.face_maxh.SetSize(totNbFaces); occgeo.face_maxh = netgen::mparam.maxh; } @@ -951,8 +960,11 @@ bool NETGENPlugin_Mesher::FillNgMesh(netgen::OCCGeometry& occgeom, // if second oreder is required, even already meshed faces must be passed to NETGEN int fID = occgeom.fmap.Add( geomFace ); - while ( fID < faceNgID ) // geomFace is already in occgeom.fmap, add a copy + occgeom.facemeshstatus[ fID-1 ] = netgen::FACE_MESHED_OK; + while ( fID < faceNgID ) { // geomFace is already in occgeom.fmap, add a copy fID = occgeom.fmap.Add( BRepBuilderAPI_Copy( geomFace, /*copyGeom=*/false )); + occgeom.facemeshstatus[ fID-1 ] = netgen::FACE_MESHED_OK; + } // Problem with the second order in a quadrangular mesh remains. // 1) All quadrangles generated by NETGEN are moved to an inexistent face // by FillSMesh() (find "AddFaceDescriptor") @@ -2987,11 +2999,11 @@ bool NETGENPlugin_Mesher::Compute() bool pb2D = false, pb3D = false; for (int i = 1; i <= occgeo.fmap.Extent(); i++) { int status = occgeo.facemeshstatus[i-1]; - if (status == 1 ) continue; + if (status == netgen::FACE_MESHED_OK ) continue; if ( SMESH_subMesh* sm = _mesh->GetSubMeshContaining( occgeo.fmap( i ))) { SMESH_ComputeErrorPtr& smError = sm->GetComputeError(); if ( !smError || smError->IsOK() ) { - if ( status == -1 ) + if ( status == netgen::FACE_FAILED ) smError.reset( new SMESH_ComputeError( *error )); else smError.reset( new SMESH_ComputeError( COMPERR_ALGO_FAILED, "Ignored" )); -- 2.30.2