From b231689b0f4a4d9e593390d5d9c16da25d97ac5b Mon Sep 17 00:00:00 2001 From: emv Date: Wed, 9 Oct 2019 10:06:26 +0300 Subject: [PATCH] Avoid size_t to int conversion in MEDCoupling Avoid signed/unsigned comparison in MEDCouplingMemArray --- .../Barycentric3DIntersectorP1P1.txx | 4 +- .../Bases/InterpKernelHashTable.hxx | 2 +- src/INTERP_KERNEL/CellModel.cxx | 16 +- src/INTERP_KERNEL/ConvexIntersector.txx | 8 +- src/INTERP_KERNEL/CurveIntersector.txx | 2 +- src/INTERP_KERNEL/Geometric2DIntersector.txx | 10 +- src/INTERP_KERNEL/Interpolation2D1D.txx | 2 +- src/INTERP_KERNEL/InterpolationCC.txx | 6 +- src/INTERP_KERNEL/InterpolationCU.txx | 2 +- src/INTERP_KERNEL/InterpolationCurve.txx | 2 +- src/INTERP_KERNEL/InterpolationPlanar.txx | 2 +- src/INTERP_KERNEL/InterpolationUtils.hxx | 12 +- src/INTERP_KERNEL/IntersectorCU.txx | 4 +- .../MappedBarycentric2DIntersectorP1P1.txx | 4 +- .../MappedBarycentric3DIntersectorP1P1.txx | 4 +- src/INTERP_KERNEL/PlanarIntersector.txx | 2 +- src/INTERP_KERNEL/PlanarIntersectorP0P1.txx | 2 +- .../PlanarIntersectorP0P1Bary.txx | 2 +- src/INTERP_KERNEL/PlanarIntersectorP0P1PL.txx | 6 +- src/INTERP_KERNEL/PlanarIntersectorP1P0.txx | 2 +- .../PlanarIntersectorP1P0Bary.txx | 2 +- src/INTERP_KERNEL/PlanarIntersectorP1P0PL.txx | 2 +- src/INTERP_KERNEL/PlanarIntersectorP1P1.txx | 6 +- src/INTERP_KERNEL/PlanarIntersectorP1P1PL.txx | 4 +- .../PointLocator2DIntersector.txx | 2 +- .../PointLocator3DIntersectorP0P0.txx | 4 +- .../PointLocator3DIntersectorP0P1.txx | 4 +- .../PointLocator3DIntersectorP1P0.txx | 4 +- .../PointLocator3DIntersectorP1P1.txx | 4 +- src/INTERP_KERNEL/PolygonAlgorithms.txx | 4 +- src/INTERP_KERNEL/SplitterTetra.txx | 6 +- .../TriangulationIntersector.txx | 8 +- src/MEDCoupling/MCType.hxx | 10 +- src/MEDCoupling/MEDCoupling1GTUMesh.cxx | 146 ++-- src/MEDCoupling/MEDCoupling1GTUMesh.txx | 4 +- src/MEDCoupling/MEDCouplingCMesh.cxx | 26 +- .../MEDCouplingCartesianAMRMesh.cxx | 18 +- .../MEDCouplingCurveLinearMesh.cxx | 33 +- .../MEDCouplingFieldDiscretization.cxx | 88 +-- src/MEDCoupling/MEDCouplingFieldDouble.cxx | 30 +- src/MEDCoupling/MEDCouplingFieldT.txx | 6 +- .../MEDCouplingGaussLocalization.cxx | 4 +- src/MEDCoupling/MEDCouplingIMesh.cxx | 26 +- .../MEDCouplingMappedExtrudedMesh.cxx | 35 +- src/MEDCoupling/MEDCouplingMatrix.cxx | 4 +- src/MEDCoupling/MEDCouplingMemArray.cxx | 667 +++++++++--------- src/MEDCoupling/MEDCouplingMemArray.hxx | 10 +- src/MEDCoupling/MEDCouplingMemArray.txx | 291 ++++---- src/MEDCoupling/MEDCouplingMemArrayChar.cxx | 88 +-- src/MEDCoupling/MEDCouplingMemArrayFloat.cxx | 8 +- src/MEDCoupling/MEDCouplingMesh.cxx | 4 +- .../MEDCouplingNormalizedCartesianMesh.hxx | 4 +- .../MEDCouplingNormalizedCartesianMesh.txx | 4 +- .../MEDCouplingNormalizedUnstructuredMesh.txx | 12 +- src/MEDCoupling/MEDCouplingPartDefinition.cxx | 2 +- src/MEDCoupling/MEDCouplingPointSet.cxx | 24 +- src/MEDCoupling/MEDCouplingRemapper.cxx | 24 +- src/MEDCoupling/MEDCouplingSkyLineArray.cxx | 34 +- src/MEDCoupling/MEDCouplingSkyLineArray.hxx | 6 +- src/MEDCoupling/MEDCouplingStructuredMesh.cxx | 42 +- .../MEDCouplingTimeDiscretization.cxx | 13 +- .../MEDCouplingTimeDiscretization.txx | 14 +- src/MEDCoupling/MEDCouplingUMesh.cxx | 291 ++++---- src/MEDCoupling/MEDCouplingUMesh.txx | 2 +- src/MEDCoupling/MEDCouplingUMesh_internal.cxx | 76 +- src/MEDCoupling/MEDCouplingUMesh_internal.hxx | 6 +- .../MEDCouplingUMesh_intersection.cxx | 120 ++-- src/MEDCoupling/MEDCouplingVoronoi.cxx | 18 +- 68 files changed, 1200 insertions(+), 1134 deletions(-) diff --git a/src/INTERP_KERNEL/Barycentric3DIntersectorP1P1.txx b/src/INTERP_KERNEL/Barycentric3DIntersectorP1P1.txx index 6b0bdf5cf..e108f95e0 100644 --- a/src/INTERP_KERNEL/Barycentric3DIntersectorP1P1.txx +++ b/src/INTERP_KERNEL/Barycentric3DIntersectorP1P1.txx @@ -56,7 +56,7 @@ namespace INTERP_KERNEL std::vector CoordsT; const ConnType *startOfCellNodeConnT=Intersector3DP1P1::getStartConnOfTargetCell(targetCell); Intersector3DP1P1::getRealTargetCoordinates(OTT::indFC(targetCell),CoordsT); - int nbOfNodesT=CoordsT.size()/SPACEDIM; + mcIdType nbOfNodesT=ToIdType(CoordsT.size())/SPACEDIM; const double *coordsS=Intersector3DP1P1::_src_mesh.getCoordinatesPtr(); for(int nodeIdT=0;nodeIdT 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],ToIdType(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..c30667b37 100644 --- a/src/INTERP_KERNEL/Bases/InterpKernelHashTable.hxx +++ b/src/INTERP_KERNEL/Bases/InterpKernelHashTable.hxx @@ -206,7 +206,7 @@ namespace INTERP_KERNEL }; inline unsigned long - __stl_next_prime(unsigned long __n) + __stl_next_prime(std::size_t __n) { const unsigned long* __first = __stl_prime_list; const unsigned long* __last = __stl_prime_list + (int)_S_num_primes; diff --git a/src/INTERP_KERNEL/CellModel.cxx b/src/INTERP_KERNEL/CellModel.cxx index 585675205..3cb12a8ad 100644 --- a/src/INTERP_KERNEL/CellModel.cxx +++ b/src/INTERP_KERNEL/CellModel.cxx @@ -463,7 +463,7 @@ namespace INTERP_KERNEL else if(_dim==1) return lgth;//NORM_POLYL else - return std::count(conn,conn+lgth,-1)+1; + return static_cast(std::count(conn,conn+lgth,-1))+1; } unsigned CellModel::getNumberOfEdgesIn3D(const int *conn, int lgth) const @@ -471,7 +471,7 @@ namespace INTERP_KERNEL if(!isDynamic()) return _nb_of_little_sons; else//polyhedron - return (lgth-std::count(conn,conn+lgth,-1))/2; + return static_cast(lgth-std::count(conn,conn+lgth,-1))/2; } /*! @@ -591,7 +591,7 @@ namespace INTERP_KERNEL } const int *where2=std::find(where,nodalConn+lgth,-1); std::copy(where,where2,sonNodalConn); - return where2-where; + return static_cast(where2-where); } else throw INTERP_KERNEL::Exception("CellModel::fillSonCellNodalConnectivity2 : no sons on NORM_POLYL !"); @@ -753,7 +753,7 @@ namespace INTERP_KERNEL where++; } const int *where2=std::find(where,nodalConn+lgth,-1); - return where2-where; + return static_cast(where2-where); } else throw INTERP_KERNEL::Exception("CellModel::getNumberOfNodesConstituentTheSon2 : no sons on NORM_POLYL !"); @@ -792,7 +792,7 @@ namespace INTERP_KERNEL std::vector::iterator it=std::copy(conn1,conn1+lgth/2,tmp.begin()); std::copy(conn1,conn1+lgth/2,it); it=std::search(tmp.begin(),tmp.end(),conn2,conn2+lgth/2); - int d=std::distance(tmp.begin(),it); + std::ptrdiff_t d=std::distance(tmp.begin(),it); if(it==tmp.end()) return false; it=std::copy(conn1+lgth/2,conn1+lgth,tmp.begin()); @@ -800,7 +800,7 @@ namespace INTERP_KERNEL it=std::search(tmp.begin(),tmp.end(),conn2,conn2+lgth); if(it==tmp.end()) return false; - int d2=std::distance(tmp.begin(),it); + std::ptrdiff_t d2=std::distance(tmp.begin(),it); return d==d2; } else @@ -810,7 +810,7 @@ namespace INTERP_KERNEL std::vector::iterator it=std::copy(conn1,conn1+p,tmp.begin()); std::copy(conn1,conn1+p,it); it=std::search(tmp.begin(),tmp.end(),conn2,conn2+p); - int d=std::distance(tmp.begin(),it); + std::ptrdiff_t d=std::distance(tmp.begin(),it); if(it==tmp.end()) return false; tmp.resize(2*p-2); @@ -819,7 +819,7 @@ namespace INTERP_KERNEL it=std::search(tmp.begin(),tmp.end(),conn2+p,conn2+lgth); if(it==tmp.end()) return false; - int d2=std::distance(tmp.begin(),it); + std::ptrdiff_t d2=std::distance(tmp.begin(),it); return d==d2; } } diff --git a/src/INTERP_KERNEL/ConvexIntersector.txx b/src/INTERP_KERNEL/ConvexIntersector.txx index 98e30ec7a..87bf1c9d2 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); + ToIdType(CoordsT.size())/SPACEDIM, ToIdType(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; + mcIdType nbOfNodesS=ToIdType(sourceCoords.size())/SPACEDIM; + mcIdType nbOfNodesT=ToIdType(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..51b8fb0bf 100644 --- a/src/INTERP_KERNEL/CurveIntersector.txx +++ b/src/INTERP_KERNEL/CurveIntersector.txx @@ -159,7 +159,7 @@ namespace INTERP_KERNEL void CurveIntersector::adjustBoundingBoxes (std::vector& bbox, double adjustmentEpsAbs) { - long size = bbox.size()/(2*SPACEDIM); + mcIdType size = ToIdType(bbox.size())/(2*SPACEDIM); for (int i=0; i nodes2(nbOfSourceNodes); for(int i=0;i& targetCoords, const std::vector& sourceCoords) { - int nbOfTargetNodes=targetCoords.size()/SPACEDIM; + mcIdType nbOfTargetNodes=ToIdType(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; + mcIdType nbNodes=ToIdType(coords.size())/SPACEDIM; std::vector nodes(nbNodes); for(int i=0;igetElemBB(bb,myMeshT,OTT::indFC(iT),nb_nodesT); my_tree.getIntersectingElems(bb, intersecting_elems); intersector->intersectCells(iT,intersecting_elems,result); - counter+=intersecting_elems.size(); + counter+=ToIdType(intersecting_elems.size()); intersecting_elems.clear(); } int ret=intersector->getNumberOfColsOfResMatrix(); diff --git a/src/INTERP_KERNEL/InterpolationCC.txx b/src/INTERP_KERNEL/InterpolationCC.txx index ecbd29210..4b34e41a1 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 = ToIdType(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 ] = ToIdType(src_mesh.nbCellsAlongAxis( _TMI( j ))); + tgt_nb_cells[ j ] = ToIdType(tgt_mesh.nbCellsAlongAxis( _TMI( j ))); } // ============================================ diff --git a/src/INTERP_KERNEL/InterpolationCU.txx b/src/INTERP_KERNEL/InterpolationCU.txx index a202ec305..080e06c9d 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] = ToIdType(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.txx b/src/INTERP_KERNEL/InterpolationCurve.txx index 097f8d04e..33864ac18 100644 --- a/src/INTERP_KERNEL/InterpolationCurve.txx +++ b/src/INTERP_KERNEL/InterpolationCurve.txx @@ -195,7 +195,7 @@ namespace INTERP_KERNEL intersector->getElemBB(bb,myMeshT,OTT::indFC(iT),nb_nodesT); my_tree.getIntersectingElems(bb, intersecting_elems); intersector->intersectCells(iT,intersecting_elems,result); - counter += intersecting_elems.size(); + counter += ToIdType(intersecting_elems.size()); } int ret = intersector->getNumberOfColsOfResMatrix(); delete intersector; diff --git a/src/INTERP_KERNEL/InterpolationPlanar.txx b/src/INTERP_KERNEL/InterpolationPlanar.txx index eb969ea3b..c18d1b5f3 100644 --- a/src/INTERP_KERNEL/InterpolationPlanar.txx +++ b/src/INTERP_KERNEL/InterpolationPlanar.txx @@ -407,7 +407,7 @@ namespace INTERP_KERNEL intersector->getElemBB(bb,myMeshT,OTT::indFC(iT),nb_nodesT); my_tree.getIntersectingElems(bb, intersecting_elems); intersector->intersectCells(iT,intersecting_elems,result); - counter+=intersecting_elems.size(); + counter+=ToIdType(intersecting_elems.size()); intersecting_elems.clear(); } int ret=intersector->getNumberOfColsOfResMatrix(); diff --git a/src/INTERP_KERNEL/InterpolationUtils.hxx b/src/INTERP_KERNEL/InterpolationUtils.hxx index f40bd3351..e7b205539 100644 --- a/src/INTERP_KERNEL/InterpolationUtils.hxx +++ b/src/INTERP_KERNEL/InterpolationUtils.hxx @@ -197,11 +197,11 @@ 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& 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 CoordsT; PlanarIntersector::getRealTargetCoordinates(OTT::indFC(icellT),CoordsT); - int nbOfNodesT=CoordsT.size()/SPACEDIM; + mcIdType nbOfNodesT=ToIdType(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],ToIdType(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; + mcIdType nbOfNodesT=ToIdType(CoordsT.size())/SPACEDIM; const double *coordsS=Intersector3DP1P1::_src_mesh.getCoordinatesPtr(); for(int nodeIdT=0;nodeIdT 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],ToIdType(connOfCurCellS.size()),coordsS,cmTypeS,_precision) ) { double mco[3]; // mapped coordinates in the hexa8 std::vector localCoordsS; diff --git a/src/INTERP_KERNEL/PlanarIntersector.txx b/src/INTERP_KERNEL/PlanarIntersector.txx index 22ac30f91..e3eca61db 100644 --- a/src/INTERP_KERNEL/PlanarIntersector.txx +++ b/src/INTERP_KERNEL/PlanarIntersector.txx @@ -132,7 +132,7 @@ namespace INTERP_KERNEL { /* We build the segment tree for locating possible matching intersections*/ - long size = bbox.size()/(2*SPACEDIM); + mcIdType size = ToIdType(bbox.size())/(2*SPACEDIM); for (int i=0; i::max(); diff --git a/src/INTERP_KERNEL/PlanarIntersectorP0P1.txx b/src/INTERP_KERNEL/PlanarIntersectorP0P1.txx index 67d7f7913..b38680ec9 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP0P1.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP0P1.txx @@ -79,7 +79,7 @@ namespace INTERP_KERNEL fillDualCellOfTri(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,ToIdType(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 index 444e09670..cb034b33e 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP0P1Bary.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP0P1Bary.txx @@ -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; + mcIdType srcNbNodes = ToIdType(srcCellCoords.size())/SPACEDIM; if(SPACEDIM==3) { srcCellCoordsTmp=srcCellCoords; diff --git a/src/INTERP_KERNEL/PlanarIntersectorP0P1PL.txx b/src/INTERP_KERNEL/PlanarIntersectorP0P1PL.txx index 94631a14c..f35853505 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; + mcIdType nbNodesT=ToIdType(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],ToIdType(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],ToIdType(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..e2f953742 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,ToIdType(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 index b63d9f50b..3278d1e32 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.txx @@ -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; + mcIdType tgtNbNodes = ToIdType(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..59bc9d847 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],ToIdType(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..95c3d9920 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],ToIdType(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],ToIdType(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],ToIdType(polygDualS.size())/SPACEDIM,ToIdType(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..3cf5c2fec 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; + mcIdType nbOfNodesT=ToIdType(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],ToIdType(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; + mcIdType nbNodes=ToIdType(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],ToIdType(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],ToIdType(connOfCurCellS.size()),coordsS,cmTypeS,_precision)) { resRow.insert(std::make_pair(OTT::indFC(*iterCellS),1)); } diff --git a/src/INTERP_KERNEL/PointLocator3DIntersectorP0P1.txx b/src/INTERP_KERNEL/PointLocator3DIntersectorP0P1.txx index f96e28852..356dd6ff2 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; + mcIdType nbNodesT=ToIdType(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++) @@ -65,7 +65,7 @@ namespace INTERP_KERNEL 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],ToIdType(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.txx b/src/INTERP_KERNEL/PointLocator3DIntersectorP1P0.txx index 44956c078..da1c10b1a 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],ToIdType(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],ToIdType(connOfCurCellS.size()),coordsS,cmTypeS,_precision) ) { double resLoc[4]; std::vector srcCell; diff --git a/src/INTERP_KERNEL/PointLocator3DIntersectorP1P1.txx b/src/INTERP_KERNEL/PointLocator3DIntersectorP1P1.txx index c587e0102..fb43df3ea 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; + mcIdType nbOfNodesT=ToIdType(CoordsT.size())/SPACEDIM; const double *coordsS=Intersector3DP1P1::_src_mesh.getCoordinatesPtr(); for(typename std::vector::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++) { @@ -68,7 +68,7 @@ namespace INTERP_KERNEL typename MyMatrix::value_type& resRow=res[OTT::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],ToIdType(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..511db406a 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 = ToIdType(_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 = ToIdType(_Status.count(i_glob)); } } return _Inter; diff --git a/src/INTERP_KERNEL/SplitterTetra.txx b/src/INTERP_KERNEL/SplitterTetra.txx index 83b2628f9..daad39504 100644 --- a/src/INTERP_KERNEL/SplitterTetra.txx +++ b/src/INTERP_KERNEL/SplitterTetra.txx @@ -909,7 +909,7 @@ namespace INTERP_KERNEL void SplitterTetra2::releaseArrays() { // free potential sub-mesh nodes that have been allocated - typename MyMeshTypeT::MyConnType nbOfNodesT = _node_ids.size();// Issue 0020634. + typename MyMeshTypeT::MyConnType nbOfNodesT = static_cast(_node_ids.size());// Issue 0020634. if((int)_nodes.size()>=/*8*/nbOfNodesT) { std::vector::iterator iter = _nodes.begin() + /*8*/nbOfNodesT; @@ -1208,7 +1208,7 @@ namespace INTERP_KERNEL // indices of nodes of a son static std::vector allNodeIndices; // == 0,1,2,...,nbOfCellNodes-1 while ( allNodeIndices.size() < nbOfCellNodes ) - allNodeIndices.push_back( allNodeIndices.size() ); + allNodeIndices.push_back(ToIdType(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..87c79ce67 100644 --- a/src/INTERP_KERNEL/TriangulationIntersector.txx +++ b/src/INTERP_KERNEL/TriangulationIntersector.txx @@ -103,7 +103,7 @@ namespace INTERP_KERNEL bool isSourceQuad) { double result = 0.; - ConnType nbNodesS=sourceCoords.size()/SPACEDIM; + ConnType nbNodesS=static_cast(sourceCoords.size())/SPACEDIM; //Compute the intersection area double area[SPACEDIM]; for(ConnType iT = 1; iT<3; iT++) @@ -144,8 +144,8 @@ namespace INTERP_KERNEL const std::vector& sourceCoords) { double result = 0.; - ConnType nbNodesS=sourceCoords.size()/SPACEDIM; - ConnType nbNodesT=targetCoords.size()/SPACEDIM; + ConnType nbNodesS=static_cast(sourceCoords.size())/SPACEDIM; + ConnType nbNodesT=static_cast(targetCoords.size())/SPACEDIM; //Compute the intersection area double area[SPACEDIM]; for(ConnType iT = 1; iT(targetCell.size())/SPACEDIM; for(ConnType iT = 1; iT inter; diff --git a/src/MEDCoupling/MCType.hxx b/src/MEDCoupling/MCType.hxx index abc049dd1..bf2a047f1 100644 --- a/src/MEDCoupling/MCType.hxx +++ b/src/MEDCoupling/MCType.hxx @@ -32,9 +32,15 @@ namespace MEDCoupling #ifndef MEDCOUPLING_USE_64BIT_IDS using mcIdType = std::int32_t; #else - using mcIdType = std::int64_t; + //using mcIdType = std::int64_t; #endif - inline mcIdType ToIdType(std::size_t val) { return mcIdType(val); } + using mcIdType = std::int32_t; + + 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;i 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); @@ -904,10 +904,10 @@ void MEDCouplingCMesh::reprQuickOverview(std::ostream& stream) const 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 index c4ea2728f..dd396fd65 100644 --- 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]) ; } } @@ -945,7 +945,7 @@ bool FindInflection(const INTERP_KERNEL::BoxSplittingOptions& bso, const Interna distance.push_back(fabs(max_cross_list[i]+1-center)); double distance_min=*min_element(distance.begin(),distance.end()) ; - int pos_distance_min=find(distance.begin(),distance.end(),distance_min)-distance.begin(); + int pos_distance_min=ToIdType(find(distance.begin(),distance.end(),distance_min)-distance.begin()); int best_place = max_cross_list[pos_distance_min] + part[id].first ; if ( max_cross >=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 index 1ca531a99..9facea4f6 100644 --- a/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx @@ -232,14 +232,14 @@ 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(); + mcIdType nbOfCompo=ToIdType(_coords->getNumberOfComponents()); if(nodeId>=0 && nodeId<_coords->getNumberOfTuples()) coo.insert(coo.end(),_coords->begin()+nodeId*nbOfCompo,_coords->begin()+(nodeId+1)*nbOfCompo); else @@ -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 index 419218f6d..811015bce 100644 --- 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)); + mcIdType nbOfRows=ToIdType(getNumberOfMeshPlaces(mesh)); if(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,9 +3109,9 @@ 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()); + mcIdType szOfMatrix=ToIdType(arr->getNumberOfTuples()); if(szOfMatrix*szOfMatrix!=matr->getNumberOfTuples()) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::performDrift : invalid size"); MCAuto ret=DataArrayDouble::New(); @@ -3119,7 +3119,7 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::performDrift(const DataA 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 index 73017d575..9c51ac09c 100644 --- a/src/MEDCoupling/MEDCouplingIMesh.cxx +++ b/src/MEDCoupling/MEDCouplingIMesh.cxx @@ -288,7 +288,7 @@ void MEDCouplingIMesh::CondenseFineToCoarse(const std::vector& coarseSt, co 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()); + mcIdType nbCompo=ToIdType(fineDA->getNumberOfComponents()); if((int)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()) @@ -298,7 +298,7 @@ void MEDCouplingIMesh::CondenseFineToCoarse(const std::vector& coarseSt, co 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) @@ -418,7 +418,7 @@ void MEDCouplingIMesh::CondenseFineToCoarseGhost(const std::vector& coarseS 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()); + mcIdType nbCompo=ToIdType(fineDA->getNumberOfComponents()); if((int)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()) @@ -432,7 +432,7 @@ 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)); + mcIdType nbTuplesFine(ToIdType(fineDA->getNumberOfTuples())),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); if(fineDA->getNumberOfTuples()!=nbTuplesFineExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::CondenseFineToCoarseGhost : Expecting " << nbTuplesFineExp << " tuples in fine DataArray having " << nbTuplesFine << " !"; @@ -547,8 +547,8 @@ void MEDCouplingIMesh::SpreadCoarseToFine(const DataArrayDouble *coarseDA, const 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) + 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()) 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) !"); @@ -557,7 +557,7 @@ void MEDCouplingIMesh::SpreadCoarseToFine(const DataArrayDouble *coarseDA, const 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())); @@ -653,7 +653,7 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, 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()); + mcIdType nbCompo=ToIdType(fineDA->getNumberOfComponents()); if((int)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()) @@ -667,7 +667,7 @@ 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)); + mcIdType nbTuplesFine=ToIdType(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); if(fineDA->getNumberOfTuples()!=nbTuplesFineExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFineGhost : Expecting " << nbTuplesFineExp << " tuples in fine DataArray having " << nbTuplesFine << " !"; @@ -745,7 +745,7 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhostZone(const DataArrayDouble *coarse 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()); + mcIdType nbCompo=ToIdType(fineDA->getNumberOfComponents()); if((int)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()) @@ -759,7 +759,7 @@ 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)); + mcIdType nbTuplesFine=ToIdType(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); if(fineDA->getNumberOfTuples()!=nbTuplesFineExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFineGhostZone : Expecting " << nbTuplesFineExp << " tuples in fine DataArray having " << nbTuplesFine << " !"; @@ -1082,7 +1082,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 +1209,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)); diff --git a/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx index b39cd225e..cb6cb480f 100644 --- a/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx +++ b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx @@ -279,9 +279,9 @@ DataArrayInt *MEDCouplingMappedExtrudedMesh::giveCellsWithType(INTERP_KERNEL::No return ret.retn(); } MCAuto 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 index 1045e260c..1709952d7 100644 --- a/src/MEDCoupling/MEDCouplingMatrix.cxx +++ b/src/MEDCoupling/MEDCouplingMatrix.cxx @@ -180,7 +180,7 @@ DataArrayDouble *DenseMatrix::MatVecMult(const DenseMatrix *mat, const DataArray if(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 index 9e7408f26..d79fe7c2e 100644 --- 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(); } @@ -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,7 +4480,7 @@ 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) { @@ -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 index 570f0f832..59481f8ad 100644 --- 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 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()); + mcIdType 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()); @@ -2255,7 +2268,7 @@ namespace MEDCoupling 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,10 +3195,11 @@ struct NotInRange { this->checkAllocated(); other->checkAllocated(); - std::size_t nbOfTuples(this->getNumberOfTuples()); + mcIdType nbOfTuples=ToIdType((this->getNumberOfTuples())); if(nbOfTuples!=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()); @@ -3195,11 +3230,11 @@ struct NotInRange throw INTERP_KERNEL::Exception("DataArrayDouble::duplicateEachTupleNTimes : this should have only one component !"); if(nbTimes<1) throw INTERP_KERNEL::Exception("DataArrayDouble::duplicateEachTupleNTimes : nb times should be >= 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()) throw INTERP_KERNEL::Exception("DataArrayInt::buildPermutationArr : 'this' and 'other' must have the same number of tuple !"); @@ -3579,14 +3614,14 @@ struct NotInRange 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' !"; @@ -3621,14 +3656,14 @@ struct NotInRange 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; } @@ -3873,14 +3909,14 @@ struct NotInRange else if(std::string(type)=="Int8") { INTERP_KERNEL::AutoPtr 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(); + mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); if(nbOfTuples!=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,16 +510,16 @@ DataArrayChar *DataArrayChar::Meld(const std::vector& arr for(it=a.begin();it!=a.end();it++) (*it)->checkAllocated(); it=a.begin(); - int nbOfTuples=(*it)->getNumberOfTuples(); + mcIdType nbOfTuples=ToIdType((*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("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); @@ -622,11 +622,11 @@ void DataArrayByte::reprZipStream(std::ostream& stream) const void DataArrayByte::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) @@ -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 index af878faa5..b514605b6 100644 --- 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; @@ -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.txx b/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx index 10d31c6a6..550f06fda 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; + mcIdType nbOfPts=ToIdType(array->getNbOfElems())/SPACEDIM; for(int j=0;j::getNumberOfNodesOfE template int MEDCouplingNormalizedUnstructuredMesh::getNumberOfElements() const { - return _mesh->getNumberOfCells(); + return 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(); + mcIdType nbOfCell=ToIdType(m1->getNumberOfCells()); + mcIdType initialConnSize=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()); + mcIdType nbOfCell=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()); + mcIdType nbOfCell=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 index c9c384d78..c6ce3a314 100644 --- 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())); } @@ -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(); + mcIdType nbCells=ToIdType(getNumberOfCells()); if (nbCells != 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 index 5b4d4cc9a..5521faf67 100644 --- a/src/MEDCoupling/MEDCouplingRemapper.cxx +++ b/src/MEDCoupling/MEDCouplingRemapper.cxx @@ -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()); @@ -1074,7 +1074,7 @@ 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(); @@ -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 index d4a8c91b0..3fd214af7 100644 --- 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; @@ -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 index bdb9cdb55..ec6803b32 100644 --- 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)) 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,7 +1977,7 @@ 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()); + int nbOfTuplesExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(st)),nbCompo(ToIdType(da->getNumberOfComponents())); if(da->getNumberOfTuples()!=nbOfTuplesExp) { std::ostringstream oss; oss << "MEDCouplingStructuredMesh::MultiplyPartOf : invalid nb of tuples ! Expected " << nbOfTuplesExp << " having " << da->getNumberOfTuples() << " !"; 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 index 5b5ca7291..2e35b2891 100644 --- 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]); diff --git a/src/MEDCoupling/MEDCouplingUMesh_internal.hxx b/src/MEDCoupling/MEDCouplingUMesh_internal.hxx index 703a2a923..9a83f58d4 100644 --- a/src/MEDCoupling/MEDCouplingUMesh_internal.hxx +++ b/src/MEDCoupling/MEDCouplingUMesh_internal.hxx @@ -109,7 +109,7 @@ void MEDCouplingUMesh::getCellsContainingPointsAlg(const double *coords, const d int *eltsIndexPtr(eltsIndex->getPointer()); 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 index 573099051..9118db35e 100644 --- a/src/MEDCoupling/MEDCouplingVoronoi.cxx +++ b/src/MEDCoupling/MEDCouplingVoronoi.cxx @@ -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; } @@ -237,7 +237,7 @@ 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()); @@ -248,7 +248,7 @@ MCAuto MergeVorCells3D(const std::vector< MCAutoinsertNextCell(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(); @@ -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())); @@ -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; } -- 2.39.2