]> SALOME platform Git repositories - modules/visu.git/blobdiff - src/CONVERTOR/VISU_MergeFilterUtilities.cxx
Salome HOME
Fix for compilation with gcc 4.7
[modules/visu.git] / src / CONVERTOR / VISU_MergeFilterUtilities.cxx
index 7de19aef81b6a605df4f665bbf4d8f8d22414902..3036520669bc3afb88a2b89480923194300517bd 100644 (file)
@@ -52,9 +52,99 @@ namespace
 
   using namespace VISU;
   
+  void CopyVectorsOnCells(vtkDataSet *theVectorsDataSet,
+                          vtkDataSet *theOutput)
+  {
+    vtkDataArray *anInputVectors = theVectorsDataSet->GetCellData()->GetVectors();
+    vtkDataArray *anOutputVectors = vtkDataArray::CreateDataArray(anInputVectors->GetDataType());
+    
+    //Clear output vector data
+    theOutput->GetCellData()->SetVectors(NULL);
+    
+    //Copy vectors data
+    vtkIntArray* anOutputIDMapper = GetIDMapper(theOutput,
+                                                TGetCellData(),
+                                                "VISU_CELLS_MAPPER");
+    
+    vtkIntArray* anInputIDMapper = GetIDMapper(theVectorsDataSet,
+                                               TGetCellData(),
+                                               "VISU_CELLS_MAPPER");
+    
+    TObjectIdArray anIntersection;
+    GetIntersection(anOutputIDMapper,
+                    anInputIDMapper,
+                    anIntersection);
+
+    vtkIdType aNbTuples = anIntersection.size();
+    anOutputVectors->SetNumberOfComponents(anInputVectors->GetNumberOfComponents());
+    anOutputVectors->SetNumberOfTuples(aNbTuples);
+    theOutput->GetCellData()->SetVectors(anOutputVectors);
+    anOutputVectors->Delete();
+    
+    TObjectId2TupleIdMap anOutputObjectId2TupleIdMap;
+    GetObjectId2TupleIdMap(anOutputIDMapper, anOutputObjectId2TupleIdMap);
+    
+    TObjectId2TupleIdMap anInputObjectId2TupleIdMap;
+    GetObjectId2TupleIdMap(anInputIDMapper, anInputObjectId2TupleIdMap);
+
+    for(vtkIdType iTupleId = 0; iTupleId < aNbTuples; iTupleId++ ){
+      TObjectId &anObjectId = anIntersection[iTupleId];
+      vtkIdType anOutputCellId  = anOutputObjectId2TupleIdMap[anObjectId];
+      vtkIdType anInputCellId = anInputObjectId2TupleIdMap[anObjectId];
+      anOutputVectors->SetTuple(anOutputCellId,anInputVectors->GetTuple(anInputCellId));
+    }
+  }
+  
+  void CopyVectorsOnPoints(vtkDataSet *theVectorsDataSet,
+                          vtkDataSet *theOutput)
+  {
+    vtkDataArray *anInputVectors = theVectorsDataSet->GetPointData()->GetVectors();
+    
+    //Clear output vector data
+    theOutput->GetPointData()->SetVectors(NULL);
+    
+    vtkDataArray *anOutputVectors = vtkDataArray::CreateDataArray(anInputVectors->GetDataType());
+    
+    //Copy vectors data
+    vtkIntArray* anOutputIDMapper = GetIDMapper(theOutput,
+                                                TGetPointData(),
+                                                "VISU_POINTS_MAPPER");
+    
+    vtkIntArray* anInputIDMapper = GetIDMapper(theVectorsDataSet,
+                                               TGetPointData(),
+                                               "VISU_POINTS_MAPPER");
+    TObjectIdArray anIntersection;
+
+    GetIntersection(anOutputIDMapper,
+                    anInputIDMapper,
+                    anIntersection);
+    
+    vtkIdType aNbTuples = anIntersection.size();  
+    anOutputVectors->SetNumberOfComponents(anInputVectors->GetNumberOfComponents());
+    anOutputVectors->SetNumberOfTuples(aNbTuples);
+    
+    
+
+    TObjectId2TupleIdMap anOutputObjectId2TupleIdMap;
+    GetObjectId2TupleIdMap(anOutputIDMapper, anOutputObjectId2TupleIdMap);
+    
+    TObjectId2TupleIdMap anInputObjectId2TupleIdMap;
+    GetObjectId2TupleIdMap(anInputIDMapper, anInputObjectId2TupleIdMap);
+    
+    for(vtkIdType iTupleId = 0; iTupleId < aNbTuples; iTupleId++ ){
+      TObjectId& anObjectId = anIntersection[iTupleId];
+      vtkIdType anOutputPointId  = anOutputObjectId2TupleIdMap[anObjectId];
+      vtkIdType anInputPointId = anInputObjectId2TupleIdMap[anObjectId];
+      anOutputVectors->SetTuple(anOutputPointId,anInputVectors->GetTuple(anInputPointId));
+    }
+    
+    theOutput->GetPointData()->SetVectors(anOutputVectors);
+    anOutputVectors->Delete();
+  }
+  
+  
   //---------------------------------------------------------------
   template<class TDataSet>
-  
   void 
   CopyDataOnCells(TDataSet *theInput,
                   vtkIntArray *theGeometryCellMapper,
@@ -125,49 +215,6 @@ namespace
     }
   }
   
-  void CopyVectorsOnCells(vtkDataSet *theVectorsDataSet,
-                          vtkDataSet *theOutput)
-  {
-    vtkDataArray *anInputVectors = theVectorsDataSet->GetCellData()->GetVectors();
-    vtkDataArray *anOutputVectors = vtkDataArray::CreateDataArray(anInputVectors->GetDataType());
-    
-    //Clear output vector data
-    theOutput->GetCellData()->SetVectors(NULL);
-    
-    //Copy vectors data
-    vtkIntArray* anOutputIDMapper = GetIDMapper(theOutput,
-                                                TGetCellData(),
-                                                "VISU_CELLS_MAPPER");
-    
-    vtkIntArray* anInputIDMapper = GetIDMapper(theVectorsDataSet,
-                                               TGetCellData(),
-                                               "VISU_CELLS_MAPPER");
-    
-    TObjectIdArray anIntersection;
-    GetIntersection(anOutputIDMapper,
-                    anInputIDMapper,
-                    anIntersection);
-
-    vtkIdType aNbTuples = anIntersection.size();
-    anOutputVectors->SetNumberOfComponents(anInputVectors->GetNumberOfComponents());
-    anOutputVectors->SetNumberOfTuples(aNbTuples);
-    theOutput->GetCellData()->SetVectors(anOutputVectors);
-    anOutputVectors->Delete();
-    
-    TObjectId2TupleIdMap anOutputObjectId2TupleIdMap;
-    GetObjectId2TupleIdMap(anOutputIDMapper, anOutputObjectId2TupleIdMap);
-    
-    TObjectId2TupleIdMap anInputObjectId2TupleIdMap;
-    GetObjectId2TupleIdMap(anInputIDMapper, anInputObjectId2TupleIdMap);
-
-    for(vtkIdType iTupleId = 0; iTupleId < aNbTuples; iTupleId++ ){
-      TObjectId &anObjectId = anIntersection[iTupleId];
-      vtkIdType anOutputCellId  = anOutputObjectId2TupleIdMap[anObjectId];
-      vtkIdType anInputCellId = anInputObjectId2TupleIdMap[anObjectId];
-      anOutputVectors->SetTuple(anOutputCellId,anInputVectors->GetTuple(anInputCellId));
-    }
-  }
-  
   //---------------------------------------------------------------
   template<class TDataSet>
   void 
@@ -360,54 +407,6 @@ namespace
       }
     }
   }
-  
-  void CopyVectorsOnPoints(vtkDataSet *theVectorsDataSet,
-                          vtkDataSet *theOutput)
-  {
-    vtkDataArray *anInputVectors = theVectorsDataSet->GetPointData()->GetVectors();
-    
-    //Clear output vector data
-    theOutput->GetPointData()->SetVectors(NULL);
-    
-    vtkDataArray *anOutputVectors = vtkDataArray::CreateDataArray(anInputVectors->GetDataType());
-    
-    //Copy vectors data
-    vtkIntArray* anOutputIDMapper = GetIDMapper(theOutput,
-                                                TGetPointData(),
-                                                "VISU_POINTS_MAPPER");
-    
-    vtkIntArray* anInputIDMapper = GetIDMapper(theVectorsDataSet,
-                                               TGetPointData(),
-                                               "VISU_POINTS_MAPPER");
-    TObjectIdArray anIntersection;
-
-    GetIntersection(anOutputIDMapper,
-                    anInputIDMapper,
-                    anIntersection);
-    
-    vtkIdType aNbTuples = anIntersection.size();  
-    anOutputVectors->SetNumberOfComponents(anInputVectors->GetNumberOfComponents());
-    anOutputVectors->SetNumberOfTuples(aNbTuples);
-    
-    
-
-    TObjectId2TupleIdMap anOutputObjectId2TupleIdMap;
-    GetObjectId2TupleIdMap(anOutputIDMapper, anOutputObjectId2TupleIdMap);
-    
-    TObjectId2TupleIdMap anInputObjectId2TupleIdMap;
-    GetObjectId2TupleIdMap(anInputIDMapper, anInputObjectId2TupleIdMap);
-    
-    for(vtkIdType iTupleId = 0; iTupleId < aNbTuples; iTupleId++ ){
-      TObjectId& anObjectId = anIntersection[iTupleId];
-      vtkIdType anOutputPointId  = anOutputObjectId2TupleIdMap[anObjectId];
-      vtkIdType anInputPointId = anInputObjectId2TupleIdMap[anObjectId];
-      anOutputVectors->SetTuple(anOutputPointId,anInputVectors->GetTuple(anInputPointId));
-    }
-    
-    theOutput->GetPointData()->SetVectors(anOutputVectors);
-    anOutputVectors->Delete();
-  }
-  
 
   //---------------------------------------------------------------
   typedef vtkDataArray* (vtkDataSetAttributes::* TGetAttribute)();