From 2b9c7dbd890282cbf0f08137fe4dc91f8d9325b1 Mon Sep 17 00:00:00 2001 From: Pascal Obry Date: Thu, 20 Feb 2020 15:38:23 +0100 Subject: [PATCH 1/5] SMDS: Minor style fixes. --- src/SMDS/SMDS_UnstructuredGrid.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/SMDS/SMDS_UnstructuredGrid.cxx b/src/SMDS/SMDS_UnstructuredGrid.cxx index 1ebbc9b72..0a928ad11 100644 --- a/src/SMDS/SMDS_UnstructuredGrid.cxx +++ b/src/SMDS/SMDS_UnstructuredGrid.cxx @@ -46,7 +46,7 @@ void SMDS_CellLinks::ResizeForPoint(vtkIdType vtkID) if ( vtkID > this->MaxId ) { this->MaxId = vtkID; - if ( vtkID >= this->Size ) + if ( vtkID >= this->Size ) vtkCellLinks::Resize( vtkID+SMDS_Mesh::chunkSize ); } } @@ -1204,4 +1204,3 @@ double SMDS_UnstructuredGrid::GetBallDiameter( vtkIdType vtkID ) const return vtkDoubleArray::SafeDownCast( vtkDataSet::CellData->GetScalars() )->GetValue( vtkID ); return 0; } - From db1b536077b643e9871607c26b146e986d51a8c3 Mon Sep 17 00:00:00 2001 From: Pascal Obry Date: Thu, 20 Feb 2020 15:38:56 +0100 Subject: [PATCH 2/5] SMDS: Fix use of this->CellLocations due to vtk changes. This fixes many smesh tests. 159 where failing (out of 160) and now only 59 are failing. So 100 tests fixed. --- src/SMDS/SMDS_UnstructuredGrid.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/SMDS/SMDS_UnstructuredGrid.cxx b/src/SMDS/SMDS_UnstructuredGrid.cxx index 0a928ad11..ce46543bf 100644 --- a/src/SMDS/SMDS_UnstructuredGrid.cxx +++ b/src/SMDS/SMDS_UnstructuredGrid.cxx @@ -320,12 +320,14 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector& idNodesOldToNew, int n newFaceLocations->Squeeze(); newFaces->Squeeze(); this->SetCells( newTypes, newLocations, newConnectivity, newFaceLocations, newFaces ); + this->CellLocations = newLocations; newFaceLocations->Delete(); newFaces->Delete(); } else { this->SetCells( newTypes, newLocations, newConnectivity, FaceLocations, Faces ); + this->CellLocations = newLocations; } newTypes->Delete(); @@ -360,7 +362,8 @@ void SMDS_UnstructuredGrid::copyBloc(vtkUnsignedCharArray * newTypes, { int iOld = idCellsNewToOld[ iNew ]; newTypes->SetValue( iNew, this->Types->GetValue( iOld )); - vtkIdType oldLoc = this->CellLocations->GetValue( iOld ); + + vtkIdType oldLoc = ((vtkIdTypeArray *)(this->Connectivity->GetOffsetsArray()))->GetValue( iOld ); vtkIdType nbpts; vtkIdType const *oldPtsCell(nullptr); this->Connectivity->GetCell( oldLoc, nbpts, oldPtsCell ); From 63b50e565547ca3674c7c5f4b45662e10902663b Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Mon, 2 Mar 2020 09:19:46 +0100 Subject: [PATCH 3/5] creating_meshes_ex02.py test is now OK --- src/SMDS/SMDS_UnstructuredGrid.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SMDS/SMDS_UnstructuredGrid.cxx b/src/SMDS/SMDS_UnstructuredGrid.cxx index ce46543bf..e06cf3ba2 100644 --- a/src/SMDS/SMDS_UnstructuredGrid.cxx +++ b/src/SMDS/SMDS_UnstructuredGrid.cxx @@ -366,7 +366,7 @@ void SMDS_UnstructuredGrid::copyBloc(vtkUnsignedCharArray * newTypes, vtkIdType oldLoc = ((vtkIdTypeArray *)(this->Connectivity->GetOffsetsArray()))->GetValue( iOld ); vtkIdType nbpts; vtkIdType const *oldPtsCell(nullptr); - this->Connectivity->GetCell( oldLoc, nbpts, oldPtsCell ); + this->Connectivity->GetCell( oldLoc+iOld, nbpts, oldPtsCell ); if ((vtkIdType) pointsCell.size() < nbpts ) pointsCell.resize( nbpts ); for ( int l = 0; l < nbpts; l++ ) From 9334054522482f4e20c93e5d911dc0515f50b86a Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Mon, 2 Mar 2020 10:43:36 +0100 Subject: [PATCH 4/5] Make SMESH_creating_meshes_ex07 test OK --- src/SMDS/SMDS_MeshCell.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SMDS/SMDS_MeshCell.cxx b/src/SMDS/SMDS_MeshCell.cxx index fc9f74031..3628aafe3 100644 --- a/src/SMDS/SMDS_MeshCell.cxx +++ b/src/SMDS/SMDS_MeshCell.cxx @@ -490,10 +490,10 @@ void SMDS_MeshCell::init( SMDSAbs_EntityType theEntity, bool SMDS_MeshCell::ChangeNodes(const SMDS_MeshNode* nodes[], const int theNbNodes) { vtkIdType npts = 0; - vtkIdType *pts; + vtkIdType *pts(nullptr); vtkIdType const *tmp(nullptr); getGrid()->GetCellPoints( GetVtkID(), npts, tmp ); - std::copy(tmp,tmp+npts,pts); + pts = const_cast(tmp); if ( theNbNodes != npts ) { MESSAGE("ChangeNodes problem: not the same number of nodes " << npts << " -> " << theNbNodes); From 550311af7b1d59413fde01030516434170ecaf6c Mon Sep 17 00:00:00 2001 From: eap Date: Mon, 2 Mar 2020 18:23:17 +0300 Subject: [PATCH 5/5] Porting to ParaView 5.8: fix SMDS_UnstructuredGrid::compactGrid() --- src/SMDS/SMDS_UnstructuredGrid.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SMDS/SMDS_UnstructuredGrid.cxx b/src/SMDS/SMDS_UnstructuredGrid.cxx index e06cf3ba2..d73ccbaf5 100644 --- a/src/SMDS/SMDS_UnstructuredGrid.cxx +++ b/src/SMDS/SMDS_UnstructuredGrid.cxx @@ -249,7 +249,7 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector& idNodesOldToNew, int n if ( newCellSize != oldCellSize ) for ( int i = 0; i < oldCellSize - 1; ++i ) if ( this->Types->GetValue( i ) == VTK_EMPTY_CELL ) - newConnectivitySize -= this->CellLocations->GetValue( i+1 ) - this->CellLocations->GetValue( i ); + newConnectivitySize -= this->Connectivity->GetCellSize( i ); vtkCellArray *newConnectivity = vtkCellArray::New(); newConnectivity->Initialize(); @@ -982,7 +982,7 @@ void SMDS_UnstructuredGrid::ModifyCellNodes(int vtkVolId, std::map loc vtkIdType const *tmp(nullptr); // will refer to the point id's of the face vtkIdType *pts; // will refer to the point id's of the face this->GetCellPoints(vtkVolId, npts, tmp); - std::copy(tmp, tmp+npts, pts); + pts = const_cast< vtkIdType*>( tmp ); for (int i = 0; i < npts; i++) { if (localClonedNodeIds.count(pts[i]))