]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
31.01.2014. Clearning code.
authorszy <szy@opencascade.com>
Fri, 31 Jan 2014 06:35:38 +0000 (06:35 +0000)
committerszy <szy@opencascade.com>
Fri, 31 Jan 2014 06:35:38 +0000 (06:35 +0000)
src/HYDROData/HYDROData_SplitToZonesTool.cxx

index f251cc758b3defe905b107a8f07a9f53a90ab04e..95c514deac9b400f8e009767f5f2ae8f788db556 100644 (file)
@@ -117,7 +117,9 @@ HYDROData_SplitToZonesTool::SplitDataList
   // Preparation. 
   // Collect the object shapes to split. InputDataList will contain elements which will hold shape & name_of_shape.
   SplitDataList anInputSplitDataList;
-  //TCollection_AsciiString aNam("Faces_");
+#ifdef DEB_SPLIT_TO_ZONES
+  TCollection_AsciiString aNam("Faces_");
+#endif
   for( int anIndex = 1, aLength = theObjectList.Length(); anIndex <= aLength; anIndex++ )
   {
     Handle(HYDROData_Object) aGeomObj = 
@@ -128,9 +130,10 @@ HYDROData_SplitToZonesTool::SplitDataList
     TopoDS_Shape aShape = aGeomObj->GetTopShape();
     if ( aShape.IsNull() )
       continue;  
-   //TCollection_AsciiString aName = aNam + anIndex + ".brep";
-   //BRepTools::Write(aShape, aName.ToCString());
-
+#ifdef DEB_SPLIT_TO_ZONES
+   TCollection_AsciiString aName = aNam + anIndex + ".brep";
+   BRepTools::Write(aShape, aName.ToCString());
+#endif
     if ( aShape.ShapeType() == TopAbs_COMPOUND ) {
       // Create split data for each face contained in the compound
       TopExp_Explorer anExp( aShape, TopAbs_FACE );
@@ -201,6 +204,7 @@ HYDROData_SplitToZonesTool::SplitDataList
       aDM3.Bind(aSh, anInputGroupList.at(i).ObjectNames);
     }
   }
+
   // Step 1. Prepare Partition structures. 
   TopoDS_Shape aResult;
   BOPCol_ListOfShape aLS;  
@@ -247,8 +251,10 @@ HYDROData_SplitToZonesTool::SplitDataList
   // Step 3. Collect history  
   //HYDROData_DataMapOfShapeListOfShape aDM1;
   BOPCol_ListIteratorOfListOfShape anIt(aLS); 
+#ifdef DEB_SPLIT_TO_ZONES
   TCollection_AsciiString aNamM ("EdgM_");
   TCollection_AsciiString aNamG ("EdgG_");
+#endif
   for (int i =1;anIt.More();anIt.Next(),i++) {
        Standard_Boolean foundF(Standard_False);
     const TopTools_ListOfShape& aListOfNew = splitTool.Modified(anIt.Value());
@@ -257,16 +263,7 @@ HYDROData_SplitToZonesTool::SplitDataList
     TopTools_ListOfShape aList;
     TopTools_ListIteratorOfListOfShape it(aListOfNew);
     for(;it.More();it.Next())       
-      aList.Append(it.Value());
-    /*
-    // Bug in History: partition should give only modified entities! => temporary solution is used
-    const TopTools_ListOfShape& aListOfGen = splitTool.Generated(anIt.Value());
-       if(!aListOfGen.IsEmpty()) {
-         foundF = Standard_True;
-         it.Initialize(aListOfGen);    
-         for(;it.More();it.Next())     
-           aList.Append(it.Value());
-       }*/
+      aList.Append(it.Value());    
     if(!foundF) // face is not modified
          aList.Append (anIt.Value());
        aDM1.Bind(anIt.Value(), aList);
@@ -284,19 +281,11 @@ HYDROData_SplitToZonesTool::SplitDataList
                it.Initialize(aListM);    
                for(int k=1;it.More();it.Next(),k++) {    
              aList.Append(it.Value());
+#ifdef DEB_SPLIT_TO_ZONES
                  //aName = aNamM + i + j +k +".brep";
                  //BRepTools::Write(it.Value(),aName.ToCString());
+#endif
                }
-               /* const TopTools_ListOfShape& aListG = splitTool.Generated(exp.Current());
-               if(!aListG.IsEmpty()) {
-                 foundE = Standard_True;
-                 it.Initialize(aListG);    
-                 for(int k=1;it.More();it.Next(),k++)   {  
-               aList.Append(it.Value());
-                 //aName = aNamG + i + j +k +".brep";
-                 //BRepTools::Write(it.Value(),aName.ToCString());
-                 }
-               }*/
                //cout << "NB_EDGE = " << aList.Extent() <<endl;
                if(!foundE) {
                  aList.Append (exp.Current());
@@ -357,23 +346,27 @@ HYDROData_SplitToZonesTool::SplitDataList
                            //cout << "Modified: " << aListOfNew.Extent() <<endl;                                                       
                            if(!aListOfNew.IsEmpty()) {
                      aDM4.Bind(aFace, aListOfNew);
+#ifdef DEB_SPLIT_TO_ZONES
                              //TCollection_AsciiString aName = aNam + i + ".brep";
                                  //BRepTools::Write(aListOfNew.Last(), aName.ToCString());                             
+#endif
                                }
                                else {
-                             if(!mkCom.IsDeleted(aFace)) {
-                                       const TopTools_ListOfShape& aListOfGen = mkCom.Generated(aFace);        
-                                   if(!aListOfGen.IsEmpty()) {
-                         aDM4.Bind(aFace, aListOfGen);                        
-                                     //TCollection_AsciiString aName = aNam + i + "g.brep";
-                                     //BRepTools::Write(aListOfGen.Last(), aName.ToCString());
-                                       }
-                                        else {
+                                       if(!mkCom.IsDeleted(aFace)) {
+                                         const TopTools_ListOfShape& aListOfGen = mkCom.Generated(aFace);      
+                                     if(!aListOfGen.IsEmpty()) {
+                           aDM4.Bind(aFace, aListOfGen);       
+#ifdef DEB_SPLIT_TO_ZONES
+                                       //TCollection_AsciiString aName = aNam + i + "g.brep";
+                                       //BRepTools::Write(aListOfGen.Last(), aName.ToCString());
+#endif
+                                         }
+                                          else {
                                    TopTools_ListOfShape aList; 
                                        aList.Append(aFace);
                                        aDM4.Bind(aFace, aList); //the same face - not modified
-                                        }
-                                 }
+                                          }
+                                       }
                         }
                         TopExp_Explorer exp2 (aFace, TopAbs_EDGE);
                         for (int j =1;exp2.More();exp2.Next(),j++) {
@@ -403,7 +396,7 @@ HYDROData_SplitToZonesTool::SplitDataList
                    //cout << "DM4 Ext = " <<aDM4.Extent() <<endl;
                 // phase 2 (from tool)
 #ifdef DEB_SPLIT_TO_ZONES
-                TCollection_AsciiString aNam("BEd_");
+                TCollection_AsciiString aNam("BndEd_");
 #endif
          TopExp_Explorer expt (limFace, TopAbs_EDGE);
                 for(int i =1;expt.More();expt.Next(),i++) {
@@ -455,33 +448,31 @@ HYDROData_SplitToZonesTool::SplitDataList
                         }
                   }
                 } else {
-         HYDROData_DataMapIteratorOfDataMapOfShapeListOfShape aMIt(aDM1); 
-                //DM4 contains Old - New after common op. DM1: old - new after Split op.
-                for(;aMIt.More();aMIt.Next()) {
-           const TopoDS_Shape& aKey = aMIt.Key();
-           TopTools_ListOfShape aList;
-           aList.Append(aKey);
-           const TopTools_ListOfShape& aListOfNew = aMIt.Value();
-           TopTools_ListIteratorOfListOfShape it(aListOfNew);
-           for(;it.More();it.Next()) {// iterate new: b1, b2, b3...
-                        if(!aDM4.IsBound(it.Value())) // bi - is deleted
-               continue; // go to the next bi
-                        else {
-                               //cout <<"DM4_Key: TShape = " <<it.Value().TShape() <<endl;
-                               const TopTools_ListOfShape& aListOfNew4 = aDM4.Find(it.Value());
-                           TopTools_ListIteratorOfListOfShape it4(aListOfNew4); // {c1, c2, c3,...}
-                for(;it4.More();it4.Next()) {
-                                 //cout <<"DM4_Value: TShape = " <<it4.Value().TShape() <<endl;
-                                 if(!aDM2.IsBound(it4.Value()))
-                    aDM2.Bind(it4.Value(), aList);
-                             else {
-                    TopTools_ListOfShape& aList = aDM2.ChangeFind(it4.Value());
-                    aList.Prepend(aKey);
+           HYDROData_DataMapIteratorOfDataMapOfShapeListOfShape aMIt(aDM1); 
+                  //DM4 contains Old - New after common op. DM1: old - new after Split op.
+                  for(;aMIt.More();aMIt.Next()) {
+             const TopoDS_Shape& aKey = aMIt.Key();
+             TopTools_ListOfShape aList;
+             aList.Append(aKey);
+             const TopTools_ListOfShape& aListOfNew = aMIt.Value();
+             TopTools_ListIteratorOfListOfShape it(aListOfNew);
+             for(;it.More();it.Next()) {// iterate new: b1, b2, b3...
+                          if(!aDM4.IsBound(it.Value())) // bi - is deleted
+                 continue; // go to the next bi
+                          else {
+                                 const TopTools_ListOfShape& aListOfNew4 = aDM4.Find(it.Value());
+                             TopTools_ListIteratorOfListOfShape it4(aListOfNew4); // {c1, c2, c3,...}
+                  for(;it4.More();it4.Next()) {
+                                   if(!aDM2.IsBound(it4.Value()))
+                      aDM2.Bind(it4.Value(), aList);
+                               else {
+                      TopTools_ListOfShape& aList = aDM2.ChangeFind(it4.Value());
+                      aList.Prepend(aKey);
+                                       }
                                  }
-                               }
+                          }
                         }
                   }
-                }//###
                 }
                 } else {
                         hasLimits = Standard_False;
@@ -564,7 +555,7 @@ HYDROData_SplitToZonesTool::SplitDataList
        cout << "New# = " << i<< " Names = "<<aStr.toStdString() << " size = " <<aDestSplitData.ObjectNames.size() <<endl; 
 #endif
   }
+
   return anOutputSplitDataList;
 }