From b40a1137aea4a313bafd1b01d6c66cf763bbf864 Mon Sep 17 00:00:00 2001 From: rnv Date: Tue, 13 Jan 2009 11:28:22 +0000 Subject: [PATCH] Improve ELNO data selection: issue 0020111: EDF VISU 917(Bad values are displayed for ELNO fields) in the 4X version. --- src/CONVERTOR/VISU_ConvertorUtils.cxx | 28 +++++++++++++++++++++++++++ src/CONVERTOR/VISU_ConvertorUtils.hxx | 11 +++++++++++ 2 files changed, 39 insertions(+) diff --git a/src/CONVERTOR/VISU_ConvertorUtils.cxx b/src/CONVERTOR/VISU_ConvertorUtils.cxx index 7bab47ae..06a9fa41 100644 --- a/src/CONVERTOR/VISU_ConvertorUtils.cxx +++ b/src/CONVERTOR/VISU_ConvertorUtils.cxx @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -431,6 +432,33 @@ namespace VISU return NULL; } + //--------------------------------------------------------------- + TElnoPoints + GetElnoPoints(vtkDataSet *theDataSet, vtkIdType theNodeObjID) + { + TElnoPoints aResult; + if(theDataSet && IsElnoData(theDataSet)) { + vtkDataSetAttributes *aDataSetAttributes = theDataSet->GetPointData(); + vtkDataArray *aDataArray = aDataSetAttributes->GetArray("VISU_POINTS_MAPPER"); + if(aDataArray){ + if(vtkIntArray *anIntArray = dynamic_cast(aDataArray)){ + int aNbTuples = anIntArray->GetNumberOfTuples(); + int* aPointer = anIntArray->GetPointer(0); + for(int aTupleId = 0; aTupleId < aNbTuples; aTupleId++){ + if( *aPointer == theNodeObjID ) { + vtkIdList *aCellIds = vtkIdList::New(); + theDataSet->GetPointCells(aTupleId,aCellIds); + if(aCellIds->GetNumberOfIds() == 1){ + aResult.push_back(TElnoPointID(aTupleId,aCellIds->GetId(0))); + } + } + aPointer += 2; + } + } + } + } + return aResult; + } //--------------------------------------------------------------- TTimerLog diff --git a/src/CONVERTOR/VISU_ConvertorUtils.hxx b/src/CONVERTOR/VISU_ConvertorUtils.hxx index 80a44887..f06f1d8d 100644 --- a/src/CONVERTOR/VISU_ConvertorUtils.hxx +++ b/src/CONVERTOR/VISU_ConvertorUtils.hxx @@ -162,6 +162,17 @@ namespace VISU vtkDataSet* GetOutput(vtkInformationVector *theOutputVector); + //! Utility for ELNO Data Selection + //--------------------------------------------------------------- + typedef vtkIdType TVTKPointID; + typedef vtkIdType TVTKCellID; + typedef std::pair TElnoPointID; + typedef std::vector TElnoPoints; + + VISU_CONVERTOR_EXPORT + TElnoPoints + GetElnoPoints(vtkDataSet *theDataSet, vtkIdType theNodeObjID); + //--------------------------------------------------------------- //! The utility class that allows to perform perfomance mesurement class VISU_CONVERTOR_EXPORT TTimerLog -- 2.39.2