From: gdd Date: Thu, 7 Jun 2012 14:45:03 +0000 (+0000) Subject: Fix for compilation with gcc 4.7 X-Git-Tag: V6_main_20120622 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Ftags%2FV6_main_20120808;p=modules%2Fvisu.git Fix for compilation with gcc 4.7 --- diff --git a/src/CONVERTOR/VISU_MergeFilterUtilities.cxx b/src/CONVERTOR/VISU_MergeFilterUtilities.cxx index 7de19aef..30365206 100644 --- a/src/CONVERTOR/VISU_MergeFilterUtilities.cxx +++ b/src/CONVERTOR/VISU_MergeFilterUtilities.cxx @@ -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 - 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 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)();