From c58cc9d1ecd22ee3c49d54360f2f5f6f108da70a Mon Sep 17 00:00:00 2001 From: Viktor UZLOV Date: Mon, 8 Feb 2021 18:24:01 +0300 Subject: [PATCH] fix warnings conversion #1 --- src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx | 2 +- src/SMDS/SMDS_ElementFactory.cxx | 16 ++++++++-------- src/SMDS/SMDS_Mesh.cxx | 8 ++++---- src/SMDS/SMDS_UnstructuredGrid.cxx | 10 +++++----- src/SMESHDS/SMESHDS_GroupBase.cxx | 4 ++-- src/SMESHDS/SMESHDS_GroupOnFilter.cxx | 10 +++++----- src/SMESHUtils/SMESH_MeshAlgos.cxx | 6 +++--- src/SMESHUtils/SMESH_Offset.cxx | 12 ++++++------ src/SMESHUtils/SMESH_Slot.cxx | 2 +- 9 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx b/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx index ac7cb640f..fac44fc86 100644 --- a/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx +++ b/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx @@ -270,7 +270,7 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform() aNodeIds.assign( aBallInfo->myConn->begin(), aBallInfo->myConn->end()); // allocate array of diameters - vtkIdType maxID = myMesh->MaxElementID() + aNbBalls; + vtkIdType maxID = FromIdType(myMesh->MaxElementID() + aNbBalls); if ( anIsElemNum && !aBallInfo->myElemNum->empty() ) maxID = *std::max_element( aBallInfo->myElemNum->begin(), aBallInfo->myElemNum->end() ); diff --git a/src/SMDS/SMDS_ElementFactory.cxx b/src/SMDS/SMDS_ElementFactory.cxx index 1c9a3cbe3..4ac7ca9aa 100644 --- a/src/SMDS/SMDS_ElementFactory.cxx +++ b/src/SMDS/SMDS_ElementFactory.cxx @@ -178,11 +178,11 @@ SMDS_MeshElement* SMDS_ElementFactory::NewElement( const smIdType id ) smIdType id0 = myChunks.size() * theChunkSize + 1; myChunks.push_back( new SMDS_ElementChunk( this, id0 )); } - SMDS_MeshElement* e = myChunks[iChunk].Element( index ); + SMDS_MeshElement* e = myChunks[iChunk].Element( FromIdType(index) ); if ( !e->IsNull() ) return 0; // element with given ID already exists - myChunks[iChunk].UseElement( index ); + myChunks[iChunk].UseElement( FromIdType(index) ); ++myNbUsedElements; e->myHolder = & myChunks[iChunk]; @@ -208,7 +208,7 @@ const SMDS_MeshElement* SMDS_ElementFactory::FindElement( const smIdType id ) co smIdType index = ( id - 1 ) % theChunkSize; if ( iChunk < (smIdType) myChunks.size() ) { - const SMDS_MeshElement* e = myChunks[iChunk].Element( index ); + const SMDS_MeshElement* e = myChunks[iChunk].Element( FromIdType(index) ); return e->IsNull() ? 0 : e; } } @@ -314,7 +314,7 @@ void SMDS_ElementFactory::Compact( std::vector& theVtkIDsNewToOld ) const SMDS_MeshElement* newElem = FindElement( newVtkID ); if ( !newElem ) newElem = NewElement( newVtkID ); - if ( smIdType shapeID = oldElem->GetShapeID() ) + if ( int shapeID = oldElem->GetShapeID() ) const_cast< SMDS_MeshElement* >( newElem )->setShapeID( shapeID ); if ( oldID > newNbCells ) Free( oldElem ); @@ -584,7 +584,7 @@ smIdType SMDS_ElementChunk::GetUnusedID() const void SMDS_ElementChunk::Free( const SMDS_MeshElement* e ) { bool hasHoles = ( myUsedRanges.Size() > 1 ); - myUsedRanges.SetValue( Index( e ), false ); + myUsedRanges.SetValue( FromIdType(Index( e )), false ); SetShapeID( e, 0 ); // sub-mesh must do it? SetIsMarked( e, false ); if ( !hasHoles ) @@ -646,7 +646,7 @@ void SMDS_ElementChunk::SetVTKID( const SMDS_MeshElement* e, const vtkIdType vtk vtkIdType SMDS_ElementChunk::GetVtkID( const SMDS_MeshElement* e ) const { - vtkIdType dfltVtkID = e->GetID() - 1; + vtkIdType dfltVtkID = FromIdType(e->GetID() - 1); return ( dfltVtkID < (vtkIdType)myFactory->myVtkIDs.size() ) ? myFactory->myVtkIDs[ dfltVtkID ] : dfltVtkID; } @@ -658,7 +658,7 @@ vtkIdType SMDS_ElementChunk::GetVtkID( const SMDS_MeshElement* e ) const int SMDS_ElementChunk::GetShapeID( const SMDS_MeshElement* e ) const { - return mySubIDRanges.GetValue( Index( e )); + return mySubIDRanges.GetValue( FromIdType(Index( e ))); } //================================================================================ @@ -672,7 +672,7 @@ void SMDS_ElementChunk::SetShapeID( const SMDS_MeshElement* e, int shapeID ) con //const size_t nbRanges = mySubIDRanges.Size(); SMDS_ElementChunk* me = const_cast( this ); - int oldShapeID = me->mySubIDRanges.SetValue( Index( e ), shapeID ); + int oldShapeID = me->mySubIDRanges.SetValue( FromIdType(Index( e )), shapeID ); if ( oldShapeID == shapeID ) return; if ( const SMDS_MeshNode* n = dynamic_cast< const SMDS_MeshNode* >( e )) diff --git a/src/SMDS/SMDS_Mesh.cxx b/src/SMDS/SMDS_Mesh.cxx index 52bd75e80..f2934ce25 100644 --- a/src/SMDS/SMDS_Mesh.cxx +++ b/src/SMDS/SMDS_Mesh.cxx @@ -815,9 +815,9 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1, SMDS_MeshFace* SMDS_Mesh::AddPolygonalFaceWithID (const std::vector & nodes_ids, const smIdType ID) { - int nbNodes = nodes_ids.size(); + smIdType nbNodes = nodes_ids.size(); std::vector nodes (nbNodes); - for (int i = 0; i < nbNodes; i++) { + for (smIdType i = 0; i < nbNodes; i++) { nodes[i] = myNodeFactory->FindNode( nodes_ids[i] ); if (!nodes[i]) return NULL; } @@ -911,9 +911,9 @@ SMDS_MeshVolume * SMDS_Mesh::AddPolyhedralVolumeWithID (const std::vector & quantities, const smIdType ID) { - int nbNodes = nodes_ids.size(); + smIdType nbNodes = nodes_ids.size(); std::vector nodes (nbNodes); - for (int i = 0; i < nbNodes; i++) { + for (smIdType i = 0; i < nbNodes; i++) { nodes[i] = myNodeFactory->FindNode(nodes_ids[i]); if (!nodes[i]) return NULL; } diff --git a/src/SMDS/SMDS_UnstructuredGrid.cxx b/src/SMDS/SMDS_UnstructuredGrid.cxx index 6ce4bb03b..ca5b300bf 100644 --- a/src/SMDS/SMDS_UnstructuredGrid.cxx +++ b/src/SMDS/SMDS_UnstructuredGrid.cxx @@ -298,16 +298,16 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector& idNodesOldToNew, { smIdType oldCellId = idCellsNewToOld[ newCellID ]; newFaceLocations->InsertNextValue( newFaces->GetMaxId()+1 ); - smIdType oldFaceLoc = this->FaceLocations->GetValue( oldCellId ); - smIdType nCellFaces = this->Faces->GetValue( oldFaceLoc++ ); - newFaces->InsertNextValue( nCellFaces ); + smIdType oldFaceLoc = this->FaceLocations->GetValue( FromIdType(oldCellId) ); + smIdType nCellFaces = this->Faces->GetValue( FromIdType(oldFaceLoc++) ); + newFaces->InsertNextValue( FromIdType(nCellFaces) ); for ( int n = 0; n < nCellFaces; n++ ) { - int nptsInFace = this->Faces->GetValue( oldFaceLoc++ ); + int nptsInFace = this->Faces->GetValue( FromIdType(oldFaceLoc++) ); newFaces->InsertNextValue( nptsInFace ); for ( int k = 0; k < nptsInFace; k++ ) { - vtkIdType oldpt = this->Faces->GetValue( oldFaceLoc++ ); + vtkIdType oldpt = this->Faces->GetValue( FromIdType(oldFaceLoc++) ); newFaces->InsertNextValue( idNodesOldToNew[ oldpt ]); } } diff --git a/src/SMESHDS/SMESHDS_GroupBase.cxx b/src/SMESHDS/SMESHDS_GroupBase.cxx index 50ac2ee74..e6a9799be 100644 --- a/src/SMESHDS/SMESHDS_GroupBase.cxx +++ b/src/SMESHDS/SMESHDS_GroupBase.cxx @@ -64,7 +64,7 @@ int SMESHDS_GroupBase::GetID (const int theIndex) } while (myCurIndex < theIndex && myIterator->more()) { myCurIndex++; - myCurID = myIterator->next()->GetID(); + myCurID = FromIdType(myIterator->next()->GetID()); } return myCurIndex == theIndex ? myCurID : -1; } @@ -154,7 +154,7 @@ bool SMESHDS_GroupBase::Contains (const int theID) bool SMESHDS_GroupBase::Contains (const SMDS_MeshElement* elem) { if ( elem ) - return Contains( elem->GetID() ); + return Contains( FromIdType(elem->GetID()) ); return false; } diff --git a/src/SMESHDS/SMESHDS_GroupOnFilter.cxx b/src/SMESHDS/SMESHDS_GroupOnFilter.cxx index 3d8f98fc9..e11f228c0 100644 --- a/src/SMESHDS/SMESHDS_GroupOnFilter.cxx +++ b/src/SMESHDS/SMESHDS_GroupOnFilter.cxx @@ -315,7 +315,7 @@ int SMESHDS_GroupOnFilter::getElementIds( void* ids, size_t idSize ) const if ( IsUpToDate() ) { for ( ; elIt->more(); curID += idSize ) - (*(int*) curID) = elIt->next()->GetID(); + (*(int*) curID) = FromIdType(elIt->next()->GetID()); } else { @@ -325,11 +325,11 @@ int SMESHDS_GroupOnFilter::getElementIds( void* ids, size_t idSize ) const me->myMeshInfo.assign( SMDSEntity_Last, 0 ); me->myMeshInfo[ firstOkElem->GetEntityType() ]++; - (*(int*) curID) = firstOkElem->GetID(); + (*(int*) curID) = FromIdType(firstOkElem->GetID()); for ( curID += idSize; elIt->more(); curID += idSize ) { const SMDS_MeshElement* e = elIt->next(); - (*(int*) curID) = e->GetID(); + (*(int*) curID) = FromIdType(e->GetID()); me->myMeshInfo[ e->GetEntityType() ]++; } } @@ -443,7 +443,7 @@ bool SMESHDS_GroupOnFilter::updateParallel() const return false; // no sense in parallel work SMDS_ElemIteratorPtr elemIt = GetMesh()->elementsIterator( GetType() ); - const int minID = elemIt->next()->GetID(); + const smIdType minID = elemIt->next()->GetID(); myPredicate->IsSatisfy( minID ); // make myPredicate fully initialized for clone() SMESH_PredicatePtr clone( myPredicate->clone() ); if ( !clone ) @@ -452,7 +452,7 @@ bool SMESHDS_GroupOnFilter::updateParallel() const TLocalPredicat threadPredicates; threadPredicates.local() = clone; - int maxID = ( GetType() == SMDSAbs_Node ) ? GetMesh()->MaxNodeID() : GetMesh()->MaxElementID(); + smIdType maxID = ( GetType() == SMDSAbs_Node ) ? GetMesh()->MaxNodeID() : GetMesh()->MaxElementID(); vector< char > isElemOK( 1 + maxID ); tbb::parallel_for ( tbb::blocked_range( 0, isElemOK.size() ), diff --git a/src/SMESHUtils/SMESH_MeshAlgos.cxx b/src/SMESHUtils/SMESH_MeshAlgos.cxx index 3bc48ff24..c5bed4dad 100644 --- a/src/SMESHUtils/SMESH_MeshAlgos.cxx +++ b/src/SMESHUtils/SMESH_MeshAlgos.cxx @@ -281,7 +281,7 @@ namespace // Utils used in SMESH_ElementSearcherImpl::FindElementsByPoint() double tolerance) :SMESH_Octree( new LimitAndPool() ) { - int nbElems = mesh.GetMeshInfo().NbElements( elemType ); + smIdType nbElems = mesh.GetMeshInfo().NbElements( elemType ); _elements.reserve( nbElems ); TElementBoxPool& elBoPool = getLimitAndPool()->_elBoPool; @@ -1981,7 +1981,7 @@ SMESH_MeshAlgos::FindSharpEdges( SMDS_Mesh* theMesh, typedef std::pair< bool, const SMDS_MeshNode* > TIsSharpAndMedium; typedef NCollection_DataMap< SMESH_TLink, TIsSharpAndMedium, SMESH_TLink > TLinkSharpMap; - TLinkSharpMap linkIsSharp( theMesh->NbFaces() ); + TLinkSharpMap linkIsSharp( FromIdType(theMesh->NbFaces()) ); TIsSharpAndMedium sharpMedium( true, 0 ); bool & isSharp = sharpMedium.first; const SMDS_MeshNode* & nMedium = sharpMedium.second; @@ -2088,7 +2088,7 @@ SMESH_MeshAlgos::SeparateFacesByEdges( SMDS_Mesh* theMesh, const std::vector< Ed typedef std::vector< const SMDS_MeshElement* > TFaceVec; typedef NCollection_DataMap< SMESH_TLink, TFaceVec, SMESH_TLink > TFacesByLinks; - TFacesByLinks facesByLink( theMesh->NbFaces() ); + TFacesByLinks facesByLink( FromIdType(theMesh->NbFaces()) ); std::vector< const SMDS_MeshNode* > faceNodes; for ( SMDS_FaceIteratorPtr faceIt = theMesh->facesIterator(); faceIt->more(); ) diff --git a/src/SMESHUtils/SMESH_Offset.cxx b/src/SMESHUtils/SMESH_Offset.cxx index 97e299261..914c68241 100644 --- a/src/SMESHUtils/SMESH_Offset.cxx +++ b/src/SMESHUtils/SMESH_Offset.cxx @@ -1933,7 +1933,7 @@ namespace SMESH_MeshAlgos for ( ; cutFacesIt != myCutFaces.cend(); ++cutFacesIt ) { const CutFace& cf = *cutFacesIt; - int index = cf.myInitFace->GetID(); // index in theNew2OldFaces + smIdType index = cf.myInitFace->GetID(); // index in theNew2OldFaces if ((int) theNew2OldFaces.size() <= index ) theNew2OldFaces.resize( index + 1 ); theNew2OldFaces[ index ] = std::make_pair( cf.myInitFace, index ); @@ -2004,7 +2004,7 @@ namespace SMESH_MeshAlgos // erase loops that are cut off by face intersections cf.CutOffLoops( loopSet, theSign, myNormals, cutOffLinks, cutOffCoplanarLinks ); - int index = cf.myInitFace->GetID(); // index in theNew2OldFaces + smIdType index = cf.myInitFace->GetID(); // index in theNew2OldFaces const SMDS_MeshElement* tria; for ( size_t iL = 0; iL < loopSet.myNbLoops; ++iL ) @@ -2094,7 +2094,7 @@ namespace SMESH_MeshAlgos continue; for ( size_t iF = 0; iF < faces.size(); ++iF ) { - int index = faces[iF]->GetID(); + smIdType index = faces[iF]->GetID(); // if ( //faces[iF]->isMarked() || // kept part of cutFace // !theNew2OldFaces[ index ].first ) // already removed // continue; @@ -2126,7 +2126,7 @@ namespace SMESH_MeshAlgos if ( cf.myInitFace->IsNull() ) continue; - int index = cf.myInitFace->GetID(); // index in theNew2OldFaces + smIdType index = cf.myInitFace->GetID(); // index in theNew2OldFaces if ( !theNew2OldFaces[ index ].first ) continue; // already cut off @@ -3226,7 +3226,7 @@ SMDS_Mesh* SMESH_MeshAlgos::MakeOffset( SMDS_ElemIteratorPtr theFaceIt, for ( SMDS_ElemIteratorPtr fIt = newNode->GetInverseElementIterator(); fIt->more(); ) { const SMDS_MeshElement* newFace = fIt->next(); - const int faceIndex = newFace->GetID(); + const int faceIndex = FromIdType(newFace->GetID()); const gp_XYZ& oldNorm = normals[ faceIndex ]; const gp_XYZ newXYZ = oldXYZ + oldNorm * theOffset; if ( multiPos.empty() ) @@ -3275,7 +3275,7 @@ SMDS_Mesh* SMESH_MeshAlgos::MakeOffset( SMDS_ElemIteratorPtr theFaceIt, for ( SMDS_ElemIteratorPtr fIt = newNode->GetInverseElementIterator(); fIt->more(); ) { const SMDS_MeshElement* newFace = fIt->next(); - const int faceIndex = newFace->GetID(); + const int faceIndex = FromIdType(newFace->GetID()); const gp_XYZ& oldNorm = normals[ faceIndex ]; if ( !SMESH_MeshAlgos::FaceNormal( newFace, faceNorm, /*normalize=*/false ) || //faceNorm * moveVec < 0 ) diff --git a/src/SMESHUtils/SMESH_Slot.cxx b/src/SMESHUtils/SMESH_Slot.cxx index 33c16aa27..910ef74f0 100644 --- a/src/SMESHUtils/SMESH_Slot.cxx +++ b/src/SMESHUtils/SMESH_Slot.cxx @@ -391,7 +391,7 @@ namespace theWorkGroups.push_back( theGroupsToUpdate[i] ); if ( !theWorkGroups.empty() ) - theFaceID2Groups.Bind( theFace->GetID(), theWorkGroups ); + theFaceID2Groups.Bind( FromIdType(theFace->GetID()), theWorkGroups ); } //================================================================================ -- 2.39.2