From: apo Date: Wed, 11 Apr 2007 08:58:07 +0000 (+0000) Subject: To introduce ids mapping for mesh nodes X-Git-Tag: V3_2_6pre4~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c6ddac612520fb11b5e1ec9731d04b82d0d753ac;p=modules%2Fvisu.git To introduce ids mapping for mesh nodes (In context of fix for Bug NPAL14169 - EDF VISU 256 : No continuum on a scalarmap) --- diff --git a/src/CONVERTOR/VISU_AppendFilter.cxx b/src/CONVERTOR/VISU_AppendFilter.cxx index f5e99939..b99e7d86 100644 --- a/src/CONVERTOR/VISU_AppendFilter.cxx +++ b/src/CONVERTOR/VISU_AppendFilter.cxx @@ -57,21 +57,21 @@ VISU_AppendFilter void VISU_AppendFilter -::SetPoints(vtkPoints* thePoints) +::SetSharedPointsDataSet(vtkPointSet* thePointsDataSet) { - if(GetPoints() == thePoints) + if(GetSharedPointsDataSet() == thePointsDataSet) return; - myPoints = thePoints; + mySharedPointsDataSet = thePointsDataSet; Modified(); } -vtkPoints* +vtkPointSet* VISU_AppendFilter -::GetPoints() +::GetSharedPointsDataSet() { - return myPoints.GetPointer(); + return mySharedPointsDataSet.GetPointer(); } void @@ -219,8 +219,9 @@ void VISU_AppendFilter ::Execute() { - if(myPoints.GetPointer()){ - if(myPoints->GetNumberOfPoints() < 1) + if(GetSharedPointsDataSet()){ + vtkPoints* aPoints = GetSharedPointsDataSet()->GetPoints(); + if(aPoints->GetNumberOfPoints() < 1) return; vtkUnstructuredGrid *anOutput = this->GetOutput(); @@ -241,7 +242,8 @@ VISU_AppendFilter // Append each input dataset together // 1.points - anOutput->SetPoints(myPoints.GetPointer()); + anOutput->SetPoints(GetSharedPointsDataSet()->GetPoints()); + anOutput->GetPointData()->PassData(GetSharedPointsDataSet()->GetPointData()); // 2.cells vtkIdList *anIdList = vtkIdList::New(); @@ -280,7 +282,8 @@ VISU_AppendFilter // Append each input dataset together // 1.points - anOutput->SetPoints(myPoints.GetPointer()); + anOutput->SetPoints(GetSharedPointsDataSet()->GetPoints()); + anOutput->GetPointData()->PassData(GetSharedPointsDataSet()->GetPointData()); // 2.cells vtkIdList *anIdList = vtkIdList::New(); diff --git a/src/CONVERTOR/VISU_AppendFilter.hxx b/src/CONVERTOR/VISU_AppendFilter.hxx index 91c7674c..fd9a827d 100644 --- a/src/CONVERTOR/VISU_AppendFilter.hxx +++ b/src/CONVERTOR/VISU_AppendFilter.hxx @@ -22,7 +22,7 @@ #include #include -class vtkPoints; +class vtkPointSet; /*! \brief This class used same as vtkAppendFilter. See documentation on VTK for more information. */ @@ -39,10 +39,10 @@ public: vtkTypeRevisionMacro(VISU_AppendFilter, vtkAppendFilter); void - SetPoints(vtkPoints* thePoints); + SetSharedPointsDataSet(vtkPointSet* thePointsDataSet); - vtkPoints* - GetPoints(); + vtkPointSet* + GetSharedPointsDataSet(); void SetMergingInputs(bool theIsMergingInputs); @@ -65,7 +65,7 @@ protected: virtual void Execute(); bool myIsMergingInputs; - vtkSmartPointer myPoints; + vtkSmartPointer mySharedPointsDataSet; }; #endif diff --git a/src/CONVERTOR/VISU_Convertor_impl.cxx b/src/CONVERTOR/VISU_Convertor_impl.cxx index aa52822c..1a91c358 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.cxx +++ b/src/CONVERTOR/VISU_Convertor_impl.cxx @@ -252,10 +252,14 @@ namespace VISU //--------------------------------------------------------------- TMeshImpl::TMeshImpl(): - myPoints(vtkPoints::New()), + myPointsSource(vtkUnstructuredGrid::New()), myNbPoints(0) { - myPoints->Delete(); + vtkPoints* aPoints = vtkPoints::New(); + myPointsSource->SetPoints(aPoints); + aPoints->Delete(); + + myPointsSource->Delete(); } @@ -1151,13 +1155,12 @@ namespace //--------------------------------------------------------------- - vtkPoints* - GetPoints(const PMeshImpl& theMesh) + vtkUnstructuredGrid* + GetPointsSource(const PMeshImpl& theMesh) { - TVTKPoints& aPoints = theMesh->myPoints; - const TNamedPointCoords& aCoords = theMesh->myNamedPointCoords; - + TVTKSource& aPointSource = theMesh->myPointsSource; if(!theMesh->myIsVTKDone){ + const TNamedPointCoords& aCoords = theMesh->myNamedPointCoords; TCoordHelperPtr aCoordHelperPtr; { int aMeshDimension = theMesh->myDim; @@ -1197,10 +1200,11 @@ namespace } } + vtkPoints* aPoints = aPointSource->GetPoints(); vtkIdType aNbPoints = aCoords.GetNbPoints(); aPoints->SetNumberOfPoints(aNbPoints); - INITMSG(MYDEBUG,"GetPoints - aNbPoints = "<SetNumberOfComponents(1); + aDataArray->SetNumberOfTuples(aNbTuples); + for(vtkIdType aTupleId = 0; aTupleId < aNbTuples; aTupleId++){ + vtkIdType anObjID = aCoords.GetObjID(aTupleId); + aDataArray->SetValue(aTupleId, anObjID); + } + aPointSource->GetPointData()->AddArray(aDataArray); + aDataArray->Delete(); + theMesh->myIsVTKDone = true; if(MYVTKDEBUG) aPoints->DebugOn(); } - return aPoints.GetPointer(); + return aPointSource.GetPointer(); } @@ -1568,7 +1584,7 @@ namespace if(theSubProfile->myIsVTKDone) return; - aSource->SetPoints(GetPoints(theMesh)); + aSource->ShallowCopy(GetPointsSource(theMesh)); INITMSGA(MYDEBUG,0,"GetNumberOfPoints - "<GetNumberOfPoints()<GetNumberOfCells()<GetFilter(); - anAppendFilter->SetPoints(GetPoints(theMesh)); + anAppendFilter->SetSharedPointsDataSet(GetPointsSource(theMesh)); if(theProfile->myIsAll){ TVTKOutput* aDataSet = theMeshOnEntity->GetVTKOutput(); @@ -1971,7 +1987,7 @@ VISU_Convertor_impl if(MYVTKDEBUG) anAppendFilter->DebugOn(); LoadMeshOnEntity(aMesh,aMeshOnEntity); - anAppendFilter->SetPoints(GetPoints(aMesh)); + anAppendFilter->SetSharedPointsDataSet(GetPointsSource(aMesh)); const TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh; TGeom2SubMesh::const_iterator anIter = aGeom2SubMesh.begin(); @@ -1989,7 +2005,7 @@ VISU_Convertor_impl //ENK: 23.11.2006 const TVTKSource& aSource = aSubMesh->GetSource(); - aSource->SetPoints(GetPoints(aMesh)); + aSource->ShallowCopy(GetPointsSource(aMesh)); aSubMesh->myStartID = aCellID; GetCellsOnSubMesh(aSource, aMeshOnEntity, aSubMesh, aVGeom); @@ -2060,7 +2076,7 @@ VISU_Convertor_impl GetMeshOnEntity(theMeshName,theEntity); LoadFamilyOnEntity(aMesh,aMeshOnEntity,aFamily); - aSource->SetPoints(GetPoints(aMesh)); + aSource->ShallowCopy(GetPointsSource(aMesh)); GetCellsOnFamily(aSource,aMeshOnEntity,aFamily); aFamily->myNamedPointCoords = aMesh->myNamedPointCoords; @@ -2122,7 +2138,7 @@ VISU_Convertor_impl const VISU::TFamilySet& aFamilySet = aGroup->myFamilySet; LoadMeshOnGroup(aMesh,aFamilySet); - anAppendFilter->SetPoints(GetPoints(aMesh)); + anAppendFilter->SetSharedPointsDataSet(GetPointsSource(aMesh)); TFamilySet::const_iterator anIter = aFamilySet.begin(); diff --git a/src/CONVERTOR/VISU_Convertor_impl.hxx b/src/CONVERTOR/VISU_Convertor_impl.hxx index f9f6b157..fd1aaf05 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.hxx +++ b/src/CONVERTOR/VISU_Convertor_impl.hxx @@ -279,7 +279,7 @@ namespace VISU { PNamedPointCoords myNamedPointCoords; //!< Keeps intermediate representation of the nodes - TVTKPoints myPoints; //!< Keeps VTK representation of the nodes + TVTKSource myPointsSource; //!< Keeps VTK representation of the nodes vtkIdType myNbPoints; //!< Keeps number of the nodes TMeshImpl(); diff --git a/src/PIPELINE/VISU_PrsMergerPL.cxx b/src/PIPELINE/VISU_PrsMergerPL.cxx index 529dc3a2..f9d21555 100644 --- a/src/PIPELINE/VISU_PrsMergerPL.cxx +++ b/src/PIPELINE/VISU_PrsMergerPL.cxx @@ -310,7 +310,7 @@ VISU_PrsMergerPL VISU::TVTKOutput* aScalarsOutput = aScalarsIDMapper->GetVTKOutput(); // copy points to output from input scalar map - myAppendFilter->SetPoints(aScalarsOutput->GetPoints()); + myAppendFilter->SetSharedPointsDataSet(aScalarsOutput); vtkIdType aNbGeoms = this->GetNbGeometry(); for(vtkIdType aGeomId = 0; aGeomId < aNbGeoms; aGeomId++){