fix warnings conversion #1

This commit is contained in:
Viktor UZLOV 2021-02-08 18:24:01 +03:00
parent 5179ca5621
commit c58cc9d1ec
9 changed files with 35 additions and 35 deletions

View File

@ -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<vtkIdType>(myMesh->MaxElementID() + aNbBalls);
if ( anIsElemNum && !aBallInfo->myElemNum->empty() )
maxID = *std::max_element( aBallInfo->myElemNum->begin(),
aBallInfo->myElemNum->end() );

View File

@ -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<int>(index) );
if ( !e->IsNull() )
return 0; // element with given ID already exists
myChunks[iChunk].UseElement( index );
myChunks[iChunk].UseElement( FromIdType<int>(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<int>(index) );
return e->IsNull() ? 0 : e;
}
}
@ -314,7 +314,7 @@ void SMDS_ElementFactory::Compact( std::vector<smIdType>& 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<int>(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<vtkIdType>(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<int>(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<SMDS_ElementChunk*>( this );
int oldShapeID = me->mySubIDRanges.SetValue( Index( e ), shapeID );
int oldShapeID = me->mySubIDRanges.SetValue( FromIdType<int>(Index( e )), shapeID );
if ( oldShapeID == shapeID ) return;
if ( const SMDS_MeshNode* n = dynamic_cast< const SMDS_MeshNode* >( e ))

View File

@ -815,9 +815,9 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
SMDS_MeshFace* SMDS_Mesh::AddPolygonalFaceWithID (const std::vector<smIdType> & nodes_ids,
const smIdType ID)
{
int nbNodes = nodes_ids.size();
smIdType nbNodes = nodes_ids.size();
std::vector<const SMDS_MeshNode*> 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<smIdTy
const std::vector<int> & quantities,
const smIdType ID)
{
int nbNodes = nodes_ids.size();
smIdType nbNodes = nodes_ids.size();
std::vector<const SMDS_MeshNode*> 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;
}

View File

@ -298,16 +298,16 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<smIdType>& 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<int>(oldCellId) );
smIdType nCellFaces = this->Faces->GetValue( FromIdType<int>(oldFaceLoc++) );
newFaces->InsertNextValue( FromIdType<int>(nCellFaces) );
for ( int n = 0; n < nCellFaces; n++ )
{
int nptsInFace = this->Faces->GetValue( oldFaceLoc++ );
int nptsInFace = this->Faces->GetValue( FromIdType<int>(oldFaceLoc++) );
newFaces->InsertNextValue( nptsInFace );
for ( int k = 0; k < nptsInFace; k++ )
{
vtkIdType oldpt = this->Faces->GetValue( oldFaceLoc++ );
vtkIdType oldpt = this->Faces->GetValue( FromIdType<int>(oldFaceLoc++) );
newFaces->InsertNextValue( idNodesOldToNew[ oldpt ]);
}
}

View File

@ -64,7 +64,7 @@ int SMESHDS_GroupBase::GetID (const int theIndex)
}
while (myCurIndex < theIndex && myIterator->more()) {
myCurIndex++;
myCurID = myIterator->next()->GetID();
myCurID = FromIdType<int>(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<int>(elem->GetID()) );
return false;
}

View File

@ -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<int>(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<int>(firstOkElem->GetID());
for ( curID += idSize; elIt->more(); curID += idSize )
{
const SMDS_MeshElement* e = elIt->next();
(*(int*) curID) = e->GetID();
(*(int*) curID) = FromIdType<int>(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<size_t>( 0, isElemOK.size() ),

View File

@ -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<int>(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<int>(theMesh->NbFaces()) );
std::vector< const SMDS_MeshNode* > faceNodes;
for ( SMDS_FaceIteratorPtr faceIt = theMesh->facesIterator(); faceIt->more(); )

View File

@ -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<int>(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<int>(newFace->GetID());
const gp_XYZ& oldNorm = normals[ faceIndex ];
if ( !SMESH_MeshAlgos::FaceNormal( newFace, faceNorm, /*normalize=*/false ) ||
//faceNorm * moveVec < 0 )

View File

@ -391,7 +391,7 @@ namespace
theWorkGroups.push_back( theGroupsToUpdate[i] );
if ( !theWorkGroups.empty() )
theFaceID2Groups.Bind( theFace->GetID(), theWorkGroups );
theFaceID2Groups.Bind( FromIdType<int>(theFace->GetID()), theWorkGroups );
}
//================================================================================