X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMDS%2FSMDS_MeshCell.cxx;h=2cec46a8c6c50e61cfbea71a280283d0a81fa210;hb=ed49807f170bded5dffd1f25be7b8c5799cdab6b;hp=4aaeed25a3d1068f16bdb5ef5ebe5c771c3fd754;hpb=b7a7d49664daa32e1befb558280e13ed0bde37c9;p=modules%2Fsmesh.git diff --git a/src/SMDS/SMDS_MeshCell.cxx b/src/SMDS/SMDS_MeshCell.cxx index 4aaeed25a..2cec46a8c 100644 --- a/src/SMDS/SMDS_MeshCell.cxx +++ b/src/SMDS/SMDS_MeshCell.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2010-2016 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2010-2020 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -143,7 +143,7 @@ namespace /*isPoly=*/0,/*nbCN=*/6,/*nbN=*/15,/*nbE=*/9,/*nbF=*/5 ); p[ VTK_BIQUADRATIC_QUADRATIC_WEDGE ]. Set( SMDSEntity_BiQuad_Penta, SMDSAbs_Volume, SMDSGeom_PENTA, - /*isPoly=*/0,/*nbCN=*/6,/*nbN=*/21,/*nbE=*/9,/*nbF=*/5 ); + /*isPoly=*/0,/*nbCN=*/6,/*nbN=*/18,/*nbE=*/9,/*nbF=*/5 ); p[ VTK_HEXAGONAL_PRISM]. Set( SMDSEntity_Hexagonal_Prism, SMDSAbs_Volume, SMDSGeom_HEXAGONAL_PRISM, /*isPoly=*/0,/*nbCN=*/12,/*nbN=*/12,/*nbE=*/18,/*nbF=*/8 ); @@ -490,8 +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 = 0; - getGrid()->GetCellPoints( GetVtkID(), npts, pts ); + vtkIdType *pts(nullptr); + vtkIdType const *tmp(nullptr); + getGrid()->GetCellPoints( GetVtkID(), npts, tmp ); + pts = const_cast(tmp); if ( theNbNodes != npts ) { MESSAGE("ChangeNodes problem: not the same number of nodes " << npts << " -> " << theNbNodes); @@ -519,8 +521,7 @@ int SMDS_MeshCell::NbNodes() const { if ( GetVtkType() == VTK_POLYHEDRON ) return static_cast< const SMDS_MeshVolume* >( this )->SMDS_MeshVolume::NbNodes(); - vtkIdType *pts, npts; - getGrid()->GetCellPoints( GetVtkID(), npts, pts ); + vtkIdType npts = getGrid()->GetCells()->GetCellSize( GetVtkID() ); return npts; } @@ -631,7 +632,8 @@ const SMDS_MeshNode* SMDS_MeshCell::GetNode(const int ind) const if ( GetVtkType() == VTK_POLYHEDRON ) return static_cast< const SMDS_MeshVolume* >( this )->SMDS_MeshVolume::GetNode( ind ); - vtkIdType npts, *pts; + vtkIdType npts; + vtkIdType const *pts; getGrid()->GetCellPoints( GetVtkID(), npts, pts ); const std::vector& interlace = SMDS_MeshCell::fromVtkOrder( VTKCellType( GetVtkType() )); return GetMesh()->FindNodeVtk( pts[ interlace.empty() ? ind : interlace[ ind ]]); @@ -639,10 +641,14 @@ const SMDS_MeshNode* SMDS_MeshCell::GetNode(const int ind) const int SMDS_MeshCell::GetNodeIndex( const SMDS_MeshNode* node ) const { + if ( !node || node->IsNull() ) + return -1; + if ( GetVtkType() == VTK_POLYHEDRON ) return static_cast< const SMDS_MeshVolume* >( this )->SMDS_MeshVolume::GetNodeIndex( node ); - vtkIdType npts, *pts; + vtkIdType npts; + vtkIdType const *pts; getGrid()->GetCellPoints( GetVtkID(), npts, pts ); for ( vtkIdType i = 0; i < npts; ++i ) if ( pts[i] == node->GetVtkID() )