Salome HOME
Updated for NPAL19665.
authorskl <skl@opencascade.com>
Wed, 21 May 2008 06:31:42 +0000 (06:31 +0000)
committerskl <skl@opencascade.com>
Wed, 21 May 2008 06:31:42 +0000 (06:31 +0000)
src/StdMeshers/StdMeshers_ProjectionUtils.cxx

index 3b69a201f4612ce648f92389c883be8da7489828..90b677811023cdba8eaca00b99a0af5fe02895d0 100644 (file)
@@ -773,6 +773,59 @@ bool StdMeshers_ProjectionUtils::FindSubShapeAssociation(const TopoDS_Shape& the
     }
     break; // try by vertex closeness
   }
+  case TopAbs_COMPOUND: {
+    if ( IsPropagationPossible( theMesh1, theMesh2 )) {
+      // find boundary(for theShape1) edge
+      TopoDS_Edge E;
+      for(TopExp_Explorer exp(theShape1, TopAbs_EDGE); exp.More(); exp.Next() ) {
+        E = TopoDS::Edge( exp.Current() );
+        int NbFacesFromShape1 = 0;
+        const TopTools_ListOfShape& EAncestors = theMesh1->GetAncestors(E);
+        TopTools_ListIteratorOfListOfShape itea(EAncestors);
+        for(; itea.More(); itea.Next()) {
+          if( itea.Value().ShapeType() != TopAbs_FACE ) continue;
+          TopoDS_Face face = TopoDS::Face(itea.Value());
+          for(TopExp_Explorer expf(theShape1, TopAbs_FACE); expf.More(); expf.Next() ) {
+            if(face.IsSame(expf.Current())) {
+              NbFacesFromShape1++;
+              break;
+            }
+          }
+        }
+        if(NbFacesFromShape1==1) break;
+      }
+      // find association for vertices from edge E
+      for(TopExp_Explorer eexp(E, TopAbs_VERTEX); eexp.More(); eexp.Next()) {
+        TopoDS_Vertex V1 = TopoDS::Vertex( eexp.Current() );
+        const TopTools_ListOfShape& Ancestors = theMesh1->GetAncestors(V1);
+        TopTools_ListIteratorOfListOfShape ita(Ancestors);
+        for(; ita.More(); ita.Next()) {
+          if( ita.Value().ShapeType() != TopAbs_EDGE ) continue;
+          TopoDS_Edge edge = TopoDS::Edge(ita.Value());
+          bool FromShape1 = false;
+          for(TopExp_Explorer expe(theShape1, TopAbs_EDGE); expe.More(); expe.Next() ) {
+            if(edge.IsSame(expe.Current())) {
+              FromShape1 = true;
+              break;
+            }
+          }
+          if(!FromShape1) {
+            // it is an edge between theShape1 and theShape2
+            TopExp_Explorer expv(edge, TopAbs_VERTEX);
+            TopoDS_Vertex V2 = TopoDS::Vertex( expv.Current() );
+            if(V2.IsSame(V1)) {
+              expv.Next();
+              V2 = TopoDS::Vertex( expv.Current() );
+            }
+            InsertAssociation( V1, V2, theMap, bidirect);
+            break;
+          }
+        }
+      }
+      return FindSubShapeAssociation( theShape1, theMesh1, theShape2, theMesh2, theMap);
+    }
+    break; // try by vertex closeness
+  }
   default:;
   }