X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMDS%2FSMDS_VtkVolume.cxx;h=7acdbf37c110daff9dae1c5bdc6632384225e5b2;hb=c17253baf7fb323aa6813115204624314e6e749c;hp=7e66a83c8bda851a290415226c788c4c5093c18e;hpb=c2c0a21343037194c319d5aa6674e89a22e9c7a5;p=modules%2Fsmesh.git diff --git a/src/SMDS/SMDS_VtkVolume.cxx b/src/SMDS/SMDS_VtkVolume.cxx index 7e66a83c8..7acdbf37c 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,11 +427,62 @@ 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 )); return SMDS_Mesh::_meshList[myMeshId]->FindNodeVtk( pts[ interlace.empty() ? ind : interlace[ind]] ); } +/*! + * \brief Check if a node belongs to the element + * \param node - the node to check + * \retval int - node index within the element, -1 if not found + */ +int SMDS_VtkVolume::GetNodeIndex( const SMDS_MeshNode* node ) const +{ + vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid(); + const 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; + for (int iF = 0; iF < nFaces; iF++) + { + int nodesInFace = ptIds[id]; + for ( vtkIdType i = 0; i < nodesInFace; ++i ) + if ( ptIds[id+i+1] == node->getVtkId() ) + return id+i-iF; + id += (nodesInFace + 1); + } + return -1; + } + vtkIdType npts, *pts; + grid->GetCellPoints( this->myVtkID, npts, pts ); + for ( vtkIdType i = 0; i < npts; ++i ) + if ( pts[i] == node->getVtkId() ) + { + const std::vector& interlace = SMDS_MeshCell::toVtkOrder( VTKCellType( aVtkType )); + return interlace.empty() ? i : interlace[i]; + } + return -1; +} bool SMDS_VtkVolume::IsQuadratic() const {