From: emv Date: Thu, 7 Nov 2019 11:15:07 +0000 (+0300) Subject: Using std::size_t for Components and mcIdType for Tuples across MEDCoupling module X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Femv%2FLOT3_LOT1_Update;p=tools%2Fmedcoupling.git Using std::size_t for Components and mcIdType for Tuples across MEDCoupling module --- diff --git a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx index 1c43f1f12..0f8504d96 100644 --- a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx +++ b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx @@ -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 !"); - mcIdType nbTuples=ToIdType(profile->getNumberOfTuples()),nbOfCells=ToIdType(getNumberOfCells()); + mcIdType nbTuples=profile->getNumberOfTuples(),nbOfCells=ToIdType(getNumberOfCells()); code.resize(3); idsInPflPerType.resize(1); code[0]=(int)getCellModelEnum(); code[1]=nbTuples; idsInPflPerType.resize(1); @@ -679,7 +679,7 @@ void MEDCoupling1SGTUMesh::checkConsistency(double eps) const { checkConsistencyLight(); const DataArrayInt *c1(_conn); - mcIdType nbOfTuples=ToIdType(c1->getNumberOfTuples()); + mcIdType nbOfTuples(c1->getNumberOfTuples()); mcIdType nbOfNodesPerCell=ToIdType(_cm->getNumberOfNodes()); if(nbOfTuples%nbOfNodesPerCell!=0) { @@ -1149,7 +1149,7 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::Merge1SGTUMeshes(std::vector > bb(sz); std::vector< const MEDCoupling1SGTUMesh * > aa(sz); - int spaceDim=-3; + mcIdType spaceDim=-3; for(std::size_t i=0;ifindCommonCells(3,0,cc,cci); ccSafe=cc; cciSafe=cci; const int *ccPtr(ccSafe->begin()); - mcIdType nbOfPair=ToIdType(cci->getNumberOfTuples())-1; + mcIdType nbOfPair=cci->getNumberOfTuples()-1; for(int i=0;isetIJ(i+1,0,ToIdType(cArr->getNumberOfTuples())); + ciArr->setIJ(i+1,0,cArr->getNumberOfTuples()); } ret->setNodalConnectivity(cArr,ciArr); return ret.retn(); @@ -2063,7 +2063,7 @@ MEDCoupling1DGTUMesh *MEDCoupling1SGTUMesh::computeDualMesh2D() const } std::vector zePolyg(MEDCoupling1DGTUMesh::BuildAPolygonFromParts(polyg)); cArr->insertAtTheEnd(zePolyg.begin(),zePolyg.end()); - ciArr->setIJ(i+1,0,ToIdType(cArr->getNumberOfTuples())); + ciArr->setIJ(i+1,0,cArr->getNumberOfTuples()); } ret->setNodalConnectivity(cArr,ciArr); return ret.retn(); @@ -2368,7 +2368,7 @@ void MEDCoupling1DGTUMesh::checkConsistencyOfConnectivity() const else throw INTERP_KERNEL::Exception("Nodal connectivity array not defined !"); // - mcIdType sz2=ToIdType(_conn->getNumberOfTuples()); + mcIdType sz2(_conn->getNumberOfTuples()); c1=_conn_indx; if(c1) { @@ -2424,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 !"); // - mcIdType nbOfTuples=ToIdType(c1->getNumberOfTuples()); + mcIdType nbOfTuples(c1->getNumberOfTuples()); int nbOfNodes=getNumberOfNodes(); const int *w(c1->begin()); for(int i=0;ideltaShiftIndex(); // for polyhedrons - mcIdType nbOfCells=ToIdType(_conn_indx->getNumberOfTuples())-1; + mcIdType nbOfCells=_conn_indx->getNumberOfTuples()-1; MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfCells,1); int *retPtr=ret->getPointer(); @@ -2488,7 +2488,7 @@ DataArrayInt *MEDCoupling1DGTUMesh::computeNbOfFacesPerCell() const return ret.retn(); } // for polyhedrons - mcIdType nbOfCells=ToIdType(_conn_indx->getNumberOfTuples())-1; + mcIdType nbOfCells=_conn_indx->getNumberOfTuples()-1; MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfCells,1); int *retPtr=ret->getPointer(); @@ -2509,7 +2509,7 @@ DataArrayInt *MEDCoupling1DGTUMesh::computeEffectiveNbOfNodesPerCell() const { checkConsistencyLight(); _conn_indx->checkMonotonic(true); - mcIdType nbOfCells=ToIdType(_conn_indx->getNumberOfTuples())-1; + mcIdType nbOfCells=_conn_indx->getNumberOfTuples()-1; MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfCells,1); int *retPtr(ret->getPointer()); @@ -3154,9 +3154,9 @@ void MEDCoupling1DGTUMesh::renumberNodesWithOffsetInConn(int offset) { getNumberOfCells();//only to check that all is well defined. // - std::size_t nbOfTuples(_conn->getNumberOfTuples()); + mcIdType nbOfTuples(_conn->getNumberOfTuples()); int *pt(_conn->getPointer()); - for(std::size_t i=0;igetNumberOfTuples())); + mcIdType nbElemsIn(getNumberOfNodes()),nbOfTuples(_conn->getNumberOfTuples()); int *pt(_conn->getPointer()); for(int i=0;i > bb(sz); std::vector< const MEDCoupling1DGTUMesh * > aa(sz); - int spaceDim=-3; + mcIdType spaceDim=-3; for(std::size_t i=0;i::const_iterator it=nodalConns.begin();it!=nodalConns.end();it++) { if(!(*it)) @@ -3699,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=ToIdType((*it)->getNumberOfTuples()); + mcIdType curNbt=(*it)->getNumberOfTuples(); const int *inPt=(*it)->begin(); int offset=offsetInNodeIdsPerElt[i]; for(int j=0;jgetPointer()); - mcIdType nbElt=ToIdType(_conn->getNumberOfTuples()); + mcIdType nbElt(_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. // - mcIdType nbOfTuples=ToIdType(_conn->getNumberOfTuples()); + mcIdType nbOfTuples(_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(ToIdType(_x_array->getNumberOfTuples())); + ret.push_back(_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(ToIdType(_y_array->getNumberOfTuples())); + ret.push_back(_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(ToIdType(_z_array->getNumberOfTuples())); + ret.push_back(_z_array->getNumberOfTuples()); } return ret; } @@ -790,7 +790,7 @@ void MEDCouplingCMesh::getTinySerializationInformation(std::vector& tiny std::string st; if(thisArr[i]) { - val=ToIdType(thisArr[i]->getNumberOfTuples()); + val=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+=ToIdType(thisArr[i]->getNumberOfTuples()); + sz+=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 { - mcIdType nbCompo=ToIdType(thisArr[i]->getNumberOfComponents()); + std::size_t nbCompo=thisArr[i]->getNumberOfComponents(); if(nbCompo==1) { - mcIdType nbTuples=ToIdType(thisArr[i]->getNumberOfTuples()); + mcIdType nbTuples=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/MEDCouplingCurveLinearMesh.cxx b/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx index 3f68ec54f..de19c7da4 100755 --- a/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx @@ -193,7 +193,7 @@ void MEDCouplingCurveLinearMesh::checkConsistencyLight() const throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkConsistencyLight : the array is not allocated !"); if(_coords->getNumberOfComponents()<1) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkConsistencyLight : the array should have >= 1 components !"); - if(_coords->getNumberOfTuples()!=nbOfNodes) + if(_coords->getNumberOfTuples()!=ToIdType(nbOfNodes)) { std::ostringstream oss; oss << "MEDCouplingCurveLinearMesh::checkConsistencyLight : structure said that number of nodes should be equal to " << nbOfNodes << " but number of tuples in array is equal to " << _coords->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -239,8 +239,8 @@ void MEDCouplingCurveLinearMesh::getCoordinatesOfNode(int nodeId, std::vectorgetNumberOfComponents()); - if(nodeId>=0 && nodeId<(ToIdType(_coords->getNumberOfTuples()))) + std::size_t nbOfCompo=_coords->getNumberOfComponents(); + if(nodeId>=0 && nodeId<_coords->getNumberOfTuples()) coo.insert(coo.end(),_coords->begin()+nodeId*nbOfCompo,_coords->begin()+(nodeId+1)*nbOfCompo); else { std::ostringstream oss; oss << "MEDCouplingCurveLinearMesh::getCoordinatesOfNode : nodeId has to be in [0," << _coords->getNumberOfTuples() << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } @@ -645,7 +645,7 @@ void MEDCouplingCurveLinearMesh::rotate(const double *center, const double *vect if(!((DataArrayDouble *)_coords)) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::rotate : no coordinates set !"); int spaceDim=getSpaceDimension(); - mcIdType nbNodes=ToIdType(_coords->getNumberOfTuples()); + mcIdType nbNodes(_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(); - mcIdType nbNodes=ToIdType(_coords->getNumberOfTuples()); - mcIdType dim=ToIdType(_coords->getNumberOfComponents()); + mcIdType nbNodes(_coords->getNumberOfTuples()); + std::size_t dim(_coords->getNumberOfComponents()); for(int i=0;i()); @@ -917,7 +917,7 @@ void MEDCouplingCurveLinearMesh::reprQuickOverview(std::ostream& stream) const { stream << std::endl << "No coordinates set !"; return ; } if(!coo->isAllocated()) { stream << std::endl << "Coordinates set but not allocated !"; return ; } - mcIdType nbOfCompo=ToIdType(coo->getNumberOfComponents()); + std::size_t nbOfCompo(coo->getNumberOfComponents()); int nbOfCompoExp(-1); try { @@ -926,7 +926,7 @@ void MEDCouplingCurveLinearMesh::reprQuickOverview(std::ostream& stream) const catch(INTERP_KERNEL::Exception&) { } - if(nbOfCompo!=nbOfCompoExp) + if(ToIdType(nbOfCompo)!=nbOfCompoExp) { stream << std::endl << "Coordinates set and allocated but mismatch number of components !"; return ; } stream << std::endl << "Coordinates ( number of tuples = " << coo->getNumberOfTuples() << " ) : "; coo->reprQuickOverviewData(stream,200); diff --git a/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx b/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx index cc790410d..9810f0584 100755 --- 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); - mcIdType nbOfCompo=ToIdType(arr->getNumberOfComponents()); + std::size_t nbOfCompo=arr->getNumberOfComponents(); int nbOfElems=getNumberOfTuples(mesh); std::fill(res,res+nbOfCompo,0.); const double *arrPtr=arr->getConstPointer(); @@ -244,7 +244,7 @@ void MEDCouplingFieldDiscretization::normL1(const MEDCouplingMesh *mesh, const D for(int i=0;i vol=getMeasureField(mesh,true); - mcIdType nbOfCompo=ToIdType(arr->getNumberOfComponents()); + std::size_t nbOfCompo=arr->getNumberOfComponents(); int nbOfElems=getNumberOfTuples(mesh); std::fill(res,res+nbOfCompo,0.); const double *arrPtr=arr->getConstPointer(); @@ -268,7 +268,7 @@ void MEDCouplingFieldDiscretization::normL2(const MEDCouplingMesh *mesh, const D for(int i=0;i vol=getMeasureField(mesh,isWAbs); - std::size_t nbOfCompo(arr->getNumberOfComponents()),nbOfElems(getNumberOfTuples(mesh)); + std::size_t nbOfCompo(arr->getNumberOfComponents()); + mcIdType nbOfElems(getNumberOfTuples(mesh)); if(nbOfElems!=arr->getNumberOfTuples()) { std::ostringstream oss; oss << "MEDCouplingFieldDiscretization::integral : field is not correct ! number of tuples in array is " << arr->getNumberOfTuples(); @@ -298,7 +299,7 @@ void MEDCouplingFieldDiscretization::integral(const MEDCouplingMesh *mesh, const std::fill(res,res+nbOfCompo,0.); const double *arrPtr(arr->begin()),*volPtr(vol->getArray()->begin()); INTERP_KERNEL::AutoPtr tmp=new double[nbOfCompo]; - for(std::size_t i=0;i(),volPtr[i])); std::transform((double *)tmp,(double *)tmp+nbOfCompo,res,res,std::plus()); @@ -428,8 +429,8 @@ void MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr(double eps, cons { if(!arr) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr : input array is NULL !"); - mcIdType oldNbOfElems=ToIdType(arr->getNumberOfTuples()); - mcIdType nbOfComp=ToIdType(arr->getNumberOfComponents()); + mcIdType oldNbOfElems=arr->getNumberOfTuples(); + std::size_t nbOfComp=arr->getNumberOfComponents(); int newNbOfTuples=newNbOfEntity; MCAuto arrCpy=arr->deepCopy(); const double *ptSrc=arrCpy->getConstPointer(); @@ -464,7 +465,7 @@ void MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr(double eps, cons void MEDCouplingFieldDiscretization::RenumberEntitiesFromN2OArr(const int *new2OldPtr, int new2OldSz, DataArrayDouble *arr, const std::string& msg) { - mcIdType nbOfComp=ToIdType(arr->getNumberOfComponents()); + std::size_t nbOfComp=arr->getNumberOfComponents(); MCAuto arrCpy=arr->deepCopy(); const double *ptSrc=arrCpy->getConstPointer(); arr->reAlloc(new2OldSz); @@ -646,7 +647,7 @@ void MEDCouplingFieldDiscretizationP0::checkCoherencyBetween(const MEDCouplingMe { if(!mesh || !da) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::checkCoherencyBetween : NULL input mesh or DataArray !"); - if(mesh->getNumberOfCells()!=da->getNumberOfTuples()) + if(ToIdType(mesh->getNumberOfCells())!=da->getNumberOfTuples()) { std::ostringstream message; message << "Field on cells invalid because there are " << mesh->getNumberOfCells(); @@ -689,7 +690,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(); - mcIdType nbOfComponents=ToIdType(arr->getNumberOfComponents()); + std::size_t nbOfComponents=arr->getNumberOfComponents(); MCAuto ret=DataArrayDouble::New(); ret->alloc(nbOfPoints,nbOfComponents); double *ptToFill=ret->getPointer(); @@ -1061,7 +1062,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); - mcIdType sz=ToIdType(arr->getNumberOfComponents()); + std::size_t sz=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(); - mcIdType nbOfComponents=ToIdType(arr->getNumberOfComponents()); + std::size_t nbOfComponents=arr->getNumberOfComponents(); MCAuto ret=DataArrayDouble::New(); ret->alloc(nbOfPoints,nbOfComponents); double *ptToFill=ret->getPointer(); @@ -1218,7 +1219,7 @@ bool MEDCouplingFieldDiscretizationPerCell::isEqualWithoutConsideringStr(const M */ void MEDCouplingFieldDiscretizationPerCell::renumberCells(const int *old2NewBg, bool check) { - mcIdType nbCells=ToIdType(_discr_per_cell->getNumberOfTuples()); + mcIdType nbCells=_discr_per_cell->getNumberOfTuples(); const int *array=old2NewBg; if(check) array=DataArrayInt::CheckAndPreparePermutation(old2NewBg,old2NewBg+nbCells); @@ -1424,7 +1425,7 @@ int MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode( throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode : invalid input code !"); int nbOfSplit=(int)idsPerType.size(); int nbOfTypes=(int)code.size()/3; - std::size_t ret(0); + mcIdType ret(0); for(int i=0;igetConstPointer(); - mcIdType nbOfTuples=ToIdType(_discr_per_cell->getNumberOfTuples()); + mcIdType nbOfTuples=_discr_per_cell->getNumberOfTuples(); mcIdType maxSz=ToIdType(_loc.size()); for(const int *w=dcPtr;w!=dcPtr+nbOfTuples;w++) { @@ -1491,7 +1492,7 @@ DataArrayInt *MEDCouplingFieldDiscretizationGauss::getOffsetArr(const MEDCouplin { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getOffsetArr : NULL input mesh !"); - std::size_t nbOfTuples(mesh->getNumberOfCells()); + mcIdType nbOfTuples=ToIdType(mesh->getNumberOfCells()); MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfTuples+1,1); int *retPtr(ret->getPointer()); @@ -1500,7 +1501,7 @@ DataArrayInt *MEDCouplingFieldDiscretizationGauss::getOffsetArr(const MEDCouplin throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getOffsetArr : mismatch between the mesh and the discretization ids array length !"); int maxPossible=(int)_loc.size(); retPtr[0]=0; - for(std::size_t i=0;i=0 && *startgetNumberOfCells()); - mcIdType nbOfCells=ToIdType(_discr_per_cell->getNumberOfTuples()); + mcIdType nbOfCells=_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 +1610,7 @@ void MEDCouplingFieldDiscretizationGauss::getTinySerializationIntInformation(std { int val=-1; if(_discr_per_cell) - val=ToIdType(_discr_per_cell->getNumberOfTuples()); + val=_discr_per_cell->getNumberOfTuples(); tinyInfo.push_back(val); tinyInfo.push_back((int)_loc.size()); if(_loc.empty()) @@ -1708,7 +1709,7 @@ void MEDCouplingFieldDiscretizationGauss::checkCoherencyBetween(const MEDCouplin throw INTERP_KERNEL::Exception(oss.str().c_str()); } } - std::size_t nbOfTuples(getNumberOfTuples(mesh)); + mcIdType nbOfTuples(getNumberOfTuples(mesh)); if(nbOfTuples!=da->getNumberOfTuples()) { std::ostringstream oss; oss << "Invalid number of tuples in the array : expecting " << nbOfTuples << " having " << da->getNumberOfTuples() << " !"; @@ -1811,7 +1812,7 @@ MEDCouplingMesh *MEDCouplingFieldDiscretizationGauss::buildSubMeshDataRange(cons throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::buildSubMeshDataRange : no discretization array set !"); di=0; beginOut=0; endOut=0; stepOut=stepCellIds; const char msg[]="MEDCouplingFieldDiscretizationGauss::buildSubMeshDataRange : cell #"; - mcIdType nbOfTuples=ToIdType(_discr_per_cell->getNumberOfTuples()); + mcIdType nbOfTuples=_discr_per_cell->getNumberOfTuples(); const int *w=_discr_per_cell->begin(); int nbMaxOfLocId=(int)_loc.size(); for(int i=0;i nbOfNodesPerCell=buildNbOfGaussPointPerCellField();//check of _discr_per_cell not NULL pointer std::size_t nbOfCells(mesh->getNumberOfCells()); - if(_discr_per_cell->getNumberOfTuples()!=nbOfCells) + if(_discr_per_cell->getNumberOfTuples()!=ToIdType(nbOfCells)) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::computeTupleIdsToSelectFromCellIds : mismatch of nb of tuples of cell ids array and number of cells !"); nbOfNodesPerCell->computeOffsetsFull(); MCAuto sel=DataArrayInt::New(); sel->useArray(startCellIds,false,DeallocType::CPP_DEALLOC,(int)std::distance(startCellIds,endCellIds),1); @@ -2046,7 +2047,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()) !"); - mcIdType nbOfTuples=ToIdType(_discr_per_cell->getNumberOfTuples()); + mcIdType nbOfTuples=_discr_per_cell->getNumberOfTuples(); const int *ptr=_discr_per_cell->getConstPointer(); for(int i=0;igetNumberOfTuples()); + mcIdType nbOfTuples=_discr_per_cell->getNumberOfTuples(); MCAuto ret=DataArrayInt::New(); const int *w=_discr_per_cell->begin(); ret->alloc(nbOfTuples,1); @@ -2122,7 +2123,7 @@ void MEDCouplingFieldDiscretizationGauss::reprQuickOverview(std::ostream& stream void MEDCouplingFieldDiscretizationGauss::zipGaussLocalizations() { const int *start=_discr_per_cell->begin(); - mcIdType nbOfTuples=ToIdType(_discr_per_cell->getNumberOfTuples()); + mcIdType nbOfTuples=_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++) @@ -2357,7 +2358,7 @@ void MEDCouplingFieldDiscretizationGaussNE::integral(const MEDCouplingMesh *mesh { if(!mesh || !arr) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::integral : input mesh or array is null !"); - mcIdType nbOfCompo=ToIdType(arr->getNumberOfComponents()); + std::size_t nbOfCompo=arr->getNumberOfComponents(); std::fill(res,res+nbOfCompo,0.); // MCAuto vol=mesh->getMeasureField(isWAbs); @@ -2375,10 +2376,10 @@ void MEDCouplingFieldDiscretizationGaussNE::integral(const MEDCouplingMesh *mesh MCAuto ids=mesh->giveCellsWithType(*it); MCAuto ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell); const int *ptIds2=ids2->begin(),*ptIds=ids->begin(); - mcIdType nbOfCellsWithCurGeoType=ToIdType(ids->getNumberOfTuples()); + mcIdType nbOfCellsWithCurGeoType=ids->getNumberOfTuples(); for(int i=0;igetNumberOfTuples()) { std::ostringstream oss; oss << "Invalid number of tuples in the array : expecting " << nbOfTuples << " !"; @@ -2693,7 +2694,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationGaussNE::getMeasureField(c MCAuto ids=mesh->giveCellsWithType(*it); MCAuto ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell); const int *ptIds2=ids2->begin(),*ptIds=ids->begin(); - mcIdType nbOfCellsWithCurGeoType=ToIdType(ids->getNumberOfTuples()); + mcIdType nbOfCellsWithCurGeoType=ids->getNumberOfTuples(); for(int i=0;iisAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::getValueOnMulti : input array is null or not allocated !"); mcIdType nbOfRows=ToIdType(getNumberOfMeshPlaces(mesh)); - if(ToIdType(arr->getNumberOfTuples())!=nbOfRows) + 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(ToIdType(arr->getNumberOfComponents())); + int nbCols(-1); + std::size_t nbCompo=arr->getNumberOfComponents(); MCAuto m(computeEvaluationMatrixOnGivenPts(mesh,loc,nbOfTargetPoints,nbCols)); MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfTargetPoints,nbCompo); - INTERP_KERNEL::matrixProduct(m->begin(),nbOfTargetPoints,nbCols,arr->begin(),nbOfRows,nbCompo,ret->getPointer()); + INTERP_KERNEL::matrixProduct(m->begin(),nbOfTargetPoints,nbCols,arr->begin(),nbOfRows,ToIdType(nbCompo),ret->getPointer()); return ret.retn(); } @@ -2909,7 +2911,8 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeEvaluationMatrixO MCAuto matrixInv(computeInverseMatrix(mesh,isDrift,nbRows)); // MCAuto coords=getLocalizationOfDiscValues(mesh); - mcIdType nbOfPts(ToIdType(coords->getNumberOfTuples())),dimension(ToIdType(coords->getNumberOfComponents())); + mcIdType nbOfPts(coords->getNumberOfTuples()); + std::size_t dimension(coords->getNumberOfComponents()); MCAuto locArr=DataArrayDouble::New(); locArr->useArray(loc,false,DeallocType::CPP_DEALLOC,nbOfTargetPoints,dimension); nbCols=nbOfPts; @@ -2968,7 +2971,7 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeMatrix(const MEDC if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::computeMatrix : NULL input mesh !"); MCAuto coords(getLocalizationOfDiscValues(mesh)); - mcIdType nbOfPts=ToIdType(coords->getNumberOfTuples()); + mcIdType nbOfPts(coords->getNumberOfTuples()); MCAuto matrix(coords->buildEuclidianDistanceDenseMatrix()); operateOnDenseMatrix(mesh->getSpaceDimension(),nbOfPts*nbOfPts,matrix->getPointer()); // Drift @@ -2994,7 +2997,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(),ToIdType(arr2->getNumberOfTuples()),1,KnewiK->getPointer()); + INTERP_KERNEL::matrixProduct(matrixInv->getConstPointer(),nbRows,nbRows,arr2->getConstPointer(),arr2->getNumberOfTuples(),1,KnewiK->getPointer()); return KnewiK.retn(); } @@ -3062,8 +3065,9 @@ 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 !"); - mcIdType spaceDimension=ToIdType(arr->getNumberOfComponents()),nbOfPts=ToIdType(arr->getNumberOfTuples()),nbOfEltInMatrx=ToIdType(matr->getNumberOfTuples()); - delta=spaceDimension+1; + std::size_t spaceDimension(arr->getNumberOfComponents()); + mcIdType nbOfPts(arr->getNumberOfTuples()),nbOfEltInMatrx(matr->getNumberOfTuples()); + delta=ToIdType(spaceDimension)+1; int nbOfCols(nbOfEltInMatrx/nbOfPts); if(nbOfEltInMatrx%nbOfPts!=0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::PerformDriftRect : size of input dense matrix and input arrays mismatch ! NbOfElems in matrix % nb of tuples in array must be equal to 0 !"); @@ -3109,10 +3113,10 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::PerformDriftOfVec(const */ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::performDrift(const DataArrayDouble *matr, const DataArrayDouble *arr, int& delta) const { - mcIdType spaceDimension=ToIdType(arr->getNumberOfComponents()); - delta=spaceDimension+1; - mcIdType szOfMatrix=ToIdType(arr->getNumberOfTuples()); - if(szOfMatrix*szOfMatrix!=ToIdType(matr->getNumberOfTuples())) + std::size_t spaceDimension(arr->getNumberOfComponents()); + delta=ToIdType(spaceDimension)+1; + mcIdType szOfMatrix(arr->getNumberOfTuples()); + if(szOfMatrix*szOfMatrix!=matr->getNumberOfTuples()) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::performDrift : invalid size"); MCAuto ret=DataArrayDouble::New(); ret->alloc((szOfMatrix+delta)*(szOfMatrix+delta),1); @@ -3131,7 +3135,7 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::performDrift(const DataA std::fill(destWork,destWork+spaceDimension+1,0.); destWork+=spaceDimension+1; MCAuto arrNoI=arr->toNoInterlace(); srcWork2=arrNoI->getConstPointer(); - for(mcIdType i=0;i > outArrsSafe(sz); std::vector outArrs(sz); for(std::size_t j=0;jgetNumberOfComponents()); + std::size_t nbCompo(arrs[j]->getNumberOfComponents()); outArrsSafe[j]=DataArrayDouble::New(); outArrsSafe[j]->alloc(nbCells,nbCompo); outArrsSafe[j]->copyStringInfoFrom(*arrs[j]); outArrs[j]=outArrsSafe[j]; @@ -705,7 +705,7 @@ void MEDCouplingFieldDouble::getWeightedAverageValue(double *res, bool isWAbs) c MCAuto arr=getArray()->deepCopy(); arr->multiplyEqual(w->getArray()); arr->accumulate(res); - mcIdType nCompo = ToIdType(getArray()->getNumberOfComponents()); + std::size_t nCompo = getArray()->getNumberOfComponents(); std::transform(res,res+nCompo,res,std::bind2nd(std::multiplies(),1./deno)); } @@ -724,8 +724,8 @@ void MEDCouplingFieldDouble::getWeightedAverageValue(double *res, bool isWAbs) c */ double MEDCouplingFieldDouble::getWeightedAverageValue(int compId, bool isWAbs) const { - mcIdType nbComps=ToIdType(getArray()->getNumberOfComponents()); - if(compId<0 || compId>=nbComps) + std::size_t nbComps=getArray()->getNumberOfComponents(); + if(compId<0 || compId>=ToIdType(nbComps)) { std::ostringstream oss; oss << "MEDCouplingFieldDouble::getWeightedAverageValue : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !"; throw INTERP_KERNEL::Exception(oss.str()); @@ -752,8 +752,8 @@ 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 !"); - mcIdType nbComps=ToIdType(getArray()->getNumberOfComponents()); - if(compId<0 || compId>=nbComps) + std::size_t nbComps=getArray()->getNumberOfComponents(); + if(compId<0 || compId>=ToIdType(nbComps)) { std::ostringstream oss; oss << "MEDCouplingFieldDouble::normL1 : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !"; throw INTERP_KERNEL::Exception(oss.str()); @@ -799,8 +799,8 @@ 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 !"); - mcIdType nbComps=ToIdType(getArray()->getNumberOfComponents()); - if(compId<0 || compId>=nbComps) + std::size_t nbComps=getArray()->getNumberOfComponents(); + if(compId<0 || compId>=ToIdType(nbComps)) { std::ostringstream oss; oss << "MEDCouplingFieldDouble::normL2 : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !"; throw INTERP_KERNEL::Exception(oss.str()); @@ -843,8 +843,8 @@ double MEDCouplingFieldDouble::normMax(int compId) const { if(getArray()==0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::normMax : no default array defined !"); - mcIdType nbComps=ToIdType(getArray()->getNumberOfComponents()); - if(compId<0 || compId>=nbComps) + std::size_t nbComps=getArray()->getNumberOfComponents(); + if(compId<0 || compId>=ToIdType(nbComps)) { std::ostringstream oss; oss << "MEDCouplingFieldDouble::normMax : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !"; throw INTERP_KERNEL::Exception(oss.str()); @@ -891,8 +891,8 @@ 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 !"); - mcIdType nbComps=ToIdType(getArray()->getNumberOfComponents()); - if(compId<0 || compId>=nbComps) + std::size_t nbComps=getArray()->getNumberOfComponents(); + if(compId<0 || compId>=ToIdType(nbComps)) { std::ostringstream oss; oss << "MEDCouplingFieldDouble::integral : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !"; throw INTERP_KERNEL::Exception(oss.str()); @@ -2927,7 +2927,7 @@ MCAuto MEDCouplingFieldDouble::voronoizeGen(const Voroni inpMeshBase=fieldToWO->getMesh(); inpMesh=inpMeshBase->buildUnstructured(); } - mcIdType nbCells=ToIdType(inpMesh->getNumberOfCells()); + std::size_t nbCells(inpMesh->getNumberOfCells()); const MEDCouplingFieldDiscretization *disc(fieldToWO->getDiscretization()); const MEDCouplingFieldDiscretizationGauss *disc2(dynamic_cast(disc)); if(!disc2) diff --git a/src/MEDCoupling/MEDCouplingFieldT.txx b/src/MEDCoupling/MEDCouplingFieldT.txx index f1cda9917..91c3d15de 100644 --- a/src/MEDCoupling/MEDCouplingFieldT.txx +++ b/src/MEDCoupling/MEDCouplingFieldT.txx @@ -368,10 +368,10 @@ namespace MEDCoupling { if(getArray()->isAllocated()) { - mcIdType nbOfCompo=ToIdType(getArray()->getNumberOfComponents()); + std::size_t nbOfCompo=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(mcIdType i=0;igetInfoOnComponent(i) << "\" "; ret << "\n"; } diff --git a/src/MEDCoupling/MEDCouplingGaussLocalization.cxx b/src/MEDCoupling/MEDCouplingGaussLocalization.cxx index f67a4ee74..bb9b404a6 100644 --- a/src/MEDCoupling/MEDCouplingGaussLocalization.cxx +++ b/src/MEDCoupling/MEDCouplingGaussLocalization.cxx @@ -216,7 +216,7 @@ MCAuto MEDCouplingGaussLocalization::localizePtsInRefCooForEach const double *coords(mesh->getCoords()->begin()); const int *connI(mesh->getNodalConnectivityIndex()->begin()),*conn(mesh->getNodalConnectivity()->begin()); // - mcIdType nbPts=ToIdType(ptsInRefCoo->getNumberOfTuples()); + mcIdType nbPts(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 ec7587ef1..c712301a9 100755 --- a/src/MEDCoupling/MEDCouplingIMesh.cxx +++ b/src/MEDCoupling/MEDCouplingIMesh.cxx @@ -289,17 +289,17 @@ void MEDCouplingIMesh::CondenseFineToCoarse(const std::vector& coarseSt, co throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : the parameters 1 or 3 are NULL or not allocated !"); std::size_t meshDim(coarseSt.size()); mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseSt)),nbOfTuplesInFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(fineLocInCoarse)); - mcIdType nbCompo=ToIdType(fineDA->getNumberOfComponents()); - if(ToIdType(coarseDA->getNumberOfComponents())!=nbCompo) + std::size_t nbCompo=fineDA->getNumberOfComponents(); + if(coarseDA->getNumberOfComponents()!=nbCompo) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : the number of components of fine DA and coarse one mismatches !"); if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !"); - if(ToIdType(coarseDA->getNumberOfTuples())!=nbOfTuplesInCoarseExp) + if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::CondenseFineToCoarse : Expecting " << nbOfTuplesInCoarseExp << " tuples having " << coarseDA->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - mcIdType nbTuplesFine=ToIdType(fineDA->getNumberOfTuples()); + mcIdType nbTuplesFine(fineDA->getNumberOfTuples()); if(nbOfTuplesInFineExp==0) { if(nbTuplesFine==0) @@ -420,12 +420,12 @@ void MEDCouplingIMesh::CondenseFineToCoarseGhost(const std::vector& coarseS std::vector coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); std::size_t meshDim(coarseSt.size()); mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); - mcIdType nbCompo=ToIdType(fineDA->getNumberOfComponents()); - if(ToIdType(coarseDA->getNumberOfComponents())!=nbCompo) + std::size_t nbCompo(fineDA->getNumberOfComponents()); + if(coarseDA->getNumberOfComponents()!=nbCompo) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarseGhost : the number of components of fine DA and coarse one mismatches !"); if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarseGhost : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !"); - if(ToIdType(coarseDA->getNumberOfTuples())!=nbOfTuplesInCoarseExp) + if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::CondenseFineToCoarseGhost : Expecting " << nbOfTuplesInCoarseExp << " tuples in coarse DataArray having " << coarseDA->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -434,8 +434,8 @@ void MEDCouplingIMesh::CondenseFineToCoarseGhost(const std::vector& coarseS std::vector fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies()); std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); - mcIdType nbTuplesFine(ToIdType(fineDA->getNumberOfTuples())),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); - if(ToIdType(fineDA->getNumberOfTuples())!=nbTuplesFineExp) + mcIdType nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); + if(fineDA->getNumberOfTuples()!=nbTuplesFineExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::CondenseFineToCoarseGhost : Expecting " << nbTuplesFineExp << " tuples in fine DataArray having " << nbTuplesFine << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -550,17 +550,17 @@ void MEDCouplingIMesh::SpreadCoarseToFine(const DataArrayDouble *coarseDA, const throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : the parameters 1 or 3 are NULL or not allocated !"); std::size_t meshDim(coarseSt.size()); mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseSt)),nbOfTuplesInFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(fineLocInCoarse)); - mcIdType nbCompo=ToIdType(fineDA->getNumberOfComponents()); - if(ToIdType(coarseDA->getNumberOfComponents())!=nbCompo) + std::size_t nbCompo=fineDA->getNumberOfComponents(); + if(coarseDA->getNumberOfComponents()!=nbCompo) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : the number of components of fine DA and coarse one mismatches !"); if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !"); - if(ToIdType(coarseDA->getNumberOfTuples())!=nbOfTuplesInCoarseExp) + if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFine : Expecting " << nbOfTuplesInCoarseExp << " tuples having " << coarseDA->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - mcIdType nbTuplesFine=ToIdType(fineDA->getNumberOfTuples()); + mcIdType nbTuplesFine(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())); @@ -657,12 +657,12 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, std::vector coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); std::size_t meshDim(coarseSt.size()); mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); - mcIdType nbCompo=ToIdType(fineDA->getNumberOfComponents()); - if(ToIdType(coarseDA->getNumberOfComponents())!=nbCompo) + std::size_t nbCompo=fineDA->getNumberOfComponents(); + if(coarseDA->getNumberOfComponents()!=nbCompo) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhost : the number of components of fine DA and coarse one mismatches !"); if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhost : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !"); - if(ToIdType(coarseDA->getNumberOfTuples())!=nbOfTuplesInCoarseExp) + if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFineGhost : Expecting " << nbOfTuplesInCoarseExp << " tuples having " << coarseDA->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -671,8 +671,8 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, std::vector fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies()); std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); - mcIdType nbTuplesFine=ToIdType(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); - if(ToIdType(fineDA->getNumberOfTuples())!=nbTuplesFineExp) + mcIdType nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); + if(fineDA->getNumberOfTuples()!=nbTuplesFineExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFineGhost : Expecting " << nbTuplesFineExp << " tuples in fine DataArray having " << nbTuplesFine << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -703,7 +703,7 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, } case 2: { - SpreadCoarseToFineGhost2D(inPtr,outPtr,nbCompo,coarseSt,fineLocInCoarse,facts,ghostSize); + SpreadCoarseToFineGhost2D(inPtr,outPtr,ToIdType(nbCompo),coarseSt,fineLocInCoarse,facts,ghostSize); break; } case 3: @@ -713,13 +713,13 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, int nxyWgCoarse((coarseSt[0]+2*ghostSize)*(coarseSt[1]+2*ghostSize)),nxyWgFine((dims[0]*fact0+2*ghostSize)*(dims[1]*fact1+2*ghostSize)); int offset((fineLocInCoarse[2].first+ghostSize-1)*nxyWgCoarse);//offset is always >=0 thanks to the fact that ghostSize>=1 ! for(int i=0;i coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); std::size_t meshDim(coarseSt.size()); mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); - mcIdType nbCompo=ToIdType(fineDA->getNumberOfComponents()); - if(ToIdType(coarseDA->getNumberOfComponents())!=nbCompo) + std:size_t nbCompo=fineDA->getNumberOfComponents(); + if(coarseDA->getNumberOfComponents()!=nbCompo) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhostZone : the number of components of fine DA and coarse one mismatches !"); if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhostZone : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !"); - if(ToIdType(coarseDA->getNumberOfTuples())!=nbOfTuplesInCoarseExp) + if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFineGhostZone : Expecting " << nbOfTuplesInCoarseExp << " tuples having " << coarseDA->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -764,8 +764,8 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhostZone(const DataArrayDouble *coarse std::vector fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies()); std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); - mcIdType nbTuplesFine=ToIdType(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); - if(ToIdType(fineDA->getNumberOfTuples())!=nbTuplesFineExp) + mcIdType nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); + if(fineDA->getNumberOfTuples()!=nbTuplesFineExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFineGhostZone : Expecting " << nbTuplesFineExp << " tuples in fine DataArray having " << nbTuplesFine << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -790,7 +790,7 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhostZone(const DataArrayDouble *coarse } case 2: { - SpreadCoarseToFineGhostZone2D(inPtr,outPtr,nbCompo,coarseSt,fineLocInCoarse,facts,ghostSize); + SpreadCoarseToFineGhostZone2D(inPtr,outPtr,ToIdType(nbCompo),coarseSt,fineLocInCoarse,facts,ghostSize); break; } case 3: @@ -799,13 +799,13 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhostZone(const DataArrayDouble *coarse int nxyWgCoarse((coarseSt[0]+2*ghostSize)*(coarseSt[1]+2*ghostSize)),nxyWgFine((dims[0]*fact0+2*ghostSize)*(dims[1]*fact1+2*ghostSize)); int offset((fineLocInCoarse[2].first+ghostSize-1)*nxyWgCoarse);//offset is always >=0 thanks to the fact that ghostSize>=1 ! for(int i=0;i tmp(_mesh2D->giveCellsWithType(revExtTyp)); mcIdType nbOfLevs=ToIdType(_mesh1D->getNumberOfCells()); mcIdType nbOfCells2D=ToIdType(_mesh2D->getNumberOfCells()); - mcIdType nbOfTuples=ToIdType(tmp->getNumberOfTuples()); + mcIdType nbOfTuples(tmp->getNumberOfTuples()); ret->alloc(nbOfLevs*nbOfTuples,1); int *pt(ret->getPointer()); for(int i=0;icheckAllocated(); if(vec->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DenseMatrix::MatVecMult : input vector must have only one component !"); - if(ToIdType(vec->getNumberOfTuples())!=mat->getNumberOfCols()) + 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(),ToIdType(vec->getNumberOfTuples()),1,ret->getPointer()); + INTERP_KERNEL::matrixProduct(mat->getData()->begin(),mat->getNumberOfRows(),mat->getNumberOfCols(),vec->begin(),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),ToIdType(a2->getNumberOfTuples()),1)); + MCAuto a2Bis(DenseMatrix::New(const_cast(a2),a2->getNumberOfTuples(),1)); return DenseMatrix::Multiply(a1,a2Bis); } diff --git a/src/MEDCoupling/MEDCouplingMemArray.cxx b/src/MEDCoupling/MEDCouplingMemArray.cxx index 81a59de1b..52a0cb4a2 100755 --- a/src/MEDCoupling/MEDCouplingMemArray.cxx +++ b/src/MEDCoupling/MEDCouplingMemArray.cxx @@ -1731,7 +1731,7 @@ double DataArrayDouble::distanceToTuple(const double *tupleBg, const double *tup checkAllocated(); mcIdType nbTuple(getNumberOfTuples()); std::size_t nbComps(getNumberOfComponents()); - if(nbComps!=std::distance(tupleBg,tupleEnd)) + if(nbComps!=(std::size_t)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) throw INTERP_KERNEL::Exception("DataArrayDouble::distanceToTuple : no tuple in this ! No distance to compute !"); @@ -3230,7 +3230,7 @@ DataArrayDouble *DataArrayDouble::Dot(const DataArrayDouble *a1, const DataArray ret->alloc(nbOfTuple,1); double *retPtr=ret->getPointer(); const double *a1Ptr=a1->begin(),*a2Ptr(a2->begin()); - for(std::size_t i=0;igetNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayInt::switchOnTupleEqualTo : number of components of this should be equal to one !"); mcIdType nbOfTuples(this->getNumberOfTuples()); - if(nbOfTuples!=vec.size()) + if(nbOfTuples!=ToIdType(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(mcIdType i=0;i1) { @@ -7275,7 +7275,7 @@ struct NotInRange previousArrI=*arrIPtr; *arrIPtr=ToIdType(arrOut.size()); } - if(arr->getNumberOfTuples()==arrOut.size()) + if(arr->getNumberOfTuples()==ToIdType(arrOut.size())) return false; arr->alloc(arrOut.size(),1); std::copy(arrOut.begin(),arrOut.end(),arr->getPointer()); diff --git a/src/MEDCoupling/MEDCouplingMemArrayChar.cxx b/src/MEDCoupling/MEDCouplingMemArrayChar.cxx index 9b77c6356..fb0cf3d0e 100755 --- a/src/MEDCoupling/MEDCouplingMemArrayChar.cxx +++ b/src/MEDCoupling/MEDCouplingMemArrayChar.cxx @@ -142,7 +142,7 @@ bool DataArrayChar::isUniform(char val) const checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayChar::isUniform : must be applied on DataArrayChar with only one component, you can call 'rearrange' method before !"); - mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); + mcIdType nbOfTuples=getNumberOfTuples(); const char *w=getConstPointer(); const char *end2=w+nbOfTuples; for(;w!=end2;w++) @@ -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); - mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); + mcIdType nbOfTuples=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); - mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); + mcIdType nbOfTuples=getNumberOfTuples(); for(int i=0;ipushBackSilent(i); @@ -247,8 +247,7 @@ DataArrayInt *DataArrayChar::findIdsNotEqual(char val) const int DataArrayChar::findIdSequence(const std::vector& vals) const { checkAllocated(); - mcIdType nbOfCompo=ToIdType(getNumberOfComponents()); - if(nbOfCompo!=1) + if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayChar::findIdSequence : works only for DataArrayChar instance with one component !"); const char *cptr=getConstPointer(); std::size_t nbOfVals=getNbOfElems(); @@ -273,10 +272,10 @@ int DataArrayChar::findIdSequence(const std::vector& vals) const int DataArrayChar::findIdFirstEqualTuple(const std::vector& tupl) const { checkAllocated(); - mcIdType nbOfCompo=ToIdType(getNumberOfComponents()); + std::size_t nbOfCompo=getNumberOfComponents(); if(nbOfCompo==0) throw INTERP_KERNEL::Exception("DataArrayChar::findIdFirstEqualTuple : 0 components in 'this' !"); - if(nbOfCompo!=(int)tupl.size()) + if(nbOfCompo!=tupl.size()) { std::ostringstream oss; oss << "DataArrayChar::findIdFirstEqualTuple : 'this' contains " << nbOfCompo << " components and searching for a tuple of length " << tupl.size() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -291,7 +290,7 @@ int DataArrayChar::findIdFirstEqualTuple(const std::vector& tupl) const if(std::distance(cptr,work)%nbOfCompo!=0) work++; else - return ToIdType(std::distance(cptr,work))/nbOfCompo; + return ToIdType(std::distance(cptr,work)/nbOfCompo); } } return -1; @@ -346,7 +345,7 @@ 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(); - mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); + mcIdType nbOfTuples=getNumberOfTuples(); const char *ret=std::find(cptr,cptr+nbOfTuples,value); if(ret!=cptr+nbOfTuples) return ToIdType(std::distance(cptr,ret)); @@ -366,7 +365,7 @@ 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(); - mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); + mcIdType nbOfTuples=getNumberOfTuples(); for(const char *w=cptr;w!=cptr+nbOfTuples;w++) if(vals2.find(*w)!=vals2.end()) return ToIdType(std::distance(cptr,w)); @@ -389,7 +388,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); - mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); + mcIdType nbOfTuples=getNumberOfTuples(); for(int i=0;i=vmin && *cptrpushBackSilent(i); @@ -444,7 +443,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()); - std::size_t nbt=(*it++)->getNumberOfTuples(); + mcIdType nbt=(*it++)->getNumberOfTuples(); for(int i=1;it!=a.end();it++,i++) { if((*it)->getNumberOfComponents()!=nbOfComp) @@ -510,23 +509,23 @@ DataArrayChar *DataArrayChar::Meld(const std::vector& arr for(it=a.begin();it!=a.end();it++) (*it)->checkAllocated(); it=a.begin(); - std::size_t nbOfTuples=(*it)->getNumberOfTuples(); - std::vector nbc(a.size()); + mcIdType nbOfTuples=(*it)->getNumberOfTuples(); + std::vector nbc(a.size()); std::vector pts(a.size()); - nbc[0]=ToIdType((*it)->getNumberOfComponents()); + nbc[0]=(*it)->getNumberOfComponents(); pts[0]=(*it++)->getConstPointer(); for(std::size_t i=1;it!=a.end();it++,i++) { if(nbOfTuples!=(*it)->getNumberOfTuples()) throw INTERP_KERNEL::Exception("DataArrayChar::meld : mismatch of number of tuples !"); - nbc[i]=ToIdType((*it)->getNumberOfComponents()); + nbc[i]=(*it)->getNumberOfComponents(); pts[i]=(*it)->getConstPointer(); } - int totalNbOfComp=std::accumulate(nbc.begin(),nbc.end(),0); + std::size_t totalNbOfComp=std::accumulate(nbc.begin(),nbc.end(),(std::size_t)0); DataArrayChar *ret=a[0]->buildEmptySpecializedDAChar(); ret->alloc(nbOfTuples,totalNbOfComp); char *retPtr=ret->getPointer(); - for(std::size_t i=0;i& arr } int k=0; for(int i=0;i<(int)a.size();i++) - for(int j=0;jsetInfoOnComponent(k,a[i]->getInfoOnComponent(j)); return ret; } @@ -625,8 +624,8 @@ void DataArrayByte::reprWithoutNameStream(std::ostream& stream) const if(_mem.reprHeader(ToIdType(getNumberOfComponents()),stream)) { const char *data=begin(); - mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); - mcIdType nbCompo=ToIdType(getNumberOfComponents()); + mcIdType nbOfTuples=getNumberOfTuples(); + std::size_t nbCompo=getNumberOfComponents(); for(int i=0;i=1) @@ -671,7 +671,7 @@ void DataArrayByte::reprQuickOverview(std::ostream& stream) const std::size_t nbOfCompo=_info_on_compo.size(); if(nbOfCompo>=1) { - std::size_t nbOfTuples=getNumberOfTuples(); + mcIdType 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(); - mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); - mcIdType nbOfCompo=ToIdType(_info_on_compo.size()); + mcIdType nbOfTuples=getNumberOfTuples(); + std::size_t nbOfCompo=_info_on_compo.size(); std::ostringstream oss2; oss2 << "["; std::string oss2Str(oss2.str()); bool isFinished=true; @@ -695,7 +695,7 @@ void DataArrayByte::reprQuickOverviewData(std::ostream& stream, std::size_t maxN if(nbOfCompo>1) { oss2 << "("; - for(int j=0;j DataArrayByte::toVectorOfBool() const checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayByte::toVectorOfBool : this method can be used only if this has one component !"); - mcIdType nbt=ToIdType(getNumberOfTuples()); + mcIdType nbt(getNumberOfTuples()); std::vector ret(nbt,false); const char *pt(begin()); for(int i=0;iincrRef(); if(_da->isAllocated()) { - _nb_comp=ToIdType(da->getNumberOfComponents()); - _nb_tuple=ToIdType(da->getNumberOfTuples()); + _nb_comp=da->getNumberOfComponents(); + _nb_tuple=da->getNumberOfTuples(); _pt=da->getPointer(); } } @@ -784,7 +784,7 @@ DataArrayByteTuple::DataArrayByteTuple(char *pt, std::size_t nbOfComp):_pt(pt),_ std::string DataArrayByteTuple::repr() const { std::ostringstream oss; oss << "("; - for(int i=0;i<_nb_of_compo-1;i++) + for(std::size_t i=0;i<_nb_of_compo-1;i++) oss << (int)_pt[i] << ", "; oss << _pt[_nb_of_compo-1] << ")"; return oss.str(); @@ -977,8 +977,8 @@ void DataArrayAsciiChar::reprWithoutNameStream(std::ostream& stream) const if(_mem.reprHeader(ToIdType(getNumberOfComponents()),stream)) { const char *data=begin(); - mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); - mcIdType nbCompo=ToIdType(getNumberOfComponents()); + mcIdType nbOfTuples=getNumberOfTuples(); + std::size_t nbCompo=getNumberOfComponents(); for(int i=0;i=1) @@ -1022,7 +1023,7 @@ void DataArrayAsciiChar::reprQuickOverview(std::ostream& stream) const std::size_t nbOfCompo=_info_on_compo.size(); if(nbOfCompo>=1) { - std::size_t nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=getNumberOfTuples(); stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl; reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR); } @@ -1036,27 +1037,27 @@ void DataArrayAsciiChar::reprQuickOverview(std::ostream& stream) const void DataArrayAsciiChar::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const { const char *data=begin(); - mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); - mcIdType nbOfCompo=ToIdType(_info_on_compo.size()); + mcIdType nbOfTuples=getNumberOfTuples(); + std::size_t nbOfCompo=_info_on_compo.size(); std::ostringstream oss2; oss2 << "["; std::string oss2Str(oss2.str()); bool isFinished=true; for(int i=0;iincrRef(); if(_da->isAllocated()) { - _nb_comp=ToIdType(da->getNumberOfComponents()); - _nb_tuple=ToIdType(da->getNumberOfTuples()); + _nb_comp=da->getNumberOfComponents(); + _nb_tuple=da->getNumberOfTuples(); _pt=da->getPointer(); } } diff --git a/src/MEDCoupling/MEDCouplingMemArrayFloat.cxx b/src/MEDCoupling/MEDCouplingMemArrayFloat.cxx index 126287179..3e454f0ff 100644 --- a/src/MEDCoupling/MEDCouplingMemArrayFloat.cxx +++ b/src/MEDCoupling/MEDCouplingMemArrayFloat.cxx @@ -40,7 +40,8 @@ DataArrayFloat *DataArrayFloat::deepCopy() const void DataArrayFloat::reprCppStream(const std::string& varName, std::ostream& stream) const { - mcIdType nbTuples=ToIdType(getNumberOfTuples()),nbComp=ToIdType(getNumberOfComponents()); + mcIdType nbTuples(getNumberOfTuples()); + std::size_t nbComp(getNumberOfComponents()); const float *data(begin()); stream.precision(7); stream << "DataArrayFloat *" << varName << "=DataArrayFloat::New();" << std::endl; @@ -65,7 +66,7 @@ void DataArrayFloat::reprQuickOverview(std::ostream& stream) const int nbOfCompo=(int)_info_on_compo.size(); if(nbOfCompo>=1) { - std::size_t nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=getNumberOfTuples(); stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl; reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR); } @@ -79,8 +80,8 @@ void DataArrayFloat::reprQuickOverview(std::ostream& stream) const void DataArrayFloat::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const { const float *data(begin()); - mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); - mcIdType nbOfCompo=ToIdType(_info_on_compo.size()); + mcIdType nbOfTuples(getNumberOfTuples()); + std::size_t nbOfCompo=_info_on_compo.size(); std::ostringstream oss2; oss2 << "["; oss2.precision(7); std::string oss2Str(oss2.str()); @@ -90,7 +91,7 @@ void DataArrayFloat::reprQuickOverviewData(std::ostream& stream, std::size_t max if(nbOfCompo>1) { oss2 << "("; - for(int j=0;j ret; getCellsContainingPoint(work,eps,ret); elts->insertAtTheEnd(ret.begin(),ret.end()); - eltsIndexPtr[i+1]=ToIdType(elts->getNumberOfTuples()); + eltsIndexPtr[i+1]=elts->getNumberOfTuples(); } } diff --git a/src/MEDCoupling/MEDCouplingPartDefinition.cxx b/src/MEDCoupling/MEDCouplingPartDefinition.cxx index 1b631d935..ce270590a 100644 --- a/src/MEDCoupling/MEDCouplingPartDefinition.cxx +++ b/src/MEDCoupling/MEDCouplingPartDefinition.cxx @@ -104,7 +104,7 @@ DataArrayPartDefinition *DataArrayPartDefinition::deepCopy() const int DataArrayPartDefinition::getNumberOfElems() const { checkInternalArrayOK(); - return ToIdType(_arr->getNumberOfTuples()); + return _arr->getNumberOfTuples(); } PartDefinition *DataArrayPartDefinition::operator+(const PartDefinition& other) const diff --git a/src/MEDCoupling/MEDCouplingPointSet.cxx b/src/MEDCoupling/MEDCouplingPointSet.cxx index d8762c9cd..951358aaf 100755 --- a/src/MEDCoupling/MEDCouplingPointSet.cxx +++ b/src/MEDCoupling/MEDCouplingPointSet.cxx @@ -55,7 +55,7 @@ MEDCouplingPointSet::~MEDCouplingPointSet() int MEDCouplingPointSet::getNumberOfNodes() const { if(_coords) - return ToIdType(_coords->getNumberOfTuples()); + return _coords->getNumberOfTuples(); else throw INTERP_KERNEL::Exception("Unable to get number of nodes 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(); - mcIdType nbOfValues=ToIdType(_coords->getNbOfElems()); + std::size_t nbOfValues=_coords->getNbOfElems(); return std::abs(*std::max_element(coords,coords+nbOfValues,MEDCouplingCompAbs())); } @@ -1438,7 +1438,7 @@ void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int mcIdType nbCells=ToIdType(getNumberOfCells()); if (nbCells != ToIdType(other->getNumberOfCells())) throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some cells in other are not in this !"); - mcIdType dan=ToIdType(da->getNumberOfTuples()); + mcIdType dan(da->getNumberOfTuples()); if (dan) { MCAuto da1(DataArrayInt::New()),da2(DataArrayInt::New()); @@ -1450,8 +1450,8 @@ void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some cells in other are not in this !"); } 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(); + nodeCor=nodeCor2->isIota(nodeCor2->getNumberOfTuples())?0:nodeCor2.retn(); + cellCor=cellCor2->isIota(cellCor2->getNumberOfTuples())?0:cellCor2.retn(); } /*! @@ -1495,7 +1495,7 @@ void MEDCouplingPointSet::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh throw INTERP_KERNEL::Exception("checkDeepEquivalOnSameNodesWith : some cells in other are not in this !"); } MCAuto cellCor2=da->selectByTupleIdSafeSlice(ToIdType(getNumberOfCells()),ToIdType(da->getNbOfElems()),1); - cellCor=cellCor2->isIota(ToIdType(cellCor2->getNumberOfTuples()))?0:cellCor2.retn(); + cellCor=cellCor2->isIota(cellCor2->getNumberOfTuples())?0:cellCor2.retn(); } void MEDCouplingPointSet::checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const diff --git a/src/MEDCoupling/MEDCouplingRemapper.cxx b/src/MEDCoupling/MEDCouplingRemapper.cxx index 7cf6cf73b..2318f4890 100755 --- a/src/MEDCoupling/MEDCouplingRemapper.cxx +++ b/src/MEDCoupling/MEDCouplingRemapper.cxx @@ -245,11 +245,11 @@ void MEDCouplingRemapper::reverseTransfer(MEDCouplingFieldDouble *srcField, cons throw INTERP_KERNEL::Exception(oss.str().c_str()); } DataArrayDouble *array(srcField->getArray()); - mcIdType trgNbOfCompo=ToIdType(targetField->getNumberOfComponents()); + std::size_t trgNbOfCompo=targetField->getNumberOfComponents(); if(array) { srcField->checkConsistencyLight(); - if(trgNbOfCompo!=srcField->getNumberOfTuplesExpected()) + if(trgNbOfCompo!=(std::size_t)srcField->getNumberOfTuplesExpected()) throw INTERP_KERNEL::Exception("Number of components mismatch !"); } else @@ -261,7 +261,7 @@ void MEDCouplingRemapper::reverseTransfer(MEDCouplingFieldDouble *srcField, cons computeDeno(srcField->getNature(),srcField,targetField); double *resPointer(srcField->getArray()->getPointer()); const double *inputPointer=targetField->getArray()->getConstPointer(); - computeReverseProduct(inputPointer,trgNbOfCompo,dftValue,resPointer); + computeReverseProduct(inputPointer,ToIdType(trgNbOfCompo),dftValue,resPointer); } /*! @@ -881,7 +881,7 @@ int MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss() MCAuto srcLoc=_src_ft->getLocalizationOfDiscr(); const double *srcLocPtr=srcLoc->begin(); MCAuto eltsArr,eltsIndexArr; - mcIdType trgNbOfGaussPts=ToIdType(trgLoc->getNumberOfTuples()); + mcIdType trgNbOfGaussPts=trgLoc->getNumberOfTuples(); _matrix.resize(trgNbOfGaussPts); _src_ft->getMesh()->getCellsContainingPointsLinearPartOnlyOnNonDynType(trgLoc->begin(),trgNbOfGaussPts,getPrecision(),eltsArr,eltsIndexArr); const int *elts(eltsArr->begin()),*eltsIndex(eltsIndexArr->begin()); @@ -904,7 +904,7 @@ int MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss() } _matrix[*trgId][srcEntry]=1.; } - if(ToIdType(ids0->getNumberOfTuples())!=trgNbOfGaussPts) + if(ids0->getNumberOfTuples()!=trgNbOfGaussPts) { MCAuto orphanTrgIds=nbOfSrcCellsShTrgPts->findIdsEqual(0); MCAuto orphanTrg=trgLoc->selectByTupleId(orphanTrgIds->begin(),orphanTrgIds->end()); @@ -1074,11 +1074,11 @@ void MEDCouplingRemapper::transferUnderground(const MEDCouplingFieldDouble *srcF throw INTERP_KERNEL::Exception(oss.str().c_str()); } DataArrayDouble *array(targetField->getArray()); - mcIdType srcNbOfCompo=ToIdType(srcField->getNumberOfComponents()); + std::size_t srcNbOfCompo(srcField->getNumberOfComponents()); if(array) { targetField->checkConsistencyLight(); - if(srcNbOfCompo!=ToIdType(targetField->getNumberOfComponents())) + if(srcNbOfCompo!=targetField->getNumberOfComponents()) throw INTERP_KERNEL::Exception("Number of components mismatch !"); } else @@ -1092,7 +1092,7 @@ void MEDCouplingRemapper::transferUnderground(const MEDCouplingFieldDouble *srcF computeDeno(srcField->getNature(),srcField,targetField); double *resPointer(targetField->getArray()->getPointer()); const double *inputPointer(srcField->getArray()->getConstPointer()); - computeProduct(inputPointer,srcNbOfCompo,isDftVal,dftValue,resPointer); + computeProduct(inputPointer,ToIdType(srcNbOfCompo),isDftVal,dftValue,resPointer); } void MEDCouplingRemapper::computeDeno(NatureOfField nat, const MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *trgField) diff --git a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx index b9e75be70..0f5387686 100755 --- a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx +++ b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx @@ -316,7 +316,7 @@ 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 !"); - mcIdType nbTuples=ToIdType(profile->getNumberOfTuples()); + mcIdType nbTuples(profile->getNumberOfTuples()); mcIdType nbOfCells=ToIdType(getNumberOfCells()); code.resize(3); idsInPflPerType.resize(1); code[0]=(int)getTypeOfCell(0); code[1]=nbOfCells; @@ -328,7 +328,7 @@ void MEDCouplingStructuredMesh::splitProfilePerType(const DataArrayInt *profile, idsPerType.clear(); return ; } - code[1]=ToIdType(profile->getNumberOfTuples()); + code[1]=profile->getNumberOfTuples(); code[2]=0; profile->checkAllIdsInRange(0,nbOfCells); idsPerType.resize(1); @@ -1709,10 +1709,11 @@ DataArrayDouble *MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(const std:: throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom : input array of double is NULL or not allocated!"); if(st.size()!=partCompactFormat.size()) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom : input arrays must have the same size !"); - if(ToIdType(fieldOfDbl->getNumberOfTuples())!=DeduceNumberOfGivenStructure(st)) + if(fieldOfDbl->getNumberOfTuples()!=DeduceNumberOfGivenStructure(st)) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom : invalid size of input array of double regarding the structure !"); std::vector dims(GetDimensionsFromCompactFrmt(partCompactFormat)); - int nbOfTuplesOfOutField(DeduceNumberOfGivenStructure(dims)),nbComp(ToIdType(fieldOfDbl->getNumberOfComponents())); + int nbOfTuplesOfOutField(DeduceNumberOfGivenStructure(dims)); + std::size_t nbComp(fieldOfDbl->getNumberOfComponents()); MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfTuplesOfOutField,nbComp); ret->copyStringInfoFrom(*fieldOfDbl); double *ptRet(ret->getPointer()); @@ -1977,8 +1978,9 @@ 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(ToIdType(da->getNumberOfComponents())); - if(ToIdType(da->getNumberOfTuples())!=nbOfTuplesExp) + int nbOfTuplesExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(st)); + std::size_t nbCompo(da->getNumberOfComponents()); + if(da->getNumberOfTuples()!=nbOfTuplesExp) { std::ostringstream oss; oss << "MEDCouplingStructuredMesh::MultiplyPartOf : invalid nb of tuples ! Expected " << nbOfTuplesExp << " having " << da->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); diff --git a/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx b/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx index 9dd25fa7f..98373fdd9 100644 --- a/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx +++ b/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx @@ -2252,7 +2252,7 @@ void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation(std::vectorgetNumberOfTuples())); + tinyInfo.push_back(_end_array->getNumberOfTuples()); tinyInfo.push_back(ToIdType(_end_array->getNumberOfComponents())); } else @@ -2271,10 +2271,10 @@ void MEDCouplingTwoTimeSteps::getTinySerializationDbleInformation(std::vector& tinyInfo) const { - mcIdType nbOfCompo=ToIdType(_array->getNumberOfComponents()); - for(int i=0;igetNumberOfComponents(); + for(std::size_t i=0;igetInfoOnComponent(i)); - for(int i=0;igetInfoOnComponent(i)); } @@ -2508,7 +2508,7 @@ void MEDCouplingLinearTime::getValueOnTime(int eltId, double time, double *value _array->getTuple(eltId,value); else throw INTERP_KERNEL::Exception("No start array existing."); - mcIdType nbComp=ToIdType(_array->getNumberOfComponents()); + std::size_t nbComp=_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 9a29ca398..ced70b7ad 100644 --- a/src/MEDCoupling/MEDCouplingTimeDiscretization.txx +++ b/src/MEDCoupling/MEDCouplingTimeDiscretization.txx @@ -229,7 +229,7 @@ namespace MEDCoupling { if(_array) { - tinyInfo.push_back(ToIdType(_array->getNumberOfTuples())); + tinyInfo.push_back(_array->getNumberOfTuples()); tinyInfo.push_back(ToIdType(_array->getNumberOfComponents())); } else @@ -248,8 +248,8 @@ namespace MEDCoupling template void MEDCouplingTimeDiscretizationTemplate::getTinySerializationStrInformation(std::vector& tinyInfo) const { - mcIdType nbOfCompo=ToIdType(_array->getNumberOfComponents()); - for(int i=0;igetNumberOfComponents()); + for(std::size_t i=0;igetInfoOnComponent(i)); } @@ -292,8 +292,8 @@ namespace MEDCoupling void MEDCouplingTimeDiscretizationTemplate::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS) { _time_tolerance=tinyInfoD[0]; - mcIdType nbOfCompo=ToIdType(_array->getNumberOfComponents()); - for(int i=0;igetNumberOfComponents(); + for(std::size_t i=0;isetInfoOnComponent(i,tinyInfoS[i]); } diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index 0f2d3f486..fec373339 100755 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -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(ToIdType(cellNeigh->getNumberOfTuples())); + cellNeighIndex->pushBackSilent(cellNeigh->getNumberOfTuples()); } } @@ -842,7 +842,7 @@ void MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, cons const int *revDescPtr=revDesc->begin(); const int *revDescIPtr=revDescIndx->begin(); // - mcIdType nbCells=ToIdType(descIndx->getNumberOfTuples())-1; + mcIdType nbCells=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=ToIdType(out0->getNumberOfTuples()); + *out1Ptr=out0->getNumberOfTuples(); } neighbors=out0.retn(); neighborsIndx=out1.retn(); @@ -1326,7 +1326,7 @@ void MEDCouplingUMesh::simplifyPolyhedra(double eps) } else connNew->insertAtTheEnd(conn+index[i],conn+index[i+1]); - *connINewPtr=ToIdType(connNew->getNumberOfTuples()); + *connINewPtr=connNew->getNumberOfTuples(); } if(changed) setConnectivity(connNew,connINew,false); @@ -1721,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); - mcIdType nbOfCells=ToIdType(nodalI->getNumberOfTuples())-1; + mcIdType nbOfCells=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(); @@ -1753,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(ToIdType(commonCells->getNumberOfTuples())); + commonCellsI->pushBackSilent(commonCells->getNumberOfTuples()); for(const int *it=commonCells->begin()+pos;it!=commonCells->end();it++) isFetched[*it]=true; } @@ -1786,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(ToIdType(commonCells->getNumberOfTuples())); + commonCellsI->pushBackSilent(commonCells->getNumberOfTuples()); for(const int *it=commonCells->begin()+pos;it!=commonCells->end();it++) isFetched[*it]=true; } @@ -1866,8 +1866,8 @@ bool MEDCouplingUMesh::areCellsIncludedInPolicy7(const MEDCouplingUMesh *other, arr2->alloc(otherNbCells,1); arr2->fillWithZero(); int *arr2Ptr=arr2->getPointer(); - mcIdType nbOfCommon=ToIdType(commonCellsI->getNumberOfTuples())-1; - for(int i=0;igetNumberOfTuples()-1; + for(mcIdType i=0;igetPointer(); cnt < connexCheck->getNumberOfTuples(); ptr++, cnt++) hitCells->setIJ(*ptr,0,1); // Connex zone WITH the crack (to identify cells lying on either part of the crack) @@ -2418,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(ToIdType(neighI00->getNumberOfTuples())-1); + DAInt cellsToModifyConn1_torenum=cellsToModifyConn0_torenum->buildComplement(neighI00->getNumberOfTuples()-1); cellsToModifyConn0_torenum->transformWithIndArr(cellsAroundGroup->begin(),cellsAroundGroup->end()); cellsToModifyConn1_torenum->transformWithIndArr(cellsAroundGroup->begin(),cellsAroundGroup->end()); // @@ -3646,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(ToIdType(conn->getNumberOfTuples())); + connI->pushBackSilent(conn->getNumberOfTuples()); cellIds2->pushBackSilent(i); } else @@ -3657,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(ToIdType(conn->getNumberOfTuples())); + connI->pushBackSilent(conn->getNumberOfTuples()); cellIds2->pushBackSilent(cellId3DSurf); } } @@ -3720,7 +3720,7 @@ MCAuto MEDCouplingUMesh::clipSingle3DCellByPlane(const double { conn->pushBackSilent((int)INTERP_KERNEL::NORM_POLYGON); conn->insertAtTheEnd(res[i].begin(),res[i].end()); - connI->pushBackSilent(ToIdType(conn->getNumberOfTuples())); + connI->pushBackSilent(conn->getNumberOfTuples()); } MCAuto ret(MEDCouplingUMesh::New("",2)); ret->setCoords(mDesc1->getCoords()); @@ -3778,9 +3778,9 @@ MCAuto MEDCouplingUMesh::clipSingle3DCellByPlane(const double } } conn2->insertAtTheEnd(cell0.begin(),cell0.end()); - conn2I->pushBackSilent(ToIdType(conn2->getNumberOfTuples())); + conn2I->pushBackSilent(conn2->getNumberOfTuples()); conn2->insertAtTheEnd(cell1.begin(),cell1.end()); - conn2I->pushBackSilent(ToIdType(conn2->getNumberOfTuples())); + conn2I->pushBackSilent(conn2->getNumberOfTuples()); ret2->setConnectivity(conn2,conn2I,true); ret2->checkConsistencyLight(); ret2->orientCorrectlyPolyhedrons(); @@ -3820,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,ToIdType(coo->getNumberOfTuples()),coo->getPointer(),coo->getPointer()); + DataArrayDouble::Rotate3DAlg(origin,vec2,angle,coo->getNumberOfTuples(),coo->getPointer(),coo->getPointer()); MCAuto mw=clone(false);//false -> shallow copy mw->setCoords(coo); mw->getBoundingBox(bbox); @@ -3979,7 +3979,7 @@ DataArrayDouble *MEDCouplingUMesh::distanceToPoints(const DataArrayDouble *pts, mcIdType nbCells=ToIdType(getNumberOfCells()); if(nbCells==0) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::distanceToPoints : no cells in this !"); - mcIdType nbOfPts=ToIdType(pts->getNumberOfTuples()); + mcIdType nbOfPts=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(); @@ -4233,11 +4233,11 @@ DataArrayInt *MEDCouplingUMesh::convexEnvelop2D() isChanged->alloc(0,1); for(int i=0;igetNumberOfTuples()); + mcIdType pos=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]=ToIdType(nodalConnecOut->getNumberOfTuples()); + workIndexOut[1]=nodalConnecOut->getNumberOfTuples(); } if(isChanged->empty()) return 0; @@ -4716,7 +4716,7 @@ DataArrayInt *MEDCouplingUMesh::convertDegeneratedCellsAndRemoveFlatOnes() } if(newPos!=initMeshLgth) _nodal_connec->reAlloc(newPos); - const mcIdType nCellDel=ToIdType(ret->getNumberOfTuples()); + const mcIdType nCellDel=ret->getNumberOfTuples(); if (nCellDel) _nodal_connec_index->reAlloc(nbOfCells-nCellDel+1); computeTypes(); @@ -5417,7 +5417,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::computeDiameterField() const ret->setMesh(this); std::set types; ComputeAllTypesInternal(types,_nodal_connec,_nodal_connec_index); - mcIdType spaceDim(ToIdType(getSpaceDimension())),nbCells(ToIdType(getNumberOfCells())); + mcIdType spaceDim(getSpaceDimension()),nbCells(ToIdType(getNumberOfCells())); MCAuto arr(DataArrayDouble::New()); arr->alloc(nbCells,1); for(std::set::const_iterator it=types.begin();it!=types.end();it++) @@ -5819,7 +5819,7 @@ void MEDCouplingUMesh::splitProfilePerType(const DataArrayInt *profile, std::vec MCAuto tmp1=rankInsideCast; MCAuto tmp2=castsPresent; // - mcIdType nbOfCastsFinal=ToIdType(castsPresent->getNumberOfTuples()); + mcIdType nbOfCastsFinal=castsPresent->getNumberOfTuples(); code.resize(3*nbOfCastsFinal); std::vector< MCAuto > idsInPflPerType2; std::vector< MCAuto > idsPerType2; @@ -5829,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]=ToIdType(tmp3->getNumberOfTuples()); + code[3*i+1]=tmp3->getNumberOfTuples(); MCAuto tmp4=rankInsideCast->selectByTupleId(tmp3->begin(),tmp3->begin()+tmp3->getNumberOfTuples()); if(!smartPflKiller || !tmp4->isIota(typeRangeVals[castId+1]-typeRangeVals[castId])) { @@ -6210,7 +6210,7 @@ void MEDCouplingUMesh::convertNodalConnectivityToDynamicGeoTypeMesh(DataArrayInt if(_types.size()!=1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertNodalConnectivityToDynamicGeoTypeMesh : current mesh does not contain exactly one geometric type !"); mcIdType nbCells=ToIdType(getNumberOfCells()), - lgth=ToIdType(_nodal_connec->getNumberOfTuples()); + lgth=_nodal_connec->getNumberOfTuples(); if(lgth c(DataArrayInt::New()),ci(DataArrayInt::New()); @@ -6685,7 +6685,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::Build0DMeshFromCoords(DataArrayDouble *da) if(name.empty()) ret->setName("Mesh"); ret->setCoords(da); - mcIdType nbOfTuples=ToIdType(da->getNumberOfTuples()); + mcIdType nbOfTuples(da->getNumberOfTuples()); MCAuto c(DataArrayInt::New()),cI(DataArrayInt::New()); c->alloc(2*nbOfTuples,1); cI->alloc(nbOfTuples+1,1); @@ -7018,7 +7018,7 @@ void MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(const std::vectorfindCommonTuples(eps,-1,comm,commI); MCAuto tmp1(comm),tmp2(commI); - mcIdType oldNbOfNodes=ToIdType(coo->getNumberOfTuples()); + mcIdType oldNbOfNodes=coo->getNumberOfTuples(); int newNbOfNodes; MCAuto o2n=DataArrayInt::ConvertIndexArrayToO2N(oldNbOfNodes,comm->begin(),commI->begin(),commI->end(),newNbOfNodes); if(oldNbOfNodes==newNbOfNodes) @@ -7189,12 +7189,12 @@ void MEDCouplingUMesh::SimplifyPolyhedronCell(double eps, const DataArrayDouble if (comm1->findIdFirstEqual(i) < 0) { comm1->pushBackSilent(i); - commI1->pushBackSilent(mcIdType(comm1->getNumberOfTuples())); + commI1->pushBackSilent(comm1->getNumberOfTuples()); } MCAuto comm1Auto(comm1),commI1Auto(commI1); const int *comm1Ptr=comm1->begin(); const int *commI1Ptr=commI1->begin(); - mcIdType nbOfGrps1=ToIdType(commI1Auto->getNumberOfTuples())-1; + mcIdType nbOfGrps1=commI1Auto->getNumberOfTuples()-1; res->pushBackSilent((int)INTERP_KERNEL::NORM_POLYHED); // for(int i=0;ifindIdFirstEqual(j) < 0) { comm2->pushBackSilent(j); - commI2->pushBackSilent(ToIdType(comm2->getNumberOfTuples())); + commI2->pushBackSilent(comm2->getNumberOfTuples()); } MCAuto comm2Auto(comm2),commI2Auto(commI2); const int *comm2Ptr=comm2->begin(); const int *commI2Ptr=commI2->begin(); - mcIdType nbOfGrps2=ToIdType(commI2Auto->getNumberOfTuples())-1; + mcIdType nbOfGrps2=commI2Auto->getNumberOfTuples()-1; for(int j=0;jisAllocated()) { stream << std::endl << "Nodal connectivity set but not allocated !"; return ; } - mcIdType lgth=ToIdType(_nodal_connec_index->getNumberOfTuples()); - mcIdType cpt=ToIdType(_nodal_connec_index->getNumberOfComponents()); + mcIdType lgth=_nodal_connec_index->getNumberOfTuples(); + std::size_t cpt=_nodal_connec_index->getNumberOfComponents(); if(cpt!=1 || lgth<1) return ; stream << std::endl << "Number of cells : " << lgth-1 << "."; @@ -7886,7 +7886,7 @@ DataArrayInt *MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(const int *se nbOfDepthPeelingPerformed=0; if(!arrIndxIn) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed : arrIndxIn input pointer is NULL !"); - mcIdType nbOfTuples=ToIdType(arrIndxIn->getNumberOfTuples())-1; + mcIdType nbOfTuples=arrIndxIn->getNumberOfTuples()-1; if(nbOfTuples<=0) { DataArrayInt *ret=DataArrayInt::New(); ret->alloc(0,1); @@ -7938,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),ToIdType(cell->getNumberOfTuples())-1,cell->begin()+1); + ret->insertNextCell((INTERP_KERNEL::NormalizedCellType)cell->getIJSafe(0,0),cell->getNumberOfTuples()-1,cell->begin()+1); } // ret->finishInsertingCells(); @@ -7963,7 +7963,7 @@ std::vector MEDCouplingUMesh::PartitionBySpreadZone(const DataAr if(!arrIn || !arrIndxIn) throw INTERP_KERNEL::Exception("PartitionBySpreadZone : null input pointers !"); arrIn->checkAllocated(); arrIndxIn->checkAllocated(); - mcIdType nbOfTuples=ToIdType(arrIndxIn->getNumberOfTuples()); + mcIdType nbOfTuples(arrIndxIn->getNumberOfTuples()); if(arrIn->getNumberOfComponents()!=1 || arrIndxIn->getNumberOfComponents()!=1 || nbOfTuples<1) throw INTERP_KERNEL::Exception("PartitionBySpreadZone : invalid arrays in input !"); int nbOfCellsCur(nbOfTuples-1); @@ -8068,7 +8068,7 @@ MEDCoupling1SGTUMesh *MEDCouplingUMesh::tetrahedrize(int policy, DataArrayInt *& if(!addPts->empty()) { addPts->rearrange(3); - nbOfAdditionalPoints=ToIdType(addPts->getNumberOfTuples()); + nbOfAdditionalPoints=addPts->getNumberOfTuples(); addPts=DataArrayDouble::Aggregate(getCoords(),addPts); ret0->setCoords(addPts); } diff --git a/src/MEDCoupling/MEDCouplingUMesh_internal.cxx b/src/MEDCoupling/MEDCouplingUMesh_internal.cxx index 510b75556..a47ecc255 100755 --- a/src/MEDCoupling/MEDCouplingUMesh_internal.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh_internal.cxx @@ -395,7 +395,7 @@ void MEDCouplingUMesh::tessellate2DCurveInternal(double eps) newConnIPtr[1]=newConnIPtr[0]+3; } } - if(addCoo.empty() && newConn.size()==_nodal_connec->getNumberOfTuples())//nothing happens during tessellation : no update needed + if(addCoo.empty() && ToIdType(newConn.size())==_nodal_connec->getNumberOfTuples())//nothing happens during tessellation : no update needed return ; _types=types; DataArrayInt::SetArrayIn(newConnI,_nodal_connec_index); @@ -1094,7 +1094,7 @@ DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic2D1(DataArrayInt *& const int *cPtr=_nodal_connec->begin(); const int *icPtr=_nodal_connec_index->begin(); int lastVal=0; - mcIdType offset=ToIdType(coordsTmpSafe->getNumberOfTuples()); + mcIdType offset=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+ToIdType(ret->getNumberOfTuples())); + newConn->pushBackSilent(offset+ret->getNumberOfTuples()); lastVal+=(icPtr[1]-icPtr[0])+(descIPtr[1]-descIPtr[0])+1; newConnI->pushBackSilent(lastVal); ret->pushBackSilent(i); @@ -1163,7 +1163,7 @@ DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic3D1(DataArrayInt *& const int *cPtr=_nodal_connec->begin(); const int *icPtr=_nodal_connec_index->begin(); int lastVal=0; - mcIdType offset=ToIdType(coordsTmpSafe->getNumberOfTuples()); + mcIdType offset=coordsTmpSafe->getNumberOfTuples(); for(int i=0;igetNumberOfTuples()); + mcIdType tmpPos=newConn->getNumberOfTuples(); newConn->pushBackSilent(nodeId2); ret2D->pushBackSilent(nodeId2); ret1D->pushBackSilent(tmpPos); } - newConn->pushBackSilent(offset+ToIdType(ret->getNumberOfTuples())); + newConn->pushBackSilent(offset+ret->getNumberOfTuples()); lastVal+=(icPtr[1]-icPtr[0])+(descIPtr[1]-descIPtr[0])+(desc2IPtr[1]-desc2IPtr[0])+1; newConnI->pushBackSilent(lastVal); ret->pushBackSilent(i); @@ -1201,7 +1201,7 @@ DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic3D1(DataArrayInt *& } } MCAuto diffRet2D=ret2D->getDifferentValues(); - MCAuto o2nRet2D=diffRet2D->invertArrayN2O2O2N(ToIdType(coordsTmp2Safe->getNumberOfTuples())); + MCAuto o2nRet2D=diffRet2D->invertArrayN2O2O2N(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; @@ -1209,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=ToIdType(coordsTmp2Safe->getNumberOfTuples()); + offset=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(); @@ -1440,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 !"); - mcIdType nbOfTuples=ToIdType(arrIndxIn->getNumberOfTuples())-1; + mcIdType nbOfTuples=arrIndxIn->getNumberOfTuples()-1; std::vector fetched2(nbOfTuples,false); int i=0; for(const int *seedElt=seedBg;seedElt!=seedEnd;seedElt++,i++) @@ -1737,7 +1737,7 @@ void MEDCouplingUMesh::assemblyForSplitFrom3DSurf(const std::vector< std::pair3) { nodalRes->insertAtTheEnd(conn.begin(),conn.end()); - nodalResIndx->pushBackSilent(ToIdType(nodalRes->getNumberOfTuples())); + nodalResIndx->pushBackSilent(nodalRes->getNumberOfTuples()); cellIds->pushBackSilent(i); } } diff --git a/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx b/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx index 3bf04217e..6f18e0051 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) { - mcIdType tmp2(0),tmp3(ToIdType(appendedCoords->getNumberOfTuples())/2); + mcIdType tmp2(0),tmp3(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) { - mcIdType tmp2(0),tmp3(ToIdType(appendedCoords->getNumberOfTuples())/2); + mcIdType tmp2(0),tmp3(appendedCoords->getNumberOfTuples()/2); InternalAddPointOriented(e,-1,coords,tmpSrt,tmpEnd,*appendedCoords,tmp2); middles.push_back(tmp3+offset); } @@ -123,7 +123,7 @@ 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 { mcIdType tmpSrt(connBg[start]),tmpEnd(connBg[stp % nbOfEdges]); // % to handle last seg. - mcIdType tmp2(0),tmp3(ToIdType(appendedCoords->getNumberOfTuples())/2); + mcIdType tmp2(0),tmp3(appendedCoords->getNumberOfTuples()/2); InternalAddPointOriented(e,-1,coords,tmpSrt,tmpEnd,*appendedCoords,tmp2); middles.push_back(tmp3+offset); } @@ -567,8 +567,8 @@ MEDCouplingUMesh *BuildMesh1DCutFrom(const MEDCouplingUMesh *mesh1D, const std:: const DataArrayDouble *coo2(mesh1D->getCoords()); const int *c(mesh1D->getNodalConnectivity()->begin()),*ci(mesh1D->getNodalConnectivityIndex()->begin()); const double *coo2Ptr(coo2->begin()); - mcIdType offset1=ToIdType(coords1->getNumberOfTuples()); - mcIdType offset2=(offset1+ToIdType(coo2->getNumberOfTuples())); + mcIdType offset1(coords1->getNumberOfTuples()); + mcIdType offset2(offset1+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); @@ -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); - mcIdType offset=ToIdType(coords->getNumberOfTuples()); + mcIdType offset(coords->getNumberOfTuples()); for(const int *it2(descBg);it2!=descEnd;it2++,ii++) { INTERP_KERNEL::NormalizedCellType typeOfSon; @@ -1296,7 +1296,7 @@ void MEDCouplingUMesh::Intersect1DMeshes(const MEDCouplingUMesh *m1Desc, const M colinear2.resize(nDescCell2); subDiv2.resize(nDescCell2); BBTree myTree(bbox2,0,0,ToIdType(m2Desc->getNumberOfCells()),-eps); - BBTreePts treeNodes2(m2Desc->getCoords()->begin(),0,0,ToIdType(m2Desc->getCoords()->getNumberOfTuples()),eps); + BBTreePts treeNodes2(m2Desc->getCoords()->begin(),0,0,m2Desc->getCoords()->getNumberOfTuples(),eps); std::vector candidates1(1); int offset1(m1Desc->getNumberOfNodes()); @@ -1568,7 +1568,7 @@ void MEDCouplingUMesh::split2DCellsLinear(const DataArrayInt *desc, const DataAr { checkConnectivityFullyDefined(); mcIdType ncells=ToIdType(getNumberOfCells()); - mcIdType lgthToReach(getNodalConnectivityArrayLen()+ToIdType(subNodesInSeg->getNumberOfTuples())); + mcIdType lgthToReach(getNodalConnectivityArrayLen()+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()); @@ -1606,7 +1606,7 @@ int MEDCouplingUMesh::split2DCellsQuadratic(const DataArrayInt *desc, const Data { checkConsistencyLight(); mcIdType ncells=ToIdType(getNumberOfCells()); - mcIdType lgthToReach(getNodalConnectivityArrayLen()+2*ToIdType(subNodesInSeg->getNumberOfTuples())); + mcIdType lgthToReach(getNodalConnectivityArrayLen()+2*subNodesInSeg->getNumberOfTuples()); mcIdType nodesCnt(getNumberOfNodes()); MCAuto c(DataArrayInt::New()); c->alloc((std::size_t)lgthToReach); MCAuto addCoo(DataArrayDouble::New()); addCoo->alloc(0,1); @@ -1656,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 ToIdType(addCoo->getNumberOfTuples()); + return addCoo->getNumberOfTuples(); } @@ -1833,12 +1833,12 @@ 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(),ToIdType(baryRet1->getNumberOfTuples()),eps,elts,eltsIndex); + mesh2D->getCellsContainingPoints(baryRet1->begin(),baryRet1->getNumberOfTuples(),eps,elts,eltsIndex); MCAuto eltsIndex2(DataArrayInt::New()); eltsIndex2->alloc(0,1); if (eltsIndex->getNumberOfTuples() > 1) eltsIndex2 = eltsIndex->deltaShiftIndex(); MCAuto eltsIndex3(eltsIndex2->findIdsEqual(1)); - if(eltsIndex2->count(0)+eltsIndex3->getNumberOfTuples()!=ret1NonCol->getNumberOfCells()) + if(eltsIndex2->count(0)+eltsIndex3->getNumberOfTuples()!=ToIdType(ret1NonCol->getNumberOfCells())) throw INTERP_KERNEL::Exception("Intersect2DMeshWith1DLine : internal error 1 !"); MCAuto cellsToBeModified(elts->buildUnique()); MCAuto untouchedCells(cellsToBeModified->buildComplement(ToIdType(mesh2D->getNumberOfCells()))); @@ -1861,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()); } - mcIdType offset(ToIdType(ret2->getNumberOfTuples())); + mcIdType offset(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); @@ -1906,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,ToIdType(ret2->getNumberOfTuples()),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)); ret3->setPartOfValues3(partOfRet3,idsNonColPerCell2->begin(),idsNonColPerCell2->end(),0,2,1,true); outMesh2DSplit.push_back(splitOfOneCell); for(std::size_t i=0;igetNumberOfCells();i++) @@ -2150,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]=ToIdType(newc->getNumberOfTuples()); + newciptr[1]=newc->getNumberOfTuples(); } // if(ret->empty()) @@ -2320,7 +2320,7 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) // Sort faces by decreasing surface: vector< pair > S; - for(mcIdType i=0;i < ToIdType(surfs->getNumberOfTuples());i++) + for(mcIdType i=0;i < surfs->getNumberOfTuples();i++) { pair p = make_pair(surfs->begin()[i], i); S.push_back(p); @@ -2357,9 +2357,9 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) MCAuto mPartCand(mDesc->buildPartOfMySelf(&cands2[0], &cands2[0]+cands2.size(), false)); // false=zipCoords is called double * cooPartRef(mPartRef->_coords->getPointer()); double * cooPartCand(mPartCand->_coords->getPointer()); - for (std::size_t ii = 0; ii < mPartRef->_coords->getNumberOfTuples(); ii++) + for (mcIdType ii = 0; ii < mPartRef->_coords->getNumberOfTuples(); ii++) rotation.transform_vector(cooPartRef+SPACEDIM*ii); - for (std::size_t ii = 0; ii < mPartCand->_coords->getNumberOfTuples(); ii++) + for (mcIdType ii = 0; ii < mPartCand->_coords->getNumberOfTuples(); ii++) rotation.transform_vector(cooPartCand+SPACEDIM*ii); // Localize faces in 2D thanks to barycenters @@ -2376,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(), ToIdType(baryPartXY->getNumberOfTuples()), eps, cc, ccI); + mPartRef->getCellsContainingPoints(baryPartXY->begin(), baryPartXY->getNumberOfTuples(), eps, cc, ccI); if (!cc->getNumberOfTuples()) continue; @@ -2487,7 +2487,7 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) // Sort edges by decreasing length: vector > S; - for(mcIdType i=0;i < ToIdType(lens->getNumberOfTuples());i++) + for(mcIdType i=0;i < lens->getNumberOfTuples();i++) { pair p = make_pair(lens->getIJ(i, 0), i); S.push_back(p); @@ -2541,9 +2541,9 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) MCAuto nodeMapInv = nodeMap->invertArrayO2N2N2O(nbElemsNotM1); double * cooPartRef(mPartRef->_coords->getPointer()); double * cooPartCand(mPartCand->_coords->getPointer()); - for (std::size_t ii = 0; ii < mPartRef->_coords->getNumberOfTuples(); ii++) + for (mcIdType ii = 0; ii < mPartRef->_coords->getNumberOfTuples(); ii++) rotation.transform_vector(cooPartRef+SPACEDIM*ii); - for (std::size_t ii = 0; ii < mPartCand->_coords->getNumberOfTuples(); ii++) + for (mcIdType ii = 0; ii < mPartCand->_coords->getNumberOfTuples(); ii++) rotation.transform_vector(cooPartCand+SPACEDIM*ii); diff --git a/src/MEDCoupling/MEDCouplingVoronoi.cxx b/src/MEDCoupling/MEDCouplingVoronoi.cxx index 37deab6a6..442be5edb 100755 --- 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,ToIdType(vdi[0]->getNumberOfTuples()),vdi[0]->begin()); + m->insertNextCell(INTERP_KERNEL::NORM_POLYGON,vdi[0]->getNumberOfTuples(),vdi[0]->begin()); return m; } @@ -223,7 +223,7 @@ MCAuto MergeVorCells3D(const std::vector< MCAutoallocateCells(); std::vector conn; int jj(0); - for(int i=0;igetNumberOfTuples())-1;i++,jj++) + for(mcIdType i=0;igetNumberOfTuples()-1;i++,jj++) { if(jj!=0) conn.push_back(-1); @@ -241,7 +241,7 @@ MCAuto MergeVorCells3D(const std::vector< MCAuto tmp(skinOfRes->buildPartOfMySelf(remain->begin(),remain->end(),true)); const int *cPtr(tmp->getNodalConnectivity()->begin()),*ciPtr(tmp->getNodalConnectivityIndex()->begin()); - for(std::size_t i=0;igetNumberOfTuples();i++,jj++) + for(mcIdType i=0;igetNumberOfTuples();i++,jj++) { if(jj!=0) conn.push_back(-1); @@ -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 !"); - mcIdType nbPts=ToIdType(points->getNumberOfTuples()); + mcIdType nbPts(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 !"); - mcIdType nbPts=ToIdType(points->getNumberOfTuples()); + mcIdType nbPts(points->getNumberOfTuples()); if(nbPts<1) throw INTERP_KERNEL::Exception("Voronoize2D : at least one point expected !"); std::vector bbox(4); @@ -440,7 +440,7 @@ MCAuto MEDCoupling::Voronizer2D::doIt(const MEDCouplingUMesh * newCoords=a->getCoords()->selectByTupleId(tmp->begin(),tmp->end()); } const double *cPtr(newCoords->begin()); - for(std::size_t j=0;jgetNumberOfTuples();j++,cPtr+=2) + for(mcIdType j=0;jgetNumberOfTuples();j++,cPtr+=2) { std::set zeCandidates; { @@ -487,7 +487,7 @@ MCAuto MEDCoupling::Voronizer3D::doIt(const MEDCouplingUMesh * throw INTERP_KERNEL::Exception("Voronoize3D : spacedim must be equal to 3 and meshdim also equal to 3 !"); if(m->getNumberOfCells()!=1) throw INTERP_KERNEL::Exception("Voronoize3D : mesh is expected to have only one cell !"); - mcIdType nbPts=ToIdType(points->getNumberOfTuples()); + mcIdType nbPts(points->getNumberOfTuples()); if(nbPts<1) throw INTERP_KERNEL::Exception("Voronoize3D : at least one point expected !"); std::vector< MCAuto > l0(1,MCAuto(m->deepCopy())); diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx index cd7ca7559..ea9e88da3 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx @@ -636,7 +636,6 @@ void MEDCouplingBasicsTest2::testRenumberCellsForFields() MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME); f->setMesh(m); DataArrayDouble *arr=DataArrayDouble::New(); - arr->alloc(m->getNumberOfCells(),3); f->setArray(arr); arr->decrRef();