Salome HOME
53057: NETGEN-1D2D3D issues "Ignored" warning for faces of a sub-mesh
authoreap <eap@opencascade.com>
Tue, 15 Mar 2016 13:02:21 +0000 (16:02 +0300)
committereap <eap@opencascade.com>
Tue, 15 Mar 2016 13:02:21 +0000 (16:02 +0300)
src/NETGENPlugin/NETGENPlugin_Mesher.cxx

index 9728a3c62964222427f0184a8edad695f560653f..eb8febfd751f7123dee24d1663b70b38301971dc 100644 (file)
@@ -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 <vector>
@@ -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" ));