From: rnv Date: Tue, 13 Jan 2009 11:26:46 +0000 (+0000) Subject: Improve ELNO data selection: issue 0020111: EDF VISU 917(Bad values are displayed... X-Git-Tag: before_mergefrom_BR_V5_IMP_P8_22Jan09~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4b6e7b30df511e5bb72913607b5891cc6a8143e4;p=modules%2Fvisu.git Improve ELNO data selection: issue 0020111: EDF VISU 917(Bad values are displayed for ELNO fields) in the 5X version. --- diff --git a/src/CONVERTOR/VISU_ConvertorUtils.cxx b/src/CONVERTOR/VISU_ConvertorUtils.cxx index be843100..c3740649 100644 --- a/src/CONVERTOR/VISU_ConvertorUtils.cxx +++ b/src/CONVERTOR/VISU_ConvertorUtils.cxx @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -432,6 +433,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..b3a9ddf4 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