From fbbc69047333c218be67d3b0a6aa7b764ac1f9b6 Mon Sep 17 00:00:00 2001 From: rnv Date: Mon, 19 Jan 2009 13:21:05 +0000 Subject: [PATCH] Fix for issue 20091 : EDF 891 VISU Visu points Gauss on a group dsiplaysonly one Gauss point by cell. --- src/CONVERTOR/VISU_GaussMergeFilter.cxx | 42 ++++++++++++--------- src/CONVERTOR/VISU_MergeFilterUtilities.cxx | 24 +++++++++++- src/CONVERTOR/VISU_MergeFilterUtilities.hxx | 9 +++++ 3 files changed, 56 insertions(+), 19 deletions(-) diff --git a/src/CONVERTOR/VISU_GaussMergeFilter.cxx b/src/CONVERTOR/VISU_GaussMergeFilter.cxx index 8e1dd08c..f1fc8d27 100644 --- a/src/CONVERTOR/VISU_GaussMergeFilter.cxx +++ b/src/CONVERTOR/VISU_GaussMergeFilter.cxx @@ -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(GetScalars()); vtkPoints* aDataPoints = aScalarsDataSet->GetPoints(); @@ -359,23 +361,27 @@ VISU_GaussMergeFilter vtkIdList *aCellIds = vtkIdList::New(); vtkFloatingPointType aCoords[3]; - for(int aTupleId=0;aTupleIdGetCell(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); + } } } } diff --git a/src/CONVERTOR/VISU_MergeFilterUtilities.cxx b/src/CONVERTOR/VISU_MergeFilterUtilities.cxx index 5a30bed7..bd928c33 100644 --- a/src/CONVERTOR/VISU_MergeFilterUtilities.cxx +++ b/src/CONVERTOR/VISU_MergeFilterUtilities.cxx @@ -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 vtkIntArray* diff --git a/src/CONVERTOR/VISU_MergeFilterUtilities.hxx b/src/CONVERTOR/VISU_MergeFilterUtilities.hxx index decfb2db..775233c3 100644 --- a/src/CONVERTOR/VISU_MergeFilterUtilities.hxx +++ b/src/CONVERTOR/VISU_MergeFilterUtilities.hxx @@ -52,6 +52,11 @@ namespace VISU typedef int TTupleId; typedef std::map TObjectId2TupleIdMap; + + typedef int TTupleCellID; + typedef int GeometryCellID; + typedef std::vector TCellIdArray; + typedef std::map TObjectId2TupleGaussIdMap; //--------------------------------------------------------------- typedef vtkFieldData* (vtkDataSet::* TGetFieldData)(); @@ -80,6 +85,10 @@ namespace VISU void GetObjectId2TupleIdMap(vtkIntArray *theArray, TObjectId2TupleIdMap& theObjectId2TupleIdMap); + + void + GetObjectId2TupleGaussIdArray(vtkIntArray *theArray, + TObjectId2TupleGaussIdMap& theObjectId2TupleGaussIdMap); template vtkIntArray* -- 2.39.2