From: abn Date: Thu, 24 Sep 2020 13:22:41 +0000 (+0200) Subject: clang -Wshorten-64-to-32-bits X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=766feec115b4f1b3bf2d099f8bc94f1fb35bccd3;p=tools%2Fmedcoupling.git clang -Wshorten-64-to-32-bits --- diff --git a/src/INTERP_KERNEL/InterpolationCU.txx b/src/INTERP_KERNEL/InterpolationCU.txx index d17dd78f9..33ec9b242 100644 --- a/src/INTERP_KERNEL/InterpolationCU.txx +++ b/src/INTERP_KERNEL/InterpolationCU.txx @@ -223,7 +223,7 @@ namespace INTERP_KERNEL MatrixType revResult; CConnType sizeT = interpolateMeshes( meshT, meshS, revResult, method ); - UConnType sizeS = revResult.size(); + UConnType sizeS = static_cast(revResult.size()); result.resize( sizeT ); for ( CConnType iS = 0; iS < sizeS; ++iS ) diff --git a/src/INTERP_KERNEL/InterpolationUtils.hxx b/src/INTERP_KERNEL/InterpolationUtils.hxx index de5778c54..8854b3526 100644 --- a/src/INTERP_KERNEL/InterpolationUtils.hxx +++ b/src/INTERP_KERNEL/InterpolationUtils.hxx @@ -1085,7 +1085,7 @@ namespace INTERP_KERNEL return result; } template - inline double distance2( T * a, int inda, T * b, int indb) + inline double distance2( T * a, std::size_t inda, T * b, std::size_t indb) { double result =0; for(int idim =0; idim - bool checkEqualPolygonsOneDirection(T * L1, T * L2, int size1, int size2, int istart1, int istart2, double epsilon, int sign) + bool checkEqualPolygonsOneDirection(T * L1, T * L2, std::size_t size1, std::size_t size2, std::size_t istart1, std::size_t istart2, double epsilon, int sign) { - int i1 = istart1; - int i2 = istart2; - int i1next = ( i1 + 1 ) % size1; - int i2next = ( i2 + sign +size2) % size2; - + std::size_t i1 = istart1; + std::size_t i2 = istart2; + std::size_t i1next = ( i1 + 1 ) % size1; + std::size_t i2next = ( i2 + sign +size2) % size2; + while(true) { while( i1next!=istart1 && distance2(L1,i1*dim, L1,i1next*dim) < epsilon ) i1next = ( i1next + 1 ) % size1; while( i2next!=istart2 && distance2(L2,i2*dim, L2,i2next*dim) < epsilon ) i2next = ( i2next + sign +size2 ) % size2; - + if(i1next == istart1) { if(i2next == istart2) @@ -1326,14 +1326,14 @@ namespace INTERP_KERNEL std::cout << "Warning InterpolationUtils.hxx:checkEqualPolygonsPointer: Null pointer " << std::endl; throw(Exception("big error: not closed polygon...")); } - - int size1 = (*L1).size()/dim; - int size2 = (*L2).size()/dim; - int istart1 = 0; - int istart2 = 0; - + + std::size_t size1 = (*L1).size()/dim; + std::size_t size2 = (*L2).size()/dim; + std::size_t istart1 = 0; + std::size_t istart2 = 0; + while( istart2 < size2 && distance2(L1,istart1*dim, L2,istart2*dim) > epsilon ) istart2++; - + if(istart2 == size2) { return (size1 == 0) && (size2 == 0); diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.cxx index 87c91ab17..dbee07db1 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.cxx @@ -1634,7 +1634,7 @@ void MEDCouplingBasicsTestInterp::testInterpolationCU2D() CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0972222 ,res[4][2],precis); CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0138889 ,res[4][5],precis); - std::vector > resRev; + std::vector > resRev; myInterpolator.interpolateMeshesRev(targetWrapper,sourceWrapper,resRev,"P0P0"); CPPUNIT_ASSERT_DOUBLES_EQUAL( res[0][0] ,resRev[0][0],precis); diff --git a/src/ParaMEDMEM/ParaDataArray.txx b/src/ParaMEDMEM/ParaDataArray.txx index 652b325f2..c27775278 100644 --- a/src/ParaMEDMEM/ParaDataArray.txx +++ b/src/ParaMEDMEM/ParaDataArray.txx @@ -94,7 +94,7 @@ namespace MEDCoupling int rank(-1); ci.commRank(comm,&rank); T vmin(std::numeric_limits::max()),vmax(-std::numeric_limits::max()); - DataArrayTools::GetSlice(0,nbOfElems,1,static_cast(rank),static_cast(size),vmin,vmax); + DataArrayTools::GetSlice(0,nbOfElems,1,ToIdType(rank),ToIdType(size),vmin,vmax); aggregatedIds->applyLin(1,-vmin); MCAuto seqComp(aggregatedIds->buildComplement(ToIdType(vmax-vmin))); seqComp->applyLin(1,ToIdType(vmin)); diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_BlockTopology.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_BlockTopology.cxx index 616a7ec07..a7c9d1598 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_BlockTopology.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_BlockTopology.cxx @@ -94,7 +94,7 @@ void ParaMEDMEMTest::testBlockTopology_constructor() CPPUNIT_ASSERT_EQUAL(global,2*size-1); std::vector > bounds = blocktopo2.getLocalArrayMinMax(); - int vecsize = bounds.size(); + int vecsize = (int)bounds.size(); CPPUNIT_ASSERT_EQUAL(1,vecsize); CPPUNIT_ASSERT_EQUAL(2*rank, (bounds[0]).first); CPPUNIT_ASSERT_EQUAL(ToIdType(2*rank+2), (bounds[0]).second); diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_Gauthier1.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_Gauthier1.cxx index d2c6f4bed..4fae33746 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_Gauthier1.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_Gauthier1.cxx @@ -345,11 +345,11 @@ void ParaMEDMEMTest::testGauthier2() } CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected1[type],pmin,1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected2[type],pmax,1e-12); - - int nbCompo(vitesse->getField()->getNumberOfComponents()); + + std::size_t nbCompo(vitesse->getField()->getNumberOfComponents()); p=vitesse->getField()->getArray()->begin(); for(int i=0;igetField()->getNumberOfTuples();i++) - for(int c=0;c