Salome HOME
23416: [CEA 2033] Impossible to re-compute a mesh from an hdf
authoreap <eap@opencascade.com>
Wed, 1 Mar 2017 17:49:50 +0000 (20:49 +0300)
committereap <eap@opencascade.com>
Wed, 1 Mar 2017 17:49:50 +0000 (20:49 +0300)
  Optimize checking if an edge is inside a hyper-patch

src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx

index 0cb1a1be5e9713c98dc4e11008d3040021d5e7fb..47eb29e37a7fa16935b6b5d6f0dc74af5cca857f 100644 (file)
@@ -765,7 +765,7 @@ BLSURFPlugin_BLSURF::TListOfIDs _getSubShapeIDsInMainShape(SMESH_Mesh*      theM
   {
     int face_id = theMesh->GetMeshDS()->ShapeToIndex(face_iter.Current());
     if (face_id == 0)
-      throw SALOME_Exception ( SMESH_Comment("Sub_shape not found in main_shape"));
+      throw SALOME_Exception ( "Periodicity: sub_shape not found in main_shape");
     face_ids.push_back(face_id);
   }
 
@@ -1894,6 +1894,9 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh&         aMesh,
 
   TopTools_IndexedMapOfShape pmap, emap, fmap;
 
+  TopTools_IndexedDataMapOfShapeListOfShape e2ffmap;
+  TopExp::MapShapesAndAncestors( aShape, TopAbs_EDGE, TopAbs_FACE, e2ffmap );
+
   // Issue 0019864. On DebianSarge, FE signals do not obey to OSD::SetSignal(false)
 #ifndef WIN32
   feclearexcept( FE_ALL_EXCEPT );
@@ -2211,18 +2214,17 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh&         aMesh,
       bool isInHyperPatch = false;
       {
         std::set< int > faceTags;
-        PShapeIteratorPtr faceIf = helper.GetAncestors( e, aMesh, TopAbs_FACE );
-        while ( const TopoDS_Shape* face = faceIf->next() )
-          if ( helper.IsSubShape( *face, aShape ))
+        TopTools_ListIteratorOfListOfShape fIt( e2ffmap.FindFromKey( e ));
+        for ( ; fIt.More(); fIt.Next() )
+        {
+          int faceTag = meshDS->ShapeToIndex( fIt.Value() );
+          int hpTag   = BLSURFPlugin_Hypothesis::GetHyperPatchTag( faceTag, _hypothesis );
+          if ( !faceTags.insert( hpTag ).second )
           {
-            int faceTag = meshDS->ShapeToIndex( *face );
-            int hpTag   = BLSURFPlugin_Hypothesis::GetHyperPatchTag( faceTag, _hypothesis );
-            if ( !faceTags.insert( hpTag ).second )
-            {
-              isInHyperPatch = true;
-              break;
-            }
+            isInHyperPatch = true;
+            break;
           }
+        }
       }
       if ( !isInHyperPatch )
         cad_edge_set_tag(edg, ic);