From 691300af8017e29850bc76c391f403674dda5504 Mon Sep 17 00:00:00 2001 From: enk Date: Fri, 20 Apr 2007 13:01:32 +0000 Subject: [PATCH] Fix for Bug NPAL14169: EDF VISU 256 : No continuum on a scalarmap On comment 2007-04-18 14:22 --- src/CONVERTOR/VISU_AppendFilter.cxx | 37 +- src/CONVERTOR/VISU_CommonCellsFilter.cxx | 119 +++-- src/CONVERTOR/VISU_ConvertorUtils.cxx | 22 +- src/CONVERTOR/VISU_ConvertorUtils.hxx | 2 +- src/CONVERTOR/VISU_Convertor_impl.cxx | 44 +- src/CONVERTOR/VISU_MergeFilter.cxx | 634 +++++++++++++---------- src/CONVERTOR/VISU_MergeFilter.hxx | 4 + src/OBJECT/VISU_Actor.cxx | 58 ++- 8 files changed, 575 insertions(+), 345 deletions(-) diff --git a/src/CONVERTOR/VISU_AppendFilter.cxx b/src/CONVERTOR/VISU_AppendFilter.cxx index b99e7d86..4814305d 100644 --- a/src/CONVERTOR/VISU_AppendFilter.cxx +++ b/src/CONVERTOR/VISU_AppendFilter.cxx @@ -43,6 +43,14 @@ #include #include +#ifdef _DEBUG_ +static int MYDEBUG = 0; +#else +static int MYDEBUG = 0; +#endif +// TTimerLog +#include "VISU_ConvertorUtils.hxx" + vtkCxxRevisionMacro(VISU_AppendFilter, "$Revision$"); vtkStandardNewMacro(VISU_AppendFilter); @@ -99,7 +107,8 @@ namespace typedef vtkIdType TInputId; typedef std::pair TInputCellId; - typedef vtkIdType TObjectId; + // + typedef std::pair TObjectId; typedef std::map TObject2InputIdMap; void @@ -109,14 +118,19 @@ namespace { if(vtkDataArray *aDataArray = theCellData->GetArray("VISU_CELLS_MAPPER")){ if(vtkIntArray *anIntArray = dynamic_cast(aDataArray)){ - int aMaxId = anIntArray->GetMaxId(); - int* aPointer = anIntArray->GetPointer(0); - int* anEndPointer = anIntArray->GetPointer(aMaxId + 1); - for(vtkIdType aCellId = 0; aPointer != anEndPointer; aPointer++, aCellId++){ - TObjectId anObjectId = *aPointer; + int aNbTuples = anIntArray->GetNumberOfTuples(); + int *aPtr = anIntArray->GetPointer(0); + for(vtkIdType aCellId = 0; aCellIdGetOutput(); + if(this->NumberOfInputs == 1){ + anOutput->ShallowCopy(this->Inputs[0]); + return; + } + + if(GetSharedPointsDataSet()){ vtkPoints* aPoints = GetSharedPointsDataSet()->GetPoints(); if(aPoints->GetNumberOfPoints() < 1) return; - vtkUnstructuredGrid *anOutput = this->GetOutput(); if(IsMergingInputs()){ TCellIdMerger aFunctor(this->NumberOfInputs); ForEachInput(this->Inputs, this->NumberOfInputs, aFunctor); diff --git a/src/CONVERTOR/VISU_CommonCellsFilter.cxx b/src/CONVERTOR/VISU_CommonCellsFilter.cxx index 6be2c3e2..2473ea64 100644 --- a/src/CONVERTOR/VISU_CommonCellsFilter.cxx +++ b/src/CONVERTOR/VISU_CommonCellsFilter.cxx @@ -4,6 +4,7 @@ // Copyright : Open CASCADE #include "VISU_CommonCellsFilter.hxx" +#include "VISU_ConvertorDef.hxx" // VTK product headers #include @@ -21,6 +22,7 @@ #include #include #include +#include #ifdef _DEBUG_ static int MYDEBUG = 0; @@ -33,18 +35,57 @@ static int MYDEBUG = 0; namespace { - typedef std::vector TSortedArray; + typedef std::pair TPair;// pair first - object id, second - entity + // + typedef std::vector TSortedArrayOne; + typedef std::set TSortedArrayPair; + typedef std::set TIdSet; typedef std::map TId2IdMap; inline void - GetSortedArray(vtkIntArray *theArray, - TSortedArray& theSortedArray) + GetSortedArrayAsPair(vtkIntArray *theArray, + TSortedArrayPair& theSortedArray) + { + TSortedArrayPair aSortedArray; + int nbComp = theArray->GetNumberOfComponents(); + if(nbComp == 2){ + int aMaxId = theArray->GetNumberOfTuples()*theArray->GetNumberOfComponents(); + int* aPointer = theArray->GetPointer(0); + int* anEndPointer = theArray->GetPointer(aMaxId + 1); + for(;aPointerGetNumberOfTuples(); + int* aPointer = theArray->GetPointer(0); + int* anEndPointer = theArray->GetPointer(aMaxId + 1); + for(;aPointerGetMaxId(); int* aPointer = theArray->GetPointer(0); int* anEndPointer = theArray->GetPointer(aMaxId + 1); - TSortedArray aSortedArray(aPointer, anEndPointer); + TSortedArrayOne aSortedArray(aPointer, anEndPointer); std::sort(aSortedArray.begin(), aSortedArray.end()); theSortedArray.swap(aSortedArray); } @@ -53,27 +94,37 @@ namespace void GetIdsForCopy(vtkUnstructuredGrid *inputUGrid, vtkIntArray* inputPointIds, - TSortedArray& outputSortedArray) + TSortedArrayOne& outputSortedArray) { - VISU::TTimerLog aTimerLog(MYDEBUG,"GetIdsForCopy"); if(inputUGrid){ - TSortedArray aSortedPointIds; - TSortedArray aOutputCellIds; - GetSortedArray(inputPointIds,aSortedPointIds); - + TSortedArrayOne aSortedPointIds; + TSortedArrayOne aOutputCellIds; + TIdSet aMapForSearch; + int nbTuples = inputPointIds->GetNumberOfTuples(); + int nbComp = inputPointIds->GetNumberOfComponents(); + int * aPtr = inputPointIds->GetPointer(0); + int * aPtrEnd = inputPointIds->GetPointer(nbTuples*nbComp+1); + if(nbComp == 1) + while(aPtrGetNumberOfCells(); - TSortedArray aPointCellIds; for(int idCell=0;idCellGetCell(idCell); vtkIdList* ptIds = aCell->GetPointIds(); int nbPointsInCell = ptIds->GetNumberOfIds(); bool aGoodCell = true; for(int i=0;iGetId(i); - TSortedArray::iterator aResult = find(aSortedPointIds.begin(),aSortedPointIds.end(),aSearchingId); - if(aResult == aSortedPointIds.end()){ + TIdSet::iterator aResult = aMapForSearch.find(aSearchingId); + if(aResult == aMapForSearch.end()){ aGoodCell = false; break; } @@ -93,11 +144,16 @@ namespace void CopyElementsToOutput(vtkUnstructuredGrid* theInputUG, int& theNbElements, - TSortedArray& theElementIdsForCopy, + TSortedArrayOne& theElementIdsForCopy, TId2IdMap& theOldId2NewIdPointsMap, - vtkIntArray* theOuputIDSArray, vtkUnstructuredGrid* theOutputUG) { + vtkIntArray* theOuputIDSArray = vtkIntArray::New(); + theOuputIDSArray->SetName("VISU_CELLS_MAPPER"); + theOuputIDSArray->SetNumberOfComponents(2); + theOuputIDSArray->SetNumberOfTuples(theNbElements); + int* aOuputIDSPtr = theOuputIDSArray->GetPointer(0); + vtkIntArray* aInputCellsMapper = dynamic_cast(theInputUG->GetCellData()->GetArray("VISU_CELLS_MAPPER")); int* aInputCellsMapperPointer = aInputCellsMapper->GetPointer(0); @@ -115,13 +171,18 @@ namespace const int aOldCellId = theElementIdsForCopy[aCellIndex]; theOutputUG->InsertNextCell(theInputUG->GetCellType(aOldCellId), aNewPointIds); - if(aInputCellsMapperPointer) - theOuputIDSArray->InsertNextValue(aInputCellsMapperPointer[aOldCellId]); - else - theOuputIDSArray->InsertNextValue(aOldCellId); + + *aOuputIDSPtr = aInputCellsMapperPointer[2*aOldCellId]; + aOuputIDSPtr++; + *aOuputIDSPtr = aInputCellsMapperPointer[2*aOldCellId+1]; + aOuputIDSPtr++; aNewPointIds->Delete(); } + + theOutputUG->GetCellData()->AddArray(theOuputIDSArray); + + theOuputIDSArray->Delete(); } } @@ -171,6 +232,7 @@ void VISU_CommonCellsFilter ::Execute() { + VISU::TTimerLog aTimerLog(MYDEBUG,"VISU_CommonCellsFilter::Execute"); vtkUnstructuredGrid* anInputProfileUG = this->GetProfileUG(); vtkUnstructuredGrid* anInputCellsUG = this->GetCellsUG(); @@ -206,9 +268,11 @@ VISU_CommonCellsFilter vtkIntArray* aPointIDS = dynamic_cast(aInputCellData->GetArray("VISU_CELLS_MAPPER")); if(aPointIDS){ + int* aPtr = aPointIDS->GetPointer(0); aPointIdsForCopy->SetNumberOfIds(aPointIDS->GetNumberOfTuples()); for(int i=0;iGetNumberOfTuples();i++){ - aPointIdsForCopy->SetId(i,aPointIDS->GetValue(i)); + aPointIdsForCopy->SetId(i,*aPtr); + aPtr++;aPtr++; } aOutputPointSet->SetNumberOfPoints(aPointIdsForCopy->GetNumberOfIds()); // aOutputPointSet copy points from anInputProfileUG to aOutputPointSet, which @@ -242,7 +306,7 @@ VISU_CommonCellsFilter // Calculate output cells int nbCells=0; - TSortedArray aCellIdsForCopy; + TSortedArrayOne aCellIdsForCopy; GetIdsForCopy(anInputCellsUG,aPointIDS,aCellIdsForCopy); nbCells = aCellIdsForCopy.size(); @@ -250,22 +314,15 @@ VISU_CommonCellsFilter // copy cells to output int aAllocMem = nbCells; anOutput->Allocate(aAllocMem); - vtkIntArray* theOuputIDSArray = vtkIntArray::New(); - theOuputIDSArray->SetName("VISU_CELLS_MAPPER"); - theOuputIDSArray->SetNumberOfComponents(1); - theOuputIDSArray->SetNumberOfTuples(aAllocMem); - + if(nbCells>0 && anInputCellsUG) CopyElementsToOutput(anInputCellsUG, nbCells, aCellIdsForCopy, aOldId2NewIdPointsMap, - theOuputIDSArray, anOutput); - anOutput->GetCellData()->AddArray(theOuputIDSArray); - - theOuputIDSArray->Delete(); + aPointIdsForCopy->Delete(); } } diff --git a/src/CONVERTOR/VISU_ConvertorUtils.cxx b/src/CONVERTOR/VISU_ConvertorUtils.cxx index d1334e02..7839fab8 100644 --- a/src/CONVERTOR/VISU_ConvertorUtils.cxx +++ b/src/CONVERTOR/VISU_ConvertorUtils.cxx @@ -83,17 +83,26 @@ namespace VISU //--------------------------------------------------------------- vtkIdType - GetElemVTKID(vtkDataSet *theDataSet, vtkIdType theID) + GetElemVTKID(vtkDataSet *theDataSet, vtkIdType theID, int theEntity) { theDataSet->Update(); vtkDataSetAttributes *aDataSetAttributes = theDataSet->GetCellData(); if(vtkDataArray *aDataArray = aDataSetAttributes->GetArray("VISU_CELLS_MAPPER")){ if(vtkIntArray *anIntArray = dynamic_cast(aDataArray)){ - int aMaxId = anIntArray->GetMaxId(); + int nbTuples = anIntArray->GetNumberOfTuples(); + int aMaxId = nbTuples * anIntArray->GetNumberOfComponents(); int* aPointer = anIntArray->GetPointer(0); - int* anEndPointer = anIntArray->GetPointer(aMaxId + 1); - int* aPtr = std::find(aPointer, anEndPointer, theID); - return aPtr - aPointer; + for(int i=0;iGetCellData(); if(vtkDataArray *aDataArray = aDataSetAttributes->GetArray("VISU_CELLS_MAPPER")){ if(vtkIntArray *anIntArray = dynamic_cast(aDataArray)){ - return anIntArray->GetValue(theID); + int nbComp = anIntArray->GetNumberOfComponents(); + return *anIntArray->GetPointer(theID*nbComp); } } return -1; diff --git a/src/CONVERTOR/VISU_ConvertorUtils.hxx b/src/CONVERTOR/VISU_ConvertorUtils.hxx index 6c952733..f70b69f5 100644 --- a/src/CONVERTOR/VISU_ConvertorUtils.hxx +++ b/src/CONVERTOR/VISU_ConvertorUtils.hxx @@ -56,7 +56,7 @@ namespace VISU IsDataOnPoints(vtkDataSet* theDataSet); vtkIdType - GetElemVTKID(vtkDataSet *theDataSet, vtkIdType theID); + GetElemVTKID(vtkDataSet *theDataSet, vtkIdType theID, int theEntity); vtkIdType GetElemObjID(vtkDataSet *theDataSet, vtkIdType theID); diff --git a/src/CONVERTOR/VISU_Convertor_impl.cxx b/src/CONVERTOR/VISU_Convertor_impl.cxx index 1a91c358..fa801675 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.cxx +++ b/src/CONVERTOR/VISU_Convertor_impl.cxx @@ -657,7 +657,7 @@ namespace VISU ::GetElemVTKID(vtkIdType theID) const { VISU::TVTKOutput* anOutput = GetFilter()->GetOutput(); - return VISU::GetElemVTKID(anOutput, theID); + return VISU::GetElemVTKID(anOutput, theID, (int)myEntity); } vtkIdType @@ -1284,16 +1284,22 @@ namespace int aNbTuples = aNbCells; vtkIntArray *aDataArray = vtkIntArray::New(); aDataArray->SetName("VISU_CELLS_MAPPER"); - aDataArray->SetNumberOfComponents(1); + // the [0] component is element object ID + // the [1] component is entity type + aDataArray->SetNumberOfComponents(2); aDataArray->SetNumberOfTuples(aNbTuples); + int *aPtr = aDataArray->GetPointer(0); for(int aTupleId = 0; aTupleId < aNbTuples; aTupleId++){ int anObjID = theSubMesh->GetElemObjID(aTupleId); - aDataArray->SetValue(aTupleId, anObjID); + *aPtr = anObjID; + aPtr++; + *aPtr = (int)theMeshOnEntity->myEntity; + aPtr++; } theSource->GetCellData()->AddArray(aDataArray); + aDataArray->Delete(); } - vtkIdType *pts = 0, npts = 0; VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New(); aCellLocationsArray->SetNumberOfComponents(1); @@ -1332,10 +1338,14 @@ namespace aMeshID.resize(aNbCells); vtkIntArray *aDataArray = vtkIntArray::New(); + aDataArray->SetName("VISU_CELLS_MAPPER"); - aDataArray->SetNumberOfComponents(1); + // the [0] component is element object ID + // the [1] component is entity type + aDataArray->SetNumberOfComponents(2); aDataArray->SetNumberOfTuples(aNbCells); - + int *aPtr = aDataArray->GetPointer(0); + VISU::TID2ID& anElemObj2VTKID = theFamily->myElemObj2VTKID; const VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh; @@ -1343,7 +1353,7 @@ namespace for(vtkIdType aCellId = 0; anIter != aGeom2SubMesh.end(); anIter++){ VISU::EGeometry aEGeom = anIter->first; vtkIdType aVGeom = VISUGeom2VTK(aEGeom); - + const VISU::TSubMeshImpl& aSubMesh = anIter->second; const VISU::TCell2Connect& anArray = aSubMesh.myCell2Connect; @@ -1369,12 +1379,14 @@ namespace PrintCells(aCellId, aConnectivity, anArray[anID]); aCellTypesArray->SetValue(aCellId, (unsigned char)aVGeom); vtkIdType anObjID = aSubMesh.GetElemObjID(anID); - aDataArray->SetValue(aCellId, anObjID); + *aPtr = anObjID; + aPtr++; + *aPtr = (int)theMeshOnEntity->myEntity; + aPtr++; anElemObj2VTKID[anObjID] = aCellId; aMeshID[aCellId] = anObjID; } } - theSource->GetCellData()->AddArray(aDataArray); aDataArray->Delete(); @@ -1501,7 +1513,7 @@ namespace VISU::EGeometry aEGeom = theSubProfile->myGeom; vtkIdType aNbNodes = VISUGeom2NbNodes(aEGeom); vtkIdType aVGeom = VISUGeom2VTK(aEGeom); - + INITMSG(MYDEBUG,"GetCells - aVGeom = "<mySubMeshID; @@ -1555,16 +1567,22 @@ namespace int aNbTuples = aNbCells; vtkIntArray *aDataArray = vtkIntArray::New(); aDataArray->SetName("VISU_CELLS_MAPPER"); - aDataArray->SetNumberOfComponents(1); + // the [0] component is element object ID + // the [1] component is entity type + aDataArray->SetNumberOfComponents(2); aDataArray->SetNumberOfTuples(aNbTuples); + int *aPtr = aDataArray->GetPointer(0); + for(int aTupleId = 0; aTupleId < aNbTuples; aTupleId++){ int anObjID = theSubProfile->GetElemObjID(aTupleId); - aDataArray->SetValue(aTupleId, anObjID); + *aPtr = anObjID; + aPtr++; + *aPtr = (int)theMeshOnEntity->myEntity; + aPtr++; } theSource->GetCellData()->AddArray(aDataArray); aDataArray->Delete(); } - aCellLocationsArray->Delete(); aCellTypesArray->Delete(); aConnectivity->Delete(); diff --git a/src/CONVERTOR/VISU_MergeFilter.cxx b/src/CONVERTOR/VISU_MergeFilter.cxx index 138db504..2b841cf1 100644 --- a/src/CONVERTOR/VISU_MergeFilter.cxx +++ b/src/CONVERTOR/VISU_MergeFilter.cxx @@ -43,6 +43,15 @@ #include #include #include +#include + +#ifdef _DEBUG_ +static int MYDEBUG = 0; +#else +static int MYDEBUG = 0; +#endif +// TTimerLog +#include "VISU_ConvertorUtils.hxx" namespace VISU { @@ -263,6 +272,7 @@ namespace } typedef std::map TId2IdMap; + typedef std::set TIdSet; template void DeepCopySwitchOnOutput(TNumericType *theInputPtr, @@ -502,21 +512,33 @@ namespace if(inputUGrid){ TSortedArray aSortedPointIds; TSortedArray aOutputCellIds; - GetSortedArray(inputPointIds,aSortedPointIds); - + + TIdSet aMapForSearch; + int nbTuples = inputPointIds->GetNumberOfTuples(); + int nbComp = inputPointIds->GetNumberOfComponents(); + int * aPtr = inputPointIds->GetPointer(0); + int * aPtrEnd = inputPointIds->GetPointer(nbTuples*nbComp+1); + if(nbComp == 1) + while(aPtrGetNumberOfCells(); - TSortedArray aPointCellIds; for(int idCell=0;idCellGetCell(idCell); vtkIdList* ptIds = aCell->GetPointIds(); int nbPointsInCell = ptIds->GetNumberOfIds(); bool aGoodCell = true; for(int i=0;iGetId(i); - TSortedArray::iterator aResult = find(aSortedPointIds.begin(),aSortedPointIds.end(),aSearchingId); - if(aResult == aSortedPointIds.end()){ + TIdSet::iterator aResult = aMapForSearch.find(aSearchingId); + if(aResult == aMapForSearch.end()){ aGoodCell = false; break; } @@ -525,6 +547,7 @@ namespace aOutputCellIds.push_back(idCell); else continue; + } outputSortedArray.swap(aOutputCellIds); @@ -537,9 +560,16 @@ namespace int& theNbElements, TSortedArray& theElementIdsForCopy, TId2IdMap& theOldId2NewIdPointsMap, - vtkIntArray* theOuputIDSArray, vtkUnstructuredGrid* theOutputUG) { + vtkIntArray* theOuputIDSArray = vtkIntArray::New(); + theOuputIDSArray->SetName("VISU_CELLS_MAPPER"); + // the [0] component is element object ID + // the [1] component is entity type + theOuputIDSArray->SetNumberOfComponents(2); + theOuputIDSArray->SetNumberOfTuples(theNbElements); + int* aOuputIDSPtr = theOuputIDSArray->GetPointer(0); + vtkIntArray* aInputCellsMapper = dynamic_cast(theInputUG->GetCellData()->GetArray("VISU_CELLS_MAPPER")); @@ -559,17 +589,333 @@ namespace const int aOldCellId = theElementIdsForCopy[aCellIndex]; theOutputUG->InsertNextCell(theInputUG->GetCellType(aOldCellId), aNewPointIds); - if(aInputCellsMapperPointer) - theOuputIDSArray->InsertNextValue(aInputCellsMapperPointer[aOldCellId]); - else - theOuputIDSArray->InsertNextValue(aOldCellId); + + *aOuputIDSPtr = aInputCellsMapperPointer[2*aOldCellId]; + aOuputIDSPtr++; + *aOuputIDSPtr = aInputCellsMapperPointer[2*aOldCellId+1]; + aOuputIDSPtr++; aNewPointIds->Delete(); } theOutputUG->GetCellData()->AddArray(theOuputIDSArray); + theOuputIDSArray->Delete(); + } + + +} + +bool +VISU_MergeFilter +::MergeGeometryCellsAndDataOnCells() +{ + if(MYDEBUG) cout << "MergeGeometryCellsAndDataOnCells" << endl; + vtkUnstructuredGrid *anInput = this->GetInput(); + vtkUnstructuredGrid *anOutput = this->GetOutput(); + vtkCellData *aCellData = anInput->GetCellData(); + vtkDataArray *aCellMapper = aCellData->GetArray("VISU_CELLS_MAPPER"); // 1 + vtkIntArray *aGeometryCellMapper = dynamic_cast(aCellMapper); // 1->2 + + // The situation for merging CELLS from anInput as Geometry + // and scalars on cell data + vtkIntArray* aDataCellMapper = NULL; + VISU::TFieldListIterator anIter(this->FieldList); + for(anIter.Begin(); !anIter.End() ; anIter.Next()){ + vtkCellData *aCellData = anIter.Get()->Ptr->GetCellData(); + const char* aFieldName = anIter.Get()->GetName(); + if(strcmp(aFieldName, "VISU_CELLS_MAPPER") == 0){ + vtkDataArray *aCellMapper_tmp = aCellData->GetArray(aFieldName); + aDataCellMapper = dynamic_cast(aCellMapper_tmp); + break; + } + } + + bool anIsDifferent = aDataCellMapper && + aDataCellMapper->GetNumberOfTuples() != aGeometryCellMapper->GetNumberOfTuples(); + + if(anIsDifferent || IsMergingInputs() ){ + TSortedArray aGeometryCellArray; + GetSortedArray(aGeometryCellMapper, aGeometryCellArray); + + TSortedArray aDataCellArray; + GetSortedArray(aDataCellMapper, aDataCellArray); + + int aMaxLength = std::max(aGeometryCellArray.size(), aDataCellArray.size()); + TSortedArray anIntersectionArray(aMaxLength); + TSortedArray::iterator anArrayIter = anIntersectionArray.begin(); + anArrayIter = std::set_intersection(aGeometryCellArray.begin(), + aGeometryCellArray.end(), + aDataCellArray.begin(), + aDataCellArray.end(), + anArrayIter); + + anIntersectionArray.erase(anArrayIter, anIntersectionArray.end()); + + bool anIsCompletelyCoincide = + anIntersectionArray.size() == aGeometryCellArray.size() && + anIntersectionArray.size() == aDataCellArray.size(); + + if(!anIsCompletelyCoincide || IsMergingInputs()){ + { + TId2IdMap anObj2VTKGeometryMap; + vtkIdType aNbCells = aGeometryCellMapper->GetNumberOfTuples(); + for(int aCellId = 0; aCellId < aNbCells; aCellId++){ + vtkIdType anObjID = aGeometryCellMapper->GetValue(aCellId); + anObj2VTKGeometryMap[anObjID] = aCellId; + } + + vtkIdType aNbTuples = anIntersectionArray.size(); + anOutput->Allocate(aNbTuples); + vtkIdList *aCellIds = vtkIdList::New(); + for(int aTupleId = 0; aTupleId < aNbTuples; aTupleId++){ + vtkIdType anObjID = anIntersectionArray[aTupleId]; + vtkIdType aCellId = anObj2VTKGeometryMap[anObjID]; + vtkCell *aCell = anInput->GetCell(aCellId); + aCellIds->Reset(); + vtkIdType aNbPointIds = aCell->PointIds->GetNumberOfIds(); + for(vtkIdType aPointId = 0; aPointId < aNbPointIds; aPointId++) + aCellIds->InsertNextId(aCell->GetPointIds()->GetId(aPointId)); + anOutput->InsertNextCell(anInput->GetCellType(aCellId), aCellIds); + } + aCellIds->Delete(); + anOutput->SetPoints(anInput->GetPoints()); + } + { + TId2IdMap anObj2VTKDataMap; + vtkIdType aNbCells = aDataCellMapper->GetNumberOfTuples(); + for(int aCellId = 0; aCellId < aNbCells; aCellId++){ + vtkIdType anObjID = aDataCellMapper->GetValue(aCellId); + anObj2VTKDataMap[anObjID] = aCellId; + } + + DeepCopyDataSetAttributes(this, + anOutput, + this->FieldList, + anIntersectionArray, + anObj2VTKDataMap); + } + return true; + } } + return false; +} + +bool +VISU_MergeFilter +::MergeGeometryCellsAndDataOnAllPoints() +{ + if(MYDEBUG) cout << "MergeGeometryCellsAndDataOnAllPoints" << endl; + // The situation for merging CELLS from anInput as Geometry + // and scalars on point data + vtkUnstructuredGrid *anInput = this->GetInput(); + vtkUnstructuredGrid *anOutput = this->GetOutput(); + + vtkPointData *aPointData = anInput->GetPointData(); + vtkCellData *aCellData = anInput->GetCellData(); + vtkDataSet* aInputScalars = this->GetScalars(); + vtkPointData* aInputScalarsPointData = aInputScalars->GetPointData(); + vtkDataArray *aPointMapper = aPointData->GetArray("VISU_POINTS_MAPPER"); + vtkIntArray *aGeometryPointMapper = dynamic_cast(aPointMapper); + vtkDataArray *aCellMapper = aCellData->GetArray("VISU_CELLS_MAPPER"); // 1 + vtkIntArray *aGeometryCellMapper = dynamic_cast(aCellMapper); // 1->2 + vtkIntArray* aDataPointMapper = NULL; + VISU::TFieldListIterator anIter(this->FieldList); + for(anIter.Begin(); !anIter.End() ; anIter.Next()){ + const char* aFieldName = anIter.Get()->GetName(); + if(strcmp(aFieldName, "VISU_POINTS_MAPPER") == 0){ + vtkDataArray *aPointMapper = aInputScalarsPointData->GetArray(aFieldName); + aDataPointMapper = dynamic_cast(aPointMapper); + break; + } + } + if(aDataPointMapper){ + TSortedArray aGeometryPointArray; + GetSortedArray(aGeometryPointMapper, aGeometryPointArray); + + TSortedArray aDataPointArray; + GetSortedArray(aDataPointMapper, aDataPointArray); + + { + TId2IdMap anObj2VTKGeometryPointsMap; + vtkIdType aNbCells = aDataPointMapper->GetNumberOfTuples(); + vtkIdType aNbComp = aDataPointMapper->GetNumberOfComponents(); + int * aPtr = aDataPointMapper->GetPointer(0); + if(aNbComp==2){ + for(int aCellId = 0; aCellId < aNbCells; aCellId++){ + vtkIdType anObjID = *aPtr; + aPtr++;aPtr++; + anObj2VTKGeometryPointsMap[anObjID] = aCellId; + } + } else if (aNbComp == 1 ){ + for(int aCellId = 0; aCellId < aNbCells; aCellId++){ + vtkIdType anObjID = *aPtr; + aPtr++; + anObj2VTKGeometryPointsMap[anObjID] = aCellId; + } + } + + TId2IdMap anObj2VTKGeometryCellsMap; + aNbCells = aGeometryCellMapper->GetNumberOfTuples(); + aNbComp = aGeometryCellMapper->GetNumberOfComponents(); + aPtr = aGeometryCellMapper->GetPointer(0); + if(aNbComp == 1) + for(int aCellId = 0; aCellId < aNbCells; aCellId++){ + vtkIdType anObjID = *aPtr; + aPtr++; + anObj2VTKGeometryCellsMap[anObjID] = aCellId; + } + else if (aNbComp == 2){ + for(int aCellId = 0; aCellId < aNbCells; aCellId++){ + vtkIdType anObjID = *aPtr; + aPtr++;aPtr++; + anObj2VTKGeometryCellsMap[anObjID] = aCellId; + } + } + + // copy points to output + vtkUnstructuredGrid* aUnstructuredScalars = dynamic_cast(aInputScalars); + if(aUnstructuredScalars) + anOutput->SetPoints(aUnstructuredScalars->GetPoints()); + anOutput->GetPointData()->ShallowCopy(aInputScalars->GetPointData()); + + // Calculate output cells + int nbCells=0; + TSortedArray aCellIdsForCopy_fromCellMapper; + GetSortedArray(aGeometryCellMapper, aCellIdsForCopy_fromCellMapper); + nbCells = aCellIdsForCopy_fromCellMapper.size(); + + TSortedArray aCellIdsForCopy; + for(int i=0;iAllocate(nbCells); + + + if(nbCells>0) + CopyElementsToOutput(anInput, + nbCells, + aCellIdsForCopy, + anObj2VTKGeometryPointsMap, + anOutput); + + return true; + } + } + return false; +} + +bool +VISU_MergeFilter +::MergeGeometryCellsAndDataOnNotAllPoints() +{ + if(MYDEBUG) cout << "MergeGeometryCellsAndDataOnNotAllPoints" << endl; + // The situation for merging CELLS from anInput as Geometry + // and scalars on point data (there the number of points of point data less than + // number of points of Geometry) + + vtkUnstructuredGrid *anInput = this->GetInput(); + vtkUnstructuredGrid *anOutput = this->GetOutput(); + vtkDataSet* aInputScalars = this->GetScalars(); + vtkPointData *aPointData = anInput->GetPointData(); + + vtkPointData* aInputScalarsPointData = aInputScalars->GetPointData(); + vtkDataArray *aPointMapper = aPointData->GetArray("VISU_POINTS_MAPPER"); + vtkIntArray *aGeometryPointMapper = dynamic_cast(aPointMapper); + + vtkIntArray* aDataPointMapper = NULL; + VISU::TFieldListIterator anIter(this->FieldList); + for(anIter.Begin(); !anIter.End() ; anIter.Next()){ + const char* aFieldName = anIter.Get()->GetName(); + if(strcmp(aFieldName, "VISU_POINTS_MAPPER") == 0){ + vtkDataArray *aPointMapper = aInputScalarsPointData->GetArray(aFieldName); + aDataPointMapper = dynamic_cast(aPointMapper); + break; + } + } + vtkIntArray* aDataCellMapper = NULL; + VISU::TFieldListIterator anIter2(this->FieldList); + for(anIter2.Begin(); !anIter2.End() ; anIter2.Next()){ + const char* aFieldName = anIter2.Get()->GetName(); + if(strcmp(aFieldName, "VISU_CELLS_MAPPER") == 0){ + vtkDataArray *aCellMapper_tmp = aInputScalarsPointData->GetArray(aFieldName); + aDataCellMapper = dynamic_cast(aCellMapper_tmp); + break; + } + } + + vtkIntArray* aDataArray = NULL; + VISU::TFieldListIterator anIter3(this->FieldList); + for(anIter2.Begin(); !anIter3.End() ; anIter3.Next()){ + const char* aFieldName = anIter3.Get()->GetName(); + if(strcmp(aFieldName, "VISU_FIELD") == 0){ + vtkDataArray *aPointMapper_tmp = aInputScalarsPointData->GetArray(aFieldName); + aDataArray = dynamic_cast(aPointMapper_tmp); + break; + } + } + + + bool anIsDifferent = aDataPointMapper && + aDataPointMapper->GetNumberOfTuples() != aGeometryPointMapper->GetNumberOfTuples(); + if(anIsDifferent){ + { + vtkIntArray* aPointsIds = vtkIntArray::New(); + + TId2IdMap anObj2VTKGeometryMap; + vtkIdType aNbCells = aDataPointMapper->GetNumberOfTuples(); + aPointsIds->SetNumberOfTuples(aNbCells); + aPointsIds->SetNumberOfComponents(1); + vtkIdType aNbComp = aDataPointMapper->GetNumberOfComponents(); + int * aPtr = aDataPointMapper->GetPointer(0); + int * aPtrOut = aPointsIds->GetPointer(0); + if(aNbComp==2){ + for(int aCellId = 0; aCellId < aNbCells; aCellId++){ + vtkIdType anObjID = *aPtr; + aPtr++;aPtr++; + *aPtrOut = anObjID; + aPtrOut++; + anObj2VTKGeometryMap[anObjID] = aCellId; + } + } else if (aNbComp == 1 ){ + for(int aCellId = 0; aCellId < aNbCells; aCellId++){ + vtkIdType anObjID = *aPtr; + aPtr++; + *aPtrOut = anObjID; + aPtrOut++; + anObj2VTKGeometryMap[anObjID] = aCellId; + } + } + + vtkUnstructuredGrid* aUnstructuredScalars = dynamic_cast(aInputScalars); + if(aUnstructuredScalars) + anOutput->SetPoints(aUnstructuredScalars->GetPoints()); + + anOutput->GetPointData()->ShallowCopy(aInputScalars->GetPointData()); + + // Calculate output cells + int nbCells=0; + TSortedArray aCellIdsForCopy; + GetIdsForCopy(anInput,aPointsIds,aCellIdsForCopy); + aPointsIds->Delete(); + nbCells = aCellIdsForCopy.size(); + + // copy cells to output + anOutput->Allocate(nbCells); + + if(nbCells>0) + CopyElementsToOutput(anInput, + nbCells, + aCellIdsForCopy, + anObj2VTKGeometryMap, + anOutput); + return true; + } + + } + + return false; } void @@ -593,10 +939,10 @@ VISU_MergeFilter void VISU_MergeFilter::Execute() { + VISU::TTimerLog aTimerLog(MYDEBUG,"VISU_MergeFilter::Execute"); vtkUnstructuredGrid *anInput = this->GetInput(); vtkUnstructuredGrid *anOutput = this->GetOutput(); - - vtkPointData *aPointData = anInput->GetPointData(); + vtkDataSet* aInputScalars = this->GetScalars(); int nbPointsInScalars = aInputScalars->GetNumberOfPoints(); int nbPointsInGeometr = anInput->GetNumberOfPoints(); @@ -605,267 +951,23 @@ void VISU_MergeFilter::Execute() vtkDataArray* aScalarsOnCellsArray = NULL; if(aInputScalars->GetCellData()) aScalarsOnCellsArray = aInputScalars->GetCellData()->GetArray("VISU_FIELD"); + vtkDataArray* aScalarsOnPointsArray = NULL; if(aInputScalars->GetPointData()) aScalarsOnPointsArray = aInputScalars->GetPointData()->GetArray("VISU_FIELD"); - vtkDataArray *aPointMapper = aPointData->GetArray("VISU_POINTS_MAPPER"); - vtkIntArray *aGeometryPointMapper = dynamic_cast(aPointMapper); vtkDataArray *aCellMapper = aCellData->GetArray("VISU_CELLS_MAPPER"); vtkIntArray *aGeometryCellMapper = dynamic_cast(aCellMapper); - if(aGeometryCellMapper && aScalarsOnCellsArray && (nbPointsInScalars == nbPointsInGeometr)){ - vtkIntArray* aDataCellMapper = NULL; - VISU::TFieldListIterator anIter(this->FieldList); - for(anIter.Begin(); !anIter.End() ; anIter.Next()){ - vtkCellData *aCellData = anIter.Get()->Ptr->GetCellData(); - const char* aFieldName = anIter.Get()->GetName(); - if(strcmp(aFieldName, "VISU_CELLS_MAPPER") == 0){ - vtkDataArray *aCellMapper_tmp = aCellData->GetArray(aFieldName); - aDataCellMapper = dynamic_cast(aCellMapper_tmp); - break; - } - } - - bool anIsDifferent = aDataCellMapper && - aDataCellMapper->GetNumberOfTuples() != aGeometryCellMapper->GetNumberOfTuples(); - - if(anIsDifferent || IsMergingInputs() ){ - // The situation for merging CELLS from anInput as Geometry - // and scalars on cell data - TSortedArray aGeometryCellArray; - GetSortedArray(aGeometryCellMapper, aGeometryCellArray); - - TSortedArray aDataCellArray; - GetSortedArray(aDataCellMapper, aDataCellArray); - - int aMaxLength = std::max(aGeometryCellArray.size(), aDataCellArray.size()); - TSortedArray anIntersectionArray(aMaxLength); - TSortedArray::iterator anArrayIter = anIntersectionArray.begin(); - anArrayIter = std::set_intersection(aGeometryCellArray.begin(), - aGeometryCellArray.end(), - aDataCellArray.begin(), - aDataCellArray.end(), - anArrayIter); - - anIntersectionArray.erase(anArrayIter, anIntersectionArray.end()); - - bool anIsCompletelyCoincide = - anIntersectionArray.size() == aGeometryCellArray.size() && - anIntersectionArray.size() == aDataCellArray.size(); - - if(!anIsCompletelyCoincide || IsMergingInputs()){ - { - TId2IdMap anObj2VTKGeometryMap; - vtkIdType aNbCells = aGeometryCellMapper->GetNumberOfTuples(); - for(int aCellId = 0; aCellId < aNbCells; aCellId++){ - vtkIdType anObjID = aGeometryCellMapper->GetValue(aCellId); - anObj2VTKGeometryMap[anObjID] = aCellId; - } - - vtkIdType aNbTuples = anIntersectionArray.size(); - anOutput->Allocate(aNbTuples); - vtkIdList *aCellIds = vtkIdList::New(); - for(int aTupleId = 0; aTupleId < aNbTuples; aTupleId++){ - vtkIdType anObjID = anIntersectionArray[aTupleId]; - vtkIdType aCellId = anObj2VTKGeometryMap[anObjID]; - vtkCell *aCell = anInput->GetCell(aCellId); - aCellIds->Reset(); - vtkIdType aNbPointIds = aCell->PointIds->GetNumberOfIds(); - for(vtkIdType aPointId = 0; aPointId < aNbPointIds; aPointId++) - aCellIds->InsertNextId(aCell->GetPointIds()->GetId(aPointId)); - anOutput->InsertNextCell(anInput->GetCellType(aCellId), aCellIds); - } - aCellIds->Delete(); - anOutput->SetPoints(anInput->GetPoints()); - } - { - TId2IdMap anObj2VTKDataMap; - vtkIdType aNbCells = aDataCellMapper->GetNumberOfTuples(); - for(int aCellId = 0; aCellId < aNbCells; aCellId++){ - vtkIdType anObjID = aDataCellMapper->GetValue(aCellId); - anObj2VTKDataMap[anObjID] = aCellId; - } - - DeepCopyDataSetAttributes(this, - anOutput, - this->FieldList, - anIntersectionArray, - anObj2VTKDataMap); - } - return; - } - } - } else if (aGeometryCellMapper && aScalarsOnPointsArray && (nbPointsInScalars == nbPointsInGeometr)) { - // The situation for merging CELLS from anInput as Geometry - // and scalars on point data - vtkPointData* aInputScalarsPointData = aInputScalars->GetPointData(); - - vtkIntArray* aDataPointMapper = NULL; - VISU::TFieldListIterator anIter(this->FieldList); - for(anIter.Begin(); !anIter.End() ; anIter.Next()){ - const char* aFieldName = anIter.Get()->GetName(); - if(strcmp(aFieldName, "VISU_POINTS_MAPPER") == 0){ - vtkDataArray *aPointMapper = aInputScalarsPointData->GetArray(aFieldName); - aDataPointMapper = dynamic_cast(aPointMapper); - break; - } - } - - if(aDataPointMapper){ - TSortedArray aGeometryPointArray; - GetSortedArray(aGeometryPointMapper, aGeometryPointArray); - - TSortedArray aDataPointArray; - GetSortedArray(aDataPointMapper, aDataPointArray); - - { - TId2IdMap anObj2VTKGeometryPointsMap; - vtkIdType aNbCells = aDataPointMapper->GetNumberOfTuples(); - for(int aCellId = 0; aCellId < aNbCells; aCellId++){ - vtkIdType anObjID = aDataPointMapper->GetValue(aCellId); - anObj2VTKGeometryPointsMap[anObjID] = aCellId; - } - - TId2IdMap anObj2VTKGeometryCellsMap; - aNbCells = aGeometryCellMapper->GetNumberOfTuples(); - for(int aCellId = 0; aCellId < aNbCells; aCellId++){ - vtkIdType anObjID = aGeometryCellMapper->GetValue(aCellId); - anObj2VTKGeometryCellsMap[anObjID] = aCellId; - } - - // copy points to output - vtkUnstructuredGrid* aUnstructuredScalars = dynamic_cast(aInputScalars); - if(aUnstructuredScalars) - anOutput->SetPoints(aUnstructuredScalars->GetPoints()); - anOutput->GetPointData()->ShallowCopy(aInputScalars->GetPointData()); - - // Calculate output cells - int nbCells=0; - TSortedArray aCellIdsForCopy_fromCellMapper; - GetSortedArray(aGeometryCellMapper, aCellIdsForCopy_fromCellMapper); - nbCells = aCellIdsForCopy_fromCellMapper.size(); - - TSortedArray aCellIdsForCopy; - for(int i=0;iAllocate(nbCells); - vtkIntArray* theOuputIDSArray = vtkIntArray::New(); - theOuputIDSArray->SetName("VISU_CELLS_MAPPER"); - theOuputIDSArray->SetNumberOfComponents(1); - theOuputIDSArray->SetNumberOfTuples(nbCells); - - if(nbCells>0) - CopyElementsToOutput(anInput, - nbCells, - aCellIdsForCopy, - anObj2VTKGeometryPointsMap, - theOuputIDSArray, - anOutput); - theOuputIDSArray->Delete(); - - return; - } - } + if (aGeometryCellMapper && aScalarsOnCellsArray && (nbPointsInScalars == nbPointsInGeometr)){ + if(MergeGeometryCellsAndDataOnCells()) + return; + } else if (aGeometryCellMapper && aScalarsOnPointsArray && (nbPointsInScalars == nbPointsInGeometr)){ + if(MergeGeometryCellsAndDataOnAllPoints()) + return; } else if (aGeometryCellMapper && (nbPointsInScalars < nbPointsInGeometr)) { - // The situation for merging CELLS from anInput as Geometry - // and scalars on point data (there the number of points of point data less than - // number of points of Geometry) - - vtkPointData* aInputScalarsPointData = aInputScalars->GetPointData(); - - vtkIntArray* aDataPointMapper = NULL; - VISU::TFieldListIterator anIter(this->FieldList); - for(anIter.Begin(); !anIter.End() ; anIter.Next()){ - const char* aFieldName = anIter.Get()->GetName(); - if(strcmp(aFieldName, "VISU_POINTS_MAPPER") == 0){ - vtkDataArray *aPointMapper = aInputScalarsPointData->GetArray(aFieldName); - aDataPointMapper = dynamic_cast(aPointMapper); - break; - } - } - vtkIntArray* aDataCellMapper = NULL; - VISU::TFieldListIterator anIter2(this->FieldList); - for(anIter2.Begin(); !anIter2.End() ; anIter2.Next()){ - vtkCellData *aCellData = anIter2.Get()->Ptr->GetCellData(); - const char* aFieldName = anIter2.Get()->GetName(); - if(strcmp(aFieldName, "VISU_CELLS_MAPPER") == 0){ - vtkDataArray *aCellMapper_tmp = aInputScalarsPointData->GetArray(aFieldName); - aDataCellMapper = dynamic_cast(aCellMapper_tmp); - break; - } - } - - bool anIsDifferent = aDataPointMapper && - aDataPointMapper->GetNumberOfTuples() != aGeometryPointMapper->GetNumberOfTuples(); - if(anIsDifferent){ - TSortedArray aGeometryPointArray; - GetSortedArray(aGeometryPointMapper, aGeometryPointArray); - - TSortedArray aDataPointArray; - GetSortedArray(aDataPointMapper, aDataPointArray); - - int aMaxLength = std::max(aGeometryPointArray.size(), aDataPointArray.size()); - TSortedArray anIntersectionArray(aMaxLength); - TSortedArray::iterator anArrayIter = anIntersectionArray.begin(); - anArrayIter = std::set_intersection(aGeometryPointArray.begin(), - aGeometryPointArray.end(), - aDataPointArray.begin(), - aDataPointArray.end(), - anArrayIter); - - anIntersectionArray.erase(anArrayIter, anIntersectionArray.end()); - - { - TId2IdMap anObj2VTKGeometryMap; - vtkIdType aNbCells = aDataPointMapper->GetNumberOfTuples(); - for(int aCellId = 0; aCellId < aNbCells; aCellId++){ - vtkIdType anObjID = aDataPointMapper->GetValue(aCellId); - anObj2VTKGeometryMap[anObjID] = aCellId; - } - - vtkIdType aNbTuples = anIntersectionArray.size(); - - if ( aNbTuples == nbPointsInScalars ){ - vtkUnstructuredGrid* aUnstructuredScalars = dynamic_cast(aInputScalars); - if(aUnstructuredScalars) - anOutput->SetPoints(aUnstructuredScalars->GetPoints()); - anOutput->GetPointData()->ShallowCopy(aInputScalars->GetPointData()); - - // Calculate output cells - int nbCells=0; - TSortedArray aCellIdsForCopy; - GetIdsForCopy(anInput,aDataPointMapper,aCellIdsForCopy); - nbCells = aCellIdsForCopy.size(); - - // copy cells to output - anOutput->Allocate(nbCells); - vtkIntArray* theOuputIDSArray = vtkIntArray::New(); - theOuputIDSArray->SetName("VISU_CELLS_MAPPER"); - theOuputIDSArray->SetNumberOfComponents(1); - theOuputIDSArray->SetNumberOfTuples(nbCells); - - if(nbCells>0) - CopyElementsToOutput(anInput, - nbCells, - aCellIdsForCopy, - anObj2VTKGeometryMap, - theOuputIDSArray, - anOutput); - theOuputIDSArray->Delete(); - return; - - } else { - // not implemented yet - } - - - - } - - } + if(MergeGeometryCellsAndDataOnNotAllPoints()) + return; } anOutput->CopyStructure(anInput); diff --git a/src/CONVERTOR/VISU_MergeFilter.hxx b/src/CONVERTOR/VISU_MergeFilter.hxx index 3379f5d6..fb18bb51 100644 --- a/src/CONVERTOR/VISU_MergeFilter.hxx +++ b/src/CONVERTOR/VISU_MergeFilter.hxx @@ -108,6 +108,10 @@ protected: bool myIsMergingInputs; private: + bool MergeGeometryCellsAndDataOnCells(); + bool MergeGeometryCellsAndDataOnAllPoints(); + bool MergeGeometryCellsAndDataOnNotAllPoints(); + VISU_MergeFilter(const VISU_MergeFilter&); // Not implemented. void operator=(const VISU_MergeFilter&); // Not implemented. }; diff --git a/src/OBJECT/VISU_Actor.cxx b/src/OBJECT/VISU_Actor.cxx index e2e9be32..36b2e2d3 100644 --- a/src/OBJECT/VISU_Actor.cxx +++ b/src/OBJECT/VISU_Actor.cxx @@ -31,7 +31,10 @@ #include "VTKViewer_ShrinkFilter.h" #include "VTKViewer_GeometryFilter.h" #include "VTKViewer_PassThroughFilter.h" - + +#include "VISU_ConvertorUtils.hxx" +#include "VISU_ConvertorDef.hxx" + #include #include @@ -408,25 +411,29 @@ vtkIdType VISU_Actor ::GetNodeObjId(vtkIdType theID) { - if(myIsVTKMapping) - return Superclass::GetNodeObjId(theID); + cout << "GetNodeObjId("<GetInput(),theID); +// if(myIsVTKMapping) +// return Superclass::GetNodeObjId(theID); - vtkIdType anID = myGeomFilter->GetNodeObjId(theID); +// vtkIdType anID = myGeomFilter->GetNodeObjId(theID); - if(myIsShrunk) - anID = myShrinkFilter->GetNodeObjId(anID); +// if(myIsShrunk) +// anID = myShrinkFilter->GetNodeObjId(anID); - return GetCurrentPL()->GetNodeObjID(anID); +// return GetCurrentPL()->GetNodeObjID(anID); } vtkIdType VISU_Actor ::GetNodeVTKID(vtkIdType theID) { - if(myIsVTKMapping) - return theID; + cout << "GetNodeVTKID("<GetInput(),theID); +// if(myIsVTKMapping) +// return theID; - return GetCurrentPL()->GetNodeVTKID(theID); +// return GetCurrentPL()->GetNodeVTKID(theID); } vtkFloatingPointType* @@ -445,25 +452,36 @@ vtkIdType VISU_Actor ::GetElemObjId(vtkIdType theID) { - if(myIsVTKMapping) - return Superclass::GetElemObjId(theID); + cout << "GetElemObjId("<GetInput(),theID); +// if(myIsVTKMapping) +// return Superclass::GetElemObjId(theID); - vtkIdType anID = myGeomFilter->GetElemObjId(theID); +// vtkIdType anID = myGeomFilter->GetElemObjId(theID); - if(myIsShrunk) - anID = myShrinkFilter->GetElemObjId(anID); +// if(myIsShrunk) +// anID = myShrinkFilter->GetElemObjId(anID); - return GetCurrentPL()->GetElemObjID(anID); +// return GetCurrentPL()->GetElemObjID(anID); } vtkIdType VISU_Actor ::GetElemVTKID(vtkIdType theID) { - if(myIsVTKMapping) - return theID; - - return GetCurrentPL()->GetElemVTKID(theID); + cout << "GetElemVTKID("<GetInput(),theID,VISU::CELL_ENTITY); + if(theId > -1) + return theId; + theId = VISU::GetElemVTKID(this->GetInput(),theID,VISU::FACE_ENTITY); + if(theId > -1) + return theId; + theId = VISU::GetElemVTKID(this->GetInput(),theID,VISU::EDGE_ENTITY); + return theId; +// if(myIsVTKMapping) +// return theID; + +// return GetCurrentPL()->GetElemVTKID(theID); } vtkCell* -- 2.39.2