From 3823057777d65af7e11722669799fc4078343094 Mon Sep 17 00:00:00 2001 From: Eugeny MALTCHIKOV Date: Tue, 22 Oct 2019 09:08:38 +0300 Subject: [PATCH] LOT 1: Enabling the -Wsign-compare and -Wconversion warnings in MEDCoupling and MEDCouplingRemapper packages. Using size_t instead of int (where possible) in INTERP_KERNEL. Eliminating warnings in MEDCouplingRemapper - Eliminating Wconversion warnings - Eliminating Wsign-compare warnings - Using MeshType::MyConnType instead of int Eliminating warnings in medcouplingcpp package - Eliminating Wconversion warnings - Eliminating Wsign-compare warnings --- src/INTERP_KERNEL/BBTreeDst.txx | 2 +- .../Barycentric3DIntersectorP1P1.txx | 6 +- .../Bases/InterpKernelHashTable.hxx | 26 +- src/INTERP_KERNEL/ConvexIntersector.txx | 8 +- src/INTERP_KERNEL/CurveIntersector.txx | 4 +- src/INTERP_KERNEL/DirectedBoundingBox.cxx | 6 +- .../InterpKernelGeo2DAbstractEdge.cxx | 4 +- src/INTERP_KERNEL/Geometric2DIntersector.txx | 20 +- .../IntegralUniformIntersector.txx | 8 +- src/INTERP_KERNEL/InterpKernelUtilities.hxx | 3 + src/INTERP_KERNEL/Interpolation.txx | 5 +- src/INTERP_KERNEL/Interpolation1D0D.cxx | 4 +- src/INTERP_KERNEL/Interpolation1D0D.txx | 10 +- src/INTERP_KERNEL/Interpolation2D1D.txx | 4 +- src/INTERP_KERNEL/Interpolation2D3D.txx | 16 +- src/INTERP_KERNEL/Interpolation3D.hxx | 86 +-- src/INTERP_KERNEL/Interpolation3D.txx | 16 +- src/INTERP_KERNEL/Interpolation3D1D.cxx | 4 +- src/INTERP_KERNEL/Interpolation3D1D.hxx | 90 +-- src/INTERP_KERNEL/Interpolation3D1D.txx | 16 +- src/INTERP_KERNEL/InterpolationCC.txx | 6 +- src/INTERP_KERNEL/InterpolationCU.hxx | 1 + src/INTERP_KERNEL/InterpolationCU.txx | 2 +- src/INTERP_KERNEL/InterpolationCurve.hxx | 88 +-- src/INTERP_KERNEL/InterpolationCurve.txx | 6 +- src/INTERP_KERNEL/InterpolationPlanar.hxx | 118 +-- src/INTERP_KERNEL/InterpolationPlanar.txx | 6 +- src/INTERP_KERNEL/InterpolationUtils.hxx | 16 +- src/INTERP_KERNEL/IntersectorCU.txx | 4 +- .../MappedBarycentric2DIntersectorP1P1.txx | 4 +- .../MappedBarycentric3DIntersectorP1P1.hxx | 1 + .../MappedBarycentric3DIntersectorP1P1.txx | 6 +- src/INTERP_KERNEL/MeshElement.txx | 2 +- src/INTERP_KERNEL/PlanarIntersector.txx | 4 +- src/INTERP_KERNEL/PlanarIntersectorP0P1.hxx | 1 + src/INTERP_KERNEL/PlanarIntersectorP0P1.txx | 2 +- .../PlanarIntersectorP0P1Bary.txx | 6 +- src/INTERP_KERNEL/PlanarIntersectorP0P1PL.txx | 6 +- src/INTERP_KERNEL/PlanarIntersectorP1P0.txx | 2 +- .../PlanarIntersectorP1P0Bary.txx | 6 +- src/INTERP_KERNEL/PlanarIntersectorP1P0PL.txx | 2 +- src/INTERP_KERNEL/PlanarIntersectorP1P1.txx | 6 +- src/INTERP_KERNEL/PlanarIntersectorP1P1PL.txx | 4 +- .../PointLocator2DIntersector.txx | 4 +- .../PointLocator3DIntersectorP0P0.hxx | 1 + .../PointLocator3DIntersectorP0P0.txx | 4 +- .../PointLocator3DIntersectorP0P1.hxx | 1 + .../PointLocator3DIntersectorP0P1.txx | 6 +- .../PointLocator3DIntersectorP1P0.hxx | 1 + .../PointLocator3DIntersectorP1P0.txx | 4 +- .../PointLocator3DIntersectorP1P1.hxx | 1 + .../PointLocator3DIntersectorP1P1.txx | 6 +- src/INTERP_KERNEL/PolygonAlgorithms.txx | 4 +- .../PolyhedronIntersectorP1P0Bary.txx | 4 +- .../PolyhedronIntersectorP1P1.txx | 8 +- src/INTERP_KERNEL/SplitterTetra.txx | 10 +- .../TriangulationIntersector.txx | 16 +- .../InterpolationPlanarTestSuite.hxx | 16 +- src/MEDCoupling/CMakeLists.txt | 4 + src/MEDCoupling/MCType.hxx | 5 +- src/MEDCoupling/MEDCoupling1GTUMesh.cxx | 146 ++-- src/MEDCoupling/MEDCoupling1GTUMesh.txx | 4 +- src/MEDCoupling/MEDCouplingAMRAttribute.cxx | 4 +- src/MEDCoupling/MEDCouplingCMesh.cxx | 28 +- .../MEDCouplingCartesianAMRMesh.cxx | 20 +- .../MEDCouplingCurveLinearMesh.cxx | 39 +- .../MEDCouplingFieldDiscretization.cxx | 92 +-- src/MEDCoupling/MEDCouplingFieldDouble.cxx | 30 +- src/MEDCoupling/MEDCouplingFieldT.txx | 6 +- .../MEDCouplingGaussLocalization.cxx | 4 +- src/MEDCoupling/MEDCouplingIMesh.cxx | 79 ++- .../MEDCouplingMappedExtrudedMesh.cxx | 35 +- src/MEDCoupling/MEDCouplingMatrix.cxx | 6 +- src/MEDCoupling/MEDCouplingMemArray.cxx | 671 +++++++++--------- src/MEDCoupling/MEDCouplingMemArray.hxx | 10 +- src/MEDCoupling/MEDCouplingMemArray.txx | 315 ++++---- src/MEDCoupling/MEDCouplingMemArrayChar.cxx | 94 +-- src/MEDCoupling/MEDCouplingMemArrayFloat.cxx | 8 +- src/MEDCoupling/MEDCouplingMesh.cxx | 6 +- .../MEDCouplingNormalizedCartesianMesh.hxx | 4 +- .../MEDCouplingNormalizedCartesianMesh.txx | 4 +- .../MEDCouplingNormalizedUnstructuredMesh.hxx | 1 + .../MEDCouplingNormalizedUnstructuredMesh.txx | 12 +- src/MEDCoupling/MEDCouplingPartDefinition.cxx | 2 +- src/MEDCoupling/MEDCouplingPointSet.cxx | 28 +- src/MEDCoupling/MEDCouplingRemapper.cxx | 30 +- src/MEDCoupling/MEDCouplingSkyLineArray.cxx | 36 +- src/MEDCoupling/MEDCouplingSkyLineArray.hxx | 6 +- src/MEDCoupling/MEDCouplingStructuredMesh.cxx | 46 +- .../MEDCouplingTimeDiscretization.cxx | 13 +- .../MEDCouplingTimeDiscretization.txx | 14 +- src/MEDCoupling/MEDCouplingUMesh.cxx | 291 ++++---- src/MEDCoupling/MEDCouplingUMesh.txx | 2 +- src/MEDCoupling/MEDCouplingUMesh_internal.cxx | 80 ++- src/MEDCoupling/MEDCouplingUMesh_internal.hxx | 6 +- .../MEDCouplingUMesh_intersection.cxx | 120 ++-- src/MEDCoupling/MEDCouplingVoronoi.cxx | 28 +- .../Test/MEDCouplingBasicsTest0.cxx | 2 +- .../Test/MEDCouplingBasicsTest1.cxx | 8 +- .../Test/MEDCouplingBasicsTest2.cxx | 12 +- .../Test/MEDCouplingBasicsTest4.cxx | 2 +- 101 files changed, 1580 insertions(+), 1496 deletions(-) mode change 100644 => 100755 src/INTERP_KERNEL/BBTreeDst.txx mode change 100644 => 100755 src/INTERP_KERNEL/IntegralUniformIntersector.txx mode change 100644 => 100755 src/INTERP_KERNEL/Interpolation.txx mode change 100644 => 100755 src/INTERP_KERNEL/Interpolation1D0D.txx mode change 100644 => 100755 src/INTERP_KERNEL/Interpolation2D1D.txx mode change 100644 => 100755 src/INTERP_KERNEL/Interpolation2D3D.txx mode change 100644 => 100755 src/INTERP_KERNEL/Interpolation3D.hxx mode change 100644 => 100755 src/INTERP_KERNEL/Interpolation3D.txx mode change 100644 => 100755 src/INTERP_KERNEL/Interpolation3D1D.hxx mode change 100644 => 100755 src/INTERP_KERNEL/Interpolation3D1D.txx mode change 100644 => 100755 src/INTERP_KERNEL/InterpolationCurve.hxx mode change 100644 => 100755 src/INTERP_KERNEL/InterpolationCurve.txx mode change 100644 => 100755 src/INTERP_KERNEL/InterpolationPlanar.hxx mode change 100644 => 100755 src/INTERP_KERNEL/InterpolationPlanar.txx mode change 100644 => 100755 src/INTERP_KERNEL/MeshElement.txx mode change 100644 => 100755 src/INTERP_KERNEL/PlanarIntersectorP0P1Bary.txx mode change 100644 => 100755 src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.txx mode change 100644 => 100755 src/INTERP_KERNEL/PolyhedronIntersectorP1P0Bary.txx mode change 100644 => 100755 src/INTERP_KERNEL/PolyhedronIntersectorP1P1.txx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingAMRAttribute.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingCMesh.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingFieldDiscretization.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingFieldDouble.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingIMesh.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingMatrix.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingMemArray.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingMemArray.txx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingMemArrayChar.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingMesh.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingPointSet.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingRemapper.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingSkyLineArray.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingStructuredMesh.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingUMesh.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingUMesh_internal.cxx mode change 100644 => 100755 src/MEDCoupling/MEDCouplingVoronoi.cxx diff --git a/src/INTERP_KERNEL/BBTreeDst.txx b/src/INTERP_KERNEL/BBTreeDst.txx old mode 100644 new mode 100755 index 70753ded3..b8931777f --- a/src/INTERP_KERNEL/BBTreeDst.txx +++ b/src/INTERP_KERNEL/BBTreeDst.txx @@ -204,7 +204,7 @@ public: for (int idim=0; idim((( (0. CoordsT; const ConnType *startOfCellNodeConnT=Intersector3DP1P1::getStartConnOfTargetCell(targetCell); Intersector3DP1P1::getRealTargetCoordinates(OTT::indFC(targetCell),CoordsT); - int nbOfNodesT=CoordsT.size()/SPACEDIM; + std::size_t nbOfNodesT=CoordsT.size()/SPACEDIM; const double *coordsS=Intersector3DP1P1::_src_mesh.getCoordinatesPtr(); - for(int nodeIdT=0;nodeIdT::ind2C(startOfCellNodeConnT[nodeIdT])]; if(!resRow.empty()) @@ -72,7 +72,7 @@ namespace INTERP_KERNEL // std::vector connOfCurCellS; Intersector3DP1P1::getConnOfSourceCell(OTT::indFC(*iterCellS),connOfCurCellS); - if( PointLocatorAlgos::isElementContainsPointAlg3D(&CoordsT[nodeIdT*SPACEDIM],&connOfCurCellS[0],connOfCurCellS.size(),coordsS,cmTypeS,_precision) ) + if( PointLocatorAlgos::isElementContainsPointAlg3D(&CoordsT[nodeIdT*SPACEDIM],&connOfCurCellS[0],ToConnType(connOfCurCellS.size()),coordsS,cmTypeS,_precision) ) { double resLoc[4]; std::vector localCoordsS; diff --git a/src/INTERP_KERNEL/Bases/InterpKernelHashTable.hxx b/src/INTERP_KERNEL/Bases/InterpKernelHashTable.hxx index 72938a4ef..860dd3f9a 100644 --- a/src/INTERP_KERNEL/Bases/InterpKernelHashTable.hxx +++ b/src/INTERP_KERNEL/Bases/InterpKernelHashTable.hxx @@ -195,22 +195,22 @@ namespace INTERP_KERNEL // Note: assumes long is at least 32 bits. enum { _S_num_primes = 28 }; - static const unsigned long __stl_prime_list[_S_num_primes] = + static const unsigned long long __stl_prime_list[_S_num_primes] = { - 53ul, 97ul, 193ul, 389ul, 769ul, - 1543ul, 3079ul, 6151ul, 12289ul, 24593ul, - 49157ul, 98317ul, 196613ul, 393241ul, 786433ul, - 1572869ul, 3145739ul, 6291469ul, 12582917ul, 25165843ul, - 50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul, - 1610612741ul, 3221225473ul, 4294967291ul + 53ull, 97ull, 193ull, 389ull, 769ull, + 1543ull, 3079ull, 6151ull, 12289ull, 24593ull, + 49157ull, 98317ull, 196613ull, 393241ull, 786433ull, + 1572869ull, 3145739ull, 6291469ull, 12582917ull, 25165843ull, + 50331653ull, 100663319ull, 201326611ull, 402653189ull, 805306457ull, + 1610612741ull, 3221225473ull, 4294967291ull }; - inline unsigned long - __stl_next_prime(unsigned long __n) + inline unsigned long long + __stl_next_prime(unsigned long long __n) { - const unsigned long* __first = __stl_prime_list; - const unsigned long* __last = __stl_prime_list + (int)_S_num_primes; - const unsigned long* pos = std::lower_bound(__first, __last, __n); + const unsigned long long* __first = __stl_prime_list; + const unsigned long long* __last = __stl_prime_list + (int)_S_num_primes; + const unsigned long long* pos = std::lower_bound(__first, __last, __n); return pos == __last ? *(__last - 1) : *pos; } @@ -497,7 +497,7 @@ namespace INTERP_KERNEL void clear(); private: - size_type _M_next_size(size_type __n) const { return __stl_next_prime(__n); } + size_type _M_next_size(size_type __n) const { return static_cast(__stl_next_prime(__n)); } void _M_initialize_buckets(size_type __n) { diff --git a/src/INTERP_KERNEL/ConvexIntersector.txx b/src/INTERP_KERNEL/ConvexIntersector.txx index 98e30ec7a..bf763e41c 100644 --- a/src/INTERP_KERNEL/ConvexIntersector.txx +++ b/src/INTERP_KERNEL/ConvexIntersector.txx @@ -68,7 +68,7 @@ namespace INTERP_KERNEL /*** Compute the intersection area ***/ INTERP_KERNEL::PolygonAlgorithms P(_epsilon, PlanarIntersector::_precision); std::deque inter = P.intersectConvexPolygons(&CoordsT[0], &CoordsS[0], - CoordsT.size()/SPACEDIM, CoordsS.size()/SPACEDIM); + ToConnType(CoordsT.size())/SPACEDIM, ToConnType(CoordsS.size())/SPACEDIM); double area[SPACEDIM]; int nb_inter =((int)inter.size())/SPACEDIM; for(int i = 1; i P(_epsilon, PlanarIntersector::_precision); @@ -126,8 +126,8 @@ namespace INTERP_KERNEL const std::vector& sourceCoords) { double result = 0; - int nbOfNodesS=sourceCoords.size()/SPACEDIM; - int nbOfNodesT=targetCoords.size()/SPACEDIM; + ConnType nbOfNodesS=ToConnType(sourceCoords.size())/SPACEDIM; + ConnType nbOfNodesT=ToConnType(targetCoords.size())/SPACEDIM; /*** Compute the intersection area ***/ INTERP_KERNEL::PolygonAlgorithms P(_epsilon, PlanarIntersector::_precision); std::deque inter = P.intersectConvexPolygons(&targetCoords[0], &sourceCoords[0], diff --git a/src/INTERP_KERNEL/CurveIntersector.txx b/src/INTERP_KERNEL/CurveIntersector.txx index 81d54f386..1aa6db204 100644 --- a/src/INTERP_KERNEL/CurveIntersector.txx +++ b/src/INTERP_KERNEL/CurveIntersector.txx @@ -159,8 +159,8 @@ namespace INTERP_KERNEL void CurveIntersector::adjustBoundingBoxes (std::vector& bbox, double adjustmentEpsAbs) { - long size = bbox.size()/(2*SPACEDIM); - for (int i=0; i_minmax[0] ); double globCorner[3]; - for ( int iC = 0, nC = corners.size()/_dim; iC < nC; ++iC) + for ( std::size_t iC = 0, nC = corners.size()/_dim; iC < nC; ++iC) { cornerBox->fromLocalCS( &corners[iC*_dim], globCorner ); mmBox.addPointToBox( globCorner ); @@ -649,7 +649,7 @@ namespace INTERP_KERNEL getCorners( cornersOther, box ); DirectedBoundingBox mmBox((double*)0,0,_dim); //!< empty box with CS == this->_axes mmBox._axes = this->_axes; - for ( int iC = 0, nC = cornersOther.size()/_dim; iC < nC; ++iC) + for ( std::size_t iC = 0, nC = cornersOther.size()/_dim; iC < nC; ++iC) mmBox.addPointToBox( &cornersOther[iC*_dim] ); if ( isMinMaxOut( &mmBox._minmax[0], &this->_minmax[0], _dim )) @@ -662,7 +662,7 @@ namespace INTERP_KERNEL getCorners( cornersThis, &_minmax[0] ); DirectedBoundingBox mmBox((double*)0,0,_dim); //!< initailized _minmax double globCorner[3]; - for ( int iC = 0, nC = cornersThis.size()/_dim; iC < nC; ++iC) + for ( std::size_t iC = 0, nC = cornersThis.size()/_dim; iC < nC; ++iC) { fromLocalCS( &cornersThis[iC*_dim], globCorner ); for ( int i = 0; i < (int)_dim; ++i ) diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DAbstractEdge.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DAbstractEdge.cxx index 2c5551988..bd12d34fd 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DAbstractEdge.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DAbstractEdge.cxx @@ -107,11 +107,11 @@ void IteratorOnComposedEdge::insertElemEdges(ComposedEdge *elems, bool changeMyS *_deep_it=*iter; _deep_it++; iter++; - int sizeOfMyList=myListToInsert->size(); + std::size_t sizeOfMyList=myListToInsert->size(); _list_handle->insert(_deep_it,iter,myListToInsert->end()); if(!changeMySelf) { - for(int i=0;i nodes2(nbOfSourceNodes); - for(int i=0;i& targetCoords, const std::vector& sourceCoords) { - int nbOfTargetNodes=targetCoords.size()/SPACEDIM; + std::size_t nbOfTargetNodes=targetCoords.size()/SPACEDIM; std::vector nodes(nbOfTargetNodes); - for(int i=0;i nodes2(nbOfSourceNodes); - for(int i=0;i nodes2(nbOfTargetNodes); - for(int i=0;i& coords, NormalizedCellType type) { - int nbNodes=coords.size()/SPACEDIM; + std::size_t nbNodes=coords.size()/SPACEDIM; std::vector nodes(nbNodes); - for(int i=0;i::_mesh.getNumberOfElements(); + ConnType nbelem=IntegralUniformIntersector::_mesh.getNumberOfElements(); const ConnType *connIndx=IntegralUniformIntersector::_mesh.getConnectivityIndexPtr(); const ConnType *conn=IntegralUniformIntersector::_mesh.getConnectivityPtr(); const double *coords=IntegralUniformIntersector::_mesh.getCoordinatesPtr(); - for(unsigned long i=0;i::_mesh.getTypeOfElement(OTT::indFC(i)); double val=computeVolSurfOfCell(t,conn+OTT::ind2C(connIndx[i]),connIndx[i+1]-connIndx[i],coords); @@ -131,11 +131,11 @@ namespace INTERP_KERNEL { static const NumberingPolicy numPol=MyMeshType::My_numPol; res.resize(getNumberOfRowsOfResMatrix()); - unsigned long nbelem=IntegralUniformIntersector::_mesh.getNumberOfElements(); + ConnType nbelem=IntegralUniformIntersector::_mesh.getNumberOfElements(); const ConnType *connIndx=IntegralUniformIntersector::_mesh.getConnectivityIndexPtr(); const ConnType *conn=IntegralUniformIntersector::_mesh.getConnectivityPtr(); const double *coords=IntegralUniformIntersector::_mesh.getCoordinatesPtr(); - for(unsigned long i=0;i::_mesh.getTypeOfElement(OTT::indFC(i)); int lgth=connIndx[i+1]-connIndx[i]; diff --git a/src/INTERP_KERNEL/InterpKernelUtilities.hxx b/src/INTERP_KERNEL/InterpKernelUtilities.hxx index cb7064abd..cbf11572d 100644 --- a/src/INTERP_KERNEL/InterpKernelUtilities.hxx +++ b/src/INTERP_KERNEL/InterpKernelUtilities.hxx @@ -35,4 +35,7 @@ #define LOCALIZED(message) static_cast (message) , __FILE__ , __LINE__ +// conversion to mesh connection type +#define ToConnType(x) static_cast(x) + #endif diff --git a/src/INTERP_KERNEL/Interpolation.txx b/src/INTERP_KERNEL/Interpolation.txx old mode 100644 new mode 100755 index a9d02ee12..7a896c80b --- a/src/INTERP_KERNEL/Interpolation.txx +++ b/src/INTERP_KERNEL/Interpolation.txx @@ -59,9 +59,10 @@ namespace INTERP_KERNEL double Interpolation::CalculateCharacteristicSizeOfMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, const int printLevel) { static const int SPACEDIM=MyMeshType::MY_SPACEDIM; + typedef typename MyMeshType::MyConnType ConnType; - long nbMailleS=myMeshS.getNumberOfElements(); - long nbMailleT=myMeshT.getNumberOfElements(); + ConnType nbMailleS=myMeshS.getNumberOfElements(); + ConnType nbMailleT=myMeshT.getNumberOfElements(); /**************************************************/ /* Search the characteristic size of the meshes */ diff --git a/src/INTERP_KERNEL/Interpolation1D0D.cxx b/src/INTERP_KERNEL/Interpolation1D0D.cxx index b1a1dd03c..65ab1c0aa 100644 --- a/src/INTERP_KERNEL/Interpolation1D0D.cxx +++ b/src/INTERP_KERNEL/Interpolation1D0D.cxx @@ -44,8 +44,8 @@ namespace INTERP_KERNEL const int SPACE_DIM = 3; const double adj(getPrecision());// here precision is used instead of getBoundingBoxAdjustment and getBoundingBoxAdjustmentAbs because in the context only precision is relevant - long size = bbox.size()/(2*SPACE_DIM); - for (int i=0; i*, int> indices; - for(unsigned long i = 0 ; i < numSrcElems ; ++i) + for(ConnType i = 0 ; i < numSrcElems ; ++i) srcElems[i] = new MeshElement(i, srcMesh); // create empty maps for all source elements @@ -74,7 +74,7 @@ namespace INTERP_KERNEL // - get bounding boxes std::vector bboxes(2*SPACEDIM*numSrcElems); int* srcElemIdx = new int[numSrcElems]; - for(unsigned long i = 0; i < numSrcElems ; ++i) + for(ConnType i = 0; i < numSrcElems ; ++i) { // get source bboxes in right order srcElems[i]->getBoundingBox()->toCompactData(bboxes.data()+6*i); @@ -89,7 +89,7 @@ namespace INTERP_KERNEL const ConnType *trgConnPtr(targetMesh.getConnectivityPtr()),*trgConnIPtr(targetMesh.getConnectivityIndexPtr()); const ConnType *srcConnPtr(srcMesh.getConnectivityPtr()),*srcConnIPtr(srcMesh.getConnectivityIndexPtr()); const double *trgCooPtr(targetMesh.getCoordinatesPtr()),*srcCooPtr(srcMesh.getCoordinatesPtr()); - for(unsigned long i = 0; i < numTargetElems; ++i) + for(ConnType i = 0; i < numTargetElems; ++i) { IKAssert(trgConnIPtr[i+1]==i+1 && trgConnIPtr[i]==i); std::vector srcSegCondidates; @@ -110,7 +110,7 @@ namespace INTERP_KERNEL } } delete [] srcElemIdx; - for(unsigned long i = 0 ; i < numSrcElems ; ++i) + for(ConnType i = 0 ; i < numSrcElems ; ++i) delete srcElems[i]; return srcMesh.getNumberOfNodes(); } diff --git a/src/INTERP_KERNEL/Interpolation2D1D.txx b/src/INTERP_KERNEL/Interpolation2D1D.txx old mode 100644 new mode 100755 index 1e644d781..2324e62ae --- a/src/INTERP_KERNEL/Interpolation2D1D.txx +++ b/src/INTERP_KERNEL/Interpolation2D1D.txx @@ -53,12 +53,12 @@ namespace INTERP_KERNEL static const NumberingPolicy numPol=MyMeshType::My_numPol; long global_start =clock(); - int counter=0; + std::size_t counter=0; /***********************************************************/ /* Check both meshes are made of triangles and quadrangles */ /***********************************************************/ - long nbMailleS=myMeshS.getNumberOfElements(); + ConnType nbMailleS=myMeshS.getNumberOfElements(); /**************************************************/ /* Search the characteristic size of the meshes */ diff --git a/src/INTERP_KERNEL/Interpolation2D3D.txx b/src/INTERP_KERNEL/Interpolation2D3D.txx old mode 100644 new mode 100755 index a9b725243..05e653878 --- a/src/INTERP_KERNEL/Interpolation2D3D.txx +++ b/src/INTERP_KERNEL/Interpolation2D3D.txx @@ -67,8 +67,8 @@ namespace INTERP_KERNEL { typedef typename MyMeshType::MyConnType ConnType; // create MeshElement objects corresponding to each element of the two meshes - const unsigned long numSrcElems = srcMesh.getNumberOfElements(); - const unsigned long numTargetElems = targetMesh.getNumberOfElements(); + const ConnType numSrcElems = srcMesh.getNumberOfElements(); + const ConnType numTargetElems = targetMesh.getNumberOfElements(); LOG(2, "Source mesh has " << numSrcElems << " elements and target mesh has " << numTargetElems << " elements "); @@ -78,10 +78,10 @@ namespace INTERP_KERNEL std::map*, int> indices; DuplicateFacesType intersectFaces; - for(unsigned long i = 0 ; i < numSrcElems ; ++i) + for(ConnType i = 0 ; i < numSrcElems ; ++i) srcElems[i] = new MeshElement(i, srcMesh); - for(unsigned long i = 0 ; i < numTargetElems ; ++i) + for(ConnType i = 0 ; i < numTargetElems ; ++i) targetElems[i] = new MeshElement(i, targetMesh); Intersector3D* intersector=0; @@ -112,7 +112,7 @@ namespace INTERP_KERNEL // - get bounding boxes double* bboxes = new double[6 * numSrcElems]; int* srcElemIdx = new int[numSrcElems]; - for(unsigned long i = 0; i < numSrcElems ; ++i) + for(ConnType i = 0; i < numSrcElems ; ++i) { // get source bboxes in right order const BoundingBox* box = srcElems[i]->getBoundingBox(); @@ -131,7 +131,7 @@ namespace INTERP_KERNEL // for each target element, get source elements with which to calculate intersection // - calculate intersection by calling intersectCells - for(unsigned long i = 0; i < numTargetElems; ++i) + for(ConnType i = 0; i < numTargetElems; ++i) { const BoundingBox* box = targetElems[i]->getBoundingBox(); const int targetIdx = targetElems[i]->getIndex(); @@ -171,11 +171,11 @@ namespace INTERP_KERNEL delete intersector; - for(unsigned long i = 0 ; i < numSrcElems ; ++i) + for(ConnType i = 0 ; i < numSrcElems ; ++i) { delete srcElems[i]; } - for(unsigned long i = 0 ; i < numTargetElems ; ++i) + for(ConnType i = 0 ; i < numTargetElems ; ++i) { delete targetElems[i]; } diff --git a/src/INTERP_KERNEL/Interpolation3D.hxx b/src/INTERP_KERNEL/Interpolation3D.hxx old mode 100644 new mode 100755 index 19e2ee9d1..056c51f53 --- a/src/INTERP_KERNEL/Interpolation3D.hxx +++ b/src/INTERP_KERNEL/Interpolation3D.hxx @@ -1,43 +1,43 @@ -// Copyright (C) 2007-2019 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : Anthony Geay (CEA/DEN) - -#ifndef __INTERPOLATION3D_HXX__ -#define __INTERPOLATION3D_HXX__ - -#include "INTERPKERNELDefines.hxx" -#include "Interpolation.hxx" -#include "NormalizedUnstructuredMesh.hxx" -#include "InterpolationOptions.hxx" - -namespace INTERP_KERNEL -{ - class INTERPKERNEL_EXPORT Interpolation3D : public Interpolation - { - public: - Interpolation3D(); - Interpolation3D(const InterpolationOptions& io); - template - int interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method); - private: - SplittingPolicy _splitting_policy; - }; -} - -#endif +// Copyright (C) 2007-2019 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// Author : Anthony Geay (CEA/DEN) + +#ifndef __INTERPOLATION3D_HXX__ +#define __INTERPOLATION3D_HXX__ + +#include "INTERPKERNELDefines.hxx" +#include "Interpolation.hxx" +#include "NormalizedUnstructuredMesh.hxx" +#include "InterpolationOptions.hxx" + +namespace INTERP_KERNEL +{ + class INTERPKERNEL_EXPORT Interpolation3D : public Interpolation + { + public: + Interpolation3D(); + Interpolation3D(const InterpolationOptions& io); + template + int interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method); + private: + SplittingPolicy _splitting_policy; + }; +} + +#endif diff --git a/src/INTERP_KERNEL/Interpolation3D.txx b/src/INTERP_KERNEL/Interpolation3D.txx old mode 100644 new mode 100755 index 46b7f7d7e..8992aaa62 --- a/src/INTERP_KERNEL/Interpolation3D.txx +++ b/src/INTERP_KERNEL/Interpolation3D.txx @@ -79,8 +79,8 @@ namespace INTERP_KERNEL { typedef typename MyMeshType::MyConnType ConnType; // create MeshElement objects corresponding to each element of the two meshes - const unsigned long numSrcElems = srcMesh.getNumberOfElements(); - const unsigned long numTargetElems = targetMesh.getNumberOfElements(); + const ConnType numSrcElems = srcMesh.getNumberOfElements(); + const ConnType numTargetElems = targetMesh.getNumberOfElements(); LOG(2, "Source mesh has " << numSrcElems << " elements and target mesh has " << numTargetElems << " elements "); @@ -89,10 +89,10 @@ namespace INTERP_KERNEL std::map*, int> indices; - for(unsigned long i = 0 ; i < numSrcElems ; ++i) + for(ConnType i = 0 ; i < numSrcElems ; ++i) srcElems[i] = new MeshElement(i, srcMesh); - for(unsigned long i = 0 ; i < numTargetElems ; ++i) + for(ConnType i = 0 ; i < numTargetElems ; ++i) targetElems[i] = new MeshElement(i, targetMesh); Intersector3D* intersector=0; @@ -308,7 +308,7 @@ namespace INTERP_KERNEL // - get bounding boxes double* bboxes = new double[6 * numSrcElems]; int* srcElemIdx = new int[numSrcElems]; - for(unsigned long i = 0; i < numSrcElems ; ++i) + for(ConnType i = 0; i < numSrcElems ; ++i) { // get source bboxes in right order const BoundingBox* box = srcElems[i]->getBoundingBox(); @@ -327,7 +327,7 @@ namespace INTERP_KERNEL // for each target element, get source elements with which to calculate intersection // - calculate intersection by calling intersectCells - for(unsigned long i = 0; i < numTargetElems; ++i) + for(ConnType i = 0; i < numTargetElems; ++i) { const BoundingBox* box = targetElems[i]->getBoundingBox(); const int targetIdx = targetElems[i]->getIndex(); @@ -358,11 +358,11 @@ namespace INTERP_KERNEL delete intersector; - for(unsigned long i = 0 ; i < numSrcElems ; ++i) + for(ConnType i = 0 ; i < numSrcElems ; ++i) { delete srcElems[i]; } - for(unsigned long i = 0 ; i < numTargetElems ; ++i) + for(ConnType i = 0 ; i < numTargetElems ; ++i) { delete targetElems[i]; } diff --git a/src/INTERP_KERNEL/Interpolation3D1D.cxx b/src/INTERP_KERNEL/Interpolation3D1D.cxx index da03d8775..faa65ec42 100644 --- a/src/INTERP_KERNEL/Interpolation3D1D.cxx +++ b/src/INTERP_KERNEL/Interpolation3D1D.cxx @@ -45,8 +45,8 @@ namespace INTERP_KERNEL const double adj = getBoundingBoxAdjustmentAbs(); const double adjRel = getBoundingBoxAdjustment(); - long size = bbox.size()/(2*SPACE_DIM); - for (int i=0; i::max(); for(int idim=0; idim - -namespace INTERP_KERNEL -{ - class INTERPKERNEL_EXPORT Interpolation3D1D : public Interpolation - { - public: - Interpolation3D1D(); - Interpolation3D1D(const InterpolationOptions& io); - template - int interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method); - private: - void adjustBoundingBoxes(std::vector& bbox); - }; -} - -#endif +// Copyright (C) 2007-2019 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// Author : A Bruneton (CEA/DEN) + +#ifndef __INTERPOLATION3D1D_HXX__ +#define __INTERPOLATION3D1D_HXX__ + +#include "INTERPKERNELDefines.hxx" +#include "Interpolation.hxx" +#include "NormalizedUnstructuredMesh.hxx" +#include "InterpolationOptions.hxx" + +#include + +namespace INTERP_KERNEL +{ + class INTERPKERNEL_EXPORT Interpolation3D1D : public Interpolation + { + public: + Interpolation3D1D(); + Interpolation3D1D(const InterpolationOptions& io); + template + int interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method); + private: + void adjustBoundingBoxes(std::vector& bbox); + }; +} + +#endif diff --git a/src/INTERP_KERNEL/Interpolation3D1D.txx b/src/INTERP_KERNEL/Interpolation3D1D.txx old mode 100644 new mode 100755 index 15d100d10..93594623e --- a/src/INTERP_KERNEL/Interpolation3D1D.txx +++ b/src/INTERP_KERNEL/Interpolation3D1D.txx @@ -46,8 +46,8 @@ namespace INTERP_KERNEL typedef typename MyMeshType::MyConnType ConnType; // create MeshElement objects corresponding to each element of the two meshes - const unsigned long numSrcElems = srcMesh.getNumberOfElements(); - const unsigned long numTargetElems = targetMesh.getNumberOfElements(); + const ConnType numSrcElems = srcMesh.getNumberOfElements(); + const ConnType numTargetElems = targetMesh.getNumberOfElements(); LOG(2, "Source mesh has " << numSrcElems << " elements and target mesh has " << numTargetElems << " elements "); @@ -56,10 +56,10 @@ namespace INTERP_KERNEL std::map*, int> indices; - for(unsigned long i = 0 ; i < numSrcElems ; ++i) + for(ConnType i = 0 ; i < numSrcElems ; ++i) srcElems[i] = new MeshElement(i, srcMesh); - for(unsigned long i = 0 ; i < numTargetElems ; ++i) + for(ConnType i = 0 ; i < numTargetElems ; ++i) targetElems[i] = new MeshElement(i, targetMesh); Intersector3D* intersector=0; @@ -85,7 +85,7 @@ namespace INTERP_KERNEL // - get bounding boxes std::vector bboxes(6*numSrcElems); int* srcElemIdx = new int[numSrcElems]; - for(unsigned long i = 0; i < numSrcElems ; ++i) + for(ConnType i = 0; i < numSrcElems ; ++i) { // get source bboxes in right order const BoundingBox* box = srcElems[i]->getBoundingBox(); @@ -107,7 +107,7 @@ namespace INTERP_KERNEL // for each target element, get source elements with which to calculate intersection // - calculate intersection by calling intersectCells - for(unsigned long i = 0; i < numTargetElems; ++i) + for(ConnType i = 0; i < numTargetElems; ++i) { const BoundingBox* box = targetElems[i]->getBoundingBox(); const int targetIdx = targetElems[i]->getIndex(); @@ -136,11 +136,11 @@ namespace INTERP_KERNEL delete intersector; - for(unsigned long i = 0 ; i < numSrcElems ; ++i) + for(ConnType i = 0 ; i < numSrcElems ; ++i) { delete srcElems[i]; } - for(unsigned long i = 0 ; i < numTargetElems ; ++i) + for(ConnType i = 0 ; i < numTargetElems ; ++i) { delete targetElems[i]; } diff --git a/src/INTERP_KERNEL/InterpolationCC.txx b/src/INTERP_KERNEL/InterpolationCC.txx index ecbd29210..ee3d43ce0 100644 --- a/src/INTERP_KERNEL/InterpolationCC.txx +++ b/src/INTERP_KERNEL/InterpolationCC.txx @@ -152,7 +152,7 @@ namespace INTERP_KERNEL // create empty maps for all target elements result.resize( tgt_mesh.getNumberOfElements() ); - const int ret = src_mesh.getNumberOfElements(); + const int ret = ToConnType(src_mesh.getNumberOfElements()); const double eps = getPrecision(); const int dim = MyMeshType::MY_MESHDIM; @@ -166,8 +166,8 @@ namespace INTERP_KERNEL { src_coords[ j ] = src_mesh.getCoordsAlongAxis( _TMI( j )); tgt_coords[ j ] = tgt_mesh.getCoordsAlongAxis( _TMI( j )); - src_nb_cells[ j ] = src_mesh.nbCellsAlongAxis( _TMI( j )); - tgt_nb_cells[ j ] = tgt_mesh.nbCellsAlongAxis( _TMI( j )); + src_nb_cells[ j ] = ToConnType(src_mesh.nbCellsAlongAxis( _TMI( j ))); + tgt_nb_cells[ j ] = ToConnType(tgt_mesh.nbCellsAlongAxis( _TMI( j ))); } // ============================================ diff --git a/src/INTERP_KERNEL/InterpolationCU.hxx b/src/INTERP_KERNEL/InterpolationCU.hxx index 3d74d4ddd..0d36165ea 100644 --- a/src/INTERP_KERNEL/InterpolationCU.hxx +++ b/src/INTERP_KERNEL/InterpolationCU.hxx @@ -26,6 +26,7 @@ #include "Interpolation.hxx" #include "NormalizedUnstructuredMesh.hxx" +#include "InterpKernelUtilities.hxx" namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/InterpolationCU.txx b/src/INTERP_KERNEL/InterpolationCU.txx index a202ec305..828646721 100644 --- a/src/INTERP_KERNEL/InterpolationCU.txx +++ b/src/INTERP_KERNEL/InterpolationCU.txx @@ -125,7 +125,7 @@ namespace INTERP_KERNEL for ( int j = 0; j < dim; ++j ) { src_coords [j] = src_mesh.getCoordsAlongAxis( _TMIC( j )); - src_nb_coords[j] = src_mesh.nbCellsAlongAxis ( _TMIC( j )) + 1; + src_nb_coords[j] = static_cast(src_mesh.nbCellsAlongAxis ( _TMIC( j ))) + 1; for (int i = 0; i < src_nb_coords[j]; ++i ) src_coord_to_index[j].insert( std::make_pair( src_coords[j][i], i )); } diff --git a/src/INTERP_KERNEL/InterpolationCurve.hxx b/src/INTERP_KERNEL/InterpolationCurve.hxx old mode 100644 new mode 100755 index 25f81e057..a194cf3cd --- a/src/INTERP_KERNEL/InterpolationCurve.hxx +++ b/src/INTERP_KERNEL/InterpolationCurve.hxx @@ -1,44 +1,44 @@ -// Copyright (C) 2007-2019 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : Anthony Geay (CEA/DEN) - -#ifndef __INTERPOLATIONCURVE_HXX__ -#define __INTERPOLATIONCURVE_HXX__ - -#include "Interpolation.hxx" -#include "InterpolationOptions.hxx" - -namespace INTERP_KERNEL -{ - template - class InterpolationCurve : public Interpolation< InterpolationCurve > - { - public: - InterpolationCurve(); - InterpolationCurve(const InterpolationOptions & io); - - // Main function to interpolate - template - int interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, - MatrixType& result, const std::string& method); - - }; -} - -#endif +// Copyright (C) 2007-2019 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// Author : Anthony Geay (CEA/DEN) + +#ifndef __INTERPOLATIONCURVE_HXX__ +#define __INTERPOLATIONCURVE_HXX__ + +#include "Interpolation.hxx" +#include "InterpolationOptions.hxx" + +namespace INTERP_KERNEL +{ + template + class InterpolationCurve : public Interpolation< InterpolationCurve > + { + public: + InterpolationCurve(); + InterpolationCurve(const InterpolationOptions & io); + + // Main function to interpolate + template + int interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, + MatrixType& result, const std::string& method); + + }; +} + +#endif diff --git a/src/INTERP_KERNEL/InterpolationCurve.txx b/src/INTERP_KERNEL/InterpolationCurve.txx old mode 100644 new mode 100755 index 097f8d04e..6bd9beeb0 --- a/src/INTERP_KERNEL/InterpolationCurve.txx +++ b/src/INTERP_KERNEL/InterpolationCurve.txx @@ -83,10 +83,10 @@ namespace INTERP_KERNEL static const NumberingPolicy numPol = MyMeshType::My_numPol; long global_start = clock(); - int counter=0; + std::size_t counter=0; - long nbMailleS = myMeshS.getNumberOfElements(); - long nbMailleT = myMeshT.getNumberOfElements(); + ConnType nbMailleS = myMeshS.getNumberOfElements(); + ConnType nbMailleT = myMeshT.getNumberOfElements(); CurveIntersector* intersector=0; if(method=="P0P0") diff --git a/src/INTERP_KERNEL/InterpolationPlanar.hxx b/src/INTERP_KERNEL/InterpolationPlanar.hxx old mode 100644 new mode 100755 index 040348741..d27580404 --- a/src/INTERP_KERNEL/InterpolationPlanar.hxx +++ b/src/INTERP_KERNEL/InterpolationPlanar.hxx @@ -1,59 +1,59 @@ -// Copyright (C) 2007-2019 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : Anthony Geay (CEA/DEN) - -#ifndef __INTERPOLATIONPLANAR_HXX__ -#define __INTERPOLATIONPLANAR_HXX__ - -#include "Interpolation.hxx" -#include "PlanarIntersector.hxx" -#include "NormalizedUnstructuredMesh.hxx" -#include "InterpolationOptions.hxx" - -namespace INTERP_KERNEL -{ - template - class InterpolationPlanar : public Interpolation< InterpolationPlanar > - { - private: - double _dim_caracteristic; - public: - InterpolationPlanar(); - InterpolationPlanar(const InterpolationOptions & io); - - // geometric precision, debug print level, choice of the median plane, intersection etc ... - void setOptions(double precision, int printLevel, - IntersectionType intersectionType, int orientation=0); - - // Main function to interpolate triangular and quadratic meshes - template - int interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, MatrixType& result, const std::string& method); - public: - bool doRotate() const { return asLeafInterpPlanar().doRotate(); } - double medianPlane() const { return asLeafInterpPlanar().medianPlane(); } - template - void performAdjustmentOfBB(PlanarIntersector* intersector, std::vector& bbox) const - { return asLeafInterpPlanar().performAdjustmentOfBB(intersector,bbox); } - protected: - RealPlanar& asLeafInterpPlanar() { return static_cast(*this); } - const RealPlanar& asLeafInterpPlanar() const { return static_cast< const RealPlanar& >(*this); } - }; -} - -#endif +// Copyright (C) 2007-2019 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// Author : Anthony Geay (CEA/DEN) + +#ifndef __INTERPOLATIONPLANAR_HXX__ +#define __INTERPOLATIONPLANAR_HXX__ + +#include "Interpolation.hxx" +#include "PlanarIntersector.hxx" +#include "NormalizedUnstructuredMesh.hxx" +#include "InterpolationOptions.hxx" + +namespace INTERP_KERNEL +{ + template + class InterpolationPlanar : public Interpolation< InterpolationPlanar > + { + private: + double _dim_caracteristic; + public: + InterpolationPlanar(); + InterpolationPlanar(const InterpolationOptions & io); + + // geometric precision, debug print level, choice of the median plane, intersection etc ... + void setOptions(double precision, int printLevel, + IntersectionType intersectionType, int orientation=0); + + // Main function to interpolate triangular and quadratic meshes + template + int interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, MatrixType& result, const std::string& method); + public: + bool doRotate() const { return asLeafInterpPlanar().doRotate(); } + double medianPlane() const { return asLeafInterpPlanar().medianPlane(); } + template + void performAdjustmentOfBB(PlanarIntersector* intersector, std::vector& bbox) const + { return asLeafInterpPlanar().performAdjustmentOfBB(intersector,bbox); } + protected: + RealPlanar& asLeafInterpPlanar() { return static_cast(*this); } + const RealPlanar& asLeafInterpPlanar() const { return static_cast< const RealPlanar& >(*this); } + }; +} + +#endif diff --git a/src/INTERP_KERNEL/InterpolationPlanar.txx b/src/INTERP_KERNEL/InterpolationPlanar.txx old mode 100644 new mode 100755 index eb969ea3b..264912bc6 --- a/src/INTERP_KERNEL/InterpolationPlanar.txx +++ b/src/INTERP_KERNEL/InterpolationPlanar.txx @@ -121,13 +121,13 @@ namespace INTERP_KERNEL static const NumberingPolicy numPol=MyMeshType::My_numPol; long global_start =clock(); - int counter=0; + std::size_t counter=0; /***********************************************************/ /* Check both meshes are made of triangles and quadrangles */ /***********************************************************/ - long nbMailleS=myMeshS.getNumberOfElements(); - long nbMailleT=myMeshT.getNumberOfElements(); + ConnType nbMailleS=myMeshS.getNumberOfElements(); + ConnType nbMailleT=myMeshT.getNumberOfElements(); /**************************************************/ /* Search the characteristic size of the meshes */ diff --git a/src/INTERP_KERNEL/InterpolationUtils.hxx b/src/INTERP_KERNEL/InterpolationUtils.hxx index f40bd3351..aaa4e812c 100644 --- a/src/INTERP_KERNEL/InterpolationUtils.hxx +++ b/src/INTERP_KERNEL/InterpolationUtils.hxx @@ -197,17 +197,17 @@ namespace INTERP_KERNEL inline std::vector bary_poly(const std::vector& V) { std::vector Bary; - long taille=V.size(); + std::size_t taille=V.size(); double x=0; double y=0; - for(long i=0;i(taille)); + double B=2*y/(static_cast(taille)); Bary.push_back(A);//taille vecteur=2*nb de points. Bary.push_back(B); @@ -801,9 +801,9 @@ namespace INTERP_KERNEL inline void verif_point_dans_vect(const double* P, std::vector& V, double absolute_precision ) { - long taille=V.size(); + std::size_t taille=V.size(); bool isPresent=false; - for(long i=0;i& V) { - long taille=V.size(); + std::size_t taille=V.size(); int A=0; - for(long i=0;i(_meshC.nbCellsAlongAxis ( _TMIC( j ))); } } @@ -130,7 +130,7 @@ namespace INTERP_KERNEL _CU_TEMPLATE int _INTERSECTOR_CU_::getNumberOfColsOfResMatrix() const { - return _meshC.getNumberOfElements(); + return static_cast(_meshC.getNumberOfElements()); } //================================================================================ diff --git a/src/INTERP_KERNEL/MappedBarycentric2DIntersectorP1P1.txx b/src/INTERP_KERNEL/MappedBarycentric2DIntersectorP1P1.txx index f399844d6..4088f3fdc 100644 --- a/src/INTERP_KERNEL/MappedBarycentric2DIntersectorP1P1.txx +++ b/src/INTERP_KERNEL/MappedBarycentric2DIntersectorP1P1.txx @@ -43,7 +43,7 @@ namespace INTERP_KERNEL { std::vector CoordsT; PlanarIntersector::getRealTargetCoordinates(OTT::indFC(icellT),CoordsT); - int nbOfNodesT=CoordsT.size()/SPACEDIM; + ConnType nbOfNodesT=ToConnType(CoordsT.size())/SPACEDIM; for(typename std::vector::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++) { NormalizedCellType tS=PlanarIntersector::_meshS.getTypeOfElement(OTT::indFC(*iter)); @@ -53,7 +53,7 @@ namespace INTERP_KERNEL PlanarIntersector::getRealSourceCoordinates(OTT::indFC(*iter),CoordsS); std::vector CoordsTTmp(CoordsT); if(SPACEDIM==3) - PlanarIntersector::projectionThis(&CoordsS[0],&CoordsTTmp[0],CoordsS.size()/SPACEDIM,nbOfNodesT); + PlanarIntersector::projectionThis(&CoordsS[0],&CoordsTTmp[0],ToConnType(CoordsS.size())/SPACEDIM,nbOfNodesT); const ConnType *startOfCellNodeConnT=PlanarIntersector::_connectT+OTT::conn2C(PlanarIntersector::_connIndexT[icellT]); for(int nodeIdT=0;nodeIdT CoordsT; const ConnType *startOfCellNodeConnT=Intersector3DP1P1::getStartConnOfTargetCell(targetCell); Intersector3DP1P1::getRealTargetCoordinates(OTT::indFC(targetCell),CoordsT); - int nbOfNodesT=CoordsT.size()/SPACEDIM; + std::size_t nbOfNodesT=CoordsT.size()/SPACEDIM; const double *coordsS=Intersector3DP1P1::_src_mesh.getCoordinatesPtr(); - for(int nodeIdT=0;nodeIdT::ind2C(startOfCellNodeConnT[nodeIdT])]; if(!resRow.empty()) @@ -72,7 +72,7 @@ namespace INTERP_KERNEL // std::vector connOfCurCellS; Intersector3DP1P1::getConnOfSourceCell(OTT::indFC(*iterCellS),connOfCurCellS); - if( PointLocatorAlgos::isElementContainsPointAlg3D(&CoordsT[nodeIdT*SPACEDIM],&connOfCurCellS[0],connOfCurCellS.size(),coordsS,cmTypeS,_precision) ) + if( PointLocatorAlgos::isElementContainsPointAlg3D(&CoordsT[nodeIdT*SPACEDIM],&connOfCurCellS[0],ToConnType(connOfCurCellS.size()),coordsS,cmTypeS,_precision) ) { double mco[3]; // mapped coordinates in the hexa8 std::vector localCoordsS; diff --git a/src/INTERP_KERNEL/MeshElement.txx b/src/INTERP_KERNEL/MeshElement.txx old mode 100644 new mode 100755 index def308775..b3ab35764 --- a/src/INTERP_KERNEL/MeshElement.txx +++ b/src/INTERP_KERNEL/MeshElement.txx @@ -39,7 +39,7 @@ namespace INTERP_KERNEL template template MeshElement::MeshElement(const ConnType index, const MyMeshType& mesh) - : _index(index), _number(mesh.getNumberOfNodesOfElement(OTT::indFC(index))), _box(0) + : _index(index), _number((unsigned char)mesh.getNumberOfNodesOfElement(OTT::indFC(index))), _box(0) { const double**vertices = new const double*[_number]; diff --git a/src/INTERP_KERNEL/PlanarIntersector.txx b/src/INTERP_KERNEL/PlanarIntersector.txx index 22ac30f91..59871ce69 100644 --- a/src/INTERP_KERNEL/PlanarIntersector.txx +++ b/src/INTERP_KERNEL/PlanarIntersector.txx @@ -132,8 +132,8 @@ namespace INTERP_KERNEL { /* We build the segment tree for locating possible matching intersections*/ - long size = bbox.size()/(2*SPACEDIM); - for (int i=0; i::max(); for(int idim=0; idim(triangle,quadrangle); std::vector sourceCellCoordsTmp(sourceCellCoords); if(SPACEDIM==3) - orientation=PlanarIntersector::projectionThis(&sourceCellCoordsTmp[0],quadrangle,sourceCellCoords.size()/SPACEDIM,4); + orientation=PlanarIntersector::projectionThis(&sourceCellCoordsTmp[0],quadrangle,ToConnType(sourceCellCoords.size())/SPACEDIM,4); NormalizedCellType tS=PlanarIntersector::_meshS.getTypeOfElement(OTT::indFC(iS)); double surf=orientation*intersectGeometryWithQuadrangle(quadrangle,sourceCellCoordsTmp,CellModel::GetCellModel(tS).isQuadratic()); surf=PlanarIntersector::getValueRegardingOption(surf); diff --git a/src/INTERP_KERNEL/PlanarIntersectorP0P1Bary.txx b/src/INTERP_KERNEL/PlanarIntersectorP0P1Bary.txx old mode 100644 new mode 100755 index 444e09670..b7c8ab25f --- a/src/INTERP_KERNEL/PlanarIntersectorP0P1Bary.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP0P1Bary.txx @@ -42,8 +42,8 @@ namespace INTERP_KERNEL // Check types of source elements here rather than in intersectCells() since a wrong type can be // found late after a long time of calculation. - const unsigned long numTrgElems = meshT.getNumberOfElements(); - for(unsigned long i = 0 ; i < numTrgElems ; ++i) + const ConnType numTrgElems = meshT.getNumberOfElements(); + for(ConnType i = 0 ; i < numTrgElems ; ++i) if ( meshT.getTypeOfElement( OTT::indFC( i )) != NORM_TRI3 ) throw INTERP_KERNEL::Exception("P0P1 barycentric algorithm works only with triangular target meshes"); } @@ -81,7 +81,7 @@ namespace INTERP_KERNEL bool isSourceQuad=CellModel::GetCellModel(tS).isQuadratic(); PlanarIntersector::getRealSourceCoordinates(OTT::indFC(iS),srcCellCoords); std::vector *srcCoords(&srcCellCoords); - int srcNbNodes = srcCellCoords.size()/SPACEDIM; + int srcNbNodes = ToConnType(srcCellCoords.size())/SPACEDIM; if(SPACEDIM==3) { srcCellCoordsTmp=srcCellCoords; diff --git a/src/INTERP_KERNEL/PlanarIntersectorP0P1PL.txx b/src/INTERP_KERNEL/PlanarIntersectorP0P1PL.txx index 94631a14c..949598023 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP0P1PL.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP0P1PL.txx @@ -46,17 +46,17 @@ namespace INTERP_KERNEL const ConnType *startOfCellNodeConnT=PlanarIntersector::_connectT+OTT::conn2C(PlanarIntersector::_connIndexT[icellT]); std::vector coordsTarget; PlanarIntersector::getRealTargetCoordinates(OTT::indFC(icellT),coordsTarget); - int nbNodesT=coordsTarget.size()/SPACEDIM; + int nbNodesT=ToConnType(coordsTarget.size())/SPACEDIM; ii=0; for(typename std::vector::const_iterator iter2=icellsS.begin();iter2!=icellsS.end();iter2++,ii++) { std::vector tmpSource(coordsOfSources[ii]); std::vector tmpTarget(coordsTarget); if(SPACEDIM==3) - PlanarIntersector::projectionThis(&tmpSource[0],&tmpTarget[0],tmpSource.size()/SPACEDIM,nbNodesT); + PlanarIntersector::projectionThis(&tmpSource[0],&tmpTarget[0],ToConnType(tmpSource.size())/SPACEDIM,nbNodesT); for(int nodeIdT=0;nodeIdT::isElementContainsPointAlg2D(&tmpTarget[0]+nodeIdT*SPACEDIM,&tmpSource[0],tmpSource.size()/SPACEDIM,PlanarIntersector::_precision)) + if(PointLocatorAlgos::isElementContainsPointAlg2D(&tmpTarget[0]+nodeIdT*SPACEDIM,&tmpSource[0],ToConnType(tmpSource.size())/SPACEDIM,PlanarIntersector::_precision)) { ConnType curNodeTInCmode=OTT::coo2C(startOfCellNodeConnT[nodeIdT]); typename MyMatrix::value_type& resRow=res[curNodeTInCmode]; diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P0.txx b/src/INTERP_KERNEL/PlanarIntersectorP1P0.txx index 865435cce..8db87d352 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P0.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P0.txx @@ -80,7 +80,7 @@ namespace INTERP_KERNEL fillDualCellOfTri(triangle,quadrangle); std::vector targetCellCoordsTmp(targetCellCoords); if(SPACEDIM==3) - orientation=PlanarIntersector::projectionThis(&targetCellCoordsTmp[0],quadrangle,targetCellCoords.size()/SPACEDIM,4); + orientation=PlanarIntersector::projectionThis(&targetCellCoordsTmp[0],quadrangle,ToConnType(targetCellCoords.size())/SPACEDIM,4); double surf=orientation*intersectGeometryWithQuadrangle(quadrangle,targetCellCoordsTmp,isTargetQuad); surf=PlanarIntersector::getValueRegardingOption(surf); if(surf!=0.) diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.txx b/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.txx old mode 100644 new mode 100755 index b63d9f50b..009079a52 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.txx @@ -44,8 +44,8 @@ namespace INTERP_KERNEL // Check types of source elements here rather than in intersectCells() since a wrong type can be // found late after a long time of calculation. - const unsigned long numSrcElems = meshS.getNumberOfElements(); - for(unsigned long i = 0 ; i < numSrcElems ; ++i) + const ConnType numSrcElems = meshS.getNumberOfElements(); + for(ConnType i = 0 ; i < numSrcElems ; ++i) if ( meshS.getTypeOfElement( OTT::indFC( i )) != NORM_TRI3 ) throw INTERP_KERNEL::Exception("P1P0 barycentric algorithm works only with triangular source meshes"); } @@ -76,7 +76,7 @@ namespace INTERP_KERNEL // target cell data PlanarIntersector::getRealTargetCoordinates(OTT::indFC(icellT),tgtCellCoords); std::vector * tgtCoords = & tgtCellCoords; - int tgtNbNodes = tgtCellCoords.size()/SPACEDIM; + int tgtNbNodes = ToConnType(tgtCellCoords.size())/SPACEDIM; NormalizedCellType tT=PlanarIntersector::_meshT.getTypeOfElement(OTT::indFC(icellT)); bool isTargetQuad=CellModel::GetCellModel(tT).isQuadratic(); diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P0PL.txx b/src/INTERP_KERNEL/PlanarIntersectorP1P0PL.txx index 2989168f2..1fb758943 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P0PL.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P0PL.txx @@ -46,7 +46,7 @@ namespace INTERP_KERNEL PlanarIntersector::getRealTargetCoordinates(OTT::indFC(icellT),CoordsT); double baryT[SPACEDIM]; double baryTTmp[SPACEDIM]; - calculateBarycenterDyn2(&CoordsT[0],CoordsT.size()/SPACEDIM,baryT); + calculateBarycenterDyn2(&CoordsT[0],ToConnType(CoordsT.size())/SPACEDIM,baryT); for(typename std::vector::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++) { NormalizedCellType tS=PlanarIntersector::_meshS.getTypeOfElement(OTT::indFC(*iter)); diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P1.txx b/src/INTERP_KERNEL/PlanarIntersectorP1P1.txx index 14dfe0620..3834fcaf4 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P1.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P1.txx @@ -62,7 +62,7 @@ namespace INTERP_KERNEL ConnType curNodeTInCmode=OTT::coo2C(startOfCellNodeConn[nodeIdT]); PlanarIntersector::getRealTargetCoordinatesPermute(OTT::indFC(icellT),nodeIdT,polygT); std::vector polygDualT(SPACEDIM*2*(nbNodesT-1)); - fillDualCellOfPolyg(&polygT[0],polygT.size()/SPACEDIM,&polygDualT[0]); + fillDualCellOfPolyg(&polygT[0],ToConnType(polygT.size())/SPACEDIM,&polygDualT[0]); typename MyMatrix::value_type& resRow=res[curNodeTInCmode]; for(typename std::vector::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++) { @@ -75,10 +75,10 @@ namespace INTERP_KERNEL std::vector polygS; PlanarIntersector::getRealSourceCoordinatesPermute(OTT::indFC(iS),nodeIdS,polygS); std::vector polygDualS(SPACEDIM*2*(nbNodesS-1)); - fillDualCellOfPolyg(&polygS[0],polygS.size()/SPACEDIM,&polygDualS[0]); + fillDualCellOfPolyg(&polygS[0],ToConnType(polygS.size())/SPACEDIM,&polygDualS[0]); std::vector polygDualTTmp(polygDualT); if(SPACEDIM==3) - orientation=PlanarIntersector::projectionThis(&polygDualS[0],&polygDualTTmp[0],polygDualS.size()/SPACEDIM,polygDualT.size()/SPACEDIM); + orientation=PlanarIntersector::projectionThis(&polygDualS[0],&polygDualTTmp[0],ToConnType(polygDualS.size())/SPACEDIM,ToConnType(polygDualT.size())/SPACEDIM); double surf=orientation*intersectGeometryGeneral(polygDualTTmp,polygDualS); surf=PlanarIntersector::getValueRegardingOption(surf); if(surf!=0.) diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P1PL.txx b/src/INTERP_KERNEL/PlanarIntersectorP1P1PL.txx index a7235b54e..557538e5c 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P1PL.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P1PL.txx @@ -42,7 +42,7 @@ namespace INTERP_KERNEL { std::vector CoordsT; PlanarIntersector::getRealTargetCoordinates(OTT::indFC(icellT),CoordsT); - int nbOfNodesT=CoordsT.size()/SPACEDIM; + int nbOfNodesT=ToConnType(CoordsT.size())/SPACEDIM; for(typename std::vector::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++) { NormalizedCellType tS=PlanarIntersector::_meshS.getTypeOfElement(OTT::indFC(*iter)); @@ -52,7 +52,7 @@ namespace INTERP_KERNEL PlanarIntersector::getRealSourceCoordinates(OTT::indFC(*iter),CoordsS); std::vector CoordsTTmp(CoordsT); if(SPACEDIM==3) - PlanarIntersector::projectionThis(&CoordsS[0],&CoordsTTmp[0],CoordsS.size()/SPACEDIM,nbOfNodesT); + PlanarIntersector::projectionThis(&CoordsS[0],&CoordsTTmp[0],ToConnType(CoordsS.size())/SPACEDIM,nbOfNodesT); const ConnType *startOfCellNodeConnT=PlanarIntersector::_connectT+OTT::conn2C(PlanarIntersector::_connIndexT[icellT]); for(int nodeIdT=0;nodeIdT& coords, NormalizedCellType type) { - int nbNodes=coords.size()/SPACEDIM; + std::size_t nbNodes=coords.size()/SPACEDIM; std::vector nodes(nbNodes); - for(int i=0;i CoordsT; Intersector3DP0P0::getRealTargetCoordinates(OTT::indFC(targetCell),CoordsT); double bary[SPACEDIM]; - calculateBarycenterDyn2(&CoordsT[0],CoordsT.size()/SPACEDIM,bary); + calculateBarycenterDyn2(&CoordsT[0],ToConnType(CoordsT.size())/SPACEDIM,bary); typename MyMatrix::value_type& resRow=res[targetCell]; const double *coordsS=Intersector3DP0P0::_src_mesh.getCoordinatesPtr(); for(typename std::vector::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++) @@ -67,7 +67,7 @@ namespace INTERP_KERNEL const CellModel& cmTypeS=CellModel::GetCellModel(tS); std::vector connOfCurCellS; Intersector3DP0P0::getConnOfSourceCell(OTT::indFC(*iterCellS),connOfCurCellS); - if(PointLocatorAlgos::isElementContainsPointAlg3D(bary,&connOfCurCellS[0],connOfCurCellS.size(),coordsS,cmTypeS,_precision)) + if(PointLocatorAlgos::isElementContainsPointAlg3D(bary,&connOfCurCellS[0],ToConnType(connOfCurCellS.size()),coordsS,cmTypeS,_precision)) { resRow.insert(std::make_pair(OTT::indFC(*iterCellS),1)); } diff --git a/src/INTERP_KERNEL/PointLocator3DIntersectorP0P1.hxx b/src/INTERP_KERNEL/PointLocator3DIntersectorP0P1.hxx index 66acfa483..731241310 100644 --- a/src/INTERP_KERNEL/PointLocator3DIntersectorP0P1.hxx +++ b/src/INTERP_KERNEL/PointLocator3DIntersectorP0P1.hxx @@ -23,6 +23,7 @@ #include "Intersector3DP0P1.hxx" #include "NormalizedUnstructuredMesh.hxx" +#include "InterpKernelUtilities.hxx" namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/PointLocator3DIntersectorP0P1.txx b/src/INTERP_KERNEL/PointLocator3DIntersectorP0P1.txx index f96e28852..7acdefec9 100644 --- a/src/INTERP_KERNEL/PointLocator3DIntersectorP0P1.txx +++ b/src/INTERP_KERNEL/PointLocator3DIntersectorP0P1.txx @@ -54,7 +54,7 @@ namespace INTERP_KERNEL { std::vector coordsTarget; Intersector3DP0P1::getRealTargetCoordinates(OTT::indFC(targetCell),coordsTarget); - int nbNodesT=coordsTarget.size()/SPACEDIM; + std::size_t nbNodesT=coordsTarget.size()/SPACEDIM; const double *coordsS=Intersector3DP0P1::_src_mesh.getCoordinatesPtr(); const ConnType *startOfCellNodeConnT=Intersector3DP0P1::getStartConnOfTargetCell(targetCell); for(typename std::vector::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++) @@ -63,9 +63,9 @@ namespace INTERP_KERNEL const CellModel& cmTypeS=CellModel::GetCellModel(tS); std::vector connOfCurCellS; Intersector3DP0P1::getConnOfSourceCell(OTT::indFC(*iterCellS),connOfCurCellS); - for(int nodeIdT=0;nodeIdT::isElementContainsPointAlg3D(&coordsTarget[nodeIdT*SPACEDIM],&connOfCurCellS[0],connOfCurCellS.size(),coordsS,cmTypeS,_precision)) + if(PointLocatorAlgos::isElementContainsPointAlg3D(&coordsTarget[nodeIdT*SPACEDIM],&connOfCurCellS[0],ToConnType(connOfCurCellS.size()),coordsS,cmTypeS,_precision)) { ConnType curNodeTInCmode=OTT::coo2C(startOfCellNodeConnT[nodeIdT]); typename MyMatrix::value_type& resRow=res[curNodeTInCmode]; diff --git a/src/INTERP_KERNEL/PointLocator3DIntersectorP1P0.hxx b/src/INTERP_KERNEL/PointLocator3DIntersectorP1P0.hxx index b7826bd4f..439100f2c 100644 --- a/src/INTERP_KERNEL/PointLocator3DIntersectorP1P0.hxx +++ b/src/INTERP_KERNEL/PointLocator3DIntersectorP1P0.hxx @@ -23,6 +23,7 @@ #include "Intersector3DP1P0.hxx" #include "NormalizedUnstructuredMesh.hxx" +#include "InterpKernelUtilities.hxx" namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/PointLocator3DIntersectorP1P0.txx b/src/INTERP_KERNEL/PointLocator3DIntersectorP1P0.txx index 44956c078..d85f6894d 100644 --- a/src/INTERP_KERNEL/PointLocator3DIntersectorP1P0.txx +++ b/src/INTERP_KERNEL/PointLocator3DIntersectorP1P0.txx @@ -57,7 +57,7 @@ namespace INTERP_KERNEL const double *coordsS=Intersector3DP1P0::_src_mesh.getCoordinatesPtr(); Intersector3DP1P0::getRealTargetCoordinates(OTT::indFC(targetCell),CoordsT); double baryT[SPACEDIM]; - calculateBarycenterDyn2(&CoordsT[0],CoordsT.size()/SPACEDIM,baryT); + calculateBarycenterDyn2(&CoordsT[0],ToConnType(CoordsT.size())/SPACEDIM,baryT); for(typename std::vector::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++) { NormalizedCellType tS=Intersector3DP1P0::_src_mesh.getTypeOfElement(OTT::indFC(*iterCellS)); @@ -66,7 +66,7 @@ namespace INTERP_KERNEL const CellModel& cmTypeS=CellModel::GetCellModel(tS); std::vector connOfCurCellS; Intersector3DP1P0::getConnOfSourceCell(OTT::indFC(*iterCellS),connOfCurCellS); - if( PointLocatorAlgos::isElementContainsPointAlg3D(baryT,&connOfCurCellS[0],connOfCurCellS.size(),coordsS,cmTypeS,_precision) ) + if( PointLocatorAlgos::isElementContainsPointAlg3D(baryT,&connOfCurCellS[0],ToConnType(connOfCurCellS.size()),coordsS,cmTypeS,_precision) ) { double resLoc[4]; std::vector srcCell; diff --git a/src/INTERP_KERNEL/PointLocator3DIntersectorP1P1.hxx b/src/INTERP_KERNEL/PointLocator3DIntersectorP1P1.hxx index efea68659..4734af56e 100644 --- a/src/INTERP_KERNEL/PointLocator3DIntersectorP1P1.hxx +++ b/src/INTERP_KERNEL/PointLocator3DIntersectorP1P1.hxx @@ -23,6 +23,7 @@ #include "Intersector3DP1P1.hxx" #include "NormalizedUnstructuredMesh.hxx" +#include "InterpKernelUtilities.hxx" namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/PointLocator3DIntersectorP1P1.txx b/src/INTERP_KERNEL/PointLocator3DIntersectorP1P1.txx index c587e0102..5d7336bcc 100644 --- a/src/INTERP_KERNEL/PointLocator3DIntersectorP1P1.txx +++ b/src/INTERP_KERNEL/PointLocator3DIntersectorP1P1.txx @@ -54,7 +54,7 @@ namespace INTERP_KERNEL { std::vector CoordsT; Intersector3DP1P1::getRealTargetCoordinates(OTT::indFC(targetCell),CoordsT); - int nbOfNodesT=CoordsT.size()/SPACEDIM; + std::size_t nbOfNodesT=CoordsT.size()/SPACEDIM; const double *coordsS=Intersector3DP1P1::_src_mesh.getCoordinatesPtr(); for(typename std::vector::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++) { @@ -63,12 +63,12 @@ namespace INTERP_KERNEL throw INTERP_KERNEL::Exception("Invalid source cell detected for meshdim==3. Only TETRA4 supported !"); const CellModel& cmTypeS=CellModel::GetCellModel(tS); const ConnType *startOfCellNodeConnT=Intersector3DP1P1::getStartConnOfTargetCell(targetCell); - for(int nodeIdT=0;nodeIdT::ind2C(startOfCellNodeConnT[nodeIdT])]; std::vector connOfCurCellS; Intersector3DP1P1::getConnOfSourceCell(OTT::indFC(*iterCellS),connOfCurCellS); - if( PointLocatorAlgos::isElementContainsPointAlg3D(&CoordsT[nodeIdT*SPACEDIM],&connOfCurCellS[0],connOfCurCellS.size(),coordsS,cmTypeS,_precision) ) + if( PointLocatorAlgos::isElementContainsPointAlg3D(&CoordsT[nodeIdT*SPACEDIM],&connOfCurCellS[0],ToConnType(connOfCurCellS.size()),coordsS,cmTypeS,_precision) ) { double resLoc[4]; std::vector localCoordsS; diff --git a/src/INTERP_KERNEL/PolygonAlgorithms.txx b/src/INTERP_KERNEL/PolygonAlgorithms.txx index 3bde89a9b..2eef9bdae 100644 --- a/src/INTERP_KERNEL/PolygonAlgorithms.txx +++ b/src/INTERP_KERNEL/PolygonAlgorithms.txx @@ -430,7 +430,7 @@ namespace INTERP_KERNEL while( !four_neighbours) { i_glob=(* mi1).second;//global index of vertex i - nb_prev = _Status.count(i_glob);//counts the number of segments ending at i + nb_prev = static_cast(_Status.count(i_glob));//counts the number of segments ending at i //std::cout<< "nb_prev= "<< nb_prev << " i_glob= " << i_glob << std::endl; switch (nb_prev) @@ -667,7 +667,7 @@ namespace INTERP_KERNEL } mi1++; i_glob=(* mi1).second;//global index of vertex i - nb_prev = _Status.count(i_glob); + nb_prev = static_cast(_Status.count(i_glob)); } } return _Inter; diff --git a/src/INTERP_KERNEL/PolyhedronIntersectorP1P0Bary.txx b/src/INTERP_KERNEL/PolyhedronIntersectorP1P0Bary.txx old mode 100644 new mode 100755 index 87813b6ad..c4645fecb --- a/src/INTERP_KERNEL/PolyhedronIntersectorP1P0Bary.txx +++ b/src/INTERP_KERNEL/PolyhedronIntersectorP1P0Bary.txx @@ -55,8 +55,8 @@ namespace INTERP_KERNEL // Check types of source elements here rather than in intersectCells() since a wrong type can be // found late after a long time of calculation. - const unsigned long numSrcElems = srcMesh.getNumberOfElements(); - for(unsigned long i = 0 ; i < numSrcElems ; ++i) + const ConnType numSrcElems = srcMesh.getNumberOfElements(); + for(ConnType i = 0 ; i < numSrcElems ; ++i) if ( srcMesh.getTypeOfElement( OTT::indFC(i) ) != NORM_TETRA4 ) throw INTERP_KERNEL::Exception("P1P0 barycentric algorithm works only with tetrahedral source meshes"); } diff --git a/src/INTERP_KERNEL/PolyhedronIntersectorP1P1.txx b/src/INTERP_KERNEL/PolyhedronIntersectorP1P1.txx old mode 100644 new mode 100755 index 38634d4ce..746fa7d14 --- a/src/INTERP_KERNEL/PolyhedronIntersectorP1P1.txx +++ b/src/INTERP_KERNEL/PolyhedronIntersectorP1P1.txx @@ -46,13 +46,13 @@ namespace INTERP_KERNEL // Check types of elements here rather than in intersectCells() since a wrong type can be // found late after a long time of calculation. - const unsigned long numSrcElems = srcMesh.getNumberOfElements(); - for(unsigned long i = 0 ; i < numSrcElems ; ++i) + const ConnType numSrcElems = srcMesh.getNumberOfElements(); + for(ConnType i = 0 ; i < numSrcElems ; ++i) if ( srcMesh.getTypeOfElement( OTT::indFC( i )) != NORM_TETRA4 ) throw INTERP_KERNEL::Exception("P1P1 3D algorithm works only with tetrahedral meshes"); - const unsigned long numTgtElems = targetMesh.getNumberOfElements(); - for(unsigned long i = 0 ; i < numTgtElems ; ++i) + const ConnType numTgtElems = targetMesh.getNumberOfElements(); + for(ConnType i = 0 ; i < numTgtElems ; ++i) if ( targetMesh.getTypeOfElement( OTT::indFC( i )) != NORM_TETRA4 ) throw INTERP_KERNEL::Exception("P1P1 3D algorithm works only with tetrahedral meshes"); } diff --git a/src/INTERP_KERNEL/SplitterTetra.txx b/src/INTERP_KERNEL/SplitterTetra.txx index 83b2628f9..293250e9a 100644 --- a/src/INTERP_KERNEL/SplitterTetra.txx +++ b/src/INTERP_KERNEL/SplitterTetra.txx @@ -909,9 +909,9 @@ namespace INTERP_KERNEL void SplitterTetra2::releaseArrays() { // free potential sub-mesh nodes that have been allocated - typename MyMeshTypeT::MyConnType nbOfNodesT = _node_ids.size();// Issue 0020634. - if((int)_nodes.size()>=/*8*/nbOfNodesT) + if(_nodes.size()>=/*8*/_node_ids.size()) { + typename MyMeshTypeT::MyConnType nbOfNodesT = static_cast(_node_ids.size()); std::vector::iterator iter = _nodes.begin() + /*8*/nbOfNodesT; while(iter != _nodes.end()) { @@ -1206,9 +1206,9 @@ namespace INTERP_KERNEL unsigned nbOfSons = cellModelCell.getNumberOfSons2(rawCellConn, rawNbCellNodes); // indices of nodes of a son - static std::vector allNodeIndices; // == 0,1,2,...,nbOfCellNodes-1 + static std::vector allNodeIndices; // == 0,1,2,...,nbOfCellNodes-1 while ( allNodeIndices.size() < nbOfCellNodes ) - allNodeIndices.push_back( allNodeIndices.size() ); + allNodeIndices.push_back( static_cast(allNodeIndices.size()) ); std::vector classicFaceNodes(4); if(cellModelCell.isQuadratic()) throw INTERP_KERNEL::Exception("SplitterTetra2::splitConvex : quadratic 3D cells are not implemented yet !"); @@ -1260,7 +1260,7 @@ namespace INTERP_KERNEL { // retrieve real mesh nodes - typename MyMeshTypeT::MyConnType nbOfNodesT = _node_ids.size();// Issue 0020634. _node_ids.resize(8); + typename MyMeshTypeT::MyConnType nbOfNodesT = static_cast(_node_ids.size());// Issue 0020634. _node_ids.resize(8); for(int node = 0; node < nbOfNodesT ; ++node) { // calculate only normal nodes diff --git a/src/INTERP_KERNEL/TriangulationIntersector.txx b/src/INTERP_KERNEL/TriangulationIntersector.txx index 5efe430ff..365cda2cd 100644 --- a/src/INTERP_KERNEL/TriangulationIntersector.txx +++ b/src/INTERP_KERNEL/TriangulationIntersector.txx @@ -73,7 +73,7 @@ namespace INTERP_KERNEL &CoordsS[0],&CoordsS[SPACEDIM*iS],&CoordsS[SPACEDIM*(iS+1)], inter, PlanarIntersector::_dim_caracteristic, PlanarIntersector::_precision); - ConnType nb_inter=((ConnType)inter.size())/2; + ConnType nb_inter=ToConnType(inter.size())/2; if(nb_inter >3) inter=reconstruct_polygon(inter); for(ConnType i = 1; i::_dim_caracteristic, PlanarIntersector::_precision); - ConnType nb_inter=((ConnType)inter.size())/2; + ConnType nb_inter=ToConnType(inter.size())/2; if(nb_inter >3) inter=reconstruct_polygon(inter); for(ConnType i = 1; i& sourceCoords) { double result = 0.; - ConnType nbNodesS=sourceCoords.size()/SPACEDIM; - ConnType nbNodesT=targetCoords.size()/SPACEDIM; + ConnType nbNodesS=ToConnType(sourceCoords.size())/SPACEDIM; + ConnType nbNodesT=ToConnType(targetCoords.size())/SPACEDIM; //Compute the intersection area double area[SPACEDIM]; for(ConnType iT = 1; iT::_dim_caracteristic, PlanarIntersector::_precision); - ConnType nb_inter=((ConnType)inter.size())/2; + ConnType nb_inter=ToConnType(inter.size())/2; if(nb_inter >3) inter=reconstruct_polygon(inter); for(ConnType i = 1; i inter; @@ -202,7 +202,7 @@ namespace INTERP_KERNEL sourceCell[0], sourceCell[1], sourceCell[2], inter, PlanarIntersector::_dim_caracteristic, PlanarIntersector::_precision); - ConnType nb_inter=((ConnType)inter.size())/2; + ConnType nb_inter=ToConnType(inter.size())/2; if(nb_inter >3) inter=reconstruct_polygon(inter); for(ConnType i = 1; i deque1, std::deque< double > deque2, double epsilon) { - int size1 = deque1.size(); - int size2 = deque2.size(); + std::size_t size1 = deque1.size(); + std::size_t size2 = deque2.size(); bool are_equal = size1 == size2; if(are_equal) - for(int i = 0; i < size1 && are_equal; i++) + for(std::size_t i = 0; i < size1 && are_equal; i++) are_equal = fabs(deque1[i] - deque2[i]) < epsilon; return are_equal; @@ -72,19 +72,19 @@ namespace INTERP_TEST bool checkVectorsEqual(std::vector< double > vect1, std::vector< double > vect2, double epsilon) { - int size1 = vect1.size(); - int size2 = vect2.size(); + std::size_t size1 = vect1.size(); + std::size_t size2 = vect2.size(); bool are_equal = size1 == size2; if(are_equal) - for(int i = 0; i < size1 && are_equal; i++) + for(std::size_t i = 0; i < size1 && are_equal; i++) are_equal = fabs(vect1[i] - vect2[i]) < epsilon; return are_equal; } void dequePrintOut(std::deque< double > deque1) { - for(int i = 0; i< (int)deque1.size(); i++) + for(std::size_t i = 0; i< deque1.size(); i++) { std::cerr << deque1[i] << " "; } @@ -92,7 +92,7 @@ namespace INTERP_TEST } void vectPrintOut(std::vector< double > vect) { - for(int i = 0; i< (int)vect.size(); i++) + for(std::size_t i = 0; i< vect.size(); i++) { std::cerr << vect[i] << " "; } diff --git a/src/MEDCoupling/CMakeLists.txt b/src/MEDCoupling/CMakeLists.txt index 04e0b5b3e..a2253b266 100644 --- a/src/MEDCoupling/CMakeLists.txt +++ b/src/MEDCoupling/CMakeLists.txt @@ -25,6 +25,10 @@ ENDIF(MEDCOUPLING_BUILD_TESTS) ### KILLER WARNINGS TO HELP INT64 MANAGEMENT #ADD_DEFINITIONS(-Wextra -Wsynth -Wno-unused-parameter -pedantic -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wctor-dtor-privacy -Wnon-virtual-dtor -Woverloaded-virtual -Wreturn-type -Wno-endif-labels -Wsign-compare -Wmissing-format-attribute -Wno-multichar -Wno-deprecated-declarations -Wpacked -Wredundant-decls -Wlong-long -Wdisabled-optimization -Wunknown-pragmas -Wundef -Wreorder) +IF (NOT DEFINED MSVC) + ADD_DEFINITIONS(-Wsign-compare -Wconversion) +ENDIF() + INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}/../.. ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/src/MEDCoupling/MCType.hxx b/src/MEDCoupling/MCType.hxx index abc049dd1..87ed588fa 100644 --- a/src/MEDCoupling/MCType.hxx +++ b/src/MEDCoupling/MCType.hxx @@ -34,7 +34,10 @@ namespace MEDCoupling #else using mcIdType = std::int64_t; #endif - inline mcIdType ToIdType(std::size_t val) { return mcIdType(val); } + template inline mcIdType ToIdType(T val) + { + return static_cast(val); + } } #define DataArrayInt DataArrayInt32 diff --git a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx index 074ec7987..19d0dfa6e 100644 --- a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx +++ b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx @@ -150,7 +150,7 @@ std::set MEDCoupling1GTUMesh::getAllGeoTypes( std::vector MEDCoupling1GTUMesh::getDistributionOfTypes() const { std::vector ret(3); - ret[0]=(int)getCellModelEnum(); ret[1]=getNumberOfCells(); ret[2]=-1; + ret[0]=(int)getCellModelEnum(); ret[1]=ToIdType(getNumberOfCells()); ret[2]=-1; return ret; } @@ -184,7 +184,7 @@ void MEDCoupling1GTUMesh::splitProfilePerType(const DataArrayInt *profile, std:: throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::splitProfilePerType : input profile is NULL !"); if(profile->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::splitProfilePerType : input profile should have exactly one component !"); - int nbTuples(profile->getNumberOfTuples()),nbOfCells(getNumberOfCells()); + mcIdType nbTuples=ToIdType(profile->getNumberOfTuples()),nbOfCells=ToIdType(getNumberOfCells()); code.resize(3); idsInPflPerType.resize(1); code[0]=(int)getCellModelEnum(); code[1]=nbTuples; idsInPflPerType.resize(1); @@ -210,7 +210,7 @@ void MEDCoupling1GTUMesh::splitProfilePerType(const DataArrayInt *profile, std:: */ DataArrayInt *MEDCoupling1GTUMesh::checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const { - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); if(code.size()!=3) throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::checkTypeConsistencyAndContig : invalid input code should be exactly of size 3 !"); if(code[0]!=(int)getCellModelEnum()) @@ -432,15 +432,15 @@ MEDCouplingUMesh *MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(const std::v throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh : all the instances in input vector must have same mesh dimension !"); if((*it)->getCoords()!=coords) throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh : all the instances must share the same coordinates pointer !"); - nbOfCells+=(*it)->getNumberOfCells(); - connSize+=(*it)->getNodalConnectivityLength(); + nbOfCells+=ToIdType((*it)->getNumberOfCells()); + connSize+=ToIdType((*it)->getNodalConnectivityLength()); } MCAuto conn(DataArrayInt::New()),connI(DataArrayInt::New()); connI->alloc(nbOfCells+1,1); conn->alloc(connSize+nbOfCells,1); int *c(conn->getPointer()),*ci(connI->getPointer()); *ci=0; for(std::vector< const MEDCoupling1GTUMesh *>::const_iterator it=parts.begin();it!=parts.end();it++) { - int curNbCells((*it)->getNumberOfCells()); + mcIdType curNbCells=ToIdType((*it)->getNumberOfCells()); int geoType((int)(*it)->getCellModelEnum()); const int *cinPtr((*it)->getNodalConnectivity()->begin()); const MEDCoupling1SGTUMesh *ps(dynamic_cast(*it)); @@ -520,7 +520,7 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::New(const MEDCouplingUMesh *m) int geoType((int)*gts.begin()); MCAuto ret(MEDCoupling1SGTUMesh::New(m->getName(),*gts.begin())); ret->setCoords(m->getCoords()); ret->setDescription(m->getDescription()); - int nbCells(m->getNumberOfCells()); + mcIdType nbCells=ToIdType(m->getNumberOfCells()); int nbOfNodesPerCell(ret->getNumberOfNodesPerCell()); MCAuto conn(DataArrayInt::New()); conn->alloc(nbCells*nbOfNodesPerCell,1); int *c(conn->getPointer()); @@ -679,8 +679,8 @@ void MEDCoupling1SGTUMesh::checkConsistency(double eps) const { checkConsistencyLight(); const DataArrayInt *c1(_conn); - int nbOfTuples=c1->getNumberOfTuples(); - int nbOfNodesPerCell=(int)_cm->getNumberOfNodes(); + mcIdType nbOfTuples=ToIdType(c1->getNumberOfTuples()); + mcIdType nbOfNodesPerCell=ToIdType(_cm->getNumberOfNodes()); if(nbOfTuples%nbOfNodesPerCell!=0) { std::ostringstream oss; oss << "MEDCoupling1SGTUMesh::checkConsistency : the nb of tuples in conn is " << nbOfTuples << " and number of nodes per cell is " << nbOfNodesPerCell << ". But " << nbOfTuples << "%" << nbOfNodesPerCell << " !=0 !"; @@ -745,7 +745,7 @@ DataArrayInt *MEDCoupling1SGTUMesh::computeEffectiveNbOfNodesPerCell() const { checkNonDynamicGeoType(); MCAuto ret=DataArrayInt::New(); - int nbCells(getNumberOfCells()); + mcIdType nbCells=ToIdType(getNumberOfCells()); ret->alloc(nbCells,1); int *retPtr(ret->getPointer()); int nbNodesPerCell(getNumberOfNodesPerCell()); @@ -839,7 +839,7 @@ std::string MEDCoupling1SGTUMesh::advancedRepr() const { if(_conn->getNumberOfComponents()==1) { - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); int sz=getNumberOfNodesPerCell(); const int *connPtr=_conn->begin(); for(int i=0;i ret=DataArrayDouble::New(); int spaceDim=getSpaceDimension(); - int nbOfCells=getNumberOfCells();//checkConsistencyLight() + mcIdType nbOfCells=ToIdType(getNumberOfCells());//checkConsistencyLight() int nbOfNodes=getNumberOfNodes(); ret->alloc(nbOfCells,spaceDim); double *ptToFill=ret->getPointer(); @@ -890,7 +890,7 @@ DataArrayDouble *MEDCoupling1SGTUMesh::computeIsoBarycenterOfNodesPerCell() cons void MEDCoupling1SGTUMesh::renumberCells(const int *old2NewBg, bool check) { - int nbCells=getNumberOfCells(); + mcIdType nbCells=ToIdType(getNumberOfCells()); MCAuto o2n=DataArrayInt::New(); o2n->useArray(old2NewBg,false,DeallocType::C_DEALLOC,nbCells,1); if(check) @@ -926,7 +926,7 @@ void MEDCoupling1SGTUMesh::renumberCells(const int *old2NewBg, bool check) */ void MEDCoupling1SGTUMesh::fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, DataArrayInt *&cellIdsKeptArr) const { - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); MCAuto cellIdsKept=DataArrayInt::New(); cellIdsKept->alloc(0,1); int tmp=-1; int sz=_conn->getMaxValue(tmp); sz=std::max(sz,0)+1; @@ -965,7 +965,7 @@ MEDCouplingUMesh *MEDCoupling1SGTUMesh::buildUnstructured() const MCAuto ret=MEDCouplingUMesh::New(getName(),getMeshDimension()); ret->setCoords(getCoords()); const int *nodalConn=_conn->begin(); - int nbCells=getNumberOfCells(); + mcIdType nbCells=ToIdType(getNumberOfCells()); int nbNodesPerCell=getNumberOfNodesPerCell(); int geoType=(int)getCellModelEnum(); MCAuto c=DataArrayInt::New(); c->alloc(nbCells*(nbNodesPerCell+1),1); @@ -1052,7 +1052,7 @@ DataArrayInt *MEDCoupling1SGTUMesh::getNodeIdsInUse(int& nbrOfNodesInUse) const { nbrOfNodesInUse=-1; int nbOfNodes=getNumberOfNodes(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); MCAuto ret(DataArrayInt::New()); ret->alloc(nbOfNodes,1); int *traducer=ret->getPointer(); @@ -1155,7 +1155,7 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::Merge1SGTUMeshes(std::vectorgetCoords(); if(coo) - spaceDim=coo->getNumberOfComponents(); + spaceDim=ToIdType(coo->getNumberOfComponents()); } if(spaceDim==-3) throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::Merge1SGTUMeshes : no spaceDim specified ! unable to perform merge !"); @@ -1209,7 +1209,7 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::Merge1SGTUMeshesLL(std::vector::const_iterator it=a.begin(); - int nbOfCells=(*it)->getNumberOfCells(); + mcIdType nbOfCells=ToIdType((*it)->getNumberOfCells()); const INTERP_KERNEL::CellModel *cm=&((*it)->getCellModel()); int nbNodesPerCell=(*it)->getNumberOfNodesPerCell(); it++; @@ -1217,7 +1217,7 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::Merge1SGTUMeshesLL(std::vectorgetCellModel())) throw INTERP_KERNEL::Exception("Geometric types mismatches, Merge1SGTUMeshes impossible !"); - nbOfCells+=(*it)->getNumberOfCells(); + nbOfCells+=ToIdType((*it)->getNumberOfCells()); } std::vector aps(a.size()); std::copy(a.begin(),a.end(),aps.begin()); @@ -1230,7 +1230,7 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::Merge1SGTUMeshesLL(std::vectorgetNodalConnectivityLength(); + mcIdType curConnLgth=ToIdType((*it)->getNodalConnectivityLength()); const int *curC=(*it)->_conn->begin(); cPtr=std::transform(curC,curC+curConnLgth,cPtr,std::bind2nd(std::plus(),offset)); offset+=(*it)->getNumberOfNodes(); @@ -1242,7 +1242,7 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::Merge1SGTUMeshesLL(std::vector ret(new MEDCoupling1SGTUMesh(getName(),*_cm)); ret->setCoords(_coords); std::size_t nbOfElemsRet=std::distance(begin,end); @@ -1267,7 +1267,7 @@ MEDCouplingPointSet *MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoords(const int MEDCouplingPointSet *MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) const { - int ncell=getNumberOfCells(); + mcIdType ncell=ToIdType(getNumberOfCells()); int nbOfElemsRet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoordsSlice : "); MCAuto ret(new MEDCoupling1SGTUMesh(getName(),*_cm)); ret->setCoords(_coords); @@ -1330,7 +1330,7 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::buildSetInstanceFromThis(int spaceDi DataArrayInt *MEDCoupling1SGTUMesh::simplexizePol0() { - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); if(getCellModelEnum()!=INTERP_KERNEL::NORM_QUAD4) return DataArrayInt::Range(0,nbOfCells,1); MCAuto newConn=DataArrayInt::New(); newConn->alloc(2*3*nbOfCells,1); @@ -1351,7 +1351,7 @@ DataArrayInt *MEDCoupling1SGTUMesh::simplexizePol0() DataArrayInt *MEDCoupling1SGTUMesh::simplexizePol1() { - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); if(getCellModelEnum()!=INTERP_KERNEL::NORM_QUAD4) return DataArrayInt::Range(0,nbOfCells,1); MCAuto newConn=DataArrayInt::New(); newConn->alloc(2*3*nbOfCells,1); @@ -1372,7 +1372,7 @@ DataArrayInt *MEDCoupling1SGTUMesh::simplexizePol1() DataArrayInt *MEDCoupling1SGTUMesh::simplexizePlanarFace5() { - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); if(getCellModelEnum()!=INTERP_KERNEL::NORM_HEXA8) return DataArrayInt::Range(0,nbOfCells,1); MCAuto newConn=DataArrayInt::New(); newConn->alloc(5*4*nbOfCells,1); @@ -1393,7 +1393,7 @@ DataArrayInt *MEDCoupling1SGTUMesh::simplexizePlanarFace5() DataArrayInt *MEDCoupling1SGTUMesh::simplexizePlanarFace6() { - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); if(getCellModelEnum()!=INTERP_KERNEL::NORM_HEXA8) return DataArrayInt::Range(0,nbOfCells,1); MCAuto newConn=DataArrayInt::New(); newConn->alloc(6*4*nbOfCells,1); @@ -1493,7 +1493,7 @@ void MEDCoupling1SGTUMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) co int sz(0); if((const DataArrayInt *)_conn) if(_conn->isAllocated()) - sz=_conn->getNbOfElems(); + sz=ToIdType(_conn->getNbOfElems()); a1=DataArrayInt::New(); a1->alloc(sz,1); if(sz!=0 && (const DataArrayInt *)_conn) @@ -1501,7 +1501,7 @@ void MEDCoupling1SGTUMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) co sz=0; if((const DataArrayDouble *)_coords) if(_coords->isAllocated()) - sz=_coords->getNbOfElems(); + sz=ToIdType(_coords->getNbOfElems()); a2=DataArrayDouble::New(); a2->alloc(sz,1); if(sz!=0 && (const DataArrayDouble *)_coords) @@ -1583,7 +1583,7 @@ void MEDCoupling1SGTUMesh::getReverseNodalConnectivity(DataArrayInt *revNodal, D revNodalIndx->useArray(revNodalIndxPtr,true,DeallocType::C_DEALLOC,nbOfNodes+1,1); std::fill(revNodalIndxPtr,revNodalIndxPtr+nbOfNodes+1,0); const int *conn=_conn->begin(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); int nbOfEltsInRevNodal=0; int nbOfNodesPerCell=getNumberOfNodesPerCell(); for(int eltId=0;eltIdbegin()); MCAuto ret(MEDCoupling1SGTUMesh::New(getName(),INTERP_KERNEL::NORM_QUAD4)); MCAuto c(DataArrayInt::New()); c->alloc(nbHexa8*6*4,1); @@ -1854,7 +1854,8 @@ bool UpdateHexa8Cell(int validAxis, int neighId, const int *validConnQuad4NeighS DataArrayInt *MEDCoupling1SGTUMesh::sortHexa8EachOther() { MCAuto quads(explodeEachHexa8To6Quad4());//checks that only hexa8 - int nbHexa8(getNumberOfCells()),*cQuads(quads->getNodalConnectivity()->getPointer()); + mcIdType nbHexa8=ToIdType(getNumberOfCells()); + int *cQuads(quads->getNodalConnectivity()->getPointer()); MCAuto neighOfQuads(DataArrayInt::New()); neighOfQuads->alloc(nbHexa8*6,1); neighOfQuads->fillWithValue(-1); int *ptNeigh(neighOfQuads->getPointer()); {//neighOfQuads tells for each face of each Quad8 which cell (if!=-1) is connected to this face. @@ -1863,7 +1864,8 @@ DataArrayInt *MEDCoupling1SGTUMesh::sortHexa8EachOther() DataArrayInt *cc(0),*cci(0); quadsTmp->findCommonCells(3,0,cc,cci); ccSafe=cc; cciSafe=cci; - const int *ccPtr(ccSafe->begin()),nbOfPair(cci->getNumberOfTuples()-1); + const int *ccPtr(ccSafe->begin()); + mcIdType nbOfPair=ToIdType(cci->getNumberOfTuples())-1; for(int i=0;i faces(thisu->buildDescendingConnectivity(d2Arr,di2Arr,rd2Arr,rdi2Arr)); thisu=0; const int *d2(d2Arr->begin()),*rdi2(rdi2Arr->begin()); MCAuto edgesBaryArr(edges->computeCellCenterOfMass()),facesBaryArr(faces->computeCellCenterOfMass()),baryArr(computeCellCenterOfMass()); - const int nbOfNodes(getNumberOfNodes()),offset0(nbOfNodes+faces->getNumberOfCells()),offset1(offset0+edges->getNumberOfCells()); + const int nbOfNodes(getNumberOfNodes()); + const mcIdType offset0=nbOfNodes+ToIdType(faces->getNumberOfCells()); + const mcIdType offset1=offset0+ToIdType(edges->getNumberOfCells()); edges=0; faces=0; std::vector v(4); v[0]=getCoords(); v[1]=facesBaryArr; v[2]=edgesBaryArr; v[3]=baryArr; MCAuto zeArr(DataArrayDouble::Aggregate(v)); baryArr=0; edgesBaryArr=0; facesBaryArr=0; @@ -1991,7 +1995,7 @@ MEDCoupling1DGTUMesh *MEDCoupling1SGTUMesh::computeDualMesh3D() const } } } - ciArr->setIJ(i+1,0,cArr->getNumberOfTuples()); + ciArr->setIJ(i+1,0,ToIdType(cArr->getNumberOfTuples())); } ret->setNodalConnectivity(cArr,ciArr); return ret.retn(); @@ -2013,7 +2017,7 @@ MEDCoupling1DGTUMesh *MEDCoupling1SGTUMesh::computeDualMesh2D() const MCAuto edges(thisu->buildDescendingConnectivity(d2Arr,di2Arr,rd2Arr,rdi2Arr)); thisu=0; const int *d2(d2Arr->begin()),*rdi2(rdi2Arr->begin()); MCAuto edgesBaryArr(edges->computeCellCenterOfMass()),baryArr(computeCellCenterOfMass()); - const int nbOfNodes(getNumberOfNodes()),offset0(nbOfNodes+edges->getNumberOfCells()); + const mcIdType nbOfNodes(getNumberOfNodes()),offset0(nbOfNodes+ToIdType(edges->getNumberOfCells())); edges=0; std::vector v(3); v[0]=getCoords(); v[1]=edgesBaryArr; v[2]=baryArr; MCAuto zeArr(DataArrayDouble::Aggregate(v)); baryArr=0; edgesBaryArr=0; @@ -2059,7 +2063,7 @@ MEDCoupling1DGTUMesh *MEDCoupling1SGTUMesh::computeDualMesh2D() const } std::vector zePolyg(MEDCoupling1DGTUMesh::BuildAPolygonFromParts(polyg)); cArr->insertAtTheEnd(zePolyg.begin(),zePolyg.end()); - ciArr->setIJ(i+1,0,cArr->getNumberOfTuples()); + ciArr->setIJ(i+1,0,ToIdType(cArr->getNumberOfTuples())); } ret->setNodalConnectivity(cArr,ciArr); return ret.retn(); @@ -2077,7 +2081,7 @@ MEDCoupling1DGTUMesh *MEDCoupling1SGTUMesh::computeDualMesh2D() const */ DataArrayDouble *MEDCoupling1SGTUMesh::getBoundingBoxForBBTree(double arcDetEps) const { - int spaceDim(getSpaceDimension()),nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes()),nbOfNodesPerCell(getNumberOfNodesPerCell()); + int spaceDim(getSpaceDimension()),nbOfCells(ToIdType(getNumberOfCells())),nbOfNodes(getNumberOfNodes()),nbOfNodesPerCell(getNumberOfNodesPerCell()); MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim); double *bbox(ret->getPointer()); for(int i=0;i ret(MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME)); - int nbCells(getNumberOfCells()); + mcIdType nbCells=ToIdType(getNumberOfCells()); MCAuto arr(DataArrayDouble::New()); arr->alloc(nbCells,1); INTERP_KERNEL::AutoCppPtr dc(_cm->buildInstanceOfDiameterCalulator(getSpaceDimension())); @@ -2141,7 +2145,7 @@ void MEDCoupling1SGTUMesh::invertOrientationOfAllCells() { checkConsistencyOfConnectivity(); INTERP_KERNEL::AutoCppPtr oi(INTERP_KERNEL::OrientationInverter::BuildInstanceFrom(getCellModelEnum())); - int nbOfNodesPerCell((int)_cm->getNumberOfNodes()),nbCells(getNumberOfCells()); + mcIdType nbOfNodesPerCell=ToIdType(_cm->getNumberOfNodes()),nbCells=ToIdType(getNumberOfCells()); int *conn(_conn->getPointer()); for(int i=0;ioperate(conn+i*nbOfNodesPerCell,conn+(i+1)*nbOfNodesPerCell); @@ -2364,7 +2368,7 @@ void MEDCoupling1DGTUMesh::checkConsistencyOfConnectivity() const else throw INTERP_KERNEL::Exception("Nodal connectivity array not defined !"); // - int sz2=_conn->getNumberOfTuples(); + mcIdType sz2=ToIdType(_conn->getNumberOfTuples()); c1=_conn_indx; if(c1) { @@ -2420,7 +2424,7 @@ void MEDCoupling1DGTUMesh::checkConsistency(double eps) const if(!c2->isMonotonic(true)) throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::checkConsistency : the nodal connectivity index is expected to be increasing monotinic !"); // - int nbOfTuples=c1->getNumberOfTuples(); + mcIdType nbOfTuples=ToIdType(c1->getNumberOfTuples()); int nbOfNodes=getNumberOfNodes(); const int *w(c1->begin()); for(int i=0;ideltaShiftIndex(); // for polyhedrons - int nbOfCells=_conn_indx->getNumberOfTuples()-1; + mcIdType nbOfCells=ToIdType(_conn_indx->getNumberOfTuples())-1; MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfCells,1); int *retPtr=ret->getPointer(); const int *ci=_conn_indx->begin(),*c=_conn->begin(); for(int i=0;igetNumberOfTuples()-1; + mcIdType nbOfCells=ToIdType(_conn_indx->getNumberOfTuples())-1; MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfCells,1); int *retPtr=ret->getPointer(); const int *ci=_conn_indx->begin(),*c=_conn->begin(); for(int i=0;icheckMonotonic(true); - int nbOfCells(_conn_indx->getNumberOfTuples()-1); + mcIdType nbOfCells=ToIdType(_conn_indx->getNumberOfTuples())-1; MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfCells,1); int *retPtr(ret->getPointer()); @@ -2534,7 +2538,7 @@ void MEDCoupling1DGTUMesh::getNodeIdsOfCell(std::size_t cellId, std::vector std::size_t nbOfCells(getNumberOfCells());//performs checks if(cellIdgetIJ(cellId,0),stp=_conn_indx->getIJ(cellId+1,0); + int strt=_conn_indx->getIJ(ToIdType(cellId),0),stp=_conn_indx->getIJ(ToIdType(cellId)+1,0); int nbOfNodes=stp-strt; if(nbOfNodes<0) throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::getNodeIdsOfCell : the index array is invalid ! Should be increasing monotonic !"); @@ -2550,12 +2554,12 @@ void MEDCoupling1DGTUMesh::getNodeIdsOfCell(std::size_t cellId, std::vector int MEDCoupling1DGTUMesh::getNumberOfNodesInCell(int cellId) const { - int nbOfCells(getNumberOfCells());//performs checks + mcIdType nbOfCells=ToIdType(getNumberOfCells());//performs checks if(cellId>=0 && cellIdbegin()); int strt=_conn_indx->getIJ(cellId,0),stp=_conn_indx->getIJ(cellId+1,0); - return stp-strt-std::count(conn+strt,conn+stp,-1); + return stp-strt-ToIdType(std::count(conn+strt,conn+stp,-1)); } else { @@ -2622,7 +2626,7 @@ std::string MEDCoupling1DGTUMesh::advancedRepr() const } if(!isOK) return ret.str(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); const int *ci=_conn_indx->begin(),*c=_conn->begin(); for(int i=0;i ret=DataArrayDouble::New(); int spaceDim=getSpaceDimension(); - int nbOfCells=getNumberOfCells();//checkConsistencyLight() + mcIdType nbOfCells=ToIdType(getNumberOfCells());//checkConsistencyLight() int nbOfNodes=getNumberOfNodes(); ret->alloc(nbOfCells,spaceDim); double *ptToFill=ret->getPointer(); @@ -2712,7 +2716,7 @@ DataArrayDouble *MEDCoupling1DGTUMesh::computeIsoBarycenterOfNodesPerCell() cons void MEDCoupling1DGTUMesh::renumberCells(const int *old2NewBg, bool check) { - int nbCells=getNumberOfCells(); + mcIdType nbCells=ToIdType(getNumberOfCells()); MCAuto o2n=DataArrayInt::New(); o2n->useArray(old2NewBg,false,DeallocType::C_DEALLOC,nbCells,1); if(check) @@ -2762,7 +2766,7 @@ MEDCouplingUMesh *MEDCoupling1DGTUMesh::buildUnstructured() const MCAuto ret=MEDCouplingUMesh::New(getName(),getMeshDimension()); ret->setCoords(getCoords()); const int *nodalConn=_conn->begin(),*nodalConnI=_conn_indx->begin(); - int nbCells=getNumberOfCells();//checkConsistencyLight + mcIdType nbCells=ToIdType(getNumberOfCells());//checkConsistencyLight int geoType=(int)getCellModelEnum(); MCAuto c=DataArrayInt::New(); c->alloc(nbCells+_conn->getNumberOfTuples(),1); MCAuto cI=DataArrayInt::New(); cI->alloc(nbCells+1); @@ -2795,7 +2799,7 @@ MEDCouplingUMesh *MEDCoupling1DGTUMesh::buildUnstructured() const */ DataArrayInt *MEDCoupling1DGTUMesh::simplexize(int policy) { - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfCells,1); ret->iota(0); @@ -2896,7 +2900,7 @@ void MEDCoupling1DGTUMesh::getReverseNodalConnectivity(DataArrayInt *revNodal, D revNodalIndx->useArray(revNodalIndxPtr,true,DeallocType::C_DEALLOC,nbOfNodes+1,1); std::fill(revNodalIndxPtr,revNodalIndxPtr+nbOfNodes+1,0); const int *conn=_conn->begin(),*conni=_conn_indx->begin(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); int nbOfEltsInRevNodal=0; for(int eltId=0;eltIdisAllocated()) - sz=_conn->getNbOfElems(); + sz=ToIdType(_conn->getNbOfElems()); if((const DataArrayInt *)_conn_indx) if(_conn_indx->isAllocated()) - sz+=_conn_indx->getNbOfElems(); + sz+=ToIdType(_conn_indx->getNbOfElems()); a1=DataArrayInt::New(); a1->alloc(sz,1); int *work(a1->getPointer()); @@ -3026,7 +3030,7 @@ void MEDCoupling1DGTUMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) co sz=0; if((const DataArrayDouble *)_coords) if(_coords->isAllocated()) - sz=_coords->getNbOfElems(); + sz=ToIdType(_coords->getNbOfElems()); a2=DataArrayDouble::New(); a2->alloc(sz,1); if(sz!=0 && (const DataArrayDouble *)_coords) @@ -3111,7 +3115,7 @@ DataArrayInt *MEDCoupling1DGTUMesh::getNodeIdsInUse(int& nbrOfNodesInUse) const { nbrOfNodesInUse=-1; int nbOfNodes=getNumberOfNodes(); - int nbOfCells=getNumberOfCells();//checkConsistencyLight + mcIdType nbOfCells=ToIdType(getNumberOfCells());//checkConsistencyLight MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfNodes,1); int *traducer=ret->getPointer(); @@ -3150,9 +3154,9 @@ void MEDCoupling1DGTUMesh::renumberNodesWithOffsetInConn(int offset) { getNumberOfCells();//only to check that all is well defined. // - int nbOfTuples(_conn->getNumberOfTuples()); + std::size_t nbOfTuples(_conn->getNumberOfTuples()); int *pt(_conn->getPointer()); - for(int i=0;igetNumberOfTuples()); + mcIdType nbElemsIn(getNumberOfNodes()),nbOfTuples(ToIdType(_conn->getNumberOfTuples())); int *pt(_conn->getPointer()); for(int i=0;i cellIdsKept=DataArrayInt::New(); cellIdsKept->alloc(0,1); int tmp=-1; int sz=_conn->getMaxValue(tmp); sz=std::max(sz,0)+1; @@ -3292,7 +3296,7 @@ void MEDCoupling1DGTUMesh::insertNextCell(const int *nodalConnOfCellBg, const in if(pos==(int)c->getNumberOfTuples()) { c->pushBackValsSilent(nodalConnOfCellBg,nodalConnOfCellEnd); - c2->pushBackSilent(pos+sz); + c2->pushBackSilent(pos+ToIdType(sz)); } else { @@ -3439,7 +3443,7 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::Merge1DGTUMeshes(std::vectorgetCoords(); if(coo) - spaceDim=coo->getNumberOfComponents(); + spaceDim=ToIdType(coo->getNumberOfComponents()); } if(spaceDim==-3) throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::Merge1DGTUMeshes : no spaceDim specified ! unable to perform merge !"); @@ -3501,7 +3505,7 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::Merge1DGTUMeshesLL(std::vector ncs(a.size()),ncis(a.size()); std::vector::const_iterator it=a.begin(); std::vector nbNodesPerElt(a.size()); - int nbOfCells=(*it)->getNumberOfCells(); + std::size_t nbOfCells=(*it)->getNumberOfCells(); bool tmp; objs[0]=(*it)->copyWithNodalConnectivityPacked(tmp); ncs[0]=objs[0]->getNodalConnectivity(); ncis[0]=objs[0]->getNodalConnectivityIndex(); @@ -3573,7 +3577,7 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::buildSetInstanceFromThis(int spaceDi DataArrayDouble *MEDCoupling1DGTUMesh::getBoundingBoxForBBTree(double arcDetEps) const { checkFullyDefined(); - int spaceDim(getSpaceDimension()),nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes()); + int spaceDim(getSpaceDimension()),nbOfCells(ToIdType(getNumberOfCells())),nbOfNodes(getNumberOfNodes()); MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim); double *bbox(ret->getPointer()); for(int i=0;i oi(INTERP_KERNEL::OrientationInverter::BuildInstanceFrom(getCellModelEnum())); - int nbCells(getNumberOfCells()); + mcIdType nbCells=ToIdType(getNumberOfCells()); const int *connI(_conn_indx->begin()); int *conn(_conn->getPointer()); for(int i=0;i::const_iterator it=nodalConns.begin();it!=nodalConns.end();it++) { if(!(*it)) @@ -3695,7 +3699,7 @@ DataArrayInt *MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(const std: int i=0; for(std::vector::const_iterator it=nodalConns.begin();it!=nodalConns.end();it++,i++) { - int curNbt=(*it)->getNumberOfTuples(); + int curNbt=ToIdType((*it)->getNumberOfTuples()); const int *inPt=(*it)->begin(); int offset=offsetInNodeIdsPerElt[i]; for(int j=0;j ret(MEDCoupling1DGTUMesh::New(m->getName(),*gts.begin())); ret->setCoords(m->getCoords()); ret->setDescription(m->getDescription()); - int nbCells(m->getNumberOfCells()); + mcIdType nbCells=ToIdType(m->getNumberOfCells()); MCAuto conn(DataArrayInt::New()),connI(DataArrayInt::New()); conn->alloc(m->getNodalConnectivityArrayLen()-nbCells,1); connI->alloc(nbCells+1,1); int *c(conn->getPointer()),*ci(connI->getPointer()); *ci=0; diff --git a/src/MEDCoupling/MEDCoupling1GTUMesh.txx b/src/MEDCoupling/MEDCoupling1GTUMesh.txx index 99fa524d4..c11c4d08a 100644 --- a/src/MEDCoupling/MEDCoupling1GTUMesh.txx +++ b/src/MEDCoupling/MEDCoupling1GTUMesh.txx @@ -28,7 +28,7 @@ void MEDCoupling::MEDCoupling1SGTUMesh::renumberNodesInConnT(const MAPCLS& newNo { getNumberOfCells();//only to check that all is well defined. int *begPtr(_conn->getPointer()); - int nbElt(_conn->getNumberOfTuples()); + mcIdType nbElt=ToIdType(_conn->getNumberOfTuples()); int *endPtr(begPtr+nbElt); for(int *it=begPtr;it!=endPtr;it++) { @@ -51,7 +51,7 @@ void MEDCoupling::MEDCoupling1DGTUMesh::renumberNodesInConnT(const MAPCLS& newNo { getNumberOfCells();//only to check that all is well defined. // - int nbOfTuples(_conn->getNumberOfTuples()); + mcIdType nbOfTuples=ToIdType(_conn->getNumberOfTuples()); int *pt(_conn->getPointer()); for(int i=0;ialloc(0,info.second); _arrs[i].first->setName(info.first); - names[i]=info.second; + names[i]=info.first; _arrs[i].second=IntensiveMaximum; } CheckDiscriminantNames(names); @@ -1021,7 +1021,7 @@ std::string MEDCouplingAMRAttribute::writeVTHB(const std::string& fileName) cons std::copy(orig.begin(),orig.end(),std::ostream_iterator(ofs," ")); ofs << "\" grid_description=\""; for(int i=0;i\n"; diff --git a/src/MEDCoupling/MEDCouplingCMesh.cxx b/src/MEDCoupling/MEDCouplingCMesh.cxx old mode 100644 new mode 100755 index bad815c4f..3f96a498c --- a/src/MEDCoupling/MEDCouplingCMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCMesh.cxx @@ -303,7 +303,7 @@ std::vector MEDCouplingCMesh::getNodeGridStructure() const { if(!_x_array->isAllocated() || _x_array->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("MEDCouplingCMesh::getNodeGridStructure : X array exits but it is not allocated or with nb of components equal to one !"); - ret.push_back(_x_array->getNumberOfTuples()); + ret.push_back(ToIdType(_x_array->getNumberOfTuples())); } else isOK=false; @@ -313,7 +313,7 @@ std::vector MEDCouplingCMesh::getNodeGridStructure() const throw INTERP_KERNEL::Exception("MEDCouplingCMesh::getNodeGridStructure : Y array exits but it is not allocated or with nb of components equal to one !"); if(!isOK) throw INTERP_KERNEL::Exception(MSG); - ret.push_back(_y_array->getNumberOfTuples()); + ret.push_back(ToIdType(_y_array->getNumberOfTuples())); } else isOK=false; @@ -323,7 +323,7 @@ std::vector MEDCouplingCMesh::getNodeGridStructure() const throw INTERP_KERNEL::Exception("MEDCouplingCMesh::getNodeGridStructure : Z array exits but it is not allocated or with nb of components equal to one !"); if(!isOK) throw INTERP_KERNEL::Exception(MSG); - ret.push_back(_z_array->getNumberOfTuples()); + ret.push_back(ToIdType(_z_array->getNumberOfTuples())); } return ret; } @@ -542,7 +542,7 @@ void MEDCouplingCMesh::getBoundingBox(double *bbox) const if(c) { const double *coords=c->getConstPointer(); - int nb=c->getNbOfElems(); + mcIdType nb=ToIdType(c->getNbOfElems()); bbox[2*j]=coords[0]; bbox[2*j+1]=coords[nb-1]; j++; @@ -565,7 +565,7 @@ MEDCouplingFieldDouble *MEDCouplingCMesh::getMeasureField(bool isAbs) const { std::string name="MeasureOfMesh_"; name+=getName(); - int nbelem=getNumberOfCells(); + mcIdType nbelem=ToIdType(getNumberOfCells()); MEDCouplingFieldDouble *field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); field->setName(name); DataArrayDouble* array=DataArrayDouble::New(); @@ -611,7 +611,7 @@ int MEDCouplingCMesh::getCellContainingPoint(const double *pos, double eps) cons for(int i=0;igetConstPointer(); - int nbOfNodes=getCoordsAt(i)->getNbOfElems(); + mcIdType nbOfNodes=ToIdType(getCoordsAt(i)->getNbOfElems()); double ref=pos[i]; const double *w=std::find_if(d,d+nbOfNodes,std::bind2nd(std::greater_equal(),ref)); int w2=(int)std::distance(d,w); @@ -677,7 +677,7 @@ void MEDCouplingCMesh::scale(const double *point, double factor) if(c) { double *coords=c->getPointer(); - int lgth=c->getNbOfElems(); + mcIdType lgth=ToIdType(c->getNbOfElems()); std::transform(coords,coords+lgth,coords,std::bind2nd(std::minus(),point[i])); std::transform(coords,coords+lgth,coords,std::bind2nd(std::multiplies(),factor)); std::transform(coords,coords+lgth,coords,std::bind2nd(std::plus(),point[i])); @@ -737,7 +737,7 @@ DataArrayDouble *MEDCouplingCMesh::computeCellCenterOfMass() const { DataArrayDouble *ret=DataArrayDouble::New(); int spaceDim=getSpaceDimension(); - int nbCells=getNumberOfCells(); + mcIdType nbCells=ToIdType(getNumberOfCells()); ret->alloc(nbCells,spaceDim); double *pt=ret->getPointer(); int tmp[3]; @@ -746,7 +746,7 @@ DataArrayDouble *MEDCouplingCMesh::computeCellCenterOfMass() const std::vector tabsPtr[3]; for(int j=0;jgetNbOfElems()-1; + int sz=ToIdType(tabs[j]->getNbOfElems())-1; ret->setInfoOnComponent(j,tabs[j]->getInfoOnComponent(0)); const double *srcPtr=tabs[j]->getConstPointer(); tabsPtr[j].insert(tabsPtr[j].end(),srcPtr,srcPtr+sz); @@ -790,7 +790,7 @@ void MEDCouplingCMesh::getTinySerializationInformation(std::vector& tiny std::string st; if(thisArr[i]) { - val=thisArr[i]->getNumberOfTuples(); + val=ToIdType(thisArr[i]->getNumberOfTuples()); st=thisArr[i]->getInfoOnComponent(0); } tinyInfo.push_back(val); @@ -820,7 +820,7 @@ void MEDCouplingCMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const for(int i=0;i<3;i++) { if(thisArr[i]) - sz+=thisArr[i]->getNumberOfTuples(); + sz+=ToIdType(thisArr[i]->getNumberOfTuples()); } a2=DataArrayDouble::New(); a2->alloc(sz,1); @@ -898,16 +898,16 @@ void MEDCouplingCMesh::reprQuickOverview(std::ostream& stream) const isDef[i]=thisArr[i]!=0; if(isDef[i]) { - char tmp='X'+i; + char tmp=(char)((int)('X')+i); stream2[i] << tmp << " positions array "; if(!thisArr[i]->isAllocated()) stream2[i] << "set but not allocated."; else { - int nbCompo=thisArr[i]->getNumberOfComponents(); + mcIdType nbCompo=ToIdType(thisArr[i]->getNumberOfComponents()); if(nbCompo==1) { - int nbTuples=thisArr[i]->getNumberOfTuples(); + mcIdType nbTuples=ToIdType(thisArr[i]->getNumberOfTuples()); if(nbTuples<1) { stream2[i] << "set and allocated - WARNING number of elements < 1 !"; nbOfCells=-1; nbOfNodes=-1; } else diff --git a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx old mode 100644 new mode 100755 index c4ea2728f..743948d7a --- a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx @@ -426,7 +426,7 @@ void MEDCouplingCartesianAMRPatch::ComputeZonesOfTwoRelativeToOneDiffLev(int gho const MEDCouplingCartesianAMRMeshGen *comAncestor(ancestorsOfThis[levThis]); int idThis(comAncestor->getPatchIdFromChildMesh(ancestorsOfThis[levThis-1])),idOther(comAncestor->getPatchIdFromChildMesh(work2)); const MEDCouplingCartesianAMRPatch *thisp(comAncestor->getPatch(idThis)),*otherp(comAncestor->getPatch(idOther)); - std::vector offset(ComputeOffsetFromTwoToOne(comAncestor,levOther,thisp,otherp)); + std::vector offset(ComputeOffsetFromTwoToOne(comAncestor,ToIdType(levOther),thisp,otherp)); p1Zone=thisp->getBLTRRange(); p2Zone=MEDCouplingStructuredMesh::TranslateCompactFrmt(otherp->getBLTRRange(),offset); factToApplyOn2.resize(p1Zone.size()); std::fill(factToApplyOn2.begin(),factToApplyOn2.end(),1); // @@ -625,7 +625,7 @@ int MEDCouplingCartesianAMRMeshGen::getMaxNumberOfLevelsRelativeToThis() const */ int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsAtCurrentLevel() const { - return _mesh->getNumberOfCells(); + return ToIdType(_mesh->getNumberOfCells()); } /*! @@ -638,7 +638,7 @@ int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsAtCurrentLevel() const int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsAtCurrentLevelGhost(int ghostLev) const { MCAuto tmp(_mesh->buildWithGhost(ghostLev)); - return tmp->getNumberOfCells(); + return ToIdType(tmp->getNumberOfCells()); } /*! @@ -647,7 +647,7 @@ int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsAtCurrentLevelGhost(int ghos */ int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsRecursiveWithOverlap() const { - int ret(_mesh->getNumberOfCells()); + mcIdType ret=ToIdType(_mesh->getNumberOfCells()); for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++) { ret+=(*it)->getNumberOfCellsRecursiveWithOverlap(); @@ -664,7 +664,7 @@ int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsRecursiveWithOverlap() const */ int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsRecursiveWithoutOverlap() const { - int ret(_mesh->getNumberOfCells()); + mcIdType ret=ToIdType(_mesh->getNumberOfCells()); for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++) { ret-=(*it)->getNumberOfOverlapedCellsForFather(); @@ -929,7 +929,7 @@ bool FindInflection(const INTERP_KERNEL::BoxSplittingOptions& bso, const Interna if ( sign==0 || sign==-1 ) if ( i >= (std::size_t)minimumPatchLength-2 && i <= signature.size()-minimumPatchLength-2 ) { - zero_cross.push_back(i) ; + zero_cross.push_back(ToIdType(i)) ; edge.push_back(gradient_absolute[i]) ; } } @@ -940,12 +940,12 @@ bool FindInflection(const INTERP_KERNEL::BoxSplittingOptions& bso, const Interna if (edge[i]==max_cross) max_cross_list.push_back(zero_cross[i]+1) ; - double center((signature.size()/2.0)); + double center(static_cast(signature.size())/2.0); for (unsigned int i=0;i=0 ) { @@ -975,7 +975,7 @@ bool FindInflection(const INTERP_KERNEL::BoxSplittingOptions& bso, const Interna max_cross_dims = 1 ; } else - max_cross_dims=std::find(zeroCrossVals.begin(),zeroCrossVals.end(),max_cross_dims)-zeroCrossVals.begin(); + max_cross_dims=ToIdType(std::find(zeroCrossVals.begin(),zeroCrossVals.end(),max_cross_dims)-zeroCrossVals.begin()); cutFound=true; cutPlace=zeroCrossDims[max_cross_dims]; axisId=max_cross_dims ; @@ -1022,7 +1022,7 @@ void DealWithCut(double minPatchLgth, const InternalPatch *patchToBeSplit, int a rightRect[axisId].first=cutPlace+1; leftPart=patchToBeSplit->extractPart(leftRect); rightPart=patchToBeSplit->extractPart(rightRect); - leftPart->zipToFitOnCriterion(minPatchLgth); rightPart->zipToFitOnCriterion(minPatchLgth); + leftPart->zipToFitOnCriterion(ToIdType(minPatchLgth)); rightPart->zipToFitOnCriterion(ToIdType(minPatchLgth)); listOfPatches.push_back(leftPart); listOfPatches.push_back(rightPart); } diff --git a/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx b/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx old mode 100644 new mode 100755 index 1ca531a99..3f68ec54f --- a/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx @@ -193,7 +193,7 @@ void MEDCouplingCurveLinearMesh::checkConsistencyLight() const throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkConsistencyLight : the array is not allocated !"); if(_coords->getNumberOfComponents()<1) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkConsistencyLight : the array should have >= 1 components !"); - if(_coords->getNumberOfTuples()!=(int)nbOfNodes) + if(_coords->getNumberOfTuples()!=nbOfNodes) { std::ostringstream oss; oss << "MEDCouplingCurveLinearMesh::checkConsistencyLight : structure said that number of nodes should be equal to " << nbOfNodes << " but number of tuples in array is equal to " << _coords->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -232,15 +232,15 @@ int MEDCouplingCurveLinearMesh::getSpaceDimension() const { if(!((const DataArrayDouble *)_coords)) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getSpaceDimension : no array set ! impossible to deduce a space dimension !"); - return _coords->getNumberOfComponents(); + return ToIdType(_coords->getNumberOfComponents()); } void MEDCouplingCurveLinearMesh::getCoordinatesOfNode(int nodeId, std::vector& coo) const { if(!((const DataArrayDouble *)_coords)) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getCoordinatesOfNode : Coordinates not set !"); - int nbOfCompo=_coords->getNumberOfComponents(); - if(nodeId>=0 && nodeId<_coords->getNumberOfTuples()) + mcIdType nbOfCompo=ToIdType(_coords->getNumberOfComponents()); + if(nodeId>=0 && nodeId<(ToIdType(_coords->getNumberOfTuples()))) coo.insert(coo.end(),_coords->begin()+nodeId*nbOfCompo,_coords->begin()+(nodeId+1)*nbOfCompo); else { std::ostringstream oss; oss << "MEDCouplingCurveLinearMesh::getCoordinatesOfNode : nodeId has to be in [0," << _coords->getNumberOfTuples() << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } @@ -406,7 +406,7 @@ void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim1(bool isAbs, MEDCoupling */ void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim2(bool isAbs, MEDCouplingFieldDouble *field) const { - int nbcells=getNumberOfCells(); + mcIdType nbcells=ToIdType(getNumberOfCells()); int spaceDim=getSpaceDimension(); if(spaceDim!=2 && spaceDim!=3) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim2 : with meshDim 2 only space dimension 2 and 3 are possible !"); @@ -432,7 +432,7 @@ void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim2(bool isAbs, MEDCoupling */ void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim3(bool isAbs, MEDCouplingFieldDouble *field) const { - int nbcells=getNumberOfCells(); + mcIdType nbcells=ToIdType(getNumberOfCells()); int spaceDim=getSpaceDimension(); if(spaceDim!=3) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim3 : with meshDim 3 only space dimension 3 is possible !"); @@ -470,7 +470,7 @@ MEDCouplingFieldDouble *MEDCouplingCurveLinearMesh::buildOrthogonalField() const throw INTERP_KERNEL::Exception("Expected a cmesh with meshDim == 2 !"); MEDCouplingFieldDouble *ret=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME); DataArrayDouble *array=DataArrayDouble::New(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); array->alloc(nbOfCells,3); double *vals=array->getPointer(); for(int i=0;igetNumberOfTuples(); + mcIdType nbNodes=ToIdType(_coords->getNumberOfTuples()); double *coords=_coords->getPointer(); if(spaceDim==3) DataArrayDouble::Rotate3DAlg(center,vector,angle,nbNodes,coords,coords); @@ -680,8 +680,8 @@ void MEDCouplingCurveLinearMesh::scale(const double *point, double factor) if(!((DataArrayDouble *)_coords)) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::scale : no coordinates set !"); double *coords=_coords->getPointer(); - int nbNodes=_coords->getNumberOfTuples(); - int dim=_coords->getNumberOfComponents(); + mcIdType nbNodes=ToIdType(_coords->getNumberOfTuples()); + mcIdType dim=ToIdType(_coords->getNumberOfComponents()); for(int i=0;i()); @@ -711,7 +711,7 @@ DataArrayDouble *MEDCouplingCurveLinearMesh::computeCellCenterOfMass() const MCAuto ret=DataArrayDouble::New(); int spaceDim=getSpaceDimension(); int meshDim=getMeshDimension(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); ret->alloc(nbOfCells,spaceDim); ret->copyStringInfoFrom(*getCoords()); switch(meshDim) @@ -738,7 +738,7 @@ DataArrayDouble *MEDCouplingCurveLinearMesh::computeIsoBarycenterOfNodesPerCell( */ void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim3(DataArrayDouble *bary) const { - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); double *ptToFill=bary->getPointer(); const double *coor=_coords->getConstPointer(); if(getSpaceDimension()!=3) @@ -764,7 +764,7 @@ void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim3(DataArrayDouble * */ void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim2(DataArrayDouble *bary) const { - int nbcells=getNumberOfCells(); + mcIdType nbcells=ToIdType(getNumberOfCells()); int spaceDim=getSpaceDimension(); double *ptToFill=bary->getPointer(); const double *coor=_coords->getConstPointer(); @@ -843,7 +843,7 @@ void MEDCouplingCurveLinearMesh::serialize(DataArrayInt *&a1, DataArrayDouble *& int sz=0; if((const DataArrayDouble *)_coords) if(_coords->isAllocated()) - sz=_coords->getNbOfElems(); + sz=ToIdType(_coords->getNbOfElems()); a2=DataArrayDouble::New(); a2->alloc(sz,1); if(sz!=0 && (const DataArrayDouble *)_coords) @@ -903,11 +903,12 @@ void MEDCouplingCurveLinearMesh::reprQuickOverview(std::ostream& stream) const { stream << "MEDCouplingCurveLinearMesh C++ instance at " << this << ". Name : \"" << getName() << "\"."; stream << " Nodal structure : ["; - for(std::size_t i=0;i<_structure.size();i++) + mcIdType s_size=ToIdType(_structure.size()); + for(mcIdType i=0;iisAllocated()) { stream << std::endl << "Coordinates set but not allocated !"; return ; } - int nbOfCompo(coo->getNumberOfComponents()); + mcIdType nbOfCompo=ToIdType(coo->getNumberOfComponents()); int nbOfCompoExp(-1); try { nbOfCompoExp=getSpaceDimension(); } - catch(INTERP_KERNEL::Exception& e) + catch(INTERP_KERNEL::Exception&) { } if(nbOfCompo!=nbOfCompoExp) diff --git a/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx b/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx old mode 100644 new mode 100755 index 419218f6d..525987d3c --- a/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx @@ -235,7 +235,7 @@ std::vector MEDCouplingFieldDiscretization::getDirectCh void MEDCouplingFieldDiscretization::normL1(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, double *res) const { MCAuto vol=getMeasureField(mesh,true); - int nbOfCompo=arr->getNumberOfComponents(); + mcIdType nbOfCompo=ToIdType(arr->getNumberOfComponents()); int nbOfElems=getNumberOfTuples(mesh); std::fill(res,res+nbOfCompo,0.); const double *arrPtr=arr->getConstPointer(); @@ -259,7 +259,7 @@ void MEDCouplingFieldDiscretization::normL1(const MEDCouplingMesh *mesh, const D void MEDCouplingFieldDiscretization::normL2(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, double *res) const { MCAuto vol=getMeasureField(mesh,true); - int nbOfCompo=arr->getNumberOfComponents(); + mcIdType nbOfCompo=ToIdType(arr->getNumberOfComponents()); int nbOfElems=getNumberOfTuples(mesh); std::fill(res,res+nbOfCompo,0.); const double *arrPtr=arr->getConstPointer(); @@ -428,8 +428,8 @@ void MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr(double eps, cons { if(!arr) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr : input array is NULL !"); - int oldNbOfElems=arr->getNumberOfTuples(); - int nbOfComp=arr->getNumberOfComponents(); + mcIdType oldNbOfElems=ToIdType(arr->getNumberOfTuples()); + mcIdType nbOfComp=ToIdType(arr->getNumberOfComponents()); int newNbOfTuples=newNbOfEntity; MCAuto arrCpy=arr->deepCopy(); const double *ptSrc=arrCpy->getConstPointer(); @@ -464,7 +464,7 @@ void MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr(double eps, cons void MEDCouplingFieldDiscretization::RenumberEntitiesFromN2OArr(const int *new2OldPtr, int new2OldSz, DataArrayDouble *arr, const std::string& msg) { - int nbOfComp=arr->getNumberOfComponents(); + mcIdType nbOfComp=ToIdType(arr->getNumberOfComponents()); MCAuto arrCpy=arr->deepCopy(); const double *ptSrc=arrCpy->getConstPointer(); arr->reAlloc(new2OldSz); @@ -537,7 +537,7 @@ int MEDCouplingFieldDiscretizationP0::getNumberOfTuples(const MEDCouplingMesh *m { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getNumberOfTuples : NULL input mesh !"); - return mesh->getNumberOfCells(); + return ToIdType(mesh->getNumberOfCells()); } /*! @@ -582,14 +582,14 @@ int MEDCouplingFieldDiscretizationP0::getNumberOfMeshPlaces(const MEDCouplingMes { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getNumberOfMeshPlaces : NULL input mesh !"); - return mesh->getNumberOfCells(); + return ToIdType(mesh->getNumberOfCells()); } DataArrayInt *MEDCouplingFieldDiscretizationP0::getOffsetArr(const MEDCouplingMesh *mesh) const { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getOffsetArr : NULL input mesh !"); - int nbOfTuples=mesh->getNumberOfCells(); + std::size_t nbOfTuples=mesh->getNumberOfCells(); DataArrayInt *ret=DataArrayInt::New(); ret->alloc(nbOfTuples+1,1); ret->iota(0); @@ -689,7 +689,7 @@ DataArrayDouble *MEDCouplingFieldDiscretizationP0::getValueOnMulti(const DataArr mesh->getCellsContainingPoints(loc,nbOfPoints,_precision,eltsArr,eltsIndexArr); const int *elts(eltsArr->begin()),*eltsIndex(eltsIndexArr->begin()); int spaceDim=mesh->getSpaceDimension(); - int nbOfComponents=arr->getNumberOfComponents(); + mcIdType nbOfComponents=ToIdType(arr->getNumberOfComponents()); MCAuto ret=DataArrayDouble::New(); ret->alloc(nbOfPoints,nbOfComponents); double *ptToFill=ret->getPointer(); @@ -1061,7 +1061,7 @@ void MEDCouplingFieldDiscretizationP1::getValueInCell(const MEDCouplingMesh *mes INTERP_KERNEL::AutoPtr tmp=new double[nbOfNodes]; INTERP_KERNEL::NormalizedCellType ct(mesh->getTypeOfCell(cellId)); INTERP_KERNEL::barycentric_coords(ct,vec,loc,tmp); - int sz=arr->getNumberOfComponents(); + mcIdType sz=ToIdType(arr->getNumberOfComponents()); INTERP_KERNEL::AutoPtr tmp2=new double[sz]; std::fill(res,res+sz,0.); for(std::size_t i=0;igetCellsContainingPoints(loc,nbOfPoints,_precision,eltsArr,eltsIndexArr); const int *elts(eltsArr->begin()),*eltsIndex(eltsIndexArr->begin()); int spaceDim=mesh->getSpaceDimension(); - int nbOfComponents=arr->getNumberOfComponents(); + mcIdType nbOfComponents=ToIdType(arr->getNumberOfComponents()); MCAuto ret=DataArrayDouble::New(); ret->alloc(nbOfPoints,nbOfComponents); double *ptToFill=ret->getPointer(); @@ -1218,7 +1218,7 @@ bool MEDCouplingFieldDiscretizationPerCell::isEqualWithoutConsideringStr(const M */ void MEDCouplingFieldDiscretizationPerCell::renumberCells(const int *old2NewBg, bool check) { - int nbCells=_discr_per_cell->getNumberOfTuples(); + mcIdType nbCells=ToIdType(_discr_per_cell->getNumberOfTuples()); const int *array=old2NewBg; if(check) array=DataArrayInt::CheckAndPreparePermutation(old2NewBg,old2NewBg+nbCells); @@ -1238,7 +1238,7 @@ void MEDCouplingFieldDiscretizationPerCell::buildDiscrPerCellIfNecessary(const M if(!_discr_per_cell) { _discr_per_cell=DataArrayInt::New(); - int nbTuples=mesh->getNumberOfCells(); + mcIdType nbTuples=ToIdType(mesh->getNumberOfCells()); _discr_per_cell->alloc(nbTuples,1); int *ptr=_discr_per_cell->getPointer(); std::fill(ptr,ptr+nbTuples,DFT_INVALID_LOCID_VALUE); @@ -1461,8 +1461,8 @@ int MEDCouplingFieldDiscretizationGauss::getNumberOfTuples(const MEDCouplingMesh if (_discr_per_cell == 0) throw INTERP_KERNEL::Exception("Discretization is not initialized!"); const int *dcPtr=_discr_per_cell->getConstPointer(); - int nbOfTuples=_discr_per_cell->getNumberOfTuples(); - int maxSz=(int)_loc.size(); + mcIdType nbOfTuples=ToIdType(_discr_per_cell->getNumberOfTuples()); + mcIdType maxSz=ToIdType(_loc.size()); for(const int *w=dcPtr;w!=dcPtr+nbOfTuples;w++) { if(*w>=0 && *wgetNumberOfCells(); + return ToIdType(mesh->getNumberOfCells()); } /*! @@ -1521,7 +1521,7 @@ void MEDCouplingFieldDiscretizationGauss::renumberArraysForCell(const MEDCouplin const int *array=old2NewBg; if(check) array=DataArrayInt::CheckAndPreparePermutation(old2NewBg,old2NewBg+mesh->getNumberOfCells()); - int nbOfCells=_discr_per_cell->getNumberOfTuples(); + mcIdType nbOfCells=ToIdType(_discr_per_cell->getNumberOfTuples()); int nbOfTuples=getNumberOfTuples(0); const int *dcPtr=_discr_per_cell->getConstPointer(); int *array2=new int[nbOfTuples];//stores the final conversion array old2New to give to arrays in renumberInPlace. @@ -1609,7 +1609,7 @@ void MEDCouplingFieldDiscretizationGauss::getTinySerializationIntInformation(std { int val=-1; if(_discr_per_cell) - val=_discr_per_cell->getNumberOfTuples(); + val=ToIdType(_discr_per_cell->getNumberOfTuples()); tinyInfo.push_back(val); tinyInfo.push_back((int)_loc.size()); if(_loc.empty()) @@ -1688,7 +1688,7 @@ void MEDCouplingFieldDiscretizationGauss::checkCoherencyBetween(const MEDCouplin for(std::vector::const_iterator iter=_loc.begin();iter!=_loc.end();iter++) (*iter).checkConsistencyLight(); int nbOfDesc=(int)_loc.size(); - int nbOfCells=mesh->getNumberOfCells(); + mcIdType nbOfCells=ToIdType(mesh->getNumberOfCells()); const int *dc=_discr_per_cell->getConstPointer(); for(int i=0;igetNumberOfTuples(); + mcIdType nbOfTuples=ToIdType(_discr_per_cell->getNumberOfTuples()); const int *w=_discr_per_cell->begin(); int nbMaxOfLocId=(int)_loc.size(); for(int i=0;igetPointer(); - int nbCells=mesh->getNumberOfCells(); + mcIdType nbCells=ToIdType(mesh->getNumberOfCells()); for(int i=0;igetTypeOfCell(i)==type) ptr[i]=id; @@ -2046,7 +2046,7 @@ void MEDCouplingFieldDiscretizationGauss::getCellIdsHavingGaussLocalization(int { if(locId<0 || locId>=(int)_loc.size()) throw INTERP_KERNEL::Exception("Invalid locId given : must be in range [0:getNbOfGaussLocalization()) !"); - int nbOfTuples=_discr_per_cell->getNumberOfTuples(); + mcIdType nbOfTuples=ToIdType(_discr_per_cell->getNumberOfTuples()); const int *ptr=_discr_per_cell->getConstPointer(); for(int i=0;igetNumberOfTuples(); + mcIdType nbOfTuples=ToIdType(_discr_per_cell->getNumberOfTuples()); MCAuto ret=DataArrayInt::New(); const int *w=_discr_per_cell->begin(); ret->alloc(nbOfTuples,1); @@ -2122,7 +2122,7 @@ void MEDCouplingFieldDiscretizationGauss::reprQuickOverview(std::ostream& stream void MEDCouplingFieldDiscretizationGauss::zipGaussLocalizations() { const int *start=_discr_per_cell->begin(); - int nbOfTuples=_discr_per_cell->getNumberOfTuples(); + mcIdType nbOfTuples=ToIdType(_discr_per_cell->getNumberOfTuples()); INTERP_KERNEL::AutoPtr tmp=new int[_loc.size()]; std::fill((int *)tmp,(int *)tmp+_loc.size(),-2); for(const int *w=start;w!=start+nbOfTuples;w++) @@ -2254,8 +2254,8 @@ int MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuples(const MEDCouplingMe if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuples : NULL input mesh !"); int ret=0; - int nbOfCells=mesh->getNumberOfCells(); - for(int i=0;igetNumberOfCells()); + for(mcIdType i=0;igetTypeOfCell(i); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); @@ -2270,14 +2270,14 @@ int MEDCouplingFieldDiscretizationGaussNE::getNumberOfMeshPlaces(const MEDCoupli { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getNumberOfMeshPlaces : NULL input mesh !"); - return mesh->getNumberOfCells(); + return ToIdType(mesh->getNumberOfCells()); } DataArrayInt *MEDCouplingFieldDiscretizationGaussNE::getOffsetArr(const MEDCouplingMesh *mesh) const { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getOffsetArr : NULL input mesh !"); - int nbOfTuples=mesh->getNumberOfCells(); + mcIdType nbOfTuples=ToIdType(mesh->getNumberOfCells()); DataArrayInt *ret=DataArrayInt::New(); ret->alloc(nbOfTuples+1,1); int *retPtr=ret->getPointer(); @@ -2301,7 +2301,7 @@ void MEDCouplingFieldDiscretizationGaussNE::renumberArraysForCell(const MEDCoupl const int *array=old2NewBg; if(check) array=DataArrayInt::CheckAndPreparePermutation(old2NewBg,old2NewBg+mesh->getNumberOfCells()); - int nbOfCells=mesh->getNumberOfCells(); + mcIdType nbOfCells=ToIdType(mesh->getNumberOfCells()); int nbOfTuples=getNumberOfTuples(mesh); int *array2=new int[nbOfTuples];//stores the final conversion array old2New to give to arrays in renumberInPlace. int *array3=new int[nbOfCells];//store for each cell in after renumbering the offset needed by each cell in new numbering. @@ -2341,7 +2341,7 @@ DataArrayDouble *MEDCouplingFieldDiscretizationGaussNE::getLocalizationOfDiscVal const double *coords=umesh->getCoords()->begin(); const int *connI=umesh->getNodalConnectivityIndex()->getConstPointer(); const int *conn=umesh->getNodalConnectivity()->getConstPointer(); - int nbCells=umesh->getNumberOfCells(); + mcIdType nbCells=ToIdType(umesh->getNumberOfCells()); double *retPtr=ret->getPointer(); for(int i=0;igetNumberOfComponents(); + mcIdType nbOfCompo=ToIdType(arr->getNumberOfComponents()); std::fill(res,res+nbOfCompo,0.); // MCAuto vol=mesh->getMeasureField(isWAbs); @@ -2375,7 +2375,7 @@ void MEDCouplingFieldDiscretizationGaussNE::integral(const MEDCouplingMesh *mesh MCAuto ids=mesh->giveCellsWithType(*it); MCAuto ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell); const int *ptIds2=ids2->begin(),*ptIds=ids->begin(); - int nbOfCellsWithCurGeoType=ids->getNumberOfTuples(); + mcIdType nbOfCellsWithCurGeoType=ToIdType(ids->getNumberOfTuples()); for(int i=0;i ids=mesh->giveCellsWithType(*it); MCAuto ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell); const int *ptIds2=ids2->begin(),*ptIds=ids->begin(); - int nbOfCellsWithCurGeoType=ids->getNumberOfTuples(); + mcIdType nbOfCellsWithCurGeoType=ToIdType(ids->getNumberOfTuples()); for(int i=0;igetNumberOfCells(); + mcIdType nbOfCells=ToIdType(mesh->getNumberOfCells()); di=0; beginOut=0; endOut=0; stepOut=stepCellIds; const char msg[]="MEDCouplingFieldDiscretizationGaussNE::buildSubMeshDataRange : cell #"; for(int i=0;iisAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::getValueOnMulti : input array is null or not allocated !"); - std::size_t nbOfRows(getNumberOfMeshPlaces(mesh)); - if(arr->getNumberOfTuples()!=nbOfRows) + mcIdType nbOfRows=ToIdType(getNumberOfMeshPlaces(mesh)); + if(ToIdType(arr->getNumberOfTuples())!=nbOfRows) { std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationKriging::getValueOnMulti : input array does not have correct number of tuples ! Excepted " << nbOfRows << " having " << arr->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - int nbCols(-1),nbCompo(arr->getNumberOfComponents()); + int nbCols(-1),nbCompo(ToIdType(arr->getNumberOfComponents())); MCAuto m(computeEvaluationMatrixOnGivenPts(mesh,loc,nbOfTargetPoints,nbCols)); MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfTargetPoints,nbCompo); @@ -2909,7 +2909,7 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeEvaluationMatrixO MCAuto matrixInv(computeInverseMatrix(mesh,isDrift,nbRows)); // MCAuto coords=getLocalizationOfDiscValues(mesh); - int nbOfPts(coords->getNumberOfTuples()),dimension(coords->getNumberOfComponents()); + mcIdType nbOfPts(ToIdType(coords->getNumberOfTuples())),dimension(ToIdType(coords->getNumberOfComponents())); MCAuto locArr=DataArrayDouble::New(); locArr->useArray(loc,false,DeallocType::CPP_DEALLOC,nbOfTargetPoints,dimension); nbCols=nbOfPts; @@ -2968,7 +2968,7 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeMatrix(const MEDC if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::computeMatrix : NULL input mesh !"); MCAuto coords(getLocalizationOfDiscValues(mesh)); - int nbOfPts(coords->getNumberOfTuples()); + mcIdType nbOfPts=ToIdType(coords->getNumberOfTuples()); MCAuto matrix(coords->buildEuclidianDistanceDenseMatrix()); operateOnDenseMatrix(mesh->getSpaceDimension(),nbOfPts*nbOfPts,matrix->getPointer()); // Drift @@ -2994,7 +2994,7 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeVectorOfCoefficie MCAuto KnewiK(DataArrayDouble::New()); KnewiK->alloc(nbRows*1,1); MCAuto arr2(PerformDriftOfVec(arr,isDrift)); - INTERP_KERNEL::matrixProduct(matrixInv->getConstPointer(),nbRows,nbRows,arr2->getConstPointer(),arr2->getNumberOfTuples(),1,KnewiK->getPointer()); + INTERP_KERNEL::matrixProduct(matrixInv->getConstPointer(),nbRows,nbRows,arr2->getConstPointer(),ToIdType(arr2->getNumberOfTuples()),1,KnewiK->getPointer()); return KnewiK.retn(); } @@ -3062,7 +3062,7 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::PerformDriftRect(const D throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::PerformDriftRect : invalid input dense matrix ! Must be allocated not NULL and with exactly one component !"); if(!arr || !arr->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::PerformDriftRect : invalid input array of coordiantes ! Must be allocated and not NULL !"); - int spaceDimension(arr->getNumberOfComponents()),nbOfPts(arr->getNumberOfTuples()),nbOfEltInMatrx(matr->getNumberOfTuples()); + mcIdType spaceDimension=ToIdType(arr->getNumberOfComponents()),nbOfPts=ToIdType(arr->getNumberOfTuples()),nbOfEltInMatrx=ToIdType(matr->getNumberOfTuples()); delta=spaceDimension+1; int nbOfCols(nbOfEltInMatrx/nbOfPts); if(nbOfEltInMatrx%nbOfPts!=0) @@ -3109,17 +3109,17 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::PerformDriftOfVec(const */ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::performDrift(const DataArrayDouble *matr, const DataArrayDouble *arr, int& delta) const { - std::size_t spaceDimension(arr->getNumberOfComponents()); + mcIdType spaceDimension=ToIdType(arr->getNumberOfComponents()); delta=spaceDimension+1; - std::size_t szOfMatrix(arr->getNumberOfTuples()); - if(szOfMatrix*szOfMatrix!=matr->getNumberOfTuples()) + mcIdType szOfMatrix=ToIdType(arr->getNumberOfTuples()); + if(szOfMatrix*szOfMatrix!=ToIdType(matr->getNumberOfTuples())) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::performDrift : invalid size"); MCAuto ret=DataArrayDouble::New(); ret->alloc((szOfMatrix+delta)*(szOfMatrix+delta),1); const double *srcWork=matr->getConstPointer(); const double *srcWork2=arr->getConstPointer(); double *destWork=ret->getPointer(); - for(std::size_t i=0;i arrNoI=arr->toNoInterlace(); srcWork2=arrNoI->getConstPointer(); - for(std::size_t i=0;i nsp(new MEDCouplingFieldDiscretizationP0); ret->setDiscretization(nsp); const MEDCouplingMesh *m(getMesh());//m is non empty thanks to checkConsistencyLight call - int nbCells(m->getNumberOfCells()); + mcIdType nbCells=ToIdType(m->getNumberOfCells()); std::vector arrs(getArrays()); std::size_t sz(arrs.size()); std::vector< MCAuto > outArrsSafe(sz); std::vector outArrs(sz); for(std::size_t j=0;jgetNumberOfComponents()); + mcIdType nbCompo=ToIdType(arrs[j]->getNumberOfComponents()); outArrsSafe[j]=DataArrayDouble::New(); outArrsSafe[j]->alloc(nbCells,nbCompo); outArrsSafe[j]->copyStringInfoFrom(*arrs[j]); outArrs[j]=outArrsSafe[j]; double *pt(outArrsSafe[j]->getPointer()); const double *srcPt(arrs[j]->begin()); - for(int i=0;i nodeIds; m->getNodeIdsOfCell(i,nodeIds); @@ -705,7 +705,7 @@ void MEDCouplingFieldDouble::getWeightedAverageValue(double *res, bool isWAbs) c MCAuto arr=getArray()->deepCopy(); arr->multiplyEqual(w->getArray()); arr->accumulate(res); - int nCompo = getArray()->getNumberOfComponents(); + mcIdType nCompo = ToIdType(getArray()->getNumberOfComponents()); std::transform(res,res+nCompo,res,std::bind2nd(std::multiplies(),1./deno)); } @@ -724,7 +724,7 @@ void MEDCouplingFieldDouble::getWeightedAverageValue(double *res, bool isWAbs) c */ double MEDCouplingFieldDouble::getWeightedAverageValue(int compId, bool isWAbs) const { - int nbComps=getArray()->getNumberOfComponents(); + mcIdType nbComps=ToIdType(getArray()->getNumberOfComponents()); if(compId<0 || compId>=nbComps) { std::ostringstream oss; oss << "MEDCouplingFieldDouble::getWeightedAverageValue : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !"; @@ -752,7 +752,7 @@ double MEDCouplingFieldDouble::normL1(int compId) const throw INTERP_KERNEL::Exception("No mesh underlying this field to perform normL1 !"); if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform normL1 !"); - int nbComps=getArray()->getNumberOfComponents(); + mcIdType nbComps=ToIdType(getArray()->getNumberOfComponents()); if(compId<0 || compId>=nbComps) { std::ostringstream oss; oss << "MEDCouplingFieldDouble::normL1 : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !"; @@ -799,7 +799,7 @@ double MEDCouplingFieldDouble::normL2(int compId) const throw INTERP_KERNEL::Exception("No mesh underlying this field to perform normL2"); if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform normL2 !"); - int nbComps=getArray()->getNumberOfComponents(); + mcIdType nbComps=ToIdType(getArray()->getNumberOfComponents()); if(compId<0 || compId>=nbComps) { std::ostringstream oss; oss << "MEDCouplingFieldDouble::normL2 : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !"; @@ -843,7 +843,7 @@ double MEDCouplingFieldDouble::normMax(int compId) const { if(getArray()==0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::normMax : no default array defined !"); - int nbComps=getArray()->getNumberOfComponents(); + mcIdType nbComps=ToIdType(getArray()->getNumberOfComponents()); if(compId<0 || compId>=nbComps) { std::ostringstream oss; oss << "MEDCouplingFieldDouble::normMax : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !"; @@ -891,7 +891,7 @@ double MEDCouplingFieldDouble::integral(int compId, bool isWAbs) const throw INTERP_KERNEL::Exception("No mesh underlying this field to perform integral"); if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform integral !"); - int nbComps=getArray()->getNumberOfComponents(); + mcIdType nbComps=ToIdType(getArray()->getNumberOfComponents()); if(compId<0 || compId>=nbComps) { std::ostringstream oss; oss << "MEDCouplingFieldDouble::integral : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !"; @@ -1832,7 +1832,7 @@ bool MEDCouplingFieldDouble::zipConnectivity(int compType, double epsOnVals) timeDiscr()->getArrays(arrays); for(std::vector::const_iterator iter=arrays.begin();iter!=arrays.end();iter++) if(*iter) - _type->renumberValuesOnCells(epsOnVals,meshC,arr->getConstPointer(),meshC2->getNumberOfCells(),*iter); + _type->renumberValuesOnCells(epsOnVals,meshC,arr->getConstPointer(),ToIdType(meshC2->getNumberOfCells()),*iter); setMesh(meshC2); return true; } @@ -1898,17 +1898,17 @@ bool MEDCouplingFieldDouble::simplexize(int policy) throw INTERP_KERNEL::Exception("No underlying mesh on this field to perform simplexize !"); if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform simplexize !"); - int oldNbOfCells=_mesh->getNumberOfCells(); + std::size_t oldNbOfCells=_mesh->getNumberOfCells(); MCAuto meshC2(_mesh->deepCopy()); MCAuto arr=meshC2->simplexize(policy); - int newNbOfCells=meshC2->getNumberOfCells(); + std::size_t newNbOfCells=meshC2->getNumberOfCells(); if(oldNbOfCells==newNbOfCells) return false; std::vector arrays; timeDiscr()->getArrays(arrays); for(std::vector::const_iterator iter=arrays.begin();iter!=arrays.end();iter++) if(*iter) - _type->renumberValuesOnCellsR(_mesh,arr->getConstPointer(),arr->getNbOfElems(),*iter); + _type->renumberValuesOnCellsR(_mesh,arr->getConstPointer(),ToIdType(arr->getNbOfElems()),*iter); setMesh(meshC2); return true; } @@ -2915,7 +2915,7 @@ MCAuto MEDCouplingFieldDouble::voronoizeGen(const Voroni inpMeshBase=fieldToWO->getMesh(); inpMesh=inpMeshBase->buildUnstructured(); } - int nbCells(inpMesh->getNumberOfCells()); + mcIdType nbCells=ToIdType(inpMesh->getNumberOfCells()); const MEDCouplingFieldDiscretization *disc(fieldToWO->getDiscretization()); const MEDCouplingFieldDiscretizationGauss *disc2(dynamic_cast(disc)); if(!disc2) @@ -2943,7 +2943,7 @@ MCAuto MEDCouplingFieldDouble::voronoizeGen(const Voroni ptsInReal=gl.localizePtsInRefCooForEachCell(vorCellsForCurDisc->getCoords(),subMesh); } int nbPtsPerCell(vorCellsForCurDisc->getNumberOfNodes()); - for(std::size_t j=0;j elt(vorCellsForCurDisc->clone(false)); MCAuto coo4(ptsInReal->selectByTupleIdSafeSlice(j*nbPtsPerCell,(j+1)*nbPtsPerCell,1)); diff --git a/src/MEDCoupling/MEDCouplingFieldT.txx b/src/MEDCoupling/MEDCouplingFieldT.txx index 7b8e53c4d..f1cda9917 100644 --- a/src/MEDCoupling/MEDCouplingFieldT.txx +++ b/src/MEDCoupling/MEDCouplingFieldT.txx @@ -368,10 +368,10 @@ namespace MEDCoupling { if(getArray()->isAllocated()) { - int nbOfCompo=getArray()->getNumberOfComponents(); + mcIdType nbOfCompo=ToIdType(getArray()->getNumberOfComponents()); ret << Traits::FieldTypeName << " default array has " << nbOfCompo << " components and " << getArray()->getNumberOfTuples() << " tuples.\n"; ret << Traits::FieldTypeName << " default array has following info on components : "; - for(int i=0;igetInfoOnComponent(i) << "\" "; ret << "\n"; } @@ -397,7 +397,7 @@ namespace MEDCoupling nat=MEDCouplingNatureOfField::GetRepr(_nature); stream << "Nature of field : " << nat << ".\n"; } - catch(INTERP_KERNEL::Exception& e) + catch(INTERP_KERNEL::Exception&) { } const MEDCouplingFieldDiscretization *fd(_type); if(!fd) diff --git a/src/MEDCoupling/MEDCouplingGaussLocalization.cxx b/src/MEDCoupling/MEDCouplingGaussLocalization.cxx index f5af4895b..f67a4ee74 100644 --- a/src/MEDCoupling/MEDCouplingGaussLocalization.cxx +++ b/src/MEDCoupling/MEDCouplingGaussLocalization.cxx @@ -212,11 +212,11 @@ MCAuto MEDCouplingGaussLocalization::localizePtsInRefCooForEach ptsInRefCoo->checkAllocated(); mesh->checkConsistencyLight(); // - int nbCells(mesh->getNumberOfCells()); + mcIdType nbCells=ToIdType(mesh->getNumberOfCells()); const double *coords(mesh->getCoords()->begin()); const int *connI(mesh->getNodalConnectivityIndex()->begin()),*conn(mesh->getNodalConnectivity()->begin()); // - int nbPts(ptsInRefCoo->getNumberOfTuples()); + mcIdType nbPts=ToIdType(ptsInRefCoo->getNumberOfTuples()); INTERP_KERNEL::NormalizedCellType typ(getType()); int dim(INTERP_KERNEL::CellModel::GetCellModel(typ).getDimension()),outDim(mesh->getSpaceDimension()); MCAuto ret(DataArrayDouble::New()); diff --git a/src/MEDCoupling/MEDCouplingIMesh.cxx b/src/MEDCoupling/MEDCouplingIMesh.cxx old mode 100644 new mode 100755 index 73017d575..ec7587ef1 --- a/src/MEDCoupling/MEDCouplingIMesh.cxx +++ b/src/MEDCoupling/MEDCouplingIMesh.cxx @@ -287,18 +287,19 @@ void MEDCouplingIMesh::CondenseFineToCoarse(const std::vector& coarseSt, co throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : All input vectors (dimension) must have the same size !"); if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : the parameters 1 or 3 are NULL or not allocated !"); - int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseSt)),nbOfTuplesInFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(fineLocInCoarse)); - int nbCompo(fineDA->getNumberOfComponents()); - if((int)coarseDA->getNumberOfComponents()!=nbCompo) + std::size_t meshDim(coarseSt.size()); + mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseSt)),nbOfTuplesInFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(fineLocInCoarse)); + mcIdType nbCompo=ToIdType(fineDA->getNumberOfComponents()); + if(ToIdType(coarseDA->getNumberOfComponents())!=nbCompo) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : the number of components of fine DA and coarse one mismatches !"); - if(meshDim!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size()) + if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !"); - if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp) + if(ToIdType(coarseDA->getNumberOfTuples())!=nbOfTuplesInCoarseExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::CondenseFineToCoarse : Expecting " << nbOfTuplesInCoarseExp << " tuples having " << coarseDA->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - int nbTuplesFine(fineDA->getNumberOfTuples()); + mcIdType nbTuplesFine=ToIdType(fineDA->getNumberOfTuples()); if(nbOfTuplesInFineExp==0) { if(nbTuplesFine==0) @@ -417,13 +418,14 @@ void MEDCouplingIMesh::CondenseFineToCoarseGhost(const std::vector& coarseS if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarseGhost : the parameters 1 or 3 are NULL or not allocated !"); std::vector coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); - int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); - int nbCompo(fineDA->getNumberOfComponents()); - if((int)coarseDA->getNumberOfComponents()!=nbCompo) + std::size_t meshDim(coarseSt.size()); + mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); + mcIdType nbCompo=ToIdType(fineDA->getNumberOfComponents()); + if(ToIdType(coarseDA->getNumberOfComponents())!=nbCompo) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarseGhost : the number of components of fine DA and coarse one mismatches !"); - if(meshDim!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size()) + if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarseGhost : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !"); - if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp) + if(ToIdType(coarseDA->getNumberOfTuples())!=nbOfTuplesInCoarseExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::CondenseFineToCoarseGhost : Expecting " << nbOfTuplesInCoarseExp << " tuples in coarse DataArray having " << coarseDA->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -432,8 +434,8 @@ void MEDCouplingIMesh::CondenseFineToCoarseGhost(const std::vector& coarseS std::vector fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies()); std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); - int nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); - if(fineDA->getNumberOfTuples()!=nbTuplesFineExp) + mcIdType nbTuplesFine(ToIdType(fineDA->getNumberOfTuples())),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); + if(ToIdType(fineDA->getNumberOfTuples())!=nbTuplesFineExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::CondenseFineToCoarseGhost : Expecting " << nbTuplesFineExp << " tuples in fine DataArray having " << nbTuplesFine << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -546,18 +548,19 @@ void MEDCouplingIMesh::SpreadCoarseToFine(const DataArrayDouble *coarseDA, const throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : All input vectors (dimension) must have the same size !"); if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : the parameters 1 or 3 are NULL or not allocated !"); - int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseSt)),nbOfTuplesInFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(fineLocInCoarse)); - int nbCompo(fineDA->getNumberOfComponents()); - if((int)coarseDA->getNumberOfComponents()!=nbCompo) + std::size_t meshDim(coarseSt.size()); + mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseSt)),nbOfTuplesInFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(fineLocInCoarse)); + mcIdType nbCompo=ToIdType(fineDA->getNumberOfComponents()); + if(ToIdType(coarseDA->getNumberOfComponents())!=nbCompo) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : the number of components of fine DA and coarse one mismatches !"); - if(meshDim!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size()) + if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !"); - if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp) + if(ToIdType(coarseDA->getNumberOfTuples())!=nbOfTuplesInCoarseExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFine : Expecting " << nbOfTuplesInCoarseExp << " tuples having " << coarseDA->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - int nbTuplesFine(fineDA->getNumberOfTuples()); + mcIdType nbTuplesFine=ToIdType(fineDA->getNumberOfTuples()); if(nbTuplesFine%nbOfTuplesInFineExp!=0) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : Invalid nb of tuples in fine DataArray regarding its structure !"); int fact(std::accumulate(facts.begin(),facts.end(),1,std::multiplies())); @@ -652,13 +655,14 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhost : the parameters 1 or 3 are NULL or not allocated !"); std::vector coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); - int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); - int nbCompo(fineDA->getNumberOfComponents()); - if((int)coarseDA->getNumberOfComponents()!=nbCompo) + std::size_t meshDim(coarseSt.size()); + mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); + mcIdType nbCompo=ToIdType(fineDA->getNumberOfComponents()); + if(ToIdType(coarseDA->getNumberOfComponents())!=nbCompo) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhost : the number of components of fine DA and coarse one mismatches !"); - if(meshDim!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size()) + if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhost : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !"); - if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp) + if(ToIdType(coarseDA->getNumberOfTuples())!=nbOfTuplesInCoarseExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFineGhost : Expecting " << nbOfTuplesInCoarseExp << " tuples having " << coarseDA->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -667,8 +671,8 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, std::vector fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies()); std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); - int nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); - if(fineDA->getNumberOfTuples()!=nbTuplesFineExp) + mcIdType nbTuplesFine=ToIdType(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); + if(ToIdType(fineDA->getNumberOfTuples())!=nbTuplesFineExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFineGhost : Expecting " << nbTuplesFineExp << " tuples in fine DataArray having " << nbTuplesFine << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -744,13 +748,14 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhostZone(const DataArrayDouble *coarse if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhostZone : the parameters 1 or 3 are NULL or not allocated !"); std::vector coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); - int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); - int nbCompo(fineDA->getNumberOfComponents()); - if((int)coarseDA->getNumberOfComponents()!=nbCompo) + std::size_t meshDim(coarseSt.size()); + mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); + mcIdType nbCompo=ToIdType(fineDA->getNumberOfComponents()); + if(ToIdType(coarseDA->getNumberOfComponents())!=nbCompo) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhostZone : the number of components of fine DA and coarse one mismatches !"); - if(meshDim!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size()) + if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhostZone : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !"); - if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp) + if(ToIdType(coarseDA->getNumberOfTuples())!=nbOfTuplesInCoarseExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFineGhostZone : Expecting " << nbOfTuplesInCoarseExp << " tuples having " << coarseDA->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -759,8 +764,8 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhostZone(const DataArrayDouble *coarse std::vector fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies()); std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); - int nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); - if(fineDA->getNumberOfTuples()!=nbTuplesFineExp) + mcIdType nbTuplesFine=ToIdType(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); + if(ToIdType(fineDA->getNumberOfTuples())!=nbTuplesFineExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFineGhostZone : Expecting " << nbTuplesFineExp << " tuples in fine DataArray having " << nbTuplesFine << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -1082,7 +1087,7 @@ MEDCouplingFieldDouble *MEDCouplingIMesh::getMeasureField(bool isAbs) const checkConsistencyLight(); std::string name="MeasureOfMesh_"; name+=getName(); - int nbelem(getNumberOfCells()); + std::size_t nbelem=getNumberOfCells(); MEDCouplingFieldDouble *field(MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME)); field->setName(name); DataArrayDouble* array(DataArrayDouble::New()); @@ -1209,7 +1214,7 @@ DataArrayDouble *MEDCouplingIMesh::computeCellCenterOfMass() const { checkConsistencyLight(); MCAuto ret(DataArrayDouble::New()); - int spaceDim(getSpaceDimension()),nbCells(getNumberOfCells()),tmp[3],tmp2[3]; + mcIdType spaceDim(getSpaceDimension()),nbCells(ToIdType(getNumberOfCells())),tmp[3],tmp2[3]; ret->alloc(nbCells,spaceDim); double *pt(ret->getPointer()),shiftOrigin[3]; std::transform(_dxyz,_dxyz+spaceDim,shiftOrigin,std::bind2nd(std::multiplies(),0.5)); @@ -1318,7 +1323,7 @@ void MEDCouplingIMesh::reprQuickOverview(std::ostream& stream) const bool isPb(false); for(int i=0;i<_space_dim;i++) { - char tmp('X'+i); + char tmp=(char)((int)('X')+i); int tmpNodes(_structure[i]); stream1 << "- Axis " << tmp << " : " << tmpNodes << " nodes (orig=" << _origin[i] << ", inter=" << _dxyz[i] << ")."; if(i!=_space_dim-1) @@ -1358,7 +1363,7 @@ std::vector MEDCouplingIMesh::buildInfoOnComponents() const for(int i=0;i tmp(_mesh2D->giveCellsWithType(revExtTyp)); - int nbOfLevs(_mesh1D->getNumberOfCells()); - int nbOfCells2D(_mesh2D->getNumberOfCells()); - int nbOfTuples(tmp->getNumberOfTuples()); + mcIdType nbOfLevs=ToIdType(_mesh1D->getNumberOfCells()); + mcIdType nbOfCells2D=ToIdType(_mesh2D->getNumberOfCells()); + mcIdType nbOfTuples=ToIdType(tmp->getNumberOfTuples()); ret->alloc(nbOfLevs*nbOfTuples,1); int *pt(ret->getPointer()); for(int i=0;i ret2D(_mesh2D->computeNbOfNodesPerCell()); - int nbOfLevs(_mesh1D->getNumberOfCells()); - int nbOfCells2D(_mesh2D->getNumberOfCells()); + mcIdType nbOfLevs=ToIdType(_mesh1D->getNumberOfCells()); + mcIdType nbOfCells2D=ToIdType(_mesh2D->getNumberOfCells()); MCAuto ret3D(DataArrayInt::New()); ret3D->alloc(nbOfLevs*nbOfCells2D,1); int *pt(ret3D->getPointer()); for(int i=0;i ret2D(_mesh2D->computeNbOfNodesPerCell()); - int nbOfLevs(_mesh1D->getNumberOfCells()); - int nbOfCells2D(_mesh2D->getNumberOfCells()); + mcIdType nbOfLevs=ToIdType(_mesh1D->getNumberOfCells()); + mcIdType nbOfCells2D=ToIdType(_mesh2D->getNumberOfCells()); MCAuto ret3D(DataArrayInt::New()); ret3D->alloc(nbOfLevs*nbOfCells2D,1); int *pt(ret3D->getPointer()); for(int i=0;i& conn) const { - int nbOfCells2D(_mesh2D->getNumberOfCells()); + mcIdType nbOfCells2D=ToIdType(_mesh2D->getNumberOfCells()); int nbOfNodes2D(_mesh2D->getNumberOfNodes()); - int locId(cellId%nbOfCells2D); - int lev(cellId/nbOfCells2D); + int locId(ToIdType(cellId)%nbOfCells2D); + int lev(ToIdType(cellId)/nbOfCells2D); std::vector tmp,tmp2; _mesh2D->getNodeIdsOfCell(locId,tmp); tmp2=tmp; @@ -476,7 +476,8 @@ MEDCouplingFieldDouble *MEDCouplingMappedExtrudedMesh::getMeasureField(bool) con MCAuto ret2D(_mesh2D->getMeasureField(true)),ret1D(_mesh1D->getMeasureField(true)); const double *ret2DPtr(ret2D->getArray()->begin()); const double *ret1DPtr(ret1D->getArray()->begin()); - int nbOf2DCells(_mesh2D->getNumberOfCells()),nbOf1DCells(_mesh1D->getNumberOfCells()),nbOf3DCells(nbOf2DCells*nbOf1DCells); + mcIdType nbOf2DCells=ToIdType(_mesh2D->getNumberOfCells()), + nbOf1DCells=ToIdType(_mesh1D->getNumberOfCells()),nbOf3DCells(nbOf2DCells*nbOf1DCells); const int *renum(_mesh3D_ids->begin()); MCAuto ret(MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME)); ret->setMesh(this); @@ -540,7 +541,7 @@ void MEDCouplingMappedExtrudedMesh::build1DExtrusion(int idIn3DDesc, int newId, const int *revDesc3D, const int *revDescIndx3D, bool computeMesh1D) { - int nbOf2DCells(_mesh2D->getNumberOfCells()); + mcIdType nbOf2DCells=ToIdType(_mesh2D->getNumberOfCells()); int start(revDescIndx3D[idIn3DDesc]); int end(revDescIndx3D[idIn3DDesc+1]); if(end-start!=1) @@ -779,7 +780,7 @@ void MEDCouplingMappedExtrudedMesh::getReverseNodalConnectivity(DataArrayInt *re void MEDCouplingMappedExtrudedMesh::computeExtrusionAlg(const MEDCouplingUMesh *mesh3D) { _mesh3D_ids->alloc(mesh3D->getNumberOfCells(),1); - int nbOf1DLev(mesh3D->getNumberOfCells()/_mesh2D->getNumberOfCells()); + mcIdType nbOf1DLev=ToIdType(mesh3D->getNumberOfCells()/_mesh2D->getNumberOfCells()); _mesh1D->setMeshDimension(1); _mesh1D->allocateCells(nbOf1DLev); int tmpConn[2]; @@ -804,7 +805,7 @@ void MEDCouplingMappedExtrudedMesh::computeExtrusionAlg(const MEDCouplingUMesh * const int *revNodalIndx2DPtr(revNodalIndx2D->begin()); const int *descP(desc->begin()),*descIndxP(descIndx->begin()),*revDescP(revDesc->begin()),*revDescIndxP(revDescIndx->begin()); // - int nbOf2DCells(_mesh2D->getNumberOfCells()); + mcIdType nbOf2DCells=ToIdType(_mesh2D->getNumberOfCells()); for(int i=0;igetNbOfElems()); + tinyInfo.push_back(ToIdType(_mesh3D_ids->getNbOfElems())); littleStrings.push_back(getName()); littleStrings.push_back(getDescription()); } @@ -857,11 +858,11 @@ void MEDCouplingMappedExtrudedMesh::resizeForUnserialization(const std::vector ls1,ls2; um->resizeForUnserialization(ti1,a1tmp,a2tmp,ls1); - la1+=a1tmp->getNbOfElems(); la2+=a2tmp->getNbOfElems(); + la1+=ToIdType(a1tmp->getNbOfElems()); la2+=ToIdType(a2tmp->getNbOfElems()); a1tmp->decrRef(); a2tmp->decrRef(); a1tmp=DataArrayInt::New(); a2tmp=DataArrayDouble::New(); um->resizeForUnserialization(ti2,a1tmp,a2tmp,ls2); - la1+=a1tmp->getNbOfElems(); la2+=a2tmp->getNbOfElems(); + la1+=ToIdType(a1tmp->getNbOfElems()); la2+=ToIdType(a2tmp->getNbOfElems()); a1tmp->decrRef(); a2tmp->decrRef(); um->decrRef(); // diff --git a/src/MEDCoupling/MEDCouplingMatrix.cxx b/src/MEDCoupling/MEDCouplingMatrix.cxx old mode 100644 new mode 100755 index 1045e260c..de0de88d4 --- a/src/MEDCoupling/MEDCouplingMatrix.cxx +++ b/src/MEDCoupling/MEDCouplingMatrix.cxx @@ -177,10 +177,10 @@ DataArrayDouble *DenseMatrix::MatVecMult(const DenseMatrix *mat, const DataArray vec->checkAllocated(); if(vec->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DenseMatrix::MatVecMult : input vector must have only one component !"); - if(vec->getNumberOfTuples()!=mat->getNumberOfCols()) + if(ToIdType(vec->getNumberOfTuples())!=mat->getNumberOfCols()) throw INTERP_KERNEL::Exception("DenseMatrix::MatVecMult : Number of columns of this must be equal to number of tuples of vec !"); MCAuto ret(DataArrayDouble::New()); ret->alloc(mat->getNumberOfRows(),1); - INTERP_KERNEL::matrixProduct(mat->getData()->begin(),mat->getNumberOfRows(),mat->getNumberOfCols(),vec->begin(),vec->getNumberOfTuples(),1,ret->getPointer()); + INTERP_KERNEL::matrixProduct(mat->getData()->begin(),mat->getNumberOfRows(),mat->getNumberOfCols(),vec->begin(),ToIdType(vec->getNumberOfTuples()),1,ret->getPointer()); return ret.retn(); } @@ -238,7 +238,7 @@ DenseMatrix *DenseMatrix::Multiply(const DenseMatrix *a1, const DataArrayDouble throw INTERP_KERNEL::Exception("DenseMatrix::Multiply #2 : input matrices must be not NULL and a2 allocated !"); if(a2->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DenseMatrix::Multiply #2 : The 2nd member must have exactly one component !"); - MCAuto a2Bis(DenseMatrix::New(const_cast(a2),a2->getNumberOfTuples(),1)); + MCAuto a2Bis(DenseMatrix::New(const_cast(a2),ToIdType(a2->getNumberOfTuples()),1)); return DenseMatrix::Multiply(a1,a2Bis); } diff --git a/src/MEDCoupling/MEDCouplingMemArray.cxx b/src/MEDCoupling/MEDCouplingMemArray.cxx old mode 100644 new mode 100755 index 9e7408f26..77d6320fc --- a/src/MEDCoupling/MEDCouplingMemArray.cxx +++ b/src/MEDCoupling/MEDCouplingMemArray.cxx @@ -193,32 +193,32 @@ void DataArray::copyStringInfoFrom(const DataArray& other) void DataArray::copyPartOfStringInfoFrom(const DataArray& other, const std::vector& compoIds) { - int nbOfCompoOth=other.getNumberOfComponents(); - std::size_t newNbOfCompo=compoIds.size(); - for(std::size_t i=0;i=nbOfCompoOth || compoIds[i]<0) { std::ostringstream oss; oss << "Specified component id is out of range (" << compoIds[i] << ") compared with nb of actual components (" << nbOfCompoOth << ")"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - for(std::size_t i=0;i& compoIds, const DataArray& other) { - std::size_t nbOfCompo(getNumberOfComponents()); - std::size_t partOfCompoToSet=compoIds.size(); - if(partOfCompoToSet!=other.getNumberOfComponents()) + if(compoIds.size()!=other.getNumberOfComponents()) throw INTERP_KERNEL::Exception("Given compoIds has not the same size as number of components of given array !"); - for(std::size_t i=0;i=(int)nbOfCompo || compoIds[i]<0) + mcIdType partOfCompoToSet=ToIdType(compoIds.size()); + mcIdType nbOfCompo=ToIdType(getNumberOfComponents()); + for(mcIdType i=0;i=nbOfCompo || compoIds[i]<0) { std::ostringstream oss; oss << "Specified component id is out of range (" << compoIds[i] << ") compared with nb of actual components (" << nbOfCompo << ")"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - for(std::size_t i=0;i(ref-absEps)) return false; @@ -925,7 +925,8 @@ void DataArrayDouble::writeVTK(std::ostream& ofs, int indent, const std::string& void DataArrayDouble::reprCppStream(const std::string& varName, std::ostream& stream) const { - int nbTuples(getNumberOfTuples()),nbComp(getNumberOfComponents()); + mcIdType nbTuples=ToIdType(getNumberOfTuples()); + mcIdType nbComp=ToIdType(getNumberOfComponents()); const double *data(getConstPointer()); stream.precision(17); stream << "DataArrayDouble *" << varName << "=DataArrayDouble::New();" << std::endl; @@ -967,18 +968,18 @@ void DataArrayDouble::reprQuickOverview(std::ostream& stream) const void DataArrayDouble::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const { const double *data=begin(); - int nbOfTuples=getNumberOfTuples(); - int nbOfCompo=(int)_info_on_compo.size(); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); + mcIdType nbOfCompo=ToIdType(_info_on_compo.size()); std::ostringstream oss2; oss2 << "["; oss2.precision(17); std::string oss2Str(oss2.str()); bool isFinished=true; - for(int i=0;i1) { oss2 << "("; - for(int j=0;j a=DataArrayDouble::Aggregate(this,other); DataArrayInt *c=0,*ci=0; - a->findCommonTuples(prec,getNumberOfTuples(),c,ci); + a->findCommonTuples(prec,ToIdType(getNumberOfTuples()),c,ci); MCAuto cSafe(c),ciSafe(ci); int newNbOfTuples=-1; - MCAuto ids=DataArrayInt::ConvertIndexArrayToO2N(a->getNumberOfTuples(),c->begin(),ci->begin(),ci->end(),newNbOfTuples); - MCAuto ret1=ids->selectByTupleIdSafeSlice(getNumberOfTuples(),a->getNumberOfTuples(),1); + MCAuto ids=DataArrayInt::ConvertIndexArrayToO2N(ToIdType(a->getNumberOfTuples()),c->begin(),ci->begin(),ci->end(),newNbOfTuples); + MCAuto ret1=ids->selectByTupleIdSafeSlice(ToIdType(getNumberOfTuples()),ToIdType(a->getNumberOfTuples()),1); tupleIds=ret1.retn(); - return newNbOfTuples==getNumberOfTuples(); + return newNbOfTuples==ToIdType(getNumberOfTuples()); } /*! @@ -1105,11 +1106,11 @@ bool DataArrayDouble::areIncludedInMe(const DataArrayDouble *other, double prec, void DataArrayDouble::findCommonTuples(double prec, int limitTupleId, DataArrayInt *&comm, DataArrayInt *&commIndex) const { checkAllocated(); - int nbOfCompo=getNumberOfComponents(); + mcIdType nbOfCompo=ToIdType(getNumberOfComponents()); if ((nbOfCompo<1) || (nbOfCompo>4)) //test before work throw INTERP_KERNEL::Exception("DataArrayDouble::findCommonTuples : Unexpected spacedim of coords. Must be 1, 2, 3 or 4."); - int nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); // MCAuto c(DataArrayInt::New()),cI(DataArrayInt::New()); c->alloc(0,1); cI->pushBackSilent(0); switch(nbOfCompo) @@ -1146,15 +1147,15 @@ void DataArrayDouble::findCommonTuples(double prec, int limitTupleId, DataArrayI double DataArrayDouble::minimalDistanceTo(const DataArrayDouble *other, int& thisTupleId, int& otherTupleId) const { MCAuto part1=findClosestTupleId(other); - int nbOfCompo(getNumberOfComponents()); - int otherNbTuples(other->getNumberOfTuples()); + mcIdType nbOfCompo=ToIdType(getNumberOfComponents()); + mcIdType otherNbTuples=ToIdType(other->getNumberOfTuples()); const double *thisPt(begin()),*otherPt(other->begin()); const int *part1Pt(part1->begin()); double ret=std::numeric_limits::max(); - for(int i=0;igetNumberOfComponents() << "! Should be equal !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - int nbOfTuples=other->getNumberOfTuples(); - int thisNbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=ToIdType(other->getNumberOfTuples()); + mcIdType thisNbOfTuples=ToIdType(getNumberOfTuples()); MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfTuples,1); double bounds[6]; getMinMaxPerComponent(bounds); @@ -1194,7 +1195,7 @@ DataArrayInt *DataArrayDouble::findClosestTupleId(const DataArrayDouble *other) double xDelta(fabs(bounds[1]-bounds[0])),yDelta(fabs(bounds[3]-bounds[2])),zDelta(fabs(bounds[5]-bounds[4])); double delta=std::max(xDelta,yDelta); delta=std::max(delta,zDelta); double characSize=pow((delta*delta*delta)/((double)thisNbOfTuples),1./3.); - BBTreePts<3,int> myTree(begin(),0,0,getNumberOfTuples(),characSize*1e-12); + BBTreePts<3,int> myTree(begin(),0,0,ToIdType(getNumberOfTuples()),characSize*1e-12); FindClosestTupleIdAlg<3>(myTree,3.*characSize*characSize,other->begin(),nbOfTuples,begin(),thisNbOfTuples,ret->getPointer()); break; } @@ -1203,14 +1204,14 @@ DataArrayInt *DataArrayDouble::findClosestTupleId(const DataArrayDouble *other) double xDelta(fabs(bounds[1]-bounds[0])),yDelta(fabs(bounds[3]-bounds[2])); double delta=std::max(xDelta,yDelta); double characSize=sqrt(delta/(double)thisNbOfTuples); - BBTreePts<2,int> myTree(begin(),0,0,getNumberOfTuples(),characSize*1e-12); + BBTreePts<2,int> myTree(begin(),0,0,ToIdType(getNumberOfTuples()),characSize*1e-12); FindClosestTupleIdAlg<2>(myTree,2.*characSize*characSize,other->begin(),nbOfTuples,begin(),thisNbOfTuples,ret->getPointer()); break; } case 1: { double characSize=fabs(bounds[1]-bounds[0])/thisNbOfTuples; - BBTreePts<1,int> myTree(begin(),0,0,getNumberOfTuples(),characSize*1e-12); + BBTreePts<1,int> myTree(begin(),0,0,ToIdType(getNumberOfTuples()),characSize*1e-12); FindClosestTupleIdAlg<1>(myTree,1.*characSize*characSize,other->begin(),nbOfTuples,begin(),thisNbOfTuples,ret->getPointer()); break; } @@ -1256,21 +1257,21 @@ DataArrayInt *DataArrayDouble::computeNbOfInteractionsWith(const DataArrayDouble { case 3: { - BBTree<3,int> bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps); + BBTree<3,int> bbt(otherBBoxFrmt->begin(),0,0,ToIdType(otherBBoxFrmt->getNumberOfTuples()),eps); for(std::size_t i=0;i bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps); + BBTree<2,int> bbt(otherBBoxFrmt->begin(),0,0,ToIdType(otherBBoxFrmt->getNumberOfTuples()),eps); for(std::size_t i=0;i bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps); + BBTree<1,int> bbt(otherBBoxFrmt->begin(),0,0,ToIdType(otherBBoxFrmt->getNumberOfTuples()),eps); for(std::size_t i=0;i c(c0),cI(cI0); int newNbOfTuples=-1; - MCAuto o2n=DataArrayInt::ConvertIndexArrayToO2N(getNumberOfTuples(),c0->begin(),cI0->begin(),cI0->end(),newNbOfTuples); + MCAuto o2n=DataArrayInt::ConvertIndexArrayToO2N(ToIdType(getNumberOfTuples()),c0->begin(),cI0->begin(),cI0->end(),newNbOfTuples); return renumberAndReduce(o2n->getConstPointer(),newNbOfTuples); } @@ -1335,11 +1336,11 @@ void DataArrayDouble::setSelectedComponents(const DataArrayDouble *a, const std: checkAllocated(); copyPartOfStringInfoFrom2(compoIds,*a); std::size_t partOfCompoSz=compoIds.size(); - int nbOfCompo=getNumberOfComponents(); - int nbOfTuples=std::min(getNumberOfTuples(),a->getNumberOfTuples()); + mcIdType nbOfCompo=ToIdType(getNumberOfComponents()); + mcIdType nbOfTuples=ToIdType(std::min(getNumberOfTuples(),a->getNumberOfTuples())); const double *ac=a->getConstPointer(); double *nc=getPointer(); - for(int i=0;i::max(); bounds[idim*2+1]=-std::numeric_limits::max(); } const double *ptr=getConstPointer(); - int nbOfTuples=getNumberOfTuples(); - for(int i=0;iptr[i*dim+idim]) { @@ -1410,14 +1411,14 @@ DataArrayDouble *DataArrayDouble::computeBBoxPerTuple(double epsilon) const { checkAllocated(); const double *dataPtr=getConstPointer(); - int nbOfCompo=getNumberOfComponents(); - int nbTuples=getNumberOfTuples(); + mcIdType nbOfCompo=ToIdType(getNumberOfComponents()); + mcIdType nbTuples=ToIdType(getNumberOfTuples()); MCAuto bbox=DataArrayDouble::New(); bbox->alloc(nbTuples,2*nbOfCompo); double *bboxPtr=bbox->getPointer(); - for(int i=0;icheckAllocated(); - int nbOfCompo=getNumberOfComponents(); - int otherNbOfCompo=other->getNumberOfComponents(); + mcIdType nbOfCompo=ToIdType(getNumberOfComponents()); + mcIdType otherNbOfCompo=ToIdType(other->getNumberOfComponents()); if(nbOfCompo!=otherNbOfCompo) throw INTERP_KERNEL::Exception("DataArrayDouble::computeTupleIdsNearTuples : number of components should be equal between this and other !"); - int nbOfTuplesOther=other->getNumberOfTuples(); + mcIdType nbOfTuplesOther=ToIdType(other->getNumberOfTuples()); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); MCAuto cArr(DataArrayInt::New()),cIArr(DataArrayInt::New()); cArr->alloc(0,1); cIArr->pushBackSilent(0); switch(nbOfCompo) { case 3: { - BBTreePts<3,int> myTree(begin(),0,0,getNumberOfTuples(),eps); + BBTreePts<3,int> myTree(begin(),0,0,nbOfTuples,eps); FindTupleIdsNearTuplesAlg<3>(myTree,other->getConstPointer(),nbOfTuplesOther,eps,cArr,cIArr); break; } case 2: { - BBTreePts<2,int> myTree(begin(),0,0,getNumberOfTuples(),eps); + BBTreePts<2,int> myTree(begin(),0,0,nbOfTuples,eps); FindTupleIdsNearTuplesAlg<2>(myTree,other->getConstPointer(),nbOfTuplesOther,eps,cArr,cIArr); break; } case 1: { - BBTreePts<1,int> myTree(begin(),0,0,getNumberOfTuples(),eps); + BBTreePts<1,int> myTree(begin(),0,0,nbOfTuples,eps); FindTupleIdsNearTuplesAlg<1>(myTree,other->getConstPointer(),nbOfTuplesOther,eps,cArr,cIArr); break; } @@ -1491,10 +1493,10 @@ void DataArrayDouble::computeTupleIdsNearTuples(const DataArrayDouble *other, do void DataArrayDouble::recenterForMaxPrecision(double eps) { checkAllocated(); - int dim=getNumberOfComponents(); + mcIdType dim=ToIdType(getNumberOfComponents()); std::vector bounds(2*dim); getMinMaxPerComponent(&bounds[0]); - for(int i=0;i 0 !"); const double *vals=getConstPointer(); @@ -1633,11 +1635,11 @@ void DataArrayDouble::normMaxPerComponent(double * res) const { checkAllocated(); std::size_t nbOfTuples(getNumberOfTuples()); - int nbOfCompos(getNumberOfComponents()); + mcIdType nbOfCompos=ToIdType(getNumberOfComponents()); std::fill(res, res+nbOfCompos, -1.0); const double *pt(getConstPointer()); for(std::size_t i=0;ires[j]) @@ -1680,10 +1682,10 @@ void DataArrayDouble::accumulate(double *res) const { checkAllocated(); const double *ptr=getConstPointer(); - int nbTuple=getNumberOfTuples(); - int nbComps=getNumberOfComponents(); + mcIdType nbTuple=ToIdType(getNumberOfTuples()); + mcIdType nbComps=ToIdType(getNumberOfComponents()); std::fill(res,res+nbComps,0.); - for(int i=0;i()); } @@ -1704,8 +1706,8 @@ void DataArrayDouble::accumulate(double *res) const double DataArrayDouble::distanceToTuple(const double *tupleBg, const double *tupleEnd, int& tupleId) const { checkAllocated(); - int nbTuple=getNumberOfTuples(); - int nbComps=getNumberOfComponents(); + mcIdType nbTuple=ToIdType(getNumberOfTuples()); + mcIdType nbComps=ToIdType(getNumberOfComponents()); if(nbComps!=(int)std::distance(tupleBg,tupleEnd)) { std::ostringstream oss; oss << "DataArrayDouble::distanceToTuple : size of input tuple is " << std::distance(tupleBg,tupleEnd) << " should be equal to the number of components in this : " << nbComps << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } if(nbTuple==0) @@ -1713,10 +1715,10 @@ double DataArrayDouble::distanceToTuple(const double *tupleBg, const double *tup double ret0=std::numeric_limits::max(); tupleId=-1; const double *work=getConstPointer(); - for(int i=0;i=ret0) continue; @@ -1738,12 +1740,12 @@ double DataArrayDouble::accumulate(int compId) const { checkAllocated(); const double *ptr=getConstPointer(); - int nbTuple=getNumberOfTuples(); - int nbComps=getNumberOfComponents(); + mcIdType nbTuple=ToIdType(getNumberOfTuples()); + mcIdType nbComps=ToIdType(getNumberOfComponents()); if(compId<0 || compId>=nbComps) throw INTERP_KERNEL::Exception("DataArrayDouble::accumulate : Invalid compId specified : No such nb of components !"); double ret=0.; - for(int i=0;igetPointer(); - for(int i=0;i=w[0]) { - for(int j=w[0];j=0 && j()); @@ -1819,12 +1821,12 @@ MCAuto DataArrayDouble::cumSum() const { checkAllocated(); checkNbOfComps(1,"DataArrayDouble::cumSum : this is expected to be single component"); - int nbOfTuple(getNumberOfTuples()); + mcIdType nbOfTuple=ToIdType(getNumberOfTuples()); MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfTuple+1,1); double *ptr(ret->getPointer()); ptr[0]=0.; const double *thisPtr(begin()); - for(int i=0;i DataArrayDouble::cumSum() const DataArrayDouble *DataArrayDouble::fromPolarToCart() const { checkAllocated(); - int nbOfComp(getNumberOfComponents()); + std::size_t nbOfComp(getNumberOfComponents()); if(nbOfComp!=2) throw INTERP_KERNEL::Exception("DataArrayDouble::fromPolarToCart : must be an array with exactly 2 components !"); - int nbOfTuple(getNumberOfTuples()); + std::size_t nbOfTuple(getNumberOfTuples()); DataArrayDouble *ret(DataArrayDouble::New()); ret->alloc(nbOfTuple,2); double *w(ret->getPointer()); const double *wIn(getConstPointer()); - for(int i=0;ialloc(getNumberOfTuples(),3); double *w(ret->getPointer()); const double *wIn(getConstPointer()); - for(int i=0;ialloc(getNumberOfTuples(),3); double *w(ret->getPointer()); const double *wIn(getConstPointer()); - for(int i=0;i ret; switch(atOfThis) { @@ -1983,13 +1985,13 @@ DataArrayDouble *DataArrayDouble::fromCartToPolar() const { MCAuto ret(DataArrayDouble::New()); checkAllocated(); - int nbOfComp(getNumberOfComponents()),nbTuples(getNumberOfTuples()); + std::size_t nbOfComp(getNumberOfComponents()),nbTuples(getNumberOfTuples()); if(nbOfComp!=2) throw INTERP_KERNEL::Exception("DataArrayDouble::fromCartToPolar : must be an array with exactly 2 components !"); ret->alloc(nbTuples,2); double *retPtr(ret->getPointer()); const double *ptr(begin()); - for(int i=0;i ret(DataArrayDouble::New()); checkAllocated(); - int nbOfComp(getNumberOfComponents()),nbTuples(getNumberOfTuples()); + std::size_t nbOfComp(getNumberOfComponents()),nbTuples(getNumberOfTuples()); if(nbOfComp!=3) throw INTERP_KERNEL::Exception("DataArrayDouble::fromCartToCyl : must be an array with exactly 3 components !"); ret->alloc(nbTuples,3); double *retPtr(ret->getPointer()); const double *ptr(begin()); - for(int i=0;i ret(DataArrayDouble::New()); checkAllocated(); - int nbOfComp(getNumberOfComponents()),nbTuples(getNumberOfTuples()); + std::size_t nbOfComp(getNumberOfComponents()),nbTuples(getNumberOfTuples()); if(nbOfComp!=3) throw INTERP_KERNEL::Exception("DataArrayDouble::fromCartToSpher : must be an array with exactly 3 components !"); ret->alloc(nbTuples,3); double *retPtr(ret->getPointer()); const double *ptr(begin()); - for(int i=0;igetPointer()); const double *coo(coords->begin()),*vectField(begin()); std::transform(vect,vect+3,Uz,std::bind2nd(std::multiplies(),1./magOfVect)); - for(int i=0;i()); Uteta[0]=Uz[1]*Ur[2]-Uz[2]*Ur[1]; Uteta[1]=Uz[2]*Ur[0]-Uz[0]*Ur[2]; Uteta[2]=Uz[0]*Ur[1]-Uz[1]*Ur[0]; @@ -2096,15 +2098,15 @@ DataArrayDouble *DataArrayDouble::fromCartToCylGiven(const DataArrayDouble *coor DataArrayDouble *DataArrayDouble::doublyContractedProduct() const { checkAllocated(); - int nbOfComp(getNumberOfComponents()); + std::size_t nbOfComp(getNumberOfComponents()); if(nbOfComp!=6) throw INTERP_KERNEL::Exception("DataArrayDouble::doublyContractedProduct : must be an array with exactly 6 components !"); DataArrayDouble *ret=DataArrayDouble::New(); - int nbOfTuple=getNumberOfTuples(); + std::size_t nbOfTuple=getNumberOfTuples(); ret->alloc(nbOfTuple,1); const double *src=getConstPointer(); double *dest=ret->getPointer(); - for(int i=0;ialloc(nbOfTuple,1); const double *src=getConstPointer(); double *dest=ret->getPointer(); switch(getNumberOfComponents()) { case 6: - for(int i=0;ialloc(nbOfTuple,3); const double *src=getConstPointer(); double *dest=ret->getPointer(); - for(int i=0;ialloc(nbOfTuple,9); const double *src=getConstPointer(); double *dest=ret->getPointer(); - for(int i=0;ialloc(nbOfTuple,nbOfComp); const double *src=getConstPointer(); double *dest=ret->getPointer(); if(nbOfComp==6) - for(int i=0;ialloc(nbOfTuple,1); const double *src=getConstPointer(); double *dest=ret->getPointer(); if(nbOfComp==6) - for(int i=0;ialloc(nbOfTuple,6); const double *src=getConstPointer(); double *dest=ret->getPointer(); - for(int i=0;ialloc(nbOfTuple,1); const double *src=getConstPointer(); double *dest=ret->getPointer(); - for(int i=0;i ret=DataArrayDouble::New(); - int nbOfTuple=getNumberOfTuples(); + mcIdType nbOfTuple=ToIdType(getNumberOfTuples()); ret->alloc(nbOfTuple,1); const double *src=getConstPointer(); double *dest=ret->getPointer(); - for(int i=0;i ret0=DataArrayDouble::New(); MCAuto ret1=DataArrayInt::New(); - int nbOfTuple=getNumberOfTuples(); + mcIdType nbOfTuple=ToIdType(getNumberOfTuples()); ret0->alloc(nbOfTuple,1); ret1->alloc(nbOfTuple,1); const double *src=getConstPointer(); double *dest=ret0->getPointer(); int *dest1=ret1->getPointer(); - for(int i=0;i ret=DataArrayDouble::New(); ret->alloc(nbOfTuples*nbOfTuples,1); double *outData=ret->getPointer(); - for(int i=0;icheckAllocated(); - int nbOfComp=getNumberOfComponents(); - int otherNbOfComp=other->getNumberOfComponents(); + mcIdType nbOfComp=ToIdType(getNumberOfComponents()); + mcIdType otherNbOfComp=ToIdType(other->getNumberOfComponents()); if(nbOfComp!=otherNbOfComp) { std::ostringstream oss; oss << "DataArrayDouble::buildEuclidianDistanceDenseMatrixWith : this nb of compo=" << nbOfComp << " and other nb of compo=" << otherNbOfComp << ". It should match !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - int nbOfTuples=getNumberOfTuples(); - int otherNbOfTuples=other->getNumberOfTuples(); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); + mcIdType otherNbOfTuples=ToIdType(other->getNumberOfTuples()); const double *inData=getConstPointer(); const double *inDataOther=other->getConstPointer(); MCAuto ret=DataArrayDouble::New(); ret->alloc(otherNbOfTuples*nbOfTuples,1); double *outData=ret->getPointer(); - for(int i=0;i()); declareAsNew(); } @@ -2669,12 +2671,12 @@ DataArrayDouble *DataArrayDouble::applyFunc(int nbOfComp, FunctionToEvaluate fun { checkAllocated(); DataArrayDouble *newArr=DataArrayDouble::New(); - int nbOfTuples=getNumberOfTuples(); - int oldNbOfComp=getNumberOfComponents(); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); + mcIdType oldNbOfComp=ToIdType(getNumberOfComponents()); newArr->alloc(nbOfTuples,nbOfComp); const double *ptr=getConstPointer(); double *ptrToFill=newArr->getPointer(); - for(int i=0;i 0 !"); checkAllocated(); - int nbOfTuples(getNumberOfTuples()); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); MCAuto newArr(DataArrayDouble::New()); newArr->alloc(nbOfTuples,nbOfComp); INTERP_KERNEL::ExprParser expr(func); @@ -2767,9 +2769,9 @@ DataArrayDouble *DataArrayDouble::applyFunc(const std::string& func, bool isSafe expr.prepareFastEvaluator(); if(!isSafe) { - for(int i=0;i 0 !"); checkAllocated(); - int nbOfTuples(getNumberOfTuples()); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); INTERP_KERNEL::ExprParser expr(func); expr.parse(); std::set vars; @@ -2852,9 +2854,9 @@ void DataArrayDouble::applyFuncOnThis(const std::string& func, bool isSafe) expr.prepareFastEvaluator(); if(!isSafe) { - for(int i=0;i 0 !"); std::vector varsOrder2(varsOrder); - int oldNbOfComp(getNumberOfComponents()); + mcIdType oldNbOfComp=ToIdType(getNumberOfComponents()); for(int i=(int)varsOrder.size();i vars; @@ -2962,7 +2964,7 @@ DataArrayDouble *DataArrayDouble::applyFuncNamedCompo(int nbOfComp, const std::v ptrToFill=newArr->getPointer()+iComp; if(!isSafe) { - for(int i=0;i DataArrayDouble::symmetry3DPlane(const double point[3], checkAllocated(); if(getNumberOfComponents()!=3) throw INTERP_KERNEL::Exception("DataArrayDouble::symmetry3DPlane : this is excepted to have 3 components !"); - int nbTuples(getNumberOfTuples()); + mcIdType nbTuples=ToIdType(getNumberOfTuples()); MCAuto ret(DataArrayDouble::New()); ret->alloc(nbTuples,3); Symmetry3DPlane(point,normalVector,nbTuples,begin(),ret->getPointer()); @@ -3074,8 +3076,8 @@ DataArrayInt *DataArrayDouble::findIdsInRange(double vmin, double vmax) const throw INTERP_KERNEL::Exception("DataArrayDouble::findIdsInRange : this must have exactly one component !"); const double *cptr(begin()); MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); - int nbOfTuples(getNumberOfTuples()); - for(int i=0;i=vmin && *cptr<=vmax) ret->pushBackSilent(i); return ret.retn(); @@ -3100,8 +3102,8 @@ DataArrayInt *DataArrayDouble::findIdsNotInRange(double vmin, double vmax) const throw INTERP_KERNEL::Exception("DataArrayDouble::findIdsNotInRange : this must have exactly one component !"); const double *cptr(begin()); MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); - int nbOfTuples(getNumberOfTuples()); - for(int i=0;ivmax) ret->pushBackSilent(i); return ret.retn(); @@ -3153,7 +3155,7 @@ DataArrayDouble *DataArrayDouble::Aggregate(const std::vector::const_iterator it=a.begin(); std::size_t nbOfComp((*it)->getNumberOfComponents()); - int nbt=(*it++)->getNumberOfTuples(); + std::size_t nbt=(*it++)->getNumberOfTuples(); for(int i=1;it!=a.end();it++,i++) { if((*it)->getNumberOfComponents()!=nbOfComp) @@ -3342,10 +3344,10 @@ DataArrayDouble *DataArrayDouble::Pow(const DataArrayDouble *a1, const DataArray { if(!a1 || !a2) throw INTERP_KERNEL::Exception("DataArrayDouble::Pow : at least one of input instances is null !"); - int nbOfTuple=a1->getNumberOfTuples(); - int nbOfTuple2=a2->getNumberOfTuples(); - int nbOfComp=a1->getNumberOfComponents(); - int nbOfComp2=a2->getNumberOfComponents(); + std::size_t nbOfTuple=a1->getNumberOfTuples(); + std::size_t nbOfTuple2=a2->getNumberOfTuples(); + std::size_t nbOfComp=a1->getNumberOfComponents(); + std::size_t nbOfComp2=a2->getNumberOfComponents(); if(nbOfTuple!=nbOfTuple2) throw INTERP_KERNEL::Exception("DataArrayDouble::Pow : number of tuples mismatches !"); if(nbOfComp!=1 || nbOfComp2!=1) @@ -3353,7 +3355,7 @@ DataArrayDouble *DataArrayDouble::Pow(const DataArrayDouble *a1, const DataArray MCAuto ret=DataArrayDouble::New(); ret->alloc(nbOfTuple,1); const double *ptr1(a1->begin()),*ptr2(a2->begin()); double *ptr=ret->getPointer(); - for(int i=0;i=0) { @@ -3381,17 +3383,17 @@ void DataArrayDouble::powEqual(const DataArrayDouble *other) { if(!other) throw INTERP_KERNEL::Exception("DataArrayDouble::powEqual : input instance is null !"); - int nbOfTuple=getNumberOfTuples(); - int nbOfTuple2=other->getNumberOfTuples(); - int nbOfComp=getNumberOfComponents(); - int nbOfComp2=other->getNumberOfComponents(); + std::size_t nbOfTuple=getNumberOfTuples(); + std::size_t nbOfTuple2=other->getNumberOfTuples(); + std::size_t nbOfComp=getNumberOfComponents(); + std::size_t nbOfComp2=other->getNumberOfComponents(); if(nbOfTuple!=nbOfTuple2) throw INTERP_KERNEL::Exception("DataArrayDouble::powEqual : number of tuples mismatches !"); if(nbOfComp!=1 || nbOfComp2!=1) throw INTERP_KERNEL::Exception("DataArrayDouble::powEqual : number of components of both arrays must be equal to 1 !"); double *ptr=getPointer(); const double *ptrc=other->begin(); - for(int i=0;i=0) *ptr=pow(*ptr,*ptrc); @@ -3417,10 +3419,10 @@ std::vector DataArrayDouble::toVectorOfBool(double eps) const checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayDouble::toVectorOfBool : must be applied on single component array !"); - int nbt(getNumberOfTuples()); + std::size_t nbt(getNumberOfTuples()); std::vector ret(nbt); const double *pt(begin()); - for(int i=0;i& tinyI tinyInfo.resize(2); if(isAllocated()) { - tinyInfo[0]=getNumberOfTuples(); - tinyInfo[1]=getNumberOfComponents(); + tinyInfo[0]=ToIdType(getNumberOfTuples()); + tinyInfo[1]=ToIdType(getNumberOfComponents()); } else { @@ -3462,10 +3464,10 @@ void DataArrayDouble::getTinySerializationStrInformation(std::vector& tinyInfoI, c setName(tinyInfoS[0]); if(isAllocated()) { - int nbOfCompo=getNumberOfComponents(); - for(int i=0;i=2 !"); @@ -3758,8 +3760,8 @@ void DataArrayInt::splitByValueRange(const int *arrBg, const int *arrEnd, ret2->alloc(nbOfTuples,1); int *ret1Ptr=ret1->getPointer(); int *ret2Ptr=ret2->getPointer(); - std::set castsDetected; - for(int i=0;i castsDetected; + for(std::size_t i=0;i(), work[i])); std::size_t pos=std::distance(bg,res); @@ -3768,7 +3770,7 @@ void DataArrayInt::splitByValueRange(const int *arrBg, const int *arrEnd, { ret1Ptr[i]=(int)pos2; ret2Ptr[i]=work[i]-arrBg[pos2]; - castsDetected.insert(pos2); + castsDetected.insert(ToIdType(pos2)); } else { @@ -3776,7 +3778,7 @@ void DataArrayInt::splitByValueRange(const int *arrBg, const int *arrEnd, throw INTERP_KERNEL::Exception(oss.str().c_str()); } } - ret3->alloc((int)castsDetected.size(),1); + ret3->alloc(castsDetected.size(),1); std::copy(castsDetected.begin(),castsDetected.end(),ret3->getPointer()); castArr=ret1.retn(); rankInsideCast=ret2.retn(); @@ -3800,7 +3802,7 @@ bool DataArrayInt::isRange(int& strt, int& sttoopp, int& stteepp) const checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayInt::isRange : this must be single component array !"); - int nbTuples(getNumberOfTuples()); + mcIdType nbTuples=ToIdType(getNumberOfTuples()); if(nbTuples==0) { strt=0; sttoopp=0; stteepp=1; return true; } const int *pt(begin()); @@ -3817,7 +3819,7 @@ bool DataArrayInt::isRange(int& strt, int& sttoopp, int& stteepp) const if(a%(nbTuples-1)!=0) return false; stteepp=a/(nbTuples-1); - for(int i=0;i ret=DataArrayInt::New(); ret->alloc(nbOfTuples,1); ret->fillWithValue(-1); int *tmp=ret->getPointer(); - for(int i=0;i=0 && *pt ret(DataArrayInt::New()); ret->alloc(newNbOfElem,1); - int nbOfOldNodes(this->getNumberOfTuples()); + mcIdType nbOfOldNodes=ToIdType(this->getNumberOfTuples()); const int *old2New(begin()); int *pt(ret->getPointer()); - for(int i=0;i!=nbOfOldNodes;i++) + for(mcIdType i=0;i!=nbOfOldNodes;i++) { int newp(old2New[i]); if(newp!=-1) @@ -3933,10 +3935,10 @@ DataArrayInt *DataArrayInt::invertArrayO2N2N2OBis(int newNbOfElem) const { MCAuto ret=DataArrayInt::New(); ret->alloc(newNbOfElem,1); - int nbOfOldNodes=getNumberOfTuples(); + mcIdType nbOfOldNodes=ToIdType(getNumberOfTuples()); const int *old2New=getConstPointer(); int *pt=ret->getPointer(); - for(int i=nbOfOldNodes-1;i>=0;i--) + for(mcIdType i=nbOfOldNodes-1;i>=0;i--) { int newp(old2New[i]); if(newp!=-1) @@ -3978,8 +3980,8 @@ DataArrayInt *DataArrayInt::invertArrayN2O2O2N(int oldNbOfElem) const const int *new2Old=getConstPointer(); int *pt=ret->getPointer(); std::fill(pt,pt+oldNbOfElem,-1); - int nbOfNewElems=getNumberOfTuples(); - for(int i=0;i=0 && v > DataArrayInt32::invertArrayN2O2O2NOptimized() const MCAuto< MapKeyVal > ret(MapKeyVal::New()); std::map& m(ret->data()); const int *new2Old(begin()); - std::size_t nbOfNewElems(this->getNumberOfTuples()); - for(std::size_t i=0;igetNumberOfTuples()); + for(mcIdType i=0;i > DataArrayInt32::giveN2OOptimized() const MCAuto< MapKeyVal > ret(MapKeyVal::New()); std::map& m(ret->data()); const int *new2Old(begin()); - std::size_t nbOfNewElems(this->getNumberOfTuples()); - for(std::size_t i=0;igetNumberOfTuples()); + for(mcIdType i=0;icheckAndPreparePermutation(); p2=ids2->checkAndPreparePermutation(); - p2=p2->invertArrayO2N2N2O(p2->getNumberOfTuples()); + p2=p2->invertArrayO2N2N2O(ToIdType(p2->getNumberOfTuples())); p2=p2->selectByTupleIdSafe(p1->begin(),p1->end()); return p2.retn(); } @@ -4162,13 +4164,13 @@ void DataArrayInt::changeSurjectiveFormat(int targetNb, DataArrayInt *&arr, Data checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayInt::changeSurjectiveFormat : number of components must == 1 !"); - int nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); MCAuto ret(DataArrayInt::New()); MCAuto retI(DataArrayInt::New()); retI->alloc(targetNb+1,1); const int *input=getConstPointer(); std::vector< std::vector > tmp(targetNb); - for(int i=0;i=0 && tmp2 m; MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfTuples,1); int *opt=ret->getPointer(); - for(int i=0;i::iterator it=m.find(val); @@ -4306,7 +4308,7 @@ DataArrayInt *DataArrayInt::buildPermArrPerLevel() const } pt=getConstPointer(); opt=ret->getPointer(); - for(int i=0;icheckAllocated(); copyPartOfStringInfoFrom2(compoIds,*a); std::size_t partOfCompoSz=compoIds.size(); - int nbOfCompo=getNumberOfComponents(); - int nbOfTuples=std::min(getNumberOfTuples(),a->getNumberOfTuples()); + mcIdType nbOfCompo=ToIdType(getNumberOfComponents()); + mcIdType nbOfTuples=ToIdType(std::min(getNumberOfTuples(),a->getNumberOfTuples())); const int *ac=a->getConstPointer(); int *nc=getPointer(); - for(int i=0;i ret(DataArrayInt::New()); ret->alloc(0,1); - int nbOfTuples=getNumberOfTuples(); - for(int i=0;ipushBackSilent(i); return ret.retn(); @@ -4478,9 +4480,9 @@ DataArrayInt *DataArrayInt::findIdsNotEqual(int val) const */ DataArrayInt *DataArrayInt::findIdsEqualTuple(const int *tupleBg, const int *tupleEnd) const { - std::size_t nbOfCompoExp(std::distance(tupleBg,tupleEnd)); + mcIdType nbOfCompoExp=ToIdType(std::distance(tupleBg,tupleEnd)); checkAllocated(); - if(getNumberOfComponents()!=nbOfCompoExp) + if(ToIdType(getNumberOfComponents())!=nbOfCompoExp) { std::ostringstream oss; oss << "DataArrayInt::findIdsEqualTuple : mismatch of number of components. Input tuple has " << nbOfCompoExp << " whereas this array has " << getNumberOfComponents() << " components !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -4494,7 +4496,7 @@ DataArrayInt *DataArrayInt::findIdsEqualTuple(const int *tupleBg, const int *tup work=std::search(work,end2,tupleBg,tupleEnd); if(work!=end2) { - std::size_t pos(std::distance(bg,work)); + mcIdType pos=ToIdType(std::distance(bg,work)); if(pos%nbOfCompoExp==0) ret->pushBackSilent(pos/nbOfCompoExp); work++; @@ -4592,9 +4594,9 @@ DataArrayInt *DataArrayInt::findIdsEqualList(const int *valsBg, const int *valsE std::set vals2(valsBg,valsEnd); const int *cptr(getConstPointer()); std::vector res; - int nbOfTuples(getNumberOfTuples()); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); - for(int i=0;ipushBackSilent(i); return ret.retn(); @@ -4617,9 +4619,9 @@ DataArrayInt *DataArrayInt::findIdsNotEqualList(const int *valsBg, const int *va std::set vals2(valsBg,valsEnd); const int *cptr=getConstPointer(); std::vector res; - int nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); - for(int i=0;ipushBackSilent(i); return ret.retn(); @@ -4640,10 +4642,10 @@ DataArrayInt *DataArrayInt::findIdsNotEqualList(const int *valsBg, const int *va int DataArrayInt::findIdFirstEqualTuple(const std::vector& tupl) const { checkAllocated(); - int nbOfCompo=getNumberOfComponents(); + mcIdType nbOfCompo=ToIdType(getNumberOfComponents()); if(nbOfCompo==0) throw INTERP_KERNEL::Exception("DataArrayInt::findIdFirstEqualTuple : 0 components in 'this' !"); - if(nbOfCompo!=(int)tupl.size()) + if(nbOfCompo!=ToIdType(tupl.size())) { std::ostringstream oss; oss << "DataArrayInt::findIdFirstEqualTuple : 'this' contains " << nbOfCompo << " components and searching for a tuple of length " << tupl.size() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -4658,7 +4660,7 @@ int DataArrayInt::findIdFirstEqualTuple(const std::vector& tupl) const if(std::distance(cptr,work)%nbOfCompo!=0) work++; else - return std::distance(cptr,work)/nbOfCompo; + return ToIdType (std::distance(cptr,work)/nbOfCompo); } } return -1; @@ -4673,14 +4675,14 @@ int DataArrayInt::findIdFirstEqualTuple(const std::vector& tupl) const int DataArrayInt::findIdSequence(const std::vector& vals) const { checkAllocated(); - int nbOfCompo=getNumberOfComponents(); + std::size_t nbOfCompo=getNumberOfComponents(); if(nbOfCompo!=1) throw INTERP_KERNEL::Exception("DataArrayInt::findIdSequence : works only for DataArrayInt instance with one component !"); const int *cptr=getConstPointer(); std::size_t nbOfVals=getNbOfElems(); const int *loc=std::search(cptr,cptr+nbOfVals,vals.begin(),vals.end()); if(loc!=cptr+nbOfVals) - return std::distance(cptr,loc); + return ToIdType(std::distance(cptr,loc)); return -1; } @@ -4696,10 +4698,10 @@ int DataArrayInt::findIdFirstEqual(int value) const if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayInt::presenceOfValue : the array must have only one component, you can call 'rearrange' method before !"); const int *cptr=getConstPointer(); - int nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); const int *ret=std::find(cptr,cptr+nbOfTuples,value); if(ret!=cptr+nbOfTuples) - return std::distance(cptr,ret); + return ToIdType(std::distance(cptr,ret)); return -1; } @@ -4716,10 +4718,10 @@ int DataArrayInt::findIdFirstEqual(const std::vector& vals) const throw INTERP_KERNEL::Exception("DataArrayInt::presenceOfValue : the array must have only one component, you can call 'rearrange' method before !"); std::set vals2(vals.begin(),vals.end()); const int *cptr=getConstPointer(); - int nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); for(const int *w=cptr;w!=cptr+nbOfTuples;w++) if(vals2.find(*w)!=vals2.end()) - return std::distance(cptr,w); + return ToIdType(std::distance(cptr,w)); return -1; } @@ -4739,8 +4741,8 @@ int DataArrayInt::count(int value) const if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayInt::count : must be applied on DataArrayInt with only one component, you can call 'rearrange' method before !"); const int *vals=begin(); - int nbOfTuples=getNumberOfTuples(); - for(int i=0;i()); } @@ -4806,12 +4808,12 @@ int DataArrayInt::accumulate(int compId) const { checkAllocated(); const int *ptr=getConstPointer(); - int nbTuple=getNumberOfTuples(); - int nbComps=getNumberOfComponents(); + mcIdType nbTuple=ToIdType(getNumberOfTuples()); + mcIdType nbComps=ToIdType(getNumberOfComponents()); if(compId<0 || compId>=nbComps) throw INTERP_KERNEL::Exception("DataArrayInt::accumulate : Invalid compId specified : No such nb of components !"); int ret=0; - for(int i=0;igetPointer(); - for(int i=0;i=w[0]) { - for(int j=w[0];j=0 && j()); @@ -4969,7 +4971,7 @@ DataArrayInt *DataArrayInt::AggregateIndexes(const std::vectorgetNumberOfTuples(); + mcIdType nbTupl=ToIdType((*it4)->getNumberOfTuples()); if(nbTupl<1) { std::ostringstream oss; oss << "DataArrayInt::AggregateIndexes : presence of a DataArrayInt instance with nb of tuples < 1 at pos " << std::distance(arrs.begin(),it4) << " !"; @@ -5013,10 +5015,10 @@ void DataArrayInt::getMinMaxValues(int& minValue, int& maxValue) const checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayInt::getMinMaxValues : must be applied on DataArrayInt with only one component !"); - int nbTuples(getNumberOfTuples()); + std::size_t nbTuples(getNumberOfTuples()); const int *pt(begin()); minValue=std::numeric_limits::max(); maxValue=-std::numeric_limits::max(); - for(int i=0;i=vmin && *cptr& for(std::vector::const_iterator it=a.begin();it!=a.end();it++) { const int *pt=(*it)->getConstPointer(); - int nbOfTuples=(*it)->getNumberOfTuples(); + mcIdType nbOfTuples=ToIdType((*it)->getNumberOfTuples()); r.insert(pt,pt+nbOfTuples); } DataArrayInt *ret=DataArrayInt::New(); @@ -5392,7 +5394,7 @@ DataArrayInt *DataArrayInt::BuildIntersection(const std::vector::const_iterator it=a.begin();it!=a.end();it++) { const int *pt=(*it)->getConstPointer(); - int nbOfTuples=(*it)->getNumberOfTuples(); + mcIdType nbOfTuples=ToIdType((*it)->getNumberOfTuples()); std::set s1(pt,pt+nbOfTuples); if(it!=a.begin()) { @@ -5498,7 +5500,7 @@ DataArrayInt *DataArrayInt::buildComplement(int nbOfElement) const throw INTERP_KERNEL::Exception("DataArrayInt::buildComplement : only single component allowed !"); std::vector tmp(nbOfElement); const int *pt=getConstPointer(); - int nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); for(const int *w=pt;w!=pt+nbOfTuples;w++) if(*w>=0 && *wgetNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstraction : only single component allowed for other type !"); const int *pt=getConstPointer(); - int nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); std::set s1(pt,pt+nbOfTuples); pt=other->getConstPointer(); - nbOfTuples=other->getNumberOfTuples(); + nbOfTuples=ToIdType(other->getNumberOfTuples()); std::set s2(pt,pt+nbOfTuples); std::vector r; std::set_difference(s1.begin(),s1.end(),s2.begin(),s2.end(),std::back_insert_iterator< std::vector >(r)); @@ -5632,7 +5634,7 @@ DataArrayInt *DataArrayInt::buildUnique() const checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayInt::buildUnique : only single component allowed !"); - int nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); MCAuto tmp=deepCopy(); int *data=tmp->getPointer(); int *last=std::unique(data,data+nbOfTuples); @@ -5701,7 +5703,7 @@ DataArrayInt *DataArrayInt::deltaShiftIndex() const checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayInt::deltaShiftIndex : only single component allowed !"); - int nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); if(nbOfTuples<2) throw INTERP_KERNEL::Exception("DataArrayInt::deltaShiftIndex : 1 tuple at least must be present in 'this' !"); const int *ptr=getConstPointer(); @@ -5734,13 +5736,13 @@ void DataArrayInt::computeOffsets() checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayInt::computeOffsets : only single component allowed !"); - int nbOfTuples=getNumberOfTuples(); + std::size_t nbOfTuples=getNumberOfTuples(); if(nbOfTuples==0) return ; int *work=getPointer(); int tmp=work[0]; work[0]=0; - for(int i=1;icheckAllocated(); if(offsets->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrByRanges : input array should have only single component !"); - int othNbTuples=offsets->getNumberOfTuples()-1; - int nbOfTuples=getNumberOfTuples(); + mcIdType othNbTuples=ToIdType(offsets->getNumberOfTuples())-1; + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); int retNbOftuples=0; const int *work=getConstPointer(); const int *offPtr=offsets->getConstPointer(); - for(int i=0;i=0 && val ret=DataArrayInt::New(); ret->alloc(retNbOftuples,1); int *retPtr=ret->getPointer(); - for(int i=0;i ret=DataArrayInt::New(); ret->alloc(nbTuples,1); - int nbOfRanges=ranges->getNumberOfTuples(); + mcIdType nbOfRanges=ToIdType(ranges->getNumberOfTuples()); const int *rangesPtr=ranges->getConstPointer(); int *retPtr=ret->getPointer(); const int *inPtr=getConstPointer(); - for(int i=0;i ret=DataArrayInt::New(); ret->alloc(nbTuples,1); - int nbOfRanges=ranges->getNumberOfTuples(); + std::size_t nbOfRanges=ranges->getNumberOfTuples(); const int *rangesPtr=ranges->getConstPointer(); int *retPtr=ret->getPointer(); const int *inPtr=getConstPointer(); - for(int i=0;i=rangesPtr[2*j] && val1) { @@ -6144,14 +6146,14 @@ MCAuto DataArrayInt::fromLinkedListOfPairToList() const { checkAllocated(); checkNbOfComps(2,"DataArrayInt::fromLinkedListOfPairToList : this is expected to have 2 components"); - int nbTuples(getNumberOfTuples()); + mcIdType nbTuples=ToIdType(getNumberOfTuples()); if(nbTuples<1) throw INTERP_KERNEL::Exception("DataArrayInt::fromLinkedListOfPairToList : no tuples in this ! Not a linked list !"); MCAuto ret(DataArrayInt::New()); ret->alloc(nbTuples+1,1); const int *thisPtr(begin()); int *retPtr(ret->getPointer()); retPtr[0]=thisPtr[0]; - for(int i=0;i > DataArrayInt::splitInBalancedSlices(int nbOfSl throw INTERP_KERNEL::Exception("DataArrayInt::splitInBalancedSlices : this array should have number of components equal to one and must be allocated !"); if(nbOfSlices<=0) throw INTERP_KERNEL::Exception("DataArrayInt::splitInBalancedSlices : number of slices must be >= 1 !"); - int sum(accumulate(0)),nbOfTuples(getNumberOfTuples()); + int sum(accumulate(0)); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); int sumPerSlc(sum/nbOfSlices),pos(0); const int *w(begin()); std::vector< std::pair > ret(nbOfSlices); @@ -6280,10 +6283,10 @@ DataArrayInt *DataArrayInt::Modulus(const DataArrayInt *a1, const DataArrayInt * { if(!a1 || !a2) throw INTERP_KERNEL::Exception("DataArrayInt::Modulus : input DataArrayInt instance is NULL !"); - int nbOfTuple1=a1->getNumberOfTuples(); - int nbOfTuple2=a2->getNumberOfTuples(); - int nbOfComp1=a1->getNumberOfComponents(); - int nbOfComp2=a2->getNumberOfComponents(); + mcIdType nbOfTuple1=ToIdType(a1->getNumberOfTuples()); + mcIdType nbOfTuple2=ToIdType(a2->getNumberOfTuples()); + mcIdType nbOfComp1=ToIdType(a1->getNumberOfComponents()); + mcIdType nbOfComp2=ToIdType(a2->getNumberOfComponents()); if(nbOfTuple2==nbOfTuple1) { if(nbOfComp1==nbOfComp2) @@ -6301,7 +6304,7 @@ DataArrayInt *DataArrayInt::Modulus(const DataArrayInt *a1, const DataArrayInt * const int *a2Ptr=a2->getConstPointer(); const int *a1Ptr=a1->getConstPointer(); int *res=ret->getPointer(); - for(int i=0;i(),a2Ptr[i])); ret->copyStringInfoFrom(*a1); return ret.retn(); @@ -6319,7 +6322,7 @@ DataArrayInt *DataArrayInt::Modulus(const DataArrayInt *a1, const DataArrayInt * ret->alloc(nbOfTuple1,nbOfComp1); const int *a1ptr=a1->getConstPointer(),*a2ptr=a2->getConstPointer(); int *pt=ret->getPointer(); - for(int i=0;i()); ret->copyStringInfoFrom(*a1); return ret.retn(); @@ -6355,10 +6358,10 @@ void DataArrayInt::modulusEqual(const DataArrayInt *other) throw INTERP_KERNEL::Exception("DataArrayInt::modulusEqual : input DataArrayInt instance is NULL !"); const char *msg="Nb of tuples mismatch for DataArrayInt::modulusEqual !"; checkAllocated(); other->checkAllocated(); - int nbOfTuple=getNumberOfTuples(); - int nbOfTuple2=other->getNumberOfTuples(); - int nbOfComp=getNumberOfComponents(); - int nbOfComp2=other->getNumberOfComponents(); + mcIdType nbOfTuple=ToIdType(getNumberOfTuples()); + mcIdType nbOfTuple2=ToIdType(other->getNumberOfTuples()); + mcIdType nbOfComp=ToIdType(getNumberOfComponents()); + mcIdType nbOfComp2=ToIdType(other->getNumberOfComponents()); if(nbOfTuple==nbOfTuple2) { if(nbOfComp==nbOfComp2) @@ -6371,7 +6374,7 @@ void DataArrayInt::modulusEqual(const DataArrayInt *other) { int *ptr=getPointer(); const int *ptrc=other->getConstPointer(); - for(int i=0;i(),*ptrc++)); } else @@ -6384,7 +6387,7 @@ void DataArrayInt::modulusEqual(const DataArrayInt *other) { int *ptr=getPointer(); const int *ptrc=other->getConstPointer(); - for(int i=0;i()); } else @@ -6410,10 +6413,10 @@ DataArrayInt *DataArrayInt::Pow(const DataArrayInt *a1, const DataArrayInt *a2) { if(!a1 || !a2) throw INTERP_KERNEL::Exception("DataArrayInt::Pow : at least one of input instances is null !"); - int nbOfTuple=a1->getNumberOfTuples(); - int nbOfTuple2=a2->getNumberOfTuples(); - int nbOfComp=a1->getNumberOfComponents(); - int nbOfComp2=a2->getNumberOfComponents(); + std::size_t nbOfTuple=a1->getNumberOfTuples(); + std::size_t nbOfTuple2=a2->getNumberOfTuples(); + std::size_t nbOfComp=a1->getNumberOfComponents(); + std::size_t nbOfComp2=a2->getNumberOfComponents(); if(nbOfTuple!=nbOfTuple2) throw INTERP_KERNEL::Exception("DataArrayInt::Pow : number of tuples mismatches !"); if(nbOfComp!=1 || nbOfComp2!=1) @@ -6421,7 +6424,7 @@ DataArrayInt *DataArrayInt::Pow(const DataArrayInt *a1, const DataArrayInt *a2) MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfTuple,1); const int *ptr1(a1->begin()),*ptr2(a2->begin()); int *ptr=ret->getPointer(); - for(int i=0;i=0) { @@ -6452,17 +6455,17 @@ void DataArrayInt::powEqual(const DataArrayInt *other) { if(!other) throw INTERP_KERNEL::Exception("DataArrayInt::powEqual : input instance is null !"); - int nbOfTuple=getNumberOfTuples(); - int nbOfTuple2=other->getNumberOfTuples(); - int nbOfComp=getNumberOfComponents(); - int nbOfComp2=other->getNumberOfComponents(); + std::size_t nbOfTuple=getNumberOfTuples(); + std::size_t nbOfTuple2=other->getNumberOfTuples(); + std::size_t nbOfComp=getNumberOfComponents(); + std::size_t nbOfComp2=other->getNumberOfComponents(); if(nbOfTuple!=nbOfTuple2) throw INTERP_KERNEL::Exception("DataArrayInt::powEqual : number of tuples mismatches !"); if(nbOfComp!=1 || nbOfComp2!=1) throw INTERP_KERNEL::Exception("DataArrayInt::powEqual : number of components of both arrays must be equal to 1 !"); int *ptr=getPointer(); const int *ptrc=other->begin(); - for(int i=0;i=0) { @@ -6506,10 +6509,10 @@ void DataArrayInt::ExtractFromIndexedArrays(const int *idsOfSelectBg, const int std::size_t sz=std::distance(idsOfSelectBg,idsOfSelectEnd); const int *arrInPtr=arrIn->begin(); const int *arrIndxPtr=arrIndxIn->begin(); - int nbOfGrps=arrIndxIn->getNumberOfTuples()-1; + mcIdType nbOfGrps=ToIdType(arrIndxIn->getNumberOfTuples())-1; if(nbOfGrps<0) throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArrays : The format of \"arrIndxIn\" is invalid ! Its nb of tuples should be >=1 !"); - int maxSizeOfArr=arrIn->getNumberOfTuples(); + mcIdType maxSizeOfArr=ToIdType(arrIn->getNumberOfTuples()); MCAuto arro=DataArrayInt::New(); MCAuto arrIo=DataArrayInt::New(); arrIo->alloc((int)(sz+1),1); @@ -6580,10 +6583,10 @@ void DataArrayInt::ExtractFromIndexedArraysSlice(int idsOfSelectStart, int idsOf int sz=DataArrayInt::GetNumberOfItemGivenBESRelative(idsOfSelectStart,idsOfSelectStop,idsOfSelectStep,"MEDCouplingUMesh::ExtractFromIndexedArraysSlice : Input slice "); const int *arrInPtr=arrIn->begin(); const int *arrIndxPtr=arrIndxIn->begin(); - int nbOfGrps=arrIndxIn->getNumberOfTuples()-1; + mcIdType nbOfGrps=ToIdType(arrIndxIn->getNumberOfTuples())-1; if(nbOfGrps<0) throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArraysSlice : The format of \"arrIndxIn\" is invalid ! Its nb of tuples should be >=1 !"); - int maxSizeOfArr=arrIn->getNumberOfTuples(); + mcIdType maxSizeOfArr=ToIdType(arrIn->getNumberOfTuples()); MCAuto arro=DataArrayInt::New(); MCAuto arrIo=DataArrayInt::New(); arrIo->alloc((int)(sz+1),1); @@ -6652,7 +6655,7 @@ void DataArrayInt::SetPartOfIndexedArrays(const int *idsOfSelectBg, const int *i throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArrays : presence of null pointer in input parameter !"); MCAuto arro=DataArrayInt::New(); MCAuto arrIo=DataArrayInt::New(); - int nbOfTuples=arrIndxIn->getNumberOfTuples()-1; + mcIdType nbOfTuples=ToIdType(arrIndxIn->getNumberOfTuples())-1; std::vector v(nbOfTuples,true); int offset=0; const int *arrIndxInPtr=arrIndxIn->begin(); @@ -6677,7 +6680,7 @@ void DataArrayInt::SetPartOfIndexedArrays(const int *idsOfSelectBg, const int *i const int *srcArrPtr=srcArr->begin(); int *arrIoPtr=arrIo->getPointer(); *arrIoPtr++=0; int *arroPtr=arro->getPointer(); - for(int ii=0;ii arro=DataArrayInt::New(); MCAuto arrIo=DataArrayInt::New(); - int nbOfTuples=arrIndxIn->getNumberOfTuples()-1; + mcIdType nbOfTuples=ToIdType(arrIndxIn->getNumberOfTuples())-1; int offset=0; const int *arrIndxInPtr=arrIndxIn->begin(); const int *srcArrIndexPtr=srcArrIndex->begin(); @@ -6745,7 +6748,7 @@ void DataArrayInt::SetPartOfIndexedArraysSlice(int start, int end, int step, con const int *srcArrPtr=srcArr->begin(); int *arrIoPtr=arrIo->getPointer(); *arrIoPtr++=0; int *arroPtr=arro->getPointer(); - for(int ii=0;iigetNumberOfTuples()-1; + mcIdType nbOfTuples=ToIdType(arrIndxIn->getNumberOfTuples())-1; const int *arrIndxInPtr=arrIndxIn->begin(); const int *srcArrIndexPtr=srcArrIndex->begin(); int *arrInOutPtr=arrInOut->getPointer(); @@ -6825,13 +6828,13 @@ bool DataArrayInt::RemoveIdsFromIndexedArrays(const int *idsToRemoveBg, const in if(offsetForRemoval<0) throw INTERP_KERNEL::Exception("DataArrayInt::RemoveIdsFromIndexedArrays : offsetForRemoval should be >=0 !"); std::set s(idsToRemoveBg,idsToRemoveEnd); - int nbOfGrps=arrIndx->getNumberOfTuples()-1; + mcIdType nbOfGrps=ToIdType(arrIndx->getNumberOfTuples())-1; int *arrIPtr=arrIndx->getPointer(); *arrIPtr++=0; int previousArrI=0; const int *arrPtr=arr->begin(); std::vector arrOut;//no utility to switch to DataArrayInt because copy always needed - for(int i=0;ioffsetForRemoval) { @@ -6870,7 +6873,7 @@ void DataArrayInt::SetPartOfIndexedArraysSameIdxSlice(int start, int end, int st { if(arrInOut==0 || arrIndxIn==0 || srcArr==0 || srcArrIndex==0) throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArraysSameIdxSlice : presence of null pointer in input parameter !"); - int nbOfTuples=arrIndxIn->getNumberOfTuples()-1; + mcIdType nbOfTuples=ToIdType(arrIndxIn->getNumberOfTuples())-1; const int *arrIndxInPtr=arrIndxIn->begin(); const int *srcArrIndexPtr=srcArrIndex->begin(); int *arrInOutPtr=arrInOut->getPointer(); @@ -6976,8 +6979,8 @@ void DataArrayInt::getTinySerializationIntInformation(std::vector& tinyInfo tinyInfo.resize(2); if(isAllocated()) { - tinyInfo[0]=getNumberOfTuples(); - tinyInfo[1]=getNumberOfComponents(); + tinyInfo[0]=ToIdType(getNumberOfTuples()); + tinyInfo[1]=ToIdType(getNumberOfComponents()); } else { @@ -6994,7 +6997,7 @@ void DataArrayInt::getTinySerializationStrInformation(std::vector& { if(isAllocated()) { - int nbOfCompo=getNumberOfComponents(); + mcIdType nbOfCompo=ToIdType(getNumberOfComponents()); tinyInfo.resize(nbOfCompo+1); tinyInfo[0]=getName(); for(int i=0;i& other); MEDCOUPLING_EXPORT void reverse(); MEDCOUPLING_EXPORT void fillWithValue(T val); @@ -716,8 +716,8 @@ namespace MEDCoupling throw INTERP_KERNEL::Exception("DataArrayInt::findIdsAdv : this must have exactly one component !"); const T *cptr(this->begin()); MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); - int nbOfTuples(this->getNumberOfTuples()); - for(int i=0;igetNumberOfTuples()); + for(mcIdType i=0;ipushBackSilent(i); return ret; @@ -842,7 +842,7 @@ namespace MEDCoupling { public: MEDCOUPLING_EXPORT DataArrayTuple(T *pt, int nbOfComp); - MEDCOUPLING_EXPORT std::string repr() const; + //MEDCOUPLING_EXPORT std::string repr() const; MEDCOUPLING_EXPORT int getNumberOfCompo() const { return _nb_of_compo; } MEDCOUPLING_EXPORT const T *getConstPointer() const { return _pt; } MEDCOUPLING_EXPORT T *getPointer() { return _pt; } @@ -993,7 +993,7 @@ namespace MEDCoupling template void DataArrayTemplate::insertAtTheEnd(InputIterator first, InputIterator last) { - int nbCompo(this->getNumberOfComponents()); + std::size_t nbCompo(this->getNumberOfComponents()); if(nbCompo==1) this->_mem.insertAtTheEnd(first,last); else if(nbCompo==0) diff --git a/src/MEDCoupling/MEDCouplingMemArray.txx b/src/MEDCoupling/MEDCouplingMemArray.txx old mode 100644 new mode 100755 index 570f0f832..9fde4127d --- a/src/MEDCoupling/MEDCouplingMemArray.txx +++ b/src/MEDCoupling/MEDCouplingMemArray.txx @@ -499,8 +499,8 @@ namespace MEDCoupling _da->incrRef(); if(_da->isAllocated()) { - _nb_comp=da->getNumberOfComponents(); - _nb_tuple=da->getNumberOfTuples(); + _nb_comp=ToIdType(da->getNumberOfComponents()); + _nb_tuple=ToIdType(da->getNumberOfTuples()); _pt=da->getPointer(); } } @@ -577,7 +577,7 @@ namespace MEDCoupling { checkAllocated(); std::size_t sz(getNumberOfComponents()); - int nbTuples(getNumberOfTuples()); + std::size_t nbTuples(getNumberOfTuples()); std::string name(getName()); std::vector compNames(getInfoOnComponents()); std::vector< MCAuto< typename Traits::ArrayTypeCh > > ret(sz); @@ -589,7 +589,7 @@ namespace MEDCoupling part->setName(name); part->setInfoOnComponent(0,compNames[i]); T *otherPt(part->getPointer()); - for(int j=0;j::getIJSafe(int tupleId, int compoId) const { checkAllocated(); - if(tupleId<0 || tupleId>=getNumberOfTuples()) + if(tupleId<0 || tupleId>=ToIdType(getNumberOfTuples())) { std::ostringstream oss; oss << Traits::ArrayTypeName << "::getIJSafe : request for tupleId " << tupleId << " should be in [0," << getNumberOfTuples() << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -735,7 +735,7 @@ namespace MEDCoupling template void DataArrayTemplate::reserve(std::size_t nbOfElems) { - int nbCompo(getNumberOfComponents()); + std::size_t nbCompo(getNumberOfComponents()); if(nbCompo==1) { _mem.reserve(nbOfElems); @@ -763,7 +763,7 @@ namespace MEDCoupling template void DataArrayTemplate::pushBackSilent(T val) { - int nbCompo(getNumberOfComponents()); + std::size_t nbCompo(getNumberOfComponents()); if(nbCompo==1) _mem.pushBack(val); else if(nbCompo==0) @@ -791,7 +791,7 @@ namespace MEDCoupling template void DataArrayTemplate::pushBackValsSilent(const T *valsBg, const T *valsEnd) { - int nbCompo(getNumberOfComponents()); + std::size_t nbCompo(getNumberOfComponents()); if(nbCompo==1) _mem.insertAtTheEnd(valsBg,valsEnd); else if(nbCompo==0) @@ -831,11 +831,11 @@ namespace MEDCoupling * \throw If \a nbOfTuple < 0 or \a nbOfCompo < 0. */ template - void DataArrayTemplate::allocIfNecessary(int nbOfTuple, int nbOfCompo) + void DataArrayTemplate::allocIfNecessary(std::size_t nbOfTuple, std::size_t nbOfCompo) { if(isAllocated()) { - if(nbOfTuple!=getNumberOfTuples() || nbOfCompo!=(int)getNumberOfComponents()) + if(nbOfTuple!=getNumberOfTuples() || nbOfCompo!=getNumberOfComponents()) alloc(nbOfTuple,nbOfCompo); } else @@ -864,9 +864,9 @@ namespace MEDCoupling void DataArrayTemplate::deepCopyFrom(const DataArrayTemplate& other) { other.checkAllocated(); - int nbOfTuples(other.getNumberOfTuples()),nbOfComp(other.getNumberOfComponents()); + std::size_t nbOfTuples(other.getNumberOfTuples()),nbOfComp(other.getNumberOfComponents()); allocIfNecessary(nbOfTuples,nbOfComp); - std::size_t nbOfElems((std::size_t)nbOfTuples*nbOfComp); + std::size_t nbOfElems(nbOfTuples*nbOfComp); T *pt(getPointer()); const T *ptI(other.begin()); for(std::size_t i=0;i::reverse() { checkAllocated(); - _mem.reverse(getNumberOfComponents()); + _mem.reverse(ToIdType(getNumberOfComponents())); declareAsNew(); } @@ -929,7 +929,8 @@ namespace MEDCoupling void DataArrayTemplate::renumberInPlace(const int *old2New) { checkAllocated(); - int nbTuples(getNumberOfTuples()),nbOfCompo(getNumberOfComponents()); + mcIdType nbTuples=ToIdType(getNumberOfTuples()); + mcIdType nbOfCompo=ToIdType(getNumberOfComponents()); T *tmp(new T[nbTuples*nbOfCompo]); const T *iptr(begin()); for(int i=0;i::renumberInPlaceR(const int *new2Old) { checkAllocated(); - int nbTuples(getNumberOfTuples()),nbOfCompo(getNumberOfComponents()); + mcIdType nbTuples=ToIdType(getNumberOfTuples()); + mcIdType nbOfCompo=ToIdType(getNumberOfComponents()); T *tmp(new T[nbTuples*nbOfCompo]); const T *iptr(begin()); - for(int i=0;i=0 && v::ArrayType *DataArrayTemplate::renumber(const int *old2New) const { checkAllocated(); - int nbTuples(getNumberOfTuples()),nbOfCompo(getNumberOfComponents()); + mcIdType nbTuples=ToIdType(getNumberOfTuples()); + mcIdType nbOfCompo=ToIdType(getNumberOfComponents()); MCAuto ret0(buildNewEmptyInstance()); MCAuto< typename Traits::ArrayType > ret(DynamicCastSafe::ArrayType>(ret0)); ret->alloc(nbTuples,nbOfCompo); ret->copyStringInfoFrom(*this); const T *iptr(begin()); T *optr(ret->getPointer()); - for(int i=0;icopyStringInfoFrom(*this); return ret.retn(); @@ -1045,14 +1048,15 @@ namespace MEDCoupling typename Traits::ArrayType *DataArrayTemplate::renumberR(const int *new2Old) const { checkAllocated(); - int nbTuples(getNumberOfTuples()),nbOfCompo(getNumberOfComponents()); + mcIdType nbTuples=ToIdType(getNumberOfTuples()); + mcIdType nbOfCompo=ToIdType(getNumberOfComponents()); MCAuto ret0(buildNewEmptyInstance()); MCAuto< typename Traits::ArrayType > ret(DynamicCastSafe::ArrayType>(ret0)); ret->alloc(nbTuples,nbOfCompo); ret->copyStringInfoFrom(*this); const T *iptr(getConstPointer()); T *optr(ret->getPointer()); - for(int i=0;icopyStringInfoFrom(*this); return ret.retn(); @@ -1075,13 +1079,14 @@ namespace MEDCoupling typename Traits::ArrayType *DataArrayTemplate::renumberAndReduce(const int *old2New, int newNbOfTuple) const { checkAllocated(); - int nbTuples(getNumberOfTuples()),nbOfCompo(getNumberOfComponents()); + mcIdType nbTuples=ToIdType(getNumberOfTuples()); + mcIdType nbOfCompo=ToIdType(getNumberOfComponents()); MCAuto ret0(buildNewEmptyInstance()); MCAuto< typename Traits::ArrayType > ret(DynamicCastSafe::ArrayType>(ret0)); ret->alloc(newNbOfTuple,nbOfCompo); const T *iptr=getConstPointer(); T *optr=ret->getPointer(); - for(int i=0;i=0) @@ -1191,7 +1196,8 @@ namespace MEDCoupling checkAllocated(); MCAuto ret0(buildNewEmptyInstance()); MCAuto< typename Traits::ArrayType > ret(DynamicCastSafe::ArrayType>(ret0)); - int nbComp(getNumberOfComponents()),oldNbOfTuples(getNumberOfTuples()); + mcIdType nbComp=ToIdType(getNumberOfComponents()); + mcIdType oldNbOfTuples=ToIdType(getNumberOfTuples()); ret->alloc((int)std::distance(new2OldBg,new2OldEnd),nbComp); ret->copyStringInfoFrom(*this); T *pt(ret->getPointer()); @@ -1259,8 +1265,7 @@ namespace MEDCoupling void DataArrayTemplate::transpose() { checkAllocated(); - int nbOfTuples(getNumberOfTuples()); - rearrange(nbOfTuples); + rearrange(ToIdType (getNumberOfTuples())); } /*! @@ -1285,18 +1290,19 @@ namespace MEDCoupling ret->alloc(getNumberOfTuples(),newNbOfComp); const T *oldc(getConstPointer()); T *nc(ret->getPointer()); - int nbOfTuples(getNumberOfTuples()),oldNbOfComp(getNumberOfComponents()); - int dim(std::min(oldNbOfComp,newNbOfComp)); - for(int i=0;isetName(getName()); - for(int i=0;isetInfoOnComponent(i,getInfoOnComponent(i)); ret->setName(getName()); return ret.retn(); @@ -1325,20 +1331,20 @@ namespace MEDCoupling checkAllocated(); MCAuto ret0(buildNewEmptyInstance()); MCAuto< typename Traits::ArrayType > ret(DynamicCastSafe::ArrayType>(ret0)); - std::size_t newNbOfCompo(compoIds.size()); - int oldNbOfCompo(getNumberOfComponents()); + std::size_t newNbOfCompo=ToIdType(compoIds.size()); + mcIdType oldNbOfCompo=ToIdType(getNumberOfComponents()); for(std::vector::const_iterator it=compoIds.begin();it!=compoIds.end();it++) if((*it)<0 || (*it)>=oldNbOfCompo) { std::ostringstream oss; oss << Traits::ArrayTypeName << "::keepSelectedComponents : invalid requested component : " << *it << " whereas it should be in [0," << oldNbOfCompo << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - int nbOfTuples(getNumberOfTuples()); - ret->alloc(nbOfTuples,(int)newNbOfCompo); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); + ret->alloc(nbOfTuples,newNbOfCompo); ret->copyPartOfStringInfoFrom(*this,compoIds); const T *oldc(getConstPointer()); T *nc(ret->getPointer()); - for(int i=0;i::ArrayType *DataArrayTemplate::subArray(int tupleIdBg, int tupleIdEnd) const { checkAllocated(); - int nbt(getNumberOfTuples()); + mcIdType nbt=ToIdType(getNumberOfTuples()); if(tupleIdBg<0) { std::ostringstream oss; oss << Traits::ArrayTypeName << "::subArray : The tupleIdBg parameter must be greater than 0 !"; @@ -1374,7 +1380,7 @@ namespace MEDCoupling std::ostringstream oss; oss << Traits::ArrayTypeName << ":subArray : The tupleIdBg parameter is greater than number of tuples !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - int trueEnd=tupleIdEnd; + mcIdType trueEnd=tupleIdEnd; if(tupleIdEnd!=-1) { if(tupleIdEnd>nbt) @@ -1385,7 +1391,7 @@ namespace MEDCoupling } else trueEnd=nbt; - int nbComp(getNumberOfComponents()); + mcIdType nbComp=ToIdType(getNumberOfComponents()); MCAuto ret0(buildNewEmptyInstance()); MCAuto< typename Traits::ArrayType > ret(DynamicCastSafe::ArrayType>(ret0)); ret->alloc(trueEnd-tupleIdBg,nbComp); @@ -1415,7 +1421,7 @@ namespace MEDCoupling checkAllocated(); MCAuto ret0(buildNewEmptyInstance()); MCAuto< typename Traits::ArrayType > ret(DynamicCastSafe::ArrayType>(ret0)); - int nbComp(getNumberOfComponents()); + mcIdType nbComp=ToIdType(getNumberOfComponents()); std::ostringstream oss; oss << Traits::ArrayTypeName << "::selectByTupleIdSafeSlice : "; int newNbOfTuples(GetNumberOfItemGivenBESRelative(bg,end2,step,oss.str())); ret->alloc(newNbOfTuples,nbComp); @@ -1476,7 +1482,8 @@ namespace MEDCoupling a->checkAllocated(); int newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg)); int newNbOfComp(DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg)); - int nbComp(getNumberOfComponents()),nbOfTuples(getNumberOfTuples()); + mcIdType nbComp=ToIdType(getNumberOfComponents()); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value"); DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value"); bool assignTech(true); @@ -1538,12 +1545,13 @@ namespace MEDCoupling checkAllocated(); int newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg)); int newNbOfComp(DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg)); - int nbComp(getNumberOfComponents()),nbOfTuples(getNumberOfTuples()); + mcIdType nbComp=ToIdType(getNumberOfComponents()); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value"); DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value"); T *pt=getPointer()+bgTuples*nbComp+bgComp; - for(int i=0;icheckAllocated(); - int nbComp(getNumberOfComponents()),nbOfTuples(getNumberOfTuples()); + mcIdType nbComp=ToIdType(getNumberOfComponents()); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); for(const int *z=bgComp;z!=endComp;z++) DataArray::CheckValueInRange(nbComp,*z,"invalid component id"); int newNbOfTuples((int)std::distance(bgTuples,endTuples)); @@ -1664,7 +1673,8 @@ namespace MEDCoupling void DataArrayTemplate::setPartOfValuesSimple2(T a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp) { checkAllocated(); - int nbComp(getNumberOfComponents()),nbOfTuples(getNumberOfTuples()); + mcIdType nbComp=ToIdType(getNumberOfComponents()); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); for(const int *z=bgComp;z!=endComp;z++) DataArray::CheckValueInRange(nbComp,*z,"invalid component id"); T *pt(getPointer()); @@ -1731,8 +1741,8 @@ namespace MEDCoupling checkAllocated(); a->checkAllocated(); int newNbOfComp=DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg); - int nbComp=getNumberOfComponents(); - int nbOfTuples=getNumberOfTuples(); + mcIdType nbComp=ToIdType(getNumberOfComponents()); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value"); int newNbOfTuples=(int)std::distance(bgTuples,endTuples); bool assignTech=true; @@ -1803,7 +1813,8 @@ namespace MEDCoupling const char msg[]="DataArrayTemplate::setPartOfValuesSimple3"; checkAllocated(); int newNbOfComp(DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg)); - int nbComp(getNumberOfComponents()),nbOfTuples(getNumberOfTuples()); + mcIdType nbComp=ToIdType(getNumberOfComponents()); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value"); T *pt(getPointer()+bgComp); for(const int *w=bgTuples;w!=endTuples;w++) @@ -1857,10 +1868,10 @@ namespace MEDCoupling a->checkAllocated(); int newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg)); int newNbOfComp((int)std::distance(bgComp,endComp)); - int nbComp(getNumberOfComponents()); + mcIdType nbComp=ToIdType(getNumberOfComponents()); for(const int *z=bgComp;z!=endComp;z++) DataArray::CheckValueInRange(nbComp,*z,"invalid component id"); - int nbOfTuples(getNumberOfTuples()); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value"); bool assignTech(true); if(a->getNbOfElems()==(std::size_t)newNbOfTuples*newNbOfComp) @@ -1898,10 +1909,10 @@ namespace MEDCoupling const char msg[]="DataArrayTemplate::setPartOfValuesSimple4"; checkAllocated(); int newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg)); - int nbComp(getNumberOfComponents()); + mcIdType nbComp=ToIdType(getNumberOfComponents()); for(const int *z=bgComp;z!=endComp;z++) DataArray::CheckValueInRange(nbComp,*z,"invalid component id"); - int nbOfTuples(getNumberOfTuples()); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value"); T *pt=getPointer()+bgTuples*nbComp; for(int i=0;igetNumberOfComponents()!=2) throw INTERP_KERNEL::Exception("DataArrayTemplate::setPartOfValuesAdv : Expecting to have a tuple selector DataArrayInt instance with exactly 2 components !"); - int thisNt(getNumberOfTuples()); - int aNt(a->getNumberOfTuples()); + mcIdType thisNt=ToIdType(getNumberOfTuples()); + mcIdType aNt=ToIdType(a->getNumberOfTuples()); T *valsToSet(getPointer()); const T *valsSrc(a->getConstPointer()); for(const int *tuple=tuplesSelec->begin();tuple!=tuplesSelec->end();tuple+=2) @@ -2008,9 +2019,9 @@ namespace MEDCoupling throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValues : This and a do not have the same number of components !"); if(tuplesSelec->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValues : Expecting to have a tuple selector DataArrayInt instance with exactly 1 component !"); - int thisNt(getNumberOfTuples()); - int aNt(a->getNumberOfTuples()); - int nbOfTupleToWrite(tuplesSelec->getNumberOfTuples()); + mcIdType thisNt=ToIdType(getNumberOfTuples()); + mcIdType aNt=ToIdType(a->getNumberOfTuples()); + mcIdType nbOfTupleToWrite=ToIdType(tuplesSelec->getNumberOfTuples()); T *valsToSet(getPointer()+tupleIdStart*nbOfComp); if(tupleIdStart+nbOfTupleToWrite>thisNt) throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValues : invalid number range of values to write !"); @@ -2073,7 +2084,8 @@ namespace MEDCoupling int nbOfTupleToWrite(DataArray::GetNumberOfItemGivenBES(bg,end2,step,msg)); if(nbOfComp!=a->getNumberOfComponents()) throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValuesSlice : This and a do not have the same number of components !"); - int thisNt(getNumberOfTuples()),aNt(a->getNumberOfTuples()); + mcIdType thisNt=ToIdType(getNumberOfTuples()); + mcIdType aNt=ToIdType(a->getNumberOfTuples()); T *valsToSet(getPointer()+tupleIdStart*nbOfComp); if(tupleIdStart+nbOfTupleToWrite>thisNt) throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValuesSlice : invalid number range of values to write !"); @@ -2102,7 +2114,8 @@ namespace MEDCoupling typename Traits::ArrayType *DataArrayTemplate::mySelectByTupleRanges(const std::vector >& ranges) const { checkAllocated(); - int nbOfComp(getNumberOfComponents()),nbOfTuplesThis(getNumberOfTuples()); + mcIdType nbOfComp=ToIdType(getNumberOfComponents()); + mcIdType nbOfTuplesThis=ToIdType(getNumberOfTuples()); if(ranges.empty()) { MCAuto ret0(buildNewEmptyInstance()); @@ -2164,7 +2177,7 @@ namespace MEDCoupling checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayTemplate::front : number of components not equal to one !"); - int nbOfTuples(getNumberOfTuples()); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); if(nbOfTuples<1) throw INTERP_KERNEL::Exception("DataArrayTemplate::front : number of tuples must be >= 1 !"); return *(getConstPointer()); @@ -2183,7 +2196,7 @@ namespace MEDCoupling checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayTemplate::back : number of components not equal to one !"); - int nbOfTuples(getNumberOfTuples()); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); if(nbOfTuples<1) throw INTERP_KERNEL::Exception("DataArrayTemplate::back : number of tuples must be >= 1 !"); return *(getConstPointer()+nbOfTuples-1); @@ -2203,7 +2216,7 @@ namespace MEDCoupling checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayDouble::getMaxValue : must be applied on DataArrayDouble with only one component, you can call 'rearrange' method before or call 'getMaxValueInArray' method !"); - int nbOfTuples(getNumberOfTuples()); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); if(nbOfTuples<=0) throw INTERP_KERNEL::Exception("DataArrayDouble::getMaxValue : array exists but number of tuples must be > 0 !"); const T *vals(getConstPointer()); @@ -2248,14 +2261,14 @@ namespace MEDCoupling const T *pt(begin()); for(std::size_t i=0;iret) { ret=cand; tupleId=i; } } - return this->getIJ(tupleId,0); + return this->getIJ(ToIdType(tupleId),0); } /*! @@ -2284,7 +2297,7 @@ namespace MEDCoupling checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayDouble::getMinValue : must be applied on DataArrayDouble with only one component, you can call 'rearrange' method before call 'getMinValueInArray' method !"); - int nbOfTuples(getNumberOfTuples()); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); if(nbOfTuples<=0) throw INTERP_KERNEL::Exception("DataArrayDouble::getMinValue : array exists but number of tuples must be > 0 !"); const T *vals(getConstPointer()); @@ -2311,7 +2324,8 @@ namespace MEDCoupling void DataArrayTemplate::circularPermutation(int nbOfShift) { checkAllocated(); - int nbOfCompo(getNumberOfComponents()),nbTuples(getNumberOfTuples()); + mcIdType nbOfCompo=ToIdType(getNumberOfComponents()); + mcIdType nbTuples=ToIdType(getNumberOfTuples()); int effNbSh(EffectiveCircPerm(nbOfShift,nbTuples)); if(effNbSh==0) return ; @@ -2336,7 +2350,8 @@ namespace MEDCoupling void DataArrayTemplate::circularPermutationPerTuple(int nbOfShift) { checkAllocated(); - int nbOfCompo(getNumberOfComponents()),nbTuples(getNumberOfTuples()); + mcIdType nbOfCompo=ToIdType(getNumberOfComponents()); + mcIdType nbTuples=ToIdType(getNumberOfTuples()); int effNbSh(EffectiveCircPerm(nbOfShift,nbOfCompo)); if(effNbSh==0) return ; @@ -2344,7 +2359,7 @@ namespace MEDCoupling if(effNbSh buf(new T[effNbSh]); - for(int i=0;i buf(new T[nbOfCompo-effNbSh]); - for(int i=0;i sts(nbOfCompo); - for(int i=0;i::reversePerTuple() { checkAllocated(); - int nbOfCompo(getNumberOfComponents()),nbTuples(getNumberOfTuples()); + mcIdType nbOfCompo=ToIdType(getNumberOfComponents()); + mcIdType nbTuples=ToIdType(getNumberOfTuples()); if(nbOfCompo<=1) return ; T *work(getPointer()); - for(int i=0;i + static void copyCast (const TIn *begin, const TIn *end, TOut* dest) + { + for (const TIn *src = begin; src != end; ++src, ++dest) + *dest=static_cast(*src); + } + } + template template MCAuto< typename Traits::ArrayType > DataArrayTemplateClassic::convertToOtherTypeOfArr() const @@ -2423,9 +2450,8 @@ namespace MEDCoupling const T *src(this->begin()); U *dest(ret->getPointer()); // to make Visual C++ happy : instead of std::size_t nbOfVals=getNbOfElems(); std::copy(src,src+nbOfVals,dest); - //for(const T *src=this->begin();src!=this->end();src++,dest++) - // *dest=(int)*src; - std::copy(src,src+nbOfVals,dest); + copyCast(src, src+nbOfVals, dest); + //std::copy(src,src+nbOfVals,dest); ret->copyStringInfoFrom(*this); return ret; } @@ -2476,13 +2502,14 @@ namespace MEDCoupling { this->checkAllocated(); T *ptr(this->getPointer()+compoId); - int nbOfComp(this->getNumberOfComponents()),nbOfTuple(this->getNumberOfTuples()); + mcIdType nbOfComp=ToIdType(this->getNumberOfComponents()); + mcIdType nbOfTuple=ToIdType(this->getNumberOfTuples()); if(compoId<0 || compoId>=nbOfComp) { std::ostringstream oss; oss << "DataArrayDouble::applyLin : The compoId requested (" << compoId << ") is not valid ! Must be in [0," << nbOfComp << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - for(int i=0;ideclareAsNew(); } @@ -2518,7 +2545,8 @@ namespace MEDCoupling { this->checkAllocated(); MCAuto::ArrayType> newArr(Traits::ArrayType::New()); - int nbOfTuples(this->getNumberOfTuples()),nbOfComp(this->getNumberOfComponents()); + mcIdType nbOfTuples=ToIdType(this->getNumberOfTuples()); + mcIdType nbOfComp=ToIdType(this->getNumberOfComponents()); newArr->alloc(nbOfTuples,nbOfComp); const T *cptr(this->begin()); std::transform(cptr,cptr+nbOfTuples*nbOfComp,newArr->getPointer(),std::negate()); @@ -2535,8 +2563,10 @@ namespace MEDCoupling const char *msg="Nb of tuples mismatch for DataArrayDouble::multiplyEqual !"; this->checkAllocated(); other->checkAllocated(); - int nbOfTuple(this->getNumberOfTuples()),nbOfTuple2(other->getNumberOfTuples()); - int nbOfComp(this->getNumberOfComponents()),nbOfComp2(other->getNumberOfComponents()); + mcIdType nbOfTuple=ToIdType(this->getNumberOfTuples()); + mcIdType nbOfTuple2=ToIdType(other->getNumberOfTuples()); + mcIdType nbOfComp=ToIdType(this->getNumberOfComponents()); + mcIdType nbOfComp2=ToIdType(other->getNumberOfComponents()); if(nbOfTuple==nbOfTuple2) { if(nbOfComp==nbOfComp2) @@ -2547,7 +2577,7 @@ namespace MEDCoupling { T *ptr(this->getPointer()); const T *ptrc(other->begin()); - for(int i=0;igetPointer()); const T *ptrc(other->begin()); - for(int i=0;igetNumberOfTuples()),nbOfTuple2(a2->getNumberOfTuples()); - int nbOfComp1(a1->getNumberOfComponents()),nbOfComp2(a2->getNumberOfComponents()); + mcIdType nbOfTuple1=ToIdType(a1->getNumberOfTuples()); + mcIdType nbOfTuple2=ToIdType(a2->getNumberOfTuples()); + mcIdType nbOfComp1=ToIdType(a1->getNumberOfComponents()); + mcIdType nbOfComp2=ToIdType(a2->getNumberOfComponents()); if(nbOfTuple2==nbOfTuple1) { if(nbOfComp1==nbOfComp2) @@ -2686,7 +2718,7 @@ namespace MEDCoupling ret->alloc(nbOfTuple1,nbOfComp1); const T *a2Ptr(a2->begin()),*a1Ptr(a1->begin()); T *res(ret->getPointer()); - for(int i=0;icopyStringInfoFrom(*a1); return ret.retn(); @@ -2704,7 +2736,7 @@ namespace MEDCoupling ret->alloc(nbOfTuple1,nbOfComp1); const T *a1ptr=a1->begin(),*a2ptr(a2->begin()); T *pt(ret->getPointer()); - for(int i=0;icopyStringInfoFrom(*a1); return ret.retn(); @@ -2784,8 +2816,10 @@ namespace MEDCoupling { if(!a1 || !a2) throw INTERP_KERNEL::Exception("DataArrayDouble::MulAdd : input DataArrayDouble instance is NULL !"); - int nbOfTuple(a1->getNumberOfTuples()),nbOfTuple2(a2->getNumberOfTuples()); - int nbOfComp(a1->getNumberOfComponents()),nbOfComp2(a2->getNumberOfComponents()); + mcIdType nbOfTuple=ToIdType(a1->getNumberOfTuples()); + mcIdType nbOfTuple2=ToIdType(a2->getNumberOfTuples()); + mcIdType nbOfComp=ToIdType(a1->getNumberOfComponents()); + mcIdType nbOfComp2=ToIdType(a2->getNumberOfComponents()); MCAuto::ArrayType> ret=0; if(nbOfTuple==nbOfTuple2) { @@ -2798,7 +2832,7 @@ namespace MEDCoupling } else { - int nbOfCompMin,nbOfCompMax; + mcIdType nbOfCompMin,nbOfCompMax; const typename Traits::ArrayType *aMin, *aMax; if(nbOfComp>nbOfComp2) { @@ -2817,7 +2851,7 @@ namespace MEDCoupling const T *aMinPtr(aMin->begin()); const T *aMaxPtr(aMax->begin()); T *res=ret->getPointer(); - for(int i=0;icopyStringInfoFrom(*aMax); } @@ -2829,14 +2863,14 @@ namespace MEDCoupling { if(nbOfComp==nbOfComp2) { - int nbOfTupleMax=std::max(nbOfTuple,nbOfTuple2); + mcIdType nbOfTupleMax=std::max(nbOfTuple,nbOfTuple2); const typename Traits::ArrayType *aMin(nbOfTuple>nbOfTuple2?a2:a1); const typename Traits::ArrayType *aMax(nbOfTuple>nbOfTuple2?a1:a2); const T *aMinPtr(aMin->begin()),*aMaxPtr(aMax->begin()); ret=Traits::ArrayType::New(); ret->alloc(nbOfTupleMax,nbOfComp); T *res(ret->getPointer()); - for(int i=0;icopyStringInfoFrom(*aMax); } @@ -3074,13 +3108,13 @@ struct NotInRange std::size_t nbOfTuples((*it)->getNumberOfTuples()); std::vector nbc(a.size()); std::vector pts(a.size()); - nbc[0]=(*it)->getNumberOfComponents(); + nbc[0]=ToIdType((*it)->getNumberOfComponents()); pts[0]=(*it++)->getConstPointer(); for(int i=1;it!=a.end();it++,i++) { if(nbOfTuples!=(*it)->getNumberOfTuples()) throw INTERP_KERNEL::Exception("DataArrayDouble::Meld : mismatch of number of tuples !"); - nbc[i]=(*it)->getNumberOfComponents(); + nbc[i]=ToIdType((*it)->getNumberOfComponents()); pts[i]=(*it)->getConstPointer(); } int totalNbOfComp=std::accumulate(nbc.begin(),nbc.end(),0); @@ -3115,9 +3149,9 @@ struct NotInRange { if(this->_mem.isNull()) throw INTERP_KERNEL::Exception("DataArrayDouble::fromNoInterlace : Not defined array !"); - T *tab(this->_mem.fromNoInterlace(this->getNumberOfComponents())); + T *tab(this->_mem.fromNoInterlace(ToIdType(this->getNumberOfComponents()))); MCAuto::ArrayType> ret(Traits::ArrayType::New()); - ret->useArray(tab,true,DeallocType::C_DEALLOC,this->getNumberOfTuples(),this->getNumberOfComponents()); + ret->useArray(tab,true,DeallocType::C_DEALLOC,ToIdType(this->getNumberOfTuples()),ToIdType(this->getNumberOfComponents())); return ret.retn(); } @@ -3136,9 +3170,9 @@ struct NotInRange { if(this->_mem.isNull()) throw INTERP_KERNEL::Exception("DataArrayDouble::toNoInterlace : Not defined array !"); - T *tab(this->_mem.toNoInterlace(this->getNumberOfComponents())); + T *tab(this->_mem.toNoInterlace(ToIdType(this->getNumberOfComponents()))); MCAuto::ArrayType> ret(Traits::ArrayType::New()); - ret->useArray(tab,true,DeallocType::C_DEALLOC,this->getNumberOfTuples(),this->getNumberOfComponents()); + ret->useArray(tab,true,DeallocType::C_DEALLOC,ToIdType(this->getNumberOfTuples()),ToIdType(this->getNumberOfComponents())); return ret.retn(); } @@ -3161,14 +3195,15 @@ struct NotInRange { this->checkAllocated(); other->checkAllocated(); - std::size_t nbOfTuples(this->getNumberOfTuples()); - if(nbOfTuples!=other->getNumberOfTuples()) + mcIdType nbOfTuples=ToIdType((this->getNumberOfTuples())); + if(nbOfTuples!=ToIdType(other->getNumberOfTuples())) throw INTERP_KERNEL::Exception("DataArrayDouble::meldWith : mismatch of number of tuples !"); - int nbOfComp1(this->getNumberOfComponents()),nbOfComp2(other->getNumberOfComponents()); + mcIdType nbOfComp1=ToIdType(this->getNumberOfComponents()); + mcIdType nbOfComp2=ToIdType(other->getNumberOfComponents()); T *newArr=(T *)malloc((nbOfTuples*(nbOfComp1+nbOfComp2))*sizeof(T)); T *w=newArr; const T *inp1(this->begin()),*inp2(other->begin()); - for(std::size_t i=0;i= 1 !"); - int nbTuples(this->getNumberOfTuples()); + mcIdType nbTuples=ToIdType(this->getNumberOfTuples()); const T *inPtr(this->begin()); MCAuto::ArrayType> ret(Traits::ArrayType::New()); ret->alloc(nbTimes*nbTuples,1); T *retPtr(ret->getPointer()); - for(int i=0;icheckAllocated(); MCAuto::ArrayType> newArr(Traits::ArrayType::New()); - int nbOfTuples(this->getNumberOfTuples()); - int nbOfComp(this->getNumberOfComponents()); + std::size_t nbOfTuples(this->getNumberOfTuples()); + std::size_t nbOfComp(this->getNumberOfComponents()); newArr->alloc(nbOfTuples,nbOfComp); std::transform(this->begin(),this->end(),newArr->getPointer(),std::ptr_fun(std::abs)); newArr->copyStringInfoFrom(*this); @@ -3353,7 +3388,7 @@ struct NotInRange { DataArray::reprWithoutNameStream(stream); ImplReprTraits::SetPrecision(stream); - this->_mem.repr(this->getNumberOfComponents(),stream); + this->_mem.repr(ToIdType(this->getNumberOfComponents()),stream); } template @@ -3361,7 +3396,7 @@ struct NotInRange { DataArray::reprWithoutNameStream(stream); ImplReprTraits::SetPrecision(stream); - this->_mem.reprZip(this->getNumberOfComponents(),stream); + this->_mem.reprZip(ToIdType(this->getNumberOfComponents()),stream); } template @@ -3369,7 +3404,7 @@ struct NotInRange { DataArray::reprWithoutNameStream(stream); ImplReprTraits::SetPrecision(stream); - this->_mem.reprNotTooLong(this->getNumberOfComponents(),stream); + this->_mem.reprNotTooLong(ToIdType(this->getNumberOfComponents()),stream); } /*! @@ -3509,11 +3544,11 @@ struct NotInRange this->checkAllocated(); if(this->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayInt::switchOnTupleEqualTo : number of components of this should be equal to one !"); - int nbOfTuples(this->getNumberOfTuples()); - if(nbOfTuples!=(int)vec.size()) + std::size_t nbOfTuples(this->getNumberOfTuples()); + if(nbOfTuples!=vec.size()) throw INTERP_KERNEL::Exception("DataArrayInt::switchOnTupleEqualTo : number of tuples of this should be equal to size of input vector of bool !"); const T *pt(this->begin()); - for(int i=0;icheckAllocated(); if(this->getNumberOfComponents()!=1 || other.getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayInt::buildPermutationArr : 'this' and 'other' have to have exactly ONE component !"); - std::size_t nbTuple(this->getNumberOfTuples()); + mcIdType nbTuple=ToIdType(this->getNumberOfTuples()); other.checkAllocated(); - if(nbTuple!=other.getNumberOfTuples()) + if(nbTuple!=ToIdType(other.getNumberOfTuples())) throw INTERP_KERNEL::Exception("DataArrayInt::buildPermutationArr : 'this' and 'other' must have the same number of tuple !"); MCAuto ret(DataArrayIdType::New()); ret->alloc(nbTuple,1); ret->fillWithValue(-1); const T *pt(this->begin()); - std::map mm; - for(std::size_t i=0;i mm; + for(mcIdType i=0;igetPointer()); - for(std::size_t i=0;i::const_iterator it=mm.find(pt[i]); + std::map::const_iterator it=mm.find(ToIdType(pt[i])); if(it==mm.end()) { std::ostringstream oss; oss << "DataArrayInt::buildPermutationArr : Arrays mismatch : element (" << pt[i] << ") in 'other' not findable in 'this' !"; @@ -3616,19 +3651,19 @@ struct NotInRange if(this->getNumberOfComponents()!=1 || partOfThis.getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayInt::indicesOfSubPart : this and input array must be one component array !"); this->checkAllocated(); partOfThis.checkAllocated(); - std::size_t thisNbTuples(this->getNumberOfTuples()),nbTuples(partOfThis.getNumberOfTuples()); + mcIdType thisNbTuples=ToIdType(this->getNumberOfTuples()),nbTuples=ToIdType(partOfThis.getNumberOfTuples()); const T *thisPt(this->begin()),*pt(partOfThis.begin()); MCAuto ret(DataArrayIdType::New()); ret->alloc(nbTuples,1); mcIdType *retPt(ret->getPointer()); - std::map m; - for(std::size_t i=0;i m; + for(mcIdType i=0;i::const_iterator it(m.find(*pt)); + std::map::const_iterator it(m.find(ToIdType(*pt))); if(it!=m.end()) *retPt=(*it).second; else @@ -3764,28 +3799,29 @@ struct NotInRange int DataArrayDiscrete::getHashCode() const { this->checkAllocated(); - std::size_t nbOfElems(this->getNbOfElems()); - int ret=nbOfElems*65536; - int delta=3; + mcIdType nbOfElems=ToIdType(this->getNbOfElems()); + mcIdType ret=nbOfElems*65536; + mcIdType delta=3; if(nbOfElems>48) delta=nbOfElems/8; T ret0(0); const T *pt(this->begin()); - for(std::size_t i=0;i void DataArrayDiscrete::reprCppStream(const std::string& varName, std::ostream& stream) const { - std::size_t nbTuples(this->getNumberOfTuples()),nbComp(this->getNumberOfComponents()); + mcIdType nbTuples=ToIdType(this->getNumberOfTuples()); + mcIdType nbComp=ToIdType(this->getNumberOfComponents()); const T *data(this->getConstPointer()); stream << Traits::ArrayTypeName << " *" << varName << "=" << Traits::ArrayTypeName << "::New();" << std::endl; if(nbTuples*nbComp>=1) { stream << "const int " << varName << "Data[" << nbTuples*nbComp << "]={"; - std::copy(data,data+nbTuples*nbComp-1,std::ostream_iterator(stream,",")); + std::copy(data,data+nbTuples*nbComp-1,std::ostream_iterator(stream,",")); stream << data[nbTuples*nbComp-1] << "};" << std::endl; stream << varName << "->useArray(" << varName << "Data,false,CPP_DEALLOC," << nbTuples << "," << nbComp << ");" << std::endl; } @@ -3826,12 +3862,12 @@ struct NotInRange std::ostringstream oss2; oss2 << "["; std::string oss2Str(oss2.str()); bool isFinished=true; - for(int i=0;i1) { oss2 << "("; - for(int j=0;j tmp(new char[this->getNbOfElems()]); - std::copy(this->begin(),this->end(),(char *)tmp); + copyCast(this->begin(),this->end(),(char *)tmp); byteArr->insertAtTheEnd((char *)tmp,(char *)tmp+this->getNbOfElems()); byteArr->insertAtTheEnd(SPACE,SPACE+4); } else if(std::string(type)=="UInt8") { INTERP_KERNEL::AutoPtr tmp(new unsigned char[this->getNbOfElems()]); - std::copy(this->begin(),this->end(),(unsigned char *)tmp); + copyCast(this->begin(),this->end(),(unsigned char *)tmp); byteArr->insertAtTheEnd((unsigned char *)tmp,(unsigned char *)tmp+this->getNbOfElems()); byteArr->insertAtTheEnd(SPACE,SPACE+4); } @@ -3894,7 +3930,7 @@ struct NotInRange else { ofs << " RangeMin=\"" << this->getMinValueInArray() << "\" RangeMax=\"" << this->getMaxValueInArray() << "\" format=\"ascii\">\n" << idt; - std::copy(this->begin(),this->end(),std::ostream_iterator(ofs," ")); + std::copy(this->begin(),this->end(),std::ostream_iterator(ofs," ")); } ofs << std::endl << idt << "\n"; } @@ -3918,7 +3954,8 @@ struct NotInRange this->checkAllocated(); if(this->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("Call transformWithIndArr method on DataArrayInt with only one component, you can call 'rearrange' method before !"); - std::size_t nbElemsIn(std::distance(indArrBg,indArrEnd)),nbOfTuples(this->getNumberOfTuples()); + mcIdType nbElemsIn=ToIdType(std::distance(indArrBg,indArrEnd)); + std::size_t nbOfTuples(this->getNumberOfTuples()); T *pt(this->getPointer()); for(std::size_t i=0;i48) delta=nbOfElems/8; int ret0=0; const char *pt=begin(); for(std::size_t i=0;icheckAllocated(); - int nbOfTuples=getNumberOfTuples(); - if(nbOfTuples!=other->getNumberOfTuples()) + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); + if(nbOfTuples!=ToIdType(other->getNumberOfTuples())) throw INTERP_KERNEL::Exception("DataArrayChar::meldWith : mismatch of number of tuples !"); - int nbOfComp1=getNumberOfComponents(); - int nbOfComp2=other->getNumberOfComponents(); + mcIdType nbOfComp1=ToIdType(getNumberOfComponents()); + mcIdType nbOfComp2=ToIdType(other->getNumberOfComponents()); char *newArr=(char *)malloc(nbOfTuples*(nbOfComp1+nbOfComp2)*sizeof(char)); char *w=newArr; const char *inp1=getConstPointer(); @@ -208,7 +208,7 @@ DataArrayInt *DataArrayChar::findIdsEqual(char val) const throw INTERP_KERNEL::Exception("DataArrayChar::findIdsEqual : the array must have only one component, you can call 'rearrange' method before !"); const char *cptr=getConstPointer(); MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); - int nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); for(int i=0;ipushBackSilent(i); @@ -231,7 +231,7 @@ DataArrayInt *DataArrayChar::findIdsNotEqual(char val) const throw INTERP_KERNEL::Exception("DataArrayChar::findIdsNotEqual : the array must have only one component, you can call 'rearrange' method before !"); const char *cptr=getConstPointer(); MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); - int nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); for(int i=0;ipushBackSilent(i); @@ -247,14 +247,14 @@ DataArrayInt *DataArrayChar::findIdsNotEqual(char val) const int DataArrayChar::findIdSequence(const std::vector& vals) const { checkAllocated(); - int nbOfCompo=getNumberOfComponents(); + mcIdType nbOfCompo=ToIdType(getNumberOfComponents()); if(nbOfCompo!=1) throw INTERP_KERNEL::Exception("DataArrayChar::findIdSequence : works only for DataArrayChar instance with one component !"); const char *cptr=getConstPointer(); std::size_t nbOfVals=getNbOfElems(); const char *loc=std::search(cptr,cptr+nbOfVals,vals.begin(),vals.end()); if(loc!=cptr+nbOfVals) - return std::distance(cptr,loc); + return ToIdType(std::distance(cptr,loc)); return -1; } @@ -273,7 +273,7 @@ int DataArrayChar::findIdSequence(const std::vector& vals) const int DataArrayChar::findIdFirstEqualTuple(const std::vector& tupl) const { checkAllocated(); - int nbOfCompo=getNumberOfComponents(); + mcIdType nbOfCompo=ToIdType(getNumberOfComponents()); if(nbOfCompo==0) throw INTERP_KERNEL::Exception("DataArrayChar::findIdFirstEqualTuple : 0 components in 'this' !"); if(nbOfCompo!=(int)tupl.size()) @@ -291,7 +291,7 @@ int DataArrayChar::findIdFirstEqualTuple(const std::vector& tupl) const if(std::distance(cptr,work)%nbOfCompo!=0) work++; else - return std::distance(cptr,work)/nbOfCompo; + return ToIdType(std::distance(cptr,work))/nbOfCompo; } } return -1; @@ -346,10 +346,10 @@ int DataArrayChar::findIdFirstEqual(char value) const if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayChar::presenceOfValue : the array must have only one component, you can call 'rearrange' method before !"); const char *cptr=getConstPointer(); - int nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); const char *ret=std::find(cptr,cptr+nbOfTuples,value); if(ret!=cptr+nbOfTuples) - return std::distance(cptr,ret); + return ToIdType(std::distance(cptr,ret)); return -1; } @@ -366,10 +366,10 @@ int DataArrayChar::findIdFirstEqual(const std::vector& vals) const throw INTERP_KERNEL::Exception("DataArrayInt::presenceOfValue : the array must have only one component, you can call 'rearrange' method before !"); std::set vals2(vals.begin(),vals.end()); const char *cptr=getConstPointer(); - int nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); for(const char *w=cptr;w!=cptr+nbOfTuples;w++) if(vals2.find(*w)!=vals2.end()) - return std::distance(cptr,w); + return ToIdType(std::distance(cptr,w)); return -1; } @@ -389,7 +389,7 @@ DataArrayInt *DataArrayChar::findIdsInRange(char vmin, char vmax) const throw INTERP_KERNEL::Exception("DataArrayChar::findIdsInRange : this must have exactly one component !"); const char *cptr=getConstPointer(); MCAuto ret=DataArrayInt::New(); ret->alloc(0,1); - int nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); for(int i=0;i=vmin && *cptrpushBackSilent(i); @@ -444,7 +444,7 @@ DataArrayChar *DataArrayChar::Aggregate(const std::vector throw INTERP_KERNEL::Exception("DataArrayChar::Aggregate : input list must be NON EMPTY !"); std::vector::const_iterator it=a.begin(); std::size_t nbOfComp((*it)->getNumberOfComponents()); - int nbt=(*it++)->getNumberOfTuples(); + std::size_t nbt=(*it++)->getNumberOfTuples(); for(int i=1;it!=a.end();it++,i++) { if((*it)->getNumberOfComponents()!=nbOfComp) @@ -510,23 +510,23 @@ DataArrayChar *DataArrayChar::Meld(const std::vector& arr for(it=a.begin();it!=a.end();it++) (*it)->checkAllocated(); it=a.begin(); - int nbOfTuples=(*it)->getNumberOfTuples(); + std::size_t nbOfTuples=(*it)->getNumberOfTuples(); std::vector nbc(a.size()); std::vector pts(a.size()); - nbc[0]=(*it)->getNumberOfComponents(); + nbc[0]=ToIdType((*it)->getNumberOfComponents()); pts[0]=(*it++)->getConstPointer(); - for(int i=1;it!=a.end();it++,i++) + for(std::size_t i=1;it!=a.end();it++,i++) { if(nbOfTuples!=(*it)->getNumberOfTuples()) throw INTERP_KERNEL::Exception("DataArrayChar::meld : mismatch of number of tuples !"); - nbc[i]=(*it)->getNumberOfComponents(); + nbc[i]=ToIdType((*it)->getNumberOfComponents()); pts[i]=(*it)->getConstPointer(); } int totalNbOfComp=std::accumulate(nbc.begin(),nbc.end(),0); DataArrayChar *ret=a[0]->buildEmptySpecializedDAChar(); ret->alloc(nbOfTuples,totalNbOfComp); char *retPtr=ret->getPointer(); - for(int i=0;i=1) @@ -668,10 +668,10 @@ void DataArrayByte::reprQuickOverview(std::ostream& stream) const stream << "DataArrayByte C++ instance at " << this << ". "; if(isAllocated()) { - int nbOfCompo=(int)_info_on_compo.size(); + std::size_t nbOfCompo=_info_on_compo.size(); if(nbOfCompo>=1) { - int nbOfTuples=getNumberOfTuples(); + std::size_t nbOfTuples=getNumberOfTuples(); stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl; reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR); } @@ -685,8 +685,8 @@ void DataArrayByte::reprQuickOverview(std::ostream& stream) const void DataArrayByte::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const { const char *data=begin(); - int nbOfTuples=getNumberOfTuples(); - int nbOfCompo=(int)_info_on_compo.size(); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); + mcIdType nbOfCompo=ToIdType(_info_on_compo.size()); std::ostringstream oss2; oss2 << "["; std::string oss2Str(oss2.str()); bool isFinished=true; @@ -735,7 +735,7 @@ std::vector DataArrayByte::toVectorOfBool() const checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayByte::toVectorOfBool : this method can be used only if this has one component !"); - int nbt(getNumberOfTuples()); + mcIdType nbt=ToIdType(getNumberOfTuples()); std::vector ret(nbt,false); const char *pt(begin()); for(int i=0;iincrRef(); if(_da->isAllocated()) { - _nb_comp=da->getNumberOfComponents(); - _nb_tuple=da->getNumberOfTuples(); + _nb_comp=ToIdType(da->getNumberOfComponents()); + _nb_tuple=ToIdType(da->getNumberOfTuples()); _pt=da->getPointer(); } } @@ -974,11 +974,11 @@ void DataArrayAsciiChar::reprZipStream(std::ostream& stream) const void DataArrayAsciiChar::reprWithoutNameStream(std::ostream& stream) const { DataArray::reprWithoutNameStream(stream); - if(_mem.reprHeader(getNumberOfComponents(),stream)) + if(_mem.reprHeader(ToIdType(getNumberOfComponents()),stream)) { const char *data=begin(); - int nbOfTuples=getNumberOfTuples(); - int nbCompo=getNumberOfComponents(); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); + mcIdType nbCompo=ToIdType(getNumberOfComponents()); for(int i=0;i=1) @@ -1019,10 +1019,10 @@ void DataArrayAsciiChar::reprQuickOverview(std::ostream& stream) const stream << "DataArrayAsciiChar C++ instance at " << this << ". "; if(isAllocated()) { - int nbOfCompo=(int)_info_on_compo.size(); + std::size_t nbOfCompo=_info_on_compo.size(); if(nbOfCompo>=1) { - int nbOfTuples=getNumberOfTuples(); + std::size_t nbOfTuples=getNumberOfTuples(); stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl; reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR); } @@ -1036,8 +1036,8 @@ void DataArrayAsciiChar::reprQuickOverview(std::ostream& stream) const void DataArrayAsciiChar::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const { const char *data=begin(); - int nbOfTuples=getNumberOfTuples(); - int nbOfCompo=(int)_info_on_compo.size(); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); + mcIdType nbOfCompo=ToIdType(_info_on_compo.size()); std::ostringstream oss2; oss2 << "["; std::string oss2Str(oss2.str()); bool isFinished=true; @@ -1091,8 +1091,8 @@ DataArrayAsciiCharIterator::DataArrayAsciiCharIterator(DataArrayAsciiChar *da):_ _da->incrRef(); if(_da->isAllocated()) { - _nb_comp=da->getNumberOfComponents(); - _nb_tuple=da->getNumberOfTuples(); + _nb_comp=ToIdType(da->getNumberOfComponents()); + _nb_tuple=ToIdType(da->getNumberOfTuples()); _pt=da->getPointer(); } } diff --git a/src/MEDCoupling/MEDCouplingMemArrayFloat.cxx b/src/MEDCoupling/MEDCouplingMemArrayFloat.cxx index fd5441f85..58306751e 100644 --- a/src/MEDCoupling/MEDCouplingMemArrayFloat.cxx +++ b/src/MEDCoupling/MEDCouplingMemArrayFloat.cxx @@ -40,7 +40,7 @@ DataArrayFloat *DataArrayFloat::deepCopy() const void DataArrayFloat::reprCppStream(const std::string& varName, std::ostream& stream) const { - int nbTuples(getNumberOfTuples()),nbComp(getNumberOfComponents()); + mcIdType nbTuples=ToIdType(getNumberOfTuples()),nbComp=ToIdType(getNumberOfComponents()); const float *data(begin()); stream.precision(7); stream << "DataArrayFloat *" << varName << "=DataArrayFloat::New();" << std::endl; @@ -65,7 +65,7 @@ void DataArrayFloat::reprQuickOverview(std::ostream& stream) const int nbOfCompo=(int)_info_on_compo.size(); if(nbOfCompo>=1) { - int nbOfTuples=getNumberOfTuples(); + std::size_t nbOfTuples=getNumberOfTuples(); stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl; reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR); } @@ -79,8 +79,8 @@ void DataArrayFloat::reprQuickOverview(std::ostream& stream) const void DataArrayFloat::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const { const float *data(begin()); - int nbOfTuples(getNumberOfTuples()); - int nbOfCompo=(int)_info_on_compo.size(); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); + mcIdType nbOfCompo=ToIdType(_info_on_compo.size()); std::ostringstream oss2; oss2 << "["; oss2.precision(7); std::string oss2Str(oss2.str()); diff --git a/src/MEDCoupling/MEDCouplingMesh.cxx b/src/MEDCoupling/MEDCouplingMesh.cxx old mode 100644 new mode 100755 index af878faa5..3ef945c25 --- a/src/MEDCoupling/MEDCouplingMesh.cxx +++ b/src/MEDCoupling/MEDCouplingMesh.cxx @@ -203,7 +203,7 @@ DataArrayInt *MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds(const int *partB { std::vector crest; std::set p(partBg,partEnd); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); for(int i=0;i conn; @@ -261,7 +261,7 @@ bool MEDCouplingMesh::areCompatibleForMerge(const MEDCouplingMesh *other) const */ MEDCouplingMesh *MEDCouplingMesh::buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const { - if(beginCellIds==0 && endCellIds==getNumberOfCells() && stepCellIds==1) + if(beginCellIds==0 && endCellIds==ToIdType(getNumberOfCells()) && stepCellIds==1) { MEDCouplingMesh *ret(const_cast(this)); ret->incrRef(); @@ -658,7 +658,7 @@ void MEDCouplingMesh::getCellsContainingPoints(const double *pos, int nbOfPoints std::vector ret; getCellsContainingPoint(work,eps,ret); elts->insertAtTheEnd(ret.begin(),ret.end()); - eltsIndexPtr[i+1]=elts->getNumberOfTuples(); + eltsIndexPtr[i+1]=ToIdType(elts->getNumberOfTuples()); } } diff --git a/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.hxx b/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.hxx index 3b7584558..759e36d9d 100644 --- a/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.hxx +++ b/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.hxx @@ -42,8 +42,8 @@ public: //INTERP_KERNEL::NormalizedCellType getTypeOfElement(int eltId) const; //int getNumberOfNodesOfElement(int eltId) const; //int getNumberOfNodes() const; - unsigned long getNumberOfElements() const; - unsigned long nbCellsAlongAxis(int axis) const; + std::size_t getNumberOfElements() const; + std::size_t nbCellsAlongAxis(int axis) const; const double * getCoordsAlongAxis(int axis) const; ~MEDCouplingNormalizedCartesianMesh(); private: diff --git a/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.txx b/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.txx index 72412782c..2dfc27791 100644 --- a/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.txx +++ b/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.txx @@ -39,13 +39,13 @@ MEDCouplingNormalizedCartesianMesh::~MEDCouplingNormalizedCartesianMes } template -unsigned long MEDCouplingNormalizedCartesianMesh::getNumberOfElements() const +std::size_t MEDCouplingNormalizedCartesianMesh::getNumberOfElements() const { return _mesh->getNumberOfCells(); } template -unsigned long MEDCouplingNormalizedCartesianMesh::nbCellsAlongAxis(int axis) const +std::size_t MEDCouplingNormalizedCartesianMesh::nbCellsAlongAxis(int axis) const { return _mesh->getCoordsAt(axis)->getNumberOfTuples() - 1; } diff --git a/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.hxx b/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.hxx index 919ae7b34..9a9bd6325 100644 --- a/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.hxx +++ b/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.hxx @@ -22,6 +22,7 @@ #define __PARAMEDMEM_MEDCOUPLINGNORMALIZEDUNSTRUCTUREDMESH_HXX__ #include "NormalizedUnstructuredMesh.hxx" +#include "MCType.hxx" namespace MEDCoupling { diff --git a/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx b/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx index 10d31c6a6..7ca18cb07 100644 --- a/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx +++ b/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx @@ -48,7 +48,7 @@ void MEDCouplingNormalizedUnstructuredMesh::getBoundingBox(dou } const MEDCoupling::DataArrayDouble *array=_mesh->getCoords(); const double *ptr=array->getConstPointer(); - int nbOfPts=array->getNbOfElems()/SPACEDIM; + MEDCoupling::mcIdType nbOfPts=MEDCoupling::ToIdType(array->getNbOfElems())/SPACEDIM; for(int j=0;j::getNumberOfNodesOfE template int MEDCouplingNormalizedUnstructuredMesh::getNumberOfElements() const { - return _mesh->getNumberOfCells(); + return MEDCoupling::ToIdType(_mesh->getNumberOfCells()); } template @@ -129,8 +129,8 @@ void MEDCouplingNormalizedUnstructuredMesh::prepare() const MEDCoupling::MEDCouplingUMesh *m1(dynamic_cast(_mesh)); if(m1) { - int nbOfCell=m1->getNumberOfCells(); - int initialConnSize=m1->getNodalConnectivity()->getNbOfElems(); + MEDCoupling::mcIdType nbOfCell=MEDCoupling::ToIdType(m1->getNumberOfCells()); + MEDCoupling::mcIdType initialConnSize=MEDCoupling::ToIdType(m1->getNodalConnectivity()->getNbOfElems()); _conn_for_interp=new int[initialConnSize-nbOfCell]; _conn_index_for_interp=new int[nbOfCell+1]; _conn_index_for_interp[0]=0; @@ -152,7 +152,7 @@ void MEDCouplingNormalizedUnstructuredMesh::prepare() const MEDCoupling::MEDCoupling1DGTUMesh *m2(dynamic_cast(_mesh)); if(m2) { - int nbOfCell(m2->getNumberOfCells()); + MEDCoupling::mcIdType nbOfCell=MEDCoupling::ToIdType(m2->getNumberOfCells()); _conn_index_for_interp=new int[nbOfCell+1]; const int *conni(m2->getNodalConnectivityIndex()->begin()); std::copy(conni,conni+nbOfCell+1,_conn_index_for_interp); @@ -163,7 +163,7 @@ void MEDCouplingNormalizedUnstructuredMesh::prepare() const MEDCoupling::MEDCoupling1SGTUMesh *m3(dynamic_cast(_mesh)); if(m3) { - int nbOfCell(m3->getNumberOfCells()),nbNodesPerCell(m3->getNumberOfNodesPerCell()); + MEDCoupling::mcIdType nbOfCell=MEDCoupling::ToIdType(m3->getNumberOfCells()),nbNodesPerCell(m3->getNumberOfNodesPerCell()); _conn_index_for_interp=new int[nbOfCell+1]; _conn_index_for_interp[0]=0; int *work(_conn_index_for_interp); for(int i=0;igetNumberOfTuples(); + return ToIdType(_arr->getNumberOfTuples()); } PartDefinition *DataArrayPartDefinition::operator+(const PartDefinition& other) const diff --git a/src/MEDCoupling/MEDCouplingPointSet.cxx b/src/MEDCoupling/MEDCouplingPointSet.cxx old mode 100644 new mode 100755 index c9c384d78..d8762c9cd --- a/src/MEDCoupling/MEDCouplingPointSet.cxx +++ b/src/MEDCoupling/MEDCouplingPointSet.cxx @@ -55,7 +55,7 @@ MEDCouplingPointSet::~MEDCouplingPointSet() int MEDCouplingPointSet::getNumberOfNodes() const { if(_coords) - return _coords->getNumberOfTuples(); + return ToIdType(_coords->getNumberOfTuples()); else throw INTERP_KERNEL::Exception("Unable to get number of nodes because no coordinates specified !"); } @@ -63,7 +63,7 @@ int MEDCouplingPointSet::getNumberOfNodes() const int MEDCouplingPointSet::getSpaceDimension() const { if(_coords) - return _coords->getNumberOfComponents(); + return ToIdType(_coords->getNumberOfComponents()); else throw INTERP_KERNEL::Exception("Unable to get space dimension because no coordinates specified !"); } @@ -501,7 +501,7 @@ double MEDCouplingPointSet::getCaracteristicDimension() const if(!_coords) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getCaracteristicDimension : Coordinates not set !"); const double *coords=_coords->getConstPointer(); - int nbOfValues=_coords->getNbOfElems(); + mcIdType nbOfValues=ToIdType(_coords->getNbOfElems()); return std::abs(*std::max_element(coords,coords+nbOfValues,MEDCouplingCompAbs())); } @@ -1094,7 +1094,7 @@ MEDCouplingMesh *MEDCouplingPointSet::buildPartAndReduceNodes(const int *start, */ MEDCouplingMesh *MEDCouplingPointSet::buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const { - if(beginCellIds==0 && endCellIds==getNumberOfCells() && stepCellIds==1) + if(beginCellIds==0 && endCellIds==ToIdType(getNumberOfCells()) && stepCellIds==1) { MEDCouplingMesh *ret(const_cast(this)); ret->incrRef(); @@ -1358,7 +1358,7 @@ DataArrayInt *MEDCouplingPointSet::zipConnectivityTraducer(int compType, int sta findCommonCells(compType,startCellId,commonCells,commonCellsI); MCAuto commonCellsTmp(commonCells),commonCellsITmp(commonCellsI); int newNbOfCells=-1; - MCAuto ret=DataArrayInt::ConvertIndexArrayToO2N(getNumberOfCells(),commonCells->begin(),commonCellsI->begin(), + MCAuto ret=DataArrayInt::ConvertIndexArrayToO2N(ToIdType(getNumberOfCells()),commonCells->begin(),commonCellsI->begin(), commonCellsI->end(),newNbOfCells); MCAuto ret2=ret->invertArrayO2N2N2O(newNbOfCells); MCAuto self=buildPartOfMySelf(ret2->begin(),ret2->end(),true); @@ -1435,10 +1435,10 @@ void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int da=m->mergeNodes(prec,areNodesMerged,newNbOfNodes); // da=m->zipConnectivityTraducer(cellCompPol); - int nbCells=getNumberOfCells(); - if (nbCells != other->getNumberOfCells()) + mcIdType nbCells=ToIdType(getNumberOfCells()); + if (nbCells != ToIdType(other->getNumberOfCells())) throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some cells in other are not in this !"); - int dan(da->getNumberOfTuples()); + mcIdType dan=ToIdType(da->getNumberOfTuples()); if (dan) { MCAuto da1(DataArrayInt::New()),da2(DataArrayInt::New()); @@ -1449,9 +1449,9 @@ void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int if (!da1->isEqualWithoutConsideringStr(*da2)) throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some cells in other are not in this !"); } - MCAuto cellCor2=da->selectByTupleIdSafeSlice(nbCells,da->getNbOfElems(),1); - nodeCor=nodeCor2->isIota(nodeCor2->getNumberOfTuples())?0:nodeCor2.retn(); - cellCor=cellCor2->isIota(cellCor2->getNumberOfTuples())?0:cellCor2.retn(); + MCAuto cellCor2=da->selectByTupleIdSafeSlice(nbCells,ToIdType(da->getNbOfElems()),1); + nodeCor=nodeCor2->isIota(ToIdType(nodeCor2->getNumberOfTuples()))?0:nodeCor2.retn(); + cellCor=cellCor2->isIota(ToIdType(cellCor2->getNumberOfTuples()))?0:cellCor2.retn(); } /*! @@ -1494,8 +1494,8 @@ void MEDCouplingPointSet::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh { throw INTERP_KERNEL::Exception("checkDeepEquivalOnSameNodesWith : some cells in other are not in this !"); } - MCAuto cellCor2=da->selectByTupleIdSafeSlice(getNumberOfCells(),da->getNbOfElems(),1); - cellCor=cellCor2->isIota(cellCor2->getNumberOfTuples())?0:cellCor2.retn(); + MCAuto cellCor2=da->selectByTupleIdSafeSlice(ToIdType(getNumberOfCells()),ToIdType(da->getNbOfElems()),1); + cellCor=cellCor2->isIota(ToIdType(cellCor2->getNumberOfTuples()))?0:cellCor2.retn(); } void MEDCouplingPointSet::checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const @@ -1505,7 +1505,7 @@ void MEDCouplingPointSet::checkFastEquivalWith(const MEDCouplingMesh *other, dou const MEDCouplingPointSet *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::checkFastEquivalWith : fails because other is not a pointset mesh !"); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); if(nbOfCells<1) return ; bool status=true; diff --git a/src/MEDCoupling/MEDCouplingRemapper.cxx b/src/MEDCoupling/MEDCouplingRemapper.cxx old mode 100644 new mode 100755 index 5b4d4cc9a..7cf6cf73b --- a/src/MEDCoupling/MEDCouplingRemapper.cxx +++ b/src/MEDCoupling/MEDCouplingRemapper.cxx @@ -104,7 +104,7 @@ void MEDCouplingRemapper::setCrudeMatrix(const MEDCouplingMesh *srcMesh, const M void MEDCouplingRemapper::setCrudeMatrixEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target, const std::vector >& m) { restartUsing(src,target); - if(m.size()!=target->getNumberOfTuplesExpected()) + if(ToIdType(m.size())!=target->getNumberOfTuplesExpected()) { std::ostringstream oss; oss << "MEDCouplingRemapper::setMatrixEx : input matrix has " << m.size() << " rows whereas there are " << target->getNumberOfTuplesExpected() << " expected !"; throw INTERP_KERNEL::Exception(oss.str()); @@ -245,7 +245,7 @@ void MEDCouplingRemapper::reverseTransfer(MEDCouplingFieldDouble *srcField, cons throw INTERP_KERNEL::Exception(oss.str().c_str()); } DataArrayDouble *array(srcField->getArray()); - int trgNbOfCompo=targetField->getNumberOfComponents(); + mcIdType trgNbOfCompo=ToIdType(targetField->getNumberOfComponents()); if(array) { srcField->checkConsistencyLight(); @@ -484,7 +484,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() std::string revMethod(BuildMethodFrom(trgMeth,srcMeth)); nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,revMethod); ReverseMatrix(matrixTmp,nbCols,_matrix); - nbCols=matrixTmp.size(); + nbCols=ToIdType(matrixTmp.size()); } else if(srcMeshDim==2 && trgMeshDim==1 && srcSpaceDim==2) { @@ -504,7 +504,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() std::string revMethod(BuildMethodFrom(trgMeth,srcMeth)); nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,revMethod); ReverseMatrix(matrixTmp,nbCols,_matrix); - nbCols=matrixTmp.size(); + nbCols=ToIdType(matrixTmp.size()); INTERP_KERNEL::Interpolation2D1D::DuplicateFacesType duplicateFaces=interpolation.retrieveDuplicateFaces(); if(!duplicateFaces.empty()) { @@ -529,7 +529,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() std::string revMethod(BuildMethodFrom(trgMeth,srcMeth)); nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,revMethod); ReverseMatrix(matrixTmp,nbCols,_matrix); - nbCols=matrixTmp.size(); + nbCols=ToIdType(matrixTmp.size()); } else { @@ -591,7 +591,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() std::string revMethod(BuildMethodFrom(trgMeth,srcMeth)); nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,revMethod); ReverseMatrix(matrixTmp,nbCols,_matrix); - nbCols=matrixTmp.size(); + nbCols=ToIdType(matrixTmp.size()); INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType duplicateFaces=interpolation.retrieveDuplicateFaces(); if(!duplicateFaces.empty()) { @@ -744,7 +744,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUC() default: throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareInterpKernelOnlyUC : only dimension 1 2 or 3 supported !"); } - ReverseMatrix(res,target_mesh->getNumberOfCells(),_matrix); + ReverseMatrix(res,ToIdType(target_mesh->getNumberOfCells()),_matrix); nullifiedTinyCoeffInCrudeMatrixAbs(0.); // _deno_multiply.clear(); @@ -868,7 +868,7 @@ int MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss() throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss : The intersection type is not supported ! Only PointLocator is supported for Gauss->Gauss interpolation ! Please invoke setIntersectionType(PointLocator) on the MEDCouplingRemapper instance !"); MCAuto trgLoc=_target_ft->getLocalizationOfDiscr(); const double *trgLocPtr=trgLoc->begin(); - int trgSpaceDim=trgLoc->getNumberOfComponents(); + mcIdType trgSpaceDim=ToIdType(trgLoc->getNumberOfComponents()); MCAuto srcOffsetArr=_src_ft->getDiscretization()->getOffsetArr(_src_ft->getMesh()); if(trgSpaceDim!=_src_ft->getMesh()->getSpaceDimension()) { @@ -881,7 +881,7 @@ int MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss() MCAuto srcLoc=_src_ft->getLocalizationOfDiscr(); const double *srcLocPtr=srcLoc->begin(); MCAuto eltsArr,eltsIndexArr; - int trgNbOfGaussPts=trgLoc->getNumberOfTuples(); + mcIdType trgNbOfGaussPts=ToIdType(trgLoc->getNumberOfTuples()); _matrix.resize(trgNbOfGaussPts); _src_ft->getMesh()->getCellsContainingPointsLinearPartOnlyOnNonDynType(trgLoc->begin(),trgNbOfGaussPts,getPrecision(),eltsArr,eltsIndexArr); const int *elts(eltsArr->begin()),*eltsIndex(eltsIndexArr->begin()); @@ -904,7 +904,7 @@ int MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss() } _matrix[*trgId][srcEntry]=1.; } - if(ids0->getNumberOfTuples()!=trgNbOfGaussPts) + if(ToIdType(ids0->getNumberOfTuples())!=trgNbOfGaussPts) { MCAuto orphanTrgIds=nbOfSrcCellsShTrgPts->findIdsEqual(0); MCAuto orphanTrg=trgLoc->selectByTupleId(orphanTrgIds->begin(),orphanTrgIds->end()); @@ -1074,11 +1074,11 @@ void MEDCouplingRemapper::transferUnderground(const MEDCouplingFieldDouble *srcF throw INTERP_KERNEL::Exception(oss.str().c_str()); } DataArrayDouble *array(targetField->getArray()); - int srcNbOfCompo(srcField->getNumberOfComponents()); + mcIdType srcNbOfCompo=ToIdType(srcField->getNumberOfComponents()); if(array) { targetField->checkConsistencyLight(); - if(srcNbOfCompo!=targetField->getNumberOfComponents()) + if(srcNbOfCompo!=ToIdType(targetField->getNumberOfComponents())) throw INTERP_KERNEL::Exception("Number of components mismatch !"); } else @@ -1108,7 +1108,7 @@ void MEDCouplingRemapper::computeDeno(NatureOfField nat, const MEDCouplingFieldD void MEDCouplingRemapper::computeDenoFromScratch(NatureOfField nat, const MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *trgField) { _nature_of_deno=nat; - _time_deno_update=getTimeOfThis(); + mcIdType _time_deno_update=ToIdType(getTimeOfThis()); switch(_nature_of_deno) { case IntensiveMaximum: @@ -1288,8 +1288,8 @@ void MEDCouplingRemapper::buildFinalInterpolationMatrixByConvolution(const std:: const int *corrCellIdSrc, int nbOf2DCellsSrc, int nbOf1DCellsSrc, const int *corrCellIdTrg) { - int nbOf2DCellsTrg=m2D.size(); - int nbOf1DCellsTrg=m1D.size(); + mcIdType nbOf2DCellsTrg=ToIdType(m2D.size()); + mcIdType nbOf1DCellsTrg=ToIdType(m1D.size()); int nbOf3DCellsTrg=nbOf2DCellsTrg*nbOf1DCellsTrg; _matrix.resize(nbOf3DCellsTrg); int id2R=0; diff --git a/src/MEDCoupling/MEDCouplingSkyLineArray.cxx b/src/MEDCoupling/MEDCouplingSkyLineArray.cxx old mode 100644 new mode 100755 index d4a8c91b0..645ed8b69 --- a/src/MEDCoupling/MEDCouplingSkyLineArray.cxx +++ b/src/MEDCoupling/MEDCouplingSkyLineArray.cxx @@ -106,14 +106,14 @@ MEDCouplingSkyLineArray * MEDCouplingSkyLineArray::BuildFromPolyhedronConn( cons while (w2 != cP+end) { copy(w, w2, work); - int d = distance(w, w2); + int d = ToIdType(distance(w, w2)); cnt += d; work +=d; idx.push_back(cnt); cnt2++; w = w2+1; // skip the -1 w2 = find(w, cP+end, -1); } copy(w, cP+end, work); - cnt += distance(w, cP+end); + cnt += ToIdType(distance(w, cP+end)); idx.push_back(cnt); cnt2++; superIdx.push_back(cnt2); } @@ -143,7 +143,7 @@ void MEDCouplingSkyLineArray::convertToPolyhedronConn( MCAuto& c, cI->alloc(_super_index->getNbOfElems(),1); // same number of super packs as number of cells int * cIVecP(cI->getPointer()); MCAuto dsi = _index->deltaShiftIndex(); - int sz = dsi->accumulate(0) + dsi->getNbOfElems(); // think about it: one slot for the type, -1 at the end of each face of the cell + int sz = dsi->accumulate(0) + ToIdType(dsi->getNbOfElems()); // think about it: one slot for the type, -1 at the end of each face of the cell c->alloc(sz, 1); int * cVecP(c->getPointer()); @@ -266,7 +266,7 @@ std::string MEDCouplingSkyLineArray::simpleRepr() const { super_index->alloc(2,1); super_index->setIJSilent(0,0,0); - super_index->setIJSilent(1,0,_index->getNbOfElems()-1); + super_index->setIJSilent(1,0,ToIdType(_index->getNbOfElems())-1); } oss << " Nb of packs: " << getNumberOf() << std::endl; oss << " Nb of values: " << getLength() << std::endl; @@ -355,7 +355,7 @@ void MEDCouplingSkyLineArray::findPackIds(const std::vector & superPackIndi checkSuperIndex("findPackIds"); - int packSz = std::distance(packBg, packEnd); + mcIdType packSz = ToIdType(std::distance(packBg, packEnd)); if (!packSz) throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::findPackIds: void pack!"); @@ -397,7 +397,7 @@ void MEDCouplingSkyLineArray::deletePack(const int superIdx, const int idx) _values->reAlloc(_values->getNbOfElems() - (end-start)); // _index - int nt = _index->getNbOfElems(); + mcIdType nt = ToIdType(_index->getNbOfElems()); std::copy(iP+siP[superIdx]+idx+1, iP+nt, iP+siP[superIdx]+idx); _index->reAlloc(nt-1); iP = _index->getPointer(); // better not forget this ... for(int ii = siP[superIdx]+idx; ii < nt-1; ii++) @@ -416,7 +416,7 @@ void MEDCouplingSkyLineArray::deleteSimplePack(const int idx) const int start(iP[idx]), end(iP[idx+1]); // _values - int initValSz( _values->getNbOfElems() ); + mcIdType initValSz=ToIdType(_values->getNbOfElems()); int deltaSz( start-end ); // should be negative int *vP(_values->getPointer()); if (deltaSz < 0) @@ -427,7 +427,7 @@ void MEDCouplingSkyLineArray::deleteSimplePack(const int idx) else throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::deleteSimplePack"); // _index - int nt(_index->getNbOfElems()); + mcIdType nt=ToIdType(_index->getNbOfElems()); std::copy(iP+idx+1, iP+nt, iP+idx); for(int ii = idx; ii < nt-1; ii++) iP[ii] += deltaSz; @@ -449,7 +449,7 @@ void MEDCouplingSkyLineArray::replaceSimplePacks(const DataArrayInt* idx, const std::deque< std::set > valuesByIdx; int* vP(_values->getPointer()); int* iP(_index->getPointer()); - std::size_t nt ( _index->getNbOfElems() ); + mcIdType nt = ToIdType(_index->getNbOfElems()); for (int ii = 0; ii < nt-1; ii++) valuesByIdx.push_back(std::set(vP+iP[ii], vP+iP[ii+1])); @@ -465,7 +465,7 @@ void MEDCouplingSkyLineArray::replaceSimplePacks(const DataArrayInt* idx, const *iP = 0; for (std::deque< std::set >::const_iterator values=valuesByIdx.begin();values!=valuesByIdx.end();values++) { - valSz += (*values).size(); + valSz += ToIdType((*values).size()); *(++iP) = valSz; } _values->reAlloc(valSz); @@ -487,7 +487,7 @@ void MEDCouplingSkyLineArray::deleteSimplePacks(const DataArrayInt* idx) // _values int* iP(_index->getPointer()); - int initValSz = _values->getNbOfElems(); + mcIdType initValSz = ToIdType(_values->getNbOfElems()); int *vP(_values->getPointer()); int end_prec(0),start_prec(0); for(std::set::const_iterator ii=packsToDelete.begin();ii!=packsToDelete.end();ii++) @@ -503,7 +503,7 @@ void MEDCouplingSkyLineArray::deleteSimplePacks(const DataArrayInt* idx) _values->reAlloc(initValSz-(end_prec-start_prec)); // _index - int nt = _index->getNbOfElems(); + mcIdType nt = ToIdType(_index->getNbOfElems()); int offset = 0; end_prec = 0; start_prec = 0; @@ -541,7 +541,7 @@ void MEDCouplingSkyLineArray::pushBackPack(const int superIdx, const int * packB validSuperIndex("pushBackPack", superIdx); int *siP(_super_index->getPointer()), *iP(_index->getPointer()); - const int sz(distance(packBg, packEnd)); + const int sz(ToIdType(distance(packBg, packEnd))); // _values _values->reAlloc(_values->getNbOfElems()+sz); @@ -552,7 +552,7 @@ void MEDCouplingSkyLineArray::pushBackPack(const int superIdx, const int * packB copy(packBg, packEnd, vP+iP[siP[superIdx+1]]); // _index - int nt = _index->getNbOfElems(); + mcIdType nt = ToIdType(_index->getNbOfElems()); _index->reAlloc(nt+1); iP = _index->getPointer(); copy(iP+siP[superIdx+1]+1, iP+nt, iP+siP[superIdx+1]+2); iP[siP[superIdx+1]+1] = iP[siP[superIdx+1]] + sz; @@ -573,11 +573,11 @@ void MEDCouplingSkyLineArray::replaceSimplePack(const int idx, const int * packB validIndex("replaceSimplePack", idx); int * iP(_index->getPointer()); - int newSz = std::distance(packBg, packEnd); + mcIdType newSz = ToIdType(std::distance(packBg, packEnd)); const int start = iP[idx], end = iP[idx+1]; // _values - int initValSz = _values->getNbOfElems(); + mcIdType initValSz = ToIdType(_values->getNbOfElems()); int deltaSz = newSz-(end-start); // can be negative if (deltaSz) { @@ -607,11 +607,11 @@ void MEDCouplingSkyLineArray::replacePack(const int superIdx, const int idx, con validSuperIndexAndIndex("replacePack", superIdx, idx); int * siP(_super_index->getPointer()), *iP(_index->getPointer()); - int newSz = std::distance(packBg, packEnd); + mcIdType newSz = ToIdType(std::distance(packBg, packEnd)); const int start = iP[siP[superIdx]+idx], end = iP[siP[superIdx]+idx+1]; // _values - int initValSz = _values->getNbOfElems(); + mcIdType initValSz = ToIdType(_values->getNbOfElems()); int deltaSz = newSz-(end-start); // can be negative if (deltaSz) { diff --git a/src/MEDCoupling/MEDCouplingSkyLineArray.hxx b/src/MEDCoupling/MEDCouplingSkyLineArray.hxx index 665e7a870..203b27ea9 100644 --- a/src/MEDCoupling/MEDCouplingSkyLineArray.hxx +++ b/src/MEDCoupling/MEDCouplingSkyLineArray.hxx @@ -70,9 +70,9 @@ namespace MEDCoupling void set( DataArrayInt* index, DataArrayInt* value ); void set3( DataArrayInt* superIndex, DataArrayInt* index, DataArrayInt* value ); - int getSuperNumberOf() const { return _super_index->getNbOfElems()-1; } - int getNumberOf() const { return _index->getNbOfElems()-1; } - int getLength() const { return _values->getNbOfElems(); } + mcIdType getSuperNumberOf() const { return ToIdType(_super_index->getNbOfElems())-1; } + mcIdType getNumberOf() const { return ToIdType(_index->getNbOfElems())-1; } + mcIdType getLength() const { return ToIdType(_values->getNbOfElems()); } const int* getSuperIndex() const { return _super_index->begin(); } const int* getIndex() const { return _index->begin(); } diff --git a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx old mode 100644 new mode 100755 index bdb9cdb55..b9e75be70 --- a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx +++ b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx @@ -110,7 +110,7 @@ DataArrayInt *MEDCouplingStructuredMesh::giveCellsWithType(INTERP_KERNEL::Normal DataArrayInt *MEDCouplingStructuredMesh::computeNbOfNodesPerCell() const { - int nbCells=getNumberOfCells(); + std::size_t nbCells=getNumberOfCells(); MCAuto ret=DataArrayInt::New(); ret->alloc(nbCells,1); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(getTypeOfCell(0)); @@ -120,7 +120,7 @@ DataArrayInt *MEDCouplingStructuredMesh::computeNbOfNodesPerCell() const DataArrayInt *MEDCouplingStructuredMesh::computeNbOfFacesPerCell() const { - int nbCells=getNumberOfCells(); + std::size_t nbCells=getNumberOfCells(); MCAuto ret=DataArrayInt::New(); ret->alloc(nbCells,1); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(getTypeOfCell(0)); @@ -147,7 +147,7 @@ void MEDCouplingStructuredMesh::getNodeIdsOfCell(std::size_t cellId, std::vector getSplitCellValues(tmpCell); getSplitNodeValues(tmpNode); int tmp2[3]; - GetPosFromId(cellId,meshDim,tmpCell,tmp2); + GetPosFromId(ToIdType(cellId),meshDim,tmpCell,tmp2); switch(meshDim) { case 1: @@ -241,7 +241,7 @@ std::vector MEDCouplingStructuredMesh::getDistributionOfTypes() const //only one type of cell std::vector ret(3); ret[0]=getTypeOfCell(0); - ret[1]=getNumberOfCells(); + ret[1]=ToIdType(getNumberOfCells()); ret[2]=-1; //ret[3*k+2]==-1 because it has no sense here return ret; } @@ -254,7 +254,7 @@ std::vector MEDCouplingStructuredMesh::getDistributionOfTypes() const */ DataArrayInt *MEDCouplingStructuredMesh::checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const { - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); if(code.size()!=3) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::checkTypeConsistencyAndContig : invalid input code should be exactly of size 3 !"); if(code[0]!=(int)getTypeOfCell(0)) @@ -316,8 +316,8 @@ void MEDCouplingStructuredMesh::splitProfilePerType(const DataArrayInt *profile, throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::splitProfilePerType : input profile is NULL or not allocated !"); if(profile->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::splitProfilePerType : input profile should have exactly one component !"); - int nbTuples(profile->getNumberOfTuples()); - int nbOfCells=getNumberOfCells(); + mcIdType nbTuples=ToIdType(profile->getNumberOfTuples()); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); code.resize(3); idsInPflPerType.resize(1); code[0]=(int)getTypeOfCell(0); code[1]=nbOfCells; idsInPflPerType.resize(1); @@ -328,7 +328,7 @@ void MEDCouplingStructuredMesh::splitProfilePerType(const DataArrayInt *profile, idsPerType.clear(); return ; } - code[1]=profile->getNumberOfTuples(); + code[1]=ToIdType(profile->getNumberOfTuples()); code[2]=0; profile->checkAllIdsInRange(0,nbOfCells); idsPerType.resize(1); @@ -459,7 +459,7 @@ MEDCouplingFieldDouble *MEDCouplingStructuredMesh::buildOrthogonalField() const throw INTERP_KERNEL::Exception("Expected a MEDCouplingStructuredMesh with meshDim == 2 !"); MCAuto ret(MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME)); MCAuto array(DataArrayDouble::New()); - int nbOfCells(getNumberOfCells()); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); array->alloc(nbOfCells,3); double *vals(array->getPointer()); for(int i=0;i > MEDCouplingStructuredMesh::ComputeSignaturePerAx DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity1D(const int *nodeStBg) { - std::size_t nbOfCells(*nodeStBg-1); + mcIdType nbOfCells=*nodeStBg-1; MCAuto conn(DataArrayInt::New()); conn->alloc(2*nbOfCells,1); int *cp=conn->getPointer(); - for(std::size_t i=0;i conn(DataArrayInt::New()); conn->alloc(4*n1*n2,1); int *cp(conn->getPointer()); std::size_t pos(0); - for(std::size_t j=0;j conn(DataArrayInt::New()); conn->alloc(8*n1*n2*n3,1); int *cp(conn->getPointer()); std::size_t pos(0); - for(std::size_t k=0;kgetNumberOfTuples()!=DeduceNumberOfGivenStructure(st)) + if(ToIdType(fieldOfDbl->getNumberOfTuples())!=DeduceNumberOfGivenStructure(st)) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom : invalid size of input array of double regarding the structure !"); std::vector dims(GetDimensionsFromCompactFrmt(partCompactFormat)); - int nbOfTuplesOfOutField(DeduceNumberOfGivenStructure(dims)),nbComp(fieldOfDbl->getNumberOfComponents()); + int nbOfTuplesOfOutField(DeduceNumberOfGivenStructure(dims)),nbComp(ToIdType(fieldOfDbl->getNumberOfComponents())); MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfTuplesOfOutField,nbComp); ret->copyStringInfoFrom(*fieldOfDbl); double *ptRet(ret->getPointer()); @@ -1765,7 +1765,7 @@ DataArrayDouble *MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(const std:: */ void MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(const std::vector& st, DataArrayDouble *fieldOfDbl, const std::vector< std::pair >& partCompactFormat, const DataArrayDouble *other) {//to be optimized - std::vector facts(st.size(),1.); + std::vector facts(st.size(),1); MEDCouplingIMesh::CondenseFineToCoarse(st,other,partCompactFormat,facts,fieldOfDbl); } @@ -1977,8 +1977,8 @@ void MEDCouplingStructuredMesh::MultiplyPartOf(const std::vector& st, const throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::MultiplyPartOf : invalid input range 3 !"); dims[i]=part[i].second-part[i].first; } - int nbOfTuplesExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(st)),nbCompo(da->getNumberOfComponents()); - if(da->getNumberOfTuples()!=nbOfTuplesExp) + int nbOfTuplesExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(st)),nbCompo(ToIdType(da->getNumberOfComponents())); + if(ToIdType(da->getNumberOfTuples())!=nbOfTuplesExp) { std::ostringstream oss; oss << "MEDCouplingStructuredMesh::MultiplyPartOf : invalid nb of tuples ! Expected " << nbOfTuplesExp << " having " << da->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); diff --git a/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx b/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx index 7e041ce71..2ebf3471e 100644 --- a/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx +++ b/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx @@ -2238,8 +2238,8 @@ void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation(std::vectorgetNumberOfTuples()); - tinyInfo.push_back(_end_array->getNumberOfComponents()); + tinyInfo.push_back(ToIdType(_end_array->getNumberOfTuples())); + tinyInfo.push_back(ToIdType(_end_array->getNumberOfComponents())); } else { @@ -2257,7 +2257,7 @@ void MEDCouplingTwoTimeSteps::getTinySerializationDbleInformation(std::vector& tinyInfo) const { - int nbOfCompo=_array->getNumberOfComponents(); + mcIdType nbOfCompo=ToIdType(_array->getNumberOfComponents()); for(int i=0;igetInfoOnComponent(i)); for(int i=0;i_end_array==0) return false; - int nbC1=_end_array->getNumberOfComponents(); - int nbC2=otherC->_end_array->getNumberOfComponents(); + std::size_t nbC1=_end_array->getNumberOfComponents(); + std::size_t nbC2=otherC->_end_array->getNumberOfComponents(); if(nbC1!=nbC2 && nbC2!=1) return false; return true; @@ -2490,12 +2490,11 @@ void MEDCouplingLinearTime::getValueForTime(double time, const std::vectorgetTuple(eltId,value); else throw INTERP_KERNEL::Exception("No start array existing."); - nbComp=_array->getNumberOfComponents(); + mcIdType nbComp=ToIdType(_array->getNumberOfComponents()); std::transform(value,value+nbComp,value,std::bind2nd(std::multiplies(),alpha)); std::vector tmp(nbComp); if(_end_array) diff --git a/src/MEDCoupling/MEDCouplingTimeDiscretization.txx b/src/MEDCoupling/MEDCouplingTimeDiscretization.txx index e66822e87..9a29ca398 100644 --- a/src/MEDCoupling/MEDCouplingTimeDiscretization.txx +++ b/src/MEDCoupling/MEDCouplingTimeDiscretization.txx @@ -148,8 +148,8 @@ namespace MEDCoupling return true; if(_array==0 || other->_array==0) return false; - int nbC1(_array->getNumberOfComponents()),nbC2(other->_array->getNumberOfComponents()); - int nbMin(std::min(nbC1,nbC2)); + std::size_t nbC1(_array->getNumberOfComponents()),nbC2(other->_array->getNumberOfComponents()); + std::size_t nbMin(std::min(nbC1,nbC2)); if(nbC1!=nbC2 && nbMin!=1) return false; return true; @@ -164,7 +164,7 @@ namespace MEDCoupling return true; if(_array==0 || other->_array==0) return false; - int nbC1(_array->getNumberOfComponents()),nbC2(other->_array->getNumberOfComponents()); + std::size_t nbC1(_array->getNumberOfComponents()),nbC2(other->_array->getNumberOfComponents()); if(nbC1!=nbC2 && nbC2!=1) return false; return true; @@ -229,8 +229,8 @@ namespace MEDCoupling { if(_array) { - tinyInfo.push_back(_array->getNumberOfTuples()); - tinyInfo.push_back(_array->getNumberOfComponents()); + tinyInfo.push_back(ToIdType(_array->getNumberOfTuples())); + tinyInfo.push_back(ToIdType(_array->getNumberOfComponents())); } else { @@ -248,7 +248,7 @@ namespace MEDCoupling template void MEDCouplingTimeDiscretizationTemplate::getTinySerializationStrInformation(std::vector& tinyInfo) const { - int nbOfCompo(_array->getNumberOfComponents()); + mcIdType nbOfCompo=ToIdType(_array->getNumberOfComponents()); for(int i=0;igetInfoOnComponent(i)); } @@ -292,7 +292,7 @@ namespace MEDCoupling void MEDCouplingTimeDiscretizationTemplate::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS) { _time_tolerance=tinyInfoD[0]; - int nbOfCompo=_array->getNumberOfComponents(); + mcIdType nbOfCompo=ToIdType(_array->getNumberOfComponents()); for(int i=0;isetInfoOnComponent(i,tinyInfoS[i]); } diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx old mode 100644 new mode 100755 index 5b5ca7291..0f2d3f486 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -228,7 +228,7 @@ void MEDCouplingUMesh::checkConsistency(double eps) const return ; int meshDim=getMeshDimension(); int nbOfNodes=getNumberOfNodes(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); const int *ptr=_nodal_connec->getConstPointer(); const int *ptrI=_nodal_connec_index->getConstPointer(); for(int i=0;i MEDCouplingUMesh::getAllGeoTypesS { std::vector ret; checkConnectivityFullyDefined(); - int nbOfCells(getNumberOfCells()); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); if(nbOfCells==0) return ret; if(getNodalConnectivityArrayLen()<1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getAllGeoTypesSorted : the connectivity in this seems invalid !"); const int *c(_nodal_connec->begin()),*ci(_nodal_connec_index->begin()); ret.push_back((INTERP_KERNEL::NormalizedCellType)c[*ci++]); - for(int i=1;iuseArray(revNodalIndxPtr,true,DeallocType::C_DEALLOC,nbOfNodes+1,1); std::fill(revNodalIndxPtr,revNodalIndxPtr+nbOfNodes+1,0); const int *conn(_nodal_connec->begin()),*connIndex(_nodal_connec_index->begin()); - int nbOfCells(getNumberOfCells()),nbOfEltsInRevNodal(0); - for(int eltId=0;eltIdcheckNbOfComps(1,"MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne : node neigh"); nodeNeighI->checkNbOfComps(1,"MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne : node neigh index"); nodeNeighI->checkNbOfTuples(1+getNumberOfNodes(),"MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne : invalid length"); - int nbCells(getNumberOfCells()); + mcIdType nbCells=ToIdType(getNumberOfCells()); const int *c(_nodal_connec->begin()),*ci(_nodal_connec_index->begin()),*ne(nodeNeigh->begin()),*nei(nodeNeighI->begin()); cellNeigh=DataArrayInt::New(); cellNeigh->alloc(0,1); cellNeighIndex=DataArrayInt::New(); cellNeighIndex->alloc(1,1); cellNeighIndex->setIJ(0,0,0); - for(int i=0;i s; for(const int *it=c+ci[i]+1;it!=c+ci[i+1];it++) @@ -808,7 +808,7 @@ void MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne(const DataArrayInt *n s.insert(ne+nei[*it],ne+nei[*it+1]); s.erase(i); cellNeigh->insertAtTheEnd(s.begin(),s.end()); - cellNeighIndex->pushBackSilent(cellNeigh->getNumberOfTuples()); + cellNeighIndex->pushBackSilent(ToIdType(cellNeigh->getNumberOfTuples())); } } @@ -842,7 +842,7 @@ void MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, cons const int *revDescPtr=revDesc->begin(); const int *revDescIPtr=revDescIndx->begin(); // - int nbCells=descIndx->getNumberOfTuples()-1; + mcIdType nbCells=ToIdType(descIndx->getNumberOfTuples())-1; MCAuto out0=DataArrayInt::New(); MCAuto out1=DataArrayInt::New(); out1->alloc(nbCells+1,1); int *out1Ptr=out1->getPointer(); @@ -856,7 +856,7 @@ void MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, cons s.erase(i); out0->insertAtTheEnd(s.begin(),s.end()); } - *out1Ptr=out0->getNumberOfTuples(); + *out1Ptr=ToIdType(out0->getNumberOfTuples()); } neighbors=out0.retn(); neighborsIndx=out1.retn(); @@ -963,7 +963,7 @@ void MEDCouplingUMesh::computeEnlargedNeighborsOfNodes(MCAuto &nei checkFullyDefined(); int nbOfNodes(getNumberOfNodes()); const int *conn(_nodal_connec->begin()),*connIndex(_nodal_connec_index->begin()); - int nbOfCells(getNumberOfCells()); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); std::vector< std::set > st0(nbOfNodes); for(int eltId=0;eltId &nei if ((*it).empty()) neighIdx[1]=neighIdx[0]; else - neighIdx[1]=neighIdx[0]+(*it).size()-1; + neighIdx[1]=neighIdx[0]+ToIdType((*it).size())-1; } } neighbors=DataArrayInt::New(); neighbors->alloc(neighborsIdx->back(),1); @@ -1024,7 +1024,7 @@ void MEDCouplingUMesh::convertToPolyTypes(const int *cellIdsToConvertBg, const i int dim=getMeshDimension(); if(dim<2 || dim>3) throw INTERP_KERNEL::Exception("Invalid mesh dimension : must be 2 or 3 !"); - int nbOfCells(getNumberOfCells()); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); if(dim==2) { const int *connIndex=_nodal_connec_index->begin(); @@ -1109,11 +1109,11 @@ void MEDCouplingUMesh::convertToPolyTypes(const int *cellIdsToConvertBg, const i */ void MEDCouplingUMesh::convertAllToPoly() { - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); std::vector cellIds(nbOfCells); - for(int i=0;i newCi=DataArrayInt::New(); newCi->alloc(nbOfCells+1,1); int *newci=newCi->getPointer(); @@ -1229,7 +1229,7 @@ bool MEDCouplingUMesh::unPolyze() throw INTERP_KERNEL::Exception("MEDCouplingUMesh::unPolyze works on umeshes with meshdim equals to 0, 1 2 or 3 !"); if(mdim<=1) return false; - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); if(nbOfCells<1) return false; int initMeshLgth=getNodalConnectivityArrayLen(); @@ -1307,7 +1307,7 @@ void MEDCouplingUMesh::simplifyPolyhedra(double eps) MCAuto coords=getCoords()->deepCopy(); coords->recenterForMaxPrecision(eps); // - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); const int *conn=_nodal_connec->getConstPointer(); const int *index=_nodal_connec_index->getConstPointer(); MCAuto connINew=DataArrayInt::New(); @@ -1326,7 +1326,7 @@ void MEDCouplingUMesh::simplifyPolyhedra(double eps) } else connNew->insertAtTheEnd(conn+index[i],conn+index[i+1]); - *connINewPtr=connNew->getNumberOfTuples(); + *connINewPtr=ToIdType(connNew->getNumberOfTuples()); } if(changed) setConnectivity(connNew,connINew,false); @@ -1356,7 +1356,8 @@ DataArrayInt *MEDCouplingUMesh::computeFetchedNodeIds() const */ void MEDCouplingUMesh::computeNodeIdsAlg(std::vector& nodeIdsInUse) const { - int nbOfNodes((int)nodeIdsInUse.size()),nbOfCells(getNumberOfCells()); + mcIdType nbOfNodes=ToIdType(nodeIdsInUse.size()), + nbOfCells=ToIdType(getNumberOfCells()); const int *connIndex(_nodal_connec_index->getConstPointer()),*conn(_nodal_connec->getConstPointer()); for(int i=0;ialloc(nbOfNodes,1); int *traducer=ret->getPointer(); std::fill(traducer,traducer+nbOfNodes,-1); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); const int *connIndex=_nodal_connec_index->getConstPointer(); const int *conn=_nodal_connec->getConstPointer(); for(int i=0;i ret=DataArrayInt::New(); ret->alloc(nbOfCells,1); int *retPtr=ret->getPointer(); @@ -1453,7 +1454,7 @@ DataArrayInt *MEDCouplingUMesh::computeNbOfNodesPerCell() const if(conn[connI[i]]!=(int)INTERP_KERNEL::NORM_POLYHED) *retPtr=connI[i+1]-connI[i]-1; else - *retPtr=connI[i+1]-connI[i]-1-std::count(conn+connI[i]+1,conn+connI[i+1],-1); + *retPtr=connI[i+1]-connI[i]-1-ToIdType(std::count(conn+connI[i]+1,conn+connI[i+1],-1)); } return ret.retn(); } @@ -1468,7 +1469,7 @@ DataArrayInt *MEDCouplingUMesh::computeNbOfNodesPerCell() const DataArrayInt *MEDCouplingUMesh::computeEffectiveNbOfNodesPerCell() const { checkConnectivityFullyDefined(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfCells,1); int *retPtr=ret->getPointer(); @@ -1497,7 +1498,7 @@ DataArrayInt *MEDCouplingUMesh::computeEffectiveNbOfNodesPerCell() const DataArrayInt *MEDCouplingUMesh::computeNbOfFacesPerCell() const { checkConnectivityFullyDefined(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfCells,1); int *retPtr=ret->getPointer(); @@ -1720,7 +1721,7 @@ void MEDCouplingUMesh::FindCommonCellsAlg(int compType, int startCellId, const D DataArrayInt *& commonCellsArr, DataArrayInt *& commonCellsIArr) { MCAuto commonCells=DataArrayInt::New(),commonCellsI=DataArrayInt::New(); commonCells->alloc(0,1); - int nbOfCells=nodalI->getNumberOfTuples()-1; + mcIdType nbOfCells=ToIdType(nodalI->getNumberOfTuples())-1; commonCellsI->reserve(1); commonCellsI->pushBackSilent(0); const int *revNodalPtr=revNodal->getConstPointer(),*revNodalIPtr=revNodalI->getConstPointer(); const int *connPtr=nodal->getConstPointer(),*connIPtr=nodalI->getConstPointer(); @@ -1752,7 +1753,7 @@ void MEDCouplingUMesh::FindCommonCellsAlg(int compType, int startCellId, const D if(AreCellsEqualInPool(v2,compType,connPtr,connIPtr,commonCells)) { int pos=commonCellsI->back(); - commonCellsI->pushBackSilent(commonCells->getNumberOfTuples()); + commonCellsI->pushBackSilent(ToIdType(commonCells->getNumberOfTuples())); for(const int *it=commonCells->begin()+pos;it!=commonCells->end();it++) isFetched[*it]=true; } @@ -1785,7 +1786,7 @@ void MEDCouplingUMesh::FindCommonCellsAlg(int compType, int startCellId, const D if(AreCellsEqualInPool(v2,compType,connPtr,connIPtr,commonCells)) { int pos=commonCellsI->back(); - commonCellsI->pushBackSilent(commonCells->getNumberOfTuples()); + commonCellsI->pushBackSilent(ToIdType(commonCells->getNumberOfTuples())); for(const int *it=commonCells->begin()+pos;it!=commonCells->end();it++) isFetched[*it]=true; } @@ -1824,7 +1825,7 @@ void MEDCouplingUMesh::FindCommonCellsAlg(int compType, int startCellId, const D bool MEDCouplingUMesh::areCellsIncludedIn(const MEDCouplingUMesh *other, int compType, DataArrayInt *& arr) const { MCAuto mesh=MergeUMeshesOnSameCoords(this,other); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); static const int possibleCompType[]={0,1,2}; if(std::find(possibleCompType,possibleCompType+sizeof(possibleCompType)/sizeof(int),compType)==possibleCompType+sizeof(possibleCompType)/sizeof(int)) { @@ -1856,16 +1857,16 @@ bool MEDCouplingUMesh::areCellsIncludedInPolicy7(const MEDCouplingUMesh *other, { MCAuto mesh=MergeUMeshesOnSameCoords(this,other); DataArrayInt *commonCells=0,*commonCellsI=0; - int thisNbCells=getNumberOfCells(); + mcIdType thisNbCells=ToIdType(getNumberOfCells()); mesh->findCommonCells(7,thisNbCells,commonCells,commonCellsI); MCAuto commonCellsTmp(commonCells),commonCellsITmp(commonCellsI); const int *commonCellsPtr=commonCells->getConstPointer(),*commonCellsIPtr=commonCellsI->getConstPointer(); - int otherNbCells=other->getNumberOfCells(); + mcIdType otherNbCells=ToIdType(other->getNumberOfCells()); MCAuto arr2=DataArrayInt::New(); arr2->alloc(otherNbCells,1); arr2->fillWithZero(); int *arr2Ptr=arr2->getPointer(); - int nbOfCommon=commonCellsI->getNumberOfTuples()-1; + mcIdType nbOfCommon=ToIdType(commonCellsI->getNumberOfTuples())-1; for(int i=0;igetConstPointer(); const int *connIOther=otherOnSameCoordsThanThis._nodal_connec_index->getConstPointer(); @@ -2140,7 +2141,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildBoundaryMesh(bool keepCoords) const revDesc->decrRef(); desc->decrRef(); descIndx->decrRef(); - int nbOfCells=meshDM1->getNumberOfCells(); + mcIdType nbOfCells=ToIdType(meshDM1->getNumberOfCells()); const int *revDescIndxC=revDescIndx->getConstPointer(); std::vector boundaryCells; for(int i=0;i faceIds=tmp->findIdsEqual(1); tmp=(DataArrayInt*)0; const int *revDescPtr=revDesc->getConstPointer(); const int *revDescIndxPtr=revDescIndx->getConstPointer(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); std::vector ret1(nbOfCells,false); int sz=0; for(const int *pt=faceIds->begin();pt!=faceIds->end();pt++) @@ -2338,7 +2339,7 @@ void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1On dnu1=0;dnu2=0;dnu3=0;dnu4=0; DataArrayInt * corresp=0; meshM2->areCellsIncludedIn(m0descSkinDesc,2,corresp); - DAInt validIds = corresp->findIdsInRange(0, meshM2->getNumberOfCells()); + DAInt validIds = corresp->findIdsInRange(0, ToIdType(meshM2->getNumberOfCells())); corresp->decrRef(); if (validIds->getNumberOfTuples()) { @@ -2360,7 +2361,7 @@ void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1On // MCUMesh m0Part2=static_cast(buildPartOfMySelf(cellsAroundGroup->begin(),cellsAroundGroup->end(),true)); - int nCells2 = m0Part2->getNumberOfCells(); + mcIdType nCells2 = ToIdType(m0Part2->getNumberOfCells()); DAInt desc00=DataArrayInt::New(),descI00=DataArrayInt::New(),revDesc00=DataArrayInt::New(),revDescI00=DataArrayInt::New(); MCUMesh m01=m0Part2->buildDescendingConnectivity(desc00,descI00,revDesc00,revDescI00); @@ -2417,7 +2418,7 @@ void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1On if (nIter >= nIterMax) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::findNodesToDuplicate(): internal error - too many iterations."); - DAInt cellsToModifyConn1_torenum=cellsToModifyConn0_torenum->buildComplement(neighI00->getNumberOfTuples()-1); + DAInt cellsToModifyConn1_torenum=cellsToModifyConn0_torenum->buildComplement(ToIdType(neighI00->getNumberOfTuples())-1); cellsToModifyConn0_torenum->transformWithIndArr(cellsAroundGroup->begin(),cellsAroundGroup->end()); cellsToModifyConn1_torenum->transformWithIndArr(cellsAroundGroup->begin(),cellsAroundGroup->end()); // @@ -2459,8 +2460,8 @@ void MEDCouplingUMesh::renumberNodesWithOffsetInConn(int offset) checkConnectivityFullyDefined(); int *conn(getNodalConnectivity()->getPointer()); const int *connIndex(getNodalConnectivityIndex()->getConstPointer()); - int nbOfCells(getNumberOfCells()); - for(int i=0;igetPointer(); const int *connIndex=getNodalConnectivityIndex()->getConstPointer(); - int nbOfCells(getNumberOfCells()); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); for(int i=0;igetPointer(); const int *connIndex=getNodalConnectivityIndex()->getConstPointer(); - int nbOfCells=getNumberOfCells(); - for(int i=0;igetPointer(); const int *connIndex=getNodalConnectivityIndex()->getConstPointer(); - int nbOfCells=getNumberOfCells(); - for(int i=0;igetConstPointer(); const int* conn_index= getNodalConnectivityIndex()->getConstPointer(); const double* coords = getCoords()->getConstPointer(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); for ( int ielem=0; ielemgetConstPointer(); const int* conn_index= getNodalConnectivityIndex()->getConstPointer(); const double* coords = getCoords()->getConstPointer(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); for ( int ielem=0; ielem ret=DataArrayInt::New(); ret->alloc(0,1); checkConnectivityFullyDefined(); - int nbCells=getNumberOfCells(); + mcIdType nbCells=ToIdType(getNumberOfCells()); int mdim=getMeshDimension(); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); if(mdim!=(int)cm.getDimension()) @@ -3100,7 +3101,7 @@ int MEDCouplingUMesh::getMeshDimension() const */ int MEDCouplingUMesh::getNodalConnectivityArrayLen() const { - return _nodal_connec->getNbOfElems(); + return ToIdType(_nodal_connec->getNbOfElems()); } /*! @@ -3109,8 +3110,8 @@ int MEDCouplingUMesh::getNodalConnectivityArrayLen() const void MEDCouplingUMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const { MEDCouplingPointSet::getTinySerializationInformation(tinyInfoD,tinyInfo,littleStrings); - tinyInfo.push_back(getMeshDimension()); - tinyInfo.push_back(getNumberOfCells()); + tinyInfo.push_back(ToIdType(getMeshDimension())); + tinyInfo.push_back(ToIdType(getNumberOfCells())); if(_nodal_connec) tinyInfo.push_back(getNodalConnectivityArrayLen()); else @@ -3199,7 +3200,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getMeasureField(bool isAbs) const { std::string name="MeasureOfMesh_"; name+=getName(); - int nbelem=getNumberOfCells(); + mcIdType nbelem=ToIdType(getNumberOfCells()); MCAuto field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); field->setName(name); MCAuto array=DataArrayDouble::New(); @@ -3355,7 +3356,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildOrthogonalField() const throw INTERP_KERNEL::Exception("Expected a umesh with ( meshDim == 2 spaceDim == 2 or 3 ) or ( meshDim == 1 spaceDim == 2 ) !"); MCAuto ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); MCAuto array=DataArrayDouble::New(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); int nbComp=getMeshDimension()+1; array->alloc(nbOfCells,nbComp); double *vals=array->getPointer(); @@ -3500,7 +3501,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildDirectionVectorField() const throw INTERP_KERNEL::Exception("Expected a umesh with only NORM_SEG2 type of elements for buildDirectionVectorField !"); MCAuto ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); MCAuto array=DataArrayDouble::New(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); int spaceDim=getSpaceDimension(); array->alloc(nbOfCells,spaceDim); double *pt=array->getPointer(); @@ -3629,7 +3630,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSlice3DSurf(const double *origin, const for(const int *it=cellIds1D->begin();it!=cellIds1D->end();it++) cut3DCurve[*it]=-1; mDesc1->split3DCurveWithPlane(origin,vec,eps,cut3DCurve); - int ncellsSub=subMesh->getNumberOfCells(); + mcIdType ncellsSub=ToIdType(subMesh->getNumberOfCells()); std::vector< std::pair > cut3DSurf(ncellsSub); AssemblyForSplitFrom3DCurve(cut3DCurve,nodes,subMesh->getNodalConnectivity()->getConstPointer(),subMesh->getNodalConnectivityIndex()->getConstPointer(), mDesc1->getNodalConnectivity()->getConstPointer(),mDesc1->getNodalConnectivityIndex()->getConstPointer(), @@ -3645,7 +3646,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSlice3DSurf(const double *origin, const if(cut3DSurf[i].first!=-2) { conn->pushBackSilent((int)INTERP_KERNEL::NORM_SEG2); conn->pushBackSilent(cut3DSurf[i].first); conn->pushBackSilent(cut3DSurf[i].second); - connI->pushBackSilent(conn->getNumberOfTuples()); + connI->pushBackSilent(ToIdType(conn->getNumberOfTuples())); cellIds2->pushBackSilent(i); } else @@ -3656,7 +3657,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSlice3DSurf(const double *origin, const for(int j=0;jpushBackSilent((int)INTERP_KERNEL::NORM_SEG2); conn->pushBackSilent(nodal[offset+j]); conn->pushBackSilent(nodal[offset+(j+1)%nbOfEdges]); - connI->pushBackSilent(conn->getNumberOfTuples()); + connI->pushBackSilent(ToIdType(conn->getNumberOfTuples())); cellIds2->pushBackSilent(cellId3DSurf); } } @@ -3719,12 +3720,12 @@ MCAuto MEDCouplingUMesh::clipSingle3DCellByPlane(const double { conn->pushBackSilent((int)INTERP_KERNEL::NORM_POLYGON); conn->insertAtTheEnd(res[i].begin(),res[i].end()); - connI->pushBackSilent(conn->getNumberOfTuples()); + connI->pushBackSilent(ToIdType(conn->getNumberOfTuples())); } MCAuto ret(MEDCouplingUMesh::New("",2)); ret->setCoords(mDesc1->getCoords()); ret->setConnectivity(conn,connI,true); - int nbCellsRet(ret->getNumberOfCells()); + mcIdType nbCellsRet(ToIdType(ret->getNumberOfCells())); // MCAuto vec2(DataArrayDouble::New()); vec2->alloc(1,3); std::copy(vec,vec+3,vec2->getPointer()); MCAuto ortho(ret->buildOrthogonalField()); @@ -3777,9 +3778,9 @@ MCAuto MEDCouplingUMesh::clipSingle3DCellByPlane(const double } } conn2->insertAtTheEnd(cell0.begin(),cell0.end()); - conn2I->pushBackSilent(conn2->getNumberOfTuples()); + conn2I->pushBackSilent(ToIdType(conn2->getNumberOfTuples())); conn2->insertAtTheEnd(cell1.begin(),cell1.end()); - conn2I->pushBackSilent(conn2->getNumberOfTuples()); + conn2I->pushBackSilent(ToIdType(conn2->getNumberOfTuples())); ret2->setConnectivity(conn2,conn2I,true); ret2->checkConsistencyLight(); ret2->orientCorrectlyPolyhedrons(); @@ -3819,7 +3820,7 @@ DataArrayInt *MEDCouplingUMesh::getCellIdsCrossingPlane(const double *origin, co MCAuto coo=_coords->deepCopy(); double normm2(sqrt(vec2[0]*vec2[0]+vec2[1]*vec2[1]+vec2[2]*vec2[2])); if(normm2/normm>1e-6) - DataArrayDouble::Rotate3DAlg(origin,vec2,angle,coo->getNumberOfTuples(),coo->getPointer(),coo->getPointer()); + DataArrayDouble::Rotate3DAlg(origin,vec2,angle,ToIdType(coo->getNumberOfTuples()),coo->getPointer(),coo->getPointer()); MCAuto mw=clone(false);//false -> shallow copy mw->setCoords(coo); mw->getBoundingBox(bbox); @@ -3846,7 +3847,7 @@ bool MEDCouplingUMesh::isContiguous1D() const { if(getMeshDimension()!=1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::isContiguous1D : this method has a sense only for 1D mesh !"); - int nbCells=getNumberOfCells(); + mcIdType nbCells=ToIdType(getNumberOfCells()); if(nbCells<1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::isContiguous1D : this method has a sense for non empty mesh !"); const int *connI(_nodal_connec_index->begin()),*conn(_nodal_connec->begin()); @@ -3975,10 +3976,10 @@ DataArrayDouble *MEDCouplingUMesh::distanceToPoints(const DataArrayDouble *pts, throw INTERP_KERNEL::Exception(oss.str()); } checkFullyDefined(); - int nbCells=getNumberOfCells(); + mcIdType nbCells=ToIdType(getNumberOfCells()); if(nbCells==0) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::distanceToPoints : no cells in this !"); - int nbOfPts=pts->getNumberOfTuples(); + mcIdType nbOfPts=ToIdType(pts->getNumberOfTuples()); MCAuto ret0=DataArrayDouble::New(); ret0->alloc(nbOfPts,1); MCAuto ret1=DataArrayInt::New(); ret1->alloc(nbOfPts,1); const int *nc=_nodal_connec->begin(),*ncI=_nodal_connec_index->begin(); const double *coords=_coords->begin(); @@ -4182,7 +4183,7 @@ void MEDCouplingUMesh::checkButterflyCells(std::vector& cells, double eps) throw INTERP_KERNEL::Exception(msg); const int *conn=_nodal_connec->getConstPointer(); const int *connI=_nodal_connec_index->getConstPointer(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); std::vector cell2DinS2; for(int i=0;igetConstPointer(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); MCAuto nodalConnecIndexOut=DataArrayInt::New(); nodalConnecIndexOut->alloc(nbOfCells+1,1); MCAuto nodalConnecOut(DataArrayInt::New()); @@ -4232,11 +4233,11 @@ DataArrayInt *MEDCouplingUMesh::convexEnvelop2D() isChanged->alloc(0,1); for(int i=0;igetNumberOfTuples(); + mcIdType pos=ToIdType(nodalConnecOut->getNumberOfTuples()); if(BuildConvexEnvelopOf2DCellJarvis(coords,nodalConnecIn+nodalConnecIndexIn[i],nodalConnecIn+nodalConnecIndexIn[i+1],nodalConnecOut)) isChanged->pushBackSilent(i); types.insert((INTERP_KERNEL::NormalizedCellType)nodalConnecOut->getIJ(pos,0)); - workIndexOut[1]=nodalConnecOut->getNumberOfTuples(); + workIndexOut[1]=ToIdType(nodalConnecOut->getNumberOfTuples()); } if(isChanged->empty()) return 0; @@ -4312,7 +4313,7 @@ bool MEDCouplingUMesh::isFullyQuadratic() const { checkFullyDefined(); bool ret=true; - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); for(int i=0;ibegin(); for(int i=0;i3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::areOnlySimplexCells : only available with meshes having a meshdim 1, 2 or 3 !"); - int nbCells=getNumberOfCells(); + mcIdType nbCells=ToIdType(getNumberOfCells()); const int *conn=_nodal_connec->begin(); const int *connI=_nodal_connec_index->begin(); for(int i=0;i ret(DataArrayInt::New()); ret->alloc(0,1); if(nbOfCells<1) return ret.retn(); @@ -4715,7 +4716,7 @@ DataArrayInt *MEDCouplingUMesh::convertDegeneratedCellsAndRemoveFlatOnes() } if(newPos!=initMeshLgth) _nodal_connec->reAlloc(newPos); - const int nCellDel=ret->getNumberOfTuples(); + const mcIdType nCellDel=ToIdType(ret->getNumberOfTuples()); if (nCellDel) _nodal_connec_index->reAlloc(nbOfCells-nCellDel+1); computeTypes(); @@ -4791,7 +4792,7 @@ void MEDCouplingUMesh::are2DCellsNotCorrectlyOriented(const double *vec, bool po { if(getMeshDimension()!=2 || getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("Invalid mesh to apply are2DCellsNotCorrectlyOriented on it : must be meshDim==2 and spaceDim==3 !"); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); const int *conn=_nodal_connec->begin(); const int *connI=_nodal_connec_index->begin(); const double *coordsPtr=_coords->begin(); @@ -4829,7 +4830,8 @@ void MEDCouplingUMesh::orientCorrectly2DCells(const double *vec, bool polyOnly) { if(getMeshDimension()!=2 || getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("Invalid mesh to apply orientCorrectly2DCells on it : must be meshDim==2 and spaceDim==3 !"); - int nbOfCells(getNumberOfCells()),*conn(_nodal_connec->getPointer()); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); + int *conn(_nodal_connec->getPointer()); const int *connI(_nodal_connec_index->begin()); const double *coordsPtr(_coords->begin()); bool isModified(false); @@ -4862,7 +4864,8 @@ void MEDCouplingUMesh::changeOrientationOfCells() int mdim(getMeshDimension()); if(mdim!=2 && mdim!=1) throw INTERP_KERNEL::Exception("Invalid mesh to apply changeOrientationOfCells on it : must be meshDim==2 or meshDim==1 !"); - int nbOfCells(getNumberOfCells()),*conn(_nodal_connec->getPointer()); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); + int *conn(_nodal_connec->getPointer()); const int *connI(_nodal_connec_index->begin()); if(mdim==2) {//2D @@ -4903,7 +4906,7 @@ void MEDCouplingUMesh::arePolyhedronsNotCorrectlyOriented(std::vector& cell { if(getMeshDimension()!=3 || getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("Invalid mesh to apply arePolyhedronsNotCorrectlyOriented on it : must be meshDim==3 and spaceDim==3 !"); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); const int *conn=_nodal_connec->begin(); const int *connI=_nodal_connec_index->begin(); const double *coordsPtr=_coords->begin(); @@ -4937,7 +4940,7 @@ void MEDCouplingUMesh::orientCorrectlyPolyhedrons() { if(getMeshDimension()!=3 || getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("Invalid mesh to apply orientCorrectlyPolyhedrons on it : must be meshDim==3 and spaceDim==3 !"); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); int *conn=_nodal_connec->getPointer(); const int *connI=_nodal_connec_index->begin(); const double *coordsPtr=_coords->begin(); @@ -5010,7 +5013,7 @@ DataArrayInt *MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells() if(spaceDim!=3) throw INTERP_KERNEL::Exception(msg); // - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); int *conn=_nodal_connec->getPointer(); const int *connI=_nodal_connec_index->begin(); const double *coo=getCoords()->begin(); @@ -5042,7 +5045,7 @@ DataArrayInt *MEDCouplingUMesh::findAndCorrectBadOriented3DCells() { if(getMeshDimension()!=3 || getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("Invalid mesh to apply findAndCorrectBadOriented3DCells on it : must be meshDim==3 and spaceDim==3 !"); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); int *conn=_nodal_connec->getPointer(); const int *connI=_nodal_connec_index->begin(); const double *coordsPtr=_coords->begin(); @@ -5150,7 +5153,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getEdgeRatioField() const throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getEdgeRatioField : MeshDimension must be equal to 2 or 3 !"); MCAuto ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); ret->setMesh(this); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); MCAuto arr=DataArrayDouble::New(); arr->alloc(nbOfCells,1); double *pt=arr->getPointer(); @@ -5222,7 +5225,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getAspectRatioField() const throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getAspectRatioField : MeshDimension must be equal to 2 or 3 !"); MCAuto ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); ret->setMesh(this); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); MCAuto arr=DataArrayDouble::New(); arr->alloc(nbOfCells,1); double *pt=arr->getPointer(); @@ -5303,7 +5306,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getWarpField() const throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getWarpField : MeshDimension must be equal to 2 !"); MCAuto ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); ret->setMesh(this); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); MCAuto arr=DataArrayDouble::New(); arr->alloc(nbOfCells,1); double *pt=arr->getPointer(); @@ -5370,7 +5373,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getSkewField() const throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getSkewField : MeshDimension must be equal to 2 !"); MCAuto ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); ret->setMesh(this); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); MCAuto arr=DataArrayDouble::New(); arr->alloc(nbOfCells,1); double *pt=arr->getPointer(); @@ -5414,7 +5417,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::computeDiameterField() const ret->setMesh(this); std::set types; ComputeAllTypesInternal(types,_nodal_connec,_nodal_connec_index); - int spaceDim(getSpaceDimension()),nbCells(getNumberOfCells()); + mcIdType spaceDim(ToIdType(getSpaceDimension())),nbCells(ToIdType(getNumberOfCells())); MCAuto arr(DataArrayDouble::New()); arr->alloc(nbCells,1); for(std::set::const_iterator it=types.begin();it!=types.end();it++) @@ -5475,7 +5478,8 @@ DataArrayDouble *MEDCouplingUMesh::getBoundingBoxForBBTree(double arcDetEps) con DataArrayDouble *MEDCouplingUMesh::getBoundingBoxForBBTreeFast() const { checkFullyDefined(); - int spaceDim(getSpaceDimension()),nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes()); + int spaceDim(getSpaceDimension()),nbOfNodes(getNumberOfNodes()); + mcIdType nbOfCells(ToIdType(getNumberOfCells())); MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim); double *bbox(ret->getPointer()); for(int i=0;i ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim); @@ -5573,7 +5578,8 @@ DataArrayDouble *MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic(double arc DataArrayDouble *MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic(double arcDetEps) const { checkFullyDefined(); - int spaceDim(getSpaceDimension()),mDim(getMeshDimension()),nbOfCells(getNumberOfCells()); + int spaceDim(getSpaceDimension()),mDim(getMeshDimension()); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); if(spaceDim!=2 || mDim!=1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic : This method should be applied on mesh with mesh dimension equal to 1 and space dimension also equal to 2!"); INTERP_KERNEL::QuadraticPlanarPrecision arcPrec(arcDetEps); @@ -5643,7 +5649,7 @@ std::vector MEDCouplingUMesh::getDistributionOfTypes() const const int *conn=_nodal_connec->begin(); const int *connI=_nodal_connec_index->begin(); const int *work=connI; - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); std::size_t n=getAllGeoTypes().size(); std::vector ret(3*n,-1); //ret[3*k+2]==-1 because it has no sense here std::set types; @@ -5716,7 +5722,7 @@ DataArrayInt *MEDCouplingUMesh::checkTypeConsistencyAndContig(const std::vector< int *retPtr=ret->getPointer(); const int *connI=_nodal_connec_index->begin(); const int *conn=_nodal_connec->begin(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); const int *i=connI; int kk=0; for(std::vector::const_iterator it=types.begin();it!=types.end();it++,kk++) @@ -5792,7 +5798,7 @@ void MEDCouplingUMesh::splitProfilePerType(const DataArrayInt *profile, std::vec checkConnectivityFullyDefined(); const int *conn=_nodal_connec->begin(); const int *connI=_nodal_connec_index->begin(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); std::vector types; std::vector typeRangeVals(1); for(const int *i=connI;i!=connI+nbOfCells;) @@ -5813,7 +5819,7 @@ void MEDCouplingUMesh::splitProfilePerType(const DataArrayInt *profile, std::vec MCAuto tmp1=rankInsideCast; MCAuto tmp2=castsPresent; // - int nbOfCastsFinal=castsPresent->getNumberOfTuples(); + mcIdType nbOfCastsFinal=ToIdType(castsPresent->getNumberOfTuples()); code.resize(3*nbOfCastsFinal); std::vector< MCAuto > idsInPflPerType2; std::vector< MCAuto > idsPerType2; @@ -5823,7 +5829,7 @@ void MEDCouplingUMesh::splitProfilePerType(const DataArrayInt *profile, std::vec MCAuto tmp3=castArr->findIdsEqual(castId); idsInPflPerType2.push_back(tmp3); code[3*i]=(int)types[castId]; - code[3*i+1]=tmp3->getNumberOfTuples(); + code[3*i+1]=ToIdType(tmp3->getNumberOfTuples()); MCAuto tmp4=rankInsideCast->selectByTupleId(tmp3->begin(),tmp3->begin()+tmp3->getNumberOfTuples()); if(!smartPflKiller || !tmp4->isIota(typeRangeVals[castId+1]-typeRangeVals[castId])) { @@ -5922,7 +5928,7 @@ bool MEDCouplingUMesh::checkConsecutiveCellTypes() const checkFullyDefined(); const int *conn=_nodal_connec->begin(); const int *connI=_nodal_connec_index->begin(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); std::set types; for(const int *i=connI;i!=connI+nbOfCells;) { @@ -5957,7 +5963,7 @@ bool MEDCouplingUMesh::checkConsecutiveCellTypesAndOrder(const INTERP_KERNEL::No checkFullyDefined(); const int *conn=_nodal_connec->begin(); const int *connI=_nodal_connec_index->begin(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); if(nbOfCells==0) return true; int lastPos=-1; @@ -5996,7 +6002,7 @@ bool MEDCouplingUMesh::checkConsecutiveCellTypesAndOrder(const INTERP_KERNEL::No DataArrayInt *MEDCouplingUMesh::getLevArrPerCellTypes(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd, DataArrayInt *&nbPerType) const { checkConnectivityFullyDefined(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); const int *conn=_nodal_connec->begin(); const int *connI=_nodal_connec_index->begin(); MCAuto tmpa=DataArrayInt::New(); @@ -6067,7 +6073,7 @@ DataArrayInt *MEDCouplingUMesh::rearrange2ConsecutiveCellTypes() computeTypes(); const int *conn=_nodal_connec->begin(); const int *connI=_nodal_connec_index->begin(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); std::vector types; for(const int *i=connI;i!=connI+nbOfCells && (types.size()!=_types.size());) if(std::find(types.begin(),types.end(),(INTERP_KERNEL::NormalizedCellType)conn[*i])==types.end()) @@ -6101,7 +6107,7 @@ std::vector MEDCouplingUMesh::splitByType() const checkConnectivityFullyDefined(); const int *conn=_nodal_connec->begin(); const int *connI=_nodal_connec_index->begin(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); std::vector ret; for(const int *i=connI;i!=connI+nbOfCells;) { @@ -6170,7 +6176,7 @@ DataArrayInt *MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh() co oss << "this type is dynamic ! Only static geometric type is possible for that type ! call convertNodalConnectivityToDynamicGeoTypeMesh instead !"; throw INTERP_KERNEL::Exception(oss.str()); } - int nbCells=getNumberOfCells(); + mcIdType nbCells=ToIdType(getNumberOfCells()); int typi=(int)typ; int nbNodesPerCell=(int)cm.getNumberOfNodes(); MCAuto connOut=DataArrayInt::New(); connOut->alloc(nbCells*nbNodesPerCell,1); @@ -6203,7 +6209,8 @@ void MEDCouplingUMesh::convertNodalConnectivityToDynamicGeoTypeMesh(DataArrayInt checkConnectivityFullyDefined(); if(_types.size()!=1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertNodalConnectivityToDynamicGeoTypeMesh : current mesh does not contain exactly one geometric type !"); - int nbCells=getNumberOfCells(),lgth=_nodal_connec->getNumberOfTuples(); + mcIdType nbCells=ToIdType(getNumberOfCells()), + lgth=ToIdType(_nodal_connec->getNumberOfTuples()); if(lgth c(DataArrayInt::New()),ci(DataArrayInt::New()); @@ -6282,13 +6289,13 @@ MEDCouplingUMesh *MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(cons MEDCouplingUMesh *singleCell=static_cast((*it2)->buildPartOfMySelf(&fake,&fake+1,true)); m1ssmSingleAuto.push_back(singleCell); m1ssmSingle.push_back(singleCell); - ret1->pushBackSilent((*it2)->getNumberOfCells()); ret2->pushBackSilent(rk); + ret1->pushBackSilent(ToIdType((*it2)->getNumberOfCells())); ret2->pushBackSilent(rk); } } MCAuto m1ssmSingle2=MEDCouplingUMesh::MergeUMeshesOnSameCoords(m1ssmSingle); MCAuto renum=m1ssmSingle2->sortCellsInMEDFileFrmt(); std::vector m1ssmfinal(m1ssm.size()); - for(std::size_t i=0;igetIJ(i,0)]=m1ssm[i]; MCAuto ret0=MEDCouplingUMesh::MergeUMeshesOnSameCoords(m1ssmfinal); szOfCellGrpOfSameType=ret1->renumber(renum->begin()); @@ -6321,7 +6328,7 @@ DataArrayInt *MEDCouplingUMesh::convertCellArrayPerGeoType(const DataArrayInt *d checkFullyDefined(); const int *conn=_nodal_connec->begin(); const int *connI=_nodal_connec_index->begin(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); std::set types(getAllGeoTypes()); int *tmp=new int[nbOfCells]; for(std::set::const_iterator iter=types.begin();iter!=types.end();iter++) @@ -6336,7 +6343,7 @@ DataArrayInt *MEDCouplingUMesh::convertCellArrayPerGeoType(const DataArrayInt *d ret->copyStringInfoFrom(*da); int *retPtr=ret->getPointer(); const int *daPtr=da->begin(); - int nbOfElems=da->getNbOfElems(); + mcIdType nbOfElems=ToIdType(da->getNbOfElems()); for(int k=0;k MEDCouplingUMesh::getQuadraticStatus() const { - int ncell=getNumberOfCells(); + mcIdType ncell=ToIdType(getNumberOfCells()); std::vector ret(ncell); const int *cI=getNodalConnectivityIndex()->begin(); const int *c=getNodalConnectivity()->begin(); @@ -6434,7 +6441,7 @@ DataArrayDouble *MEDCouplingUMesh::computeCellCenterOfMass() const { MCAuto ret=DataArrayDouble::New(); int spaceDim=getSpaceDimension(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); ret->alloc(nbOfCells,spaceDim); ret->copyStringInfoFrom(*getCoords()); double *ptToFill=ret->getPointer(); @@ -6487,7 +6494,7 @@ DataArrayDouble *MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell() const checkFullyDefined(); MCAuto ret=DataArrayDouble::New(); int spaceDim=getSpaceDimension(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); int nbOfNodes=getNumberOfNodes(); ret->alloc(nbOfCells,spaceDim); double *ptToFill=ret->getPointer(); @@ -6600,7 +6607,8 @@ DataArrayDouble *MEDCouplingUMesh::getPartBarycenterAndOwner(const int *begin, c DataArrayDouble *MEDCouplingUMesh::computePlaneEquationOf3DFaces() const { MCAuto ret(DataArrayDouble::New()); - int nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes()); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); + int nbOfNodes(getNumberOfNodes()); if(getSpaceDimension()!=3 || getMeshDimension()!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::computePlaneEquationOf3DFaces : This method must be applied on a mesh having meshDimension equal 2 and a spaceDimension equal to 3 !"); ret->alloc(nbOfCells,4); @@ -6677,7 +6685,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::Build0DMeshFromCoords(DataArrayDouble *da) if(name.empty()) ret->setName("Mesh"); ret->setCoords(da); - int nbOfTuples(da->getNumberOfTuples()); + mcIdType nbOfTuples=ToIdType(da->getNumberOfTuples()); MCAuto c(DataArrayInt::New()),cI(DataArrayInt::New()); c->alloc(2*nbOfTuples,1); cI->alloc(nbOfTuples+1,1); @@ -6769,7 +6777,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshes(const std::vectorgetCoords(); if(coo) - spaceDim=coo->getNumberOfComponents(); + spaceDim=ToIdType(coo->getNumberOfComponents()); } if(spaceDim==-3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::MergeUMeshes : no spaceDim specified ! unable to perform merge !"); @@ -6840,7 +6848,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesOnSameCoords(const std::vectorgetMeshDimension()) throw INTERP_KERNEL::Exception("Mesh dimensions mismatches, FuseUMeshesOnSameCoords impossible !"); meshLgth+=(*iter)->getNodalConnectivityArrayLen(); - meshIndexLgth+=(*iter)->getNumberOfCells(); + meshIndexLgth+=ToIdType((*iter)->getNumberOfCells()); } MCAuto nodal=DataArrayInt::New(); nodal->alloc(meshLgth,1); @@ -6853,7 +6861,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesOnSameCoords(const std::vectorgetNodalConnectivity()->begin(); const int *index=(*iter)->getNodalConnectivityIndex()->begin(); - int nbOfCells=(*iter)->getNumberOfCells(); + mcIdType nbOfCells=ToIdType((*iter)->getNumberOfCells()); int meshLgth2=(*iter)->getNodalConnectivityArrayLen(); nodalPtr=std::copy(nod,nod+meshLgth2,nodalPtr); if(iter!=meshes.begin()) @@ -6906,7 +6914,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::FuseUMeshesOnSameCoords(const std::vectorgetNumberOfCells(); + mcIdType curNbOfCells=ToIdType(meshes[i]->getNumberOfCells()); tmp->alloc(curNbOfCells,1); std::copy(o2nPtr+offset,o2nPtr+offset+curNbOfCells,tmp->getPointer()); offset+=curNbOfCells; @@ -7010,7 +7018,7 @@ void MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(const std::vectorfindCommonTuples(eps,-1,comm,commI); MCAuto tmp1(comm),tmp2(commI); - int oldNbOfNodes=coo->getNumberOfTuples(); + mcIdType oldNbOfNodes=ToIdType(coo->getNumberOfTuples()); int newNbOfNodes; MCAuto o2n=DataArrayInt::ConvertIndexArrayToO2N(oldNbOfNodes,comm->begin(),commI->begin(),commI->end(),newNbOfNodes); if(oldNbOfNodes==newNbOfNodes) @@ -7046,7 +7054,7 @@ bool MEDCouplingUMesh::IsPolygonWellOriented(bool isQuadratic, const double *vec // Same algorithm as above but also using intermediate quadratic points. // (taking only linear points might lead to issues if the linearized version of the // polygon is not convex or self-intersecting ... see testCellOrientation4) - int hsz = sz/2; + std::size_t hsz = sz/2; for(std::size_t j=0;jfindIdFirstEqual(i) < 0) { comm1->pushBackSilent(i); - commI1->pushBackSilent(comm1->getNumberOfTuples()); + commI1->pushBackSilent(mcIdType(comm1->getNumberOfTuples())); } MCAuto comm1Auto(comm1),commI1Auto(commI1); const int *comm1Ptr=comm1->begin(); const int *commI1Ptr=commI1->begin(); - int nbOfGrps1=commI1Auto->getNumberOfTuples()-1; + mcIdType nbOfGrps1=ToIdType(commI1Auto->getNumberOfTuples())-1; res->pushBackSilent((int)INTERP_KERNEL::NORM_POLYHED); // for(int i=0;ifindIdFirstEqual(j) < 0) { comm2->pushBackSilent(j); - commI2->pushBackSilent(comm2->getNumberOfTuples()); + commI2->pushBackSilent(ToIdType(comm2->getNumberOfTuples())); } MCAuto comm2Auto(comm2),commI2Auto(commI2); const int *comm2Ptr=comm2->begin(); const int *commI2Ptr=commI2->begin(); - int nbOfGrps2=commI2Auto->getNumberOfTuples()-1; + mcIdType nbOfGrps2=ToIdType(commI2Auto->getNumberOfTuples())-1; for(int j=0;j mm4=mm3->buildSpreadZonesWithPoly(); const int *conn4=mm4->getNodalConnectivity()->begin(); const int *connI4=mm4->getNodalConnectivityIndex()->begin(); - int nbOfCells=mm4->getNumberOfCells(); + mcIdType nbOfCells=ToIdType(mm4->getNumberOfCells()); for(int k=0;k o2n(skin->zipCoordsTraducer()); int nbOfNodesExpected(skin->getNumberOfNodes()); MCAuto n2o(o2n->invertArrayO2N2N2O(oldNbOfNodes)); - int nbCells(skin->getNumberOfCells()); + mcIdType nbCells=ToIdType(skin->getNumberOfCells()); if(nbCells==nbOfNodesExpected) return buildUnionOf2DMeshLinear(skin,n2o); else if(2*nbCells==nbOfNodesExpected) @@ -7415,7 +7423,7 @@ DataArrayInt *MEDCouplingUMesh::buildUnionOf3DMesh() const MCAuto m=computeSkin(); const int *conn=m->getNodalConnectivity()->begin(); const int *connI=m->getNodalConnectivityIndex()->begin(); - int nbOfCells=m->getNumberOfCells(); + mcIdType nbOfCells=ToIdType(m->getNumberOfCells()); MCAuto ret=DataArrayInt::New(); ret->alloc(m->getNodalConnectivity()->getNumberOfTuples(),1); int *work=ret->getPointer(); *work++=INTERP_KERNEL::NORM_POLYHED; if(nbOfCells<1) @@ -7454,7 +7462,7 @@ MEDCouplingSkyLineArray* MEDCouplingUMesh::generateGraph() const const MEDCoupling::DataArrayInt* conn; conn=this->getNodalConnectivity(); // it includes a type as the 1st element!!! index=this->getNodalConnectivityIndex(); - int nbCells=this->getNumberOfCells(); + mcIdType nbCells=ToIdType(this->getNumberOfCells()); const int* index_ptr=index->begin(); const int* conn_ptr=conn->begin(); @@ -7508,7 +7516,7 @@ MEDCouplingSkyLineArray* MEDCouplingUMesh::generateGraph() const void MEDCouplingUMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const { - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); if(nbOfCells<=0) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::writeVTK : the unstructured mesh has no cells !"); ofs << " <" << getVTKDataSetType() << ">\n"; @@ -7565,7 +7573,7 @@ void MEDCouplingUMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData for(int i=0;iisAllocated()) { stream << std::endl << "Nodal connectivity set but not allocated !"; return ; } - int lgth=_nodal_connec_index->getNumberOfTuples(); - int cpt=_nodal_connec_index->getNumberOfComponents(); + mcIdType lgth=ToIdType(_nodal_connec_index->getNumberOfTuples()); + mcIdType cpt=ToIdType(_nodal_connec_index->getNumberOfComponents()); if(cpt!=1 || lgth<1) return ; stream << std::endl << "Number of cells : " << lgth-1 << "."; @@ -7652,7 +7660,7 @@ DataArrayInt *MEDCouplingUMesh::orderConsecutiveCells1D() const if (dsii->getNumberOfTuples()) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::orderConsecutiveCells1D only work with a mesh being a (piecewise) connected line!"); - int nc(getNumberOfCells()); + mcIdType nc=ToIdType(getNumberOfCells()); MCAuto result(DataArrayInt::New()); result->alloc(nc,1); @@ -7695,7 +7703,7 @@ DataArrayInt *MEDCouplingUMesh::orderConsecutiveCells1D() const } // Done, save final piece into DA: std::copy(linePiece.begin(), linePiece.end(), result->getPointer()+newIdx); - newIdx += linePiece.size(); + newIdx += ToIdType(linePiece.size()); // identify next valid start segment (one which is not consumed) if(!edgeSet.empty()) @@ -7878,7 +7886,7 @@ DataArrayInt *MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(const int *se nbOfDepthPeelingPerformed=0; if(!arrIndxIn) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed : arrIndxIn input pointer is NULL !"); - int nbOfTuples=arrIndxIn->getNumberOfTuples()-1; + mcIdType nbOfTuples=ToIdType(arrIndxIn->getNumberOfTuples())-1; if(nbOfTuples<=0) { DataArrayInt *ret=DataArrayInt::New(); ret->alloc(0,1); @@ -7930,7 +7938,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSpreadZonesWithPoly() const throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSpreadZonesWithPoly : meshdimension supported are [2,3] ! Not implemented yet for others !"); } - ret->insertNextCell((INTERP_KERNEL::NormalizedCellType)cell->getIJSafe(0,0),cell->getNumberOfTuples()-1,cell->begin()+1); + ret->insertNextCell((INTERP_KERNEL::NormalizedCellType)cell->getIJSafe(0,0),ToIdType(cell->getNumberOfTuples())-1,cell->begin()+1); } // ret->finishInsertingCells(); @@ -7955,7 +7963,7 @@ std::vector MEDCouplingUMesh::PartitionBySpreadZone(const DataAr if(!arrIn || !arrIndxIn) throw INTERP_KERNEL::Exception("PartitionBySpreadZone : null input pointers !"); arrIn->checkAllocated(); arrIndxIn->checkAllocated(); - int nbOfTuples(arrIndxIn->getNumberOfTuples()); + mcIdType nbOfTuples=ToIdType(arrIndxIn->getNumberOfTuples()); if(arrIn->getNumberOfComponents()!=1 || arrIndxIn->getNumberOfComponents()!=1 || nbOfTuples<1) throw INTERP_KERNEL::Exception("PartitionBySpreadZone : invalid arrays in input !"); int nbOfCellsCur(nbOfTuples-1); @@ -8030,7 +8038,8 @@ MEDCoupling1SGTUMesh *MEDCouplingUMesh::tetrahedrize(int policy, DataArrayInt *& checkConnectivityFullyDefined(); if(getMeshDimension()!=3 || getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::tetrahedrize : only available for mesh with meshdim == 3 and spacedim == 3 !"); - int nbOfCells(getNumberOfCells()),nbNodes(getNumberOfNodes()); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); + int nbNodes(getNumberOfNodes()); MCAuto ret0(MEDCoupling1SGTUMesh::New(getName(),INTERP_KERNEL::NORM_TETRA4)); MCAuto ret(DataArrayInt::New()); ret->alloc(nbOfCells,1); int *retPt(ret->getPointer()); @@ -8059,7 +8068,7 @@ MEDCoupling1SGTUMesh *MEDCouplingUMesh::tetrahedrize(int policy, DataArrayInt *& if(!addPts->empty()) { addPts->rearrange(3); - nbOfAdditionalPoints=addPts->getNumberOfTuples(); + nbOfAdditionalPoints=ToIdType(addPts->getNumberOfTuples()); addPts=DataArrayDouble::Aggregate(getCoords(),addPts); ret0->setCoords(addPts); } @@ -8081,7 +8090,7 @@ MEDCouplingUMeshCellIterator::MEDCouplingUMeshCellIterator(MEDCouplingUMesh *mes if(mesh) { mesh->incrRef(); - _nb_cell=mesh->getNumberOfCells(); + _nb_cell=ToIdType(mesh->getNumberOfCells()); } } @@ -8164,7 +8173,7 @@ MEDCouplingUMeshCellByTypeIterator::MEDCouplingUMeshCellByTypeIterator(MEDCoupli if(mesh) { mesh->incrRef(); - _nb_cell=mesh->getNumberOfCells(); + _nb_cell=ToIdType(mesh->getNumberOfCells()); } } diff --git a/src/MEDCoupling/MEDCouplingUMesh.txx b/src/MEDCoupling/MEDCouplingUMesh.txx index 581cd29ca..919372afb 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.txx +++ b/src/MEDCoupling/MEDCouplingUMesh.txx @@ -29,7 +29,7 @@ void MEDCoupling::MEDCouplingUMesh::renumberNodesInConnT(const MAPCLS& newNodeNu checkConnectivityFullyDefined(); int *conn(getNodalConnectivity()->getPointer()); const int *connIndex(getNodalConnectivityIndex()->getConstPointer()); - int nbOfCells(getNumberOfCells()); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); for(int i=0;igetConstPointer(); const int *ci=_nodal_connec_index->getConstPointer(); for(int i=0;i ret=DataArrayInt::New(); - int nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4); + mcIdType nbOfCutCells=ToIdType(getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4)); ret->alloc(nbOfCells+nbOfCutCells,1); if(nbOfCutCells==0) { ret->iota(0); return ret.retn(); } int *retPt=ret->getPointer(); @@ -151,9 +151,9 @@ DataArrayInt *MEDCouplingUMesh::simplexizePol1() checkConnectivityFullyDefined(); if(getMeshDimension()!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplexizePol0 : this policy is only available for mesh with meshdim == 2 !"); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); MCAuto ret=DataArrayInt::New(); - int nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4); + mcIdType nbOfCutCells=ToIdType(getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4)); ret->alloc(nbOfCells+nbOfCutCells,1); if(nbOfCutCells==0) { ret->iota(0); return ret.retn(); } int *retPt=ret->getPointer(); @@ -204,9 +204,9 @@ DataArrayInt *MEDCouplingUMesh::simplexizePlanarFace5() checkConnectivityFullyDefined(); if(getMeshDimension()!=3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplexizePlanarFace5 : this policy is only available for mesh with meshdim == 3 !"); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); MCAuto ret=DataArrayInt::New(); - int nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8); + mcIdType nbOfCutCells=ToIdType(getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8)); ret->alloc(nbOfCells+4*nbOfCutCells,1); if(nbOfCutCells==0) { ret->iota(0); return ret.retn(); } int *retPt=ret->getPointer(); @@ -256,9 +256,9 @@ DataArrayInt *MEDCouplingUMesh::simplexizePlanarFace6() checkConnectivityFullyDefined(); if(getMeshDimension()!=3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplexizePlanarFace6 : this policy is only available for mesh with meshdim == 3 !"); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); MCAuto ret=DataArrayInt::New(); - int nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8); + mcIdType nbOfCutCells=ToIdType(getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8)); ret->alloc(nbOfCells+5*nbOfCutCells,1); if(nbOfCutCells==0) { ret->iota(0); return ret.retn(); } int *retPt=ret->getPointer(); @@ -349,7 +349,7 @@ void MEDCouplingUMesh::tessellate2DCurveInternal(double eps) if(epsa::min()) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::tessellate2DCurveInternal : epsilon is null ! Please specify a higher epsilon. If too tiny it can lead to a huge amount of nodes and memory !"); INTERP_KERNEL::QuadraticPlanarPrecision arcPrec(1.e-10); // RAII - int nbCells=getNumberOfCells(); + mcIdType nbCells=ToIdType(getNumberOfCells()); int nbNodes=getNumberOfNodes(); const int *conn=_nodal_connec->begin(); const int *connI=_nodal_connec_index->begin(); @@ -425,7 +425,7 @@ void MEDCouplingUMesh::subDivide2DMesh(const int *nodeSubdived, const int *nodeI checkFullyDefined(); if(getMeshDimension()!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::subDivide2DMesh : works only on umesh with meshdim==2 !"); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); int *connI=_nodal_connec_index->getPointer(); int newConnLgth=0; for(int i=0;i=0 && *workgetConstPointer(); const int *connIndex=getNodalConnectivityIndex()->getConstPointer(); for(int i=0;igetNumberOfCells(); + mcIdType nbOf1DCells=ToIdType(mesh1D->getNumberOfCells()); int spaceDim=getSpaceDimension(); DataArrayDouble *ret=DataArrayDouble::New(); std::vector isQuads; @@ -671,7 +671,7 @@ DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation2D(con if(isQuad) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation2D : not implemented for quadratic cells !"); int oldNbOfNodes=getNumberOfNodes(); - int nbOf1DCells=mesh1D->getNumberOfCells(); + mcIdType nbOf1DCells=ToIdType(mesh1D->getNumberOfCells()); if(nbOf1DCells<2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation2D : impossible to detect any angle of rotation ! Change extrusion policy 1->0 !"); MCAuto ret=DataArrayDouble::New(); @@ -715,7 +715,7 @@ DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation3D(con if(isQuad) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation3D : not implemented for quadratic cells !"); int oldNbOfNodes=getNumberOfNodes(); - int nbOf1DCells=mesh1D->getNumberOfCells(); + mcIdType nbOf1DCells=ToIdType(mesh1D->getNumberOfCells()); if(nbOf1DCells<2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation3D : impossible to detect any angle of rotation ! Change extrusion policy 1->0 !"); MCAuto ret=DataArrayDouble::New(); @@ -780,7 +780,7 @@ DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation3D(con MEDCouplingUMesh *MEDCouplingUMesh::buildExtrudedMeshFromThisLowLev(int nbOfNodesOf1Lev, bool isQuad) const { int nbOf1DCells(getNumberOfNodes()/nbOfNodesOf1Lev-1); - int nbOf2DCells(getNumberOfCells()); + mcIdType nbOf2DCells=ToIdType(getNumberOfCells()); int nbOf3DCells(nbOf2DCells*nbOf1DCells); MEDCouplingUMesh *ret(MEDCouplingUMesh::New("Extruded",getMeshDimension()+1)); const int *conn(_nodal_connec->begin()),*connI(_nodal_connec_index->begin()); @@ -868,7 +868,7 @@ bool MEDCouplingUMesh::AreCellsEqualInPool(const std::vector& candidates, i MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoords(const int *begin, const int *end) const { checkConnectivityFullyDefined(); - int ncell=getNumberOfCells(); + mcIdType ncell=ToIdType(getNumberOfCells()); MCAuto ret=MEDCouplingUMesh::New(); ret->_mesh_dim=_mesh_dim; ret->setCoords(_coords); @@ -914,7 +914,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoords(const int *begin MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) const { checkFullyDefined(); - int ncell=getNumberOfCells(); + mcIdType ncell=ToIdType(getNumberOfCells()); MCAuto ret=MEDCouplingUMesh::New(); ret->_mesh_dim=_mesh_dim; ret->setCoords(_coords); @@ -982,7 +982,7 @@ DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic1D0(DataArrayInt *& MCAuto newConn=DataArrayInt::New(); newConn->alloc(0,1); MCAuto newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0); MCAuto ret=DataArrayInt::New(); ret->alloc(0,1); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); int nbOfNodes=getNumberOfNodes(); const int *cPtr=_nodal_connec->begin(); const int *icPtr=_nodal_connec_index->begin(); @@ -1028,7 +1028,7 @@ DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic2DAnd3D0(const MEDC MCAuto conn1DSafe(conn1D),conn1DISafe(conn1DI); const int *c1DPtr=conn1D->begin(); const int *c1DIPtr=conn1DI->begin(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); const int *cPtr=_nodal_connec->begin(); const int *icPtr=_nodal_connec_index->begin(); int lastVal=0; @@ -1090,10 +1090,11 @@ DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic2D1(DataArrayInt *& MCAuto conn1DSafe(conn1D),conn1DISafe(conn1DI); const int *c1DPtr=conn1D->begin(); const int *c1DIPtr=conn1DI->begin(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); const int *cPtr=_nodal_connec->begin(); const int *icPtr=_nodal_connec_index->begin(); - int lastVal=0,offset=coordsTmpSafe->getNumberOfTuples(); + int lastVal=0; + mcIdType offset=ToIdType(coordsTmpSafe->getNumberOfTuples()); for(int i=0;ipushBackValsSilent(cPtr+icPtr[0]+1,cPtr+icPtr[1]); for(const int *d=descPtr+descIPtr[0];d!=descPtr+descIPtr[1];d++) newConn->pushBackSilent(c1DPtr[c1DIPtr[*d]+3]); - newConn->pushBackSilent(offset+ret->getNumberOfTuples()); + newConn->pushBackSilent(offset+ToIdType(ret->getNumberOfTuples())); lastVal+=(icPtr[1]-icPtr[0])+(descIPtr[1]-descIPtr[0])+1; newConnI->pushBackSilent(lastVal); ret->pushBackSilent(i); @@ -1158,10 +1159,11 @@ DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic3D1(DataArrayInt *& MCAuto coordsTmp2Safe(coordsTmp2); MCAuto conn2DSafe(conn2D),conn2DISafe(conn2DI); const int *c1DPtr=conn1D->begin(),*c1DIPtr=conn1DI->begin(),*c2DPtr=conn2D->begin(),*c2DIPtr=conn2DI->begin(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); const int *cPtr=_nodal_connec->begin(); const int *icPtr=_nodal_connec_index->begin(); - int lastVal=0,offset=coordsTmpSafe->getNumberOfTuples(); + int lastVal=0; + mcIdType offset=ToIdType(coordsTmpSafe->getNumberOfTuples()); for(int i=0;igetNumberOfTuples(); + mcIdType tmpPos=ToIdType(newConn->getNumberOfTuples()); newConn->pushBackSilent(nodeId2); ret2D->pushBackSilent(nodeId2); ret1D->pushBackSilent(tmpPos); } - newConn->pushBackSilent(offset+ret->getNumberOfTuples()); + newConn->pushBackSilent(offset+ToIdType(ret->getNumberOfTuples())); lastVal+=(icPtr[1]-icPtr[0])+(descIPtr[1]-descIPtr[0])+(desc2IPtr[1]-desc2IPtr[0])+1; newConnI->pushBackSilent(lastVal); ret->pushBackSilent(i); @@ -1199,7 +1201,7 @@ DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic3D1(DataArrayInt *& } } MCAuto diffRet2D=ret2D->getDifferentValues(); - MCAuto o2nRet2D=diffRet2D->invertArrayN2O2O2N(coordsTmp2Safe->getNumberOfTuples()); + MCAuto o2nRet2D=diffRet2D->invertArrayN2O2O2N(ToIdType(coordsTmp2Safe->getNumberOfTuples())); coordsTmp2Safe=coordsTmp2Safe->selectByTupleId(diffRet2D->begin(),diffRet2D->end()); MCAuto tmp=bary->selectByTupleIdSafe(ret->begin(),ret->end()); std::vector v(3); v[0]=coordsTmpSafe; v[1]=coordsTmp2Safe; v[2]=tmp; @@ -1207,7 +1209,7 @@ DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic3D1(DataArrayInt *& const int *cI(newConnI->begin()); for(const int *elt=ret1D->begin();elt!=ret1D->end();elt++) c[*elt]=o2nRet2D->getIJ(c[*elt],0)+offset; - offset=coordsTmp2Safe->getNumberOfTuples(); + offset=ToIdType(coordsTmp2Safe->getNumberOfTuples()); for(const int *elt=ret->begin();elt!=ret->end();elt++) c[cI[(*elt)+1]-1]+=offset; coords=DataArrayDouble::Aggregate(v); conn=newConn.retn(); connI=newConnI.retn(); @@ -1312,13 +1314,13 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesLL(const std::vector::const_iterator it=a.begin(); int meshDim=(*it)->getMeshDimension(); - int nbOfCells=(*it)->getNumberOfCells(); + mcIdType nbOfCells=ToIdType((*it)->getNumberOfCells()); int meshLgth=(*it++)->getNodalConnectivityArrayLen(); for(;it!=a.end();it++) { if(meshDim!=(*it)->getMeshDimension()) throw INTERP_KERNEL::Exception("Mesh dimensions mismatches, MergeUMeshes impossible !"); - nbOfCells+=(*it)->getNumberOfCells(); + nbOfCells+=ToIdType((*it)->getNumberOfCells()); meshLgth+=(*it)->getNodalConnectivityArrayLen(); } std::vector aps(a.size()); @@ -1337,7 +1339,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesLL(const std::vectorgetNumberOfCells(); + mcIdType curNbOfCell=ToIdType((*it)->getNumberOfCells()); const int *curCI=(*it)->_nodal_connec_index->begin(); const int *curC=(*it)->_nodal_connec->begin(); cIPtr=std::transform(curCI+1,curCI+curNbOfCell+1,cIPtr,std::bind2nd(std::plus(),offset)); @@ -1438,7 +1440,7 @@ DataArrayInt *MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeedAlg(std::vecto nbOfDepthPeelingPerformed=0; if(!seedBg || !seedEnd || !arrIn || !arrIndxIn) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeedAlg : some input pointer is NULL !"); - int nbOfTuples=arrIndxIn->getNumberOfTuples()-1; + mcIdType nbOfTuples=ToIdType(arrIndxIn->getNumberOfTuples())-1; std::vector fetched2(nbOfTuples,false); int i=0; for(const int *seedElt=seedBg;seedElt!=seedEnd;seedElt++,i++) @@ -1675,7 +1677,7 @@ void MEDCouplingUMesh::assemblyForSplitFrom3DSurf(const std::vector< std::pairbegin()),*nodalIndx3D(_nodal_connec_index->begin()); - int nbOfCells(getNumberOfCells()); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); for(int i=0;i > m; @@ -1735,7 +1737,7 @@ void MEDCouplingUMesh::assemblyForSplitFrom3DSurf(const std::vector< std::pair3) { nodalRes->insertAtTheEnd(conn.begin(),conn.end()); - nodalResIndx->pushBackSilent(nodalRes->getNumberOfTuples()); + nodalResIndx->pushBackSilent(ToIdType(nodalRes->getNumberOfTuples())); cellIds->pushBackSilent(i); } } @@ -1748,7 +1750,7 @@ void MEDCouplingUMesh::ComputeAllTypesInternal(std::setbegin()),*connIndex(nodalConnecIndex->begin()); - int nbOfElem(nodalConnecIndex->getNbOfElems()-1); + mcIdType nbOfElem=ToIdType(nodalConnecIndex->getNbOfElems())-1; if(nbOfElem>0) for(const int *pt=connIndex;pt!=connIndex+nbOfElem;pt++) types.insert((INTERP_KERNEL::NormalizedCellType)conn[*pt]); @@ -1794,14 +1796,14 @@ void MEDCouplingUMesh::attractSeg3MidPtsAroundNodesUnderground(double ratio, con int spaceDim(getSpaceDimension()); double *coords(getCoords()->getPointer()); auto nbNodes(getNumberOfNodes()); - auto nbCells(getNumberOfCells()); + std::size_t nbCells(getNumberOfCells()); std::vector fastFinder(nbNodes,false); for(auto work=nodeIdsBg;work!=nodeIdsEnd;work++) if(*work>=0 && *work cellsIds(getCellIdsLyingOnNodes(nodeIdsBg,nodeIdsEnd,false)); const int *nc(_nodal_connec->begin()),*nci(_nodal_connec_index->begin()); - for(auto cellId=0;cellIdgetPointer()); MCAuto bboxArr(getBoundingBoxForBBTree(eps)); const double *bbox(bboxArr->begin()); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); const int *conn=_nodal_connec->getConstPointer(); const int *connI=_nodal_connec_index->getConstPointer(); double bb[2*SPACEDIM]; @@ -172,7 +172,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildDescendingConnectivityGen(DataArrayInt if(!desc || !descIndx || !revDesc || !revDescIndx) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildDescendingConnectivityGen : present of a null pointer in input !"); checkConnectivityFullyDefined(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); int nbOfNodes=getNumberOfNodes(); MCAuto revNodalIndx=DataArrayInt::New(); revNodalIndx->alloc(nbOfNodes+1,1); revNodalIndx->fillWithZero(); int *revNodalIndxPtr=revNodalIndx->getPointer(); @@ -205,7 +205,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildDescendingConnectivityGen(DataArrayInt } descIndxPtr[0]=descIndxPtr[-1]+(int)nbOfSons; } - int nbOfCellsM1=ret->getNumberOfCells(); + mcIdType nbOfCellsM1=ToIdType(ret->getNumberOfCells()); std::transform(revNodalIndxPtr+1,revNodalIndxPtr+nbOfNodes+1,revNodalIndxPtr,revNodalIndxPtr+1,std::plus()); MCAuto revNodal=DataArrayInt::New(); revNodal->alloc(revNodalIndx->back(),1); std::fill(revNodal->getPointer(),revNodal->getPointer()+revNodalIndx->back(),-1); diff --git a/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx b/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx index f2df4a04f..010b8b273 100644 --- a/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx @@ -89,7 +89,7 @@ void EnterTheResultOf2DCellFirst(const INTERP_KERNEL::Edge *e, int start, int st { if(stp-start>1) { - int tmp2(0),tmp3(appendedCoords->getNumberOfTuples()/2); + mcIdType tmp2(0),tmp3(ToIdType(appendedCoords->getNumberOfTuples())/2); InternalAddPointOriented(e,-1,coords,tmp[1],tmp[2],*appendedCoords,tmp2); middles.push_back(tmp3+offset); } @@ -106,7 +106,7 @@ void EnterTheResultOf2DCellMiddle(const INTERP_KERNEL::Edge *e, int start, int s { if(stp-start>1) { - int tmp2(0),tmp3(appendedCoords->getNumberOfTuples()/2); + mcIdType tmp2(0),tmp3(ToIdType(appendedCoords->getNumberOfTuples())/2); InternalAddPointOriented(e,-1,coords,tmpSrt,tmpEnd,*appendedCoords,tmp2); middles.push_back(tmp3+offset); } @@ -122,8 +122,8 @@ void EnterTheResultOf2DCellEnd(const INTERP_KERNEL::Edge *e, int start, int stp, { if(stp-start>1) // if we are covering more than one segment we need to create a new mid point { - int tmpSrt(connBg[start]),tmpEnd(connBg[stp % nbOfEdges]); // % to handle last seg. - int tmp2(0),tmp3(appendedCoords->getNumberOfTuples()/2); + mcIdType tmpSrt(connBg[start]),tmpEnd(connBg[stp % nbOfEdges]); // % to handle last seg. + mcIdType tmp2(0),tmp3(ToIdType(appendedCoords->getNumberOfTuples())/2); InternalAddPointOriented(e,-1,coords,tmpSrt,tmpEnd,*appendedCoords,tmp2); middles.push_back(tmp3+offset); } @@ -379,16 +379,16 @@ bool MEDCouplingUMesh::Colinearize2DCell(const double *coords, const int *connBg INTERP_KERNEL::AutoPtr tmpConn(new int[sz]); INTERP_KERNEL::AutoPtr tmpConn2(new int[sz]); const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)connBg[0])); - unsigned nbs(cm.getNumberOfSons2(connBg+1,sz)); + std::size_t nbs(cm.getNumberOfSons2(connBg+1,ToIdType(sz))); unsigned nbOfHit(0); // number of fusions operated int posBaseElt(0),posEndElt(0),nbOfTurn(0); - const unsigned int maxNbOfHit = cm.isQuadratic() ? nbs-2 : nbs-3; // a quad cell is authorized to end up with only two edges, a linear one has to keep 3 at least + const std::size_t maxNbOfHit = cm.isQuadratic() ? nbs-2 : nbs-3; // a quad cell is authorized to end up with only two edges, a linear one has to keep 3 at least INTERP_KERNEL::NormalizedCellType typeOfSon; std::vector middles; bool ret(false); for(;(nbOfTurn+nbOfHit),int> m; INTERP_KERNEL::Edge *e(MEDCouplingUMeshBuildQPFromEdge2(typeOfSon,tmpConn,coords,m)); posEndElt = posBaseElt+1; @@ -399,7 +399,7 @@ bool MEDCouplingUMesh::Colinearize2DCell(const double *coords, const int *connBg { for(unsigned i=1;i >& subDiv, std::vector< std::vector >& intersectEdge) { int offset1=m1->getNumberOfNodes(); - int ncell2=m2->getNumberOfCells(); + mcIdType ncell2=ToIdType(m2->getNumberOfCells()); const int *c=m2->getNodalConnectivity()->begin(); const int *cI=m2->getNodalConnectivityIndex()->begin(); const double *coo=m2->getCoords()->begin(); @@ -561,15 +561,15 @@ MEDCouplingUMesh *BuildMesh1DCutFrom(const MEDCouplingUMesh *mesh1D, const std:: { idsInRetColinear=DataArrayInt::New(); idsInRetColinear->alloc(0,1); idsInMesh1DForIdsInRetColinear=DataArrayInt::New(); idsInMesh1DForIdsInRetColinear->alloc(0,1); - int nCells(mesh1D->getNumberOfCells()); + mcIdType nCells=ToIdType(mesh1D->getNumberOfCells()); if(nCells!=(int)intersectEdge2.size()) throw INTERP_KERNEL::Exception("BuildMesh1DCutFrom : internal error # 1 !"); const DataArrayDouble *coo2(mesh1D->getCoords()); const int *c(mesh1D->getNodalConnectivity()->begin()),*ci(mesh1D->getNodalConnectivityIndex()->begin()); const double *coo2Ptr(coo2->begin()); - int offset1(coords1->getNumberOfTuples()); - int offset2(offset1+coo2->getNumberOfTuples()); - int offset3(offset2+addCoo.size()/2); + mcIdType offset1=ToIdType(coords1->getNumberOfTuples()); + mcIdType offset2=(offset1+ToIdType(coo2->getNumberOfTuples())); + mcIdType offset3(offset2+ToIdType(addCoo.size())/2); std::vector addCooQuad; MCAuto cOut(DataArrayInt::New()),ciOut(DataArrayInt::New()); cOut->alloc(0,1); ciOut->alloc(1,1); ciOut->setIJ(0,0,0); int tmp[4],cicnt(0),kk(0); @@ -578,7 +578,7 @@ MEDCouplingUMesh *BuildMesh1DCutFrom(const MEDCouplingUMesh *mesh1D, const std:: std::map,int> m; INTERP_KERNEL::Edge *e(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)c[ci[i]],c+ci[i]+1,coo2Ptr,m)); const std::vector& subEdges(intersectEdge2[i]); - int nbSubEdge(subEdges.size()/2); + mcIdType nbSubEdge=ToIdType(subEdges.size()/2); for(int j=0;j n1(MEDCouplingUMeshBuildQPNode(subEdges[2*j],coords1->begin(),offset1,coo2Ptr,offset2,addCoo)),n2(MEDCouplingUMeshBuildQPNode(subEdges[2*j+1],coords1->begin(),offset1,coo2Ptr,offset2,addCoo)); @@ -652,7 +652,7 @@ MEDCouplingUMesh *BuildRefined2DCellLinear(const DataArrayDouble *coords, const std::vector connOut(nbOfEdgesOf2DCellSplit); for(std::size_t kk=0;kkinsertNextCell(INTERP_KERNEL::NORM_POLYGON,connOut.size(),&connOut[0]); + ret->insertNextCell(INTERP_KERNEL::NORM_POLYGON,ToIdType(connOut.size()),&connOut[0]); return ret.retn(); } @@ -660,7 +660,7 @@ MEDCouplingUMesh *BuildRefined2DCellQuadratic(const DataArrayDouble *coords, con { const int *c(mesh2D->getNodalConnectivity()->begin()),*ci(mesh2D->getNodalConnectivityIndex()->begin()); const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)c[ci[cellIdInMesh2D]])); - std::size_t ii(0); + mcIdType ii(0); unsigned sz(cm.getNumberOfSons2(c+ci[cellIdInMesh2D]+1,ci[cellIdInMesh2D+1]-ci[cellIdInMesh2D]-1)); if(sz!=std::distance(descBg,descEnd)) throw INTERP_KERNEL::Exception("BuildRefined2DCellQuadratic : internal error 1 !"); @@ -668,7 +668,7 @@ MEDCouplingUMesh *BuildRefined2DCellQuadratic(const DataArrayDouble *coords, con std::vector allEdges,centers; const double *coordsPtr(coords->begin()); MCAuto addCoo(DataArrayDouble::New()); addCoo->alloc(0,1); - int offset(coords->getNumberOfTuples()); + mcIdType offset=ToIdType(coords->getNumberOfTuples()); for(const int *it2(descBg);it2!=descEnd;it2++,ii++) { INTERP_KERNEL::NormalizedCellType typeOfSon; @@ -682,11 +682,11 @@ MEDCouplingUMesh *BuildRefined2DCellQuadratic(const DataArrayDouble *coords, con centers.push_back(tmpPtr[2]);//special case where no subsplit of edge -> reuse the original center. else {//the current edge has been subsplit -> create corresponding centers. - std::size_t nbOfCentersToAppend(edge1.size()/2); + mcIdType nbOfCentersToAppend=ToIdType(edge1.size()/2); std::map< MCAuto,int> m; MCAuto ee(MEDCouplingUMeshBuildQPFromEdge2(typeOfSon,tmpPtr,coordsPtr,m)); std::vector::const_iterator it3(allEdges.end()-edge1.size()); - for(std::size_t k=0;kinsertNextCell(INTERP_KERNEL::NORM_QPOLYG,connOut.size(),&connOut[0]); + ret->insertNextCell(INTERP_KERNEL::NORM_QPOLYG,ToIdType(connOut.size()),&connOut[0]); return ret.retn(); } @@ -744,7 +744,7 @@ void AddCellInMesh2D(MEDCouplingUMesh *mesh2D, const std::vector& conn, con isQuad=true; } if(!isQuad) - mesh2D->insertNextCell(INTERP_KERNEL::NORM_POLYGON,conn.size(),&conn[0]); + mesh2D->insertNextCell(INTERP_KERNEL::NORM_POLYGON,ToIdType(conn.size()),&conn[0]); else { const double *coo(mesh2D->getCoords()->begin()); @@ -762,7 +762,7 @@ void AddCellInMesh2D(MEDCouplingUMesh *mesh2D, const std::vector& conn, con mesh2D->getCoords()->rearrange(1); mesh2D->getCoords()->pushBackValsSilent(&addCoo[0],&addCoo[0]+addCoo.size()); mesh2D->getCoords()->rearrange(2); - mesh2D->insertNextCell(INTERP_KERNEL::NORM_QPOLYG,conn2.size(),&conn2[0]); + mesh2D->insertNextCell(INTERP_KERNEL::NORM_QPOLYG,ToIdType(conn2.size()),&conn2[0]); } } @@ -777,7 +777,7 @@ void BuildMesh2DCutInternal2(const MEDCouplingUMesh *splitMesh1D, const std::vec { std::size_t nb(edge1Bis.size()/2); std::size_t nbOfEdgesOf2DCellSplit(nb/2); - int iEnd(splitMesh1D->getNumberOfCells()); + mcIdType iEnd=ToIdType(splitMesh1D->getNumberOfCells()); if(iEnd==0) throw INTERP_KERNEL::Exception("BuildMesh2DCutInternal2 : internal error ! input 1D mesh must have at least one cell !"); std::size_t ii,jj; @@ -983,26 +983,26 @@ void VectorOfCellInfo::setMeshAt(std::size_t pos, const MCAuto const MCAuto& mesh1DInCase, const std::vector< std::vector >& edges, const std::vector< std::vector< MCAuto > >& edgePtrs) { - get(pos);//to check pos + get(ToIdType(pos));//to check pos bool isFast(pos==0 && _pool.size()==1); std::size_t sz(edges.size()); // dealing with edges if(sz==1) _edge_info.push_back(EdgeInfo(istart,iend,mesh1DInCase)); else - _edge_info.push_back(EdgeInfo(istart,iend,pos,edgePtrs[0].back())); + _edge_info.push_back(EdgeInfo(istart,iend,ToIdType(pos),edgePtrs[0].back())); // std::vector pool(_pool.size()-1+sz); for(std::size_t i=0;i std::vector< MCAuto > ms; if(pos>0) { - MCAuto elt(static_cast(_ze_mesh->buildPartOfMySelfSlice(0,pos,true))); + MCAuto elt(static_cast(_ze_mesh->buildPartOfMySelfSlice(0,ToIdType(pos),true))); ms.push_back(elt); } ms.push_back(mesh); if(pos<_ze_mesh->getNumberOfCells()-1) { - MCAuto elt(static_cast(_ze_mesh->buildPartOfMySelfSlice(pos+1,_ze_mesh->getNumberOfCells(),true))); + MCAuto elt(static_cast(_ze_mesh->buildPartOfMySelfSlice(ToIdType(pos)+1,ToIdType(_ze_mesh->getNumberOfCells()),true))); ms.push_back(elt); } std::vector< const MEDCouplingUMesh *> ms2(ms.size()); @@ -1084,7 +1084,7 @@ CellInfo& VectorOfCellInfo::get(int pos) MEDCouplingUMesh *BuildMesh2DCutInternal(double eps, MEDCouplingUMesh *splitMesh1D, const std::vector& allEdges, const std::vector< MCAuto >& allEdgesPtr, int offset, MCAuto& idsLeftRight) { - int nbCellsInSplitMesh1D(splitMesh1D->getNumberOfCells()); + mcIdType nbCellsInSplitMesh1D=ToIdType(splitMesh1D->getNumberOfCells()); if(nbCellsInSplitMesh1D==0) throw INTERP_KERNEL::Exception("BuildMesh2DCutInternal : internal error ! input 1D mesh must have at least one cell !"); const int *cSplitPtr(splitMesh1D->getNodalConnectivity()->begin()),*ciSplitPtr(splitMesh1D->getNodalConnectivityIndex()->begin()); @@ -1291,12 +1291,12 @@ void MEDCouplingUMesh::Intersect1DMeshes(const MEDCouplingUMesh *m1Desc, const M // Build BB tree of all edges in the tool mesh (second mesh) MCAuto bbox1Arr(m1Desc->getBoundingBoxForBBTree(eps)),bbox2Arr(m2Desc->getBoundingBoxForBBTree(eps)); const double *bbox1(bbox1Arr->begin()),*bbox2(bbox2Arr->begin()); - int nDescCell1(m1Desc->getNumberOfCells()),nDescCell2(m2Desc->getNumberOfCells()); + mcIdType nDescCell1=ToIdType(m1Desc->getNumberOfCells()),nDescCell2=ToIdType(m2Desc->getNumberOfCells()); intersectEdge1.resize(nDescCell1); colinear2.resize(nDescCell2); subDiv2.resize(nDescCell2); - BBTree myTree(bbox2,0,0,m2Desc->getNumberOfCells(),-eps); - BBTreePts treeNodes2(m2Desc->getCoords()->begin(),0,0,m2Desc->getCoords()->getNumberOfTuples(),eps); + BBTree myTree(bbox2,0,0,ToIdType(m2Desc->getNumberOfCells()),-eps); + BBTreePts treeNodes2(m2Desc->getCoords()->begin(),0,0,ToIdType(m2Desc->getCoords()->getNumberOfTuples()),eps); std::vector candidates1(1); int offset1(m1Desc->getNumberOfNodes()); @@ -1393,8 +1393,8 @@ void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCo MCAuto bbox1Arr(m1->getBoundingBoxForBBTree(eps)),bbox2Arr(m2->getBoundingBoxForBBTree(eps)); const double *bbox1(bbox1Arr->begin()),*bbox2(bbox2Arr->begin()); // Here a BBTree on 2D-cells, not on segments: - BBTree myTree(bbox2,0,0,m2->getNumberOfCells(),eps); - int ncell1(m1->getNumberOfCells()); + BBTree myTree(bbox2,0,0,ToIdType(m2->getNumberOfCells()),eps); + mcIdType ncell1=ToIdType(m1->getNumberOfCells()); crI.push_back(0); for(int i=0;ibegin()),*nodalIndx3D(_nodal_connec_index->begin()); - int nbOfCells(getNumberOfCells()); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); if(nbOfCells!=1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSubCellsFromCut works only with single cell presently !"); - for(int i=0;igetNumberOfTuples()); + mcIdType ncells=ToIdType(getNumberOfCells()); + mcIdType lgthToReach(getNodalConnectivityArrayLen()+ToIdType(subNodesInSeg->getNumberOfTuples())); MCAuto c(DataArrayInt::New()); c->alloc((std::size_t)lgthToReach); const int *subPtr(subNodesInSeg->begin()),*subIPtr(subNodesInSegI->begin()),*descPtr(desc->begin()),*descIPtr(descI->begin()),*oldConn(getNodalConnectivity()->begin()); int *cPtr(c->getPointer()),*ciPtr(getNodalConnectivityIndex()->getPointer()); @@ -1604,7 +1605,9 @@ void MEDCouplingUMesh::split2DCellsLinear(const DataArrayInt *desc, const DataAr int MEDCouplingUMesh::split2DCellsQuadratic(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *subNodesInSeg, const DataArrayInt *subNodesInSegI, const DataArrayInt *mid, const DataArrayInt *midI) { checkConsistencyLight(); - int ncells(getNumberOfCells()),lgthToReach(getNodalConnectivityArrayLen()+2*subNodesInSeg->getNumberOfTuples()),nodesCnt(getNumberOfNodes()); + mcIdType ncells=ToIdType(getNumberOfCells()); + mcIdType lgthToReach(getNodalConnectivityArrayLen()+2*ToIdType(subNodesInSeg->getNumberOfTuples())); + mcIdType nodesCnt(getNumberOfNodes()); MCAuto c(DataArrayInt::New()); c->alloc((std::size_t)lgthToReach); MCAuto addCoo(DataArrayDouble::New()); addCoo->alloc(0,1); const int *subPtr(subNodesInSeg->begin()),*subIPtr(subNodesInSegI->begin()),*descPtr(desc->begin()),*descIPtr(descI->begin()),*oldConn(getNodalConnectivity()->begin()); @@ -1653,7 +1656,7 @@ int MEDCouplingUMesh::split2DCellsQuadratic(const DataArrayInt *desc, const Data addCoo->rearrange(2); MCAuto coo(DataArrayDouble::Aggregate(getCoords(),addCoo));//info are copied from getCoords() by using Aggregate setCoords(coo); - return addCoo->getNumberOfTuples(); + return ToIdType(addCoo->getNumberOfTuples()); } @@ -1811,7 +1814,7 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, MCAuto ret1(BuildMesh1DCutFrom(mesh1D,intersectEdge2,mesh2D->getCoords(),addCoo,mergedNodes,colinear2,intersectEdge1, idsInRet1Colinear,idsInDescMesh2DForIdsInRetColinear)); MCAuto ret3(DataArrayInt::New()); ret3->alloc(ret1->getNumberOfCells()*2,1); ret3->fillWithValue(std::numeric_limits::max()); ret3->rearrange(2); - MCAuto idsInRet1NotColinear(idsInRet1Colinear->buildComplement(ret1->getNumberOfCells())); + MCAuto idsInRet1NotColinear(idsInRet1Colinear->buildComplement(ToIdType(ret1->getNumberOfCells()))); // deal with cells in mesh2D that are not cut but only some of their edges are MCAuto idsInDesc2DToBeRefined(idsInDescMesh2DForIdsInRetColinear->deepCopy()); idsInDesc2DToBeRefined->abs(); idsInDesc2DToBeRefined->applyLin(1,-1); @@ -1830,7 +1833,7 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, MCAuto ret1NonCol(static_cast(ret1->buildPartOfMySelf(idsInRet1NotColinear->begin(),idsInRet1NotColinear->end()))); MCAuto baryRet1(ret1NonCol->computeCellCenterOfMass()); MCAuto elts,eltsIndex; - mesh2D->getCellsContainingPoints(baryRet1->begin(),baryRet1->getNumberOfTuples(),eps,elts,eltsIndex); + mesh2D->getCellsContainingPoints(baryRet1->begin(),ToIdType(baryRet1->getNumberOfTuples()),eps,elts,eltsIndex); MCAuto eltsIndex2(DataArrayInt::New()); eltsIndex2->alloc(0,1); if (eltsIndex->getNumberOfTuples() > 1) eltsIndex2 = eltsIndex->deltaShiftIndex(); @@ -1838,7 +1841,7 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, if(eltsIndex2->count(0)+eltsIndex3->getNumberOfTuples()!=ret1NonCol->getNumberOfCells()) throw INTERP_KERNEL::Exception("Intersect2DMeshWith1DLine : internal error 1 !"); MCAuto cellsToBeModified(elts->buildUnique()); - MCAuto untouchedCells(cellsToBeModified->buildComplement(mesh2D->getNumberOfCells())); + MCAuto untouchedCells(cellsToBeModified->buildComplement(ToIdType(mesh2D->getNumberOfCells()))); if((DataArrayInt *)out0s) untouchedCells=untouchedCells->buildSubstraction(out0s);//if some edges in ret1 are colinear to descending mesh of mesh2D remove cells from untouched one std::vector< MCAuto > outMesh2DSplit; @@ -1858,7 +1861,7 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, outMesh2DSplit.push_back(BuildRefined2DCell(ret1->getCoords(),mesh2D,*it,dptr+diptr[*it],dptr+diptr[*it+1],intersectEdge1)); ret1->setCoords(outMesh2DSplit.back()->getCoords()); } - int offset(ret2->getNumberOfTuples()); + mcIdType offset(ToIdType(ret2->getNumberOfTuples())); ret2->pushBackValsSilent(fewModifiedCells->begin(),fewModifiedCells->end()); MCAuto partOfRet3(DataArrayInt::New()); partOfRet3->alloc(2*idsInRet1Colinear->getNumberOfTuples(),1); partOfRet3->fillWithValue(std::numeric_limits::max()); partOfRet3->rearrange(2); @@ -1903,7 +1906,7 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, MCAuto idsNonColPerCell2(idsInRet1NotColinear->selectByTupleId(idsNonColPerCell->begin(),idsNonColPerCell->end())); MCAuto partOfMesh1CuttingCur2DCell(static_cast(ret1NonCol->buildPartOfMySelf(idsNonColPerCell->begin(),idsNonColPerCell->end()))); MCAuto partOfRet3; - MCAuto splitOfOneCell(BuildMesh2DCutFrom(eps,*it,m1Desc,partOfMesh1CuttingCur2DCell,dd1->begin()+dd2->getIJ(*it,0),dd1->begin()+dd2->getIJ((*it)+1,0),intersectEdge1,ret2->getNumberOfTuples(),partOfRet3)); + MCAuto splitOfOneCell(BuildMesh2DCutFrom(eps,*it,m1Desc,partOfMesh1CuttingCur2DCell,dd1->begin()+dd2->getIJ(*it,0),dd1->begin()+dd2->getIJ((*it)+1,0),intersectEdge1,ToIdType(ret2->getNumberOfTuples()),partOfRet3)); ret3->setPartOfValues3(partOfRet3,idsNonColPerCell2->begin(),idsNonColPerCell2->end(),0,2,1,true); outMesh2DSplit.push_back(splitOfOneCell); for(std::size_t i=0;igetNumberOfCells();i++) @@ -1969,7 +1972,7 @@ DataArrayInt *MEDCouplingUMesh::conformize2D(double eps) const int *c(mDesc->getNodalConnectivity()->begin()),*ci(mDesc->getNodalConnectivityIndex()->begin()),*rd(revDesc1->begin()),*rdi(revDescIndx1->begin()); MCAuto bboxArr(mDesc->getBoundingBoxForBBTree(eps)); const double *bbox(bboxArr->begin()),*coords(getCoords()->begin()); - int nCell(getNumberOfCells()),nDescCell(mDesc->getNumberOfCells()); + mcIdType nCell=ToIdType(getNumberOfCells()),nDescCell=ToIdType(mDesc->getNumberOfCells()); std::vector< std::vector > intersectEdge(nDescCell),overlapEdge(nDescCell); std::vector addCoo; BBTree myTree(bbox,0,0,nDescCell,-eps); @@ -2122,7 +2125,7 @@ DataArrayInt *MEDCouplingUMesh::internalColinearize2D(double eps, bool stayConfo if(getSpaceDimension()!=2 || getMeshDimension()!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::colinearize2D : This method only works for meshes with spaceDim=2 and meshDim=2 !"); INTERP_KERNEL::QuadraticPlanarPrecision prec(eps); - int nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes()); + mcIdType nbOfCells(ToIdType(getNumberOfCells())),nbOfNodes(getNumberOfNodes()); const int *cptr(_nodal_connec->begin()),*ciptr(_nodal_connec_index->begin()); MCAuto newc(DataArrayInt::New()),newci(DataArrayInt::New()); newci->alloc(nbOfCells+1,1); newc->alloc(0,1); newci->setIJ(0,0,0); std::map forbiddenPoints; // list of points that can not be removed (or it will break conformity) @@ -2147,7 +2150,7 @@ DataArrayInt *MEDCouplingUMesh::internalColinearize2D(double eps, bool stayConfo { if(Colinearize2DCell(coords,cptr+ciptr[0],cptr+ciptr[1],nbOfNodes,forbiddenPoints, /*out*/ newc,appendedCoords)) ret->pushBackSilent(i); - newciptr[1]=newc->getNumberOfTuples(); + newciptr[1]=ToIdType(newc->getNumberOfTuples()); } // if(ret->empty()) @@ -2235,7 +2238,7 @@ void MEDCouplingUMesh::ReplaceEdgeInFace(const int * sIdxConn, const int * sIdxC const std::vector& insidePoints, std::vector& modifiedFace) { using namespace std; - int dst = distance(sIdxConn, sIdxConnE); + mcIdType dst = ToIdType(distance(sIdxConn, sIdxConnE)); modifiedFace.reserve(dst + insidePoints.size()-2); modifiedFace.resize(dst); copy(sIdxConn, sIdxConnE, modifiedFace.data()); @@ -2247,7 +2250,7 @@ void MEDCouplingUMesh::ReplaceEdgeInFace(const int * sIdxConn, const int * sIdxC vector::iterator endPos = find(modifiedFace.begin(),shortEnd, endNode); if (endPos == shortEnd) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ReplaceEdgeInFace: internal error, should never happen!"); - int d = distance(startPos, endPos); + mcIdType d = ToIdType(distance(startPos, endPos)); if (d == 1 || d == (1-dst)) // don't use modulo, for neg numbers, result is implementation defined ... modifiedFace.insert(++startPos, ++insidePoints.begin(), --insidePoints.end()); // insidePoints also contains start and end node. Those don't need to be inserted. else @@ -2305,7 +2308,7 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) // Build BBTree MCAuto bboxArr(mDesc->getBoundingBoxForBBTree(eps)); const double *bbox(bboxArr->begin()); getCoords()->begin(); - int nDescCell(mDesc->getNumberOfCells()); + mcIdType nDescCell=ToIdType(mDesc->getNumberOfCells()); BBTree myTree(bbox,0,0,nDescCell,-eps); // Surfaces - handle biggest first MCAuto surfF = mDesc->getMeasureField(true); @@ -2317,7 +2320,7 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) // Sort faces by decreasing surface: vector< pair > S; - for(std::size_t i=0;i < surfs->getNumberOfTuples();i++) + for(mcIdType i=0;i < ToIdType(surfs->getNumberOfTuples());i++) { pair p = make_pair(surfs->begin()[i], i); S.push_back(p); @@ -2373,7 +2376,7 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) MCAuto baryPartXY = baryPart->keepSelectedComponents(compo); mPartRef->changeSpaceDimension(2,0.0); MCAuto cc(DataArrayInt::New()), ccI(DataArrayInt::New()); - mPartRef->getCellsContainingPoints(baryPartXY->begin(), baryPartXY->getNumberOfTuples(), eps, cc, ccI); + mPartRef->getCellsContainingPoints(baryPartXY->begin(), ToIdType(baryPartXY->getNumberOfTuples()), eps, cc, ccI); if (!cc->getNumberOfTuples()) continue; @@ -2475,7 +2478,7 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) const int *cDesc2(mDesc2->getNodalConnectivity()->begin()),*cIDesc2(mDesc2->getNodalConnectivityIndex()->begin()); MCAuto bboxArr(mDesc2->getBoundingBoxForBBTree(eps)); const double *bbox2(bboxArr->begin()); - int nDesc2Cell=mDesc2->getNumberOfCells(); + mcIdType nDesc2Cell=ToIdType(mDesc2->getNumberOfCells()); BBTree myTree2(bbox2,0,0,nDesc2Cell,-eps); // Edges - handle longest first @@ -2484,7 +2487,7 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) // Sort edges by decreasing length: vector > S; - for(std::size_t i=0;i < lens->getNumberOfTuples();i++) + for(mcIdType i=0;i < ToIdType(lens->getNumberOfTuples());i++) { pair p = make_pair(lens->getIJ(i, 0), i); S.push_back(p); @@ -2533,7 +2536,7 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) int nbElemsNotM1; { MCAuto tmp(nodeMap->findIdsNotEqual(-1)); - nbElemsNotM1 = tmp->getNbOfElems(); + nbElemsNotM1 = ToIdType(tmp->getNbOfElems()); } MCAuto nodeMapInv = nodeMap->invertArrayO2N2N2O(nbElemsNotM1); double * cooPartRef(mPartRef->_coords->getPointer()); @@ -2598,7 +2601,8 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) MCAuto idx(DataArrayInt::New()); idx->alloc(1); idx->fillWithValue(0); MCAuto vals(DataArrayInt::New()); vals->alloc(0); newConn->set3(superIdx, idx, vals); - for(std::size_t ii = 0; ii < getNumberOfCells(); ii++) + mcIdType nbCells=ToIdType(getNumberOfCells()); + for(mcIdType ii = 0; ii < nbCells; ii++) for (int jj=descIP[ii]; jj < descIP[ii+1]; jj++) { int sz, faceIdx = abs(descP[jj])-1; diff --git a/src/MEDCoupling/MEDCouplingVoronoi.cxx b/src/MEDCoupling/MEDCouplingVoronoi.cxx old mode 100644 new mode 100755 index 573099051..37deab6a6 --- a/src/MEDCoupling/MEDCouplingVoronoi.cxx +++ b/src/MEDCoupling/MEDCouplingVoronoi.cxx @@ -108,7 +108,7 @@ MCAuto MergeVorCells2D(MEDCouplingUMesh *p, double eps, bool i if(isZip) { skinOfRes->zipCoords(); - if(skinOfRes->getNumberOfCells()!=skinOfRes->getNumberOfNodes()) + if(ToIdType(skinOfRes->getNumberOfCells())!=skinOfRes->getNumberOfNodes()) throw INTERP_KERNEL::Exception("MergeVorCells : result of merge looks bad !"); } MCAuto d(skinOfRes->orderConsecutiveCells1D()); @@ -126,7 +126,7 @@ MCAuto MergeVorCells2D(MEDCouplingUMesh *p, double eps, bool i MCAuto m(MEDCouplingUMesh::New("",2)); m->setCoords(skinOfRes2->getCoords()); m->allocateCells(); - m->insertNextCell(INTERP_KERNEL::NORM_POLYGON,vdi[0]->getNumberOfTuples(),vdi[0]->begin()); + m->insertNextCell(INTERP_KERNEL::NORM_POLYGON,ToIdType(vdi[0]->getNumberOfTuples()),vdi[0]->begin()); return m; } @@ -180,7 +180,7 @@ MCAuto SimplifyPolygon(const MEDCouplingUMesh *m, double eps) MCAuto ret(MEDCouplingUMesh::New("",2)); ret->setCoords(m->getCoords()); ret->allocateCells(); - ret->insertNextCell(INTERP_KERNEL::NORM_POLYGON,resConn.size(),&resConn[0]); + ret->insertNextCell(INTERP_KERNEL::NORM_POLYGON,ToIdType(resConn.size()),&resConn[0]); return ret; } @@ -223,7 +223,7 @@ MCAuto MergeVorCells3D(const std::vector< MCAutoallocateCells(); std::vector conn; int jj(0); - for(int i=0;igetNumberOfTuples()-1;i++,jj++) + for(int i=0;igetNumberOfTuples())-1;i++,jj++) { if(jj!=0) conn.push_back(-1); @@ -237,18 +237,18 @@ MCAuto MergeVorCells3D(const std::vector< MCAutogetNodalConnectivity()->begin()),*ciPtr(tmp2->getNodalConnectivityIndex()->begin()); conn.insert(conn.end(),cPtr+1,cPtr+ciPtr[1]); } - MCAuto remain(comm->buildComplement(skinOfRes->getNumberOfCells())); + MCAuto remain(comm->buildComplement(ToIdType(skinOfRes->getNumberOfCells()))); { MCAuto tmp(skinOfRes->buildPartOfMySelf(remain->begin(),remain->end(),true)); const int *cPtr(tmp->getNodalConnectivity()->begin()),*ciPtr(tmp->getNodalConnectivityIndex()->begin()); - for(int i=0;igetNumberOfTuples();i++,jj++) + for(std::size_t i=0;igetNumberOfTuples();i++,jj++) { if(jj!=0) conn.push_back(-1); conn.insert(conn.end(),cPtr+ciPtr[i]+1,cPtr+ciPtr[i+1]); } } - ret->insertNextCell(INTERP_KERNEL::NORM_POLYHED,conn.size(),&conn[0]); + ret->insertNextCell(INTERP_KERNEL::NORM_POLYHED,ToIdType(conn.size()),&conn[0]); return ret; } @@ -292,7 +292,7 @@ MCAuto MEDCoupling::Voronizer1D::doIt(const MEDCouplingUMesh * throw INTERP_KERNEL::Exception("Voronoize1D : spacedim must be equal to 1 and meshdim also equal to 1 !"); if(m->getNumberOfCells()!=1) throw INTERP_KERNEL::Exception("Voronoize1D : mesh is expected to have only one cell !"); - int nbPts(points->getNumberOfTuples()); + mcIdType nbPts=ToIdType(points->getNumberOfTuples()); if(nbPts<1) throw INTERP_KERNEL::Exception("Voronoize1D : at least one point expected !"); std::vector bbox(4); @@ -373,7 +373,7 @@ MCAuto MEDCoupling::Voronizer2D::doIt(const MEDCouplingUMesh * throw INTERP_KERNEL::Exception("Voronoize2D : spacedim must be equal to 2 and meshdim also equal to 2 !"); if(m->getNumberOfCells()!=1) throw INTERP_KERNEL::Exception("Voronoize2D : mesh is expected to have only one cell !"); - int nbPts(points->getNumberOfTuples()); + mcIdType nbPts=ToIdType(points->getNumberOfTuples()); if(nbPts<1) throw INTERP_KERNEL::Exception("Voronoize2D : at least one point expected !"); std::vector bbox(4); @@ -418,7 +418,7 @@ MCAuto MEDCoupling::Voronizer2D::doIt(const MEDCouplingUMesh * throw INTERP_KERNEL::Exception("Voronoize2D : internal error"); MCAuto newVorCell; { - MCAuto tmp(part->buildComplement(a->getNumberOfCells())); + MCAuto tmp(part->buildComplement(ToIdType(a->getNumberOfCells()))); newVorCell=a->buildPartOfMySelf(tmp->begin(),tmp->end()); } newVorCell->zipCoords(); @@ -440,7 +440,7 @@ MCAuto MEDCoupling::Voronizer2D::doIt(const MEDCouplingUMesh * newCoords=a->getCoords()->selectByTupleId(tmp->begin(),tmp->end()); } const double *cPtr(newCoords->begin()); - for(int j=0;jgetNumberOfTuples();j++,cPtr+=2) + for(std::size_t j=0;jgetNumberOfTuples();j++,cPtr+=2) { std::set zeCandidates; { @@ -487,7 +487,7 @@ MCAuto MEDCoupling::Voronizer3D::doIt(const MEDCouplingUMesh * throw INTERP_KERNEL::Exception("Voronoize3D : spacedim must be equal to 3 and meshdim also equal to 3 !"); if(m->getNumberOfCells()!=1) throw INTERP_KERNEL::Exception("Voronoize3D : mesh is expected to have only one cell !"); - int nbPts(points->getNumberOfTuples()); + mcIdType nbPts=ToIdType(points->getNumberOfTuples()); if(nbPts<1) throw INTERP_KERNEL::Exception("Voronoize3D : at least one point expected !"); std::vector< MCAuto > l0(1,MCAuto(m->deepCopy())); @@ -510,7 +510,7 @@ MCAuto MEDCoupling::Voronizer3D::doIt(const MEDCouplingUMesh * if(polygsToIterOn.size()<1) throw INTERP_KERNEL::Exception("Voronoize3D : presence of a point outside the given cell !"); std::vector< MCAuto > newVorCells; - for(int poly=0;polygetNumberOfCells();poly++) + for(int poly=0;polygetNumberOfCells());poly++) { const double *seed(pts+3*poly); MCAuto tile(l0[poly]); @@ -521,7 +521,7 @@ MCAuto MEDCoupling::Voronizer3D::doIt(const MEDCouplingUMesh * { cells=Split3DCellInParts(tile,pt,seed,eps,tmp); } - catch(INTERP_KERNEL::Exception& e) + catch(INTERP_KERNEL::Exception&) { continue; } diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest0.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest0.cxx index 1ee95f1ae..91184f47a 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest0.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest0.cxx @@ -1629,7 +1629,7 @@ MEDCouplingUMesh* MEDCouplingBasicsTest::build3D2DTetraTargetMesh(const double i int MEDCouplingBasicsTest::countNonZero(const std::vector< std::map >& matrix) { - int ret=0.; + int ret=0; for(std::vector< std::map >::const_iterator iter=matrix.begin();iter!=matrix.end();iter++) for(std::map::const_iterator iter2=(*iter).begin();iter2!=(*iter).end();iter2++) if (!INTERP_KERNEL::epsilonEqual((*iter2).second, 0.)) ret +=1; diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx index 65b3a6c5e..bcaf814dc 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx @@ -1219,7 +1219,7 @@ void MEDCouplingBasicsTest1::testFindCommonNodes() // targetMesh=build3DTargetMesh_1(); bool areNodesMerged; - unsigned int time=targetMesh->getTimeOfThis(); + std::size_t time=targetMesh->getTimeOfThis(); o2n=targetMesh->mergeNodes(1e-10,areNodesMerged,newNbOfNodes); targetMesh->updateTime(); CPPUNIT_ASSERT(time==targetMesh->getTimeOfThis()); @@ -1818,7 +1818,7 @@ void MEDCouplingBasicsTest1::testOperationsOnFields3() void MEDCouplingBasicsTest1::testOperationsOnFields4() { MEDCouplingUMesh *m=build2DTargetMesh_1(); - int nbOfCells=m->getNumberOfCells(); + std::size_t nbOfCells=m->getNumberOfCells(); MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,CONST_ON_TIME_INTERVAL); f1->setMesh(m); DataArrayDouble *array=DataArrayDouble::New(); @@ -2234,13 +2234,13 @@ void MEDCouplingBasicsTest1::testGetValueOn1() { MEDCouplingUMesh *targetMesh=build2DTargetMesh_1(); MEDCouplingFieldDouble *fieldOnCells=MEDCouplingFieldDouble::New(ON_CELLS); - int nbOfCells=targetMesh->getNumberOfCells(); + std::size_t nbOfCells=targetMesh->getNumberOfCells(); fieldOnCells->setMesh(targetMesh); DataArrayDouble *array=DataArrayDouble::New(); array->alloc(nbOfCells,2); fieldOnCells->setArray(array); double *tmp=array->getPointer(); - for(int i=0;idecrRef(); // diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx index 8fdca210a..cd7ca7559 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx @@ -636,8 +636,8 @@ void MEDCouplingBasicsTest2::testRenumberCellsForFields() MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME); f->setMesh(m); DataArrayDouble *arr=DataArrayDouble::New(); - int nbOfCells=m->getNumberOfCells(); - arr->alloc(nbOfCells,3); + + arr->alloc(m->getNumberOfCells(),3); f->setArray(arr); arr->decrRef(); const double values1[15]={7.,107.,10007.,8.,108.,10008.,9.,109.,10009.,10.,110.,10010.,11.,111.,10011.}; @@ -883,13 +883,13 @@ void MEDCouplingBasicsTest2::testCheckGeoEquivalWith() bool isExcep=false; try { mesh1->checkGeoEquivalWith(mesh2,0,1e-12,cellCor,nodeCor);//deepEqual fails } - catch(INTERP_KERNEL::Exception& e) { isExcep=true; } + catch(INTERP_KERNEL::Exception&) { isExcep=true; } CPPUNIT_ASSERT(isExcep); isExcep=false; CPPUNIT_ASSERT(cellCor==0); CPPUNIT_ASSERT(nodeCor==0); try { mesh1->checkGeoEquivalWith(mesh2,1,1e-12,cellCor,nodeCor);//fastEqual has detected something } - catch(INTERP_KERNEL::Exception& e) { isExcep=true; } + catch(INTERP_KERNEL::Exception&) { isExcep=true; } CPPUNIT_ASSERT(isExcep); isExcep=false; CPPUNIT_ASSERT(cellCor==0); CPPUNIT_ASSERT(nodeCor==0); @@ -931,7 +931,7 @@ void MEDCouplingBasicsTest2::testCheckGeoEquivalWith2() void MEDCouplingBasicsTest2::testCopyTinyStringsFromOnFields() { MEDCouplingUMesh *m=build3DSurfTargetMesh_1(); - int nbOfCells=m->getNumberOfCells(); + std::size_t nbOfCells=m->getNumberOfCells(); MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,LINEAR_TIME); f->setMesh(m); CPPUNIT_ASSERT_EQUAL(5,f->getNumberOfMeshPlacesExpected()); @@ -1107,7 +1107,7 @@ void MEDCouplingBasicsTest2::testChangeUnderlyingMesh1() void MEDCouplingBasicsTest2::testGetMaxValue1() { MEDCouplingUMesh *m=build3DSurfTargetMesh_1(); - int nbOfCells=m->getNumberOfCells(); + std::size_t nbOfCells=m->getNumberOfCells(); MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,LINEAR_TIME); f->setMesh(m); DataArrayDouble *a1=DataArrayDouble::New(); diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx index 550dfd02e..743fef5d5 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx @@ -734,7 +734,7 @@ void MEDCouplingBasicsTest4::testGetValueOn2() MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME); f->setMesh(m); DataArrayDouble *arr=DataArrayDouble::New(); - int nbOfCells=m->getNumberOfCells(); + std::size_t nbOfCells=m->getNumberOfCells(); arr->alloc(nbOfCells,3); f->setArray(arr); arr->decrRef(); -- 2.39.2