]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for issue 20091 : EDF 891 VISU Visu points Gauss on a group dsiplaysonly one...
authorrnv <rnv@opencascade.com>
Mon, 19 Jan 2009 13:21:05 +0000 (13:21 +0000)
committerrnv <rnv@opencascade.com>
Mon, 19 Jan 2009 13:21:05 +0000 (13:21 +0000)
src/CONVERTOR/VISU_GaussMergeFilter.cxx
src/CONVERTOR/VISU_MergeFilterUtilities.cxx
src/CONVERTOR/VISU_MergeFilterUtilities.hxx

index 8e1dd08ce7d4fbb556dea122e543eb679600c526..f1fc8d2760c73bcf874a0430fd1772e97c5cd509 100644 (file)
@@ -333,11 +333,13 @@ VISU_GaussMergeFilter
        VISU::GetIntersection(aDataCellIds,
                              aGeometryCellMapper,
                              anIntersection);
-       
-       vtkIdType aNbTuples = anIntersection.size();
-       
-       VISU::TObjectId2TupleIdMap aDataCellId2TupleIdMap;
-       VISU::GetObjectId2TupleIdMap(aDataCellIds, aDataCellId2TupleIdMap);
+
+        VISU::TObjectId2TupleGaussIdMap aDataCellId2TupleGaussIdMap;
+       VISU::GetObjectId2TupleGaussIdArray(aDataCellIds, aDataCellId2TupleGaussIdMap);
+
+        vtkIdType aNbTuples = 0;
+        for(vtkIdType i = 0;i < anIntersection.size();i++)
+          aNbTuples += aDataCellId2TupleGaussIdMap[anIntersection[i].first].size();
        
        vtkPointSet* aScalarsDataSet = dynamic_cast<vtkPointSet*>(GetScalars());
        vtkPoints* aDataPoints = aScalarsDataSet->GetPoints();
@@ -359,23 +361,27 @@ VISU_GaussMergeFilter
        
        vtkIdList *aCellIds = vtkIdList::New();
        vtkFloatingPointType aCoords[3];
-       for(int aTupleId=0;aTupleId<aNbTuples;aTupleId++){
+       for(int aTupleId=0, aNewTupleId=0; aTupleId<anIntersection.size(); aTupleId++){
          VISU::TObjectId& anObjectId = anIntersection[aTupleId];
+          VISU::TCellIdArray aCellIdArray = aDataCellId2TupleGaussIdMap[anObjectId.first];
+          
+          for(vtkIdType i = 0; i < aCellIdArray.size();i++) {
+            vtkIdType aCellId = aCellIdArray[i];
+            vtkCell *aCell = GetScalars()->GetCell(aCellId);
+            
+            aCellIds->Reset();
+            aCellIds->InsertNextId(aNewTupleId);
+            aNewTupleId++;
          
-         vtkIdType aCellId = aDataCellId2TupleIdMap[anObjectId];
-         vtkCell *aCell = GetScalars()->GetCell(aCellId);
-         
-         aCellIds->Reset();
-         aCellIds->InsertNextId(aTupleId);
-         
-         vtkIdType aCellType = GetScalars()->GetCellType(aCellId);
-         vtkIdType aNewCellId = theOutput->InsertNextCell(aCellType, aCellIds);
+            vtkIdType aCellType = GetScalars()->GetCellType(aCellId);
+            vtkIdType aNewCellId = theOutput->InsertNextCell(aCellType, aCellIds);
          
-         anOutputCellData->CopyData(anInputCellData, aCellId, aNewCellId);
-         anOutputPointData->CopyData(anInputPointData, aCellId, aNewCellId);
+            anOutputCellData->CopyData(anInputCellData, aCellId, aNewCellId);
+            anOutputPointData->CopyData(anInputPointData, aCellId, aNewCellId);
 
-         aDataPoints->GetPoint(aCellId, aCoords);
-         anOutputPoints->SetPoint(aNewCellId, aCoords);
+            aDataPoints->GetPoint(aCellId, aCoords);
+            anOutputPoints->SetPoint(aNewCellId, aCoords);
+          }
        }
       }
     }
index 5a30bed7e48ec7d793c360af7b51e4cd120bdfac..bd928c33b3dd410d5a3d6b8d701fa1ea09b4e602 100644 (file)
@@ -637,7 +637,29 @@ namespace VISU
     }
   }
 
-
+  //---------------------------------------------------------------
+  void 
+  GetObjectId2TupleGaussIdArray(vtkIntArray *theArray, 
+                                TObjectId2TupleGaussIdMap& theObjectId2TupleGaussIdMap)
+  {
+    theObjectId2TupleGaussIdMap.clear();
+    int* aPointer = theArray->GetPointer(0);
+    int aNbTuples = theArray->GetNumberOfTuples();
+    for(vtkIdType aTupleId = 0; aTupleId < aNbTuples; aTupleId++){
+      int aCellId = *aPointer;
+      TObjectId2TupleGaussIdMap::iterator it = theObjectId2TupleGaussIdMap.find(aCellId);
+      if(it == theObjectId2TupleGaussIdMap.end()){
+        TCellIdArray anIdArray;
+        anIdArray.push_back(aTupleId);
+        theObjectId2TupleGaussIdMap.insert(make_pair(aCellId,anIdArray));
+      }
+      else{
+        (*it).second.push_back(aTupleId);
+      }
+      aPointer += 2;
+    }
+  }
+  
   //---------------------------------------------------------------
   template<class TGetFieldData>
   vtkIntArray*
index decfb2db25c3894237217a3e4a77de134f5ecf38..775233c332a9b675a4951ab0cc2d252d808b2cd9 100644 (file)
@@ -52,6 +52,11 @@ namespace VISU
 
   typedef int TTupleId;
   typedef std::map<TObjectId, TTupleId> TObjectId2TupleIdMap;
+
+  typedef int TTupleCellID;
+  typedef int GeometryCellID;
+  typedef std::vector<TTupleCellID> TCellIdArray;
+  typedef std::map<GeometryCellID, TCellIdArray> TObjectId2TupleGaussIdMap;
   
   //---------------------------------------------------------------
   typedef vtkFieldData* (vtkDataSet::* TGetFieldData)();
@@ -80,6 +85,10 @@ namespace VISU
   void
   GetObjectId2TupleIdMap(vtkIntArray *theArray, 
                         TObjectId2TupleIdMap& theObjectId2TupleIdMap);
+
+  void
+  GetObjectId2TupleGaussIdArray(vtkIntArray *theArray,
+                                TObjectId2TupleGaussIdMap& theObjectId2TupleGaussIdMap);
   
   template<class TGetFieldData>
   vtkIntArray*