From 8f44652c303eb4e964158c8bf7b0b2e141da2918 Mon Sep 17 00:00:00 2001 From: prascle Date: Wed, 11 May 2011 14:46:30 +0000 Subject: [PATCH] PR: debug a SIGSEGV case when using downward connectivity on a modified mesh. --- src/SMDS/SMDS_UnstructuredGrid.cxx | 7 ++++++- src/SMESH/SMESH_MeshEditor.cxx | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/SMDS/SMDS_UnstructuredGrid.cxx b/src/SMDS/SMDS_UnstructuredGrid.cxx index 03b5d2337..0a2778445 100644 --- a/src/SMDS/SMDS_UnstructuredGrid.cxx +++ b/src/SMDS/SMDS_UnstructuredGrid.cxx @@ -312,7 +312,12 @@ void SMDS_UnstructuredGrid::copyBloc(vtkUnsignedCharArray *newTypes, std::vector int SMDS_UnstructuredGrid::CellIdToDownId(int vtkCellId) { - // ASSERT((vtkCellId >= 0) && (vtkCellId < _cellIdToDownId.size())); + if((vtkCellId < 0) || (vtkCellId >= _cellIdToDownId.size())) + { + std::cerr << "SMDS_UnstructuredGrid::CellIdToDownId problem vtkCellId=" + << vtkCellId << " max="<< _cellIdToDownId.size() << std::endl; + return -1; + } return _cellIdToDownId[vtkCellId]; } diff --git a/src/SMESH/SMESH_MeshEditor.cxx b/src/SMESH/SMESH_MeshEditor.cxx index db8f8a36d..be3ac4cc9 100644 --- a/src/SMESH/SMESH_MeshEditor.cxx +++ b/src/SMESH/SMESH_MeshEditor.cxx @@ -10968,6 +10968,8 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vectorGetCellType(vtkId); int downId = grid->CellIdToDownId(vtkId); + if (downId < 0) + continue; DownIdType aCell(downId, vtkType); if (celldom.count(vtkId)) continue; @@ -11238,6 +11240,8 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vectorGetCellType(vtkId); int downId = grid->CellIdToDownId(vtkId); + if (downId < 0) + continue; DownIdType aCell(downId, vtkType); int volParents[1000]; int nbvol = grid->GetParentVolumes(volParents, vtkId); -- 2.39.2