From c922a9cc642143721f0364e60f7f022f5f1a0c80 Mon Sep 17 00:00:00 2001 From: eap Date: Tue, 28 May 2013 16:40:15 +0000 Subject: [PATCH] Fix GetNode() for polyhedron --- src/SMDS/SMDS_VtkVolume.cxx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/SMDS/SMDS_VtkVolume.cxx b/src/SMDS/SMDS_VtkVolume.cxx index 7e66a83c8..3db0ba03b 100644 --- a/src/SMDS/SMDS_VtkVolume.cxx +++ b/src/SMDS/SMDS_VtkVolume.cxx @@ -366,7 +366,6 @@ const SMDS_MeshNode* SMDS_VtkVolume::GetFaceNode(const int face_ind, const int n std::vector SMDS_VtkVolume::GetQuantities() const { vector quantities; - quantities.clear(); SMDS_Mesh *mesh = SMDS_Mesh::_meshList[myMeshId]; vtkUnstructuredGrid* grid = mesh->getGrid(); vtkIdType aVtkType = grid->GetCellType(this->myVtkID); @@ -428,6 +427,22 @@ const SMDS_MeshNode* SMDS_VtkVolume::GetNode(const int ind) const { vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid(); vtkIdType aVtkType = grid->GetCellType(this->myVtkID); + if ( aVtkType == VTK_POLYHEDRON) + { + vtkIdType nFaces = 0; + vtkIdType* ptIds = 0; + grid->GetFaceStream(this->myVtkID, nFaces, ptIds); + int id = 0, nbPoints = 0; + for (int i = 0; i < nFaces; i++) + { + int nodesInFace = ptIds[id]; + if ( ind < nbPoints + nodesInFace ) + return SMDS_Mesh::_meshList[myMeshId]->FindNodeVtk( ptIds[ ind + i ]); + nbPoints += nodesInFace; + id += (nodesInFace + 1); + } + return 0; + } vtkIdType npts, *pts; grid->GetCellPoints( this->myVtkID, npts, pts ); const std::vector& interlace = SMDS_MeshCell::fromVtkOrder( VTKCellType( aVtkType )); -- 2.39.2