]> 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:26:11 +0000 (13:26 +0000)
committerrnv <rnv@opencascade.com>
Mon, 19 Jan 2009 13:26:11 +0000 (13:26 +0000)
src/CONVERTOR/VISU_GaussMergeFilter.cxx
src/CONVERTOR/VISU_MergeFilterUtilities.cxx
src/CONVERTOR/VISU_MergeFilterUtilities.hxx

index 928232ed2a433ef6f354a92105ccfdef3fdf5080..0d76105a685e36eb8e030a3d6a340c50a79dea6f 100644 (file)
@@ -334,11 +334,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();
@@ -360,23 +362,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 8461ed53cb2be582756e004efd55a5d6196714e7..13cec4eb311f0faeb07ba10992055085543ff7b6 100644 (file)
@@ -638,7 +638,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 3e35c56f0d66c46492b6a5353cd0349f309bf91a..52f74407724a9c4e444a46440f736b69e8c2bf44 100644 (file)
@@ -54,6 +54,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)();
@@ -82,6 +87,10 @@ namespace VISU
   void
   GetObjectId2TupleIdMap(vtkIntArray *theArray, 
                         TObjectId2TupleIdMap& theObjectId2TupleIdMap);
+
+  void
+  GetObjectId2TupleGaussIdArray(vtkIntArray *theArray,
+                                TObjectId2TupleGaussIdMap& theObjectId2TupleGaussIdMap);
   
   template<class TGetFieldData>
   vtkIntArray*