From c6f5674a785db2c6dcb2fbc3a4077de156f1c3ac Mon Sep 17 00:00:00 2001 From: apo Date: Wed, 17 Jan 2007 08:15:22 +0000 Subject: [PATCH] To restore picking functionality for Gauss Points --- src/CONVERTOR/VISUConvertor.cxx | 41 +++++++++++++++----------- src/CONVERTOR/VISU_Convertor_impl.cxx | 5 ++-- src/CONVERTOR/VISU_Structures_impl.cxx | 12 ++------ src/CONVERTOR/VISU_Structures_impl.hxx | 6 ---- src/OBJECT/VISU_GaussPtsAct.cxx | 32 ++++++++++---------- src/PIPELINE/VISUPipeLine.cxx | 23 ++++++++++++--- 6 files changed, 61 insertions(+), 58 deletions(-) diff --git a/src/CONVERTOR/VISUConvertor.cxx b/src/CONVERTOR/VISUConvertor.cxx index 3a07760d..c9517fda 100644 --- a/src/CONVERTOR/VISUConvertor.cxx +++ b/src/CONVERTOR/VISUConvertor.cxx @@ -46,6 +46,7 @@ static int MYDEBUG = 1; static int MYDEBUG = 0; #endif +//#define _DEBUG_ID_MAPPING_ #define _DEXCEPT_ typedef vtkUnstructuredGrid TOutput; @@ -91,26 +92,32 @@ void parseFile(const char* theFileName) if(anEntity != VISU::NODE_ENTITY){ VISU::PGaussPtsIDMapper aGaussMesh = aCon->GetTimeStampOnGaussPts(aMeshName,anEntity,aFieldName,aTimeStamp); - /* - VISU::TVTKOutput* aDataSet = aGaussMesh->GetVTKOutput(); +#ifdef _DEBUG_ID_MAPPING_ + vtkDataSet* aDataSet = aGaussMesh->GetOutput(); + aDataSet->Update(); int aNbCells = aDataSet->GetNumberOfCells(); + cout<<"aNbCells = "<GetObjID(anCellId); - cout<GetNodeVTKID(anObjID.first)<GetNodeCoord(anCellId); + cout<GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp); - /* - VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput(); +#ifdef _DEBUG_ID_MAPPING_ + vtkDataSet* aDataSet = anIDMapper->GetOutput(); + aDataSet->Update(); int aNbCells = aDataSet->GetNumberOfCells(); for(int anCellId = 0; anCellId < aNbCells; anCellId++){ int anObjID = anIDMapper->GetElemObjID(anCellId); int aVTKID = anIDMapper->GetElemVTKID(anObjID); cout<first; VISU::PIDMapper anIDMapper = aCon->GetMeshOnEntity(aMeshName,anEntity); - { - /* - VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput(); - int aNbCells, anCellId, anObjID, aVTKID; - aNbCells = aDataSet->GetNumberOfCells(); - for(anCellId = 0; anCellId < aNbCells; anCellId++){ - anObjID = anIDMapper->GetElemObjID(anCellId); - aVTKID = anIDMapper->GetElemVTKID(anObjID); - cout<GetOutput(); + int aNbCells, anCellId, anObjID, aVTKID; + aNbCells = aDataSet->GetNumberOfCells(); + for(anCellId = 0; anCellId < aNbCells; anCellId++){ + anObjID = anIDMapper->GetElemObjID(anCellId); + aVTKID = anIDMapper->GetElemVTKID(anObjID); + cout<myGaussMesh; - VISU::TPolyDataHolder& aGaussPtsSource = aGaussMesh->mySource; - if(!aGaussPtsSource.myIsVTKDone){ + if(!aGaussMesh->myIsVTKDone){ BuildGaussMesh(aMesh, aVTKMeshOnEntity, aGaussMesh); aGaussMesh->myParent = aProfile.get(); - aGaussPtsSource.myIsVTKDone = true; + aGaussMesh->myIsVTKDone = true; } aGaussPtsIDFilter->myIDMapper = aGaussMesh; diff --git a/src/CONVERTOR/VISU_Structures_impl.cxx b/src/CONVERTOR/VISU_Structures_impl.cxx index 2a65b133..100bcf14 100644 --- a/src/CONVERTOR/VISU_Structures_impl.cxx +++ b/src/CONVERTOR/VISU_Structures_impl.cxx @@ -682,19 +682,12 @@ namespace VISU return aSubMeshImpl.GetObjID(anInputID,aStartId); } - + vtkPolyData* TGaussMeshImpl ::GetPolyDataOutput() { - return mySource.GetPolyDataOutput(); - } - - vtkDataSet* - TGaussMeshImpl - ::GetOutput() - { - return GetPolyDataOutput(); + return TAppendPolyDataHolder::GetPolyDataOutput(); } unsigned long int @@ -702,7 +695,6 @@ namespace VISU ::GetMemorySize() { size_t aSize = TAppendPolyDataHolder::GetMemorySize(); - aSize += mySource.GetMemorySize(); TGeom2GaussSubMesh::const_iterator anIter = myGeom2GaussSubMesh.begin(); TGeom2GaussSubMesh::const_iterator anIterEnd = myGeom2GaussSubMesh.end(); for(; anIter != anIterEnd; anIter++){ diff --git a/src/CONVERTOR/VISU_Structures_impl.hxx b/src/CONVERTOR/VISU_Structures_impl.hxx index dc2e7b9b..7783b66c 100644 --- a/src/CONVERTOR/VISU_Structures_impl.hxx +++ b/src/CONVERTOR/VISU_Structures_impl.hxx @@ -481,11 +481,6 @@ namespace VISU vtkPolyData* GetPolyDataOutput(); - //! Reimplement the TIDMapper::GetOutput - virtual - vtkDataSet* - GetOutput(); - //! Gets memory size used by the instance (bytes). virtual unsigned long int @@ -496,7 +491,6 @@ namespace VISU TNamedIDMapper* GetParent(); - TPolyDataHolder mySource; //!< Keeps VTK representation of the Gauss Points TNamedIDMapper* myParent; //!< Refer to parent mesh TGaussSubMeshArr myGaussSubMeshArr; //!< Keeps sequence of TGaussSubMesh as they were added into TAppendFilterHolder TGeom2GaussSubMesh myGeom2GaussSubMesh; //!< Keeps TGaussSubMesh according to their geometrical type diff --git a/src/OBJECT/VISU_GaussPtsAct.cxx b/src/OBJECT/VISU_GaussPtsAct.cxx index 4ad22030..dd2e4ab9 100644 --- a/src/OBJECT/VISU_GaussPtsAct.cxx +++ b/src/OBJECT/VISU_GaussPtsAct.cxx @@ -47,11 +47,8 @@ #include #include -#include #include - #include -#include #include #include @@ -714,8 +711,8 @@ VISU_GaussPtsAct if(anIsChanged){ vtkFloatingPointType* aNodeCoord = GetNodeCoord(anObjId); vtkDataSet* aDataSet = GetInput(); - vtkCellData* aCellData = aDataSet->GetCellData(); - if(vtkDataArray *aScalarArray = aCellData->GetScalars()){ + vtkPointData* aPointData = aDataSet->GetPointData(); + if(vtkDataArray *aScalarArray = aPointData->GetScalars()){ vtkFloatingPointType aPyramidHeight = myPickingSettings->GetPyramidHeight(); aPyramidHeight = aPyramidHeight*myGaussPointsPL->GetMaxPointSize(); //vtkFloatingPointType aColor[3] = myPreHighlightActor->GetProperty()->GetColor(); @@ -927,7 +924,7 @@ VISU_GaussPtsAct vtkFloatingPointType aWorldCoord[4] = {aNodeCoord[0], aNodeCoord[1], aNodeCoord[2], 1.}; // vtkDataSet* aDataSet = GetInput(); - vtkCellData* aDataSetAttributes = aDataSet->GetCellData(); + vtkPointData* aDataSetAttributes = aDataSet->GetPointData(); // if(vtkDataArray* aScalarArray = aDataSetAttributes->GetScalars()){ vtkFloatingPointType aVal = aScalarArray->GetTuple1(aVtkId); @@ -964,18 +961,19 @@ VISU_GaussPtsAct } if(vtkDataArray* aFieldArray = aDataSetAttributes->GetArray("VISU_FIELD")){ - if(vtkFloatArray *aFloatArray = dynamic_cast(aFieldArray)){ - int aNbComp = aFloatArray->GetNumberOfComponents(); - aStr<<"\nData: {"; - int anId = 0; - while(anId < aNbComp){ - vtkFloatingPointType aComp = aFloatArray->GetComponent(aVtkId,anId++); - aStr<GetNumberOfComponents(); + std::vector aTuple(aNbComp); + aFieldArray->GetTuple(aVtkId, &aTuple[0]); + + aStr<<"\nData: {"; + int anId = 0; + while(anId < aNbComp){ + vtkFloatingPointType aComp = aTuple[anId++]; + aStr< #include @@ -58,6 +58,7 @@ using namespace std; static int isOnlyMesh = false; +//#define _DEBUG_ID_MAPPING_ //---------------------------------------------------------------------------- template @@ -100,6 +101,20 @@ CreateColoredPL(VISU_Convertor* theConvertor, aPresent->Update(); +#ifdef _DEBUG_ID_MAPPING_ + vtkDataSet* aDataSet = aPresent->GetOutput(); + aDataSet->Update(); + int aNbCells = aDataSet->GetNumberOfCells(); + cout<<"aNbCells = "<GetNodeObjID(anCellId); + vtkIdType aVtkID = aPresent->GetNodeVTKID(anObjID); + cout<GetNodeCoord(anObjID); + cout<second; - ///* + /* if(aField->myNbComp == 1) continue; - //*/ + */ const string& aFieldName = aFieldMapIter->first; const VISU::TValField& aValField = aField->myValField; VISU::TValField::const_iterator aValFieldIter = aValField.begin(); @@ -195,7 +210,7 @@ main(int argc, char** argv) aFieldName, aTimeStamp); }else{ - //continue; + continue; aPresent = CreateColoredPL(aConvertor, aMeshName, anEntity, -- 2.39.2