From: eap Date: Wed, 3 Mar 2021 15:34:42 +0000 (+0300) Subject: Fix for id shitf +2147483647 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=44811efade4c48516c3ea74f11d579c3c28a617a;p=modules%2Fsmesh.git Fix for id shitf +2147483647 --- diff --git a/src/SMDS/SMDS_ElementFactory.cxx b/src/SMDS/SMDS_ElementFactory.cxx index 1b968993f..bd5a68380 100644 --- a/src/SMDS/SMDS_ElementFactory.cxx +++ b/src/SMDS/SMDS_ElementFactory.cxx @@ -39,8 +39,6 @@ namespace const int theDefaultShapeDim = 3; - const smIdType idShift = 2147483647; - // classes allowing to modify parameters of SMDS_Position stored in SMDS_ElementFactory struct _EdgePosition : public SMDS_EdgePosition @@ -230,7 +228,7 @@ const SMDS_MeshElement* SMDS_ElementFactory::FindElement( const smIdType ID ) co smIdType SMDS_ElementFactory::FromVtkToSmds( vtkIdType VTKID ) { - vtkIdType vtkID = VTKID - idShift; + vtkIdType vtkID = VTKID; if ( vtkID >= 0 && vtkID < (vtkIdType)mySmdsIDs.size() ) return mySmdsIDs[vtkID] + 1; return vtkID + 1 + idShift; @@ -251,7 +249,7 @@ void SMDS_ElementFactory::Free( const SMDS_MeshElement* e ) if ( !myVtkIDs.empty() ) { size_t id = e->GetID() - 1 - idShift; - size_t vtkID = e->GetVtkID() - idShift; + size_t vtkID = e->GetVtkID(); if ( id < myVtkIDs.size() ) myVtkIDs[ id ] = -1; if ( vtkID < mySmdsIDs.size() ) diff --git a/src/SMDS/SMDS_ElementFactory.hxx b/src/SMDS/SMDS_ElementFactory.hxx index 165c0af89..b933e5826 100644 --- a/src/SMDS/SMDS_ElementFactory.hxx +++ b/src/SMDS/SMDS_ElementFactory.hxx @@ -53,6 +53,10 @@ struct _ChunkCompare { typedef boost::ptr_vector TChunkVector; typedef std::set TChunkPtrSet; +const smIdType idShift = 2147483647; + + + //------------------------------------------------------------------------------------ /*! * \brief Allocate SMDS_MeshElement's (SMDS_MeshCell's or SMDS_MeshNode's ) @@ -565,7 +569,7 @@ SMDS_ElementFactory::GetShapeIterator( int shapeID, size_t nbElemsToReturn, const SMDS_MeshElement* sm1stElem ) { - smIdType iChunk = sm1stElem ? (( sm1stElem->GetID() - 1 ) / ChunkSize()) : 0; + smIdType iChunk = sm1stElem ? (( sm1stElem->GetID() - 1 - idShift) / ChunkSize()) : 0; typedef _ChunkIterator< ElemIterator, TSubIDRangeSet > TChuckIterator; return boost::make_shared< TChuckIterator >( myChunks, & SMDS_ElementChunk::GetSubIDRangesMinMax, diff --git a/src/SMDS/SMDS_Mesh.cxx b/src/SMDS/SMDS_Mesh.cxx index a529ee447..46423d9fc 100644 --- a/src/SMDS/SMDS_Mesh.cxx +++ b/src/SMDS/SMDS_Mesh.cxx @@ -1000,7 +1000,7 @@ const SMDS_MeshNode * SMDS_Mesh::FindNode(smIdType ID) const /////////////////////////////////////////////////////////////////////////////// const SMDS_MeshNode * SMDS_Mesh::FindNodeVtk(vtkIdType vtkId) const { - return myNodeFactory->FindNode( vtkId + 1 ); + return myNodeFactory->FindNode( FromVtkToSmds( vtkId )); } const SMDS_MeshElement * SMDS_Mesh::FindElementVtk(vtkIdType IDelem) const