std::vector<double> CoordsT;
const ConnType *startOfCellNodeConnT=Intersector3DP1P1<MyMeshType,MyMatrix>::getStartConnOfTargetCell(targetCell);
Intersector3DP1P1<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(targetCell),CoordsT);
- int nbOfNodesT=CoordsT.size()/SPACEDIM;
+ mcIdType nbOfNodesT=ToIdType(CoordsT.size())/SPACEDIM;
const double *coordsS=Intersector3DP1P1<MyMeshType,MyMatrix>::_src_mesh.getCoordinatesPtr();
for(int nodeIdT=0;nodeIdT<nbOfNodesT;nodeIdT++)
{
//
std::vector<ConnType> connOfCurCellS;
Intersector3DP1P1<MyMeshType,MyMatrix>::getConnOfSourceCell(OTT<ConnType,numPol>::indFC(*iterCellS),connOfCurCellS);
- if( PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg3D(&CoordsT[nodeIdT*SPACEDIM],&connOfCurCellS[0],connOfCurCellS.size(),coordsS,cmTypeS,_precision) )
+ if( PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg3D(&CoordsT[nodeIdT*SPACEDIM],&connOfCurCellS[0],ToIdType(connOfCurCellS.size()),coordsS,cmTypeS,_precision) )
{
double resLoc[4];
std::vector<double> localCoordsS;
};
inline unsigned long
- __stl_next_prime(unsigned long __n)
+ __stl_next_prime(std::size_t __n)
{
const unsigned long* __first = __stl_prime_list;
const unsigned long* __last = __stl_prime_list + (int)_S_num_primes;
else if(_dim==1)
return lgth;//NORM_POLYL
else
- return std::count(conn,conn+lgth,-1)+1;
+ return static_cast<unsigned>(std::count(conn,conn+lgth,-1))+1;
}
unsigned CellModel::getNumberOfEdgesIn3D(const int *conn, int lgth) const
if(!isDynamic())
return _nb_of_little_sons;
else//polyhedron
- return (lgth-std::count(conn,conn+lgth,-1))/2;
+ return static_cast<unsigned>(lgth-std::count(conn,conn+lgth,-1))/2;
}
/*!
}
const int *where2=std::find(where,nodalConn+lgth,-1);
std::copy(where,where2,sonNodalConn);
- return where2-where;
+ return static_cast<unsigned>(where2-where);
}
else
throw INTERP_KERNEL::Exception("CellModel::fillSonCellNodalConnectivity2 : no sons on NORM_POLYL !");
where++;
}
const int *where2=std::find(where,nodalConn+lgth,-1);
- return where2-where;
+ return static_cast<unsigned>(where2-where);
}
else
throw INTERP_KERNEL::Exception("CellModel::getNumberOfNodesConstituentTheSon2 : no sons on NORM_POLYL !");
std::vector<int>::iterator it=std::copy(conn1,conn1+lgth/2,tmp.begin());
std::copy(conn1,conn1+lgth/2,it);
it=std::search(tmp.begin(),tmp.end(),conn2,conn2+lgth/2);
- int d=std::distance(tmp.begin(),it);
+ std::ptrdiff_t d=std::distance(tmp.begin(),it);
if(it==tmp.end())
return false;
it=std::copy(conn1+lgth/2,conn1+lgth,tmp.begin());
it=std::search(tmp.begin(),tmp.end(),conn2,conn2+lgth);
if(it==tmp.end())
return false;
- int d2=std::distance(tmp.begin(),it);
+ std::ptrdiff_t d2=std::distance(tmp.begin(),it);
return d==d2;
}
else
std::vector<int>::iterator it=std::copy(conn1,conn1+p,tmp.begin());
std::copy(conn1,conn1+p,it);
it=std::search(tmp.begin(),tmp.end(),conn2,conn2+p);
- int d=std::distance(tmp.begin(),it);
+ std::ptrdiff_t d=std::distance(tmp.begin(),it);
if(it==tmp.end())
return false;
tmp.resize(2*p-2);
it=std::search(tmp.begin(),tmp.end(),conn2+p,conn2+lgth);
if(it==tmp.end())
return false;
- int d2=std::distance(tmp.begin(),it);
+ std::ptrdiff_t d2=std::distance(tmp.begin(),it);
return d==d2;
}
}
/*** Compute the intersection area ***/
INTERP_KERNEL::PolygonAlgorithms<SPACEDIM> P(_epsilon, PlanarIntersector<MyMeshType,MyMatrix>::_precision);
std::deque<double> inter = P.intersectConvexPolygons(&CoordsT[0], &CoordsS[0],
- CoordsT.size()/SPACEDIM, CoordsS.size()/SPACEDIM);
+ ToIdType(CoordsT.size())/SPACEDIM, ToIdType(CoordsS.size())/SPACEDIM);
double area[SPACEDIM];
int nb_inter =((int)inter.size())/SPACEDIM;
for(int i = 1; i<nb_inter-1; i++)
bool isSourceQuad)
{
double result = 0;
- int nbOfNodesS=sourceCoords.size()/SPACEDIM;
+ mcIdType nbOfNodesS=ToIdType(sourceCoords.size())/SPACEDIM;
/*** Compute the intersection area ***/
INTERP_KERNEL::PolygonAlgorithms<SPACEDIM> P(_epsilon, PlanarIntersector<MyMeshType,MyMatrix>::_precision);
const std::vector<double>& sourceCoords)
{
double result = 0;
- int nbOfNodesS=sourceCoords.size()/SPACEDIM;
- int nbOfNodesT=targetCoords.size()/SPACEDIM;
+ mcIdType nbOfNodesS=ToIdType(sourceCoords.size())/SPACEDIM;
+ mcIdType nbOfNodesT=ToIdType(targetCoords.size())/SPACEDIM;
/*** Compute the intersection area ***/
INTERP_KERNEL::PolygonAlgorithms<SPACEDIM> P(_epsilon, PlanarIntersector<MyMeshType,MyMatrix>::_precision);
std::deque<double> inter = P.intersectConvexPolygons(&targetCoords[0], &sourceCoords[0],
void CurveIntersector<MyMeshType,MyMatrix>::adjustBoundingBoxes (std::vector<double>& bbox,
double adjustmentEpsAbs)
{
- long size = bbox.size()/(2*SPACEDIM);
+ mcIdType size = ToIdType(bbox.size())/(2*SPACEDIM);
for (int i=0; i<size; i++)
{
for(int idim=0; idim<SPACEDIM; idim++)
nodes[1]=new Node(quadrangle[SPACEDIM],quadrangle[SPACEDIM+1]);
nodes[2]=new Node(quadrangle[2*SPACEDIM],quadrangle[2*SPACEDIM+1]);
nodes[3]=new Node(quadrangle[3*SPACEDIM],quadrangle[3*SPACEDIM+1]);
- int nbOfSourceNodes=sourceCoords.size()/SPACEDIM;
+ mcIdType nbOfSourceNodes=ToIdType(sourceCoords.size())/SPACEDIM;
std::vector<Node *> nodes2(nbOfSourceNodes);
for(int i=0;i<nbOfSourceNodes;i++)
nodes2[i]=new Node(sourceCoords[i*SPACEDIM],sourceCoords[i*SPACEDIM+1]);
double GEO2D_INTERSECTOR::intersectGeometryGeneral(const std::vector<double>& targetCoords,
const std::vector<double>& sourceCoords)
{
- int nbOfTargetNodes=targetCoords.size()/SPACEDIM;
+ mcIdType nbOfTargetNodes=ToIdType(targetCoords.size())/SPACEDIM;
std::vector<Node *> nodes(nbOfTargetNodes);
for(int i=0;i<nbOfTargetNodes;i++)
nodes[i]=new Node(targetCoords[i*SPACEDIM],targetCoords[i*SPACEDIM+1]);
- int nbOfSourceNodes=sourceCoords.size()/SPACEDIM;
+ mcIdType nbOfSourceNodes=ToIdType(sourceCoords.size())/SPACEDIM;
std::vector<Node *> nodes2(nbOfSourceNodes);
for(int i=0;i<nbOfSourceNodes;i++)
nodes2[i]=new Node(sourceCoords[i*SPACEDIM],sourceCoords[i*SPACEDIM+1]);
nodes[0]=new Node(sourceTria[0*SPACEDIM],sourceTria[0*SPACEDIM+1]);
nodes[1]=new Node(sourceTria[1*SPACEDIM],sourceTria[1*SPACEDIM+1]);
nodes[2]=new Node(sourceTria[2*SPACEDIM],sourceTria[2*SPACEDIM+1]);
- int nbOfTargetNodes=targetCell.size()/SPACEDIM;
+ mcIdType nbOfTargetNodes=ToIdType(targetCell.size())/SPACEDIM;
std::vector<Node *> nodes2(nbOfTargetNodes);
for(int i=0;i<nbOfTargetNodes;i++)
nodes2[i]=new Node(targetCell[i*SPACEDIM],targetCell[i*SPACEDIM+1]);
INTERSECTOR_TEMPLATE
QuadraticPolygon *GEO2D_INTERSECTOR::buildPolygonFrom(const std::vector<double>& coords, NormalizedCellType type)
{
- int nbNodes=coords.size()/SPACEDIM;
+ mcIdType nbNodes=ToIdType(coords.size())/SPACEDIM;
std::vector<Node *> nodes(nbNodes);
for(int i=0;i<nbNodes;i++)
nodes[i]=new Node(coords[i*SPACEDIM],coords[i*SPACEDIM+1]);
intersector->getElemBB(bb,myMeshT,OTT<ConnType,numPol>::indFC(iT),nb_nodesT);
my_tree.getIntersectingElems(bb, intersecting_elems);
intersector->intersectCells(iT,intersecting_elems,result);
- counter+=intersecting_elems.size();
+ counter+=ToIdType(intersecting_elems.size());
intersecting_elems.clear();
}
int ret=intersector->getNumberOfColsOfResMatrix();
// create empty maps for all target elements
result.resize( tgt_mesh.getNumberOfElements() );
- const int ret = src_mesh.getNumberOfElements();
+ const int ret = ToIdType(src_mesh.getNumberOfElements());
const double eps = getPrecision();
const int dim = MyMeshType::MY_MESHDIM;
{
src_coords[ j ] = src_mesh.getCoordsAlongAxis( _TMI( j ));
tgt_coords[ j ] = tgt_mesh.getCoordsAlongAxis( _TMI( j ));
- src_nb_cells[ j ] = src_mesh.nbCellsAlongAxis( _TMI( j ));
- tgt_nb_cells[ j ] = tgt_mesh.nbCellsAlongAxis( _TMI( j ));
+ src_nb_cells[ j ] = ToIdType(src_mesh.nbCellsAlongAxis( _TMI( j )));
+ tgt_nb_cells[ j ] = ToIdType(tgt_mesh.nbCellsAlongAxis( _TMI( j )));
}
// ============================================
for ( int j = 0; j < dim; ++j )
{
src_coords [j] = src_mesh.getCoordsAlongAxis( _TMIC( j ));
- src_nb_coords[j] = src_mesh.nbCellsAlongAxis ( _TMIC( j )) + 1;
+ src_nb_coords[j] = ToIdType(src_mesh.nbCellsAlongAxis ( _TMIC( j ))) + 1;
for (int i = 0; i < src_nb_coords[j]; ++i )
src_coord_to_index[j].insert( std::make_pair( src_coords[j][i], i ));
}
intersector->getElemBB(bb,myMeshT,OTT<ConnType,numPol>::indFC(iT),nb_nodesT);
my_tree.getIntersectingElems(bb, intersecting_elems);
intersector->intersectCells(iT,intersecting_elems,result);
- counter += intersecting_elems.size();
+ counter += ToIdType(intersecting_elems.size());
}
int ret = intersector->getNumberOfColsOfResMatrix();
delete intersector;
intersector->getElemBB(bb,myMeshT,OTT<ConnType,numPol>::indFC(iT),nb_nodesT);
my_tree.getIntersectingElems(bb, intersecting_elems);
intersector->intersectCells(iT,intersecting_elems,result);
- counter+=intersecting_elems.size();
+ counter+=ToIdType(intersecting_elems.size());
intersecting_elems.clear();
}
int ret=intersector->getNumberOfColsOfResMatrix();
inline std::vector<double> bary_poly(const std::vector<double>& V)
{
std::vector<double> Bary;
- long taille=V.size();
+ std::size_t taille=V.size();
double x=0;
double y=0;
- for(long i=0;i<taille/2;i++)
+ for(std::size_t i=0;i<taille/2;i++)
{
x=x+V[2*i];
y=y+V[2*i+1];
inline void verif_point_dans_vect(const double* P, std::vector<double>& V, double absolute_precision )
{
- long taille=V.size();
+ std::size_t taille=V.size();
bool isPresent=false;
- for(long i=0;i<taille/2;i++)
+ for(std::size_t i=0;i<taille/2;i++)
{
if (sqrt(((P[0]-V[2*i])*(P[0]-V[2*i])+(P[1]-V[2*i+1])*(P[1]-V[2*i+1])))<absolute_precision)
isPresent=true;
inline void verif_maill_dans_vect(int Num, std::vector<int>& V)
{
- long taille=V.size();
+ std::size_t taille=V.size();
int A=0;
- for(long i=0;i<taille;i++)
+ for(std::size_t i=0;i<taille;i++)
{
if(Num==V[i])
{
for ( int j = 0; j < SPACEDIM; ++j )
{
_coordsC [ j ] = _meshC.getCoordsAlongAxis( _TMIC( j ));
- _nbCellsC[ j ] = _meshC.nbCellsAlongAxis ( _TMIC( j ));
+ _nbCellsC[ j ] = ToIdType(_meshC.nbCellsAlongAxis ( _TMIC( j )));
}
}
_CU_TEMPLATE
int _INTERSECTOR_CU_::getNumberOfColsOfResMatrix() const
{
- return _meshC.getNumberOfElements();
+ return ToIdType(_meshC.getNumberOfElements());
}
//================================================================================
{
std::vector<double> CoordsT;
PlanarIntersector<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(icellT),CoordsT);
- int nbOfNodesT=CoordsT.size()/SPACEDIM;
+ mcIdType nbOfNodesT=ToIdType(CoordsT.size())/SPACEDIM;
for(typename std::vector<ConnType>::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++)
{
NormalizedCellType tS=PlanarIntersector<MyMeshType,MyMatrix>::_meshS.getTypeOfElement(OTT<ConnType,numPol>::indFC(*iter));
PlanarIntersector<MyMeshType,MyMatrix>::getRealSourceCoordinates(OTT<ConnType,numPol>::indFC(*iter),CoordsS);
std::vector<double> CoordsTTmp(CoordsT);
if(SPACEDIM==3)
- PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(&CoordsS[0],&CoordsTTmp[0],CoordsS.size()/SPACEDIM,nbOfNodesT);
+ PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(&CoordsS[0],&CoordsTTmp[0],ToIdType(CoordsS.size())/SPACEDIM,nbOfNodesT);
const ConnType *startOfCellNodeConnT=PlanarIntersector<MyMeshType,MyMatrix>::_connectT+OTT<ConnType,numPol>::conn2C(PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT]);
for(int nodeIdT=0;nodeIdT<nbOfNodesT;nodeIdT++)
{
std::vector<double> CoordsT;
const ConnType *startOfCellNodeConnT=Intersector3DP1P1<MyMeshType,MyMatrix>::getStartConnOfTargetCell(targetCell);
Intersector3DP1P1<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(targetCell),CoordsT);
- int nbOfNodesT=CoordsT.size()/SPACEDIM;
+ mcIdType nbOfNodesT=ToIdType(CoordsT.size())/SPACEDIM;
const double *coordsS=Intersector3DP1P1<MyMeshType,MyMatrix>::_src_mesh.getCoordinatesPtr();
for(int nodeIdT=0;nodeIdT<nbOfNodesT;nodeIdT++)
{
//
std::vector<ConnType> connOfCurCellS;
Intersector3DP1P1<MyMeshType,MyMatrix>::getConnOfSourceCell(OTT<ConnType,numPol>::indFC(*iterCellS),connOfCurCellS);
- if( PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg3D(&CoordsT[nodeIdT*SPACEDIM],&connOfCurCellS[0],connOfCurCellS.size(),coordsS,cmTypeS,_precision) )
+ if( PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg3D(&CoordsT[nodeIdT*SPACEDIM],&connOfCurCellS[0],ToIdType(connOfCurCellS.size()),coordsS,cmTypeS,_precision) )
{
double mco[3]; // mapped coordinates in the hexa8
std::vector<double> localCoordsS;
{
/* We build the segment tree for locating possible matching intersections*/
- long size = bbox.size()/(2*SPACEDIM);
+ mcIdType size = ToIdType(bbox.size())/(2*SPACEDIM);
for (int i=0; i<size; i++)
{
double max=- std::numeric_limits<double>::max();
fillDualCellOfTri<SPACEDIM>(triangle,quadrangle);
std::vector<double> sourceCellCoordsTmp(sourceCellCoords);
if(SPACEDIM==3)
- orientation=PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(&sourceCellCoordsTmp[0],quadrangle,sourceCellCoords.size()/SPACEDIM,4);
+ orientation=PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(&sourceCellCoordsTmp[0],quadrangle,ToIdType(sourceCellCoords.size())/SPACEDIM,4);
NormalizedCellType tS=PlanarIntersector<MyMeshType,MyMatrix>::_meshS.getTypeOfElement(OTT<ConnType,numPol>::indFC(iS));
double surf=orientation*intersectGeometryWithQuadrangle(quadrangle,sourceCellCoordsTmp,CellModel::GetCellModel(tS).isQuadratic());
surf=PlanarIntersector<MyMeshType,MyMatrix>::getValueRegardingOption(surf);
bool isSourceQuad=CellModel::GetCellModel(tS).isQuadratic();
PlanarIntersector<MyMeshType,MyMatrix>::getRealSourceCoordinates(OTT<ConnType,numPol>::indFC(iS),srcCellCoords);
std::vector<double> *srcCoords(&srcCellCoords);
- int srcNbNodes = srcCellCoords.size()/SPACEDIM;
+ mcIdType srcNbNodes = ToIdType(srcCellCoords.size())/SPACEDIM;
if(SPACEDIM==3)
{
srcCellCoordsTmp=srcCellCoords;
const ConnType *startOfCellNodeConnT=PlanarIntersector<MyMeshType,MyMatrix>::_connectT+OTT<ConnType,numPol>::conn2C(PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT]);
std::vector<double> coordsTarget;
PlanarIntersector<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(icellT),coordsTarget);
- int nbNodesT=coordsTarget.size()/SPACEDIM;
+ mcIdType nbNodesT=ToIdType(coordsTarget.size())/SPACEDIM;
ii=0;
for(typename std::vector<ConnType>::const_iterator iter2=icellsS.begin();iter2!=icellsS.end();iter2++,ii++)
{
std::vector<double> tmpSource(coordsOfSources[ii]);
std::vector<double> tmpTarget(coordsTarget);
if(SPACEDIM==3)
- PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(&tmpSource[0],&tmpTarget[0],tmpSource.size()/SPACEDIM,nbNodesT);
+ PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(&tmpSource[0],&tmpTarget[0],ToIdType(tmpSource.size())/SPACEDIM,nbNodesT);
for(int nodeIdT=0;nodeIdT<nbNodesT;nodeIdT++)
{
- if(PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg2D(&tmpTarget[0]+nodeIdT*SPACEDIM,&tmpSource[0],tmpSource.size()/SPACEDIM,PlanarIntersector<MyMeshType,MyMatrix>::_precision))
+ if(PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg2D(&tmpTarget[0]+nodeIdT*SPACEDIM,&tmpSource[0],ToIdType(tmpSource.size())/SPACEDIM,PlanarIntersector<MyMeshType,MyMatrix>::_precision))
{
ConnType curNodeTInCmode=OTT<ConnType,numPol>::coo2C(startOfCellNodeConnT[nodeIdT]);
typename MyMatrix::value_type& resRow=res[curNodeTInCmode];
fillDualCellOfTri<SPACEDIM>(triangle,quadrangle);
std::vector<double> targetCellCoordsTmp(targetCellCoords);
if(SPACEDIM==3)
- orientation=PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(&targetCellCoordsTmp[0],quadrangle,targetCellCoords.size()/SPACEDIM,4);
+ orientation=PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(&targetCellCoordsTmp[0],quadrangle,ToIdType(targetCellCoords.size())/SPACEDIM,4);
double surf=orientation*intersectGeometryWithQuadrangle(quadrangle,targetCellCoordsTmp,isTargetQuad);
surf=PlanarIntersector<MyMeshType,MyMatrix>::getValueRegardingOption(surf);
if(surf!=0.)
// target cell data
PlanarIntersector<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(icellT),tgtCellCoords);
std::vector<double> * tgtCoords = & tgtCellCoords;
- int tgtNbNodes = tgtCellCoords.size()/SPACEDIM;
+ mcIdType tgtNbNodes = ToIdType(tgtCellCoords.size())/SPACEDIM;
NormalizedCellType tT=PlanarIntersector<MyMeshType,MyMatrix>::_meshT.getTypeOfElement(OTT<ConnType,numPol>::indFC(icellT));
bool isTargetQuad=CellModel::GetCellModel(tT).isQuadratic();
PlanarIntersector<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(icellT),CoordsT);
double baryT[SPACEDIM];
double baryTTmp[SPACEDIM];
- calculateBarycenterDyn2<SPACEDIM>(&CoordsT[0],CoordsT.size()/SPACEDIM,baryT);
+ calculateBarycenterDyn2<SPACEDIM>(&CoordsT[0],ToIdType(CoordsT.size())/SPACEDIM,baryT);
for(typename std::vector<ConnType>::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++)
{
NormalizedCellType tS=PlanarIntersector<MyMeshType,MyMatrix>::_meshS.getTypeOfElement(OTT<ConnType,numPol>::indFC(*iter));
ConnType curNodeTInCmode=OTT<ConnType,numPol>::coo2C(startOfCellNodeConn[nodeIdT]);
PlanarIntersector<MyMeshType,MyMatrix>::getRealTargetCoordinatesPermute(OTT<ConnType,numPol>::indFC(icellT),nodeIdT,polygT);
std::vector<double> polygDualT(SPACEDIM*2*(nbNodesT-1));
- fillDualCellOfPolyg<SPACEDIM>(&polygT[0],polygT.size()/SPACEDIM,&polygDualT[0]);
+ fillDualCellOfPolyg<SPACEDIM>(&polygT[0],ToIdType(polygT.size())/SPACEDIM,&polygDualT[0]);
typename MyMatrix::value_type& resRow=res[curNodeTInCmode];
for(typename std::vector<ConnType>::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++)
{
std::vector<double> polygS;
PlanarIntersector<MyMeshType,MyMatrix>::getRealSourceCoordinatesPermute(OTT<ConnType,numPol>::indFC(iS),nodeIdS,polygS);
std::vector<double> polygDualS(SPACEDIM*2*(nbNodesS-1));
- fillDualCellOfPolyg<SPACEDIM>(&polygS[0],polygS.size()/SPACEDIM,&polygDualS[0]);
+ fillDualCellOfPolyg<SPACEDIM>(&polygS[0],ToIdType(polygS.size())/SPACEDIM,&polygDualS[0]);
std::vector<double> polygDualTTmp(polygDualT);
if(SPACEDIM==3)
- orientation=PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(&polygDualS[0],&polygDualTTmp[0],polygDualS.size()/SPACEDIM,polygDualT.size()/SPACEDIM);
+ orientation=PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(&polygDualS[0],&polygDualTTmp[0],ToIdType(polygDualS.size())/SPACEDIM,ToIdType(polygDualT.size())/SPACEDIM);
double surf=orientation*intersectGeometryGeneral(polygDualTTmp,polygDualS);
surf=PlanarIntersector<MyMeshType,MyMatrix>::getValueRegardingOption(surf);
if(surf!=0.)
{
std::vector<double> CoordsT;
PlanarIntersector<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(icellT),CoordsT);
- int nbOfNodesT=CoordsT.size()/SPACEDIM;
+ mcIdType nbOfNodesT=ToIdType(CoordsT.size())/SPACEDIM;
for(typename std::vector<ConnType>::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++)
{
NormalizedCellType tS=PlanarIntersector<MyMeshType,MyMatrix>::_meshS.getTypeOfElement(OTT<ConnType,numPol>::indFC(*iter));
PlanarIntersector<MyMeshType,MyMatrix>::getRealSourceCoordinates(OTT<ConnType,numPol>::indFC(*iter),CoordsS);
std::vector<double> CoordsTTmp(CoordsT);
if(SPACEDIM==3)
- PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(&CoordsS[0],&CoordsTTmp[0],CoordsS.size()/SPACEDIM,nbOfNodesT);
+ PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(&CoordsS[0],&CoordsTTmp[0],ToIdType(CoordsS.size())/SPACEDIM,nbOfNodesT);
const ConnType *startOfCellNodeConnT=PlanarIntersector<MyMeshType,MyMatrix>::_connectT+OTT<ConnType,numPol>::conn2C(PlanarIntersector<MyMeshType,MyMatrix>::_connIndexT[icellT]);
for(int nodeIdT=0;nodeIdT<nbOfNodesT;nodeIdT++)
{
INTERSECTOR_TEMPLATE
QuadraticPolygon *PTLOC2D_INTERSECTOR::buildPolygonFrom(const std::vector<double>& coords, NormalizedCellType type)
{
- int nbNodes=coords.size()/SPACEDIM;
+ mcIdType nbNodes=ToIdType(coords.size())/SPACEDIM;
std::vector<Node *> nodes(nbNodes);
for(int i=0;i<nbNodes;i++)
nodes[i]=new Node(coords[i*SPACEDIM],coords[i*SPACEDIM+1]);
std::vector<double> CoordsT;
Intersector3DP0P0<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(targetCell),CoordsT);
double bary[SPACEDIM];
- calculateBarycenterDyn2<SPACEDIM>(&CoordsT[0],CoordsT.size()/SPACEDIM,bary);
+ calculateBarycenterDyn2<SPACEDIM>(&CoordsT[0],ToIdType(CoordsT.size())/SPACEDIM,bary);
typename MyMatrix::value_type& resRow=res[targetCell];
const double *coordsS=Intersector3DP0P0<MyMeshType,MyMatrix>::_src_mesh.getCoordinatesPtr();
for(typename std::vector<ConnType>::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++)
const CellModel& cmTypeS=CellModel::GetCellModel(tS);
std::vector<ConnType> connOfCurCellS;
Intersector3DP0P0<MyMeshType,MyMatrix>::getConnOfSourceCell(OTT<ConnType,numPol>::indFC(*iterCellS),connOfCurCellS);
- if(PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg3D(bary,&connOfCurCellS[0],connOfCurCellS.size(),coordsS,cmTypeS,_precision))
+ if(PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg3D(bary,&connOfCurCellS[0],ToIdType(connOfCurCellS.size()),coordsS,cmTypeS,_precision))
{
resRow.insert(std::make_pair(OTT<ConnType,numPol>::indFC(*iterCellS),1));
}
{
std::vector<double> coordsTarget;
Intersector3DP0P1<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(targetCell),coordsTarget);
- int nbNodesT=coordsTarget.size()/SPACEDIM;
+ mcIdType nbNodesT=ToIdType(coordsTarget.size())/SPACEDIM;
const double *coordsS=Intersector3DP0P1<MyMeshType,MyMatrix>::_src_mesh.getCoordinatesPtr();
const ConnType *startOfCellNodeConnT=Intersector3DP0P1<MyMeshType,MyMatrix>::getStartConnOfTargetCell(targetCell);
for(typename std::vector<ConnType>::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++)
Intersector3DP0P1<MyMeshType,MyMatrix>::getConnOfSourceCell(OTT<ConnType,numPol>::indFC(*iterCellS),connOfCurCellS);
for(int nodeIdT=0;nodeIdT<nbNodesT;nodeIdT++)
{
- if(PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg3D(&coordsTarget[nodeIdT*SPACEDIM],&connOfCurCellS[0],connOfCurCellS.size(),coordsS,cmTypeS,_precision))
+ if(PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg3D(&coordsTarget[nodeIdT*SPACEDIM],&connOfCurCellS[0],ToIdType(connOfCurCellS.size()),coordsS,cmTypeS,_precision))
{
ConnType curNodeTInCmode=OTT<ConnType,numPol>::coo2C(startOfCellNodeConnT[nodeIdT]);
typename MyMatrix::value_type& resRow=res[curNodeTInCmode];
const double *coordsS=Intersector3DP1P0<MyMeshType,MyMatrix>::_src_mesh.getCoordinatesPtr();
Intersector3DP1P0<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(targetCell),CoordsT);
double baryT[SPACEDIM];
- calculateBarycenterDyn2<SPACEDIM>(&CoordsT[0],CoordsT.size()/SPACEDIM,baryT);
+ calculateBarycenterDyn2<SPACEDIM>(&CoordsT[0],ToIdType(CoordsT.size())/SPACEDIM,baryT);
for(typename std::vector<ConnType>::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++)
{
NormalizedCellType tS=Intersector3DP1P0<MyMeshType,MyMatrix>::_src_mesh.getTypeOfElement(OTT<ConnType,numPol>::indFC(*iterCellS));
const CellModel& cmTypeS=CellModel::GetCellModel(tS);
std::vector<ConnType> connOfCurCellS;
Intersector3DP1P0<MyMeshType,MyMatrix>::getConnOfSourceCell(OTT<ConnType,numPol>::indFC(*iterCellS),connOfCurCellS);
- if( PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg3D(baryT,&connOfCurCellS[0],connOfCurCellS.size(),coordsS,cmTypeS,_precision) )
+ if( PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg3D(baryT,&connOfCurCellS[0],ToIdType(connOfCurCellS.size()),coordsS,cmTypeS,_precision) )
{
double resLoc[4];
std::vector<double> srcCell;
{
std::vector<double> CoordsT;
Intersector3DP1P1<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(targetCell),CoordsT);
- int nbOfNodesT=CoordsT.size()/SPACEDIM;
+ mcIdType nbOfNodesT=ToIdType(CoordsT.size())/SPACEDIM;
const double *coordsS=Intersector3DP1P1<MyMeshType,MyMatrix>::_src_mesh.getCoordinatesPtr();
for(typename std::vector<ConnType>::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++)
{
typename MyMatrix::value_type& resRow=res[OTT<ConnType,numPol>::ind2C(startOfCellNodeConnT[nodeIdT])];
std::vector<ConnType> connOfCurCellS;
Intersector3DP1P1<MyMeshType,MyMatrix>::getConnOfSourceCell(OTT<ConnType,numPol>::indFC(*iterCellS),connOfCurCellS);
- if( PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg3D(&CoordsT[nodeIdT*SPACEDIM],&connOfCurCellS[0],connOfCurCellS.size(),coordsS,cmTypeS,_precision) )
+ if( PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg3D(&CoordsT[nodeIdT*SPACEDIM],&connOfCurCellS[0],ToIdType(connOfCurCellS.size()),coordsS,cmTypeS,_precision) )
{
double resLoc[4];
std::vector<double> localCoordsS;
while( !four_neighbours)
{
i_glob=(* mi1).second;//global index of vertex i
- nb_prev = _Status.count(i_glob);//counts the number of segments ending at i
+ nb_prev = ToIdType(_Status.count(i_glob));//counts the number of segments ending at i
//std::cout<< "nb_prev= "<< nb_prev << " i_glob= " << i_glob << std::endl;
switch (nb_prev)
}
mi1++;
i_glob=(* mi1).second;//global index of vertex i
- nb_prev = _Status.count(i_glob);
+ nb_prev = ToIdType(_Status.count(i_glob));
}
}
return _Inter;
void SplitterTetra2<MyMeshTypeT, MyMeshTypeS>::releaseArrays()
{
// free potential sub-mesh nodes that have been allocated
- typename MyMeshTypeT::MyConnType nbOfNodesT = _node_ids.size();// Issue 0020634.
+ typename MyMeshTypeT::MyConnType nbOfNodesT = static_cast<typename MyMeshTypeT::MyConnType>(_node_ids.size());// Issue 0020634.
if((int)_nodes.size()>=/*8*/nbOfNodesT)
{
std::vector<const double*>::iterator iter = _nodes.begin() + /*8*/nbOfNodesT;
// indices of nodes of a son
static std::vector<int> allNodeIndices; // == 0,1,2,...,nbOfCellNodes-1
while ( allNodeIndices.size() < nbOfCellNodes )
- allNodeIndices.push_back( allNodeIndices.size() );
+ allNodeIndices.push_back(ToIdType(allNodeIndices.size()));
std::vector<int> classicFaceNodes(4);
if(cellModelCell.isQuadratic())
throw INTERP_KERNEL::Exception("SplitterTetra2::splitConvex : quadratic 3D cells are not implemented yet !");
{
// retrieve real mesh nodes
- typename MyMeshTypeT::MyConnType nbOfNodesT = _node_ids.size();// Issue 0020634. _node_ids.resize(8);
+ typename MyMeshTypeT::MyConnType nbOfNodesT = static_cast<typename MyMeshTypeT::MyConnType>(_node_ids.size());// Issue 0020634. _node_ids.resize(8);
for(int node = 0; node < nbOfNodesT ; ++node)
{
// calculate only normal nodes
bool isSourceQuad)
{
double result = 0.;
- ConnType nbNodesS=sourceCoords.size()/SPACEDIM;
+ ConnType nbNodesS=static_cast<ConnType>(sourceCoords.size())/SPACEDIM;
//Compute the intersection area
double area[SPACEDIM];
for(ConnType iT = 1; iT<3; iT++)
const std::vector<double>& sourceCoords)
{
double result = 0.;
- ConnType nbNodesS=sourceCoords.size()/SPACEDIM;
- ConnType nbNodesT=targetCoords.size()/SPACEDIM;
+ ConnType nbNodesS=static_cast<ConnType>(sourceCoords.size())/SPACEDIM;
+ ConnType nbNodesT=static_cast<ConnType>(targetCoords.size())/SPACEDIM;
//Compute the intersection area
double area[SPACEDIM];
for(ConnType iT = 1; iT<nbNodesT-1; iT++)
double inter_area[SPACEDIM], total_area = 0.;
double total_barycenter[SPACEDIM]={0.,0.};
- const ConnType nbNodesT=targetCell.size()/SPACEDIM;
+ const ConnType nbNodesT=static_cast<ConnType>(targetCell.size())/SPACEDIM;
for(ConnType iT = 1; iT<nbNodesT-1; iT++)
{
std::vector<double> inter;
#ifndef MEDCOUPLING_USE_64BIT_IDS
using mcIdType = std::int32_t;
#else
- using mcIdType = std::int64_t;
+ //using mcIdType = std::int64_t;
#endif
- inline mcIdType ToIdType(std::size_t val) { return mcIdType(val); }
+ using mcIdType = std::int32_t;
+
+ template <class T>
+ inline mcIdType ToIdType(T val)
+ {
+ return static_cast<mcIdType>(val);
+ }
}
#define DataArrayInt DataArrayInt32
std::vector<int> MEDCoupling1GTUMesh::getDistributionOfTypes() const
{
std::vector<int> ret(3);
- ret[0]=(int)getCellModelEnum(); ret[1]=getNumberOfCells(); ret[2]=-1;
+ ret[0]=(int)getCellModelEnum(); ret[1]=ToIdType(getNumberOfCells()); ret[2]=-1;
return ret;
}
throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::splitProfilePerType : input profile is NULL !");
if(profile->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::splitProfilePerType : input profile should have exactly one component !");
- int nbTuples(profile->getNumberOfTuples()),nbOfCells(getNumberOfCells());
+ mcIdType nbTuples=ToIdType(profile->getNumberOfTuples()),nbOfCells=ToIdType(getNumberOfCells());
code.resize(3); idsInPflPerType.resize(1);
code[0]=(int)getCellModelEnum(); code[1]=nbTuples;
idsInPflPerType.resize(1);
*/
DataArrayInt *MEDCoupling1GTUMesh::checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const
{
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
if(code.size()!=3)
throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::checkTypeConsistencyAndContig : invalid input code should be exactly of size 3 !");
if(code[0]!=(int)getCellModelEnum())
throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh : all the instances in input vector must have same mesh dimension !");
if((*it)->getCoords()!=coords)
throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh : all the instances must share the same coordinates pointer !");
- nbOfCells+=(*it)->getNumberOfCells();
- connSize+=(*it)->getNodalConnectivityLength();
+ nbOfCells+=ToIdType((*it)->getNumberOfCells());
+ connSize+=ToIdType((*it)->getNodalConnectivityLength());
}
MCAuto<DataArrayInt> conn(DataArrayInt::New()),connI(DataArrayInt::New());
connI->alloc(nbOfCells+1,1); conn->alloc(connSize+nbOfCells,1);
int *c(conn->getPointer()),*ci(connI->getPointer()); *ci=0;
for(std::vector< const MEDCoupling1GTUMesh *>::const_iterator it=parts.begin();it!=parts.end();it++)
{
- int curNbCells((*it)->getNumberOfCells());
+ mcIdType curNbCells=ToIdType((*it)->getNumberOfCells());
int geoType((int)(*it)->getCellModelEnum());
const int *cinPtr((*it)->getNodalConnectivity()->begin());
const MEDCoupling1SGTUMesh *ps(dynamic_cast<const MEDCoupling1SGTUMesh *>(*it));
int geoType((int)*gts.begin());
MCAuto<MEDCoupling1SGTUMesh> ret(MEDCoupling1SGTUMesh::New(m->getName(),*gts.begin()));
ret->setCoords(m->getCoords()); ret->setDescription(m->getDescription());
- int nbCells(m->getNumberOfCells());
+ mcIdType nbCells=ToIdType(m->getNumberOfCells());
int nbOfNodesPerCell(ret->getNumberOfNodesPerCell());
MCAuto<DataArrayInt> conn(DataArrayInt::New()); conn->alloc(nbCells*nbOfNodesPerCell,1);
int *c(conn->getPointer());
{
checkConsistencyLight();
const DataArrayInt *c1(_conn);
- int nbOfTuples=c1->getNumberOfTuples();
- int nbOfNodesPerCell=(int)_cm->getNumberOfNodes();
+ mcIdType nbOfTuples=ToIdType(c1->getNumberOfTuples());
+ mcIdType nbOfNodesPerCell=ToIdType(_cm->getNumberOfNodes());
if(nbOfTuples%nbOfNodesPerCell!=0)
{
std::ostringstream oss; oss << "MEDCoupling1SGTUMesh::checkConsistency : the nb of tuples in conn is " << nbOfTuples << " and number of nodes per cell is " << nbOfNodesPerCell << ". But " << nbOfTuples << "%" << nbOfNodesPerCell << " !=0 !";
{
checkNonDynamicGeoType();
MCAuto<DataArrayInt> ret=DataArrayInt::New();
- int nbCells(getNumberOfCells());
+ mcIdType nbCells=ToIdType(getNumberOfCells());
ret->alloc(nbCells,1);
int *retPtr(ret->getPointer());
int nbNodesPerCell(getNumberOfNodesPerCell());
{
if(_conn->getNumberOfComponents()==1)
{
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
int sz=getNumberOfNodesPerCell();
const int *connPtr=_conn->begin();
for(int i=0;i<nbOfCells;i++,connPtr+=sz)
{
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
int spaceDim=getSpaceDimension();
- int nbOfCells=getNumberOfCells();//checkConsistencyLight()
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());//checkConsistencyLight()
int nbOfNodes=getNumberOfNodes();
ret->alloc(nbOfCells,spaceDim);
double *ptToFill=ret->getPointer();
void MEDCoupling1SGTUMesh::renumberCells(const int *old2NewBg, bool check)
{
- int nbCells=getNumberOfCells();
+ mcIdType nbCells=ToIdType(getNumberOfCells());
MCAuto<DataArrayInt> o2n=DataArrayInt::New();
o2n->useArray(old2NewBg,false,DeallocType::C_DEALLOC,nbCells,1);
if(check)
*/
void MEDCoupling1SGTUMesh::fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, DataArrayInt *&cellIdsKeptArr) const
{
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
MCAuto<DataArrayInt> cellIdsKept=DataArrayInt::New(); cellIdsKept->alloc(0,1);
int tmp=-1;
int sz=_conn->getMaxValue(tmp); sz=std::max(sz,0)+1;
MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(getName(),getMeshDimension());
ret->setCoords(getCoords());
const int *nodalConn=_conn->begin();
- int nbCells=getNumberOfCells();
+ mcIdType nbCells=ToIdType(getNumberOfCells());
int nbNodesPerCell=getNumberOfNodesPerCell();
int geoType=(int)getCellModelEnum();
MCAuto<DataArrayInt> c=DataArrayInt::New(); c->alloc(nbCells*(nbNodesPerCell+1),1);
{
nbrOfNodesInUse=-1;
int nbOfNodes=getNumberOfNodes();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
MCAuto<DataArrayInt> ret(DataArrayInt::New());
ret->alloc(nbOfNodes,1);
int *traducer=ret->getPointer();
const MEDCoupling1SGTUMesh *cur=a[i];
const DataArrayDouble *coo=cur->getCoords();
if(coo)
- spaceDim=coo->getNumberOfComponents();
+ spaceDim=ToIdType(coo->getNumberOfComponents());
}
if(spaceDim==-3)
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::Merge1SGTUMeshes : no spaceDim specified ! unable to perform merge !");
if(a.empty())
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::Merge1SGTUMeshes : input array must be NON EMPTY !");
std::vector<const MEDCoupling1SGTUMesh *>::const_iterator it=a.begin();
- int nbOfCells=(*it)->getNumberOfCells();
+ mcIdType nbOfCells=ToIdType((*it)->getNumberOfCells());
const INTERP_KERNEL::CellModel *cm=&((*it)->getCellModel());
int nbNodesPerCell=(*it)->getNumberOfNodesPerCell();
it++;
{
if(cm!=&((*it)->getCellModel()))
throw INTERP_KERNEL::Exception("Geometric types mismatches, Merge1SGTUMeshes impossible !");
- nbOfCells+=(*it)->getNumberOfCells();
+ nbOfCells+=ToIdType((*it)->getNumberOfCells());
}
std::vector<const MEDCouplingPointSet *> aps(a.size());
std::copy(a.begin(),a.end(),aps.begin());
int offset=0;
for(it=a.begin();it!=a.end();it++)
{
- int curConnLgth=(*it)->getNodalConnectivityLength();
+ mcIdType curConnLgth=ToIdType((*it)->getNodalConnectivityLength());
const int *curC=(*it)->_conn->begin();
cPtr=std::transform(curC,curC+curConnLgth,cPtr,std::bind2nd(std::plus<int>(),offset));
offset+=(*it)->getNumberOfNodes();
MEDCouplingPointSet *MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoords(const int *begin, const int *end) const
{
- int ncell=getNumberOfCells();
+ mcIdType ncell=ToIdType(getNumberOfCells());
MCAuto<MEDCoupling1SGTUMesh> ret(new MEDCoupling1SGTUMesh(getName(),*_cm));
ret->setCoords(_coords);
std::size_t nbOfElemsRet=std::distance(begin,end);
MEDCouplingPointSet *MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) const
{
- int ncell=getNumberOfCells();
+ mcIdType ncell=ToIdType(getNumberOfCells());
int nbOfElemsRet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoordsSlice : ");
MCAuto<MEDCoupling1SGTUMesh> ret(new MEDCoupling1SGTUMesh(getName(),*_cm));
ret->setCoords(_coords);
DataArrayInt *MEDCoupling1SGTUMesh::simplexizePol0()
{
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
if(getCellModelEnum()!=INTERP_KERNEL::NORM_QUAD4)
return DataArrayInt::Range(0,nbOfCells,1);
MCAuto<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(2*3*nbOfCells,1);
DataArrayInt *MEDCoupling1SGTUMesh::simplexizePol1()
{
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
if(getCellModelEnum()!=INTERP_KERNEL::NORM_QUAD4)
return DataArrayInt::Range(0,nbOfCells,1);
MCAuto<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(2*3*nbOfCells,1);
DataArrayInt *MEDCoupling1SGTUMesh::simplexizePlanarFace5()
{
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
if(getCellModelEnum()!=INTERP_KERNEL::NORM_HEXA8)
return DataArrayInt::Range(0,nbOfCells,1);
MCAuto<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(5*4*nbOfCells,1);
DataArrayInt *MEDCoupling1SGTUMesh::simplexizePlanarFace6()
{
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
if(getCellModelEnum()!=INTERP_KERNEL::NORM_HEXA8)
return DataArrayInt::Range(0,nbOfCells,1);
MCAuto<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(6*4*nbOfCells,1);
int sz(0);
if((const DataArrayInt *)_conn)
if(_conn->isAllocated())
- sz=_conn->getNbOfElems();
+ sz=ToIdType(_conn->getNbOfElems());
a1=DataArrayInt::New();
a1->alloc(sz,1);
if(sz!=0 && (const DataArrayInt *)_conn)
sz=0;
if((const DataArrayDouble *)_coords)
if(_coords->isAllocated())
- sz=_coords->getNbOfElems();
+ sz=ToIdType(_coords->getNbOfElems());
a2=DataArrayDouble::New();
a2->alloc(sz,1);
if(sz!=0 && (const DataArrayDouble *)_coords)
revNodalIndx->useArray(revNodalIndxPtr,true,DeallocType::C_DEALLOC,nbOfNodes+1,1);
std::fill(revNodalIndxPtr,revNodalIndxPtr+nbOfNodes+1,0);
const int *conn=_conn->begin();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
int nbOfEltsInRevNodal=0;
int nbOfNodesPerCell=getNumberOfNodesPerCell();
for(int eltId=0;eltId<nbOfCells;eltId++)
const INTERP_KERNEL::CellModel& cm(getCellModel());
if(cm.getEnum()!=INTERP_KERNEL::NORM_HEXA8)
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4 : this method can be applied only on HEXA8 mesh !");
- int nbHexa8(getNumberOfCells());
+ mcIdType nbHexa8=ToIdType(getNumberOfCells());
const int *inConnPtr(getNodalConnectivity()->begin());
MCAuto<MEDCoupling1SGTUMesh> ret(MEDCoupling1SGTUMesh::New(getName(),INTERP_KERNEL::NORM_QUAD4));
MCAuto<DataArrayInt> c(DataArrayInt::New()); c->alloc(nbHexa8*6*4,1);
DataArrayInt *MEDCoupling1SGTUMesh::sortHexa8EachOther()
{
MCAuto<MEDCoupling1SGTUMesh> quads(explodeEachHexa8To6Quad4());//checks that only hexa8
- int nbHexa8(getNumberOfCells()),*cQuads(quads->getNodalConnectivity()->getPointer());
+ mcIdType nbHexa8=ToIdType(getNumberOfCells());
+ int *cQuads(quads->getNodalConnectivity()->getPointer());
MCAuto<DataArrayInt> neighOfQuads(DataArrayInt::New()); neighOfQuads->alloc(nbHexa8*6,1); neighOfQuads->fillWithValue(-1);
int *ptNeigh(neighOfQuads->getPointer());
{//neighOfQuads tells for each face of each Quad8 which cell (if!=-1) is connected to this face.
DataArrayInt *cc(0),*cci(0);
quadsTmp->findCommonCells(3,0,cc,cci);
ccSafe=cc; cciSafe=cci;
- const int *ccPtr(ccSafe->begin()),nbOfPair(cci->getNumberOfTuples()-1);
+ const int *ccPtr(ccSafe->begin());
+ mcIdType nbOfPair=ToIdType(cci->getNumberOfTuples())-1;
for(int i=0;i<nbOfPair;i++)
{ ptNeigh[ccPtr[2*i+0]]=ccPtr[2*i+1]/6; ptNeigh[ccPtr[2*i+1]]=ccPtr[2*i+0]/6; }
}
MCAuto<MEDCouplingUMesh> faces(thisu->buildDescendingConnectivity(d2Arr,di2Arr,rd2Arr,rdi2Arr)); thisu=0;
const int *d2(d2Arr->begin()),*rdi2(rdi2Arr->begin());
MCAuto<DataArrayDouble> edgesBaryArr(edges->computeCellCenterOfMass()),facesBaryArr(faces->computeCellCenterOfMass()),baryArr(computeCellCenterOfMass());
- const int nbOfNodes(getNumberOfNodes()),offset0(nbOfNodes+faces->getNumberOfCells()),offset1(offset0+edges->getNumberOfCells());
+ const int nbOfNodes(getNumberOfNodes());
+ const mcIdType offset0=nbOfNodes+ToIdType(faces->getNumberOfCells());
+ const mcIdType offset1=offset0+ToIdType(edges->getNumberOfCells());
edges=0; faces=0;
std::vector<const DataArrayDouble *> v(4); v[0]=getCoords(); v[1]=facesBaryArr; v[2]=edgesBaryArr; v[3]=baryArr;
MCAuto<DataArrayDouble> zeArr(DataArrayDouble::Aggregate(v)); baryArr=0; edgesBaryArr=0; facesBaryArr=0;
}
}
}
- ciArr->setIJ(i+1,0,cArr->getNumberOfTuples());
+ ciArr->setIJ(i+1,0,ToIdType(cArr->getNumberOfTuples()));
}
ret->setNodalConnectivity(cArr,ciArr);
return ret.retn();
MCAuto<MEDCouplingUMesh> edges(thisu->buildDescendingConnectivity(d2Arr,di2Arr,rd2Arr,rdi2Arr)); thisu=0;
const int *d2(d2Arr->begin()),*rdi2(rdi2Arr->begin());
MCAuto<DataArrayDouble> edgesBaryArr(edges->computeCellCenterOfMass()),baryArr(computeCellCenterOfMass());
- const int nbOfNodes(getNumberOfNodes()),offset0(nbOfNodes+edges->getNumberOfCells());
+ const mcIdType nbOfNodes(getNumberOfNodes()),offset0(nbOfNodes+ToIdType(edges->getNumberOfCells()));
edges=0;
std::vector<const DataArrayDouble *> v(3); v[0]=getCoords(); v[1]=edgesBaryArr; v[2]=baryArr;
MCAuto<DataArrayDouble> zeArr(DataArrayDouble::Aggregate(v)); baryArr=0; edgesBaryArr=0;
}
std::vector<int> zePolyg(MEDCoupling1DGTUMesh::BuildAPolygonFromParts(polyg));
cArr->insertAtTheEnd(zePolyg.begin(),zePolyg.end());
- ciArr->setIJ(i+1,0,cArr->getNumberOfTuples());
+ ciArr->setIJ(i+1,0,ToIdType(cArr->getNumberOfTuples()));
}
ret->setNodalConnectivity(cArr,ciArr);
return ret.retn();
*/
DataArrayDouble *MEDCoupling1SGTUMesh::getBoundingBoxForBBTree(double arcDetEps) const
{
- int spaceDim(getSpaceDimension()),nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes()),nbOfNodesPerCell(getNumberOfNodesPerCell());
+ int spaceDim(getSpaceDimension()),nbOfCells(ToIdType(getNumberOfCells())),nbOfNodes(getNumberOfNodes()),nbOfNodesPerCell(getNumberOfNodesPerCell());
MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim);
double *bbox(ret->getPointer());
for(int i=0;i<nbOfCells*spaceDim;i++)
{
checkFullyDefined();
MCAuto<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME));
- int nbCells(getNumberOfCells());
+ mcIdType nbCells=ToIdType(getNumberOfCells());
MCAuto<DataArrayDouble> arr(DataArrayDouble::New());
arr->alloc(nbCells,1);
INTERP_KERNEL::AutoCppPtr<INTERP_KERNEL::DiameterCalculator> dc(_cm->buildInstanceOfDiameterCalulator(getSpaceDimension()));
{
checkConsistencyOfConnectivity();
INTERP_KERNEL::AutoCppPtr<INTERP_KERNEL::OrientationInverter> oi(INTERP_KERNEL::OrientationInverter::BuildInstanceFrom(getCellModelEnum()));
- int nbOfNodesPerCell((int)_cm->getNumberOfNodes()),nbCells(getNumberOfCells());
+ mcIdType nbOfNodesPerCell=ToIdType(_cm->getNumberOfNodes()),nbCells=ToIdType(getNumberOfCells());
int *conn(_conn->getPointer());
for(int i=0;i<nbCells;i++)
oi->operate(conn+i*nbOfNodesPerCell,conn+(i+1)*nbOfNodesPerCell);
else
throw INTERP_KERNEL::Exception("Nodal connectivity array not defined !");
//
- int sz2=_conn->getNumberOfTuples();
+ mcIdType sz2=ToIdType(_conn->getNumberOfTuples());
c1=_conn_indx;
if(c1)
{
if(!c2->isMonotonic(true))
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::checkConsistency : the nodal connectivity index is expected to be increasing monotinic !");
//
- int nbOfTuples=c1->getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType(c1->getNumberOfTuples());
int nbOfNodes=getNumberOfNodes();
const int *w(c1->begin());
for(int i=0;i<nbOfTuples;i++,w++)
if(getCellModelEnum()!=INTERP_KERNEL::NORM_POLYHED)
return _conn_indx->deltaShiftIndex();
// for polyhedrons
- int nbOfCells=_conn_indx->getNumberOfTuples()-1;
+ mcIdType nbOfCells=ToIdType(_conn_indx->getNumberOfTuples())-1;
MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfCells,1);
int *retPtr=ret->getPointer();
const int *ci=_conn_indx->begin(),*c=_conn->begin();
for(int i=0;i<nbOfCells;i++,retPtr++,ci++)
- *retPtr=ci[1]-ci[0]-std::count(c+ci[0],c+ci[1],-1);
+ *retPtr=ci[1]-ci[0]-ToIdType(std::count(c+ci[0],c+ci[1],-1));
return ret.retn();
}
return ret.retn();
}
// for polyhedrons
- int nbOfCells=_conn_indx->getNumberOfTuples()-1;
+ mcIdType nbOfCells=ToIdType(_conn_indx->getNumberOfTuples())-1;
MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfCells,1);
int *retPtr=ret->getPointer();
const int *ci=_conn_indx->begin(),*c=_conn->begin();
for(int i=0;i<nbOfCells;i++,retPtr++,ci++)
- *retPtr=std::count(c+ci[0],c+ci[1],-1)+1;
+ *retPtr=ToIdType(std::count(c+ci[0],c+ci[1],-1))+1;
return ret.retn();
}
{
checkConsistencyLight();
_conn_indx->checkMonotonic(true);
- int nbOfCells(_conn_indx->getNumberOfTuples()-1);
+ mcIdType nbOfCells=ToIdType(_conn_indx->getNumberOfTuples())-1;
MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfCells,1);
int *retPtr(ret->getPointer());
std::size_t nbOfCells(getNumberOfCells());//performs checks
if(cellId<nbOfCells)
{
- int strt=_conn_indx->getIJ(cellId,0),stp=_conn_indx->getIJ(cellId+1,0);
+ int strt=_conn_indx->getIJ(ToIdType(cellId),0),stp=_conn_indx->getIJ(ToIdType(cellId)+1,0);
int nbOfNodes=stp-strt;
if(nbOfNodes<0)
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::getNodeIdsOfCell : the index array is invalid ! Should be increasing monotonic !");
int MEDCoupling1DGTUMesh::getNumberOfNodesInCell(int cellId) const
{
- int nbOfCells(getNumberOfCells());//performs checks
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());//performs checks
if(cellId>=0 && cellId<nbOfCells)
{
const int *conn(_conn->begin());
int strt=_conn_indx->getIJ(cellId,0),stp=_conn_indx->getIJ(cellId+1,0);
- return stp-strt-std::count(conn+strt,conn+stp,-1);
+ return stp-strt-ToIdType(std::count(conn+strt,conn+stp,-1));
}
else
{
}
if(!isOK)
return ret.str();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
const int *ci=_conn_indx->begin(),*c=_conn->begin();
for(int i=0;i<nbOfCells;i++,ci++)
{
{
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
int spaceDim=getSpaceDimension();
- int nbOfCells=getNumberOfCells();//checkConsistencyLight()
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());//checkConsistencyLight()
int nbOfNodes=getNumberOfNodes();
ret->alloc(nbOfCells,spaceDim);
double *ptToFill=ret->getPointer();
void MEDCoupling1DGTUMesh::renumberCells(const int *old2NewBg, bool check)
{
- int nbCells=getNumberOfCells();
+ mcIdType nbCells=ToIdType(getNumberOfCells());
MCAuto<DataArrayInt> o2n=DataArrayInt::New();
o2n->useArray(old2NewBg,false,DeallocType::C_DEALLOC,nbCells,1);
if(check)
MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(getName(),getMeshDimension());
ret->setCoords(getCoords());
const int *nodalConn=_conn->begin(),*nodalConnI=_conn_indx->begin();
- int nbCells=getNumberOfCells();//checkConsistencyLight
+ mcIdType nbCells=ToIdType(getNumberOfCells());//checkConsistencyLight
int geoType=(int)getCellModelEnum();
MCAuto<DataArrayInt> c=DataArrayInt::New(); c->alloc(nbCells+_conn->getNumberOfTuples(),1);
MCAuto<DataArrayInt> cI=DataArrayInt::New(); cI->alloc(nbCells+1);
*/
DataArrayInt *MEDCoupling1DGTUMesh::simplexize(int policy)
{
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfCells,1);
ret->iota(0);
revNodalIndx->useArray(revNodalIndxPtr,true,DeallocType::C_DEALLOC,nbOfNodes+1,1);
std::fill(revNodalIndxPtr,revNodalIndxPtr+nbOfNodes+1,0);
const int *conn=_conn->begin(),*conni=_conn_indx->begin();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
int nbOfEltsInRevNodal=0;
for(int eltId=0;eltId<nbOfCells;eltId++)
{
int sz(0);
if((const DataArrayInt *)_conn)
if(_conn->isAllocated())
- sz=_conn->getNbOfElems();
+ sz=ToIdType(_conn->getNbOfElems());
if((const DataArrayInt *)_conn_indx)
if(_conn_indx->isAllocated())
- sz+=_conn_indx->getNbOfElems();
+ sz+=ToIdType(_conn_indx->getNbOfElems());
a1=DataArrayInt::New();
a1->alloc(sz,1);
int *work(a1->getPointer());
sz=0;
if((const DataArrayDouble *)_coords)
if(_coords->isAllocated())
- sz=_coords->getNbOfElems();
+ sz=ToIdType(_coords->getNbOfElems());
a2=DataArrayDouble::New();
a2->alloc(sz,1);
if(sz!=0 && (const DataArrayDouble *)_coords)
{
nbrOfNodesInUse=-1;
int nbOfNodes=getNumberOfNodes();
- int nbOfCells=getNumberOfCells();//checkConsistencyLight
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());//checkConsistencyLight
MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfNodes,1);
int *traducer=ret->getPointer();
{
getNumberOfCells();//only to check that all is well defined.
//
- int nbOfTuples(_conn->getNumberOfTuples());
+ std::size_t nbOfTuples(_conn->getNumberOfTuples());
int *pt(_conn->getPointer());
- for(int i=0;i<nbOfTuples;i++,pt++)
+ for(std::size_t i=0;i<nbOfTuples;i++,pt++)
{
if(*pt==-1) continue;
*pt+=offset;
{
getNumberOfCells();//only to check that all is well defined.
//
- int nbElemsIn(getNumberOfNodes()),nbOfTuples(_conn->getNumberOfTuples());
+ mcIdType nbElemsIn(getNumberOfNodes()),nbOfTuples(ToIdType(_conn->getNumberOfTuples()));
int *pt(_conn->getPointer());
for(int i=0;i<nbOfTuples;i++,pt++)
{
*/
void MEDCoupling1DGTUMesh::fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, DataArrayInt *&cellIdsKeptArr) const
{
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
MCAuto<DataArrayInt> cellIdsKept=DataArrayInt::New(); cellIdsKept->alloc(0,1);
int tmp=-1;
int sz=_conn->getMaxValue(tmp); sz=std::max(sz,0)+1;
if(pos==(int)c->getNumberOfTuples())
{
c->pushBackValsSilent(nodalConnOfCellBg,nodalConnOfCellEnd);
- c2->pushBackSilent(pos+sz);
+ c2->pushBackSilent(pos+ToIdType(sz));
}
else
{
const MEDCoupling1DGTUMesh *cur=a[i];
const DataArrayDouble *coo=cur->getCoords();
if(coo)
- spaceDim=coo->getNumberOfComponents();
+ spaceDim=ToIdType(coo->getNumberOfComponents());
}
if(spaceDim==-3)
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::Merge1DGTUMeshes : no spaceDim specified ! unable to perform merge !");
std::vector<const DataArrayInt *> ncs(a.size()),ncis(a.size());
std::vector<const MEDCoupling1DGTUMesh *>::const_iterator it=a.begin();
std::vector<int> nbNodesPerElt(a.size());
- int nbOfCells=(*it)->getNumberOfCells();
+ std::size_t nbOfCells=(*it)->getNumberOfCells();
bool tmp;
objs[0]=(*it)->copyWithNodalConnectivityPacked(tmp);
ncs[0]=objs[0]->getNodalConnectivity(); ncis[0]=objs[0]->getNodalConnectivityIndex();
DataArrayDouble *MEDCoupling1DGTUMesh::getBoundingBoxForBBTree(double arcDetEps) const
{
checkFullyDefined();
- int spaceDim(getSpaceDimension()),nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes());
+ int spaceDim(getSpaceDimension()),nbOfCells(ToIdType(getNumberOfCells())),nbOfNodes(getNumberOfNodes());
MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim);
double *bbox(ret->getPointer());
for(int i=0;i<nbOfCells*spaceDim;i++)
{
checkConsistencyOfConnectivity();
INTERP_KERNEL::AutoCppPtr<INTERP_KERNEL::OrientationInverter> oi(INTERP_KERNEL::OrientationInverter::BuildInstanceFrom(getCellModelEnum()));
- int nbCells(getNumberOfCells());
+ mcIdType nbCells=ToIdType(getNumberOfCells());
const int *connI(_conn_indx->begin());
int *conn(_conn->getPointer());
for(int i=0;i<nbCells;i++)
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds : input vectors do not have the same size !");
if(sz1==0)
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds : empty vectors in input !");
- int nbOfTuples=0;
+ std::size_t nbOfTuples=0;
for(std::vector<const DataArrayInt *>::const_iterator it=nodalConns.begin();it!=nodalConns.end();it++)
{
if(!(*it))
int i=0;
for(std::vector<const DataArrayInt *>::const_iterator it=nodalConns.begin();it!=nodalConns.end();it++,i++)
{
- int curNbt=(*it)->getNumberOfTuples();
+ int curNbt=ToIdType((*it)->getNumberOfTuples());
const int *inPt=(*it)->begin();
int offset=offsetInNodeIdsPerElt[i];
for(int j=0;j<curNbt;j++,pt++)
int geoType((int)*gts.begin());
MCAuto<MEDCoupling1DGTUMesh> ret(MEDCoupling1DGTUMesh::New(m->getName(),*gts.begin()));
ret->setCoords(m->getCoords()); ret->setDescription(m->getDescription());
- int nbCells(m->getNumberOfCells());
+ mcIdType nbCells=ToIdType(m->getNumberOfCells());
MCAuto<DataArrayInt> conn(DataArrayInt::New()),connI(DataArrayInt::New());
conn->alloc(m->getNodalConnectivityArrayLen()-nbCells,1); connI->alloc(nbCells+1,1);
int *c(conn->getPointer()),*ci(connI->getPointer()); *ci=0;
{
getNumberOfCells();//only to check that all is well defined.
int *begPtr(_conn->getPointer());
- int nbElt(_conn->getNumberOfTuples());
+ mcIdType nbElt=ToIdType(_conn->getNumberOfTuples());
int *endPtr(begPtr+nbElt);
for(int *it=begPtr;it!=endPtr;it++)
{
{
getNumberOfCells();//only to check that all is well defined.
//
- int nbOfTuples(_conn->getNumberOfTuples());
+ mcIdType nbOfTuples=ToIdType(_conn->getNumberOfTuples());
int *pt(_conn->getPointer());
for(int i=0;i<nbOfTuples;i++,pt++)
{
{
if(!_x_array->isAllocated() || _x_array->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("MEDCouplingCMesh::getNodeGridStructure : X array exits but it is not allocated or with nb of components equal to one !");
- ret.push_back(_x_array->getNumberOfTuples());
+ ret.push_back(ToIdType(_x_array->getNumberOfTuples()));
}
else
isOK=false;
throw INTERP_KERNEL::Exception("MEDCouplingCMesh::getNodeGridStructure : Y array exits but it is not allocated or with nb of components equal to one !");
if(!isOK)
throw INTERP_KERNEL::Exception(MSG);
- ret.push_back(_y_array->getNumberOfTuples());
+ ret.push_back(ToIdType(_y_array->getNumberOfTuples()));
}
else
isOK=false;
throw INTERP_KERNEL::Exception("MEDCouplingCMesh::getNodeGridStructure : Z array exits but it is not allocated or with nb of components equal to one !");
if(!isOK)
throw INTERP_KERNEL::Exception(MSG);
- ret.push_back(_z_array->getNumberOfTuples());
+ ret.push_back(ToIdType(_z_array->getNumberOfTuples()));
}
return ret;
}
if(c)
{
const double *coords=c->getConstPointer();
- int nb=c->getNbOfElems();
+ mcIdType nb=ToIdType(c->getNbOfElems());
bbox[2*j]=coords[0];
bbox[2*j+1]=coords[nb-1];
j++;
{
std::string name="MeasureOfMesh_";
name+=getName();
- int nbelem=getNumberOfCells();
+ mcIdType nbelem=ToIdType(getNumberOfCells());
MEDCouplingFieldDouble *field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
field->setName(name);
DataArrayDouble* array=DataArrayDouble::New();
for(int i=0;i<dim;i++)
{
const double *d=getCoordsAt(i)->getConstPointer();
- int nbOfNodes=getCoordsAt(i)->getNbOfElems();
+ mcIdType nbOfNodes=ToIdType(getCoordsAt(i)->getNbOfElems());
double ref=pos[i];
const double *w=std::find_if(d,d+nbOfNodes,std::bind2nd(std::greater_equal<double>(),ref));
int w2=(int)std::distance(d,w);
if(c)
{
double *coords=c->getPointer();
- int lgth=c->getNbOfElems();
+ mcIdType lgth=ToIdType(c->getNbOfElems());
std::transform(coords,coords+lgth,coords,std::bind2nd(std::minus<double>(),point[i]));
std::transform(coords,coords+lgth,coords,std::bind2nd(std::multiplies<double>(),factor));
std::transform(coords,coords+lgth,coords,std::bind2nd(std::plus<double>(),point[i]));
{
DataArrayDouble *ret=DataArrayDouble::New();
int spaceDim=getSpaceDimension();
- int nbCells=getNumberOfCells();
+ mcIdType nbCells=ToIdType(getNumberOfCells());
ret->alloc(nbCells,spaceDim);
double *pt=ret->getPointer();
int tmp[3];
std::vector<double> tabsPtr[3];
for(int j=0;j<spaceDim;j++)
{
- int sz=tabs[j]->getNbOfElems()-1;
+ int sz=ToIdType(tabs[j]->getNbOfElems())-1;
ret->setInfoOnComponent(j,tabs[j]->getInfoOnComponent(0));
const double *srcPtr=tabs[j]->getConstPointer();
tabsPtr[j].insert(tabsPtr[j].end(),srcPtr,srcPtr+sz);
std::string st;
if(thisArr[i])
{
- val=thisArr[i]->getNumberOfTuples();
+ val=ToIdType(thisArr[i]->getNumberOfTuples());
st=thisArr[i]->getInfoOnComponent(0);
}
tinyInfo.push_back(val);
for(int i=0;i<3;i++)
{
if(thisArr[i])
- sz+=thisArr[i]->getNumberOfTuples();
+ sz+=ToIdType(thisArr[i]->getNumberOfTuples());
}
a2=DataArrayDouble::New();
a2->alloc(sz,1);
stream2[i] << "set but not allocated.";
else
{
- int nbCompo=thisArr[i]->getNumberOfComponents();
+ mcIdType nbCompo=ToIdType(thisArr[i]->getNumberOfComponents());
if(nbCompo==1)
{
- int nbTuples=thisArr[i]->getNumberOfTuples();
+ mcIdType nbTuples=ToIdType(thisArr[i]->getNumberOfTuples());
if(nbTuples<1)
{ stream2[i] << "set and allocated - WARNING number of elements < 1 !"; nbOfCells=-1; nbOfNodes=-1; }
else
const MEDCouplingCartesianAMRMeshGen *comAncestor(ancestorsOfThis[levThis]);
int idThis(comAncestor->getPatchIdFromChildMesh(ancestorsOfThis[levThis-1])),idOther(comAncestor->getPatchIdFromChildMesh(work2));
const MEDCouplingCartesianAMRPatch *thisp(comAncestor->getPatch(idThis)),*otherp(comAncestor->getPatch(idOther));
- std::vector<int> offset(ComputeOffsetFromTwoToOne(comAncestor,levOther,thisp,otherp));
+ std::vector<int> offset(ComputeOffsetFromTwoToOne(comAncestor,ToIdType(levOther),thisp,otherp));
p1Zone=thisp->getBLTRRange(); p2Zone=MEDCouplingStructuredMesh::TranslateCompactFrmt(otherp->getBLTRRange(),offset);
factToApplyOn2.resize(p1Zone.size()); std::fill(factToApplyOn2.begin(),factToApplyOn2.end(),1);
//
*/
int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsAtCurrentLevel() const
{
- return _mesh->getNumberOfCells();
+ return ToIdType(_mesh->getNumberOfCells());
}
/*!
int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsAtCurrentLevelGhost(int ghostLev) const
{
MCAuto<MEDCouplingIMesh> tmp(_mesh->buildWithGhost(ghostLev));
- return tmp->getNumberOfCells();
+ return ToIdType(tmp->getNumberOfCells());
}
/*!
*/
int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsRecursiveWithOverlap() const
{
- int ret(_mesh->getNumberOfCells());
+ mcIdType ret=ToIdType(_mesh->getNumberOfCells());
for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
{
ret+=(*it)->getNumberOfCellsRecursiveWithOverlap();
*/
int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsRecursiveWithoutOverlap() const
{
- int ret(_mesh->getNumberOfCells());
+ mcIdType ret=ToIdType(_mesh->getNumberOfCells());
for(std::vector< MCAuto<MEDCouplingCartesianAMRPatch> >::const_iterator it=_patches.begin();it!=_patches.end();it++)
{
ret-=(*it)->getNumberOfOverlapedCellsForFather();
if ( sign==0 || sign==-1 )
if ( i >= (std::size_t)minimumPatchLength-2 && i <= signature.size()-minimumPatchLength-2 )
{
- zero_cross.push_back(i) ;
+ zero_cross.push_back(ToIdType(i)) ;
edge.push_back(gradient_absolute[i]) ;
}
}
distance.push_back(fabs(max_cross_list[i]+1-center));
double distance_min=*min_element(distance.begin(),distance.end()) ;
- int pos_distance_min=find(distance.begin(),distance.end(),distance_min)-distance.begin();
+ int pos_distance_min=ToIdType(find(distance.begin(),distance.end(),distance_min)-distance.begin());
int best_place = max_cross_list[pos_distance_min] + part[id].first ;
if ( max_cross >=0 )
{
max_cross_dims = 1 ;
}
else
- max_cross_dims=std::find(zeroCrossVals.begin(),zeroCrossVals.end(),max_cross_dims)-zeroCrossVals.begin();
+ max_cross_dims=ToIdType(std::find(zeroCrossVals.begin(),zeroCrossVals.end(),max_cross_dims)-zeroCrossVals.begin());
cutFound=true;
cutPlace=zeroCrossDims[max_cross_dims];
axisId=max_cross_dims ;
rightRect[axisId].first=cutPlace+1;
leftPart=patchToBeSplit->extractPart(leftRect);
rightPart=patchToBeSplit->extractPart(rightRect);
- leftPart->zipToFitOnCriterion(minPatchLgth); rightPart->zipToFitOnCriterion(minPatchLgth);
+ leftPart->zipToFitOnCriterion(ToIdType(minPatchLgth)); rightPart->zipToFitOnCriterion(ToIdType(minPatchLgth));
listOfPatches.push_back(leftPart);
listOfPatches.push_back(rightPart);
}
{
if(!((const DataArrayDouble *)_coords))
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getSpaceDimension : no array set ! impossible to deduce a space dimension !");
- return _coords->getNumberOfComponents();
+ return ToIdType(_coords->getNumberOfComponents());
}
void MEDCouplingCurveLinearMesh::getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const
{
if(!((const DataArrayDouble *)_coords))
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getCoordinatesOfNode : Coordinates not set !");
- int nbOfCompo=_coords->getNumberOfComponents();
+ mcIdType nbOfCompo=ToIdType(_coords->getNumberOfComponents());
if(nodeId>=0 && nodeId<_coords->getNumberOfTuples())
coo.insert(coo.end(),_coords->begin()+nodeId*nbOfCompo,_coords->begin()+(nodeId+1)*nbOfCompo);
else
*/
void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim2(bool isAbs, MEDCouplingFieldDouble *field) const
{
- int nbcells=getNumberOfCells();
+ mcIdType nbcells=ToIdType(getNumberOfCells());
int spaceDim=getSpaceDimension();
if(spaceDim!=2 && spaceDim!=3)
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim2 : with meshDim 2 only space dimension 2 and 3 are possible !");
*/
void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim3(bool isAbs, MEDCouplingFieldDouble *field) const
{
- int nbcells=getNumberOfCells();
+ mcIdType nbcells=ToIdType(getNumberOfCells());
int spaceDim=getSpaceDimension();
if(spaceDim!=3)
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim3 : with meshDim 3 only space dimension 3 is possible !");
throw INTERP_KERNEL::Exception("Expected a cmesh with meshDim == 2 !");
MEDCouplingFieldDouble *ret=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME);
DataArrayDouble *array=DataArrayDouble::New();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
array->alloc(nbOfCells,3);
double *vals=array->getPointer();
for(int i=0;i<nbOfCells;i++)
if(!((DataArrayDouble *)_coords))
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::rotate : no coordinates set !");
int spaceDim=getSpaceDimension();
- int nbNodes=_coords->getNumberOfTuples();
+ mcIdType nbNodes=ToIdType(_coords->getNumberOfTuples());
double *coords=_coords->getPointer();
if(spaceDim==3)
DataArrayDouble::Rotate3DAlg(center,vector,angle,nbNodes,coords,coords);
if(!((DataArrayDouble *)_coords))
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::scale : no coordinates set !");
double *coords=_coords->getPointer();
- int nbNodes=_coords->getNumberOfTuples();
- int dim=_coords->getNumberOfComponents();
+ mcIdType nbNodes=ToIdType(_coords->getNumberOfTuples());
+ mcIdType dim=ToIdType(_coords->getNumberOfComponents());
for(int i=0;i<nbNodes;i++)
{
std::transform(coords+i*dim,coords+(i+1)*dim,point,coords+i*dim,std::minus<double>());
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
int spaceDim=getSpaceDimension();
int meshDim=getMeshDimension();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
ret->alloc(nbOfCells,spaceDim);
ret->copyStringInfoFrom(*getCoords());
switch(meshDim)
*/
void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim3(DataArrayDouble *bary) const
{
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
double *ptToFill=bary->getPointer();
const double *coor=_coords->getConstPointer();
if(getSpaceDimension()!=3)
*/
void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim2(DataArrayDouble *bary) const
{
- int nbcells=getNumberOfCells();
+ mcIdType nbcells=ToIdType(getNumberOfCells());
int spaceDim=getSpaceDimension();
double *ptToFill=bary->getPointer();
const double *coor=_coords->getConstPointer();
int sz=0;
if((const DataArrayDouble *)_coords)
if(_coords->isAllocated())
- sz=_coords->getNbOfElems();
+ sz=ToIdType(_coords->getNbOfElems());
a2=DataArrayDouble::New();
a2->alloc(sz,1);
if(sz!=0 && (const DataArrayDouble *)_coords)
{
stream << "MEDCouplingCurveLinearMesh C++ instance at " << this << ". Name : \"" << getName() << "\".";
stream << " Nodal structure : [";
- for(std::size_t i=0;i<_structure.size();i++)
+ mcIdType s_size=ToIdType(_structure.size());
+ for(mcIdType i=0;i<s_size;i++)
{
char tmp='X'+i;
stream << " " << tmp << "=" << _structure[i];
- if(i!=_structure.size()-1)
+ if(i!=s_size-1)
stream << ", ";
}
stream << " ].";
{ stream << std::endl << "No coordinates set !"; return ; }
if(!coo->isAllocated())
{ stream << std::endl << "Coordinates set but not allocated !"; return ; }
- int nbOfCompo(coo->getNumberOfComponents());
+ mcIdType nbOfCompo=ToIdType(coo->getNumberOfComponents());
int nbOfCompoExp(-1);
try
{
nbOfCompoExp=getSpaceDimension();
}
- catch(INTERP_KERNEL::Exception& e)
+ catch(INTERP_KERNEL::Exception&)
{
}
if(nbOfCompo!=nbOfCompoExp)
void MEDCouplingFieldDiscretization::normL1(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, double *res) const
{
MCAuto<MEDCouplingFieldDouble> vol=getMeasureField(mesh,true);
- int nbOfCompo=arr->getNumberOfComponents();
+ mcIdType nbOfCompo=ToIdType(arr->getNumberOfComponents());
int nbOfElems=getNumberOfTuples(mesh);
std::fill(res,res+nbOfCompo,0.);
const double *arrPtr=arr->getConstPointer();
void MEDCouplingFieldDiscretization::normL2(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, double *res) const
{
MCAuto<MEDCouplingFieldDouble> vol=getMeasureField(mesh,true);
- int nbOfCompo=arr->getNumberOfComponents();
+ mcIdType nbOfCompo=ToIdType(arr->getNumberOfComponents());
int nbOfElems=getNumberOfTuples(mesh);
std::fill(res,res+nbOfCompo,0.);
const double *arrPtr=arr->getConstPointer();
{
if(!arr)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr : input array is NULL !");
- int oldNbOfElems=arr->getNumberOfTuples();
- int nbOfComp=arr->getNumberOfComponents();
+ mcIdType oldNbOfElems=ToIdType(arr->getNumberOfTuples());
+ mcIdType nbOfComp=ToIdType(arr->getNumberOfComponents());
int newNbOfTuples=newNbOfEntity;
MCAuto<DataArrayDouble> arrCpy=arr->deepCopy();
const double *ptSrc=arrCpy->getConstPointer();
void MEDCouplingFieldDiscretization::RenumberEntitiesFromN2OArr(const int *new2OldPtr, int new2OldSz, DataArrayDouble *arr, const std::string& msg)
{
- int nbOfComp=arr->getNumberOfComponents();
+ mcIdType nbOfComp=ToIdType(arr->getNumberOfComponents());
MCAuto<DataArrayDouble> arrCpy=arr->deepCopy();
const double *ptSrc=arrCpy->getConstPointer();
arr->reAlloc(new2OldSz);
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getNumberOfTuples : NULL input mesh !");
- return mesh->getNumberOfCells();
+ return ToIdType(mesh->getNumberOfCells());
}
/*!
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getNumberOfMeshPlaces : NULL input mesh !");
- return mesh->getNumberOfCells();
+ return ToIdType(mesh->getNumberOfCells());
}
DataArrayInt *MEDCouplingFieldDiscretizationP0::getOffsetArr(const MEDCouplingMesh *mesh) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getOffsetArr : NULL input mesh !");
- int nbOfTuples=mesh->getNumberOfCells();
+ std::size_t nbOfTuples=mesh->getNumberOfCells();
DataArrayInt *ret=DataArrayInt::New();
ret->alloc(nbOfTuples+1,1);
ret->iota(0);
mesh->getCellsContainingPoints(loc,nbOfPoints,_precision,eltsArr,eltsIndexArr);
const int *elts(eltsArr->begin()),*eltsIndex(eltsIndexArr->begin());
int spaceDim=mesh->getSpaceDimension();
- int nbOfComponents=arr->getNumberOfComponents();
+ mcIdType nbOfComponents=ToIdType(arr->getNumberOfComponents());
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(nbOfPoints,nbOfComponents);
double *ptToFill=ret->getPointer();
INTERP_KERNEL::AutoPtr<double> tmp=new double[nbOfNodes];
INTERP_KERNEL::NormalizedCellType ct(mesh->getTypeOfCell(cellId));
INTERP_KERNEL::barycentric_coords(ct,vec,loc,tmp);
- int sz=arr->getNumberOfComponents();
+ mcIdType sz=ToIdType(arr->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> tmp2=new double[sz];
std::fill(res,res+sz,0.);
for(std::size_t i=0;i<nbOfNodes;i++)
mesh->getCellsContainingPoints(loc,nbOfPoints,_precision,eltsArr,eltsIndexArr);
const int *elts(eltsArr->begin()),*eltsIndex(eltsIndexArr->begin());
int spaceDim=mesh->getSpaceDimension();
- int nbOfComponents=arr->getNumberOfComponents();
+ mcIdType nbOfComponents=ToIdType(arr->getNumberOfComponents());
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(nbOfPoints,nbOfComponents);
double *ptToFill=ret->getPointer();
*/
void MEDCouplingFieldDiscretizationPerCell::renumberCells(const int *old2NewBg, bool check)
{
- int nbCells=_discr_per_cell->getNumberOfTuples();
+ mcIdType nbCells=ToIdType(_discr_per_cell->getNumberOfTuples());
const int *array=old2NewBg;
if(check)
array=DataArrayInt::CheckAndPreparePermutation(old2NewBg,old2NewBg+nbCells);
if(!_discr_per_cell)
{
_discr_per_cell=DataArrayInt::New();
- int nbTuples=mesh->getNumberOfCells();
+ mcIdType nbTuples=ToIdType(mesh->getNumberOfCells());
_discr_per_cell->alloc(nbTuples,1);
int *ptr=_discr_per_cell->getPointer();
std::fill(ptr,ptr+nbTuples,DFT_INVALID_LOCID_VALUE);
if (_discr_per_cell == 0)
throw INTERP_KERNEL::Exception("Discretization is not initialized!");
const int *dcPtr=_discr_per_cell->getConstPointer();
- int nbOfTuples=_discr_per_cell->getNumberOfTuples();
- int maxSz=(int)_loc.size();
+ mcIdType nbOfTuples=ToIdType(_discr_per_cell->getNumberOfTuples());
+ mcIdType maxSz=ToIdType(_loc.size());
for(const int *w=dcPtr;w!=dcPtr+nbOfTuples;w++)
{
if(*w>=0 && *w<maxSz)
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getNumberOfMeshPlaces : NULL input mesh !");
- return mesh->getNumberOfCells();
+ return ToIdType(mesh->getNumberOfCells());
}
/*!
const int *array=old2NewBg;
if(check)
array=DataArrayInt::CheckAndPreparePermutation(old2NewBg,old2NewBg+mesh->getNumberOfCells());
- int nbOfCells=_discr_per_cell->getNumberOfTuples();
+ mcIdType nbOfCells=ToIdType(_discr_per_cell->getNumberOfTuples());
int nbOfTuples=getNumberOfTuples(0);
const int *dcPtr=_discr_per_cell->getConstPointer();
int *array2=new int[nbOfTuples];//stores the final conversion array old2New to give to arrays in renumberInPlace.
{
int val=-1;
if(_discr_per_cell)
- val=_discr_per_cell->getNumberOfTuples();
+ val=ToIdType(_discr_per_cell->getNumberOfTuples());
tinyInfo.push_back(val);
tinyInfo.push_back((int)_loc.size());
if(_loc.empty())
for(std::vector<MEDCouplingGaussLocalization>::const_iterator iter=_loc.begin();iter!=_loc.end();iter++)
(*iter).checkConsistencyLight();
int nbOfDesc=(int)_loc.size();
- int nbOfCells=mesh->getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(mesh->getNumberOfCells());
const int *dc=_discr_per_cell->getConstPointer();
for(int i=0;i<nbOfCells;i++)
{
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::buildSubMeshDataRange : no discretization array set !");
di=0; beginOut=0; endOut=0; stepOut=stepCellIds;
const char msg[]="MEDCouplingFieldDiscretizationGauss::buildSubMeshDataRange : cell #";
- int nbOfTuples=_discr_per_cell->getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType(_discr_per_cell->getNumberOfTuples());
const int *w=_discr_per_cell->begin();
int nbMaxOfLocId=(int)_loc.size();
for(int i=0;i<nbOfTuples;i++,w++)
MEDCouplingGaussLocalization elt(type,refCoo,gsCoo,wg);
_loc.push_back(elt);
int *ptr=_discr_per_cell->getPointer();
- int nbCells=mesh->getNumberOfCells();
+ mcIdType nbCells=ToIdType(mesh->getNumberOfCells());
for(int i=0;i<nbCells;i++)
if(mesh->getTypeOfCell(i)==type)
ptr[i]=id;
{
if(locId<0 || locId>=(int)_loc.size())
throw INTERP_KERNEL::Exception("Invalid locId given : must be in range [0:getNbOfGaussLocalization()) !");
- int nbOfTuples=_discr_per_cell->getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType(_discr_per_cell->getNumberOfTuples());
const int *ptr=_discr_per_cell->getConstPointer();
for(int i=0;i<nbOfTuples;i++)
if(ptr[i]==locId)
{
if(!_discr_per_cell)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::buildNbOfGaussPointPerCellField : no discretization array set !");
- int nbOfTuples=_discr_per_cell->getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType(_discr_per_cell->getNumberOfTuples());
MCAuto<DataArrayInt> ret=DataArrayInt::New();
const int *w=_discr_per_cell->begin();
ret->alloc(nbOfTuples,1);
void MEDCouplingFieldDiscretizationGauss::zipGaussLocalizations()
{
const int *start=_discr_per_cell->begin();
- int nbOfTuples=_discr_per_cell->getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType(_discr_per_cell->getNumberOfTuples());
INTERP_KERNEL::AutoPtr<int> tmp=new int[_loc.size()];
std::fill((int *)tmp,(int *)tmp+_loc.size(),-2);
for(const int *w=start;w!=start+nbOfTuples;w++)
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuples : NULL input mesh !");
int ret=0;
- int nbOfCells=mesh->getNumberOfCells();
- for(int i=0;i<nbOfCells;i++)
+ mcIdType nbOfCells=ToIdType(mesh->getNumberOfCells());
+ for(mcIdType i=0;i<nbOfCells;i++)
{
INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(i);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getNumberOfMeshPlaces : NULL input mesh !");
- return mesh->getNumberOfCells();
+ return ToIdType(mesh->getNumberOfCells());
}
DataArrayInt *MEDCouplingFieldDiscretizationGaussNE::getOffsetArr(const MEDCouplingMesh *mesh) const
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getOffsetArr : NULL input mesh !");
- int nbOfTuples=mesh->getNumberOfCells();
+ mcIdType nbOfTuples=ToIdType(mesh->getNumberOfCells());
DataArrayInt *ret=DataArrayInt::New();
ret->alloc(nbOfTuples+1,1);
int *retPtr=ret->getPointer();
const int *array=old2NewBg;
if(check)
array=DataArrayInt::CheckAndPreparePermutation(old2NewBg,old2NewBg+mesh->getNumberOfCells());
- int nbOfCells=mesh->getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(mesh->getNumberOfCells());
int nbOfTuples=getNumberOfTuples(mesh);
int *array2=new int[nbOfTuples];//stores the final conversion array old2New to give to arrays in renumberInPlace.
int *array3=new int[nbOfCells];//store for each cell in after renumbering the offset needed by each cell in new numbering.
const double *coords=umesh->getCoords()->begin();
const int *connI=umesh->getNodalConnectivityIndex()->getConstPointer();
const int *conn=umesh->getNodalConnectivity()->getConstPointer();
- int nbCells=umesh->getNumberOfCells();
+ mcIdType nbCells=ToIdType(umesh->getNumberOfCells());
double *retPtr=ret->getPointer();
for(int i=0;i<nbCells;i++,connI++)
for(const int *w=conn+connI[0]+1;w!=conn+connI[1];w++)
{
if(!mesh || !arr)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::integral : input mesh or array is null !");
- int nbOfCompo=arr->getNumberOfComponents();
+ mcIdType nbOfCompo=ToIdType(arr->getNumberOfComponents());
std::fill(res,res+nbOfCompo,0.);
//
MCAuto<MEDCouplingFieldDouble> vol=mesh->getMeasureField(isWAbs);
MCAuto<DataArrayInt> ids=mesh->giveCellsWithType(*it);
MCAuto<DataArrayInt> ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell);
const int *ptIds2=ids2->begin(),*ptIds=ids->begin();
- int nbOfCellsWithCurGeoType=ids->getNumberOfTuples();
+ mcIdType nbOfCellsWithCurGeoType=ToIdType(ids->getNumberOfTuples());
for(int i=0;i<nbOfCellsWithCurGeoType;i++,ptIds++,ptIds2+=wArrSz)
{
for(int k=0;k<nbOfCompo;k++)
MCAuto<DataArrayInt> ids=mesh->giveCellsWithType(*it);
MCAuto<DataArrayInt> ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell);
const int *ptIds2=ids2->begin(),*ptIds=ids->begin();
- int nbOfCellsWithCurGeoType=ids->getNumberOfTuples();
+ mcIdType nbOfCellsWithCurGeoType=ToIdType(ids->getNumberOfTuples());
for(int i=0;i<nbOfCellsWithCurGeoType;i++,ptIds++)
for(std::size_t j=0;j<wArrSz;j++,ptIds2++)
arrPtr[*ptIds2]=wArr2[j]*volPtr[*ptIds];
return MEDCouplingFieldDiscretization::buildSubMeshDataRange(mesh,beginCellIds,endCellIds,stepCellIds,beginOut,endOut,stepOut,di);
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::buildSubMeshDataRange : NULL input mesh !");
- int nbOfCells=mesh->getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(mesh->getNumberOfCells());
di=0; beginOut=0; endOut=0; stepOut=stepCellIds;
const char msg[]="MEDCouplingFieldDiscretizationGaussNE::buildSubMeshDataRange : cell #";
for(int i=0;i<nbOfCells;i++)
{
if(!arr || !arr->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::getValueOnMulti : input array is null or not allocated !");
- std::size_t nbOfRows(getNumberOfMeshPlaces(mesh));
+ mcIdType nbOfRows=ToIdType(getNumberOfMeshPlaces(mesh));
if(arr->getNumberOfTuples()!=nbOfRows)
{
std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationKriging::getValueOnMulti : input array does not have correct number of tuples ! Excepted " << nbOfRows << " having " << arr->getNumberOfTuples() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- int nbCols(-1),nbCompo(arr->getNumberOfComponents());
+ int nbCols(-1),nbCompo(ToIdType(arr->getNumberOfComponents()));
MCAuto<DataArrayDouble> m(computeEvaluationMatrixOnGivenPts(mesh,loc,nbOfTargetPoints,nbCols));
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
ret->alloc(nbOfTargetPoints,nbCompo);
MCAuto<DataArrayDouble> matrixInv(computeInverseMatrix(mesh,isDrift,nbRows));
//
MCAuto<DataArrayDouble> coords=getLocalizationOfDiscValues(mesh);
- int nbOfPts(coords->getNumberOfTuples()),dimension(coords->getNumberOfComponents());
+ mcIdType nbOfPts(ToIdType(coords->getNumberOfTuples())),dimension(ToIdType(coords->getNumberOfComponents()));
MCAuto<DataArrayDouble> locArr=DataArrayDouble::New();
locArr->useArray(loc,false,DeallocType::CPP_DEALLOC,nbOfTargetPoints,dimension);
nbCols=nbOfPts;
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::computeMatrix : NULL input mesh !");
MCAuto<DataArrayDouble> coords(getLocalizationOfDiscValues(mesh));
- int nbOfPts(coords->getNumberOfTuples());
+ mcIdType nbOfPts=ToIdType(coords->getNumberOfTuples());
MCAuto<DataArrayDouble> matrix(coords->buildEuclidianDistanceDenseMatrix());
operateOnDenseMatrix(mesh->getSpaceDimension(),nbOfPts*nbOfPts,matrix->getPointer());
// Drift
MCAuto<DataArrayDouble> KnewiK(DataArrayDouble::New());
KnewiK->alloc(nbRows*1,1);
MCAuto<DataArrayDouble> arr2(PerformDriftOfVec(arr,isDrift));
- INTERP_KERNEL::matrixProduct(matrixInv->getConstPointer(),nbRows,nbRows,arr2->getConstPointer(),arr2->getNumberOfTuples(),1,KnewiK->getPointer());
+ INTERP_KERNEL::matrixProduct(matrixInv->getConstPointer(),nbRows,nbRows,arr2->getConstPointer(),ToIdType(arr2->getNumberOfTuples()),1,KnewiK->getPointer());
return KnewiK.retn();
}
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::PerformDriftRect : invalid input dense matrix ! Must be allocated not NULL and with exactly one component !");
if(!arr || !arr->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::PerformDriftRect : invalid input array of coordiantes ! Must be allocated and not NULL !");
- int spaceDimension(arr->getNumberOfComponents()),nbOfPts(arr->getNumberOfTuples()),nbOfEltInMatrx(matr->getNumberOfTuples());
+ mcIdType spaceDimension=ToIdType(arr->getNumberOfComponents()),nbOfPts=ToIdType(arr->getNumberOfTuples()),nbOfEltInMatrx=ToIdType(matr->getNumberOfTuples());
delta=spaceDimension+1;
int nbOfCols(nbOfEltInMatrx/nbOfPts);
if(nbOfEltInMatrx%nbOfPts!=0)
*/
DataArrayDouble *MEDCouplingFieldDiscretizationKriging::performDrift(const DataArrayDouble *matr, const DataArrayDouble *arr, int& delta) const
{
- std::size_t spaceDimension(arr->getNumberOfComponents());
+ mcIdType spaceDimension=ToIdType(arr->getNumberOfComponents());
delta=spaceDimension+1;
- std::size_t szOfMatrix(arr->getNumberOfTuples());
+ mcIdType szOfMatrix=ToIdType(arr->getNumberOfTuples());
if(szOfMatrix*szOfMatrix!=matr->getNumberOfTuples())
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::performDrift : invalid size");
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
const double *srcWork=matr->getConstPointer();
const double *srcWork2=arr->getConstPointer();
double *destWork=ret->getPointer();
- for(std::size_t i=0;i<szOfMatrix;i++)
+ for(mcIdType i=0;i<szOfMatrix;i++)
{
destWork=std::copy(srcWork,srcWork+szOfMatrix,destWork);
srcWork+=szOfMatrix;
std::fill(destWork,destWork+spaceDimension+1,0.); destWork+=spaceDimension+1;
MCAuto<DataArrayDouble> arrNoI=arr->toNoInterlace();
srcWork2=arrNoI->getConstPointer();
- for(std::size_t i=0;i<spaceDimension;i++)
+ for(mcIdType i=0;i<spaceDimension;i++)
{
destWork=std::copy(srcWork2,srcWork2+szOfMatrix,destWork);
srcWork2+=szOfMatrix;
MCAuto<MEDCouplingFieldDiscretizationP0> nsp(new MEDCouplingFieldDiscretizationP0);
ret->setDiscretization(nsp);
const MEDCouplingMesh *m(getMesh());//m is non empty thanks to checkConsistencyLight call
- int nbCells(m->getNumberOfCells());
+ mcIdType nbCells=ToIdType(m->getNumberOfCells());
std::vector<DataArrayDouble *> arrs(getArrays());
std::size_t sz(arrs.size());
std::vector< MCAuto<DataArrayDouble> > outArrsSafe(sz); std::vector<DataArrayDouble *> outArrs(sz);
for(std::size_t j=0;j<sz;j++)
{
- int nbCompo(arrs[j]->getNumberOfComponents());
+ mcIdType nbCompo=ToIdType(arrs[j]->getNumberOfComponents());
outArrsSafe[j]=DataArrayDouble::New(); outArrsSafe[j]->alloc(nbCells,nbCompo);
outArrsSafe[j]->copyStringInfoFrom(*arrs[j]);
outArrs[j]=outArrsSafe[j];
double *pt(outArrsSafe[j]->getPointer());
const double *srcPt(arrs[j]->begin());
- for(int i=0;i<nbCells;i++,pt+=nbCompo)
+ for(mcIdType i=0;i<nbCells;i++,pt+=nbCompo)
{
std::vector<int> nodeIds;
m->getNodeIdsOfCell(i,nodeIds);
MCAuto<DataArrayDouble> arr=getArray()->deepCopy();
arr->multiplyEqual(w->getArray());
arr->accumulate(res);
- int nCompo = getArray()->getNumberOfComponents();
+ mcIdType nCompo = ToIdType(getArray()->getNumberOfComponents());
std::transform(res,res+nCompo,res,std::bind2nd(std::multiplies<double>(),1./deno));
}
*/
double MEDCouplingFieldDouble::getWeightedAverageValue(int compId, bool isWAbs) const
{
- int nbComps=getArray()->getNumberOfComponents();
+ mcIdType nbComps=ToIdType(getArray()->getNumberOfComponents());
if(compId<0 || compId>=nbComps)
{
std::ostringstream oss; oss << "MEDCouplingFieldDouble::getWeightedAverageValue : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !";
throw INTERP_KERNEL::Exception("No mesh underlying this field to perform normL1 !");
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform normL1 !");
- int nbComps=getArray()->getNumberOfComponents();
+ mcIdType nbComps=ToIdType(getArray()->getNumberOfComponents());
if(compId<0 || compId>=nbComps)
{
std::ostringstream oss; oss << "MEDCouplingFieldDouble::normL1 : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !";
throw INTERP_KERNEL::Exception("No mesh underlying this field to perform normL2");
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform normL2 !");
- int nbComps=getArray()->getNumberOfComponents();
+ mcIdType nbComps=ToIdType(getArray()->getNumberOfComponents());
if(compId<0 || compId>=nbComps)
{
std::ostringstream oss; oss << "MEDCouplingFieldDouble::normL2 : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !";
{
if(getArray()==0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::normMax : no default array defined !");
- int nbComps=getArray()->getNumberOfComponents();
+ mcIdType nbComps=ToIdType(getArray()->getNumberOfComponents());
if(compId<0 || compId>=nbComps)
{
std::ostringstream oss; oss << "MEDCouplingFieldDouble::normMax : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !";
throw INTERP_KERNEL::Exception("No mesh underlying this field to perform integral");
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform integral !");
- int nbComps=getArray()->getNumberOfComponents();
+ mcIdType nbComps=ToIdType(getArray()->getNumberOfComponents());
if(compId<0 || compId>=nbComps)
{
std::ostringstream oss; oss << "MEDCouplingFieldDouble::integral : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !";
timeDiscr()->getArrays(arrays);
for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
if(*iter)
- _type->renumberValuesOnCells(epsOnVals,meshC,arr->getConstPointer(),meshC2->getNumberOfCells(),*iter);
+ _type->renumberValuesOnCells(epsOnVals,meshC,arr->getConstPointer(),ToIdType(meshC2->getNumberOfCells()),*iter);
setMesh(meshC2);
return true;
}
throw INTERP_KERNEL::Exception("No underlying mesh on this field to perform simplexize !");
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform simplexize !");
- int oldNbOfCells=_mesh->getNumberOfCells();
+ std::size_t oldNbOfCells=_mesh->getNumberOfCells();
MCAuto<MEDCouplingMesh> meshC2(_mesh->deepCopy());
MCAuto<DataArrayInt> arr=meshC2->simplexize(policy);
- int newNbOfCells=meshC2->getNumberOfCells();
+ std::size_t newNbOfCells=meshC2->getNumberOfCells();
if(oldNbOfCells==newNbOfCells)
return false;
std::vector<DataArrayDouble *> arrays;
timeDiscr()->getArrays(arrays);
for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
if(*iter)
- _type->renumberValuesOnCellsR(_mesh,arr->getConstPointer(),arr->getNbOfElems(),*iter);
+ _type->renumberValuesOnCellsR(_mesh,arr->getConstPointer(),ToIdType(arr->getNbOfElems()),*iter);
setMesh(meshC2);
return true;
}
inpMeshBase=fieldToWO->getMesh();
inpMesh=inpMeshBase->buildUnstructured();
}
- int nbCells(inpMesh->getNumberOfCells());
+ mcIdType nbCells=ToIdType(inpMesh->getNumberOfCells());
const MEDCouplingFieldDiscretization *disc(fieldToWO->getDiscretization());
const MEDCouplingFieldDiscretizationGauss *disc2(dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(disc));
if(!disc2)
ptsInReal=gl.localizePtsInRefCooForEachCell(vorCellsForCurDisc->getCoords(),subMesh);
}
int nbPtsPerCell(vorCellsForCurDisc->getNumberOfNodes());
- for(std::size_t j=0;j<ids.size();j++)
+ for(mcIdType j=0;j<ids.size();j++)
{
MCAuto<MEDCouplingUMesh> elt(vorCellsForCurDisc->clone(false));
MCAuto<DataArrayDouble> coo4(ptsInReal->selectByTupleIdSafeSlice(j*nbPtsPerCell,(j+1)*nbPtsPerCell,1));
{
if(getArray()->isAllocated())
{
- int nbOfCompo=getArray()->getNumberOfComponents();
+ mcIdType nbOfCompo=ToIdType(getArray()->getNumberOfComponents());
ret << Traits<T>::FieldTypeName << " default array has " << nbOfCompo << " components and " << getArray()->getNumberOfTuples() << " tuples.\n";
ret << Traits<T>::FieldTypeName << " default array has following info on components : ";
- for(int i=0;i<nbOfCompo;i++)
+ for(mcIdType i=0;i<nbOfCompo;i++)
ret << "\"" << getArray()->getInfoOnComponent(i) << "\" ";
ret << "\n";
}
nat=MEDCouplingNatureOfField::GetRepr(_nature);
stream << "Nature of field : " << nat << ".\n";
}
- catch(INTERP_KERNEL::Exception& e)
+ catch(INTERP_KERNEL::Exception&)
{ }
const MEDCouplingFieldDiscretization *fd(_type);
if(!fd)
ptsInRefCoo->checkAllocated();
mesh->checkConsistencyLight();
//
- int nbCells(mesh->getNumberOfCells());
+ mcIdType nbCells=ToIdType(mesh->getNumberOfCells());
const double *coords(mesh->getCoords()->begin());
const int *connI(mesh->getNodalConnectivityIndex()->begin()),*conn(mesh->getNodalConnectivity()->begin());
//
- int nbPts(ptsInRefCoo->getNumberOfTuples());
+ mcIdType nbPts=ToIdType(ptsInRefCoo->getNumberOfTuples());
INTERP_KERNEL::NormalizedCellType typ(getType());
int dim(INTERP_KERNEL::CellModel::GetCellModel(typ).getDimension()),outDim(mesh->getSpaceDimension());
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : the parameters 1 or 3 are NULL or not allocated !");
int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseSt)),nbOfTuplesInFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(fineLocInCoarse));
- int nbCompo(fineDA->getNumberOfComponents());
+ mcIdType nbCompo=ToIdType(fineDA->getNumberOfComponents());
if((int)coarseDA->getNumberOfComponents()!=nbCompo)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : the number of components of fine DA and coarse one mismatches !");
if(meshDim!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size())
std::ostringstream oss; oss << "MEDCouplingIMesh::CondenseFineToCoarse : Expecting " << nbOfTuplesInCoarseExp << " tuples having " << coarseDA->getNumberOfTuples() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- int nbTuplesFine(fineDA->getNumberOfTuples());
+ mcIdType nbTuplesFine=ToIdType(fineDA->getNumberOfTuples());
if(nbOfTuplesInFineExp==0)
{
if(nbTuplesFine==0)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarseGhost : the parameters 1 or 3 are NULL or not allocated !");
std::vector<int> coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus<int>(),2*ghostSize));
int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG));
- int nbCompo(fineDA->getNumberOfComponents());
+ mcIdType nbCompo=ToIdType(fineDA->getNumberOfComponents());
if((int)coarseDA->getNumberOfComponents()!=nbCompo)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarseGhost : the number of components of fine DA and coarse one mismatches !");
if(meshDim!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size())
std::vector<int> fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse));
std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies<int>());
std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus<int>(),2*ghostSize));
- int nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG));
+ mcIdType nbTuplesFine(ToIdType(fineDA->getNumberOfTuples())),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG));
if(fineDA->getNumberOfTuples()!=nbTuplesFineExp)
{
std::ostringstream oss; oss << "MEDCouplingIMesh::CondenseFineToCoarseGhost : Expecting " << nbTuplesFineExp << " tuples in fine DataArray having " << nbTuplesFine << " !";
if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : the parameters 1 or 3 are NULL or not allocated !");
int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseSt)),nbOfTuplesInFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(fineLocInCoarse));
- int nbCompo(fineDA->getNumberOfComponents());
- if((int)coarseDA->getNumberOfComponents()!=nbCompo)
+ mcIdType nbCompo=ToIdType(fineDA->getNumberOfComponents());
+ if(ToIdType(coarseDA->getNumberOfComponents())!=nbCompo)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : the number of components of fine DA and coarse one mismatches !");
if(meshDim!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size())
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !");
std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFine : Expecting " << nbOfTuplesInCoarseExp << " tuples having " << coarseDA->getNumberOfTuples() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- int nbTuplesFine(fineDA->getNumberOfTuples());
+ mcIdType nbTuplesFine=ToIdType(fineDA->getNumberOfTuples());
if(nbTuplesFine%nbOfTuplesInFineExp!=0)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : Invalid nb of tuples in fine DataArray regarding its structure !");
int fact(std::accumulate(facts.begin(),facts.end(),1,std::multiplies<int>()));
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhost : the parameters 1 or 3 are NULL or not allocated !");
std::vector<int> coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus<int>(),2*ghostSize));
int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG));
- int nbCompo(fineDA->getNumberOfComponents());
+ mcIdType nbCompo=ToIdType(fineDA->getNumberOfComponents());
if((int)coarseDA->getNumberOfComponents()!=nbCompo)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhost : the number of components of fine DA and coarse one mismatches !");
if(meshDim!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size())
std::vector<int> fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse));
std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies<int>());
std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus<int>(),2*ghostSize));
- int nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG));
+ mcIdType nbTuplesFine=ToIdType(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG));
if(fineDA->getNumberOfTuples()!=nbTuplesFineExp)
{
std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFineGhost : Expecting " << nbTuplesFineExp << " tuples in fine DataArray having " << nbTuplesFine << " !";
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhostZone : the parameters 1 or 3 are NULL or not allocated !");
std::vector<int> coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus<int>(),2*ghostSize));
int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG));
- int nbCompo(fineDA->getNumberOfComponents());
+ mcIdType nbCompo=ToIdType(fineDA->getNumberOfComponents());
if((int)coarseDA->getNumberOfComponents()!=nbCompo)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhostZone : the number of components of fine DA and coarse one mismatches !");
if(meshDim!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size())
std::vector<int> fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse));
std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies<int>());
std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus<int>(),2*ghostSize));
- int nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG));
+ mcIdType nbTuplesFine=ToIdType(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG));
if(fineDA->getNumberOfTuples()!=nbTuplesFineExp)
{
std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFineGhostZone : Expecting " << nbTuplesFineExp << " tuples in fine DataArray having " << nbTuplesFine << " !";
checkConsistencyLight();
std::string name="MeasureOfMesh_";
name+=getName();
- int nbelem(getNumberOfCells());
+ std::size_t nbelem=getNumberOfCells();
MEDCouplingFieldDouble *field(MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME));
field->setName(name);
DataArrayDouble* array(DataArrayDouble::New());
{
checkConsistencyLight();
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
- int spaceDim(getSpaceDimension()),nbCells(getNumberOfCells()),tmp[3],tmp2[3];
+ mcIdType spaceDim(getSpaceDimension()),nbCells(ToIdType(getNumberOfCells())),tmp[3],tmp2[3];
ret->alloc(nbCells,spaceDim);
double *pt(ret->getPointer()),shiftOrigin[3];
std::transform(_dxyz,_dxyz+spaceDim,shiftOrigin,std::bind2nd(std::multiplies<double>(),0.5));
return ret.retn();
}
MCAuto<DataArrayInt> tmp(_mesh2D->giveCellsWithType(revExtTyp));
- int nbOfLevs(_mesh1D->getNumberOfCells());
- int nbOfCells2D(_mesh2D->getNumberOfCells());
- int nbOfTuples(tmp->getNumberOfTuples());
+ mcIdType nbOfLevs=ToIdType(_mesh1D->getNumberOfCells());
+ mcIdType nbOfCells2D=ToIdType(_mesh2D->getNumberOfCells());
+ mcIdType nbOfTuples=ToIdType(tmp->getNumberOfTuples());
ret->alloc(nbOfLevs*nbOfTuples,1);
int *pt(ret->getPointer());
for(int i=0;i<nbOfLevs;i++,pt+=nbOfTuples)
DataArrayInt *MEDCouplingMappedExtrudedMesh::computeNbOfNodesPerCell() const
{
MCAuto<DataArrayInt> ret2D(_mesh2D->computeNbOfNodesPerCell());
- int nbOfLevs(_mesh1D->getNumberOfCells());
- int nbOfCells2D(_mesh2D->getNumberOfCells());
+ mcIdType nbOfLevs=ToIdType(_mesh1D->getNumberOfCells());
+ mcIdType nbOfCells2D=ToIdType(_mesh2D->getNumberOfCells());
MCAuto<DataArrayInt> ret3D(DataArrayInt::New()); ret3D->alloc(nbOfLevs*nbOfCells2D,1);
int *pt(ret3D->getPointer());
for(int i=0;i<nbOfLevs;i++,pt+=nbOfCells2D)
DataArrayInt *MEDCouplingMappedExtrudedMesh::computeNbOfFacesPerCell() const
{
MCAuto<DataArrayInt> ret2D(_mesh2D->computeNbOfNodesPerCell());
- int nbOfLevs(_mesh1D->getNumberOfCells());
- int nbOfCells2D(_mesh2D->getNumberOfCells());
+ mcIdType nbOfLevs=ToIdType(_mesh1D->getNumberOfCells());
+ mcIdType nbOfCells2D=ToIdType(_mesh2D->getNumberOfCells());
MCAuto<DataArrayInt> ret3D(DataArrayInt::New()); ret3D->alloc(nbOfLevs*nbOfCells2D,1);
int *pt(ret3D->getPointer());
for(int i=0;i<nbOfLevs;i++,pt+=nbOfCells2D)
void MEDCouplingMappedExtrudedMesh::getNodeIdsOfCell(std::size_t cellId, std::vector<int>& conn) const
{
- int nbOfCells2D(_mesh2D->getNumberOfCells());
+ mcIdType nbOfCells2D=ToIdType(_mesh2D->getNumberOfCells());
int nbOfNodes2D(_mesh2D->getNumberOfNodes());
- int locId(cellId%nbOfCells2D);
- int lev(cellId/nbOfCells2D);
+ int locId(ToIdType(cellId)%nbOfCells2D);
+ int lev(ToIdType(cellId)/nbOfCells2D);
std::vector<int> tmp,tmp2;
_mesh2D->getNodeIdsOfCell(locId,tmp);
tmp2=tmp;
MCAuto<MEDCouplingFieldDouble> ret2D(_mesh2D->getMeasureField(true)),ret1D(_mesh1D->getMeasureField(true));
const double *ret2DPtr(ret2D->getArray()->begin());
const double *ret1DPtr(ret1D->getArray()->begin());
- int nbOf2DCells(_mesh2D->getNumberOfCells()),nbOf1DCells(_mesh1D->getNumberOfCells()),nbOf3DCells(nbOf2DCells*nbOf1DCells);
+ mcIdType nbOf2DCells=ToIdType(_mesh2D->getNumberOfCells()),
+ nbOf1DCells=ToIdType(_mesh1D->getNumberOfCells()),nbOf3DCells(nbOf2DCells*nbOf1DCells);
const int *renum(_mesh3D_ids->begin());
MCAuto<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME));
ret->setMesh(this);
const int *revDesc3D, const int *revDescIndx3D,
bool computeMesh1D)
{
- int nbOf2DCells(_mesh2D->getNumberOfCells());
+ mcIdType nbOf2DCells=ToIdType(_mesh2D->getNumberOfCells());
int start(revDescIndx3D[idIn3DDesc]);
int end(revDescIndx3D[idIn3DDesc+1]);
if(end-start!=1)
void MEDCouplingMappedExtrudedMesh::computeExtrusionAlg(const MEDCouplingUMesh *mesh3D)
{
_mesh3D_ids->alloc(mesh3D->getNumberOfCells(),1);
- int nbOf1DLev(mesh3D->getNumberOfCells()/_mesh2D->getNumberOfCells());
+ mcIdType nbOf1DLev=ToIdType(mesh3D->getNumberOfCells()/_mesh2D->getNumberOfCells());
_mesh1D->setMeshDimension(1);
_mesh1D->allocateCells(nbOf1DLev);
int tmpConn[2];
const int *revNodalIndx2DPtr(revNodalIndx2D->begin());
const int *descP(desc->begin()),*descIndxP(descIndx->begin()),*revDescP(revDesc->begin()),*revDescIndxP(revDescIndx->begin());
//
- int nbOf2DCells(_mesh2D->getNumberOfCells());
+ mcIdType nbOf2DCells=ToIdType(_mesh2D->getNumberOfCells());
for(int i=0;i<nbOf2DCells;i++)
{
int idInSubMesh;
littleStrings.insert(littleStrings.end(),ls2.begin(),ls2.end());
tinyInfo.push_back(_cell_2D_id);
tinyInfo.push_back((int)tinyInfo1.size());
- tinyInfo.push_back(_mesh3D_ids->getNbOfElems());
+ tinyInfo.push_back(ToIdType(_mesh3D_ids->getNbOfElems()));
littleStrings.push_back(getName());
littleStrings.push_back(getDescription());
}
int la1=0,la2=0;
std::vector<std::string> ls1,ls2;
um->resizeForUnserialization(ti1,a1tmp,a2tmp,ls1);
- la1+=a1tmp->getNbOfElems(); la2+=a2tmp->getNbOfElems();
+ la1+=ToIdType(a1tmp->getNbOfElems()); la2+=ToIdType(a2tmp->getNbOfElems());
a1tmp->decrRef(); a2tmp->decrRef();
a1tmp=DataArrayInt::New(); a2tmp=DataArrayDouble::New();
um->resizeForUnserialization(ti2,a1tmp,a2tmp,ls2);
- la1+=a1tmp->getNbOfElems(); la2+=a2tmp->getNbOfElems();
+ la1+=ToIdType(a1tmp->getNbOfElems()); la2+=ToIdType(a2tmp->getNbOfElems());
a1tmp->decrRef(); a2tmp->decrRef();
um->decrRef();
//
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<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(mat->getNumberOfRows(),1);
- INTERP_KERNEL::matrixProduct(mat->getData()->begin(),mat->getNumberOfRows(),mat->getNumberOfCols(),vec->begin(),vec->getNumberOfTuples(),1,ret->getPointer());
+ INTERP_KERNEL::matrixProduct(mat->getData()->begin(),mat->getNumberOfRows(),mat->getNumberOfCols(),vec->begin(),ToIdType(vec->getNumberOfTuples()),1,ret->getPointer());
return ret.retn();
}
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<DenseMatrix> a2Bis(DenseMatrix::New(const_cast<DataArrayDouble *>(a2),a2->getNumberOfTuples(),1));
+ MCAuto<DenseMatrix> a2Bis(DenseMatrix::New(const_cast<DataArrayDouble *>(a2),ToIdType(a2->getNumberOfTuples()),1));
return DenseMatrix::Multiply(a1,a2Bis);
}
void DataArray::copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds)
{
- int nbOfCompoOth=other.getNumberOfComponents();
- std::size_t newNbOfCompo=compoIds.size();
- for(std::size_t i=0;i<newNbOfCompo;i++)
+ mcIdType nbOfCompoOth=ToIdType(other.getNumberOfComponents());
+ mcIdType newNbOfCompo=ToIdType(compoIds.size());
+ for(mcIdType i=0;i<newNbOfCompo;i++)
if(compoIds[i]>=nbOfCompoOth || compoIds[i]<0)
{
std::ostringstream oss; oss << "Specified component id is out of range (" << compoIds[i] << ") compared with nb of actual components (" << nbOfCompoOth << ")";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- for(std::size_t i=0;i<newNbOfCompo;i++)
- setInfoOnComponent((int)i,other.getInfoOnComponent(compoIds[i]));
+ for(mcIdType i=0;i<newNbOfCompo;i++)
+ setInfoOnComponent(i,other.getInfoOnComponent(compoIds[i]));
}
void DataArray::copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other)
{
- std::size_t nbOfCompo(getNumberOfComponents());
- std::size_t partOfCompoToSet=compoIds.size();
- if(partOfCompoToSet!=other.getNumberOfComponents())
+ if(compoIds.size()!=other.getNumberOfComponents())
throw INTERP_KERNEL::Exception("Given compoIds has not the same size as number of components of given array !");
- for(std::size_t i=0;i<partOfCompoToSet;i++)
- if(compoIds[i]>=(int)nbOfCompo || compoIds[i]<0)
+ mcIdType partOfCompoToSet=ToIdType(compoIds.size());
+ mcIdType nbOfCompo=ToIdType(getNumberOfComponents());
+ for(mcIdType i=0;i<partOfCompoToSet;i++)
+ if(compoIds[i]>=nbOfCompo || compoIds[i]<0)
{
std::ostringstream oss; oss << "Specified component id is out of range (" << compoIds[i] << ") compared with nb of actual components (" << nbOfCompo << ")";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- for(std::size_t i=0;i<partOfCompoToSet;i++)
- setInfoOnComponent(compoIds[i],other.getInfoOnComponent((int)i));
+ for(mcIdType i=0;i<partOfCompoToSet;i++)
+ setInfoOnComponent(compoIds[i],other.getInfoOnComponent(i));
}
bool DataArray::areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayDouble::isMonotonic : only supported with 'this' array with ONE component !");
- int nbOfElements=getNumberOfTuples();
+ mcIdType nbOfElements=ToIdType(getNumberOfTuples());
const double *ptr=getConstPointer();
if(nbOfElements==0)
return true;
double absEps=fabs(eps);
if(increasing)
{
- for(int i=1;i<nbOfElements;i++)
+ for(mcIdType i=1;i<nbOfElements;i++)
{
if(ptr[i]<(ref+absEps))
return false;
}
else
{
- for(int i=1;i<nbOfElements;i++)
+ for(mcIdType i=1;i<nbOfElements;i++)
{
if(ptr[i]>(ref-absEps))
return false;
void DataArrayDouble::reprCppStream(const std::string& varName, std::ostream& stream) const
{
- int nbTuples(getNumberOfTuples()),nbComp(getNumberOfComponents());
+ mcIdType nbTuples=ToIdType(getNumberOfTuples());
+ mcIdType nbComp=ToIdType(getNumberOfComponents());
const double *data(getConstPointer());
stream.precision(17);
stream << "DataArrayDouble *" << varName << "=DataArrayDouble::New();" << std::endl;
void DataArrayDouble::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const
{
const double *data=begin();
- int nbOfTuples=getNumberOfTuples();
- int nbOfCompo=(int)_info_on_compo.size();
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
+ mcIdType nbOfCompo=ToIdType(_info_on_compo.size());
std::ostringstream oss2; oss2 << "[";
oss2.precision(17);
std::string oss2Str(oss2.str());
bool isFinished=true;
- for(int i=0;i<nbOfTuples && isFinished;i++)
+ for(mcIdType i=0;i<nbOfTuples && isFinished;i++)
{
if(nbOfCompo>1)
{
oss2 << "(";
- for(int j=0;j<nbOfCompo;j++,data++)
+ for(mcIdType j=0;j<nbOfCompo;j++,data++)
{
oss2 << *data;
if(j!=nbOfCompo-1) oss2 << ", ";
throw INTERP_KERNEL::Exception("DataArrayDouble::areIncludedInMe : the number of components does not match !");
MCAuto<DataArrayDouble> a=DataArrayDouble::Aggregate(this,other);
DataArrayInt *c=0,*ci=0;
- a->findCommonTuples(prec,getNumberOfTuples(),c,ci);
+ a->findCommonTuples(prec,ToIdType(getNumberOfTuples()),c,ci);
MCAuto<DataArrayInt> cSafe(c),ciSafe(ci);
int newNbOfTuples=-1;
- MCAuto<DataArrayInt> ids=DataArrayInt::ConvertIndexArrayToO2N(a->getNumberOfTuples(),c->begin(),ci->begin(),ci->end(),newNbOfTuples);
- MCAuto<DataArrayInt> ret1=ids->selectByTupleIdSafeSlice(getNumberOfTuples(),a->getNumberOfTuples(),1);
+ MCAuto<DataArrayInt> ids=DataArrayInt::ConvertIndexArrayToO2N(ToIdType(a->getNumberOfTuples()),c->begin(),ci->begin(),ci->end(),newNbOfTuples);
+ MCAuto<DataArrayInt> ret1=ids->selectByTupleIdSafeSlice(ToIdType(getNumberOfTuples()),ToIdType(a->getNumberOfTuples()),1);
tupleIds=ret1.retn();
return newNbOfTuples==getNumberOfTuples();
}
void DataArrayDouble::findCommonTuples(double prec, int limitTupleId, DataArrayInt *&comm, DataArrayInt *&commIndex) const
{
checkAllocated();
- int nbOfCompo=getNumberOfComponents();
+ mcIdType nbOfCompo=ToIdType(getNumberOfComponents());
if ((nbOfCompo<1) || (nbOfCompo>4)) //test before work
throw INTERP_KERNEL::Exception("DataArrayDouble::findCommonTuples : Unexpected spacedim of coords. Must be 1, 2, 3 or 4.");
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
//
MCAuto<DataArrayInt> c(DataArrayInt::New()),cI(DataArrayInt::New()); c->alloc(0,1); cI->pushBackSilent(0);
switch(nbOfCompo)
double DataArrayDouble::minimalDistanceTo(const DataArrayDouble *other, int& thisTupleId, int& otherTupleId) const
{
MCAuto<DataArrayInt> part1=findClosestTupleId(other);
- int nbOfCompo(getNumberOfComponents());
- int otherNbTuples(other->getNumberOfTuples());
+ mcIdType nbOfCompo=ToIdType(getNumberOfComponents());
+ mcIdType otherNbTuples=ToIdType(other->getNumberOfTuples());
const double *thisPt(begin()),*otherPt(other->begin());
const int *part1Pt(part1->begin());
double ret=std::numeric_limits<double>::max();
- for(int i=0;i<otherNbTuples;i++,part1Pt++,otherPt+=nbOfCompo)
+ for(mcIdType i=0;i<otherNbTuples;i++,part1Pt++,otherPt+=nbOfCompo)
{
double tmp(0.);
- for(int j=0;j<nbOfCompo;j++)
+ for(mcIdType j=0;j<nbOfCompo;j++)
tmp+=(otherPt[j]-thisPt[nbOfCompo*(*part1Pt)+j])*(otherPt[j]-thisPt[nbOfCompo*(*part1Pt)+j]);
if(tmp<ret)
{ ret=tmp; thisTupleId=*part1Pt; otherTupleId=i; }
oss << ", whereas number of components in other is " << other->getNumberOfComponents() << "! Should be equal !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- int nbOfTuples=other->getNumberOfTuples();
- int thisNbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType(other->getNumberOfTuples());
+ mcIdType thisNbOfTuples=ToIdType(getNumberOfTuples());
MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(nbOfTuples,1);
double bounds[6];
getMinMaxPerComponent(bounds);
double xDelta(fabs(bounds[1]-bounds[0])),yDelta(fabs(bounds[3]-bounds[2])),zDelta(fabs(bounds[5]-bounds[4]));
double delta=std::max(xDelta,yDelta); delta=std::max(delta,zDelta);
double characSize=pow((delta*delta*delta)/((double)thisNbOfTuples),1./3.);
- BBTreePts<3,int> myTree(begin(),0,0,getNumberOfTuples(),characSize*1e-12);
+ BBTreePts<3,int> myTree(begin(),0,0,ToIdType(getNumberOfTuples()),characSize*1e-12);
FindClosestTupleIdAlg<3>(myTree,3.*characSize*characSize,other->begin(),nbOfTuples,begin(),thisNbOfTuples,ret->getPointer());
break;
}
double xDelta(fabs(bounds[1]-bounds[0])),yDelta(fabs(bounds[3]-bounds[2]));
double delta=std::max(xDelta,yDelta);
double characSize=sqrt(delta/(double)thisNbOfTuples);
- BBTreePts<2,int> myTree(begin(),0,0,getNumberOfTuples(),characSize*1e-12);
+ BBTreePts<2,int> myTree(begin(),0,0,ToIdType(getNumberOfTuples()),characSize*1e-12);
FindClosestTupleIdAlg<2>(myTree,2.*characSize*characSize,other->begin(),nbOfTuples,begin(),thisNbOfTuples,ret->getPointer());
break;
}
case 1:
{
double characSize=fabs(bounds[1]-bounds[0])/thisNbOfTuples;
- BBTreePts<1,int> myTree(begin(),0,0,getNumberOfTuples(),characSize*1e-12);
+ BBTreePts<1,int> myTree(begin(),0,0,ToIdType(getNumberOfTuples()),characSize*1e-12);
FindClosestTupleIdAlg<1>(myTree,1.*characSize*characSize,other->begin(),nbOfTuples,begin(),thisNbOfTuples,ret->getPointer());
break;
}
{
case 3:
{
- BBTree<3,int> bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps);
+ BBTree<3,int> bbt(otherBBoxFrmt->begin(),0,0,ToIdType(otherBBoxFrmt->getNumberOfTuples()),eps);
for(std::size_t i=0;i<nbOfTuples;i++,retPtr++,thisBBPtr+=nbOfComp)
*retPtr=bbt.getNbOfIntersectingElems(thisBBPtr);
break;
}
case 2:
{
- BBTree<2,int> bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps);
+ BBTree<2,int> bbt(otherBBoxFrmt->begin(),0,0,ToIdType(otherBBoxFrmt->getNumberOfTuples()),eps);
for(std::size_t i=0;i<nbOfTuples;i++,retPtr++,thisBBPtr+=nbOfComp)
*retPtr=bbt.getNbOfIntersectingElems(thisBBPtr);
break;
}
case 1:
{
- BBTree<1,int> bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps);
+ BBTree<1,int> bbt(otherBBoxFrmt->begin(),0,0,ToIdType(otherBBoxFrmt->getNumberOfTuples()),eps);
for(std::size_t i=0;i<nbOfTuples;i++,retPtr++,thisBBPtr+=nbOfComp)
*retPtr=bbt.getNbOfIntersectingElems(thisBBPtr);
break;
findCommonTuples(prec,limitTupleId,c0,cI0);
MCAuto<DataArrayInt> c(c0),cI(cI0);
int newNbOfTuples=-1;
- MCAuto<DataArrayInt> o2n=DataArrayInt::ConvertIndexArrayToO2N(getNumberOfTuples(),c0->begin(),cI0->begin(),cI0->end(),newNbOfTuples);
+ MCAuto<DataArrayInt> o2n=DataArrayInt::ConvertIndexArrayToO2N(ToIdType(getNumberOfTuples()),c0->begin(),cI0->begin(),cI0->end(),newNbOfTuples);
return renumberAndReduce(o2n->getConstPointer(),newNbOfTuples);
}
checkAllocated();
copyPartOfStringInfoFrom2(compoIds,*a);
std::size_t partOfCompoSz=compoIds.size();
- int nbOfCompo=getNumberOfComponents();
- int nbOfTuples=std::min(getNumberOfTuples(),a->getNumberOfTuples());
+ mcIdType nbOfCompo=ToIdType(getNumberOfComponents());
+ mcIdType nbOfTuples=ToIdType(std::min(getNumberOfTuples(),a->getNumberOfTuples()));
const double *ac=a->getConstPointer();
double *nc=getPointer();
- for(int i=0;i<nbOfTuples;i++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
for(std::size_t j=0;j<partOfCompoSz;j++,ac++)
nc[nbOfCompo*i+compoIds[j]]=*ac;
}
void DataArrayDouble::checkNoNullValues() const
{
const double *tmp=getConstPointer();
- std::size_t nbOfElems=getNbOfElems();
+ mcIdType nbOfElems=ToIdType(getNbOfElems());
const double *where=std::find(tmp,tmp+nbOfElems,0.);
if(where!=tmp+nbOfElems)
throw INTERP_KERNEL::Exception("A value 0.0 have been detected !");
void DataArrayDouble::getMinMaxPerComponent(double *bounds) const
{
checkAllocated();
- int dim=getNumberOfComponents();
- for (int idim=0; idim<dim; idim++)
+ mcIdType dim=ToIdType(getNumberOfComponents());
+ for (mcIdType idim=0; idim<dim; idim++)
{
bounds[idim*2]=std::numeric_limits<double>::max();
bounds[idim*2+1]=-std::numeric_limits<double>::max();
}
const double *ptr=getConstPointer();
- int nbOfTuples=getNumberOfTuples();
- for(int i=0;i<nbOfTuples;i++)
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
+ for(mcIdType i=0;i<nbOfTuples;i++)
{
- for(int idim=0;idim<dim;idim++)
+ for(mcIdType idim=0;idim<dim;idim++)
{
if(bounds[idim*2]>ptr[i*dim+idim])
{
{
checkAllocated();
const double *dataPtr=getConstPointer();
- int nbOfCompo=getNumberOfComponents();
- int nbTuples=getNumberOfTuples();
+ mcIdType nbOfCompo=ToIdType(getNumberOfComponents());
+ mcIdType nbTuples=ToIdType(getNumberOfTuples());
MCAuto<DataArrayDouble> bbox=DataArrayDouble::New();
bbox->alloc(nbTuples,2*nbOfCompo);
double *bboxPtr=bbox->getPointer();
- for(int i=0;i<nbTuples;i++)
+ for(mcIdType i=0;i<nbTuples;i++)
{
- for(int j=0;j<nbOfCompo;j++)
+ for(mcIdType j=0;j<nbOfCompo;j++)
{
bboxPtr[2*nbOfCompo*i+2*j]=dataPtr[nbOfCompo*i+j]-epsilon;
bboxPtr[2*nbOfCompo*i+2*j+1]=dataPtr[nbOfCompo*i+j]+epsilon;
throw INTERP_KERNEL::Exception("DataArrayDouble::computeTupleIdsNearTuples : input pointer other is null !");
checkAllocated();
other->checkAllocated();
- int nbOfCompo=getNumberOfComponents();
- int otherNbOfCompo=other->getNumberOfComponents();
+ mcIdType nbOfCompo=ToIdType(getNumberOfComponents());
+ mcIdType otherNbOfCompo=ToIdType(other->getNumberOfComponents());
if(nbOfCompo!=otherNbOfCompo)
throw INTERP_KERNEL::Exception("DataArrayDouble::computeTupleIdsNearTuples : number of components should be equal between this and other !");
- int nbOfTuplesOther=other->getNumberOfTuples();
+ mcIdType nbOfTuplesOther=ToIdType(other->getNumberOfTuples());
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
MCAuto<DataArrayInt> cArr(DataArrayInt::New()),cIArr(DataArrayInt::New()); cArr->alloc(0,1); cIArr->pushBackSilent(0);
switch(nbOfCompo)
{
case 3:
{
- BBTreePts<3,int> myTree(begin(),0,0,getNumberOfTuples(),eps);
+ BBTreePts<3,int> myTree(begin(),0,0,nbOfTuples,eps);
FindTupleIdsNearTuplesAlg<3>(myTree,other->getConstPointer(),nbOfTuplesOther,eps,cArr,cIArr);
break;
}
case 2:
{
- BBTreePts<2,int> myTree(begin(),0,0,getNumberOfTuples(),eps);
+ BBTreePts<2,int> myTree(begin(),0,0,nbOfTuples,eps);
FindTupleIdsNearTuplesAlg<2>(myTree,other->getConstPointer(),nbOfTuplesOther,eps,cArr,cIArr);
break;
}
case 1:
{
- BBTreePts<1,int> myTree(begin(),0,0,getNumberOfTuples(),eps);
+ BBTreePts<1,int> myTree(begin(),0,0,nbOfTuples,eps);
FindTupleIdsNearTuplesAlg<1>(myTree,other->getConstPointer(),nbOfTuplesOther,eps,cArr,cIArr);
break;
}
void DataArrayDouble::recenterForMaxPrecision(double eps)
{
checkAllocated();
- int dim=getNumberOfComponents();
+ mcIdType dim=ToIdType(getNumberOfComponents());
std::vector<double> bounds(2*dim);
getMinMaxPerComponent(&bounds[0]);
- for(int i=0;i<dim;i++)
+ for(mcIdType i=0;i<dim;i++)
{
double delta=bounds[2*i+1]-bounds[2*i];
double offset=(bounds[2*i]+bounds[2*i+1])/2.;
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayDouble::count : must be applied on DataArrayDouble with only one component, you can call 'rearrange' method before !");
const double *vals=begin();
- int nbOfTuples=getNumberOfTuples();
- for(int i=0;i<nbOfTuples;i++,vals++)
+ std::size_t nbOfTuples=getNumberOfTuples();
+ for(std::size_t i=0;i<nbOfTuples;i++,vals++)
if(fabs(*vals-value)<=eps)
ret++;
return ret;
{
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayDouble::getAverageValue : must be applied on DataArrayDouble with only one component, you can call 'rearrange' method before !");
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
if(nbOfTuples<=0)
throw INTERP_KERNEL::Exception("DataArrayDouble::getAverageValue : array exists but number of tuples must be > 0 !");
const double *vals=getConstPointer();
{
checkAllocated();
std::size_t nbOfTuples(getNumberOfTuples());
- int nbOfCompos(getNumberOfComponents());
+ mcIdType nbOfCompos=ToIdType(getNumberOfComponents());
std::fill(res, res+nbOfCompos, -1.0);
const double *pt(getConstPointer());
for(std::size_t i=0;i<nbOfTuples;i++)
- for (int j=0; j<nbOfCompos; j++, pt++)
+ for (mcIdType j=0; j<nbOfCompos; j++, pt++)
{
double val(std::abs(*pt));
if(val>res[j])
{
checkAllocated();
const double *ptr=getConstPointer();
- int nbTuple=getNumberOfTuples();
- int nbComps=getNumberOfComponents();
+ mcIdType nbTuple=ToIdType(getNumberOfTuples());
+ mcIdType nbComps=ToIdType(getNumberOfComponents());
std::fill(res,res+nbComps,0.);
- for(int i=0;i<nbTuple;i++)
+ for(mcIdType i=0;i<nbTuple;i++)
std::transform(ptr+i*nbComps,ptr+(i+1)*nbComps,res,res,std::plus<double>());
}
double DataArrayDouble::distanceToTuple(const double *tupleBg, const double *tupleEnd, int& tupleId) const
{
checkAllocated();
- int nbTuple=getNumberOfTuples();
- int nbComps=getNumberOfComponents();
+ mcIdType nbTuple=ToIdType(getNumberOfTuples());
+ mcIdType nbComps=ToIdType(getNumberOfComponents());
if(nbComps!=(int)std::distance(tupleBg,tupleEnd))
{ std::ostringstream oss; oss << "DataArrayDouble::distanceToTuple : size of input tuple is " << std::distance(tupleBg,tupleEnd) << " should be equal to the number of components in this : " << nbComps << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); }
if(nbTuple==0)
double ret0=std::numeric_limits<double>::max();
tupleId=-1;
const double *work=getConstPointer();
- for(int i=0;i<nbTuple;i++)
+ for(mcIdType i=0;i<nbTuple;i++)
{
double val=0.;
- for(int j=0;j<nbComps;j++,work++)
+ for(mcIdType j=0;j<nbComps;j++,work++)
val+=(*work-tupleBg[j])*((*work-tupleBg[j]));
if(val>=ret0)
continue;
{
checkAllocated();
const double *ptr=getConstPointer();
- int nbTuple=getNumberOfTuples();
- int nbComps=getNumberOfComponents();
+ mcIdType nbTuple=ToIdType(getNumberOfTuples());
+ mcIdType nbComps=ToIdType(getNumberOfComponents());
if(compId<0 || compId>=nbComps)
throw INTERP_KERNEL::Exception("DataArrayDouble::accumulate : Invalid compId specified : No such nb of components !");
double ret=0.;
- for(int i=0;i<nbTuple;i++)
+ for(mcIdType i=0;i<nbTuple;i++)
ret+=ptr[i*nbComps+compId];
return ret;
}
if(!bgOfIndex || !endOfIndex)
throw INTERP_KERNEL::Exception("DataArrayDouble::accumulatePerChunck : input pointer NULL !");
checkAllocated();
- int nbCompo=getNumberOfComponents();
- int nbOfTuples=getNumberOfTuples();
- int sz=(int)std::distance(bgOfIndex,endOfIndex);
+ mcIdType nbCompo=ToIdType(getNumberOfComponents());
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
+ mcIdType sz=ToIdType(std::distance(bgOfIndex,endOfIndex));
if(sz<1)
throw INTERP_KERNEL::Exception("DataArrayDouble::accumulatePerChunck : invalid size of input index array !");
sz--;
throw INTERP_KERNEL::Exception("DataArrayDouble::accumulatePerChunck : The first element of the input index not in [0,nbOfTuples) !");
const double *srcPt=begin()+(*w)*nbCompo;
double *tmp=ret->getPointer();
- for(int i=0;i<sz;i++,tmp+=nbCompo,w++)
+ for(mcIdType i=0;i<sz;i++,tmp+=nbCompo,w++)
{
std::fill(tmp,tmp+nbCompo,0.);
if(w[1]>=w[0])
{
- for(int j=w[0];j<w[1];j++,srcPt+=nbCompo)
+ for(mcIdType j=w[0];j<w[1];j++,srcPt+=nbCompo)
{
if(j>=0 && j<nbOfTuples)
std::transform(srcPt,srcPt+nbCompo,tmp,tmp,std::plus<double>());
{
checkAllocated();
checkNbOfComps(1,"DataArrayDouble::cumSum : this is expected to be single component");
- int nbOfTuple(getNumberOfTuples());
+ mcIdType nbOfTuple=ToIdType(getNumberOfTuples());
MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfTuple+1,1);
double *ptr(ret->getPointer());
ptr[0]=0.;
const double *thisPtr(begin());
- for(int i=0;i<nbOfTuple;i++)
+ for(mcIdType i=0;i<nbOfTuple;i++)
ptr[i+1]=ptr[i]+thisPtr[i];
return ret;
}
DataArrayDouble *DataArrayDouble::fromPolarToCart() const
{
checkAllocated();
- int nbOfComp(getNumberOfComponents());
+ std::size_t nbOfComp(getNumberOfComponents());
if(nbOfComp!=2)
throw INTERP_KERNEL::Exception("DataArrayDouble::fromPolarToCart : must be an array with exactly 2 components !");
- int nbOfTuple(getNumberOfTuples());
+ std::size_t nbOfTuple(getNumberOfTuples());
DataArrayDouble *ret(DataArrayDouble::New());
ret->alloc(nbOfTuple,2);
double *w(ret->getPointer());
const double *wIn(getConstPointer());
- for(int i=0;i<nbOfTuple;i++,w+=2,wIn+=2)
+ for(std::size_t i=0;i<nbOfTuple;i++,w+=2,wIn+=2)
{
w[0]=wIn[0]*cos(wIn[1]);
w[1]=wIn[0]*sin(wIn[1]);
DataArrayDouble *DataArrayDouble::fromCylToCart() const
{
checkAllocated();
- int nbOfComp(getNumberOfComponents());
+ std::size_t nbOfComp(getNumberOfComponents());
if(nbOfComp!=3)
throw INTERP_KERNEL::Exception("DataArrayDouble::fromCylToCart : must be an array with exactly 3 components !");
- int nbOfTuple(getNumberOfTuples());
+ std::size_t nbOfTuple(getNumberOfTuples());
DataArrayDouble *ret(DataArrayDouble::New());
ret->alloc(getNumberOfTuples(),3);
double *w(ret->getPointer());
const double *wIn(getConstPointer());
- for(int i=0;i<nbOfTuple;i++,w+=3,wIn+=3)
+ for(std::size_t i=0;i<nbOfTuple;i++,w+=3,wIn+=3)
{
w[0]=wIn[0]*cos(wIn[1]);
w[1]=wIn[0]*sin(wIn[1]);
DataArrayDouble *DataArrayDouble::fromSpherToCart() const
{
checkAllocated();
- int nbOfComp(getNumberOfComponents());
+ std::size_t nbOfComp(getNumberOfComponents());
if(nbOfComp!=3)
throw INTERP_KERNEL::Exception("DataArrayDouble::fromSpherToCart : must be an array with exactly 3 components !");
- int nbOfTuple(getNumberOfTuples());
+ std::size_t nbOfTuple(getNumberOfTuples());
DataArrayDouble *ret(DataArrayDouble::New());
ret->alloc(getNumberOfTuples(),3);
double *w(ret->getPointer());
const double *wIn(getConstPointer());
- for(int i=0;i<nbOfTuple;i++,w+=3,wIn+=3)
+ for(std::size_t i=0;i<nbOfTuple;i++,w+=3,wIn+=3)
{
w[0]=wIn[0]*cos(wIn[2])*sin(wIn[1]);
w[1]=wIn[0]*sin(wIn[2])*sin(wIn[1]);
DataArrayDouble *DataArrayDouble::cartesianize(MEDCouplingAxisType atOfThis) const
{
checkAllocated();
- int nbOfComp(getNumberOfComponents());
+ std::size_t nbOfComp(getNumberOfComponents());
MCAuto<DataArrayDouble> ret;
switch(atOfThis)
{
{
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
checkAllocated();
- int nbOfComp(getNumberOfComponents()),nbTuples(getNumberOfTuples());
+ std::size_t nbOfComp(getNumberOfComponents()),nbTuples(getNumberOfTuples());
if(nbOfComp!=2)
throw INTERP_KERNEL::Exception("DataArrayDouble::fromCartToPolar : must be an array with exactly 2 components !");
ret->alloc(nbTuples,2);
double *retPtr(ret->getPointer());
const double *ptr(begin());
- for(int i=0;i<nbTuples;i++,ptr+=2,retPtr+=2)
+ for(std::size_t i=0;i<nbTuples;i++,ptr+=2,retPtr+=2)
{
retPtr[0]=sqrt(ptr[0]*ptr[0]+ptr[1]*ptr[1]);
retPtr[1]=atan2(ptr[1],ptr[0]);
{
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
checkAllocated();
- int nbOfComp(getNumberOfComponents()),nbTuples(getNumberOfTuples());
+ std::size_t nbOfComp(getNumberOfComponents()),nbTuples(getNumberOfTuples());
if(nbOfComp!=3)
throw INTERP_KERNEL::Exception("DataArrayDouble::fromCartToCyl : must be an array with exactly 3 components !");
ret->alloc(nbTuples,3);
double *retPtr(ret->getPointer());
const double *ptr(begin());
- for(int i=0;i<nbTuples;i++,ptr+=3,retPtr+=3)
+ for(std::size_t i=0;i<nbTuples;i++,ptr+=3,retPtr+=3)
{
retPtr[0]=sqrt(ptr[0]*ptr[0]+ptr[1]*ptr[1]);
retPtr[1]=atan2(ptr[1],ptr[0]);
{
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
checkAllocated();
- int nbOfComp(getNumberOfComponents()),nbTuples(getNumberOfTuples());
+ std::size_t nbOfComp(getNumberOfComponents()),nbTuples(getNumberOfTuples());
if(nbOfComp!=3)
throw INTERP_KERNEL::Exception("DataArrayDouble::fromCartToSpher : must be an array with exactly 3 components !");
ret->alloc(nbTuples,3);
double *retPtr(ret->getPointer());
const double *ptr(begin());
- for(int i=0;i<nbTuples;i++,ptr+=3,retPtr+=3)
+ for(std::size_t i=0;i<nbTuples;i++,ptr+=3,retPtr+=3)
{
retPtr[0]=sqrt(ptr[0]*ptr[0]+ptr[1]*ptr[1]+ptr[2]*ptr[2]);
retPtr[1]=acos(ptr[2]/retPtr[0]);
double Ur[3],Uteta[3],Uz[3],*retPtr(ret->getPointer());
const double *coo(coords->begin()),*vectField(begin());
std::transform(vect,vect+3,Uz,std::bind2nd(std::multiplies<double>(),1./magOfVect));
- for(int i=0;i<nbTuples;i++,vectField+=3,retPtr+=3,coo+=3)
+ for(std::size_t i=0;i<nbTuples;i++,vectField+=3,retPtr+=3,coo+=3)
{
std::transform(coo,coo+3,center,Ur,std::minus<double>());
Uteta[0]=Uz[1]*Ur[2]-Uz[2]*Ur[1]; Uteta[1]=Uz[2]*Ur[0]-Uz[0]*Ur[2]; Uteta[2]=Uz[0]*Ur[1]-Uz[1]*Ur[0];
DataArrayDouble *DataArrayDouble::doublyContractedProduct() const
{
checkAllocated();
- int nbOfComp(getNumberOfComponents());
+ std::size_t nbOfComp(getNumberOfComponents());
if(nbOfComp!=6)
throw INTERP_KERNEL::Exception("DataArrayDouble::doublyContractedProduct : must be an array with exactly 6 components !");
DataArrayDouble *ret=DataArrayDouble::New();
- int nbOfTuple=getNumberOfTuples();
+ std::size_t nbOfTuple=getNumberOfTuples();
ret->alloc(nbOfTuple,1);
const double *src=getConstPointer();
double *dest=ret->getPointer();
- for(int i=0;i<nbOfTuple;i++,dest++,src+=6)
+ for(std::size_t i=0;i<nbOfTuple;i++,dest++,src+=6)
*dest=src[0]*src[0]+src[1]*src[1]+src[2]*src[2]+2.*src[3]*src[3]+2.*src[4]*src[4]+2.*src[5]*src[5];
return ret;
}
{
checkAllocated();
DataArrayDouble *ret=DataArrayDouble::New();
- int nbOfTuple=getNumberOfTuples();
+ std::size_t nbOfTuple=getNumberOfTuples();
ret->alloc(nbOfTuple,1);
const double *src=getConstPointer();
double *dest=ret->getPointer();
switch(getNumberOfComponents())
{
case 6:
- for(int i=0;i<nbOfTuple;i++,dest++,src+=6)
+ for(std::size_t i=0;i<nbOfTuple;i++,dest++,src+=6)
*dest=src[0]*src[1]*src[2]+2.*src[4]*src[5]*src[3]-src[0]*src[4]*src[4]-src[2]*src[3]*src[3]-src[1]*src[5]*src[5];
return ret;
case 4:
- for(int i=0;i<nbOfTuple;i++,dest++,src+=4)
+ for(std::size_t i=0;i<nbOfTuple;i++,dest++,src+=4)
*dest=src[0]*src[3]-src[1]*src[2];
return ret;
case 9:
- for(int i=0;i<nbOfTuple;i++,dest++,src+=9)
+ for(std::size_t i=0;i<nbOfTuple;i++,dest++,src+=9)
*dest=src[0]*src[4]*src[8]+src[1]*src[5]*src[6]+src[2]*src[3]*src[7]-src[0]*src[5]*src[7]-src[1]*src[3]*src[8]-src[2]*src[4]*src[6];
return ret;
default:
DataArrayDouble *DataArrayDouble::eigenValues() const
{
checkAllocated();
- int nbOfComp=getNumberOfComponents();
+ std::size_t nbOfComp=getNumberOfComponents();
if(nbOfComp!=6)
throw INTERP_KERNEL::Exception("DataArrayDouble::eigenValues : must be an array with exactly 6 components !");
DataArrayDouble *ret=DataArrayDouble::New();
- int nbOfTuple=getNumberOfTuples();
+ std::size_t nbOfTuple=getNumberOfTuples();
ret->alloc(nbOfTuple,3);
const double *src=getConstPointer();
double *dest=ret->getPointer();
- for(int i=0;i<nbOfTuple;i++,dest+=3,src+=6)
+ for(std::size_t i=0;i<nbOfTuple;i++,dest+=3,src+=6)
INTERP_KERNEL::computeEigenValues6(src,dest);
return ret;
}
DataArrayDouble *DataArrayDouble::eigenVectors() const
{
checkAllocated();
- int nbOfComp=getNumberOfComponents();
+ std::size_t nbOfComp=getNumberOfComponents();
if(nbOfComp!=6)
throw INTERP_KERNEL::Exception("DataArrayDouble::eigenVectors : must be an array with exactly 6 components !");
DataArrayDouble *ret=DataArrayDouble::New();
- int nbOfTuple=getNumberOfTuples();
+ std::size_t nbOfTuple=getNumberOfTuples();
ret->alloc(nbOfTuple,9);
const double *src=getConstPointer();
double *dest=ret->getPointer();
- for(int i=0;i<nbOfTuple;i++,src+=6)
+ for(std::size_t i=0;i<nbOfTuple;i++,src+=6)
{
double tmp[3];
INTERP_KERNEL::computeEigenValues6(src,tmp);
DataArrayDouble *DataArrayDouble::inverse() const
{
checkAllocated();
- int nbOfComp=getNumberOfComponents();
+ std::size_t nbOfComp=getNumberOfComponents();
if(nbOfComp!=6 && nbOfComp!=9 && nbOfComp!=4)
throw INTERP_KERNEL::Exception("DataArrayDouble::inversion : must be an array with 4,6 or 9 components !");
DataArrayDouble *ret=DataArrayDouble::New();
- int nbOfTuple=getNumberOfTuples();
+ std::size_t nbOfTuple=getNumberOfTuples();
ret->alloc(nbOfTuple,nbOfComp);
const double *src=getConstPointer();
double *dest=ret->getPointer();
if(nbOfComp==6)
- for(int i=0;i<nbOfTuple;i++,dest+=6,src+=6)
+ for(std::size_t i=0;i<nbOfTuple;i++,dest+=6,src+=6)
{
double det=src[0]*src[1]*src[2]+2.*src[4]*src[5]*src[3]-src[0]*src[4]*src[4]-src[2]*src[3]*src[3]-src[1]*src[5]*src[5];
dest[0]=(src[1]*src[2]-src[4]*src[4])/det;
dest[5]=(src[3]*src[4]-src[1]*src[5])/det;
}
else if(nbOfComp==4)
- for(int i=0;i<nbOfTuple;i++,dest+=4,src+=4)
+ for(std::size_t i=0;i<nbOfTuple;i++,dest+=4,src+=4)
{
double det=src[0]*src[3]-src[1]*src[2];
dest[0]=src[3]/det;
dest[3]=src[0]/det;
}
else
- for(int i=0;i<nbOfTuple;i++,dest+=9,src+=9)
+ for(std::size_t i=0;i<nbOfTuple;i++,dest+=9,src+=9)
{
double det=src[0]*src[4]*src[8]+src[1]*src[5]*src[6]+src[2]*src[3]*src[7]-src[0]*src[5]*src[7]-src[1]*src[3]*src[8]-src[2]*src[4]*src[6];
dest[0]=(src[4]*src[8]-src[7]*src[5])/det;
DataArrayDouble *DataArrayDouble::trace() const
{
checkAllocated();
- int nbOfComp=getNumberOfComponents();
+ std::size_t nbOfComp=getNumberOfComponents();
if(nbOfComp!=6 && nbOfComp!=9 && nbOfComp!=4)
throw INTERP_KERNEL::Exception("DataArrayDouble::trace : must be an array with 4,6 or 9 components !");
DataArrayDouble *ret=DataArrayDouble::New();
- int nbOfTuple=getNumberOfTuples();
+ std::size_t nbOfTuple=getNumberOfTuples();
ret->alloc(nbOfTuple,1);
const double *src=getConstPointer();
double *dest=ret->getPointer();
if(nbOfComp==6)
- for(int i=0;i<nbOfTuple;i++,dest++,src+=6)
+ for(std::size_t i=0;i<nbOfTuple;i++,dest++,src+=6)
*dest=src[0]+src[1]+src[2];
else if(nbOfComp==4)
- for(int i=0;i<nbOfTuple;i++,dest++,src+=4)
+ for(std::size_t i=0;i<nbOfTuple;i++,dest++,src+=4)
*dest=src[0]+src[3];
else
- for(int i=0;i<nbOfTuple;i++,dest++,src+=9)
+ for(std::size_t i=0;i<nbOfTuple;i++,dest++,src+=9)
*dest=src[0]+src[4]+src[8];
return ret;
}
DataArrayDouble *DataArrayDouble::deviator() const
{
checkAllocated();
- int nbOfComp=getNumberOfComponents();
+ std::size_t nbOfComp=getNumberOfComponents();
if(nbOfComp!=6)
throw INTERP_KERNEL::Exception("DataArrayDouble::deviator : must be an array with exactly 6 components !");
DataArrayDouble *ret=DataArrayDouble::New();
- int nbOfTuple=getNumberOfTuples();
+ std::size_t nbOfTuple=getNumberOfTuples();
ret->alloc(nbOfTuple,6);
const double *src=getConstPointer();
double *dest=ret->getPointer();
- for(int i=0;i<nbOfTuple;i++,dest+=6,src+=6)
+ for(std::size_t i=0;i<nbOfTuple;i++,dest+=6,src+=6)
{
double tr=(src[0]+src[1]+src[2])/3.;
dest[0]=src[0]-tr;
DataArrayDouble *DataArrayDouble::magnitude() const
{
checkAllocated();
- int nbOfComp=getNumberOfComponents();
+ std::size_t nbOfComp=getNumberOfComponents();
DataArrayDouble *ret=DataArrayDouble::New();
- int nbOfTuple=getNumberOfTuples();
+ std::size_t nbOfTuple=getNumberOfTuples();
ret->alloc(nbOfTuple,1);
const double *src=getConstPointer();
double *dest=ret->getPointer();
- for(int i=0;i<nbOfTuple;i++,dest++)
+ for(std::size_t i=0;i<nbOfTuple;i++,dest++)
{
double sum=0.;
- for(int j=0;j<nbOfComp;j++,src++)
+ for(std::size_t j=0;j<nbOfComp;j++,src++)
sum+=(*src)*(*src);
*dest=sqrt(sum);
}
DataArrayDouble *DataArrayDouble::maxPerTuple() const
{
checkAllocated();
- int nbOfComp=getNumberOfComponents();
+ mcIdType nbOfComp=ToIdType(getNumberOfComponents());
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
- int nbOfTuple=getNumberOfTuples();
+ mcIdType nbOfTuple=ToIdType(getNumberOfTuples());
ret->alloc(nbOfTuple,1);
const double *src=getConstPointer();
double *dest=ret->getPointer();
- for(int i=0;i<nbOfTuple;i++,dest++,src+=nbOfComp)
+ for(mcIdType i=0;i<nbOfTuple;i++,dest++,src+=nbOfComp)
*dest=*std::max_element(src,src+nbOfComp);
return ret.retn();
}
DataArrayDouble *DataArrayDouble::maxPerTupleWithCompoId(DataArrayInt* &compoIdOfMaxPerTuple) const
{
checkAllocated();
- int nbOfComp=getNumberOfComponents();
+ mcIdType nbOfComp=ToIdType(getNumberOfComponents());
MCAuto<DataArrayDouble> ret0=DataArrayDouble::New();
MCAuto<DataArrayInt> ret1=DataArrayInt::New();
- int nbOfTuple=getNumberOfTuples();
+ mcIdType nbOfTuple=ToIdType(getNumberOfTuples());
ret0->alloc(nbOfTuple,1); ret1->alloc(nbOfTuple,1);
const double *src=getConstPointer();
double *dest=ret0->getPointer(); int *dest1=ret1->getPointer();
- for(int i=0;i<nbOfTuple;i++,dest++,dest1++,src+=nbOfComp)
+ for(mcIdType i=0;i<nbOfTuple;i++,dest++,dest1++,src+=nbOfComp)
{
const double *loc=std::max_element(src,src+nbOfComp);
*dest=*loc;
DataArrayDouble *DataArrayDouble::buildEuclidianDistanceDenseMatrix() const
{
checkAllocated();
- int nbOfComp=getNumberOfComponents();
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfComp=ToIdType(getNumberOfComponents());
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
const double *inData=getConstPointer();
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(nbOfTuples*nbOfTuples,1);
double *outData=ret->getPointer();
- for(int i=0;i<nbOfTuples;i++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
{
outData[i*nbOfTuples+i]=0.;
- for(int j=i+1;j<nbOfTuples;j++)
+ for(mcIdType j=i+1;j<nbOfTuples;j++)
{
double dist=0.;
- for(int k=0;k<nbOfComp;k++)
+ for(mcIdType k=0;k<nbOfComp;k++)
{ double delta=inData[i*nbOfComp+k]-inData[j*nbOfComp+k]; dist+=delta*delta; }
dist=sqrt(dist);
outData[i*nbOfTuples+j]=dist;
throw INTERP_KERNEL::Exception("DataArrayDouble::buildEuclidianDistanceDenseMatrixWith : input parameter is null !");
checkAllocated();
other->checkAllocated();
- int nbOfComp=getNumberOfComponents();
- int otherNbOfComp=other->getNumberOfComponents();
+ mcIdType nbOfComp=ToIdType(getNumberOfComponents());
+ mcIdType otherNbOfComp=ToIdType(other->getNumberOfComponents());
if(nbOfComp!=otherNbOfComp)
{
std::ostringstream oss; oss << "DataArrayDouble::buildEuclidianDistanceDenseMatrixWith : this nb of compo=" << nbOfComp << " and other nb of compo=" << otherNbOfComp << ". It should match !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- int nbOfTuples=getNumberOfTuples();
- int otherNbOfTuples=other->getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
+ mcIdType otherNbOfTuples=ToIdType(other->getNumberOfTuples());
const double *inData=getConstPointer();
const double *inDataOther=other->getConstPointer();
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(otherNbOfTuples*nbOfTuples,1);
double *outData=ret->getPointer();
- for(int i=0;i<otherNbOfTuples;i++,inDataOther+=nbOfComp)
+ for(mcIdType i=0;i<otherNbOfTuples;i++,inDataOther+=nbOfComp)
{
- for(int j=0;j<nbOfTuples;j++)
+ for(mcIdType j=0;j<nbOfTuples;j++)
{
double dist=0.;
- for(int k=0;k<nbOfComp;k++)
+ for(mcIdType k=0;k<nbOfComp;k++)
{ double delta=inDataOther[k]-inData[j*nbOfComp+k]; dist+=delta*delta; }
dist=sqrt(dist);
outData[i*nbOfTuples+j]=dist;
{
checkAllocated();
double *pt=getPointer();
- int nbOfTuple=getNumberOfTuples();
- int nbOfComp=getNumberOfComponents();
+ mcIdType nbOfTuple=ToIdType(getNumberOfTuples());
+ mcIdType nbOfComp=ToIdType(getNumberOfComponents());
if(asc)
- for(int i=0;i<nbOfTuple;i++,pt+=nbOfComp)
+ for(mcIdType i=0;i<nbOfTuple;i++,pt+=nbOfComp)
std::sort(pt,pt+nbOfComp);
else
- for(int i=0;i<nbOfTuple;i++,pt+=nbOfComp)
+ for(mcIdType i=0;i<nbOfTuple;i++,pt+=nbOfComp)
std::sort(pt,pt+nbOfComp,std::greater<double>());
declareAsNew();
}
{
checkAllocated();
DataArrayDouble *newArr=DataArrayDouble::New();
- int nbOfTuples=getNumberOfTuples();
- int oldNbOfComp=getNumberOfComponents();
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
+ mcIdType oldNbOfComp=ToIdType(getNumberOfComponents());
newArr->alloc(nbOfTuples,nbOfComp);
const double *ptr=getConstPointer();
double *ptrToFill=newArr->getPointer();
- for(int i=0;i<nbOfTuples;i++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
{
if(!func(ptr+i*oldNbOfComp,ptrToFill+i*nbOfComp))
{
*/
DataArrayDouble *DataArrayDouble::applyFunc(const std::string& func, bool isSafe) const
{
- int nbOfComp(getNumberOfComponents());
+ mcIdType nbOfComp=ToIdType(getNumberOfComponents());
if(nbOfComp<=0)
throw INTERP_KERNEL::Exception("DataArrayDouble::applyFunc : output number of component must be > 0 !");
checkAllocated();
- int nbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
MCAuto<DataArrayDouble> newArr(DataArrayDouble::New());
newArr->alloc(nbOfTuples,nbOfComp);
INTERP_KERNEL::ExprParser expr(func);
expr.prepareFastEvaluator();
if(!isSafe)
{
- for(int i=0;i<nbOfTuples;i++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
{
- for(int iComp=0;iComp<nbOfComp;iComp++,ptr++,ptrToFill++)
+ for(mcIdType iComp=0;iComp<nbOfComp;iComp++,ptr++,ptrToFill++)
{
buff=*ptr;
expr.evaluateDoubleInternal(stck);
}
else
{
- for(int i=0;i<nbOfTuples;i++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
{
- for(int iComp=0;iComp<nbOfComp;iComp++,ptr++,ptrToFill++)
+ for(mcIdType iComp=0;iComp<nbOfComp;iComp++,ptr++,ptrToFill++)
{
buff=*ptr;
try
*/
void DataArrayDouble::applyFuncOnThis(const std::string& func, bool isSafe)
{
- int nbOfComp(getNumberOfComponents());
+ mcIdType nbOfComp=ToIdType(getNumberOfComponents());
if(nbOfComp<=0)
throw INTERP_KERNEL::Exception("DataArrayDouble::applyFuncOnThis : output number of component must be > 0 !");
checkAllocated();
- int nbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
INTERP_KERNEL::ExprParser expr(func);
expr.parse();
std::set<std::string> vars;
expr.prepareFastEvaluator();
if(!isSafe)
{
- for(int i=0;i<nbOfTuples;i++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
{
- for(int iComp=0;iComp<nbOfComp;iComp++,ptr++,ptrToFill++)
+ for(mcIdType iComp=0;iComp<nbOfComp;iComp++,ptr++,ptrToFill++)
{
buff=*ptr;
expr.evaluateDoubleInternal(stck);
}
else
{
- for(int i=0;i<nbOfTuples;i++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
{
- for(int iComp=0;iComp<nbOfComp;iComp++,ptr++,ptrToFill++)
+ for(mcIdType iComp=0;iComp<nbOfComp;iComp++,ptr++,ptrToFill++)
{
buff=*ptr;
try
if(nbOfComp<=0)
throw INTERP_KERNEL::Exception("DataArrayDouble::applyFuncNamedCompo : output number of component must be > 0 !");
std::vector<std::string> varsOrder2(varsOrder);
- int oldNbOfComp(getNumberOfComponents());
+ mcIdType oldNbOfComp=ToIdType(getNumberOfComponents());
for(int i=(int)varsOrder.size();i<oldNbOfComp;i++)
varsOrder2.push_back(std::string());
checkAllocated();
- int nbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
INTERP_KERNEL::ExprParser expr(func);
expr.parse();
std::set<std::string> vars;
ptrToFill=newArr->getPointer()+iComp;
if(!isSafe)
{
- for(int i=0;i<nbOfTuples;i++,ptrToFill+=nbOfComp,ptr+=oldNbOfComp)
+ for(mcIdType i=0;i<nbOfTuples;i++,ptrToFill+=nbOfComp,ptr+=oldNbOfComp)
{
std::copy(ptr,ptr+oldNbOfComp,buffPtr);
expr.evaluateDoubleInternal(stck);
}
else
{
- for(int i=0;i<nbOfTuples;i++,ptrToFill+=nbOfComp,ptr+=oldNbOfComp)
+ for(mcIdType i=0;i<nbOfTuples;i++,ptrToFill+=nbOfComp,ptr+=oldNbOfComp)
{
std::copy(ptr,ptr+oldNbOfComp,buffPtr);
try
*((void **)&funcPtr)=funcStr;//he he...
//
double *ptr=getPointer();
- int nbOfComp=getNumberOfComponents();
- int nbOfTuples=getNumberOfTuples();
- int nbOfElems=nbOfTuples*nbOfComp;
- for(int i=0;i<nbOfElems;i++,ptr++)
+ std::size_t nbOfComp=getNumberOfComponents();
+ std::size_t nbOfTuples=getNumberOfTuples();
+ std::size_t nbOfElems=nbOfTuples*nbOfComp;
+ for(std::size_t i=0;i<nbOfElems;i++,ptr++)
*ptr=funcPtr(*ptr);
declareAsNew();
}
*((void **)&funcPtr)=funcStr;//he he...
//
double *ptr=getPointer();
- int nbOfComp=getNumberOfComponents();
- int nbOfTuples=getNumberOfTuples();
- int nbOfElems=nbOfTuples*nbOfComp;
- for(int i=0;i<nbOfElems;i++,ptr++)
+ std::size_t nbOfComp=getNumberOfComponents();
+ std::size_t nbOfTuples=getNumberOfTuples();
+ std::size_t nbOfElems=nbOfTuples*nbOfComp;
+ for(std::size_t i=0;i<nbOfElems;i++,ptr++)
*ptr=funcPtr(*ptr);
declareAsNew();
}
checkAllocated();
if(getNumberOfComponents()!=3)
throw INTERP_KERNEL::Exception("DataArrayDouble::symmetry3DPlane : this is excepted to have 3 components !");
- int nbTuples(getNumberOfTuples());
+ mcIdType nbTuples=ToIdType(getNumberOfTuples());
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
ret->alloc(nbTuples,3);
Symmetry3DPlane(point,normalVector,nbTuples,begin(),ret->getPointer());
throw INTERP_KERNEL::Exception("DataArrayDouble::findIdsInRange : this must have exactly one component !");
const double *cptr(begin());
MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
- int nbOfTuples(getNumberOfTuples());
- for(int i=0;i<nbOfTuples;i++,cptr++)
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
+ for(mcIdType i=0;i<nbOfTuples;i++,cptr++)
if(*cptr>=vmin && *cptr<=vmax)
ret->pushBackSilent(i);
return ret.retn();
throw INTERP_KERNEL::Exception("DataArrayDouble::findIdsNotInRange : this must have exactly one component !");
const double *cptr(begin());
MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
- int nbOfTuples(getNumberOfTuples());
- for(int i=0;i<nbOfTuples;i++,cptr++)
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
+ for(mcIdType i=0;i<nbOfTuples;i++,cptr++)
if(*cptr<vmin || *cptr>vmax)
ret->pushBackSilent(i);
return ret.retn();
throw INTERP_KERNEL::Exception("DataArrayDouble::Aggregate : input list must contain at least one NON EMPTY DataArrayDouble !");
std::vector<const DataArrayDouble *>::const_iterator it=a.begin();
std::size_t nbOfComp((*it)->getNumberOfComponents());
- int nbt=(*it++)->getNumberOfTuples();
+ std::size_t nbt=(*it++)->getNumberOfTuples();
for(int i=1;it!=a.end();it++,i++)
{
if((*it)->getNumberOfComponents()!=nbOfComp)
{
if(!a1 || !a2)
throw INTERP_KERNEL::Exception("DataArrayDouble::Pow : at least one of input instances is null !");
- int nbOfTuple=a1->getNumberOfTuples();
- int nbOfTuple2=a2->getNumberOfTuples();
- int nbOfComp=a1->getNumberOfComponents();
- int nbOfComp2=a2->getNumberOfComponents();
+ std::size_t nbOfTuple=a1->getNumberOfTuples();
+ std::size_t nbOfTuple2=a2->getNumberOfTuples();
+ std::size_t nbOfComp=a1->getNumberOfComponents();
+ std::size_t nbOfComp2=a2->getNumberOfComponents();
if(nbOfTuple!=nbOfTuple2)
throw INTERP_KERNEL::Exception("DataArrayDouble::Pow : number of tuples mismatches !");
if(nbOfComp!=1 || nbOfComp2!=1)
MCAuto<DataArrayDouble> ret=DataArrayDouble::New(); ret->alloc(nbOfTuple,1);
const double *ptr1(a1->begin()),*ptr2(a2->begin());
double *ptr=ret->getPointer();
- for(int i=0;i<nbOfTuple;i++,ptr1++,ptr2++,ptr++)
+ for(std::size_t i=0;i<nbOfTuple;i++,ptr1++,ptr2++,ptr++)
{
if(*ptr1>=0)
{
{
if(!other)
throw INTERP_KERNEL::Exception("DataArrayDouble::powEqual : input instance is null !");
- int nbOfTuple=getNumberOfTuples();
- int nbOfTuple2=other->getNumberOfTuples();
- int nbOfComp=getNumberOfComponents();
- int nbOfComp2=other->getNumberOfComponents();
+ std::size_t nbOfTuple=getNumberOfTuples();
+ std::size_t nbOfTuple2=other->getNumberOfTuples();
+ std::size_t nbOfComp=getNumberOfComponents();
+ std::size_t nbOfComp2=other->getNumberOfComponents();
if(nbOfTuple!=nbOfTuple2)
throw INTERP_KERNEL::Exception("DataArrayDouble::powEqual : number of tuples mismatches !");
if(nbOfComp!=1 || nbOfComp2!=1)
throw INTERP_KERNEL::Exception("DataArrayDouble::powEqual : number of components of both arrays must be equal to 1 !");
double *ptr=getPointer();
const double *ptrc=other->begin();
- for(int i=0;i<nbOfTuple;i++,ptrc++,ptr++)
+ for(std::size_t i=0;i<nbOfTuple;i++,ptrc++,ptr++)
{
if(*ptr>=0)
*ptr=pow(*ptr,*ptrc);
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayDouble::toVectorOfBool : must be applied on single component array !");
- int nbt(getNumberOfTuples());
+ std::size_t nbt(getNumberOfTuples());
std::vector<bool> ret(nbt);
const double *pt(begin());
- for(int i=0;i<nbt;i++)
+ for(std::size_t i=0;i<nbt;i++)
{
if(fabs(pt[i])<eps)
ret[i]=false;
tinyInfo.resize(2);
if(isAllocated())
{
- tinyInfo[0]=getNumberOfTuples();
- tinyInfo[1]=getNumberOfComponents();
+ tinyInfo[0]=ToIdType(getNumberOfTuples());
+ tinyInfo[1]=ToIdType(getNumberOfComponents());
}
else
{
{
if(isAllocated())
{
- int nbOfCompo=getNumberOfComponents();
+ mcIdType nbOfCompo=ToIdType(getNumberOfComponents());
tinyInfo.resize(nbOfCompo+1);
tinyInfo[0]=getName();
- for(int i=0;i<nbOfCompo;i++)
+ for(mcIdType i=0;i<nbOfCompo;i++)
tinyInfo[i+1]=getInfoOnComponent(i);
}
else
setName(tinyInfoS[0]);
if(isAllocated())
{
- int nbOfCompo=getNumberOfComponents();
- for(int i=0;i<nbOfCompo;i++)
+ mcIdType nbOfCompo=ToIdType(getNumberOfComponents());
+ for(mcIdType i=0;i<nbOfCompo;i++)
setInfoOnComponent(i,tinyInfoS[i+1]);
}
}
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("Call splitByValueRange method on DataArrayInt with only one component, you can call 'rearrange' method before !");
- int nbOfTuples=getNumberOfTuples();
+ std::size_t nbOfTuples=getNumberOfTuples();
std::size_t nbOfCast=std::distance(arrBg,arrEnd);
if(nbOfCast<2)
throw INTERP_KERNEL::Exception("DataArrayInt::splitByValueRange : The input array giving the cast range values should be of size >=2 !");
ret2->alloc(nbOfTuples,1);
int *ret1Ptr=ret1->getPointer();
int *ret2Ptr=ret2->getPointer();
- std::set<std::size_t> castsDetected;
- for(int i=0;i<nbOfTuples;i++)
+ std::set<mcIdType> castsDetected;
+ for(std::size_t i=0;i<nbOfTuples;i++)
{
rintstart res=std::find_if(bg,end2,std::bind2nd(std::less_equal<int>(), work[i]));
std::size_t pos=std::distance(bg,res);
{
ret1Ptr[i]=(int)pos2;
ret2Ptr[i]=work[i]-arrBg[pos2];
- castsDetected.insert(pos2);
+ castsDetected.insert(ToIdType(pos2));
}
else
{
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
- ret3->alloc((int)castsDetected.size(),1);
+ ret3->alloc(castsDetected.size(),1);
std::copy(castsDetected.begin(),castsDetected.end(),ret3->getPointer());
castArr=ret1.retn();
rankInsideCast=ret2.retn();
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::isRange : this must be single component array !");
- int nbTuples(getNumberOfTuples());
+ mcIdType nbTuples=ToIdType(getNumberOfTuples());
if(nbTuples==0)
{ strt=0; sttoopp=0; stteepp=1; return true; }
const int *pt(begin());
if(a%(nbTuples-1)!=0)
return false;
stteepp=a/(nbTuples-1);
- for(int i=0;i<nbTuples;i++,tmp+=stteepp)
+ for(mcIdType i=0;i<nbTuples;i++,tmp+=stteepp)
if(pt[i]!=tmp)
return false;
return true;
if(a%(nbTuples-1)!=0)
return false;
stteepp=-(a/(nbTuples-1));
- for(int i=0;i<nbTuples;i++,tmp+=stteepp)
+ for(mcIdType i=0;i<nbTuples;i++,tmp+=stteepp)
if(pt[i]!=tmp)
return false;
return true;
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("Call transformWithIndArrR method on DataArrayInt with only one component, you can call 'rearrange' method before !");
int nbElemsIn=(int)std::distance(indArrBg,indArrEnd);
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
const int *pt=getConstPointer();
MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfTuples,1);
ret->fillWithValue(-1);
int *tmp=ret->getPointer();
- for(int i=0;i<nbOfTuples;i++,pt++)
+ for(mcIdType i=0;i<nbOfTuples;i++,pt++)
{
if(*pt>=0 && *pt<nbElemsIn)
{
{
MCAuto<DataArrayInt> ret(DataArrayInt::New());
ret->alloc(newNbOfElem,1);
- int nbOfOldNodes(this->getNumberOfTuples());
+ mcIdType nbOfOldNodes=ToIdType(this->getNumberOfTuples());
const int *old2New(begin());
int *pt(ret->getPointer());
- for(int i=0;i!=nbOfOldNodes;i++)
+ for(mcIdType i=0;i!=nbOfOldNodes;i++)
{
int newp(old2New[i]);
if(newp!=-1)
{
MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(newNbOfElem,1);
- int nbOfOldNodes=getNumberOfTuples();
+ mcIdType nbOfOldNodes=ToIdType(getNumberOfTuples());
const int *old2New=getConstPointer();
int *pt=ret->getPointer();
- for(int i=nbOfOldNodes-1;i>=0;i--)
+ for(mcIdType i=nbOfOldNodes-1;i>=0;i--)
{
int newp(old2New[i]);
if(newp!=-1)
const int *new2Old=getConstPointer();
int *pt=ret->getPointer();
std::fill(pt,pt+oldNbOfElem,-1);
- int nbOfNewElems=getNumberOfTuples();
- for(int i=0;i<nbOfNewElems;i++)
+ mcIdType nbOfNewElems=ToIdType(getNumberOfTuples());
+ for(mcIdType i=0;i<nbOfNewElems;i++)
{
int v(new2Old[i]);
if(v>=0 && v<oldNbOfElem)
MCAuto< MapKeyVal<int> > ret(MapKeyVal<int>::New());
std::map<int,int>& m(ret->data());
const int *new2Old(begin());
- std::size_t nbOfNewElems(this->getNumberOfTuples());
- for(std::size_t i=0;i<nbOfNewElems;i++)
+ mcIdType nbOfNewElems=ToIdType(this->getNumberOfTuples());
+ for(mcIdType i=0;i<nbOfNewElems;i++)
{
int v(new2Old[i]);
m[v]=i;
MCAuto< MapKeyVal<int> > ret(MapKeyVal<int>::New());
std::map<int,int>& m(ret->data());
const int *new2Old(begin());
- std::size_t nbOfNewElems(this->getNumberOfTuples());
- for(std::size_t i=0;i<nbOfNewElems;i++)
+ mcIdType nbOfNewElems=ToIdType(this->getNumberOfTuples());
+ for(mcIdType i=0;i<nbOfNewElems;i++)
{
int v(new2Old[i]);
m[i]=v;
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::checkAndPreparePermutation : number of components must == 1 !");
- int nbTuples=getNumberOfTuples();
+ mcIdType nbTuples=ToIdType(getNumberOfTuples());
const int *pt=getConstPointer();
int *pt2=CheckAndPreparePermutation(pt,pt+nbTuples);
DataArrayInt *ret=DataArrayInt::New();
throw INTERP_KERNEL::Exception("DataArrayInt::FindPermutationFromFirstToSecond : the two arrays are not lying on same ids ! Impossible to find a permutation between the 2 arrays !");
p1=ids1->checkAndPreparePermutation();
p2=ids2->checkAndPreparePermutation();
- p2=p2->invertArrayO2N2N2O(p2->getNumberOfTuples());
+ p2=p2->invertArrayO2N2N2O(ToIdType(p2->getNumberOfTuples()));
p2=p2->selectByTupleIdSafe(p1->begin(),p1->end());
return p2.retn();
}
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::changeSurjectiveFormat : number of components must == 1 !");
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
MCAuto<DataArrayInt> ret(DataArrayInt::New());
MCAuto<DataArrayInt> retI(DataArrayInt::New());
retI->alloc(targetNb+1,1);
const int *input=getConstPointer();
std::vector< std::vector<int> > tmp(targetNb);
- for(int i=0;i<nbOfTuples;i++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
{
int tmp2=input[i];
if(tmp2>=0 && tmp2<targetNb)
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::buildPermArrPerLevel : number of components must == 1 !");
- int nbOfTuples=getNumberOfTuples();
+ std::size_t nbOfTuples=getNumberOfTuples();
const int *pt=getConstPointer();
std::map<int,int> m;
MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfTuples,1);
int *opt=ret->getPointer();
- for(int i=0;i<nbOfTuples;i++,pt++,opt++)
+ for(std::size_t i=0;i<nbOfTuples;i++,pt++,opt++)
{
int val=*pt;
std::map<int,int>::iterator it=m.find(val);
}
pt=getConstPointer();
opt=ret->getPointer();
- for(int i=0;i<nbOfTuples;i++,pt++,opt++)
+ for(std::size_t i=0;i<nbOfTuples;i++,pt++,opt++)
*opt+=m[*pt];
//
return ret.retn();
checkAllocated();
if(getNumberOfComponents()!=1)
return false;
- int nbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
if(nbOfTuples!=sizeExpected)
return false;
const int *pt=getConstPointer();
- for(int i=0;i<nbOfTuples;i++,pt++)
+ for(mcIdType i=0;i<nbOfTuples;i++,pt++)
if(*pt!=i)
return false;
return true;
a->checkAllocated();
copyPartOfStringInfoFrom2(compoIds,*a);
std::size_t partOfCompoSz=compoIds.size();
- int nbOfCompo=getNumberOfComponents();
- int nbOfTuples=std::min(getNumberOfTuples(),a->getNumberOfTuples());
+ mcIdType nbOfCompo=ToIdType(getNumberOfComponents());
+ mcIdType nbOfTuples=ToIdType(std::min(getNumberOfTuples(),a->getNumberOfTuples()));
const int *ac=a->getConstPointer();
int *nc=getPointer();
- for(int i=0;i<nbOfTuples;i++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
for(std::size_t j=0;j<partOfCompoSz;j++,ac++)
nc[nbOfCompo*i+compoIds[j]]=*ac;
}
throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqual : the array must have only one component, you can call 'rearrange' method before !");
const int *cptr(getConstPointer());
MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
- int nbOfTuples=getNumberOfTuples();
- for(int i=0;i<nbOfTuples;i++,cptr++)
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
+ for(mcIdType i=0;i<nbOfTuples;i++,cptr++)
if(*cptr!=val)
ret->pushBackSilent(i);
return ret.retn();
*/
DataArrayInt *DataArrayInt::findIdsEqualTuple(const int *tupleBg, const int *tupleEnd) const
{
- std::size_t nbOfCompoExp(std::distance(tupleBg,tupleEnd));
+ mcIdType nbOfCompoExp=ToIdType(std::distance(tupleBg,tupleEnd));
checkAllocated();
if(getNumberOfComponents()!=nbOfCompoExp)
{
work=std::search(work,end2,tupleBg,tupleEnd);
if(work!=end2)
{
- std::size_t pos(std::distance(bg,work));
+ mcIdType pos=ToIdType(std::distance(bg,work));
if(pos%nbOfCompoExp==0)
ret->pushBackSilent(pos/nbOfCompoExp);
work++;
std::set<int> vals2(valsBg,valsEnd);
const int *cptr(getConstPointer());
std::vector<int> res;
- int nbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
- for(int i=0;i<nbOfTuples;i++,cptr++)
+ for(mcIdType i=0;i<nbOfTuples;i++,cptr++)
if(vals2.find(*cptr)!=vals2.end())
ret->pushBackSilent(i);
return ret.retn();
std::set<int> vals2(valsBg,valsEnd);
const int *cptr=getConstPointer();
std::vector<int> res;
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
- for(int i=0;i<nbOfTuples;i++,cptr++)
+ for(mcIdType i=0;i<nbOfTuples;i++,cptr++)
if(vals2.find(*cptr)==vals2.end())
ret->pushBackSilent(i);
return ret.retn();
int DataArrayInt::findIdFirstEqualTuple(const std::vector<int>& tupl) const
{
checkAllocated();
- int nbOfCompo=getNumberOfComponents();
+ mcIdType nbOfCompo=ToIdType(getNumberOfComponents());
if(nbOfCompo==0)
throw INTERP_KERNEL::Exception("DataArrayInt::findIdFirstEqualTuple : 0 components in 'this' !");
- if(nbOfCompo!=(int)tupl.size())
+ if(nbOfCompo!=ToIdType(tupl.size()))
{
std::ostringstream oss; oss << "DataArrayInt::findIdFirstEqualTuple : 'this' contains " << nbOfCompo << " components and searching for a tuple of length " << tupl.size() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
if(std::distance(cptr,work)%nbOfCompo!=0)
work++;
else
- return std::distance(cptr,work)/nbOfCompo;
+ return ToIdType (std::distance(cptr,work)/nbOfCompo);
}
}
return -1;
int DataArrayInt::findIdSequence(const std::vector<int>& vals) const
{
checkAllocated();
- int nbOfCompo=getNumberOfComponents();
+ std::size_t nbOfCompo=getNumberOfComponents();
if(nbOfCompo!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::findIdSequence : works only for DataArrayInt instance with one component !");
const int *cptr=getConstPointer();
std::size_t nbOfVals=getNbOfElems();
const int *loc=std::search(cptr,cptr+nbOfVals,vals.begin(),vals.end());
if(loc!=cptr+nbOfVals)
- return std::distance(cptr,loc);
+ return ToIdType(std::distance(cptr,loc));
return -1;
}
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::presenceOfValue : the array must have only one component, you can call 'rearrange' method before !");
const int *cptr=getConstPointer();
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
const int *ret=std::find(cptr,cptr+nbOfTuples,value);
if(ret!=cptr+nbOfTuples)
- return std::distance(cptr,ret);
+ return ToIdType(std::distance(cptr,ret));
return -1;
}
throw INTERP_KERNEL::Exception("DataArrayInt::presenceOfValue : the array must have only one component, you can call 'rearrange' method before !");
std::set<int> vals2(vals.begin(),vals.end());
const int *cptr=getConstPointer();
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
for(const int *w=cptr;w!=cptr+nbOfTuples;w++)
if(vals2.find(*w)!=vals2.end())
- return std::distance(cptr,w);
+ return ToIdType(std::distance(cptr,w));
return -1;
}
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::count : must be applied on DataArrayInt with only one component, you can call 'rearrange' method before !");
const int *vals=begin();
- int nbOfTuples=getNumberOfTuples();
- for(int i=0;i<nbOfTuples;i++,vals++)
+ std::size_t nbOfTuples=getNumberOfTuples();
+ for(std::size_t i=0;i<nbOfTuples;i++,vals++)
if(*vals==value)
ret++;
return ret;
{
checkAllocated();
const int *ptr=getConstPointer();
- int nbTuple=getNumberOfTuples();
- int nbComps=getNumberOfComponents();
+ mcIdType nbTuple=ToIdType(getNumberOfTuples());
+ mcIdType nbComps=ToIdType(getNumberOfComponents());
std::fill(res,res+nbComps,0);
- for(int i=0;i<nbTuple;i++)
+ for(mcIdType i=0;i<nbTuple;i++)
std::transform(ptr+i*nbComps,ptr+(i+1)*nbComps,res,res,std::plus<int>());
}
{
checkAllocated();
const int *ptr=getConstPointer();
- int nbTuple=getNumberOfTuples();
- int nbComps=getNumberOfComponents();
+ mcIdType nbTuple=ToIdType(getNumberOfTuples());
+ mcIdType nbComps=ToIdType(getNumberOfComponents());
if(compId<0 || compId>=nbComps)
throw INTERP_KERNEL::Exception("DataArrayInt::accumulate : Invalid compId specified : No such nb of components !");
int ret=0;
- for(int i=0;i<nbTuple;i++)
+ for(mcIdType i=0;i<nbTuple;i++)
ret+=ptr[i*nbComps+compId];
return ret;
}
if(!bgOfIndex || !endOfIndex)
throw INTERP_KERNEL::Exception("DataArrayInt::accumulatePerChunck : input pointer NULL !");
checkAllocated();
- int nbCompo=getNumberOfComponents();
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbCompo=ToIdType(getNumberOfComponents());
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
int sz=(int)std::distance(bgOfIndex,endOfIndex);
if(sz<1)
throw INTERP_KERNEL::Exception("DataArrayInt::accumulatePerChunck : invalid size of input index array !");
throw INTERP_KERNEL::Exception("DataArrayInt::accumulatePerChunck : The first element of the input index not in [0,nbOfTuples) !");
const int *srcPt=begin()+(*w)*nbCompo;
int *tmp=ret->getPointer();
- for(int i=0;i<sz;i++,tmp+=nbCompo,w++)
+ for(mcIdType i=0;i<sz;i++,tmp+=nbCompo,w++)
{
std::fill(tmp,tmp+nbCompo,0);
if(w[1]>=w[0])
{
- for(int j=w[0];j<w[1];j++,srcPt+=nbCompo)
+ for(mcIdType j=w[0];j<w[1];j++,srcPt+=nbCompo)
{
if(j>=0 && j<nbOfTuples)
std::transform(srcPt,srcPt+nbCompo,tmp,tmp,std::plus<int>());
std::ostringstream oss; oss << "DataArrayInt::AggregateIndexes : presence of a DataArrayInt instance with nb of compo != 1 at pos " << std::distance(arrs.begin(),it4) << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- int nbTupl=(*it4)->getNumberOfTuples();
+ mcIdType nbTupl=ToIdType((*it4)->getNumberOfTuples());
if(nbTupl<1)
{
std::ostringstream oss; oss << "DataArrayInt::AggregateIndexes : presence of a DataArrayInt instance with nb of tuples < 1 at pos " << std::distance(arrs.begin(),it4) << " !";
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::getMinMaxValues : must be applied on DataArrayInt with only one component !");
- int nbTuples(getNumberOfTuples());
+ std::size_t nbTuples(getNumberOfTuples());
const int *pt(begin());
minValue=std::numeric_limits<int>::max(); maxValue=-std::numeric_limits<int>::max();
- for(int i=0;i<nbTuples;i++,pt++)
+ for(std::size_t i=0;i<nbTuples;i++,pt++)
{
if(*pt<minValue)
minValue=*pt;
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::checkAllIdsInRange : this must have exactly one component !");
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
bool ret=true;
const int *cptr=getConstPointer();
- for(int i=0;i<nbOfTuples;i++,cptr++)
+ for(mcIdType i=0;i<nbOfTuples;i++,cptr++)
{
if(*cptr>=vmin && *cptr<vmax)
{ ret=ret && *cptr==i; }
for(std::vector<const DataArrayInt *>::const_iterator it=a.begin();it!=a.end();it++)
{
const int *pt=(*it)->getConstPointer();
- int nbOfTuples=(*it)->getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType((*it)->getNumberOfTuples());
r.insert(pt,pt+nbOfTuples);
}
DataArrayInt *ret=DataArrayInt::New();
for(std::vector<const DataArrayInt *>::const_iterator it=a.begin();it!=a.end();it++)
{
const int *pt=(*it)->getConstPointer();
- int nbOfTuples=(*it)->getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType((*it)->getNumberOfTuples());
std::set<int> s1(pt,pt+nbOfTuples);
if(it!=a.begin())
{
throw INTERP_KERNEL::Exception("DataArrayInt::buildComplement : only single component allowed !");
std::vector<bool> tmp(nbOfElement);
const int *pt=getConstPointer();
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
for(const int *w=pt;w!=pt+nbOfTuples;w++)
if(*w>=0 && *w<nbOfElement)
tmp[*w]=true;
if(other->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstraction : only single component allowed for other type !");
const int *pt=getConstPointer();
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
std::set<int> s1(pt,pt+nbOfTuples);
pt=other->getConstPointer();
- nbOfTuples=other->getNumberOfTuples();
+ nbOfTuples=ToIdType(other->getNumberOfTuples());
std::set<int> s2(pt,pt+nbOfTuples);
std::vector<int> r;
std::set_difference(s1.begin(),s1.end(),s2.begin(),s2.end(),std::back_insert_iterator< std::vector<int> >(r));
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::buildUnique : only single component allowed !");
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
MCAuto<DataArrayInt> tmp=deepCopy();
int *data=tmp->getPointer();
int *last=std::unique(data,data+nbOfTuples);
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::deltaShiftIndex : only single component allowed !");
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
if(nbOfTuples<2)
throw INTERP_KERNEL::Exception("DataArrayInt::deltaShiftIndex : 1 tuple at least must be present in 'this' !");
const int *ptr=getConstPointer();
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::computeOffsets : only single component allowed !");
- int nbOfTuples=getNumberOfTuples();
+ std::size_t nbOfTuples=getNumberOfTuples();
if(nbOfTuples==0)
return ;
int *work=getPointer();
int tmp=work[0];
work[0]=0;
- for(int i=1;i<nbOfTuples;i++)
+ for(std::size_t i=1;i<nbOfTuples;i++)
{
int tmp2=work[i];
work[i]=work[i-1]+tmp;
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::computeOffsetsFull : only single component allowed !");
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
int *ret=(int *)malloc((nbOfTuples+1)*sizeof(int));
const int *work=getConstPointer();
ret[0]=0;
- for(int i=0;i<nbOfTuples;i++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
ret[i+1]=work[i]+ret[i];
useArray(ret,true,DeallocType::C_DEALLOC,nbOfTuples+1,1);
declareAsNew();
offsets->checkAllocated();
if(offsets->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrByRanges : input array should have only single component !");
- int othNbTuples=offsets->getNumberOfTuples()-1;
- int nbOfTuples=getNumberOfTuples();
+ mcIdType othNbTuples=ToIdType(offsets->getNumberOfTuples())-1;
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
int retNbOftuples=0;
const int *work=getConstPointer();
const int *offPtr=offsets->getConstPointer();
- for(int i=0;i<nbOfTuples;i++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
{
int val=work[i];
if(val>=0 && val<othNbTuples)
MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(retNbOftuples,1);
int *retPtr=ret->getPointer();
- for(int i=0;i<nbOfTuples;i++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
{
int val=work[i];
int start=offPtr[val];
throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr : not allocated array !");
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr : number of components is expected to be equal to one !");
- int nbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples = ToIdType(getNumberOfTuples());
if(nbOfTuples==0)
throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr : number of tuples must be != 0 !");
const int *ids(begin());
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::findRangeIdForEachTuple : this should have only one component !");
- int nbTuples=getNumberOfTuples();
+ mcIdType nbTuples=ToIdType(getNumberOfTuples());
MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(nbTuples,1);
- int nbOfRanges=ranges->getNumberOfTuples();
+ mcIdType nbOfRanges=ToIdType(ranges->getNumberOfTuples());
const int *rangesPtr=ranges->getConstPointer();
int *retPtr=ret->getPointer();
const int *inPtr=getConstPointer();
- for(int i=0;i<nbTuples;i++,retPtr++)
+ for(mcIdType i=0;i<nbTuples;i++,retPtr++)
{
int val=inPtr[i];
bool found=false;
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::findIdInRangeForEachTuple : this should have only one component !");
- int nbTuples=getNumberOfTuples();
+ std::size_t nbTuples=getNumberOfTuples();
MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(nbTuples,1);
- int nbOfRanges=ranges->getNumberOfTuples();
+ std::size_t nbOfRanges=ranges->getNumberOfTuples();
const int *rangesPtr=ranges->getConstPointer();
int *retPtr=ret->getPointer();
const int *inPtr=getConstPointer();
- for(int i=0;i<nbTuples;i++,retPtr++)
+ for(std::size_t i=0;i<nbTuples;i++,retPtr++)
{
int val=inPtr[i];
bool found=false;
- for(int j=0;j<nbOfRanges && !found;j++)
+ for(std::size_t j=0;j<nbOfRanges && !found;j++)
if(val>=rangesPtr[2*j] && val<rangesPtr[2*j+1])
{ *retPtr=val-rangesPtr[2*j]; found=true; }
if(found)
checkAllocated();
if(getNumberOfComponents()!=2)
throw INTERP_KERNEL::Exception("DataArrayInt::sortEachPairToMakeALinkedList : Only works on DataArrayInt instance with nb of components equal to 2 !");
- int nbOfTuples(getNumberOfTuples());
+ std::size_t nbOfTuples(getNumberOfTuples());
if(nbOfTuples<=1)
return ;
int *conn(getPointer());
- for(int i=1;i<nbOfTuples;i++,conn+=2)
+ for(std::size_t i=1;i<nbOfTuples;i++,conn+=2)
{
if(i>1)
{
{
checkAllocated();
checkNbOfComps(2,"DataArrayInt::fromLinkedListOfPairToList : this is expected to have 2 components");
- int nbTuples(getNumberOfTuples());
+ mcIdType nbTuples=ToIdType(getNumberOfTuples());
if(nbTuples<1)
throw INTERP_KERNEL::Exception("DataArrayInt::fromLinkedListOfPairToList : no tuples in this ! Not a linked list !");
MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(nbTuples+1,1);
const int *thisPtr(begin());
int *retPtr(ret->getPointer());
retPtr[0]=thisPtr[0];
- for(int i=0;i<nbTuples;i++)
+ for(mcIdType i=0;i<nbTuples;i++)
{
retPtr[i+1]=thisPtr[2*i+1];
if(i<nbTuples-1)
throw INTERP_KERNEL::Exception("DataArrayInt::splitInBalancedSlices : this array should have number of components equal to one and must be allocated !");
if(nbOfSlices<=0)
throw INTERP_KERNEL::Exception("DataArrayInt::splitInBalancedSlices : number of slices must be >= 1 !");
- int sum(accumulate(0)),nbOfTuples(getNumberOfTuples());
+ int sum(accumulate(0));
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
int sumPerSlc(sum/nbOfSlices),pos(0);
const int *w(begin());
std::vector< std::pair<int,int> > ret(nbOfSlices);
{
if(!a1 || !a2)
throw INTERP_KERNEL::Exception("DataArrayInt::Modulus : input DataArrayInt instance is NULL !");
- int nbOfTuple1=a1->getNumberOfTuples();
- int nbOfTuple2=a2->getNumberOfTuples();
- int nbOfComp1=a1->getNumberOfComponents();
- int nbOfComp2=a2->getNumberOfComponents();
+ mcIdType nbOfTuple1=ToIdType(a1->getNumberOfTuples());
+ mcIdType nbOfTuple2=ToIdType(a2->getNumberOfTuples());
+ mcIdType nbOfComp1=ToIdType(a1->getNumberOfComponents());
+ mcIdType nbOfComp2=ToIdType(a2->getNumberOfComponents());
if(nbOfTuple2==nbOfTuple1)
{
if(nbOfComp1==nbOfComp2)
const int *a2Ptr=a2->getConstPointer();
const int *a1Ptr=a1->getConstPointer();
int *res=ret->getPointer();
- for(int i=0;i<nbOfTuple1;i++)
+ for(mcIdType i=0;i<nbOfTuple1;i++)
res=std::transform(a1Ptr+i*nbOfComp1,a1Ptr+(i+1)*nbOfComp1,res,std::bind2nd(std::modulus<int>(),a2Ptr[i]));
ret->copyStringInfoFrom(*a1);
return ret.retn();
ret->alloc(nbOfTuple1,nbOfComp1);
const int *a1ptr=a1->getConstPointer(),*a2ptr=a2->getConstPointer();
int *pt=ret->getPointer();
- for(int i=0;i<nbOfTuple1;i++)
+ for(mcIdType i=0;i<nbOfTuple1;i++)
pt=std::transform(a1ptr+i*nbOfComp1,a1ptr+(i+1)*nbOfComp1,a2ptr,pt,std::modulus<int>());
ret->copyStringInfoFrom(*a1);
return ret.retn();
throw INTERP_KERNEL::Exception("DataArrayInt::modulusEqual : input DataArrayInt instance is NULL !");
const char *msg="Nb of tuples mismatch for DataArrayInt::modulusEqual !";
checkAllocated(); other->checkAllocated();
- int nbOfTuple=getNumberOfTuples();
- int nbOfTuple2=other->getNumberOfTuples();
- int nbOfComp=getNumberOfComponents();
- int nbOfComp2=other->getNumberOfComponents();
+ mcIdType nbOfTuple=ToIdType(getNumberOfTuples());
+ mcIdType nbOfTuple2=ToIdType(other->getNumberOfTuples());
+ mcIdType nbOfComp=ToIdType(getNumberOfComponents());
+ mcIdType nbOfComp2=ToIdType(other->getNumberOfComponents());
if(nbOfTuple==nbOfTuple2)
{
if(nbOfComp==nbOfComp2)
{
int *ptr=getPointer();
const int *ptrc=other->getConstPointer();
- for(int i=0;i<nbOfTuple;i++)
+ for(mcIdType i=0;i<nbOfTuple;i++)
std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptr+i*nbOfComp,std::bind2nd(std::modulus<int>(),*ptrc++));
}
else
{
int *ptr=getPointer();
const int *ptrc=other->getConstPointer();
- for(int i=0;i<nbOfTuple;i++)
+ for(mcIdType i=0;i<nbOfTuple;i++)
std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptrc,ptr+i*nbOfComp,std::modulus<int>());
}
else
{
if(!a1 || !a2)
throw INTERP_KERNEL::Exception("DataArrayInt::Pow : at least one of input instances is null !");
- int nbOfTuple=a1->getNumberOfTuples();
- int nbOfTuple2=a2->getNumberOfTuples();
- int nbOfComp=a1->getNumberOfComponents();
- int nbOfComp2=a2->getNumberOfComponents();
+ std::size_t nbOfTuple=a1->getNumberOfTuples();
+ std::size_t nbOfTuple2=a2->getNumberOfTuples();
+ std::size_t nbOfComp=a1->getNumberOfComponents();
+ std::size_t nbOfComp2=a2->getNumberOfComponents();
if(nbOfTuple!=nbOfTuple2)
throw INTERP_KERNEL::Exception("DataArrayInt::Pow : number of tuples mismatches !");
if(nbOfComp!=1 || nbOfComp2!=1)
MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(nbOfTuple,1);
const int *ptr1(a1->begin()),*ptr2(a2->begin());
int *ptr=ret->getPointer();
- for(int i=0;i<nbOfTuple;i++,ptr1++,ptr2++,ptr++)
+ for(std::size_t i=0;i<nbOfTuple;i++,ptr1++,ptr2++,ptr++)
{
if(*ptr2>=0)
{
{
if(!other)
throw INTERP_KERNEL::Exception("DataArrayInt::powEqual : input instance is null !");
- int nbOfTuple=getNumberOfTuples();
- int nbOfTuple2=other->getNumberOfTuples();
- int nbOfComp=getNumberOfComponents();
- int nbOfComp2=other->getNumberOfComponents();
+ std::size_t nbOfTuple=getNumberOfTuples();
+ std::size_t nbOfTuple2=other->getNumberOfTuples();
+ std::size_t nbOfComp=getNumberOfComponents();
+ std::size_t nbOfComp2=other->getNumberOfComponents();
if(nbOfTuple!=nbOfTuple2)
throw INTERP_KERNEL::Exception("DataArrayInt::powEqual : number of tuples mismatches !");
if(nbOfComp!=1 || nbOfComp2!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::powEqual : number of components of both arrays must be equal to 1 !");
int *ptr=getPointer();
const int *ptrc=other->begin();
- for(int i=0;i<nbOfTuple;i++,ptrc++,ptr++)
+ for(std::size_t i=0;i<nbOfTuple;i++,ptrc++,ptr++)
{
if(*ptrc>=0)
{
std::size_t sz=std::distance(idsOfSelectBg,idsOfSelectEnd);
const int *arrInPtr=arrIn->begin();
const int *arrIndxPtr=arrIndxIn->begin();
- int nbOfGrps=arrIndxIn->getNumberOfTuples()-1;
+ mcIdType nbOfGrps=ToIdType(arrIndxIn->getNumberOfTuples())-1;
if(nbOfGrps<0)
throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArrays : The format of \"arrIndxIn\" is invalid ! Its nb of tuples should be >=1 !");
- int maxSizeOfArr=arrIn->getNumberOfTuples();
+ mcIdType maxSizeOfArr=ToIdType(arrIn->getNumberOfTuples());
MCAuto<DataArrayInt> arro=DataArrayInt::New();
MCAuto<DataArrayInt> arrIo=DataArrayInt::New();
arrIo->alloc((int)(sz+1),1);
int sz=DataArrayInt::GetNumberOfItemGivenBESRelative(idsOfSelectStart,idsOfSelectStop,idsOfSelectStep,"MEDCouplingUMesh::ExtractFromIndexedArraysSlice : Input slice ");
const int *arrInPtr=arrIn->begin();
const int *arrIndxPtr=arrIndxIn->begin();
- int nbOfGrps=arrIndxIn->getNumberOfTuples()-1;
+ mcIdType nbOfGrps=ToIdType(arrIndxIn->getNumberOfTuples())-1;
if(nbOfGrps<0)
throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArraysSlice : The format of \"arrIndxIn\" is invalid ! Its nb of tuples should be >=1 !");
- int maxSizeOfArr=arrIn->getNumberOfTuples();
+ mcIdType maxSizeOfArr=ToIdType(arrIn->getNumberOfTuples());
MCAuto<DataArrayInt> arro=DataArrayInt::New();
MCAuto<DataArrayInt> arrIo=DataArrayInt::New();
arrIo->alloc((int)(sz+1),1);
throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArrays : presence of null pointer in input parameter !");
MCAuto<DataArrayInt> arro=DataArrayInt::New();
MCAuto<DataArrayInt> arrIo=DataArrayInt::New();
- int nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
+ mcIdType nbOfTuples=ToIdType(arrIndxIn->getNumberOfTuples())-1;
std::vector<bool> v(nbOfTuples,true);
int offset=0;
const int *arrIndxInPtr=arrIndxIn->begin();
const int *srcArrPtr=srcArr->begin();
int *arrIoPtr=arrIo->getPointer(); *arrIoPtr++=0;
int *arroPtr=arro->getPointer();
- for(int ii=0;ii<nbOfTuples;ii++,arrIoPtr++)
+ for(mcIdType ii=0;ii<nbOfTuples;ii++,arrIoPtr++)
{
if(v[ii])
{
throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArraysSlice : presence of null pointer in input parameter !");
MCAuto<DataArrayInt> arro=DataArrayInt::New();
MCAuto<DataArrayInt> arrIo=DataArrayInt::New();
- int nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
+ mcIdType nbOfTuples=ToIdType(arrIndxIn->getNumberOfTuples())-1;
int offset=0;
const int *arrIndxInPtr=arrIndxIn->begin();
const int *srcArrIndexPtr=srcArrIndex->begin();
const int *srcArrPtr=srcArr->begin();
int *arrIoPtr=arrIo->getPointer(); *arrIoPtr++=0;
int *arroPtr=arro->getPointer();
- for(int ii=0;ii<nbOfTuples;ii++,arrIoPtr++)
+ for(mcIdType ii=0;ii<nbOfTuples;ii++,arrIoPtr++)
{
int pos=DataArray::GetPosOfItemGivenBESRelativeNoThrow(ii,start,end,step);
if(pos<0)
{
if(arrInOut==0 || arrIndxIn==0 || srcArr==0 || srcArrIndex==0)
throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArraysSameIdx : presence of null pointer in input parameter !");
- int nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
+ mcIdType nbOfTuples=ToIdType(arrIndxIn->getNumberOfTuples())-1;
const int *arrIndxInPtr=arrIndxIn->begin();
const int *srcArrIndexPtr=srcArrIndex->begin();
int *arrInOutPtr=arrInOut->getPointer();
if(offsetForRemoval<0)
throw INTERP_KERNEL::Exception("DataArrayInt::RemoveIdsFromIndexedArrays : offsetForRemoval should be >=0 !");
std::set<int> s(idsToRemoveBg,idsToRemoveEnd);
- int nbOfGrps=arrIndx->getNumberOfTuples()-1;
+ mcIdType nbOfGrps=ToIdType(arrIndx->getNumberOfTuples())-1;
int *arrIPtr=arrIndx->getPointer();
*arrIPtr++=0;
int previousArrI=0;
const int *arrPtr=arr->begin();
std::vector<int> arrOut;//no utility to switch to DataArrayInt because copy always needed
- for(int i=0;i<nbOfGrps;i++,arrIPtr++)
+ for(mcIdType i=0;i<nbOfGrps;i++,arrIPtr++)
{
if(*arrIPtr-previousArrI>offsetForRemoval)
{
{
if(arrInOut==0 || arrIndxIn==0 || srcArr==0 || srcArrIndex==0)
throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArraysSameIdxSlice : presence of null pointer in input parameter !");
- int nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
+ mcIdType nbOfTuples=ToIdType(arrIndxIn->getNumberOfTuples())-1;
const int *arrIndxInPtr=arrIndxIn->begin();
const int *srcArrIndexPtr=srcArrIndex->begin();
int *arrInOutPtr=arrInOut->getPointer();
tinyInfo.resize(2);
if(isAllocated())
{
- tinyInfo[0]=getNumberOfTuples();
- tinyInfo[1]=getNumberOfComponents();
+ tinyInfo[0]=ToIdType(getNumberOfTuples());
+ tinyInfo[1]=ToIdType(getNumberOfComponents());
}
else
{
{
if(isAllocated())
{
- int nbOfCompo=getNumberOfComponents();
+ mcIdType nbOfCompo=ToIdType(getNumberOfComponents());
tinyInfo.resize(nbOfCompo+1);
tinyInfo[0]=getName();
for(int i=0;i<nbOfCompo;i++)
MEDCOUPLING_EXPORT T front() const;
MEDCOUPLING_EXPORT T back() const;
MEDCOUPLING_EXPORT std::size_t getNbOfElemAllocated() const { return _mem.getNbOfElemAllocated(); }
- MEDCOUPLING_EXPORT void allocIfNecessary(int nbOfTuple, int nbOfCompo);
+ MEDCOUPLING_EXPORT void allocIfNecessary(std::size_t nbOfTuple, std::size_t nbOfCompo);
MEDCOUPLING_EXPORT void deepCopyFrom(const DataArrayTemplate<T>& other);
MEDCOUPLING_EXPORT void reverse();
MEDCOUPLING_EXPORT void fillWithValue(T val);
throw INTERP_KERNEL::Exception("DataArrayInt::findIdsAdv : this must have exactly one component !");
const T *cptr(this->begin());
MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
- int nbOfTuples(this->getNumberOfTuples());
- for(int i=0;i<nbOfTuples;i++,cptr++)
+ mcIdType nbOfTuples=ToIdType(this->getNumberOfTuples());
+ for(mcIdType i=0;i<nbOfTuples;i++,cptr++)
if(op(*cptr))
ret->pushBackSilent(i);
return ret;
{
public:
MEDCOUPLING_EXPORT DataArrayTuple(T *pt, int nbOfComp);
- MEDCOUPLING_EXPORT std::string repr() const;
+ //MEDCOUPLING_EXPORT std::string repr() const;
MEDCOUPLING_EXPORT int getNumberOfCompo() const { return _nb_of_compo; }
MEDCOUPLING_EXPORT const T *getConstPointer() const { return _pt; }
MEDCOUPLING_EXPORT T *getPointer() { return _pt; }
template<class InputIterator>
void DataArrayTemplate<T>::insertAtTheEnd(InputIterator first, InputIterator last)
{
- int nbCompo(this->getNumberOfComponents());
+ std::size_t nbCompo(this->getNumberOfComponents());
if(nbCompo==1)
this->_mem.insertAtTheEnd(first,last);
else if(nbCompo==0)
_da->incrRef();
if(_da->isAllocated())
{
- _nb_comp=da->getNumberOfComponents();
- _nb_tuple=da->getNumberOfTuples();
+ _nb_comp=ToIdType(da->getNumberOfComponents());
+ _nb_tuple=ToIdType(da->getNumberOfTuples());
_pt=da->getPointer();
}
}
{
checkAllocated();
std::size_t sz(getNumberOfComponents());
- int nbTuples(getNumberOfTuples());
+ std::size_t nbTuples(getNumberOfTuples());
std::string name(getName());
std::vector<std::string> compNames(getInfoOnComponents());
std::vector< MCAuto< typename Traits<T>::ArrayTypeCh > > ret(sz);
part->setName(name);
part->setInfoOnComponent(0,compNames[i]);
T *otherPt(part->getPointer());
- for(int j=0;j<nbTuples;j++)
+ for(std::size_t j=0;j<nbTuples;j++)
otherPt[j]=thisPt[sz*j+i];
ret[i]=part;
}
template<class T>
void DataArrayTemplate<T>::reserve(std::size_t nbOfElems)
{
- int nbCompo(getNumberOfComponents());
+ std::size_t nbCompo(getNumberOfComponents());
if(nbCompo==1)
{
_mem.reserve(nbOfElems);
template<class T>
void DataArrayTemplate<T>::pushBackSilent(T val)
{
- int nbCompo(getNumberOfComponents());
+ std::size_t nbCompo(getNumberOfComponents());
if(nbCompo==1)
_mem.pushBack(val);
else if(nbCompo==0)
template<class T>
void DataArrayTemplate<T>::pushBackValsSilent(const T *valsBg, const T *valsEnd)
{
- int nbCompo(getNumberOfComponents());
+ std::size_t nbCompo(getNumberOfComponents());
if(nbCompo==1)
_mem.insertAtTheEnd(valsBg,valsEnd);
else if(nbCompo==0)
* \throw If \a nbOfTuple < 0 or \a nbOfCompo < 0.
*/
template<class T>
- void DataArrayTemplate<T>::allocIfNecessary(int nbOfTuple, int nbOfCompo)
+ void DataArrayTemplate<T>::allocIfNecessary(std::size_t nbOfTuple, std::size_t nbOfCompo)
{
if(isAllocated())
{
- if(nbOfTuple!=getNumberOfTuples() || nbOfCompo!=(int)getNumberOfComponents())
+ if(nbOfTuple!=getNumberOfTuples() || nbOfCompo!=getNumberOfComponents())
alloc(nbOfTuple,nbOfCompo);
}
else
void DataArrayTemplate<T>::deepCopyFrom(const DataArrayTemplate<T>& other)
{
other.checkAllocated();
- int nbOfTuples(other.getNumberOfTuples()),nbOfComp(other.getNumberOfComponents());
+ std::size_t nbOfTuples(other.getNumberOfTuples()),nbOfComp(other.getNumberOfComponents());
allocIfNecessary(nbOfTuples,nbOfComp);
- std::size_t nbOfElems((std::size_t)nbOfTuples*nbOfComp);
+ std::size_t nbOfElems(nbOfTuples*nbOfComp);
T *pt(getPointer());
const T *ptI(other.begin());
for(std::size_t i=0;i<nbOfElems;i++)
void DataArrayTemplate<T>::reverse()
{
checkAllocated();
- _mem.reverse(getNumberOfComponents());
+ _mem.reverse(ToIdType(getNumberOfComponents()));
declareAsNew();
}
void DataArrayTemplate<T>::renumberInPlace(const int *old2New)
{
checkAllocated();
- int nbTuples(getNumberOfTuples()),nbOfCompo(getNumberOfComponents());
+ mcIdType nbTuples=ToIdType(getNumberOfTuples());
+ mcIdType nbOfCompo=ToIdType(getNumberOfComponents());
T *tmp(new T[nbTuples*nbOfCompo]);
const T *iptr(begin());
for(int i=0;i<nbTuples;i++)
void DataArrayTemplate<T>::renumberInPlaceR(const int *new2Old)
{
checkAllocated();
- int nbTuples(getNumberOfTuples()),nbOfCompo(getNumberOfComponents());
+ mcIdType nbTuples=ToIdType(getNumberOfTuples());
+ mcIdType nbOfCompo=ToIdType(getNumberOfComponents());
T *tmp(new T[nbTuples*nbOfCompo]);
const T *iptr(begin());
- for(int i=0;i<nbTuples;i++)
+ for(mcIdType i=0;i<nbTuples;i++)
{
int v=new2Old[i];
if(v>=0 && v<nbTuples)
typename Traits<T>::ArrayType *DataArrayTemplate<T>::renumber(const int *old2New) const
{
checkAllocated();
- int nbTuples(getNumberOfTuples()),nbOfCompo(getNumberOfComponents());
+ mcIdType nbTuples=ToIdType(getNumberOfTuples());
+ mcIdType nbOfCompo=ToIdType(getNumberOfComponents());
MCAuto<DataArray> ret0(buildNewEmptyInstance());
MCAuto< typename Traits<T>::ArrayType > ret(DynamicCastSafe<DataArray,typename Traits<T>::ArrayType>(ret0));
ret->alloc(nbTuples,nbOfCompo);
ret->copyStringInfoFrom(*this);
const T *iptr(begin());
T *optr(ret->getPointer());
- for(int i=0;i<nbTuples;i++)
+ for(mcIdType i=0;i<nbTuples;i++)
std::copy(iptr+nbOfCompo*i,iptr+nbOfCompo*(i+1),optr+nbOfCompo*old2New[i]);
ret->copyStringInfoFrom(*this);
return ret.retn();
typename Traits<T>::ArrayType *DataArrayTemplate<T>::renumberR(const int *new2Old) const
{
checkAllocated();
- int nbTuples(getNumberOfTuples()),nbOfCompo(getNumberOfComponents());
+ mcIdType nbTuples=ToIdType(getNumberOfTuples());
+ mcIdType nbOfCompo=ToIdType(getNumberOfComponents());
MCAuto<DataArray> ret0(buildNewEmptyInstance());
MCAuto< typename Traits<T>::ArrayType > ret(DynamicCastSafe<DataArray,typename Traits<T>::ArrayType>(ret0));
ret->alloc(nbTuples,nbOfCompo);
ret->copyStringInfoFrom(*this);
const T *iptr(getConstPointer());
T *optr(ret->getPointer());
- for(int i=0;i<nbTuples;i++)
+ for(mcIdType i=0;i<nbTuples;i++)
std::copy(iptr+nbOfCompo*new2Old[i],iptr+nbOfCompo*(new2Old[i]+1),optr+i*nbOfCompo);
ret->copyStringInfoFrom(*this);
return ret.retn();
typename Traits<T>::ArrayType *DataArrayTemplate<T>::renumberAndReduce(const int *old2New, int newNbOfTuple) const
{
checkAllocated();
- int nbTuples(getNumberOfTuples()),nbOfCompo(getNumberOfComponents());
+ mcIdType nbTuples=ToIdType(getNumberOfTuples());
+ mcIdType nbOfCompo=ToIdType(getNumberOfComponents());
MCAuto<DataArray> ret0(buildNewEmptyInstance());
MCAuto< typename Traits<T>::ArrayType > ret(DynamicCastSafe<DataArray,typename Traits<T>::ArrayType>(ret0));
ret->alloc(newNbOfTuple,nbOfCompo);
const T *iptr=getConstPointer();
T *optr=ret->getPointer();
- for(int i=0;i<nbTuples;i++)
+ for(mcIdType i=0;i<nbTuples;i++)
{
int w=old2New[i];
if(w>=0)
checkAllocated();
MCAuto<DataArray> ret0(buildNewEmptyInstance());
MCAuto< typename Traits<T>::ArrayType > ret(DynamicCastSafe<DataArray,typename Traits<T>::ArrayType>(ret0));
- int nbComp(getNumberOfComponents()),oldNbOfTuples(getNumberOfTuples());
+ mcIdType nbComp=ToIdType(getNumberOfComponents());
+ mcIdType oldNbOfTuples=ToIdType(getNumberOfTuples());
ret->alloc((int)std::distance(new2OldBg,new2OldEnd),nbComp);
ret->copyStringInfoFrom(*this);
T *pt(ret->getPointer());
void DataArrayTemplate<T>::transpose()
{
checkAllocated();
- int nbOfTuples(getNumberOfTuples());
- rearrange(nbOfTuples);
+ rearrange(ToIdType (getNumberOfTuples()));
}
/*!
ret->alloc(getNumberOfTuples(),newNbOfComp);
const T *oldc(getConstPointer());
T *nc(ret->getPointer());
- int nbOfTuples(getNumberOfTuples()),oldNbOfComp(getNumberOfComponents());
- int dim(std::min(oldNbOfComp,newNbOfComp));
- for(int i=0;i<nbOfTuples;i++)
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
+ mcIdType oldNbOfComp=ToIdType(getNumberOfComponents());
+ mcIdType dim(std::min(oldNbOfComp,newNbOfComp));
+ for(mcIdType i=0;i<nbOfTuples;i++)
{
- int j=0;
+ mcIdType j=0;
for(;j<dim;j++)
nc[newNbOfComp*i+j]=oldc[i*oldNbOfComp+j];
for(;j<newNbOfComp;j++)
nc[newNbOfComp*i+j]=dftValue;
}
ret->setName(getName());
- for(int i=0;i<dim;i++)
+ for(mcIdType i=0;i<dim;i++)
ret->setInfoOnComponent(i,getInfoOnComponent(i));
ret->setName(getName());
return ret.retn();
checkAllocated();
MCAuto<DataArray> ret0(buildNewEmptyInstance());
MCAuto< typename Traits<T>::ArrayType > ret(DynamicCastSafe<DataArray,typename Traits<T>::ArrayType>(ret0));
- std::size_t newNbOfCompo(compoIds.size());
- int oldNbOfCompo(getNumberOfComponents());
+ mcIdType newNbOfCompo=ToIdType(compoIds.size());
+ mcIdType oldNbOfCompo=ToIdType(getNumberOfComponents());
for(std::vector<int>::const_iterator it=compoIds.begin();it!=compoIds.end();it++)
if((*it)<0 || (*it)>=oldNbOfCompo)
{
std::ostringstream oss; oss << Traits<T>::ArrayTypeName << "::keepSelectedComponents : invalid requested component : " << *it << " whereas it should be in [0," << oldNbOfCompo << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- int nbOfTuples(getNumberOfTuples());
- ret->alloc(nbOfTuples,(int)newNbOfCompo);
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
+ ret->alloc(nbOfTuples,newNbOfCompo);
ret->copyPartOfStringInfoFrom(*this,compoIds);
const T *oldc(getConstPointer());
T *nc(ret->getPointer());
- for(int i=0;i<nbOfTuples;i++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
for(std::size_t j=0;j<newNbOfCompo;j++,nc++)
*nc=oldc[i*oldNbOfCompo+compoIds[j]];
return ret.retn();
typename Traits<T>::ArrayType *DataArrayTemplate<T>::subArray(int tupleIdBg, int tupleIdEnd) const
{
checkAllocated();
- int nbt(getNumberOfTuples());
+ mcIdType nbt=ToIdType(getNumberOfTuples());
if(tupleIdBg<0)
{
std::ostringstream oss; oss << Traits<T>::ArrayTypeName << "::subArray : The tupleIdBg parameter must be greater than 0 !";
std::ostringstream oss; oss << Traits<T>::ArrayTypeName << ":subArray : The tupleIdBg parameter is greater than number of tuples !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- int trueEnd=tupleIdEnd;
+ mcIdType trueEnd=tupleIdEnd;
if(tupleIdEnd!=-1)
{
if(tupleIdEnd>nbt)
}
else
trueEnd=nbt;
- int nbComp(getNumberOfComponents());
+ mcIdType nbComp=ToIdType(getNumberOfComponents());
MCAuto<DataArray> ret0(buildNewEmptyInstance());
MCAuto< typename Traits<T>::ArrayType > ret(DynamicCastSafe<DataArray,typename Traits<T>::ArrayType>(ret0));
ret->alloc(trueEnd-tupleIdBg,nbComp);
checkAllocated();
MCAuto<DataArray> ret0(buildNewEmptyInstance());
MCAuto< typename Traits<T>::ArrayType > ret(DynamicCastSafe<DataArray,typename Traits<T>::ArrayType>(ret0));
- int nbComp(getNumberOfComponents());
+ mcIdType nbComp=ToIdType(getNumberOfComponents());
std::ostringstream oss; oss << Traits<T>::ArrayTypeName << "::selectByTupleIdSafeSlice : ";
int newNbOfTuples(GetNumberOfItemGivenBESRelative(bg,end2,step,oss.str()));
ret->alloc(newNbOfTuples,nbComp);
a->checkAllocated();
int newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg));
int newNbOfComp(DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg));
- int nbComp(getNumberOfComponents()),nbOfTuples(getNumberOfTuples());
+ mcIdType nbComp=ToIdType(getNumberOfComponents());
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value");
DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value");
bool assignTech(true);
checkAllocated();
int newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg));
int newNbOfComp(DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg));
- int nbComp(getNumberOfComponents()),nbOfTuples(getNumberOfTuples());
+ mcIdType nbComp=ToIdType(getNumberOfComponents());
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value");
DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value");
T *pt=getPointer()+bgTuples*nbComp+bgComp;
- for(int i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
- for(int j=0;j<newNbOfComp;j++)
+ for(mcIdType i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
+ for(mcIdType j=0;j<newNbOfComp;j++)
pt[j*stepComp]=a;
}
const char msg[]="DataArrayTemplate::setPartOfValues2";
checkAllocated();
a->checkAllocated();
- int nbComp(getNumberOfComponents()),nbOfTuples(getNumberOfTuples());
+ mcIdType nbComp=ToIdType(getNumberOfComponents());
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
for(const int *z=bgComp;z!=endComp;z++)
DataArray::CheckValueInRange(nbComp,*z,"invalid component id");
int newNbOfTuples((int)std::distance(bgTuples,endTuples));
void DataArrayTemplate<T>::setPartOfValuesSimple2(T a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp)
{
checkAllocated();
- int nbComp(getNumberOfComponents()),nbOfTuples(getNumberOfTuples());
+ mcIdType nbComp=ToIdType(getNumberOfComponents());
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
for(const int *z=bgComp;z!=endComp;z++)
DataArray::CheckValueInRange(nbComp,*z,"invalid component id");
T *pt(getPointer());
checkAllocated();
a->checkAllocated();
int newNbOfComp=DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg);
- int nbComp=getNumberOfComponents();
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbComp=ToIdType(getNumberOfComponents());
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value");
int newNbOfTuples=(int)std::distance(bgTuples,endTuples);
bool assignTech=true;
const char msg[]="DataArrayTemplate::setPartOfValuesSimple3";
checkAllocated();
int newNbOfComp(DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg));
- int nbComp(getNumberOfComponents()),nbOfTuples(getNumberOfTuples());
+ mcIdType nbComp=ToIdType(getNumberOfComponents());
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value");
T *pt(getPointer()+bgComp);
for(const int *w=bgTuples;w!=endTuples;w++)
a->checkAllocated();
int newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg));
int newNbOfComp((int)std::distance(bgComp,endComp));
- int nbComp(getNumberOfComponents());
+ mcIdType nbComp=ToIdType(getNumberOfComponents());
for(const int *z=bgComp;z!=endComp;z++)
DataArray::CheckValueInRange(nbComp,*z,"invalid component id");
- int nbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value");
bool assignTech(true);
if(a->getNbOfElems()==(std::size_t)newNbOfTuples*newNbOfComp)
const char msg[]="DataArrayTemplate::setPartOfValuesSimple4";
checkAllocated();
int newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg));
- int nbComp(getNumberOfComponents());
+ mcIdType nbComp=ToIdType(getNumberOfComponents());
for(const int *z=bgComp;z!=endComp;z++)
DataArray::CheckValueInRange(nbComp,*z,"invalid component id");
- int nbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value");
T *pt=getPointer()+bgTuples*nbComp;
for(int i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
throw INTERP_KERNEL::Exception("DataArrayTemplate::setPartOfValuesAdv : This and a do not have the same number of components !");
if(tuplesSelec->getNumberOfComponents()!=2)
throw INTERP_KERNEL::Exception("DataArrayTemplate::setPartOfValuesAdv : Expecting to have a tuple selector DataArrayInt instance with exactly 2 components !");
- int thisNt(getNumberOfTuples());
- int aNt(a->getNumberOfTuples());
+ mcIdType thisNt=ToIdType(getNumberOfTuples());
+ mcIdType aNt=ToIdType(a->getNumberOfTuples());
T *valsToSet(getPointer());
const T *valsSrc(a->getConstPointer());
for(const int *tuple=tuplesSelec->begin();tuple!=tuplesSelec->end();tuple+=2)
throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValues : This and a do not have the same number of components !");
if(tuplesSelec->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValues : Expecting to have a tuple selector DataArrayInt instance with exactly 1 component !");
- int thisNt(getNumberOfTuples());
- int aNt(a->getNumberOfTuples());
- int nbOfTupleToWrite(tuplesSelec->getNumberOfTuples());
+ mcIdType thisNt=ToIdType(getNumberOfTuples());
+ mcIdType aNt=ToIdType(a->getNumberOfTuples());
+ mcIdType nbOfTupleToWrite=ToIdType(tuplesSelec->getNumberOfTuples());
T *valsToSet(getPointer()+tupleIdStart*nbOfComp);
if(tupleIdStart+nbOfTupleToWrite>thisNt)
throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValues : invalid number range of values to write !");
int nbOfTupleToWrite(DataArray::GetNumberOfItemGivenBES(bg,end2,step,msg));
if(nbOfComp!=a->getNumberOfComponents())
throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValuesSlice : This and a do not have the same number of components !");
- int thisNt(getNumberOfTuples()),aNt(a->getNumberOfTuples());
+ mcIdType thisNt=ToIdType(getNumberOfTuples());
+ mcIdType aNt=ToIdType(a->getNumberOfTuples());
T *valsToSet(getPointer()+tupleIdStart*nbOfComp);
if(tupleIdStart+nbOfTupleToWrite>thisNt)
throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValuesSlice : invalid number range of values to write !");
typename Traits<T>::ArrayType *DataArrayTemplate<T>::mySelectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) const
{
checkAllocated();
- int nbOfComp(getNumberOfComponents()),nbOfTuplesThis(getNumberOfTuples());
+ mcIdType nbOfComp=ToIdType(getNumberOfComponents());
+ mcIdType nbOfTuplesThis=ToIdType(getNumberOfTuples());
if(ranges.empty())
{
MCAuto<DataArray> ret0(buildNewEmptyInstance());
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayTemplate::front : number of components not equal to one !");
- int nbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
if(nbOfTuples<1)
throw INTERP_KERNEL::Exception("DataArrayTemplate::front : number of tuples must be >= 1 !");
return *(getConstPointer());
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayTemplate::back : number of components not equal to one !");
- int nbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
if(nbOfTuples<1)
throw INTERP_KERNEL::Exception("DataArrayTemplate::back : number of tuples must be >= 1 !");
return *(getConstPointer()+nbOfTuples-1);
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayDouble::getMaxValue : must be applied on DataArrayDouble with only one component, you can call 'rearrange' method before or call 'getMaxValueInArray' method !");
- int nbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
if(nbOfTuples<=0)
throw INTERP_KERNEL::Exception("DataArrayDouble::getMaxValue : array exists but number of tuples must be > 0 !");
const T *vals(getConstPointer());
tupleId=i;
}
}
- return this->getIJ(tupleId,0);
+ return this->getIJ(ToIdType(tupleId),0);
}
/*!
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayDouble::getMinValue : must be applied on DataArrayDouble with only one component, you can call 'rearrange' method before call 'getMinValueInArray' method !");
- int nbOfTuples(getNumberOfTuples());
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
if(nbOfTuples<=0)
throw INTERP_KERNEL::Exception("DataArrayDouble::getMinValue : array exists but number of tuples must be > 0 !");
const T *vals(getConstPointer());
void DataArrayTemplate<T>::circularPermutation(int nbOfShift)
{
checkAllocated();
- int nbOfCompo(getNumberOfComponents()),nbTuples(getNumberOfTuples());
+ mcIdType nbOfCompo=ToIdType(getNumberOfComponents());
+ mcIdType nbTuples=ToIdType(getNumberOfTuples());
int effNbSh(EffectiveCircPerm(nbOfShift,nbTuples));
if(effNbSh==0)
return ;
void DataArrayTemplate<T>::circularPermutationPerTuple(int nbOfShift)
{
checkAllocated();
- int nbOfCompo(getNumberOfComponents()),nbTuples(getNumberOfTuples());
+ mcIdType nbOfCompo=ToIdType(getNumberOfComponents());
+ mcIdType nbTuples=ToIdType(getNumberOfTuples());
int effNbSh(EffectiveCircPerm(nbOfShift,nbOfCompo));
if(effNbSh==0)
return ;
if(effNbSh<nbOfCompo-effNbSh)
{
typename INTERP_KERNEL::AutoPtr<T> buf(new T[effNbSh]);
- for(int i=0;i<nbTuples;i++,work+=nbOfCompo)
+ for(mcIdType i=0;i<nbTuples;i++,work+=nbOfCompo)
{
std::copy(work,work+effNbSh,(T *)buf);
std::copy(work+effNbSh,work+nbOfCompo,work);// ze big shift
else
{
typename INTERP_KERNEL::AutoPtr<T> buf(new T[nbOfCompo-effNbSh]);
- for(int i=0;i<nbTuples;i++,work+=nbOfCompo)
+ for(mcIdType i=0;i<nbTuples;i++,work+=nbOfCompo)
{
std::copy(work+effNbSh,work+nbOfCompo,(T *)buf);
std::copy(work,work+effNbSh,work+(nbOfCompo-effNbSh));// ze big shift
}
}
std::vector<std::string> sts(nbOfCompo);
- for(int i=0;i<nbOfCompo;i++)
+ for(mcIdType i=0;i<nbOfCompo;i++)
sts[i]=_info_on_compo[(i+effNbSh)%nbOfCompo];
setInfoOnComponents(sts);
}
void DataArrayTemplate<T>::reversePerTuple()
{
checkAllocated();
- int nbOfCompo(getNumberOfComponents()),nbTuples(getNumberOfTuples());
+ mcIdType nbOfCompo=ToIdType(getNumberOfComponents());
+ mcIdType nbTuples=ToIdType(getNumberOfTuples());
if(nbOfCompo<=1)
return ;
T *work(getPointer());
- for(int i=0;i<nbTuples;i++,work+=nbOfCompo)
+ for(mcIdType i=0;i<nbTuples;i++,work+=nbOfCompo)
std::reverse(work,work+nbOfCompo);
std::reverse(_info_on_compo.begin(),_info_on_compo.end());
}
//////////////////////////////
+ namespace
+ {
+ // local static function to copy arrays without warnings
+ template <class TIn, class TOut>
+ static void copyCast (const TIn *begin, const TIn *end, TOut* dest)
+ {
+ for (const TIn *src = begin; src != end; ++src, ++dest)
+ *dest=static_cast<TOut>(*src);
+ }
+ }
+
template<class T>
template<class U>
MCAuto< typename Traits<U>::ArrayType > DataArrayTemplateClassic<T>::convertToOtherTypeOfArr() const
const T *src(this->begin());
U *dest(ret->getPointer());
// to make Visual C++ happy : instead of std::size_t nbOfVals=getNbOfElems(); std::copy(src,src+nbOfVals,dest);
- //for(const T *src=this->begin();src!=this->end();src++,dest++)
- // *dest=(int)*src;
- std::copy(src,src+nbOfVals,dest);
+ copyCast(src, src+nbOfVals, dest);
+ //std::copy(src,src+nbOfVals,dest);
ret->copyStringInfoFrom(*this);
return ret;
}
{
this->checkAllocated();
T *ptr(this->getPointer()+compoId);
- int nbOfComp(this->getNumberOfComponents()),nbOfTuple(this->getNumberOfTuples());
+ mcIdType nbOfComp=ToIdType(this->getNumberOfComponents());
+ mcIdType nbOfTuple=ToIdType(this->getNumberOfTuples());
if(compoId<0 || compoId>=nbOfComp)
{
std::ostringstream oss; oss << "DataArrayDouble::applyLin : The compoId requested (" << compoId << ") is not valid ! Must be in [0," << nbOfComp << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- for(int i=0;i<nbOfTuple;i++,ptr+=nbOfComp)
+ for(mcIdType i=0;i<nbOfTuple;i++,ptr+=nbOfComp)
*ptr=a*(*ptr)+b;
this->declareAsNew();
}
{
this->checkAllocated();
MCAuto<typename Traits<T>::ArrayType> newArr(Traits<T>::ArrayType::New());
- int nbOfTuples(this->getNumberOfTuples()),nbOfComp(this->getNumberOfComponents());
+ mcIdType nbOfTuples=ToIdType(this->getNumberOfTuples());
+ mcIdType nbOfComp=ToIdType(this->getNumberOfComponents());
newArr->alloc(nbOfTuples,nbOfComp);
const T *cptr(this->begin());
std::transform(cptr,cptr+nbOfTuples*nbOfComp,newArr->getPointer(),std::negate<T>());
const char *msg="Nb of tuples mismatch for DataArrayDouble::multiplyEqual !";
this->checkAllocated();
other->checkAllocated();
- int nbOfTuple(this->getNumberOfTuples()),nbOfTuple2(other->getNumberOfTuples());
- int nbOfComp(this->getNumberOfComponents()),nbOfComp2(other->getNumberOfComponents());
+ mcIdType nbOfTuple=ToIdType(this->getNumberOfTuples());
+ mcIdType nbOfTuple2=ToIdType(other->getNumberOfTuples());
+ mcIdType nbOfComp=ToIdType(this->getNumberOfComponents());
+ mcIdType nbOfComp2=ToIdType(other->getNumberOfComponents());
if(nbOfTuple==nbOfTuple2)
{
if(nbOfComp==nbOfComp2)
{
T *ptr(this->getPointer());
const T *ptrc(other->begin());
- for(int i=0;i<nbOfTuple;i++)
+ for(mcIdType i=0;i<nbOfTuple;i++)
std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptr+i*nbOfComp,std::bind2nd(FCT(),*ptrc++));
}
else
{
T *ptr(this->getPointer());
const T *ptrc(other->begin());
- for(int i=0;i<nbOfTuple;i++)
+ for(mcIdType i=0;i<nbOfTuple;i++)
std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptrc,ptr+i*nbOfComp,FCT());
}
else
{
if(!a1 || !a2)
throw INTERP_KERNEL::Exception("DivSub : input DataArrayDouble instance is NULL !");
- int nbOfTuple1(a1->getNumberOfTuples()),nbOfTuple2(a2->getNumberOfTuples());
- int nbOfComp1(a1->getNumberOfComponents()),nbOfComp2(a2->getNumberOfComponents());
+ mcIdType nbOfTuple1=ToIdType(a1->getNumberOfTuples());
+ mcIdType nbOfTuple2=ToIdType(a2->getNumberOfTuples());
+ mcIdType nbOfComp1=ToIdType(a1->getNumberOfComponents());
+ mcIdType nbOfComp2=ToIdType(a2->getNumberOfComponents());
if(nbOfTuple2==nbOfTuple1)
{
if(nbOfComp1==nbOfComp2)
ret->alloc(nbOfTuple1,nbOfComp1);
const T *a2Ptr(a2->begin()),*a1Ptr(a1->begin());
T *res(ret->getPointer());
- for(int i=0;i<nbOfTuple1;i++)
+ for(mcIdType i=0;i<nbOfTuple1;i++)
res=std::transform(a1Ptr+i*nbOfComp1,a1Ptr+(i+1)*nbOfComp1,res,std::bind2nd(FCT(),a2Ptr[i]));
ret->copyStringInfoFrom(*a1);
return ret.retn();
ret->alloc(nbOfTuple1,nbOfComp1);
const T *a1ptr=a1->begin(),*a2ptr(a2->begin());
T *pt(ret->getPointer());
- for(int i=0;i<nbOfTuple1;i++)
+ for(mcIdType i=0;i<nbOfTuple1;i++)
pt=std::transform(a1ptr+i*nbOfComp1,a1ptr+(i+1)*nbOfComp1,a2ptr,pt,FCT());
ret->copyStringInfoFrom(*a1);
return ret.retn();
{
if(!a1 || !a2)
throw INTERP_KERNEL::Exception("DataArrayDouble::MulAdd : input DataArrayDouble instance is NULL !");
- int nbOfTuple(a1->getNumberOfTuples()),nbOfTuple2(a2->getNumberOfTuples());
- int nbOfComp(a1->getNumberOfComponents()),nbOfComp2(a2->getNumberOfComponents());
+ mcIdType nbOfTuple=ToIdType(a1->getNumberOfTuples());
+ mcIdType nbOfTuple2=ToIdType(a2->getNumberOfTuples());
+ mcIdType nbOfComp=ToIdType(a1->getNumberOfComponents());
+ mcIdType nbOfComp2=ToIdType(a2->getNumberOfComponents());
MCAuto<typename Traits<T>::ArrayType> ret=0;
if(nbOfTuple==nbOfTuple2)
{
}
else
{
- int nbOfCompMin,nbOfCompMax;
+ mcIdType nbOfCompMin,nbOfCompMax;
const typename Traits<T>::ArrayType *aMin, *aMax;
if(nbOfComp>nbOfComp2)
{
const T *aMinPtr(aMin->begin());
const T *aMaxPtr(aMax->begin());
T *res=ret->getPointer();
- for(int i=0;i<nbOfTuple;i++)
+ for(mcIdType i=0;i<nbOfTuple;i++)
res=std::transform(aMaxPtr+i*nbOfCompMax,aMaxPtr+(i+1)*nbOfCompMax,res,std::bind2nd(FCT(),aMinPtr[i]));
ret->copyStringInfoFrom(*aMax);
}
{
if(nbOfComp==nbOfComp2)
{
- int nbOfTupleMax=std::max(nbOfTuple,nbOfTuple2);
+ mcIdType nbOfTupleMax=std::max(nbOfTuple,nbOfTuple2);
const typename Traits<T>::ArrayType *aMin(nbOfTuple>nbOfTuple2?a2:a1);
const typename Traits<T>::ArrayType *aMax(nbOfTuple>nbOfTuple2?a1:a2);
const T *aMinPtr(aMin->begin()),*aMaxPtr(aMax->begin());
ret=Traits<T>::ArrayType::New();
ret->alloc(nbOfTupleMax,nbOfComp);
T *res(ret->getPointer());
- for(int i=0;i<nbOfTupleMax;i++)
+ for(mcIdType i=0;i<nbOfTupleMax;i++)
res=std::transform(aMaxPtr+i*nbOfComp,aMaxPtr+(i+1)*nbOfComp,aMinPtr,res,FCT());
ret->copyStringInfoFrom(*aMax);
}
std::size_t nbOfTuples((*it)->getNumberOfTuples());
std::vector<int> nbc(a.size());
std::vector<const T *> pts(a.size());
- nbc[0]=(*it)->getNumberOfComponents();
+ nbc[0]=ToIdType((*it)->getNumberOfComponents());
pts[0]=(*it++)->getConstPointer();
for(int i=1;it!=a.end();it++,i++)
{
if(nbOfTuples!=(*it)->getNumberOfTuples())
throw INTERP_KERNEL::Exception("DataArrayDouble::Meld : mismatch of number of tuples !");
- nbc[i]=(*it)->getNumberOfComponents();
+ nbc[i]=ToIdType((*it)->getNumberOfComponents());
pts[i]=(*it)->getConstPointer();
}
int totalNbOfComp=std::accumulate(nbc.begin(),nbc.end(),0);
{
if(this->_mem.isNull())
throw INTERP_KERNEL::Exception("DataArrayDouble::fromNoInterlace : Not defined array !");
- T *tab(this->_mem.fromNoInterlace(this->getNumberOfComponents()));
+ T *tab(this->_mem.fromNoInterlace(ToIdType(this->getNumberOfComponents())));
MCAuto<typename Traits<T>::ArrayType> ret(Traits<T>::ArrayType::New());
- ret->useArray(tab,true,DeallocType::C_DEALLOC,this->getNumberOfTuples(),this->getNumberOfComponents());
+ ret->useArray(tab,true,DeallocType::C_DEALLOC,ToIdType(this->getNumberOfTuples()),ToIdType(this->getNumberOfComponents()));
return ret.retn();
}
{
if(this->_mem.isNull())
throw INTERP_KERNEL::Exception("DataArrayDouble::toNoInterlace : Not defined array !");
- T *tab(this->_mem.toNoInterlace(this->getNumberOfComponents()));
+ T *tab(this->_mem.toNoInterlace(ToIdType(this->getNumberOfComponents())));
MCAuto<typename Traits<T>::ArrayType> ret(Traits<T>::ArrayType::New());
- ret->useArray(tab,true,DeallocType::C_DEALLOC,this->getNumberOfTuples(),this->getNumberOfComponents());
+ ret->useArray(tab,true,DeallocType::C_DEALLOC,ToIdType(this->getNumberOfTuples()),ToIdType(this->getNumberOfComponents()));
return ret.retn();
}
{
this->checkAllocated();
other->checkAllocated();
- std::size_t nbOfTuples(this->getNumberOfTuples());
+ mcIdType nbOfTuples=ToIdType((this->getNumberOfTuples()));
if(nbOfTuples!=other->getNumberOfTuples())
throw INTERP_KERNEL::Exception("DataArrayDouble::meldWith : mismatch of number of tuples !");
- int nbOfComp1(this->getNumberOfComponents()),nbOfComp2(other->getNumberOfComponents());
+ mcIdType nbOfComp1=ToIdType(this->getNumberOfComponents());
+ mcIdType nbOfComp2=ToIdType(other->getNumberOfComponents());
T *newArr=(T *)malloc((nbOfTuples*(nbOfComp1+nbOfComp2))*sizeof(T));
T *w=newArr;
const T *inp1(this->begin()),*inp2(other->begin());
throw INTERP_KERNEL::Exception("DataArrayDouble::duplicateEachTupleNTimes : this should have only one component !");
if(nbTimes<1)
throw INTERP_KERNEL::Exception("DataArrayDouble::duplicateEachTupleNTimes : nb times should be >= 1 !");
- int nbTuples(this->getNumberOfTuples());
+ mcIdType nbTuples=ToIdType(this->getNumberOfTuples());
const T *inPtr(this->begin());
MCAuto<typename Traits<T>::ArrayType> ret(Traits<T>::ArrayType::New()); ret->alloc(nbTimes*nbTuples,1);
T *retPtr(ret->getPointer());
- for(int i=0;i<nbTuples;i++,inPtr++)
+ for(mcIdType i=0;i<nbTuples;i++,inPtr++)
{
T val(*inPtr);
for(int j=0;j<nbTimes;j++,retPtr++)
{
this->checkAllocated();
MCAuto<typename Traits<T>::ArrayType> newArr(Traits<T>::ArrayType::New());
- int nbOfTuples(this->getNumberOfTuples());
- int nbOfComp(this->getNumberOfComponents());
+ std::size_t nbOfTuples(this->getNumberOfTuples());
+ std::size_t nbOfComp(this->getNumberOfComponents());
newArr->alloc(nbOfTuples,nbOfComp);
std::transform(this->begin(),this->end(),newArr->getPointer(),std::ptr_fun<T,T>(std::abs));
newArr->copyStringInfoFrom(*this);
{
DataArray::reprWithoutNameStream(stream);
ImplReprTraits<T>::SetPrecision(stream);
- this->_mem.repr(this->getNumberOfComponents(),stream);
+ this->_mem.repr(ToIdType(this->getNumberOfComponents()),stream);
}
template<class T>
{
DataArray::reprWithoutNameStream(stream);
ImplReprTraits<T>::SetPrecision(stream);
- this->_mem.reprZip(this->getNumberOfComponents(),stream);
+ this->_mem.reprZip(ToIdType(this->getNumberOfComponents()),stream);
}
template<class T>
{
DataArray::reprWithoutNameStream(stream);
ImplReprTraits<T>::SetPrecision(stream);
- this->_mem.reprNotTooLong(this->getNumberOfComponents(),stream);
+ this->_mem.reprNotTooLong(ToIdType(this->getNumberOfComponents()),stream);
}
/*!
this->checkAllocated();
if(this->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::switchOnTupleEqualTo : number of components of this should be equal to one !");
- int nbOfTuples(this->getNumberOfTuples());
- if(nbOfTuples!=(int)vec.size())
+ std::size_t nbOfTuples(this->getNumberOfTuples());
+ if(nbOfTuples!=vec.size())
throw INTERP_KERNEL::Exception("DataArrayInt::switchOnTupleEqualTo : number of tuples of this should be equal to size of input vector of bool !");
const T *pt(this->begin());
- for(int i=0;i<nbOfTuples;i++)
+ for(std::size_t i=0;i<nbOfTuples;i++)
if(algo(pt[i],val))
vec[i]=true;
}
this->checkAllocated();
if(this->getNumberOfComponents()!=1 || other.getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::buildPermutationArr : 'this' and 'other' have to have exactly ONE component !");
- std::size_t nbTuple(this->getNumberOfTuples());
+ mcIdType nbTuple=ToIdType(this->getNumberOfTuples());
other.checkAllocated();
if(nbTuple!=other.getNumberOfTuples())
throw INTERP_KERNEL::Exception("DataArrayInt::buildPermutationArr : 'this' and 'other' must have the same number of tuple !");
ret->alloc(nbTuple,1);
ret->fillWithValue(-1);
const T *pt(this->begin());
- std::map<int,mcIdType> mm;
- for(std::size_t i=0;i<nbTuple;i++)
- mm[pt[i]]=(mcIdType)i;
+ std::map<mcIdType,mcIdType> mm;
+ for(mcIdType i=0;i<nbTuple;i++)
+ mm[ToIdType(pt[i])]=i;
pt=other.begin();
mcIdType *retToFill(ret->getPointer());
for(std::size_t i=0;i<nbTuple;i++)
{
- std::map<int,int>::const_iterator it=mm.find(pt[i]);
+ std::map<mcIdType,mcIdType>::const_iterator it=mm.find(ToIdType(pt[i]));
if(it==mm.end())
{
std::ostringstream oss; oss << "DataArrayInt::buildPermutationArr : Arrays mismatch : element (" << pt[i] << ") in 'other' not findable in 'this' !";
MCAuto<DataArrayIdType> ret(DataArrayIdType::New());
ret->alloc(nbTuples,1);
mcIdType *retPt(ret->getPointer());
- std::map<int,mcIdType> m;
- for(std::size_t i=0;i<thisNbTuples;i++,thisPt++)
- m[*thisPt]=(mcIdType)i;
+ std::map<mcIdType,mcIdType> m;
+ for(mcIdType i=0;i<thisNbTuples;i++,thisPt++)
+ m[ToIdType(*thisPt)]=i;
if(m.size()!=thisNbTuples)
throw INTERP_KERNEL::Exception("DataArrayInt::indicesOfSubPart : some elements appears more than once !");
for(std::size_t i=0;i<nbTuples;i++,retPt++,pt++)
{
- std::map<int,mcIdType>::const_iterator it(m.find(*pt));
+ std::map<mcIdType,mcIdType>::const_iterator it(m.find(ToIdType(*pt)));
if(it!=m.end())
*retPt=(*it).second;
else
int DataArrayDiscrete<T>::getHashCode() const
{
this->checkAllocated();
- std::size_t nbOfElems(this->getNbOfElems());
- int ret=nbOfElems*65536;
- int delta=3;
+ mcIdType nbOfElems=ToIdType(this->getNbOfElems());
+ mcIdType ret=nbOfElems*65536;
+ mcIdType delta=3;
if(nbOfElems>48)
delta=nbOfElems/8;
T ret0(0);
const T *pt(this->begin());
for(std::size_t i=0;i<nbOfElems;i+=delta)
ret0+=pt[i] & 0x1FFF;
- return ret+ret0;
+ return int(ret+ret0);
}
template<class T>
void DataArrayDiscrete<T>::reprCppStream(const std::string& varName, std::ostream& stream) const
{
- std::size_t nbTuples(this->getNumberOfTuples()),nbComp(this->getNumberOfComponents());
+ mcIdType nbTuples=ToIdType(this->getNumberOfTuples());
+ mcIdType nbComp=ToIdType(this->getNumberOfComponents());
const T *data(this->getConstPointer());
stream << Traits<T>::ArrayTypeName << " *" << varName << "=" << Traits<T>::ArrayTypeName << "::New();" << std::endl;
if(nbTuples*nbComp>=1)
{
stream << "const int " << varName << "Data[" << nbTuples*nbComp << "]={";
- std::copy(data,data+nbTuples*nbComp-1,std::ostream_iterator<int>(stream,","));
+ std::copy(data,data+nbTuples*nbComp-1,std::ostream_iterator<T>(stream,","));
stream << data[nbTuples*nbComp-1] << "};" << std::endl;
stream << varName << "->useArray(" << varName << "Data,false,CPP_DEALLOC," << nbTuples << "," << nbComp << ");" << std::endl;
}
else if(std::string(type)=="Int8")
{
INTERP_KERNEL::AutoPtr<char> tmp(new char[this->getNbOfElems()]);
- std::copy(this->begin(),this->end(),(char *)tmp);
+ copyCast(this->begin(),this->end(),(char *)tmp);
byteArr->insertAtTheEnd((char *)tmp,(char *)tmp+this->getNbOfElems());
byteArr->insertAtTheEnd(SPACE,SPACE+4);
}
else if(std::string(type)=="UInt8")
{
INTERP_KERNEL::AutoPtr<unsigned char> tmp(new unsigned char[this->getNbOfElems()]);
- std::copy(this->begin(),this->end(),(unsigned char *)tmp);
+ copyCast(this->begin(),this->end(),(unsigned char *)tmp);
byteArr->insertAtTheEnd((unsigned char *)tmp,(unsigned char *)tmp+this->getNbOfElems());
byteArr->insertAtTheEnd(SPACE,SPACE+4);
}
else
{
ofs << " RangeMin=\"" << this->getMinValueInArray() << "\" RangeMax=\"" << this->getMaxValueInArray() << "\" format=\"ascii\">\n" << idt;
- std::copy(this->begin(),this->end(),std::ostream_iterator<int>(ofs," "));
+ std::copy(this->begin(),this->end(),std::ostream_iterator<T>(ofs," "));
}
ofs << std::endl << idt << "</DataArray>\n";
}
this->checkAllocated();
if(this->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("Call transformWithIndArr method on DataArrayInt with only one component, you can call 'rearrange' method before !");
- std::size_t nbElemsIn(std::distance(indArrBg,indArrEnd)),nbOfTuples(this->getNumberOfTuples());
+ mcIdType nbElemsIn=ToIdType(std::distance(indArrBg,indArrEnd));
+ std::size_t nbOfTuples(this->getNumberOfTuples());
T *pt(this->getPointer());
for(std::size_t i=0;i<nbOfTuples;i++,pt++)
{
{
checkAllocated();
std::size_t nbOfElems=getNbOfElems();
- int ret=nbOfElems*65536;
- int delta=3;
+ std::size_t ret=nbOfElems*65536;
+ std::size_t delta=3;
if(nbOfElems>48)
delta=nbOfElems/8;
int ret0=0;
const char *pt=begin();
for(std::size_t i=0;i<nbOfElems;i+=delta)
ret0+=pt[i];
- return ret+ret0;
+ return ToIdType(ret)+ret0;
}
/*!
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 !");
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
const char *w=getConstPointer();
const char *end2=w+nbOfTuples;
for(;w!=end2;w++)
throw INTERP_KERNEL::Exception("DataArrayChar::meldWith : DataArrayChar pointer in input is NULL !");
checkAllocated();
other->checkAllocated();
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
if(nbOfTuples!=other->getNumberOfTuples())
throw INTERP_KERNEL::Exception("DataArrayChar::meldWith : mismatch of number of tuples !");
- int nbOfComp1=getNumberOfComponents();
- int nbOfComp2=other->getNumberOfComponents();
+ mcIdType nbOfComp1=ToIdType(getNumberOfComponents());
+ mcIdType nbOfComp2=ToIdType(other->getNumberOfComponents());
char *newArr=(char *)malloc(nbOfTuples*(nbOfComp1+nbOfComp2)*sizeof(char));
char *w=newArr;
const char *inp1=getConstPointer();
throw INTERP_KERNEL::Exception("DataArrayChar::findIdsEqual : the array must have only one component, you can call 'rearrange' method before !");
const char *cptr=getConstPointer();
MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
for(int i=0;i<nbOfTuples;i++,cptr++)
if(*cptr==val)
ret->pushBackSilent(i);
throw INTERP_KERNEL::Exception("DataArrayChar::findIdsNotEqual : the array must have only one component, you can call 'rearrange' method before !");
const char *cptr=getConstPointer();
MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
for(int i=0;i<nbOfTuples;i++,cptr++)
if(*cptr!=val)
ret->pushBackSilent(i);
int DataArrayChar::findIdSequence(const std::vector<char>& vals) const
{
checkAllocated();
- int nbOfCompo=getNumberOfComponents();
+ mcIdType nbOfCompo=ToIdType(getNumberOfComponents());
if(nbOfCompo!=1)
throw INTERP_KERNEL::Exception("DataArrayChar::findIdSequence : works only for DataArrayChar instance with one component !");
const char *cptr=getConstPointer();
std::size_t nbOfVals=getNbOfElems();
const char *loc=std::search(cptr,cptr+nbOfVals,vals.begin(),vals.end());
if(loc!=cptr+nbOfVals)
- return std::distance(cptr,loc);
+ return ToIdType(std::distance(cptr,loc));
return -1;
}
int DataArrayChar::findIdFirstEqualTuple(const std::vector<char>& tupl) const
{
checkAllocated();
- int nbOfCompo=getNumberOfComponents();
+ mcIdType nbOfCompo=ToIdType(getNumberOfComponents());
if(nbOfCompo==0)
throw INTERP_KERNEL::Exception("DataArrayChar::findIdFirstEqualTuple : 0 components in 'this' !");
if(nbOfCompo!=(int)tupl.size())
if(std::distance(cptr,work)%nbOfCompo!=0)
work++;
else
- return std::distance(cptr,work)/nbOfCompo;
+ return ToIdType(std::distance(cptr,work))/nbOfCompo;
}
}
return -1;
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayChar::presenceOfValue : the array must have only one component, you can call 'rearrange' method before !");
const char *cptr=getConstPointer();
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
const char *ret=std::find(cptr,cptr+nbOfTuples,value);
if(ret!=cptr+nbOfTuples)
- return std::distance(cptr,ret);
+ return ToIdType(std::distance(cptr,ret));
return -1;
}
throw INTERP_KERNEL::Exception("DataArrayInt::presenceOfValue : the array must have only one component, you can call 'rearrange' method before !");
std::set<char> vals2(vals.begin(),vals.end());
const char *cptr=getConstPointer();
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
for(const char *w=cptr;w!=cptr+nbOfTuples;w++)
if(vals2.find(*w)!=vals2.end())
- return std::distance(cptr,w);
+ return ToIdType(std::distance(cptr,w));
return -1;
}
throw INTERP_KERNEL::Exception("DataArrayChar::findIdsInRange : this must have exactly one component !");
const char *cptr=getConstPointer();
MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(0,1);
- int nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
for(int i=0;i<nbOfTuples;i++,cptr++)
if(*cptr>=vmin && *cptr<vmax)
ret->pushBackSilent(i);
throw INTERP_KERNEL::Exception("DataArrayChar::Aggregate : input list must be NON EMPTY !");
std::vector<const DataArrayChar *>::const_iterator it=a.begin();
std::size_t nbOfComp((*it)->getNumberOfComponents());
- int nbt=(*it++)->getNumberOfTuples();
+ std::size_t nbt=(*it++)->getNumberOfTuples();
for(int i=1;it!=a.end();it++,i++)
{
if((*it)->getNumberOfComponents()!=nbOfComp)
for(it=a.begin();it!=a.end();it++)
(*it)->checkAllocated();
it=a.begin();
- int nbOfTuples=(*it)->getNumberOfTuples();
+ mcIdType nbOfTuples=ToIdType((*it)->getNumberOfTuples());
std::vector<int> nbc(a.size());
std::vector<const char *> pts(a.size());
- nbc[0]=(*it)->getNumberOfComponents();
+ nbc[0]=ToIdType((*it)->getNumberOfComponents());
pts[0]=(*it++)->getConstPointer();
for(int i=1;it!=a.end();it++,i++)
{
if(nbOfTuples!=(*it)->getNumberOfTuples())
throw INTERP_KERNEL::Exception("DataArrayChar::meld : mismatch of number of tuples !");
- nbc[i]=(*it)->getNumberOfComponents();
+ nbc[i]=ToIdType((*it)->getNumberOfComponents());
pts[i]=(*it)->getConstPointer();
}
int totalNbOfComp=std::accumulate(nbc.begin(),nbc.end(),0);
void DataArrayByte::reprWithoutNameStream(std::ostream& stream) const
{
DataArray::reprWithoutNameStream(stream);
- if(_mem.reprHeader(getNumberOfComponents(),stream))
+ if(_mem.reprHeader(ToIdType(getNumberOfComponents()),stream))
{
const char *data=begin();
- int nbOfTuples=getNumberOfTuples();
- int nbCompo=getNumberOfComponents();
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
+ mcIdType nbCompo=ToIdType(getNumberOfComponents());
for(int i=0;i<nbOfTuples;i++,data+=nbCompo)
{
stream << "Tuple #" << i << " : ";
void DataArrayByte::reprZipWithoutNameStream(std::ostream& stream) const
{
DataArray::reprWithoutNameStream(stream);
- _mem.reprZip(getNumberOfComponents(),stream);
+ _mem.reprZip(ToIdType(getNumberOfComponents()),stream);
}
void DataArrayByte::reprCppStream(const std::string& varName, std::ostream& stream) const
{
- int nbTuples=getNumberOfTuples(),nbComp=getNumberOfComponents();
+ mcIdType nbTuples=ToIdType(getNumberOfTuples()),nbComp=ToIdType(getNumberOfComponents());
const char *data=getConstPointer();
stream << "DataArrayByte *" << varName << "=DataArrayByte::New();" << std::endl;
if(nbTuples*nbComp>=1)
stream << "DataArrayByte C++ instance at " << this << ". ";
if(isAllocated())
{
- int nbOfCompo=(int)_info_on_compo.size();
+ std::size_t nbOfCompo=_info_on_compo.size();
if(nbOfCompo>=1)
{
- int nbOfTuples=getNumberOfTuples();
+ std::size_t nbOfTuples=getNumberOfTuples();
stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl;
reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR);
}
void DataArrayByte::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const
{
const char *data=begin();
- int nbOfTuples=getNumberOfTuples();
- int nbOfCompo=(int)_info_on_compo.size();
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
+ mcIdType nbOfCompo=ToIdType(_info_on_compo.size());
std::ostringstream oss2; oss2 << "[";
std::string oss2Str(oss2.str());
bool isFinished=true;
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayByte::toVectorOfBool : this method can be used only if this has one component !");
- int nbt(getNumberOfTuples());
+ mcIdType nbt=ToIdType(getNumberOfTuples());
std::vector<bool> ret(nbt,false);
const char *pt(begin());
for(int i=0;i<nbt;i++,pt++)
_da->incrRef();
if(_da->isAllocated())
{
- _nb_comp=da->getNumberOfComponents();
- _nb_tuple=da->getNumberOfTuples();
+ _nb_comp=ToIdType(da->getNumberOfComponents());
+ _nb_tuple=ToIdType(da->getNumberOfTuples());
_pt=da->getPointer();
}
}
void DataArrayAsciiChar::reprWithoutNameStream(std::ostream& stream) const
{
DataArray::reprWithoutNameStream(stream);
- if(_mem.reprHeader(getNumberOfComponents(),stream))
+ if(_mem.reprHeader(ToIdType(getNumberOfComponents()),stream))
{
const char *data=begin();
- int nbOfTuples=getNumberOfTuples();
- int nbCompo=getNumberOfComponents();
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
+ mcIdType nbCompo=ToIdType(getNumberOfComponents());
for(int i=0;i<nbOfTuples;i++,data+=nbCompo)
{
stream << "Tuple #" << i << " : \"";
void DataArrayAsciiChar::reprCppStream(const std::string& varName, std::ostream& stream) const
{
- int nbTuples=getNumberOfTuples(),nbComp=getNumberOfComponents();
+ mcIdType nbTuples=ToIdType(getNumberOfTuples()),nbComp=ToIdType(getNumberOfComponents());
const char *data=getConstPointer();
stream << "DataArrayAsciiChar *" << varName << "=DataArrayAsciiChar::New();" << std::endl;
if(nbTuples*nbComp>=1)
stream << "DataArrayAsciiChar C++ instance at " << this << ". ";
if(isAllocated())
{
- int nbOfCompo=(int)_info_on_compo.size();
+ std::size_t nbOfCompo=_info_on_compo.size();
if(nbOfCompo>=1)
{
- int nbOfTuples=getNumberOfTuples();
+ std::size_t nbOfTuples=getNumberOfTuples();
stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl;
reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR);
}
void DataArrayAsciiChar::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const
{
const char *data=begin();
- int nbOfTuples=getNumberOfTuples();
- int nbOfCompo=(int)_info_on_compo.size();
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
+ mcIdType nbOfCompo=ToIdType(_info_on_compo.size());
std::ostringstream oss2; oss2 << "[";
std::string oss2Str(oss2.str());
bool isFinished=true;
_da->incrRef();
if(_da->isAllocated())
{
- _nb_comp=da->getNumberOfComponents();
- _nb_tuple=da->getNumberOfTuples();
+ _nb_comp=ToIdType(da->getNumberOfComponents());
+ _nb_tuple=ToIdType(da->getNumberOfTuples());
_pt=da->getPointer();
}
}
void DataArrayFloat::reprCppStream(const std::string& varName, std::ostream& stream) const
{
- int nbTuples(getNumberOfTuples()),nbComp(getNumberOfComponents());
+ mcIdType nbTuples=ToIdType(getNumberOfTuples()),nbComp=ToIdType(getNumberOfComponents());
const float *data(begin());
stream.precision(7);
stream << "DataArrayFloat *" << varName << "=DataArrayFloat::New();" << std::endl;
int nbOfCompo=(int)_info_on_compo.size();
if(nbOfCompo>=1)
{
- int nbOfTuples=getNumberOfTuples();
+ std::size_t nbOfTuples=getNumberOfTuples();
stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl;
reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR);
}
void DataArrayFloat::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const
{
const float *data(begin());
- int nbOfTuples(getNumberOfTuples());
- int nbOfCompo=(int)_info_on_compo.size();
+ mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
+ mcIdType nbOfCompo=ToIdType(_info_on_compo.size());
std::ostringstream oss2; oss2 << "[";
oss2.precision(7);
std::string oss2Str(oss2.str());
{
std::vector<int> crest;
std::set<int> p(partBg,partEnd);
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
for(int i=0;i<nbOfCells;i++)
{
std::vector<int> conn;
std::vector<int> ret;
getCellsContainingPoint(work,eps,ret);
elts->insertAtTheEnd(ret.begin(),ret.end());
- eltsIndexPtr[i+1]=elts->getNumberOfTuples();
+ eltsIndexPtr[i+1]=ToIdType(elts->getNumberOfTuples());
}
}
//INTERP_KERNEL::NormalizedCellType getTypeOfElement(int eltId) const;
//int getNumberOfNodesOfElement(int eltId) const;
//int getNumberOfNodes() const;
- unsigned long getNumberOfElements() const;
- unsigned long nbCellsAlongAxis(int axis) const;
+ std::size_t getNumberOfElements() const;
+ std::size_t nbCellsAlongAxis(int axis) const;
const double * getCoordsAlongAxis(int axis) const;
~MEDCouplingNormalizedCartesianMesh();
private:
}
template<int SPACEDIM>
-unsigned long MEDCouplingNormalizedCartesianMesh<SPACEDIM>::getNumberOfElements() const
+std::size_t MEDCouplingNormalizedCartesianMesh<SPACEDIM>::getNumberOfElements() const
{
return _mesh->getNumberOfCells();
}
template<int SPACEDIM>
-unsigned long MEDCouplingNormalizedCartesianMesh<SPACEDIM>::nbCellsAlongAxis(int axis) const
+std::size_t MEDCouplingNormalizedCartesianMesh<SPACEDIM>::nbCellsAlongAxis(int axis) const
{
return _mesh->getCoordsAt(axis)->getNumberOfTuples() - 1;
}
}
const MEDCoupling::DataArrayDouble *array=_mesh->getCoords();
const double *ptr=array->getConstPointer();
- int nbOfPts=array->getNbOfElems()/SPACEDIM;
+ mcIdType nbOfPts=ToIdType(array->getNbOfElems())/SPACEDIM;
for(int j=0;j<SPACEDIM;j++)
{
const double *work=ptr+j;
template<int SPACEDIM,int MESHDIM>
int MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::getNumberOfElements() const
{
- return _mesh->getNumberOfCells();
+ return ToIdType(_mesh->getNumberOfCells());
}
template<int SPACEDIM,int MESHDIM>
const MEDCoupling::MEDCouplingUMesh *m1(dynamic_cast<const MEDCoupling::MEDCouplingUMesh *>(_mesh));
if(m1)
{
- int nbOfCell=m1->getNumberOfCells();
- int initialConnSize=m1->getNodalConnectivity()->getNbOfElems();
+ mcIdType nbOfCell=ToIdType(m1->getNumberOfCells());
+ mcIdType initialConnSize=ToIdType(m1->getNodalConnectivity()->getNbOfElems());
_conn_for_interp=new int[initialConnSize-nbOfCell];
_conn_index_for_interp=new int[nbOfCell+1];
_conn_index_for_interp[0]=0;
const MEDCoupling::MEDCoupling1DGTUMesh *m2(dynamic_cast<const MEDCoupling::MEDCoupling1DGTUMesh *>(_mesh));
if(m2)
{
- int nbOfCell(m2->getNumberOfCells());
+ mcIdType nbOfCell=ToIdType(m2->getNumberOfCells());
_conn_index_for_interp=new int[nbOfCell+1];
const int *conni(m2->getNodalConnectivityIndex()->begin());
std::copy(conni,conni+nbOfCell+1,_conn_index_for_interp);
const MEDCoupling::MEDCoupling1SGTUMesh *m3(dynamic_cast<const MEDCoupling::MEDCoupling1SGTUMesh *>(_mesh));
if(m3)
{
- int nbOfCell(m3->getNumberOfCells()),nbNodesPerCell(m3->getNumberOfNodesPerCell());
+ mcIdType nbOfCell=ToIdType(m3->getNumberOfCells()),nbNodesPerCell(m3->getNumberOfNodesPerCell());
_conn_index_for_interp=new int[nbOfCell+1]; _conn_index_for_interp[0]=0;
int *work(_conn_index_for_interp);
for(int i=0;i<nbOfCell;i++,work++)
int DataArrayPartDefinition::getNumberOfElems() const
{
checkInternalArrayOK();
- return _arr->getNumberOfTuples();
+ return ToIdType(_arr->getNumberOfTuples());
}
PartDefinition *DataArrayPartDefinition::operator+(const PartDefinition& other) const
int MEDCouplingPointSet::getNumberOfNodes() const
{
if(_coords)
- return _coords->getNumberOfTuples();
+ return ToIdType(_coords->getNumberOfTuples());
else
throw INTERP_KERNEL::Exception("Unable to get number of nodes because no coordinates specified !");
}
int MEDCouplingPointSet::getSpaceDimension() const
{
if(_coords)
- return _coords->getNumberOfComponents();
+ return ToIdType(_coords->getNumberOfComponents());
else
throw INTERP_KERNEL::Exception("Unable to get space dimension because no coordinates specified !");
}
if(!_coords)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getCaracteristicDimension : Coordinates not set !");
const double *coords=_coords->getConstPointer();
- int nbOfValues=_coords->getNbOfElems();
+ mcIdType nbOfValues=ToIdType(_coords->getNbOfElems());
return std::abs(*std::max_element(coords,coords+nbOfValues,MEDCouplingCompAbs()));
}
findCommonCells(compType,startCellId,commonCells,commonCellsI);
MCAuto<DataArrayInt> commonCellsTmp(commonCells),commonCellsITmp(commonCellsI);
int newNbOfCells=-1;
- MCAuto<DataArrayInt> ret=DataArrayInt::ConvertIndexArrayToO2N(getNumberOfCells(),commonCells->begin(),commonCellsI->begin(),
+ MCAuto<DataArrayInt> ret=DataArrayInt::ConvertIndexArrayToO2N(ToIdType(getNumberOfCells()),commonCells->begin(),commonCellsI->begin(),
commonCellsI->end(),newNbOfCells);
MCAuto<DataArrayInt> ret2=ret->invertArrayO2N2N2O(newNbOfCells);
MCAuto<MEDCouplingPointSet> self=buildPartOfMySelf(ret2->begin(),ret2->end(),true);
da=m->mergeNodes(prec,areNodesMerged,newNbOfNodes);
//
da=m->zipConnectivityTraducer(cellCompPol);
- int nbCells=getNumberOfCells();
+ mcIdType nbCells=ToIdType(getNumberOfCells());
if (nbCells != other->getNumberOfCells())
throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some cells in other are not in this !");
- int dan(da->getNumberOfTuples());
+ mcIdType dan=ToIdType(da->getNumberOfTuples());
if (dan)
{
MCAuto<DataArrayInt> da1(DataArrayInt::New()),da2(DataArrayInt::New());
if (!da1->isEqualWithoutConsideringStr(*da2))
throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some cells in other are not in this !");
}
- MCAuto<DataArrayInt> cellCor2=da->selectByTupleIdSafeSlice(nbCells,da->getNbOfElems(),1);
- nodeCor=nodeCor2->isIota(nodeCor2->getNumberOfTuples())?0:nodeCor2.retn();
- cellCor=cellCor2->isIota(cellCor2->getNumberOfTuples())?0:cellCor2.retn();
+ MCAuto<DataArrayInt> 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();
}
/*!
{
throw INTERP_KERNEL::Exception("checkDeepEquivalOnSameNodesWith : some cells in other are not in this !");
}
- MCAuto<DataArrayInt> cellCor2=da->selectByTupleIdSafeSlice(getNumberOfCells(),da->getNbOfElems(),1);
- cellCor=cellCor2->isIota(cellCor2->getNumberOfTuples())?0:cellCor2.retn();
+ MCAuto<DataArrayInt> cellCor2=da->selectByTupleIdSafeSlice(ToIdType(getNumberOfCells()),ToIdType(da->getNbOfElems()),1);
+ cellCor=cellCor2->isIota(ToIdType(cellCor2->getNumberOfTuples()))?0:cellCor2.retn();
}
void MEDCouplingPointSet::checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const
const MEDCouplingPointSet *otherC=dynamic_cast<const MEDCouplingPointSet *>(other);
if(!otherC)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::checkFastEquivalWith : fails because other is not a pointset mesh !");
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
if(nbOfCells<1)
return ;
bool status=true;
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
DataArrayDouble *array(srcField->getArray());
- int trgNbOfCompo=targetField->getNumberOfComponents();
+ mcIdType trgNbOfCompo=ToIdType(targetField->getNumberOfComponents());
if(array)
{
srcField->checkConsistencyLight();
std::string revMethod(BuildMethodFrom(trgMeth,srcMeth));
nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,revMethod);
ReverseMatrix(matrixTmp,nbCols,_matrix);
- nbCols=matrixTmp.size();
+ nbCols=ToIdType(matrixTmp.size());
}
else if(srcMeshDim==2 && trgMeshDim==1 && srcSpaceDim==2)
{
std::string revMethod(BuildMethodFrom(trgMeth,srcMeth));
nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,revMethod);
ReverseMatrix(matrixTmp,nbCols,_matrix);
- nbCols=matrixTmp.size();
+ nbCols=ToIdType(matrixTmp.size());
INTERP_KERNEL::Interpolation2D1D::DuplicateFacesType duplicateFaces=interpolation.retrieveDuplicateFaces();
if(!duplicateFaces.empty())
{
std::string revMethod(BuildMethodFrom(trgMeth,srcMeth));
nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,revMethod);
ReverseMatrix(matrixTmp,nbCols,_matrix);
- nbCols=matrixTmp.size();
+ nbCols=ToIdType(matrixTmp.size());
}
else
{
std::string revMethod(BuildMethodFrom(trgMeth,srcMeth));
nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,revMethod);
ReverseMatrix(matrixTmp,nbCols,_matrix);
- nbCols=matrixTmp.size();
+ nbCols=ToIdType(matrixTmp.size());
INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType duplicateFaces=interpolation.retrieveDuplicateFaces();
if(!duplicateFaces.empty())
{
default:
throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareInterpKernelOnlyUC : only dimension 1 2 or 3 supported !");
}
- ReverseMatrix(res,target_mesh->getNumberOfCells(),_matrix);
+ ReverseMatrix(res,ToIdType(target_mesh->getNumberOfCells()),_matrix);
nullifiedTinyCoeffInCrudeMatrixAbs(0.);
//
_deno_multiply.clear();
throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss : The intersection type is not supported ! Only PointLocator is supported for Gauss->Gauss interpolation ! Please invoke setIntersectionType(PointLocator) on the MEDCouplingRemapper instance !");
MCAuto<DataArrayDouble> trgLoc=_target_ft->getLocalizationOfDiscr();
const double *trgLocPtr=trgLoc->begin();
- int trgSpaceDim=trgLoc->getNumberOfComponents();
+ mcIdType trgSpaceDim=ToIdType(trgLoc->getNumberOfComponents());
MCAuto<DataArrayInt> srcOffsetArr=_src_ft->getDiscretization()->getOffsetArr(_src_ft->getMesh());
if(trgSpaceDim!=_src_ft->getMesh()->getSpaceDimension())
{
MCAuto<DataArrayDouble> srcLoc=_src_ft->getLocalizationOfDiscr();
const double *srcLocPtr=srcLoc->begin();
MCAuto<DataArrayInt> eltsArr,eltsIndexArr;
- int trgNbOfGaussPts=trgLoc->getNumberOfTuples();
+ mcIdType trgNbOfGaussPts=ToIdType(trgLoc->getNumberOfTuples());
_matrix.resize(trgNbOfGaussPts);
_src_ft->getMesh()->getCellsContainingPointsLinearPartOnlyOnNonDynType(trgLoc->begin(),trgNbOfGaussPts,getPrecision(),eltsArr,eltsIndexArr);
const int *elts(eltsArr->begin()),*eltsIndex(eltsIndexArr->begin());
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
DataArrayDouble *array(targetField->getArray());
- int srcNbOfCompo(srcField->getNumberOfComponents());
+ mcIdType srcNbOfCompo=ToIdType(srcField->getNumberOfComponents());
if(array)
{
targetField->checkConsistencyLight();
void MEDCouplingRemapper::computeDenoFromScratch(NatureOfField nat, const MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *trgField)
{
_nature_of_deno=nat;
- _time_deno_update=getTimeOfThis();
+ mcIdType _time_deno_update=ToIdType(getTimeOfThis());
switch(_nature_of_deno)
{
case IntensiveMaximum:
const int *corrCellIdSrc, int nbOf2DCellsSrc, int nbOf1DCellsSrc,
const int *corrCellIdTrg)
{
- int nbOf2DCellsTrg=m2D.size();
- int nbOf1DCellsTrg=m1D.size();
+ mcIdType nbOf2DCellsTrg=ToIdType(m2D.size());
+ mcIdType nbOf1DCellsTrg=ToIdType(m1D.size());
int nbOf3DCellsTrg=nbOf2DCellsTrg*nbOf1DCellsTrg;
_matrix.resize(nbOf3DCellsTrg);
int id2R=0;
while (w2 != cP+end)
{
copy(w, w2, work);
- int d = distance(w, w2);
+ int d = ToIdType(distance(w, w2));
cnt += d; work +=d;
idx.push_back(cnt); cnt2++;
w = w2+1; // skip the -1
w2 = find(w, cP+end, -1);
}
copy(w, cP+end, work);
- cnt += distance(w, cP+end);
+ cnt += ToIdType(distance(w, cP+end));
idx.push_back(cnt); cnt2++;
superIdx.push_back(cnt2);
}
cI->alloc(_super_index->getNbOfElems(),1); // same number of super packs as number of cells
int * cIVecP(cI->getPointer());
MCAuto <DataArrayInt> dsi = _index->deltaShiftIndex();
- int sz = dsi->accumulate(0) + dsi->getNbOfElems(); // think about it: one slot for the type, -1 at the end of each face of the cell
+ int sz = dsi->accumulate(0) + ToIdType(dsi->getNbOfElems()); // think about it: one slot for the type, -1 at the end of each face of the cell
c->alloc(sz, 1);
int * cVecP(c->getPointer());
{
super_index->alloc(2,1);
super_index->setIJSilent(0,0,0);
- super_index->setIJSilent(1,0,_index->getNbOfElems()-1);
+ super_index->setIJSilent(1,0,ToIdType(_index->getNbOfElems())-1);
}
oss << " Nb of packs: " << getNumberOf() << std::endl;
oss << " Nb of values: " << getLength() << std::endl;
checkSuperIndex("findPackIds");
- int packSz = std::distance(packBg, packEnd);
+ mcIdType packSz = ToIdType(std::distance(packBg, packEnd));
if (!packSz)
throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::findPackIds: void pack!");
_values->reAlloc(_values->getNbOfElems() - (end-start));
// _index
- int nt = _index->getNbOfElems();
+ mcIdType nt = ToIdType(_index->getNbOfElems());
std::copy(iP+siP[superIdx]+idx+1, iP+nt, iP+siP[superIdx]+idx);
_index->reAlloc(nt-1); iP = _index->getPointer(); // better not forget this ...
for(int ii = siP[superIdx]+idx; ii < nt-1; ii++)
const int start(iP[idx]), end(iP[idx+1]);
// _values
- int initValSz( _values->getNbOfElems() );
+ mcIdType initValSz=ToIdType(_values->getNbOfElems());
int deltaSz( start-end ); // should be negative
int *vP(_values->getPointer());
if (deltaSz < 0)
else
throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::deleteSimplePack");
// _index
- int nt(_index->getNbOfElems());
+ mcIdType nt=ToIdType(_index->getNbOfElems());
std::copy(iP+idx+1, iP+nt, iP+idx);
for(int ii = idx; ii < nt-1; ii++)
iP[ii] += deltaSz;
*iP = 0;
for (std::deque< std::set<int> >::const_iterator values=valuesByIdx.begin();values!=valuesByIdx.end();values++)
{
- valSz += (*values).size();
+ valSz += ToIdType((*values).size());
*(++iP) = valSz;
}
_values->reAlloc(valSz);
// _values
int* iP(_index->getPointer());
- int initValSz = _values->getNbOfElems();
+ mcIdType initValSz = ToIdType(_values->getNbOfElems());
int *vP(_values->getPointer());
int end_prec(0),start_prec(0);
for(std::set<int>::const_iterator ii=packsToDelete.begin();ii!=packsToDelete.end();ii++)
_values->reAlloc(initValSz-(end_prec-start_prec));
// _index
- int nt = _index->getNbOfElems();
+ mcIdType nt = ToIdType(_index->getNbOfElems());
int offset = 0;
end_prec = 0;
start_prec = 0;
validSuperIndex("pushBackPack", superIdx);
int *siP(_super_index->getPointer()), *iP(_index->getPointer());
- const int sz(distance(packBg, packEnd));
+ const int sz(ToIdType(distance(packBg, packEnd)));
// _values
_values->reAlloc(_values->getNbOfElems()+sz);
copy(packBg, packEnd, vP+iP[siP[superIdx+1]]);
// _index
- int nt = _index->getNbOfElems();
+ mcIdType nt = ToIdType(_index->getNbOfElems());
_index->reAlloc(nt+1); iP = _index->getPointer();
copy(iP+siP[superIdx+1]+1, iP+nt, iP+siP[superIdx+1]+2);
iP[siP[superIdx+1]+1] = iP[siP[superIdx+1]] + sz;
validIndex("replaceSimplePack", idx);
int * iP(_index->getPointer());
- int newSz = std::distance(packBg, packEnd);
+ mcIdType newSz = ToIdType(std::distance(packBg, packEnd));
const int start = iP[idx], end = iP[idx+1];
// _values
- int initValSz = _values->getNbOfElems();
+ mcIdType initValSz = ToIdType(_values->getNbOfElems());
int deltaSz = newSz-(end-start); // can be negative
if (deltaSz)
{
validSuperIndexAndIndex("replacePack", superIdx, idx);
int * siP(_super_index->getPointer()), *iP(_index->getPointer());
- int newSz = std::distance(packBg, packEnd);
+ mcIdType newSz = ToIdType(std::distance(packBg, packEnd));
const int start = iP[siP[superIdx]+idx], end = iP[siP[superIdx]+idx+1];
// _values
- int initValSz = _values->getNbOfElems();
+ mcIdType initValSz = ToIdType(_values->getNbOfElems());
int deltaSz = newSz-(end-start); // can be negative
if (deltaSz)
{
void set( DataArrayInt* index, DataArrayInt* value );
void set3( DataArrayInt* superIndex, DataArrayInt* index, DataArrayInt* value );
- int getSuperNumberOf() const { return _super_index->getNbOfElems()-1; }
- int getNumberOf() const { return _index->getNbOfElems()-1; }
- int getLength() const { return _values->getNbOfElems(); }
+ mcIdType getSuperNumberOf() const { return ToIdType(_super_index->getNbOfElems())-1; }
+ mcIdType getNumberOf() const { return ToIdType(_index->getNbOfElems())-1; }
+ mcIdType getLength() const { return ToIdType(_values->getNbOfElems()); }
const int* getSuperIndex() const { return _super_index->begin(); }
const int* getIndex() const { return _index->begin(); }
DataArrayInt *MEDCouplingStructuredMesh::computeNbOfNodesPerCell() const
{
- int nbCells=getNumberOfCells();
+ std::size_t nbCells=getNumberOfCells();
MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbCells,1);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(getTypeOfCell(0));
DataArrayInt *MEDCouplingStructuredMesh::computeNbOfFacesPerCell() const
{
- int nbCells=getNumberOfCells();
+ std::size_t nbCells=getNumberOfCells();
MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbCells,1);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(getTypeOfCell(0));
getSplitCellValues(tmpCell);
getSplitNodeValues(tmpNode);
int tmp2[3];
- GetPosFromId(cellId,meshDim,tmpCell,tmp2);
+ GetPosFromId(ToIdType(cellId),meshDim,tmpCell,tmp2);
switch(meshDim)
{
case 1:
//only one type of cell
std::vector<int> ret(3);
ret[0]=getTypeOfCell(0);
- ret[1]=getNumberOfCells();
+ ret[1]=ToIdType(getNumberOfCells());
ret[2]=-1; //ret[3*k+2]==-1 because it has no sense here
return ret;
}
*/
DataArrayInt *MEDCouplingStructuredMesh::checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const
{
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
if(code.size()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::checkTypeConsistencyAndContig : invalid input code should be exactly of size 3 !");
if(code[0]!=(int)getTypeOfCell(0))
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::splitProfilePerType : input profile is NULL or not allocated !");
if(profile->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::splitProfilePerType : input profile should have exactly one component !");
- int nbTuples(profile->getNumberOfTuples());
- int nbOfCells=getNumberOfCells();
+ mcIdType nbTuples=ToIdType(profile->getNumberOfTuples());
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
code.resize(3); idsInPflPerType.resize(1);
code[0]=(int)getTypeOfCell(0); code[1]=nbOfCells;
idsInPflPerType.resize(1);
idsPerType.clear();
return ;
}
- code[1]=profile->getNumberOfTuples();
+ code[1]=ToIdType(profile->getNumberOfTuples());
code[2]=0;
profile->checkAllIdsInRange(0,nbOfCells);
idsPerType.resize(1);
throw INTERP_KERNEL::Exception("Expected a MEDCouplingStructuredMesh with meshDim == 2 !");
MCAuto<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME));
MCAuto<DataArrayDouble> array(DataArrayDouble::New());
- int nbOfCells(getNumberOfCells());
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
array->alloc(nbOfCells,3);
double *vals(array->getPointer());
for(int i=0;i<nbOfCells;i++)
DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity1D(const int *nodeStBg)
{
- std::size_t nbOfCells(*nodeStBg-1);
+ mcIdType nbOfCells=*nodeStBg-1;
MCAuto<DataArrayInt> conn(DataArrayInt::New());
conn->alloc(2*nbOfCells,1);
int *cp=conn->getPointer();
- for(std::size_t i=0;i<nbOfCells;i++)
+ for(mcIdType i=0;i<nbOfCells;i++)
{
cp[2*i+0]=i;
cp[2*i+1]=i+1;
DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity2D(const int *nodeStBg)
{
- std::size_t n1(nodeStBg[0]-1),n2(nodeStBg[1]-1);
+ mcIdType n1(nodeStBg[0]-1),n2(nodeStBg[1]-1);
MCAuto<DataArrayInt> conn(DataArrayInt::New());
conn->alloc(4*n1*n2,1);
int *cp(conn->getPointer());
std::size_t pos(0);
- for(std::size_t j=0;j<n2;j++)
- for(std::size_t i=0;i<n1;i++,pos++)
+ for(mcIdType j=0;j<n2;j++)
+ for(mcIdType i=0;i<n1;i++,pos++)
{
cp[4*pos+0]=i+1+j*(n1+1);
cp[4*pos+1]=i+j*(n1+1);
DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity3D(const int *nodeStBg)
{
- std::size_t n1(nodeStBg[0]-1),n2(nodeStBg[1]-1),n3(nodeStBg[2]-1);
+ mcIdType n1(nodeStBg[0]-1),n2(nodeStBg[1]-1),n3(nodeStBg[2]-1);
MCAuto<DataArrayInt> conn(DataArrayInt::New());
conn->alloc(8*n1*n2*n3,1);
int *cp(conn->getPointer());
std::size_t pos(0);
- for(std::size_t k=0;k<n3;k++)
- for(std::size_t j=0;j<n2;j++)
- for(std::size_t i=0;i<n1;i++,pos++)
+ for(mcIdType k=0;k<n3;k++)
+ for(mcIdType j=0;j<n2;j++)
+ for(mcIdType i=0;i<n1;i++,pos++)
{
int tmp=(n1+1)*(n2+1);
cp[8*pos+0]=i+1+j*(n1+1)+k*tmp;
if(fieldOfDbl->getNumberOfTuples()!=DeduceNumberOfGivenStructure(st))
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom : invalid size of input array of double regarding the structure !");
std::vector<int> dims(GetDimensionsFromCompactFrmt(partCompactFormat));
- int nbOfTuplesOfOutField(DeduceNumberOfGivenStructure(dims)),nbComp(fieldOfDbl->getNumberOfComponents());
+ int nbOfTuplesOfOutField(DeduceNumberOfGivenStructure(dims)),nbComp(ToIdType(fieldOfDbl->getNumberOfComponents()));
MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfTuplesOfOutField,nbComp);
ret->copyStringInfoFrom(*fieldOfDbl);
double *ptRet(ret->getPointer());
*/
void MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(const std::vector<int>& st, DataArrayDouble *fieldOfDbl, const std::vector< std::pair<int,int> >& partCompactFormat, const DataArrayDouble *other)
{//to be optimized
- std::vector<int> facts(st.size(),1.);
+ std::vector<int> facts(st.size(),1);
MEDCouplingIMesh::CondenseFineToCoarse(st,other,partCompactFormat,facts,fieldOfDbl);
}
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::MultiplyPartOf : invalid input range 3 !");
dims[i]=part[i].second-part[i].first;
}
- int nbOfTuplesExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(st)),nbCompo(da->getNumberOfComponents());
+ int nbOfTuplesExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(st)),nbCompo(ToIdType(da->getNumberOfComponents()));
if(da->getNumberOfTuples()!=nbOfTuplesExp)
{
std::ostringstream oss; oss << "MEDCouplingStructuredMesh::MultiplyPartOf : invalid nb of tuples ! Expected " << nbOfTuplesExp << " having " << da->getNumberOfTuples() << " !";
tinyInfo.push_back(_end.getOrder());
if(_end_array)
{
- tinyInfo.push_back(_end_array->getNumberOfTuples());
- tinyInfo.push_back(_end_array->getNumberOfComponents());
+ tinyInfo.push_back(ToIdType(_end_array->getNumberOfTuples()));
+ tinyInfo.push_back(ToIdType(_end_array->getNumberOfComponents()));
}
else
{
void MEDCouplingTwoTimeSteps::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
{
- int nbOfCompo=_array->getNumberOfComponents();
+ mcIdType nbOfCompo=ToIdType(_array->getNumberOfComponents());
for(int i=0;i<nbOfCompo;i++)
tinyInfo.push_back(_array->getInfoOnComponent(i));
for(int i=0;i<nbOfCompo;i++)
return true;
if(_end_array==0 || otherC->_end_array==0)
return false;
- int nbC1=_end_array->getNumberOfComponents();
- int nbC2=otherC->_end_array->getNumberOfComponents();
+ std::size_t nbC1=_end_array->getNumberOfComponents();
+ std::size_t nbC2=otherC->_end_array->getNumberOfComponents();
if(nbC1!=nbC2 && nbC2!=1)
return false;
return true;
void MEDCouplingLinearTime::getValueOnTime(int eltId, double time, double *value) const
{
double alpha=(_end.getTimeValue()-time)/(_end.getTimeValue()-_start.getTimeValue());
- int nbComp;
if(_array)
_array->getTuple(eltId,value);
else
throw INTERP_KERNEL::Exception("No start array existing.");
- nbComp=_array->getNumberOfComponents();
+ mcIdType nbComp=ToIdType(_array->getNumberOfComponents());
std::transform(value,value+nbComp,value,std::bind2nd(std::multiplies<double>(),alpha));
std::vector<double> tmp(nbComp);
if(_end_array)
return true;
if(_array==0 || other->_array==0)
return false;
- int nbC1(_array->getNumberOfComponents()),nbC2(other->_array->getNumberOfComponents());
- int nbMin(std::min(nbC1,nbC2));
+ std::size_t nbC1(_array->getNumberOfComponents()),nbC2(other->_array->getNumberOfComponents());
+ std::size_t nbMin(std::min(nbC1,nbC2));
if(nbC1!=nbC2 && nbMin!=1)
return false;
return true;
return true;
if(_array==0 || other->_array==0)
return false;
- int nbC1(_array->getNumberOfComponents()),nbC2(other->_array->getNumberOfComponents());
+ std::size_t nbC1(_array->getNumberOfComponents()),nbC2(other->_array->getNumberOfComponents());
if(nbC1!=nbC2 && nbC2!=1)
return false;
return true;
{
if(_array)
{
- tinyInfo.push_back(_array->getNumberOfTuples());
- tinyInfo.push_back(_array->getNumberOfComponents());
+ tinyInfo.push_back(ToIdType(_array->getNumberOfTuples()));
+ tinyInfo.push_back(ToIdType(_array->getNumberOfComponents()));
}
else
{
template<class T>
void MEDCouplingTimeDiscretizationTemplate<T>::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
{
- int nbOfCompo(_array->getNumberOfComponents());
+ mcIdType nbOfCompo=ToIdType(_array->getNumberOfComponents());
for(int i=0;i<nbOfCompo;i++)
tinyInfo.push_back(_array->getInfoOnComponent(i));
}
void MEDCouplingTimeDiscretizationTemplate<T>::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
{
_time_tolerance=tinyInfoD[0];
- int nbOfCompo=_array->getNumberOfComponents();
+ mcIdType nbOfCompo=ToIdType(_array->getNumberOfComponents());
for(int i=0;i<nbOfCompo;i++)
_array->setInfoOnComponent(i,tinyInfoS[i]);
}
return ;
int meshDim=getMeshDimension();
int nbOfNodes=getNumberOfNodes();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
const int *ptr=_nodal_connec->getConstPointer();
const int *ptrI=_nodal_connec_index->getConstPointer();
for(int i=0;i<nbOfCells;i++)
{
std::vector<INTERP_KERNEL::NormalizedCellType> ret;
checkConnectivityFullyDefined();
- int nbOfCells(getNumberOfCells());
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
if(nbOfCells==0)
return ret;
if(getNodalConnectivityArrayLen()<1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getAllGeoTypesSorted : the connectivity in this seems invalid !");
const int *c(_nodal_connec->begin()),*ci(_nodal_connec_index->begin());
ret.push_back((INTERP_KERNEL::NormalizedCellType)c[*ci++]);
- for(int i=1;i<nbOfCells;i++,ci++)
+ for(mcIdType i=1;i<nbOfCells;i++,ci++)
if(ret.back()!=((INTERP_KERNEL::NormalizedCellType)c[*ci]))
ret.push_back((INTERP_KERNEL::NormalizedCellType)c[*ci]);
return ret;
revNodalIndx->useArray(revNodalIndxPtr,true,DeallocType::C_DEALLOC,nbOfNodes+1,1);
std::fill(revNodalIndxPtr,revNodalIndxPtr+nbOfNodes+1,0);
const int *conn(_nodal_connec->begin()),*connIndex(_nodal_connec_index->begin());
- int nbOfCells(getNumberOfCells()),nbOfEltsInRevNodal(0);
- for(int eltId=0;eltId<nbOfCells;eltId++)
+ mcIdType nbOfCells(ToIdType(getNumberOfCells())),nbOfEltsInRevNodal(0);
+ for(mcIdType eltId=0;eltId<nbOfCells;eltId++)
{
const int *strtNdlConnOfCurCell(conn+connIndex[eltId]+1),*endNdlConnOfCurCell(conn+connIndex[eltId+1]);
for(const int *iter=strtNdlConnOfCurCell;iter!=endNdlConnOfCurCell;iter++)
nodeNeigh->checkNbOfComps(1,"MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne : node neigh");
nodeNeighI->checkNbOfComps(1,"MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne : node neigh index");
nodeNeighI->checkNbOfTuples(1+getNumberOfNodes(),"MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne : invalid length");
- int nbCells(getNumberOfCells());
+ mcIdType nbCells=ToIdType(getNumberOfCells());
const int *c(_nodal_connec->begin()),*ci(_nodal_connec_index->begin()),*ne(nodeNeigh->begin()),*nei(nodeNeighI->begin());
cellNeigh=DataArrayInt::New(); cellNeigh->alloc(0,1); cellNeighIndex=DataArrayInt::New(); cellNeighIndex->alloc(1,1); cellNeighIndex->setIJ(0,0,0);
- for(int i=0;i<nbCells;i++)
+ for(mcIdType i=0;i<nbCells;i++)
{
std::set<int> s;
for(const int *it=c+ci[i]+1;it!=c+ci[i+1];it++)
s.insert(ne+nei[*it],ne+nei[*it+1]);
s.erase(i);
cellNeigh->insertAtTheEnd(s.begin(),s.end());
- cellNeighIndex->pushBackSilent(cellNeigh->getNumberOfTuples());
+ cellNeighIndex->pushBackSilent(ToIdType(cellNeigh->getNumberOfTuples()));
}
}
const int *revDescPtr=revDesc->begin();
const int *revDescIPtr=revDescIndx->begin();
//
- int nbCells=descIndx->getNumberOfTuples()-1;
+ mcIdType nbCells=ToIdType(descIndx->getNumberOfTuples())-1;
MCAuto<DataArrayInt> out0=DataArrayInt::New();
MCAuto<DataArrayInt> out1=DataArrayInt::New(); out1->alloc(nbCells+1,1);
int *out1Ptr=out1->getPointer();
s.erase(i);
out0->insertAtTheEnd(s.begin(),s.end());
}
- *out1Ptr=out0->getNumberOfTuples();
+ *out1Ptr=ToIdType(out0->getNumberOfTuples());
}
neighbors=out0.retn();
neighborsIndx=out1.retn();
checkFullyDefined();
int nbOfNodes(getNumberOfNodes());
const int *conn(_nodal_connec->begin()),*connIndex(_nodal_connec_index->begin());
- int nbOfCells(getNumberOfCells());
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
std::vector< std::set<int> > st0(nbOfNodes);
for(int eltId=0;eltId<nbOfCells;eltId++)
{
if ((*it).empty())
neighIdx[1]=neighIdx[0];
else
- neighIdx[1]=neighIdx[0]+(*it).size()-1;
+ neighIdx[1]=neighIdx[0]+ToIdType((*it).size())-1;
}
}
neighbors=DataArrayInt::New(); neighbors->alloc(neighborsIdx->back(),1);
int dim=getMeshDimension();
if(dim<2 || dim>3)
throw INTERP_KERNEL::Exception("Invalid mesh dimension : must be 2 or 3 !");
- int nbOfCells(getNumberOfCells());
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
if(dim==2)
{
const int *connIndex=_nodal_connec_index->begin();
*/
void MEDCouplingUMesh::convertAllToPoly()
{
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
std::vector<int> cellIds(nbOfCells);
- for(int i=0;i<nbOfCells;i++)
+ for(mcIdType i=0;i<nbOfCells;i++)
cellIds[i]=i;
- convertToPolyTypes(&cellIds[0],&cellIds[0]+cellIds.size());
+ convertToPolyTypes(&cellIds[0],&cellIds[0]+ToIdType(cellIds.size()));
}
/*!
checkFullyDefined();
if(getMeshDimension()!=3 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertExtrudedPolyhedra works on umeshes with meshdim equal to 3 and spaceDim equal to 3 too!");
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
MCAuto<DataArrayInt> newCi=DataArrayInt::New();
newCi->alloc(nbOfCells+1,1);
int *newci=newCi->getPointer();
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::unPolyze works on umeshes with meshdim equals to 0, 1 2 or 3 !");
if(mdim<=1)
return false;
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
if(nbOfCells<1)
return false;
int initMeshLgth=getNodalConnectivityArrayLen();
MCAuto<DataArrayDouble> coords=getCoords()->deepCopy();
coords->recenterForMaxPrecision(eps);
//
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
const int *conn=_nodal_connec->getConstPointer();
const int *index=_nodal_connec_index->getConstPointer();
MCAuto<DataArrayInt> connINew=DataArrayInt::New();
}
else
connNew->insertAtTheEnd(conn+index[i],conn+index[i+1]);
- *connINewPtr=connNew->getNumberOfTuples();
+ *connINewPtr=ToIdType(connNew->getNumberOfTuples());
}
if(changed)
setConnectivity(connNew,connINew,false);
*/
void MEDCouplingUMesh::computeNodeIdsAlg(std::vector<bool>& nodeIdsInUse) const
{
- int nbOfNodes((int)nodeIdsInUse.size()),nbOfCells(getNumberOfCells());
+ mcIdType nbOfNodes=ToIdType(nodeIdsInUse.size()),
+ nbOfCells=ToIdType(getNumberOfCells());
const int *connIndex(_nodal_connec_index->getConstPointer()),*conn(_nodal_connec->getConstPointer());
for(int i=0;i<nbOfCells;i++)
for(int j=connIndex[i]+1;j<connIndex[i+1];j++)
ret->alloc(nbOfNodes,1);
int *traducer=ret->getPointer();
std::fill(traducer,traducer+nbOfNodes,-1);
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
const int *connIndex=_nodal_connec_index->getConstPointer();
const int *conn=_nodal_connec->getConstPointer();
for(int i=0;i<nbOfCells;i++)
DataArrayInt *MEDCouplingUMesh::computeNbOfNodesPerCell() const
{
checkConnectivityFullyDefined();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfCells,1);
int *retPtr=ret->getPointer();
if(conn[connI[i]]!=(int)INTERP_KERNEL::NORM_POLYHED)
*retPtr=connI[i+1]-connI[i]-1;
else
- *retPtr=connI[i+1]-connI[i]-1-std::count(conn+connI[i]+1,conn+connI[i+1],-1);
+ *retPtr=connI[i+1]-connI[i]-1-ToIdType(std::count(conn+connI[i]+1,conn+connI[i+1],-1));
}
return ret.retn();
}
DataArrayInt *MEDCouplingUMesh::computeEffectiveNbOfNodesPerCell() const
{
checkConnectivityFullyDefined();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfCells,1);
int *retPtr=ret->getPointer();
DataArrayInt *MEDCouplingUMesh::computeNbOfFacesPerCell() const
{
checkConnectivityFullyDefined();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfCells,1);
int *retPtr=ret->getPointer();
DataArrayInt *& commonCellsArr, DataArrayInt *& commonCellsIArr)
{
MCAuto<DataArrayInt> commonCells=DataArrayInt::New(),commonCellsI=DataArrayInt::New(); commonCells->alloc(0,1);
- int nbOfCells=nodalI->getNumberOfTuples()-1;
+ mcIdType nbOfCells=ToIdType(nodalI->getNumberOfTuples())-1;
commonCellsI->reserve(1); commonCellsI->pushBackSilent(0);
const int *revNodalPtr=revNodal->getConstPointer(),*revNodalIPtr=revNodalI->getConstPointer();
const int *connPtr=nodal->getConstPointer(),*connIPtr=nodalI->getConstPointer();
if(AreCellsEqualInPool(v2,compType,connPtr,connIPtr,commonCells))
{
int pos=commonCellsI->back();
- commonCellsI->pushBackSilent(commonCells->getNumberOfTuples());
+ commonCellsI->pushBackSilent(ToIdType(commonCells->getNumberOfTuples()));
for(const int *it=commonCells->begin()+pos;it!=commonCells->end();it++)
isFetched[*it]=true;
}
if(AreCellsEqualInPool(v2,compType,connPtr,connIPtr,commonCells))
{
int pos=commonCellsI->back();
- commonCellsI->pushBackSilent(commonCells->getNumberOfTuples());
+ commonCellsI->pushBackSilent(ToIdType(commonCells->getNumberOfTuples()));
for(const int *it=commonCells->begin()+pos;it!=commonCells->end();it++)
isFetched[*it]=true;
}
bool MEDCouplingUMesh::areCellsIncludedIn(const MEDCouplingUMesh *other, int compType, DataArrayInt *& arr) const
{
MCAuto<MEDCouplingUMesh> mesh=MergeUMeshesOnSameCoords(this,other);
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
static const int possibleCompType[]={0,1,2};
if(std::find(possibleCompType,possibleCompType+sizeof(possibleCompType)/sizeof(int),compType)==possibleCompType+sizeof(possibleCompType)/sizeof(int))
{
{
MCAuto<MEDCouplingUMesh> mesh=MergeUMeshesOnSameCoords(this,other);
DataArrayInt *commonCells=0,*commonCellsI=0;
- int thisNbCells=getNumberOfCells();
+ mcIdType thisNbCells=ToIdType(getNumberOfCells());
mesh->findCommonCells(7,thisNbCells,commonCells,commonCellsI);
MCAuto<DataArrayInt> commonCellsTmp(commonCells),commonCellsITmp(commonCellsI);
const int *commonCellsPtr=commonCells->getConstPointer(),*commonCellsIPtr=commonCellsI->getConstPointer();
- int otherNbCells=other->getNumberOfCells();
+ mcIdType otherNbCells=ToIdType(other->getNumberOfCells());
MCAuto<DataArrayInt> arr2=DataArrayInt::New();
arr2->alloc(otherNbCells,1);
arr2->fillWithZero();
int *arr2Ptr=arr2->getPointer();
- int nbOfCommon=commonCellsI->getNumberOfTuples()-1;
+ mcIdType nbOfCommon=ToIdType(commonCellsI->getNumberOfTuples())-1;
for(int i=0;i<nbOfCommon;i++)
{
int start=commonCellsPtr[commonCellsIPtr[i]];
std::ostringstream oss; oss << "MEDCouplingUMesh::setPartOfMySelfSlice : cells ids length (" << nbOfCellsToModify << ") do not match the number of cells of other mesh (" << otherOnSameCoordsThanThis.getNumberOfCells() << ") !";
throw INTERP_KERNEL::Exception(oss.str());
}
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
bool easyAssign=true;
const int *connI=_nodal_connec_index->getConstPointer();
const int *connIOther=otherOnSameCoordsThanThis._nodal_connec_index->getConstPointer();
revDesc->decrRef();
desc->decrRef();
descIndx->decrRef();
- int nbOfCells=meshDM1->getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(meshDM1->getNumberOfCells());
const int *revDescIndxC=revDescIndx->getConstPointer();
std::vector<int> boundaryCells;
for(int i=0;i<nbOfCells;i++)
MCAuto<DataArrayInt> faceIds=tmp->findIdsEqual(1); tmp=(DataArrayInt*)0;
const int *revDescPtr=revDesc->getConstPointer();
const int *revDescIndxPtr=revDescIndx->getConstPointer();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
std::vector<bool> ret1(nbOfCells,false);
int sz=0;
for(const int *pt=faceIds->begin();pt!=faceIds->end();pt++)
dnu1=0;dnu2=0;dnu3=0;dnu4=0;
DataArrayInt * corresp=0;
meshM2->areCellsIncludedIn(m0descSkinDesc,2,corresp);
- DAInt validIds = corresp->findIdsInRange(0, meshM2->getNumberOfCells());
+ DAInt validIds = corresp->findIdsInRange(0, ToIdType(meshM2->getNumberOfCells()));
corresp->decrRef();
if (validIds->getNumberOfTuples())
{
//
MCUMesh m0Part2=static_cast<MEDCouplingUMesh *>(buildPartOfMySelf(cellsAroundGroup->begin(),cellsAroundGroup->end(),true));
- int nCells2 = m0Part2->getNumberOfCells();
+ mcIdType nCells2 = ToIdType(m0Part2->getNumberOfCells());
DAInt desc00=DataArrayInt::New(),descI00=DataArrayInt::New(),revDesc00=DataArrayInt::New(),revDescI00=DataArrayInt::New();
MCUMesh m01=m0Part2->buildDescendingConnectivity(desc00,descI00,revDesc00,revDescI00);
if (nIter >= nIterMax)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::findNodesToDuplicate(): internal error - too many iterations.");
- DAInt cellsToModifyConn1_torenum=cellsToModifyConn0_torenum->buildComplement(neighI00->getNumberOfTuples()-1);
+ DAInt cellsToModifyConn1_torenum=cellsToModifyConn0_torenum->buildComplement(ToIdType(neighI00->getNumberOfTuples())-1);
cellsToModifyConn0_torenum->transformWithIndArr(cellsAroundGroup->begin(),cellsAroundGroup->end());
cellsToModifyConn1_torenum->transformWithIndArr(cellsAroundGroup->begin(),cellsAroundGroup->end());
//
checkConnectivityFullyDefined();
int *conn(getNodalConnectivity()->getPointer());
const int *connIndex(getNodalConnectivityIndex()->getConstPointer());
- int nbOfCells(getNumberOfCells());
- for(int i=0;i<nbOfCells;i++)
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
+ for(mcIdType i=0;i<nbOfCells;i++)
for(int iconn=connIndex[i]+1;iconn!=connIndex[i+1];iconn++)
{
int& node=conn[iconn];
checkConnectivityFullyDefined();
int *conn=getNodalConnectivity()->getPointer();
const int *connIndex=getNodalConnectivityIndex()->getConstPointer();
- int nbOfCells(getNumberOfCells());
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
for(int i=0;i<nbOfCells;i++)
for(int iconn=connIndex[i]+1;iconn!=connIndex[i+1];iconn++)
{
checkConnectivityFullyDefined();
int *conn=getNodalConnectivity()->getPointer();
const int *connIndex=getNodalConnectivityIndex()->getConstPointer();
- int nbOfCells=getNumberOfCells();
- for(int i=0;i<nbOfCells;i++)
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
+ for(mcIdType i=0;i<nbOfCells;i++)
for(int iconn=connIndex[i]+1;iconn!=connIndex[i+1];iconn++)
{
int& node=conn[iconn];
m[*work]=val;
int *conn=getNodalConnectivity()->getPointer();
const int *connIndex=getNodalConnectivityIndex()->getConstPointer();
- int nbOfCells=getNumberOfCells();
- for(int i=0;i<nbOfCells;i++)
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
+ for(mcIdType i=0;i<nbOfCells;i++)
for(int iconn=connIndex[i]+1;iconn!=connIndex[i+1];iconn++)
{
int& node=conn[iconn];
void MEDCouplingUMesh::renumberCells(const int *old2NewBg, bool check)
{
checkConnectivityFullyDefined();
- int nbCells=getNumberOfCells();
+ mcIdType nbCells=ToIdType(getNumberOfCells());
const int *array=old2NewBg;
if(check)
array=DataArrayInt::CheckAndPreparePermutation(old2NewBg,old2NewBg+nbCells);
const int* conn = getNodalConnectivity()->getConstPointer();
const int* conn_index= getNodalConnectivityIndex()->getConstPointer();
const double* coords = getCoords()->getConstPointer();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
for ( int ielem=0; ielem<nbOfCells;ielem++ )
{
for (int i=0; i<dim; i++)
const int* conn = getNodalConnectivity()->getConstPointer();
const int* conn_index= getNodalConnectivityIndex()->getConstPointer();
const double* coords = getCoords()->getConstPointer();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
for ( int ielem=0; ielem<nbOfCells;ielem++ )
{
for (int i=0; i<dim; i++)
MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(0,1);
checkConnectivityFullyDefined();
- int nbCells=getNumberOfCells();
+ mcIdType nbCells=ToIdType(getNumberOfCells());
int mdim=getMeshDimension();
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
if(mdim!=(int)cm.getDimension())
*/
int MEDCouplingUMesh::getNodalConnectivityArrayLen() const
{
- return _nodal_connec->getNbOfElems();
+ return ToIdType(_nodal_connec->getNbOfElems());
}
/*!
void MEDCouplingUMesh::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const
{
MEDCouplingPointSet::getTinySerializationInformation(tinyInfoD,tinyInfo,littleStrings);
- tinyInfo.push_back(getMeshDimension());
- tinyInfo.push_back(getNumberOfCells());
+ tinyInfo.push_back(ToIdType(getMeshDimension()));
+ tinyInfo.push_back(ToIdType(getNumberOfCells()));
if(_nodal_connec)
tinyInfo.push_back(getNodalConnectivityArrayLen());
else
{
std::string name="MeasureOfMesh_";
name+=getName();
- int nbelem=getNumberOfCells();
+ mcIdType nbelem=ToIdType(getNumberOfCells());
MCAuto<MEDCouplingFieldDouble> field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
field->setName(name);
MCAuto<DataArrayDouble> array=DataArrayDouble::New();
throw INTERP_KERNEL::Exception("Expected a umesh with ( meshDim == 2 spaceDim == 2 or 3 ) or ( meshDim == 1 spaceDim == 2 ) !");
MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
MCAuto<DataArrayDouble> array=DataArrayDouble::New();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
int nbComp=getMeshDimension()+1;
array->alloc(nbOfCells,nbComp);
double *vals=array->getPointer();
throw INTERP_KERNEL::Exception("Expected a umesh with only NORM_SEG2 type of elements for buildDirectionVectorField !");
MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
MCAuto<DataArrayDouble> array=DataArrayDouble::New();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
int spaceDim=getSpaceDimension();
array->alloc(nbOfCells,spaceDim);
double *pt=array->getPointer();
for(const int *it=cellIds1D->begin();it!=cellIds1D->end();it++)
cut3DCurve[*it]=-1;
mDesc1->split3DCurveWithPlane(origin,vec,eps,cut3DCurve);
- int ncellsSub=subMesh->getNumberOfCells();
+ mcIdType ncellsSub=ToIdType(subMesh->getNumberOfCells());
std::vector< std::pair<int,int> > cut3DSurf(ncellsSub);
AssemblyForSplitFrom3DCurve(cut3DCurve,nodes,subMesh->getNodalConnectivity()->getConstPointer(),subMesh->getNodalConnectivityIndex()->getConstPointer(),
mDesc1->getNodalConnectivity()->getConstPointer(),mDesc1->getNodalConnectivityIndex()->getConstPointer(),
if(cut3DSurf[i].first!=-2)
{
conn->pushBackSilent((int)INTERP_KERNEL::NORM_SEG2); conn->pushBackSilent(cut3DSurf[i].first); conn->pushBackSilent(cut3DSurf[i].second);
- connI->pushBackSilent(conn->getNumberOfTuples());
+ connI->pushBackSilent(ToIdType(conn->getNumberOfTuples()));
cellIds2->pushBackSilent(i);
}
else
for(int j=0;j<nbOfEdges;j++)
{
conn->pushBackSilent((int)INTERP_KERNEL::NORM_SEG2); conn->pushBackSilent(nodal[offset+j]); conn->pushBackSilent(nodal[offset+(j+1)%nbOfEdges]);
- connI->pushBackSilent(conn->getNumberOfTuples());
+ connI->pushBackSilent(ToIdType(conn->getNumberOfTuples()));
cellIds2->pushBackSilent(cellId3DSurf);
}
}
{
conn->pushBackSilent((int)INTERP_KERNEL::NORM_POLYGON);
conn->insertAtTheEnd(res[i].begin(),res[i].end());
- connI->pushBackSilent(conn->getNumberOfTuples());
+ connI->pushBackSilent(ToIdType(conn->getNumberOfTuples()));
}
MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::New("",2));
ret->setCoords(mDesc1->getCoords());
ret->setConnectivity(conn,connI,true);
- int nbCellsRet(ret->getNumberOfCells());
+ mcIdType nbCellsRet(ToIdType(ret->getNumberOfCells()));
//
MCAuto<DataArrayDouble> vec2(DataArrayDouble::New()); vec2->alloc(1,3); std::copy(vec,vec+3,vec2->getPointer());
MCAuto<MEDCouplingFieldDouble> ortho(ret->buildOrthogonalField());
}
}
conn2->insertAtTheEnd(cell0.begin(),cell0.end());
- conn2I->pushBackSilent(conn2->getNumberOfTuples());
+ conn2I->pushBackSilent(ToIdType(conn2->getNumberOfTuples()));
conn2->insertAtTheEnd(cell1.begin(),cell1.end());
- conn2I->pushBackSilent(conn2->getNumberOfTuples());
+ conn2I->pushBackSilent(ToIdType(conn2->getNumberOfTuples()));
ret2->setConnectivity(conn2,conn2I,true);
ret2->checkConsistencyLight();
ret2->orientCorrectlyPolyhedrons();
MCAuto<DataArrayDouble> coo=_coords->deepCopy();
double normm2(sqrt(vec2[0]*vec2[0]+vec2[1]*vec2[1]+vec2[2]*vec2[2]));
if(normm2/normm>1e-6)
- DataArrayDouble::Rotate3DAlg(origin,vec2,angle,coo->getNumberOfTuples(),coo->getPointer(),coo->getPointer());
+ DataArrayDouble::Rotate3DAlg(origin,vec2,angle,ToIdType(coo->getNumberOfTuples()),coo->getPointer(),coo->getPointer());
MCAuto<MEDCouplingUMesh> mw=clone(false);//false -> shallow copy
mw->setCoords(coo);
mw->getBoundingBox(bbox);
{
if(getMeshDimension()!=1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::isContiguous1D : this method has a sense only for 1D mesh !");
- int nbCells=getNumberOfCells();
+ mcIdType nbCells=ToIdType(getNumberOfCells());
if(nbCells<1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::isContiguous1D : this method has a sense for non empty mesh !");
const int *connI(_nodal_connec_index->begin()),*conn(_nodal_connec->begin());
throw INTERP_KERNEL::Exception(oss.str());
}
checkFullyDefined();
- int nbCells=getNumberOfCells();
+ mcIdType nbCells=ToIdType(getNumberOfCells());
if(nbCells==0)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::distanceToPoints : no cells in this !");
- int nbOfPts=pts->getNumberOfTuples();
+ mcIdType nbOfPts=ToIdType(pts->getNumberOfTuples());
MCAuto<DataArrayDouble> ret0=DataArrayDouble::New(); ret0->alloc(nbOfPts,1);
MCAuto<DataArrayInt> ret1=DataArrayInt::New(); ret1->alloc(nbOfPts,1);
const int *nc=_nodal_connec->begin(),*ncI=_nodal_connec_index->begin(); const double *coords=_coords->begin();
throw INTERP_KERNEL::Exception(msg);
const int *conn=_nodal_connec->getConstPointer();
const int *connI=_nodal_connec_index->getConstPointer();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
std::vector<double> cell2DinS2;
for(int i=0;i<nbOfCells;i++)
{
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convexEnvelop2D works only for meshDim=2 and spaceDim=2 !");
checkFullyDefined();
const double *coords=getCoords()->getConstPointer();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
MCAuto<DataArrayInt> nodalConnecIndexOut=DataArrayInt::New();
nodalConnecIndexOut->alloc(nbOfCells+1,1);
MCAuto<DataArrayInt> nodalConnecOut(DataArrayInt::New());
isChanged->alloc(0,1);
for(int i=0;i<nbOfCells;i++,workIndexOut++)
{
- int pos=nodalConnecOut->getNumberOfTuples();
+ mcIdType pos=ToIdType(nodalConnecOut->getNumberOfTuples());
if(BuildConvexEnvelopOf2DCellJarvis(coords,nodalConnecIn+nodalConnecIndexIn[i],nodalConnecIn+nodalConnecIndexIn[i+1],nodalConnecOut))
isChanged->pushBackSilent(i);
types.insert((INTERP_KERNEL::NormalizedCellType)nodalConnecOut->getIJ(pos,0));
- workIndexOut[1]=nodalConnecOut->getNumberOfTuples();
+ workIndexOut[1]=ToIdType(nodalConnecOut->getNumberOfTuples());
}
if(isChanged->empty())
return 0;
{
checkFullyDefined();
bool ret=true;
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
for(int i=0;i<nbOfCells && ret;i++)
{
INTERP_KERNEL::NormalizedCellType type=getTypeOfCell(i);
{
checkFullyDefined();
bool ret=false;
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
for(int i=0;i<nbOfCells && !ret;i++)
{
INTERP_KERNEL::NormalizedCellType type=getTypeOfCell(i);
void MEDCouplingUMesh::convertQuadraticCellsToLinear()
{
checkFullyDefined();
- int nbOfCells(getNumberOfCells());
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
int delta=0;
const int *iciptr=_nodal_connec_index->begin();
for(int i=0;i<nbOfCells;i++)
int mdim=getMeshDimension();
if(mdim<1 || mdim>3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::areOnlySimplexCells : only available with meshes having a meshdim 1, 2 or 3 !");
- int nbCells=getNumberOfCells();
+ mcIdType nbCells=ToIdType(getNumberOfCells());
const int *conn=_nodal_connec->begin();
const int *connI=_nodal_connec_index->begin();
for(int i=0;i<nbCells;i++)
checkFullyDefined();
if(getMeshDimension()<=1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertDegeneratedCells works on umeshes with meshdim equals to 2 or 3 !");
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
if(nbOfCells<1)
return ;
int initMeshLgth=getNodalConnectivityArrayLen();
checkFullyDefined();
if(getMeshDimension()<=1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertDegeneratedCells works on umeshes with meshdim equals to 2 or 3 !");
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
if(nbOfCells<1)
return ret.retn();
}
if(newPos!=initMeshLgth)
_nodal_connec->reAlloc(newPos);
- const int nCellDel=ret->getNumberOfTuples();
+ const mcIdType nCellDel=ToIdType(ret->getNumberOfTuples());
if (nCellDel)
_nodal_connec_index->reAlloc(nbOfCells-nCellDel+1);
computeTypes();
{
if(getMeshDimension()!=2 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("Invalid mesh to apply are2DCellsNotCorrectlyOriented on it : must be meshDim==2 and spaceDim==3 !");
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
const int *conn=_nodal_connec->begin();
const int *connI=_nodal_connec_index->begin();
const double *coordsPtr=_coords->begin();
{
if(getMeshDimension()!=2 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("Invalid mesh to apply orientCorrectly2DCells on it : must be meshDim==2 and spaceDim==3 !");
- int nbOfCells(getNumberOfCells()),*conn(_nodal_connec->getPointer());
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
+ int *conn(_nodal_connec->getPointer());
const int *connI(_nodal_connec_index->begin());
const double *coordsPtr(_coords->begin());
bool isModified(false);
int mdim(getMeshDimension());
if(mdim!=2 && mdim!=1)
throw INTERP_KERNEL::Exception("Invalid mesh to apply changeOrientationOfCells on it : must be meshDim==2 or meshDim==1 !");
- int nbOfCells(getNumberOfCells()),*conn(_nodal_connec->getPointer());
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
+ int *conn(_nodal_connec->getPointer());
const int *connI(_nodal_connec_index->begin());
if(mdim==2)
{//2D
{
if(getMeshDimension()!=3 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("Invalid mesh to apply arePolyhedronsNotCorrectlyOriented on it : must be meshDim==3 and spaceDim==3 !");
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
const int *conn=_nodal_connec->begin();
const int *connI=_nodal_connec_index->begin();
const double *coordsPtr=_coords->begin();
{
if(getMeshDimension()!=3 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("Invalid mesh to apply orientCorrectlyPolyhedrons on it : must be meshDim==3 and spaceDim==3 !");
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
int *conn=_nodal_connec->getPointer();
const int *connI=_nodal_connec_index->begin();
const double *coordsPtr=_coords->begin();
if(spaceDim!=3)
throw INTERP_KERNEL::Exception(msg);
//
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
int *conn=_nodal_connec->getPointer();
const int *connI=_nodal_connec_index->begin();
const double *coo=getCoords()->begin();
{
if(getMeshDimension()!=3 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("Invalid mesh to apply findAndCorrectBadOriented3DCells on it : must be meshDim==3 and spaceDim==3 !");
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
int *conn=_nodal_connec->getPointer();
const int *connI=_nodal_connec_index->begin();
const double *coordsPtr=_coords->begin();
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getEdgeRatioField : MeshDimension must be equal to 2 or 3 !");
MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
ret->setMesh(this);
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
MCAuto<DataArrayDouble> arr=DataArrayDouble::New();
arr->alloc(nbOfCells,1);
double *pt=arr->getPointer();
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getAspectRatioField : MeshDimension must be equal to 2 or 3 !");
MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
ret->setMesh(this);
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
MCAuto<DataArrayDouble> arr=DataArrayDouble::New();
arr->alloc(nbOfCells,1);
double *pt=arr->getPointer();
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getWarpField : MeshDimension must be equal to 2 !");
MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
ret->setMesh(this);
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
MCAuto<DataArrayDouble> arr=DataArrayDouble::New();
arr->alloc(nbOfCells,1);
double *pt=arr->getPointer();
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getSkewField : MeshDimension must be equal to 2 !");
MCAuto<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
ret->setMesh(this);
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
MCAuto<DataArrayDouble> arr=DataArrayDouble::New();
arr->alloc(nbOfCells,1);
double *pt=arr->getPointer();
ret->setMesh(this);
std::set<INTERP_KERNEL::NormalizedCellType> types;
ComputeAllTypesInternal(types,_nodal_connec,_nodal_connec_index);
- int spaceDim(getSpaceDimension()),nbCells(getNumberOfCells());
+ mcIdType spaceDim(ToIdType(getSpaceDimension())),nbCells(ToIdType(getNumberOfCells()));
MCAuto<DataArrayDouble> arr(DataArrayDouble::New());
arr->alloc(nbCells,1);
for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator it=types.begin();it!=types.end();it++)
DataArrayDouble *MEDCouplingUMesh::getBoundingBoxForBBTreeFast() const
{
checkFullyDefined();
- int spaceDim(getSpaceDimension()),nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes());
+ int spaceDim(getSpaceDimension()),nbOfNodes(getNumberOfNodes());
+ mcIdType nbOfCells(ToIdType(getNumberOfCells()));
MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim);
double *bbox(ret->getPointer());
for(int i=0;i<nbOfCells*spaceDim;i++)
checkFullyDefined();
INTERP_KERNEL::QuadraticPlanarPrecision arcPrec(arcDetEps);
- int spaceDim(getSpaceDimension()),mDim(getMeshDimension()),nbOfCells(getNumberOfCells());
+ int spaceDim(getSpaceDimension()),mDim(getMeshDimension());
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
if(spaceDim!=2 || mDim!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getBoundingBoxForBBTree2DQuadratic : This method should be applied on mesh with mesh dimension equal to 2 and space dimension also equal to 2!");
MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim);
DataArrayDouble *MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic(double arcDetEps) const
{
checkFullyDefined();
- int spaceDim(getSpaceDimension()),mDim(getMeshDimension()),nbOfCells(getNumberOfCells());
+ int spaceDim(getSpaceDimension()),mDim(getMeshDimension());
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
if(spaceDim!=2 || mDim!=1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getBoundingBoxForBBTree1DQuadratic : This method should be applied on mesh with mesh dimension equal to 1 and space dimension also equal to 2!");
INTERP_KERNEL::QuadraticPlanarPrecision arcPrec(arcDetEps);
const int *conn=_nodal_connec->begin();
const int *connI=_nodal_connec_index->begin();
const int *work=connI;
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
std::size_t n=getAllGeoTypes().size();
std::vector<int> ret(3*n,-1); //ret[3*k+2]==-1 because it has no sense here
std::set<INTERP_KERNEL::NormalizedCellType> types;
int *retPtr=ret->getPointer();
const int *connI=_nodal_connec_index->begin();
const int *conn=_nodal_connec->begin();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
const int *i=connI;
int kk=0;
for(std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator it=types.begin();it!=types.end();it++,kk++)
checkConnectivityFullyDefined();
const int *conn=_nodal_connec->begin();
const int *connI=_nodal_connec_index->begin();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
std::vector<INTERP_KERNEL::NormalizedCellType> types;
std::vector<int> typeRangeVals(1);
for(const int *i=connI;i!=connI+nbOfCells;)
MCAuto<DataArrayInt> tmp1=rankInsideCast;
MCAuto<DataArrayInt> tmp2=castsPresent;
//
- int nbOfCastsFinal=castsPresent->getNumberOfTuples();
+ mcIdType nbOfCastsFinal=ToIdType(castsPresent->getNumberOfTuples());
code.resize(3*nbOfCastsFinal);
std::vector< MCAuto<DataArrayInt> > idsInPflPerType2;
std::vector< MCAuto<DataArrayInt> > idsPerType2;
MCAuto<DataArrayInt> tmp3=castArr->findIdsEqual(castId);
idsInPflPerType2.push_back(tmp3);
code[3*i]=(int)types[castId];
- code[3*i+1]=tmp3->getNumberOfTuples();
+ code[3*i+1]=ToIdType(tmp3->getNumberOfTuples());
MCAuto<DataArrayInt> tmp4=rankInsideCast->selectByTupleId(tmp3->begin(),tmp3->begin()+tmp3->getNumberOfTuples());
if(!smartPflKiller || !tmp4->isIota(typeRangeVals[castId+1]-typeRangeVals[castId]))
{
checkFullyDefined();
const int *conn=_nodal_connec->begin();
const int *connI=_nodal_connec_index->begin();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
std::set<INTERP_KERNEL::NormalizedCellType> types;
for(const int *i=connI;i!=connI+nbOfCells;)
{
checkFullyDefined();
const int *conn=_nodal_connec->begin();
const int *connI=_nodal_connec_index->begin();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
if(nbOfCells==0)
return true;
int lastPos=-1;
DataArrayInt *MEDCouplingUMesh::getLevArrPerCellTypes(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd, DataArrayInt *&nbPerType) const
{
checkConnectivityFullyDefined();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
const int *conn=_nodal_connec->begin();
const int *connI=_nodal_connec_index->begin();
MCAuto<DataArrayInt> tmpa=DataArrayInt::New();
computeTypes();
const int *conn=_nodal_connec->begin();
const int *connI=_nodal_connec_index->begin();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
std::vector<INTERP_KERNEL::NormalizedCellType> types;
for(const int *i=connI;i!=connI+nbOfCells && (types.size()!=_types.size());)
if(std::find(types.begin(),types.end(),(INTERP_KERNEL::NormalizedCellType)conn[*i])==types.end())
checkConnectivityFullyDefined();
const int *conn=_nodal_connec->begin();
const int *connI=_nodal_connec_index->begin();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
std::vector<MEDCouplingUMesh *> ret;
for(const int *i=connI;i!=connI+nbOfCells;)
{
oss << "this type is dynamic ! Only static geometric type is possible for that type ! call convertNodalConnectivityToDynamicGeoTypeMesh instead !";
throw INTERP_KERNEL::Exception(oss.str());
}
- int nbCells=getNumberOfCells();
+ mcIdType nbCells=ToIdType(getNumberOfCells());
int typi=(int)typ;
int nbNodesPerCell=(int)cm.getNumberOfNodes();
MCAuto<DataArrayInt> connOut=DataArrayInt::New(); connOut->alloc(nbCells*nbNodesPerCell,1);
checkConnectivityFullyDefined();
if(_types.size()!=1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertNodalConnectivityToDynamicGeoTypeMesh : current mesh does not contain exactly one geometric type !");
- int nbCells=getNumberOfCells(),lgth=_nodal_connec->getNumberOfTuples();
+ mcIdType nbCells=ToIdType(getNumberOfCells()),
+ lgth=ToIdType(_nodal_connec->getNumberOfTuples());
if(lgth<nbCells)
throw INTERP_KERNEL::Exception(msg0);
MCAuto<DataArrayInt> c(DataArrayInt::New()),ci(DataArrayInt::New());
MEDCouplingUMesh *singleCell=static_cast<MEDCouplingUMesh *>((*it2)->buildPartOfMySelf(&fake,&fake+1,true));
m1ssmSingleAuto.push_back(singleCell);
m1ssmSingle.push_back(singleCell);
- ret1->pushBackSilent((*it2)->getNumberOfCells()); ret2->pushBackSilent(rk);
+ ret1->pushBackSilent(ToIdType((*it2)->getNumberOfCells())); ret2->pushBackSilent(rk);
}
}
MCAuto<MEDCouplingUMesh> m1ssmSingle2=MEDCouplingUMesh::MergeUMeshesOnSameCoords(m1ssmSingle);
MCAuto<DataArrayInt> renum=m1ssmSingle2->sortCellsInMEDFileFrmt();
std::vector<const MEDCouplingUMesh *> m1ssmfinal(m1ssm.size());
- for(std::size_t i=0;i<m1ssm.size();i++)
+ for(mcIdType i=0;i<m1ssm.size();i++)
m1ssmfinal[renum->getIJ(i,0)]=m1ssm[i];
MCAuto<MEDCouplingUMesh> ret0=MEDCouplingUMesh::MergeUMeshesOnSameCoords(m1ssmfinal);
szOfCellGrpOfSameType=ret1->renumber(renum->begin());
checkFullyDefined();
const int *conn=_nodal_connec->begin();
const int *connI=_nodal_connec_index->begin();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
std::set<INTERP_KERNEL::NormalizedCellType> types(getAllGeoTypes());
int *tmp=new int[nbOfCells];
for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iter=types.begin();iter!=types.end();iter++)
ret->copyStringInfoFrom(*da);
int *retPtr=ret->getPointer();
const int *daPtr=da->begin();
- int nbOfElems=da->getNbOfElems();
+ mcIdType nbOfElems=ToIdType(da->getNbOfElems());
for(int k=0;k<nbOfElems;k++)
retPtr[k]=tmp[daPtr[k]];
delete [] tmp;
*/
std::vector<bool> MEDCouplingUMesh::getQuadraticStatus() const
{
- int ncell=getNumberOfCells();
+ mcIdType ncell=ToIdType(getNumberOfCells());
std::vector<bool> ret(ncell);
const int *cI=getNodalConnectivityIndex()->begin();
const int *c=getNodalConnectivity()->begin();
{
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
int spaceDim=getSpaceDimension();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
ret->alloc(nbOfCells,spaceDim);
ret->copyStringInfoFrom(*getCoords());
double *ptToFill=ret->getPointer();
checkFullyDefined();
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
int spaceDim=getSpaceDimension();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
int nbOfNodes=getNumberOfNodes();
ret->alloc(nbOfCells,spaceDim);
double *ptToFill=ret->getPointer();
DataArrayDouble *MEDCouplingUMesh::computePlaneEquationOf3DFaces() const
{
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
- int nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes());
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
+ int nbOfNodes(getNumberOfNodes());
if(getSpaceDimension()!=3 || getMeshDimension()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::computePlaneEquationOf3DFaces : This method must be applied on a mesh having meshDimension equal 2 and a spaceDimension equal to 3 !");
ret->alloc(nbOfCells,4);
if(name.empty())
ret->setName("Mesh");
ret->setCoords(da);
- int nbOfTuples(da->getNumberOfTuples());
+ mcIdType nbOfTuples=ToIdType(da->getNumberOfTuples());
MCAuto<DataArrayInt> c(DataArrayInt::New()),cI(DataArrayInt::New());
c->alloc(2*nbOfTuples,1);
cI->alloc(nbOfTuples+1,1);
const MEDCouplingUMesh *cur=a[i];
const DataArrayDouble *coo=cur->getCoords();
if(coo)
- spaceDim=coo->getNumberOfComponents();
+ spaceDim=ToIdType(coo->getNumberOfComponents());
}
if(spaceDim==-3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::MergeUMeshes : no spaceDim specified ! unable to perform merge !");
if(meshDim!=(*iter)->getMeshDimension())
throw INTERP_KERNEL::Exception("Mesh dimensions mismatches, FuseUMeshesOnSameCoords impossible !");
meshLgth+=(*iter)->getNodalConnectivityArrayLen();
- meshIndexLgth+=(*iter)->getNumberOfCells();
+ meshIndexLgth+=ToIdType((*iter)->getNumberOfCells());
}
MCAuto<DataArrayInt> nodal=DataArrayInt::New();
nodal->alloc(meshLgth,1);
{
const int *nod=(*iter)->getNodalConnectivity()->begin();
const int *index=(*iter)->getNodalConnectivityIndex()->begin();
- int nbOfCells=(*iter)->getNumberOfCells();
+ mcIdType nbOfCells=ToIdType((*iter)->getNumberOfCells());
int meshLgth2=(*iter)->getNodalConnectivityArrayLen();
nodalPtr=std::copy(nod,nod+meshLgth2,nodalPtr);
if(iter!=meshes.begin())
for(std::size_t i=0;i<nbOfMeshes;i++)
{
DataArrayInt *tmp=DataArrayInt::New();
- int curNbOfCells=meshes[i]->getNumberOfCells();
+ mcIdType curNbOfCells=ToIdType(meshes[i]->getNumberOfCells());
tmp->alloc(curNbOfCells,1);
std::copy(o2nPtr+offset,o2nPtr+offset+curNbOfCells,tmp->getPointer());
offset+=curNbOfCells;
DataArrayInt *comm,*commI;
coo->findCommonTuples(eps,-1,comm,commI);
MCAuto<DataArrayInt> tmp1(comm),tmp2(commI);
- int oldNbOfNodes=coo->getNumberOfTuples();
+ mcIdType oldNbOfNodes=ToIdType(coo->getNumberOfTuples());
int newNbOfNodes;
MCAuto<DataArrayInt> o2n=DataArrayInt::ConvertIndexArrayToO2N(oldNbOfNodes,comm->begin(),commI->begin(),commI->end(),newNbOfNodes);
if(oldNbOfNodes==newNbOfNodes)
// Same algorithm as above but also using intermediate quadratic points.
// (taking only linear points might lead to issues if the linearized version of the
// polygon is not convex or self-intersecting ... see testCellOrientation4)
- int hsz = sz/2;
+ std::size_t hsz = sz/2;
for(std::size_t j=0;j<sz;j++)
{
if (j%2) // current point i is quadratic, next point i+1 is standard
if (comm1->findIdFirstEqual(i) < 0)
{
comm1->pushBackSilent(i);
- commI1->pushBackSilent(comm1->getNumberOfTuples());
+ commI1->pushBackSilent(mcIdType(comm1->getNumberOfTuples()));
}
MCAuto<DataArrayInt> comm1Auto(comm1),commI1Auto(commI1);
const int *comm1Ptr=comm1->begin();
const int *commI1Ptr=commI1->begin();
- int nbOfGrps1=commI1Auto->getNumberOfTuples()-1;
+ mcIdType nbOfGrps1=ToIdType(commI1Auto->getNumberOfTuples())-1;
res->pushBackSilent((int)INTERP_KERNEL::NORM_POLYHED);
//
for(int i=0;i<nbOfGrps1;i++)
if (comm2->findIdFirstEqual(j) < 0)
{
comm2->pushBackSilent(j);
- commI2->pushBackSilent(comm2->getNumberOfTuples());
+ commI2->pushBackSilent(ToIdType(comm2->getNumberOfTuples()));
}
MCAuto<DataArrayInt> comm2Auto(comm2),commI2Auto(commI2);
const int *comm2Ptr=comm2->begin();
const int *commI2Ptr=commI2->begin();
- int nbOfGrps2=commI2Auto->getNumberOfTuples()-1;
+ mcIdType nbOfGrps2=ToIdType(commI2Auto->getNumberOfTuples())-1;
for(int j=0;j<nbOfGrps2;j++)
{
if(commI2Ptr[j+1] == commI2Ptr[j] + 1)
MCAuto<MEDCouplingUMesh> mm4=mm3->buildSpreadZonesWithPoly();
const int *conn4=mm4->getNodalConnectivity()->begin();
const int *connI4=mm4->getNodalConnectivityIndex()->begin();
- int nbOfCells=mm4->getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(mm4->getNumberOfCells());
for(int k=0;k<nbOfCells;k++)
{
int l=0;
MCAuto<DataArrayInt> o2n(skin->zipCoordsTraducer());
int nbOfNodesExpected(skin->getNumberOfNodes());
MCAuto<DataArrayInt> n2o(o2n->invertArrayO2N2N2O(oldNbOfNodes));
- int nbCells(skin->getNumberOfCells());
+ mcIdType nbCells=ToIdType(skin->getNumberOfCells());
if(nbCells==nbOfNodesExpected)
return buildUnionOf2DMeshLinear(skin,n2o);
else if(2*nbCells==nbOfNodesExpected)
MCAuto<MEDCouplingUMesh> m=computeSkin();
const int *conn=m->getNodalConnectivity()->begin();
const int *connI=m->getNodalConnectivityIndex()->begin();
- int nbOfCells=m->getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(m->getNumberOfCells());
MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(m->getNodalConnectivity()->getNumberOfTuples(),1);
int *work=ret->getPointer(); *work++=INTERP_KERNEL::NORM_POLYHED;
if(nbOfCells<1)
const MEDCoupling::DataArrayInt* conn;
conn=this->getNodalConnectivity(); // it includes a type as the 1st element!!!
index=this->getNodalConnectivityIndex();
- int nbCells=this->getNumberOfCells();
+ mcIdType nbCells=ToIdType(this->getNumberOfCells());
const int* index_ptr=index->begin();
const int* conn_ptr=conn->begin();
void MEDCouplingUMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const
{
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
if(nbOfCells<=0)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::writeVTK : the unstructured mesh has no cells !");
ofs << " <" << getVTKDataSetType() << ">\n";
for(int i=0;i<nbOfCells;i++)
if((INTERP_KERNEL::NormalizedCellType)cPtr[cIPtr[i]]==INTERP_KERNEL::NORM_POLYHED)
{
- int nbFaces=std::count(cPtr+cIPtr[i]+1,cPtr+cIPtr[i+1],-1)+1;
+ mcIdType nbFaces=ToIdType(std::count(cPtr+cIPtr[i]+1,cPtr+cIPtr[i+1],-1))+1;
*w1++=nbFaces;
const int *w6=cPtr+cIPtr[i]+1,*w5=0;
for(int j=0;j<nbFaces;j++)
{ stream << std::endl << "Nodal connectivity NOT set !"; return ; }
if(!_nodal_connec_index->isAllocated())
{ stream << std::endl << "Nodal connectivity set but not allocated !"; return ; }
- int lgth=_nodal_connec_index->getNumberOfTuples();
- int cpt=_nodal_connec_index->getNumberOfComponents();
+ mcIdType lgth=ToIdType(_nodal_connec_index->getNumberOfTuples());
+ mcIdType cpt=ToIdType(_nodal_connec_index->getNumberOfComponents());
if(cpt!=1 || lgth<1)
return ;
stream << std::endl << "Number of cells : " << lgth-1 << ".";
if (dsii->getNumberOfTuples())
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::orderConsecutiveCells1D only work with a mesh being a (piecewise) connected line!");
- int nc(getNumberOfCells());
+ mcIdType nc=ToIdType(getNumberOfCells());
MCAuto<DataArrayInt> result(DataArrayInt::New());
result->alloc(nc,1);
}
// Done, save final piece into DA:
std::copy(linePiece.begin(), linePiece.end(), result->getPointer()+newIdx);
- newIdx += linePiece.size();
+ newIdx += ToIdType(linePiece.size());
// identify next valid start segment (one which is not consumed)
if(!edgeSet.empty())
nbOfDepthPeelingPerformed=0;
if(!arrIndxIn)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed : arrIndxIn input pointer is NULL !");
- int nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
+ mcIdType nbOfTuples=ToIdType(arrIndxIn->getNumberOfTuples())-1;
if(nbOfTuples<=0)
{
DataArrayInt *ret=DataArrayInt::New(); ret->alloc(0,1);
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSpreadZonesWithPoly : meshdimension supported are [2,3] ! Not implemented yet for others !");
}
- ret->insertNextCell((INTERP_KERNEL::NormalizedCellType)cell->getIJSafe(0,0),cell->getNumberOfTuples()-1,cell->begin()+1);
+ ret->insertNextCell((INTERP_KERNEL::NormalizedCellType)cell->getIJSafe(0,0),ToIdType(cell->getNumberOfTuples())-1,cell->begin()+1);
}
//
ret->finishInsertingCells();
if(!arrIn || !arrIndxIn)
throw INTERP_KERNEL::Exception("PartitionBySpreadZone : null input pointers !");
arrIn->checkAllocated(); arrIndxIn->checkAllocated();
- int nbOfTuples(arrIndxIn->getNumberOfTuples());
+ mcIdType nbOfTuples=ToIdType(arrIndxIn->getNumberOfTuples());
if(arrIn->getNumberOfComponents()!=1 || arrIndxIn->getNumberOfComponents()!=1 || nbOfTuples<1)
throw INTERP_KERNEL::Exception("PartitionBySpreadZone : invalid arrays in input !");
int nbOfCellsCur(nbOfTuples-1);
checkConnectivityFullyDefined();
if(getMeshDimension()!=3 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::tetrahedrize : only available for mesh with meshdim == 3 and spacedim == 3 !");
- int nbOfCells(getNumberOfCells()),nbNodes(getNumberOfNodes());
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
+ int nbNodes(getNumberOfNodes());
MCAuto<MEDCoupling1SGTUMesh> ret0(MEDCoupling1SGTUMesh::New(getName(),INTERP_KERNEL::NORM_TETRA4));
MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(nbOfCells,1);
int *retPt(ret->getPointer());
if(!addPts->empty())
{
addPts->rearrange(3);
- nbOfAdditionalPoints=addPts->getNumberOfTuples();
+ nbOfAdditionalPoints=ToIdType(addPts->getNumberOfTuples());
addPts=DataArrayDouble::Aggregate(getCoords(),addPts);
ret0->setCoords(addPts);
}
if(mesh)
{
mesh->incrRef();
- _nb_cell=mesh->getNumberOfCells();
+ _nb_cell=ToIdType(mesh->getNumberOfCells());
}
}
if(mesh)
{
mesh->incrRef();
- _nb_cell=mesh->getNumberOfCells();
+ _nb_cell=ToIdType(mesh->getNumberOfCells());
}
}
checkConnectivityFullyDefined();
int *conn(getNodalConnectivity()->getPointer());
const int *connIndex(getNodalConnectivityIndex()->getConstPointer());
- int nbOfCells(getNumberOfCells());
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
for(int i=0;i<nbOfCells;i++)
for(int iconn=connIndex[i]+1;iconn!=connIndex[i+1];iconn++)
{
{
if(_nodal_connec!=0 && _nodal_connec_index!=0)
{
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
const int *c=_nodal_connec->getConstPointer();
const int *ci=_nodal_connec_index->getConstPointer();
for(int i=0;i<nbOfCells;i++)
checkConnectivityFullyDefined();
if(getMeshDimension()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplexizePol0 : this policy is only available for mesh with meshdim == 2 !");
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
MCAuto<DataArrayInt> ret=DataArrayInt::New();
- int nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4);
+ mcIdType nbOfCutCells=ToIdType(getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4));
ret->alloc(nbOfCells+nbOfCutCells,1);
if(nbOfCutCells==0) { ret->iota(0); return ret.retn(); }
int *retPt=ret->getPointer();
checkConnectivityFullyDefined();
if(getMeshDimension()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplexizePol0 : this policy is only available for mesh with meshdim == 2 !");
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
MCAuto<DataArrayInt> ret=DataArrayInt::New();
- int nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4);
+ mcIdType nbOfCutCells=ToIdType(getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4));
ret->alloc(nbOfCells+nbOfCutCells,1);
if(nbOfCutCells==0) { ret->iota(0); return ret.retn(); }
int *retPt=ret->getPointer();
checkConnectivityFullyDefined();
if(getMeshDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplexizePlanarFace5 : this policy is only available for mesh with meshdim == 3 !");
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
MCAuto<DataArrayInt> ret=DataArrayInt::New();
- int nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8);
+ mcIdType nbOfCutCells=ToIdType(getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8));
ret->alloc(nbOfCells+4*nbOfCutCells,1);
if(nbOfCutCells==0) { ret->iota(0); return ret.retn(); }
int *retPt=ret->getPointer();
checkConnectivityFullyDefined();
if(getMeshDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplexizePlanarFace6 : this policy is only available for mesh with meshdim == 3 !");
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
MCAuto<DataArrayInt> ret=DataArrayInt::New();
- int nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8);
+ mcIdType nbOfCutCells=ToIdType(getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8));
ret->alloc(nbOfCells+5*nbOfCutCells,1);
if(nbOfCutCells==0) { ret->iota(0); return ret.retn(); }
int *retPt=ret->getPointer();
if(epsa<std::numeric_limits<double>::min())
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::tessellate2DCurveInternal : epsilon is null ! Please specify a higher epsilon. If too tiny it can lead to a huge amount of nodes and memory !");
INTERP_KERNEL::QuadraticPlanarPrecision arcPrec(1.e-10); // RAII
- int nbCells=getNumberOfCells();
+ mcIdType nbCells=ToIdType(getNumberOfCells());
int nbNodes=getNumberOfNodes();
const int *conn=_nodal_connec->begin();
const int *connI=_nodal_connec_index->begin();
checkFullyDefined();
if(getMeshDimension()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::subDivide2DMesh : works only on umesh with meshdim==2 !");
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
int *connI=_nodal_connec_index->getPointer();
int newConnLgth=0;
for(int i=0;i<nbOfCells;i++,connI++)
for(const int *work=begin;work!=end;work++)
if(*work>=0 && *work<sz)
fastFinder[*work]=true;
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
const int *conn=getNodalConnectivity()->getConstPointer();
const int *connIndex=getNodalConnectivityIndex()->getConstPointer();
for(int i=0;i<nbOfCells;i++)
checkFullyDefined();
if(getMeshDimension()!=1 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::split3DCurveWithPlane works on umeshes with meshdim equal to 1 and spaceDim equal to 3 !");
- int ncells=getNumberOfCells();
+ mcIdType ncells=ToIdType(getNumberOfCells());
int nnodes=getNumberOfNodes();
double vec2[3],vec3[3],vec4[3];
double normm=sqrt(vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2]);
DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslation(const MEDCouplingUMesh *mesh1D, bool isQuad) const
{
int oldNbOfNodes=getNumberOfNodes();
- int nbOf1DCells=mesh1D->getNumberOfCells();
+ mcIdType nbOf1DCells=ToIdType(mesh1D->getNumberOfCells());
int spaceDim=getSpaceDimension();
DataArrayDouble *ret=DataArrayDouble::New();
std::vector<bool> isQuads;
if(isQuad)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation2D : not implemented for quadratic cells !");
int oldNbOfNodes=getNumberOfNodes();
- int nbOf1DCells=mesh1D->getNumberOfCells();
+ mcIdType nbOf1DCells=ToIdType(mesh1D->getNumberOfCells());
if(nbOf1DCells<2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation2D : impossible to detect any angle of rotation ! Change extrusion policy 1->0 !");
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
if(isQuad)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation3D : not implemented for quadratic cells !");
int oldNbOfNodes=getNumberOfNodes();
- int nbOf1DCells=mesh1D->getNumberOfCells();
+ mcIdType nbOf1DCells=ToIdType(mesh1D->getNumberOfCells());
if(nbOf1DCells<2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation3D : impossible to detect any angle of rotation ! Change extrusion policy 1->0 !");
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
MEDCouplingUMesh *MEDCouplingUMesh::buildExtrudedMeshFromThisLowLev(int nbOfNodesOf1Lev, bool isQuad) const
{
int nbOf1DCells(getNumberOfNodes()/nbOfNodesOf1Lev-1);
- int nbOf2DCells(getNumberOfCells());
+ mcIdType nbOf2DCells=ToIdType(getNumberOfCells());
int nbOf3DCells(nbOf2DCells*nbOf1DCells);
MEDCouplingUMesh *ret(MEDCouplingUMesh::New("Extruded",getMeshDimension()+1));
const int *conn(_nodal_connec->begin()),*connI(_nodal_connec_index->begin());
MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoords(const int *begin, const int *end) const
{
checkConnectivityFullyDefined();
- int ncell=getNumberOfCells();
+ mcIdType ncell=ToIdType(getNumberOfCells());
MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New();
ret->_mesh_dim=_mesh_dim;
ret->setCoords(_coords);
MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) const
{
checkFullyDefined();
- int ncell=getNumberOfCells();
+ mcIdType ncell=ToIdType(getNumberOfCells());
MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New();
ret->_mesh_dim=_mesh_dim;
ret->setCoords(_coords);
MCAuto<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(0,1);
MCAuto<DataArrayInt> newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0);
MCAuto<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(0,1);
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
int nbOfNodes=getNumberOfNodes();
const int *cPtr=_nodal_connec->begin();
const int *icPtr=_nodal_connec_index->begin();
MCAuto<DataArrayInt> conn1DSafe(conn1D),conn1DISafe(conn1DI);
const int *c1DPtr=conn1D->begin();
const int *c1DIPtr=conn1DI->begin();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
const int *cPtr=_nodal_connec->begin();
const int *icPtr=_nodal_connec_index->begin();
int lastVal=0;
MCAuto<DataArrayInt> conn1DSafe(conn1D),conn1DISafe(conn1DI);
const int *c1DPtr=conn1D->begin();
const int *c1DIPtr=conn1DI->begin();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
const int *cPtr=_nodal_connec->begin();
const int *icPtr=_nodal_connec_index->begin();
- int lastVal=0,offset=coordsTmpSafe->getNumberOfTuples();
+ int lastVal=0;
+ mcIdType offset=ToIdType(coordsTmpSafe->getNumberOfTuples());
for(int i=0;i<nbOfCells;i++,icPtr++,descIPtr++)
{
INTERP_KERNEL::NormalizedCellType typ=(INTERP_KERNEL::NormalizedCellType)cPtr[*icPtr];
newConn->pushBackValsSilent(cPtr+icPtr[0]+1,cPtr+icPtr[1]);
for(const int *d=descPtr+descIPtr[0];d!=descPtr+descIPtr[1];d++)
newConn->pushBackSilent(c1DPtr[c1DIPtr[*d]+3]);
- newConn->pushBackSilent(offset+ret->getNumberOfTuples());
+ newConn->pushBackSilent(offset+ToIdType(ret->getNumberOfTuples()));
lastVal+=(icPtr[1]-icPtr[0])+(descIPtr[1]-descIPtr[0])+1;
newConnI->pushBackSilent(lastVal);
ret->pushBackSilent(i);
MCAuto<DataArrayDouble> coordsTmp2Safe(coordsTmp2);
MCAuto<DataArrayInt> conn2DSafe(conn2D),conn2DISafe(conn2DI);
const int *c1DPtr=conn1D->begin(),*c1DIPtr=conn1DI->begin(),*c2DPtr=conn2D->begin(),*c2DIPtr=conn2DI->begin();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
const int *cPtr=_nodal_connec->begin();
const int *icPtr=_nodal_connec_index->begin();
- int lastVal=0,offset=coordsTmpSafe->getNumberOfTuples();
+ int lastVal=0;
+ mcIdType offset=ToIdType(coordsTmpSafe->getNumberOfTuples());
for(int i=0;i<nbOfCells;i++,icPtr++,descIPtr++,desc2IPtr++)
{
INTERP_KERNEL::NormalizedCellType typ=(INTERP_KERNEL::NormalizedCellType)cPtr[*icPtr];
for(const int *d=desc2Ptr+desc2IPtr[0];d!=desc2Ptr+desc2IPtr[1];d++)
{
int nodeId2=c2DPtr[c2DIPtr[(*d)+1]-1];
- int tmpPos=newConn->getNumberOfTuples();
+ mcIdType tmpPos=ToIdType(newConn->getNumberOfTuples());
newConn->pushBackSilent(nodeId2);
ret2D->pushBackSilent(nodeId2); ret1D->pushBackSilent(tmpPos);
}
- newConn->pushBackSilent(offset+ret->getNumberOfTuples());
+ newConn->pushBackSilent(offset+ToIdType(ret->getNumberOfTuples()));
lastVal+=(icPtr[1]-icPtr[0])+(descIPtr[1]-descIPtr[0])+(desc2IPtr[1]-desc2IPtr[0])+1;
newConnI->pushBackSilent(lastVal);
ret->pushBackSilent(i);
}
}
MCAuto<DataArrayInt> diffRet2D=ret2D->getDifferentValues();
- MCAuto<DataArrayInt> o2nRet2D=diffRet2D->invertArrayN2O2O2N(coordsTmp2Safe->getNumberOfTuples());
+ MCAuto<DataArrayInt> o2nRet2D=diffRet2D->invertArrayN2O2O2N(ToIdType(coordsTmp2Safe->getNumberOfTuples()));
coordsTmp2Safe=coordsTmp2Safe->selectByTupleId(diffRet2D->begin(),diffRet2D->end());
MCAuto<DataArrayDouble> tmp=bary->selectByTupleIdSafe(ret->begin(),ret->end());
std::vector<const DataArrayDouble *> v(3); v[0]=coordsTmpSafe; v[1]=coordsTmp2Safe; v[2]=tmp;
const int *cI(newConnI->begin());
for(const int *elt=ret1D->begin();elt!=ret1D->end();elt++)
c[*elt]=o2nRet2D->getIJ(c[*elt],0)+offset;
- offset=coordsTmp2Safe->getNumberOfTuples();
+ offset=ToIdType(coordsTmp2Safe->getNumberOfTuples());
for(const int *elt=ret->begin();elt!=ret->end();elt++)
c[cI[(*elt)+1]-1]+=offset;
coords=DataArrayDouble::Aggregate(v); conn=newConn.retn(); connI=newConnI.retn();
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::MergeUMeshes : input array must be NON EMPTY !");
std::vector<const MEDCouplingUMesh *>::const_iterator it=a.begin();
int meshDim=(*it)->getMeshDimension();
- int nbOfCells=(*it)->getNumberOfCells();
+ mcIdType nbOfCells=ToIdType((*it)->getNumberOfCells());
int meshLgth=(*it++)->getNodalConnectivityArrayLen();
for(;it!=a.end();it++)
{
if(meshDim!=(*it)->getMeshDimension())
throw INTERP_KERNEL::Exception("Mesh dimensions mismatches, MergeUMeshes impossible !");
- nbOfCells+=(*it)->getNumberOfCells();
+ nbOfCells+=ToIdType((*it)->getNumberOfCells());
meshLgth+=(*it)->getNodalConnectivityArrayLen();
}
std::vector<const MEDCouplingPointSet *> aps(a.size());
int offset2=0;
for(it=a.begin();it!=a.end();it++)
{
- int curNbOfCell=(*it)->getNumberOfCells();
+ mcIdType curNbOfCell=ToIdType((*it)->getNumberOfCells());
const int *curCI=(*it)->_nodal_connec_index->begin();
const int *curC=(*it)->_nodal_connec->begin();
cIPtr=std::transform(curCI+1,curCI+curNbOfCell+1,cIPtr,std::bind2nd(std::plus<int>(),offset));
nbOfDepthPeelingPerformed=0;
if(!seedBg || !seedEnd || !arrIn || !arrIndxIn)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeedAlg : some input pointer is NULL !");
- int nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
+ mcIdType nbOfTuples=ToIdType(arrIndxIn->getNumberOfTuples())-1;
std::vector<bool> fetched2(nbOfTuples,false);
int i=0;
for(const int *seedElt=seedBg;seedElt!=seedEnd;seedElt++,i++)
if(getMeshDimension()!=3 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::assemblyForSplitFrom3DSurf works on umeshes with meshdim equal to 3 and spaceDim equal to 3 too!");
const int *nodal3D(_nodal_connec->begin()),*nodalIndx3D(_nodal_connec_index->begin());
- int nbOfCells(getNumberOfCells());
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
for(int i=0;i<nbOfCells;i++)
{
std::map<int, std::set<int> > m;
if(conn.size()>3)
{
nodalRes->insertAtTheEnd(conn.begin(),conn.end());
- nodalResIndx->pushBackSilent(nodalRes->getNumberOfTuples());
+ nodalResIndx->pushBackSilent(ToIdType(nodalRes->getNumberOfTuples()));
cellIds->pushBackSilent(i);
}
}
{
types.clear();
const int *conn(nodalConnec->begin()),*connIndex(nodalConnecIndex->begin());
- int nbOfElem(nodalConnecIndex->getNbOfElems()-1);
+ mcIdType nbOfElem=ToIdType(nodalConnecIndex->getNbOfElems())-1;
if(nbOfElem>0)
for(const int *pt=connIndex;pt!=connIndex+nbOfElem;pt++)
types.insert((INTERP_KERNEL::NormalizedCellType)conn[*pt]);
int *eltsIndexPtr(eltsIndex->getPointer());
MCAuto<DataArrayDouble> bboxArr(getBoundingBoxForBBTree(eps));
const double *bbox(bboxArr->begin());
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
const int *conn=_nodal_connec->getConstPointer();
const int *connI=_nodal_connec_index->getConstPointer();
double bb[2*SPACEDIM];
if(!desc || !descIndx || !revDesc || !revDescIndx)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildDescendingConnectivityGen : present of a null pointer in input !");
checkConnectivityFullyDefined();
- int nbOfCells=getNumberOfCells();
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
int nbOfNodes=getNumberOfNodes();
MCAuto<DataArrayInt> revNodalIndx=DataArrayInt::New(); revNodalIndx->alloc(nbOfNodes+1,1); revNodalIndx->fillWithZero();
int *revNodalIndxPtr=revNodalIndx->getPointer();
}
descIndxPtr[0]=descIndxPtr[-1]+(int)nbOfSons;
}
- int nbOfCellsM1=ret->getNumberOfCells();
+ mcIdType nbOfCellsM1=ToIdType(ret->getNumberOfCells());
std::transform(revNodalIndxPtr+1,revNodalIndxPtr+nbOfNodes+1,revNodalIndxPtr,revNodalIndxPtr+1,std::plus<int>());
MCAuto<DataArrayInt> revNodal=DataArrayInt::New(); revNodal->alloc(revNodalIndx->back(),1);
std::fill(revNodal->getPointer(),revNodal->getPointer()+revNodalIndx->back(),-1);
{
if(stp-start>1)
{
- int tmp2(0),tmp3(appendedCoords->getNumberOfTuples()/2);
+ mcIdType tmp2(0),tmp3(ToIdType(appendedCoords->getNumberOfTuples())/2);
InternalAddPointOriented(e,-1,coords,tmp[1],tmp[2],*appendedCoords,tmp2);
middles.push_back(tmp3+offset);
}
{
if(stp-start>1)
{
- int tmp2(0),tmp3(appendedCoords->getNumberOfTuples()/2);
+ mcIdType tmp2(0),tmp3(ToIdType(appendedCoords->getNumberOfTuples())/2);
InternalAddPointOriented(e,-1,coords,tmpSrt,tmpEnd,*appendedCoords,tmp2);
middles.push_back(tmp3+offset);
}
{
if(stp-start>1) // if we are covering more than one segment we need to create a new mid point
{
- int tmpSrt(connBg[start]),tmpEnd(connBg[stp % nbOfEdges]); // % to handle last seg.
- int tmp2(0),tmp3(appendedCoords->getNumberOfTuples()/2);
+ mcIdType tmpSrt(connBg[start]),tmpEnd(connBg[stp % nbOfEdges]); // % to handle last seg.
+ mcIdType tmp2(0),tmp3(ToIdType(appendedCoords->getNumberOfTuples())/2);
InternalAddPointOriented(e,-1,coords,tmpSrt,tmpEnd,*appendedCoords,tmp2);
middles.push_back(tmp3+offset);
}
INTERP_KERNEL::AutoPtr<int> tmpConn(new int[sz]);
INTERP_KERNEL::AutoPtr<int> tmpConn2(new int[sz]);
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)connBg[0]));
- unsigned nbs(cm.getNumberOfSons2(connBg+1,sz));
+ std::size_t nbs(cm.getNumberOfSons2(connBg+1,ToIdType(sz)));
unsigned nbOfHit(0); // number of fusions operated
int posBaseElt(0),posEndElt(0),nbOfTurn(0);
- const unsigned int maxNbOfHit = cm.isQuadratic() ? nbs-2 : nbs-3; // a quad cell is authorized to end up with only two edges, a linear one has to keep 3 at least
+ const std::size_t maxNbOfHit = cm.isQuadratic() ? nbs-2 : nbs-3; // a quad cell is authorized to end up with only two edges, a linear one has to keep 3 at least
INTERP_KERNEL::NormalizedCellType typeOfSon;
std::vector<int> middles;
bool ret(false);
for(;(nbOfTurn+nbOfHit)<nbs;nbOfTurn++)
{
- cm.fillSonCellNodalConnectivity2(posBaseElt,connBg+1,sz,tmpConn,typeOfSon);
+ cm.fillSonCellNodalConnectivity2(posBaseElt,connBg+1,ToIdType(sz),tmpConn,typeOfSon);
std::map<MCAuto<INTERP_KERNEL::Node>,int> m;
INTERP_KERNEL::Edge *e(MEDCouplingUMeshBuildQPFromEdge2(typeOfSon,tmpConn,coords,m));
posEndElt = posBaseElt+1;
{
for(unsigned i=1;i<nbs && nbOfHit<maxNbOfHit;i++) // 2nd condition is to avoid ending with a cell with one single edge
{
- cm.fillSonCellNodalConnectivity2(nbs-i,connBg+1,sz,tmpConn2,typeOfSon);
+ cm.fillSonCellNodalConnectivity2(ToIdType(nbs-i),connBg+1,ToIdType(sz),tmpConn2,typeOfSon);
// Identify common point:
int commPoint = std::find((int *)tmpConn, tmpConn+2, tmpConn2[0]) != tmpConn+2 ? tmpConn2[0] : tmpConn2[1];
auto itE(forbiddenPoints.end());
const unsigned fwdStart = (nbOfTurn == 0 ? 0 : posBaseElt); // the first element to be inspected going forward
for(unsigned j=fwdStart+1;j<nbs && nbOfHit<maxNbOfHit;j++) // 2nd condition is to avoid ending with a cell with one single edge
{
- cm.fillSonCellNodalConnectivity2((int)j,connBg+1,sz,tmpConn2,typeOfSon); // get edge #j's connectivity
+ cm.fillSonCellNodalConnectivity2((int)j,connBg+1,ToIdType(sz),tmpConn2,typeOfSon); // get edge #j's connectivity
// Identify common point:
int commPoint = std::find((int *)tmpConn, tmpConn+2, tmpConn2[0]) != tmpConn+2 ? tmpConn2[0] : tmpConn2[1];
auto itE(forbiddenPoints.end());
const std::vector< std::vector<int> >& subDiv, std::vector< std::vector<int> >& intersectEdge)
{
int offset1=m1->getNumberOfNodes();
- int ncell2=m2->getNumberOfCells();
+ mcIdType ncell2=ToIdType(m2->getNumberOfCells());
const int *c=m2->getNodalConnectivity()->begin();
const int *cI=m2->getNodalConnectivityIndex()->begin();
const double *coo=m2->getCoords()->begin();
{
idsInRetColinear=DataArrayInt::New(); idsInRetColinear->alloc(0,1);
idsInMesh1DForIdsInRetColinear=DataArrayInt::New(); idsInMesh1DForIdsInRetColinear->alloc(0,1);
- int nCells(mesh1D->getNumberOfCells());
+ mcIdType nCells=ToIdType(mesh1D->getNumberOfCells());
if(nCells!=(int)intersectEdge2.size())
throw INTERP_KERNEL::Exception("BuildMesh1DCutFrom : internal error # 1 !");
const DataArrayDouble *coo2(mesh1D->getCoords());
const int *c(mesh1D->getNodalConnectivity()->begin()),*ci(mesh1D->getNodalConnectivityIndex()->begin());
const double *coo2Ptr(coo2->begin());
- int offset1(coords1->getNumberOfTuples());
- int offset2(offset1+coo2->getNumberOfTuples());
- int offset3(offset2+addCoo.size()/2);
+ mcIdType offset1=ToIdType(coords1->getNumberOfTuples());
+ mcIdType offset2=(offset1+ToIdType(coo2->getNumberOfTuples()));
+ mcIdType offset3(offset2+ToIdType(addCoo.size())/2);
std::vector<double> addCooQuad;
MCAuto<DataArrayInt> cOut(DataArrayInt::New()),ciOut(DataArrayInt::New()); cOut->alloc(0,1); ciOut->alloc(1,1); ciOut->setIJ(0,0,0);
int tmp[4],cicnt(0),kk(0);
std::map<MCAuto<INTERP_KERNEL::Node>,int> m;
INTERP_KERNEL::Edge *e(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)c[ci[i]],c+ci[i]+1,coo2Ptr,m));
const std::vector<int>& subEdges(intersectEdge2[i]);
- int nbSubEdge(subEdges.size()/2);
+ mcIdType nbSubEdge=ToIdType(subEdges.size()/2);
for(int j=0;j<nbSubEdge;j++,kk++)
{
MCAuto<INTERP_KERNEL::Node> n1(MEDCouplingUMeshBuildQPNode(subEdges[2*j],coords1->begin(),offset1,coo2Ptr,offset2,addCoo)),n2(MEDCouplingUMeshBuildQPNode(subEdges[2*j+1],coords1->begin(),offset1,coo2Ptr,offset2,addCoo));
std::vector<int> connOut(nbOfEdgesOf2DCellSplit);
for(std::size_t kk=0;kk<nbOfEdgesOf2DCellSplit;kk++)
connOut[kk]=allEdges[2*kk];
- ret->insertNextCell(INTERP_KERNEL::NORM_POLYGON,connOut.size(),&connOut[0]);
+ ret->insertNextCell(INTERP_KERNEL::NORM_POLYGON,ToIdType(connOut.size()),&connOut[0]);
return ret.retn();
}
{
const int *c(mesh2D->getNodalConnectivity()->begin()),*ci(mesh2D->getNodalConnectivityIndex()->begin());
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)c[ci[cellIdInMesh2D]]));
- std::size_t ii(0);
+ mcIdType ii(0);
unsigned sz(cm.getNumberOfSons2(c+ci[cellIdInMesh2D]+1,ci[cellIdInMesh2D+1]-ci[cellIdInMesh2D]-1));
if(sz!=std::distance(descBg,descEnd))
throw INTERP_KERNEL::Exception("BuildRefined2DCellQuadratic : internal error 1 !");
std::vector<int> allEdges,centers;
const double *coordsPtr(coords->begin());
MCAuto<DataArrayDouble> addCoo(DataArrayDouble::New()); addCoo->alloc(0,1);
- int offset(coords->getNumberOfTuples());
+ mcIdType offset=ToIdType(coords->getNumberOfTuples());
for(const int *it2(descBg);it2!=descEnd;it2++,ii++)
{
INTERP_KERNEL::NormalizedCellType typeOfSon;
centers.push_back(tmpPtr[2]);//special case where no subsplit of edge -> reuse the original center.
else
{//the current edge has been subsplit -> create corresponding centers.
- std::size_t nbOfCentersToAppend(edge1.size()/2);
+ mcIdType nbOfCentersToAppend=ToIdType(edge1.size()/2);
std::map< MCAuto<INTERP_KERNEL::Node>,int> m;
MCAuto<INTERP_KERNEL::Edge> ee(MEDCouplingUMeshBuildQPFromEdge2(typeOfSon,tmpPtr,coordsPtr,m));
std::vector<int>::const_iterator it3(allEdges.end()-edge1.size());
- for(std::size_t k=0;k<nbOfCentersToAppend;k++)
+ for(mcIdType k=0;k<nbOfCentersToAppend;k++)
{
double tmpp[2];
const double *aa(coordsPtr+2*(*it3++));
for(std::size_t kk=0;kk<nbOfEdgesOf2DCellSplit;kk++)
connOut[kk]=allEdges[2*kk];
connOut.insert(connOut.end(),centers.begin(),centers.end());
- ret->insertNextCell(INTERP_KERNEL::NORM_QPOLYG,connOut.size(),&connOut[0]);
+ ret->insertNextCell(INTERP_KERNEL::NORM_QPOLYG,ToIdType(connOut.size()),&connOut[0]);
return ret.retn();
}
isQuad=true;
}
if(!isQuad)
- mesh2D->insertNextCell(INTERP_KERNEL::NORM_POLYGON,conn.size(),&conn[0]);
+ mesh2D->insertNextCell(INTERP_KERNEL::NORM_POLYGON,ToIdType(conn.size()),&conn[0]);
else
{
const double *coo(mesh2D->getCoords()->begin());
mesh2D->getCoords()->rearrange(1);
mesh2D->getCoords()->pushBackValsSilent(&addCoo[0],&addCoo[0]+addCoo.size());
mesh2D->getCoords()->rearrange(2);
- mesh2D->insertNextCell(INTERP_KERNEL::NORM_QPOLYG,conn2.size(),&conn2[0]);
+ mesh2D->insertNextCell(INTERP_KERNEL::NORM_QPOLYG,ToIdType(conn2.size()),&conn2[0]);
}
}
{
std::size_t nb(edge1Bis.size()/2);
std::size_t nbOfEdgesOf2DCellSplit(nb/2);
- int iEnd(splitMesh1D->getNumberOfCells());
+ mcIdType iEnd=ToIdType(splitMesh1D->getNumberOfCells());
if(iEnd==0)
throw INTERP_KERNEL::Exception("BuildMesh2DCutInternal2 : internal error ! input 1D mesh must have at least one cell !");
std::size_t ii,jj;
const MCAuto<MEDCouplingUMesh>& mesh1DInCase, const std::vector< std::vector<int> >& edges,
const std::vector< std::vector< MCAuto<INTERP_KERNEL::Edge> > >& edgePtrs)
{
- get(pos);//to check pos
+ get(ToIdType(pos));//to check pos
bool isFast(pos==0 && _pool.size()==1);
std::size_t sz(edges.size());
// dealing with edges
if(sz==1)
_edge_info.push_back(EdgeInfo(istart,iend,mesh1DInCase));
else
- _edge_info.push_back(EdgeInfo(istart,iend,pos,edgePtrs[0].back()));
+ _edge_info.push_back(EdgeInfo(istart,iend,ToIdType(pos),edgePtrs[0].back()));
//
std::vector<CellInfo> pool(_pool.size()-1+sz);
for(std::size_t i=0;i<pos;i++)
pool[i]=_pool[i];
for(std::size_t j=0;j<sz;j++)
pool[pos+j]=CellInfo(edges[j],edgePtrs[j]);
- for(int i=pos+1;i<(int)_pool.size();i++)
+ for(std::size_t i=pos+1;i<_pool.size();i++)
pool[i+sz-1]=_pool[i];
_pool=pool;
//
if(sz==2)
- updateEdgeInfo(pos,edgePtrs[0],edgePtrs[1]);
+ updateEdgeInfo(ToIdType(pos),edgePtrs[0],edgePtrs[1]);
//
if(isFast)
{
std::vector< MCAuto<MEDCouplingUMesh> > ms;
if(pos>0)
{
- MCAuto<MEDCouplingUMesh> elt(static_cast<MEDCouplingUMesh *>(_ze_mesh->buildPartOfMySelfSlice(0,pos,true)));
+ MCAuto<MEDCouplingUMesh> elt(static_cast<MEDCouplingUMesh *>(_ze_mesh->buildPartOfMySelfSlice(0,ToIdType(pos),true)));
ms.push_back(elt);
}
ms.push_back(mesh);
if(pos<_ze_mesh->getNumberOfCells()-1)
{
- MCAuto<MEDCouplingUMesh> elt(static_cast<MEDCouplingUMesh *>(_ze_mesh->buildPartOfMySelfSlice(pos+1,_ze_mesh->getNumberOfCells(),true)));
+ MCAuto<MEDCouplingUMesh> elt(static_cast<MEDCouplingUMesh *>(_ze_mesh->buildPartOfMySelfSlice(ToIdType(pos)+1,ToIdType(_ze_mesh->getNumberOfCells()),true)));
ms.push_back(elt);
}
std::vector< const MEDCouplingUMesh *> ms2(ms.size());
MEDCouplingUMesh *BuildMesh2DCutInternal(double eps, MEDCouplingUMesh *splitMesh1D, const std::vector<int>& allEdges, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& allEdgesPtr, int offset,
MCAuto<DataArrayInt>& idsLeftRight)
{
- int nbCellsInSplitMesh1D(splitMesh1D->getNumberOfCells());
+ mcIdType nbCellsInSplitMesh1D=ToIdType(splitMesh1D->getNumberOfCells());
if(nbCellsInSplitMesh1D==0)
throw INTERP_KERNEL::Exception("BuildMesh2DCutInternal : internal error ! input 1D mesh must have at least one cell !");
const int *cSplitPtr(splitMesh1D->getNodalConnectivity()->begin()),*ciSplitPtr(splitMesh1D->getNodalConnectivityIndex()->begin());
// Build BB tree of all edges in the tool mesh (second mesh)
MCAuto<DataArrayDouble> bbox1Arr(m1Desc->getBoundingBoxForBBTree(eps)),bbox2Arr(m2Desc->getBoundingBoxForBBTree(eps));
const double *bbox1(bbox1Arr->begin()),*bbox2(bbox2Arr->begin());
- int nDescCell1(m1Desc->getNumberOfCells()),nDescCell2(m2Desc->getNumberOfCells());
+ mcIdType nDescCell1=ToIdType(m1Desc->getNumberOfCells()),nDescCell2=ToIdType(m2Desc->getNumberOfCells());
intersectEdge1.resize(nDescCell1);
colinear2.resize(nDescCell2);
subDiv2.resize(nDescCell2);
- BBTree<SPACEDIM,int> myTree(bbox2,0,0,m2Desc->getNumberOfCells(),-eps);
- BBTreePts<SPACEDIM,int> treeNodes2(m2Desc->getCoords()->begin(),0,0,m2Desc->getCoords()->getNumberOfTuples(),eps);
+ BBTree<SPACEDIM,int> myTree(bbox2,0,0,ToIdType(m2Desc->getNumberOfCells()),-eps);
+ BBTreePts<SPACEDIM,int> treeNodes2(m2Desc->getCoords()->begin(),0,0,ToIdType(m2Desc->getCoords()->getNumberOfTuples()),eps);
std::vector<int> candidates1(1);
int offset1(m1Desc->getNumberOfNodes());
MCAuto<DataArrayDouble> bbox1Arr(m1->getBoundingBoxForBBTree(eps)),bbox2Arr(m2->getBoundingBoxForBBTree(eps));
const double *bbox1(bbox1Arr->begin()),*bbox2(bbox2Arr->begin());
// Here a BBTree on 2D-cells, not on segments:
- BBTree<SPACEDIM,int> myTree(bbox2,0,0,m2->getNumberOfCells(),eps);
- int ncell1(m1->getNumberOfCells());
+ BBTree<SPACEDIM,int> myTree(bbox2,0,0,ToIdType(m2->getNumberOfCells()),eps);
+ mcIdType ncell1=ToIdType(m1->getNumberOfCells());
crI.push_back(0);
for(int i=0;i<ncell1;i++)
{
if(getMeshDimension()!=3 || getSpaceDimension()!=3)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSubCellsFromCut works on umeshes with meshdim equal to 3 and spaceDim equal to 3 too!");
const int *nodal3D(_nodal_connec->begin()),*nodalIndx3D(_nodal_connec_index->begin());
- int nbOfCells(getNumberOfCells());
+ mcIdType nbOfCells=ToIdType(getNumberOfCells());
if(nbOfCells!=1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSubCellsFromCut works only with single cell presently !");
- for(int i=0;i<nbOfCells;i++)
+ for(mcIdType i=0;i<nbOfCells;i++)
{
int offset(descIndx[i]),nbOfFaces(descIndx[i+1]-offset);
for(int j=0;j<nbOfFaces;j++)
void MEDCouplingUMesh::split2DCellsLinear(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *subNodesInSeg, const DataArrayInt *subNodesInSegI)
{
checkConnectivityFullyDefined();
- int ncells(getNumberOfCells()),lgthToReach(getNodalConnectivityArrayLen()+subNodesInSeg->getNumberOfTuples());
+ mcIdType ncells=ToIdType(getNumberOfCells());
+ mcIdType lgthToReach(getNodalConnectivityArrayLen()+ToIdType(subNodesInSeg->getNumberOfTuples()));
MCAuto<DataArrayInt> 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());
int MEDCouplingUMesh::split2DCellsQuadratic(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *subNodesInSeg, const DataArrayInt *subNodesInSegI, const DataArrayInt *mid, const DataArrayInt *midI)
{
checkConsistencyLight();
- int ncells(getNumberOfCells()),lgthToReach(getNodalConnectivityArrayLen()+2*subNodesInSeg->getNumberOfTuples()),nodesCnt(getNumberOfNodes());
+ mcIdType ncells=ToIdType(getNumberOfCells());
+ mcIdType lgthToReach(getNodalConnectivityArrayLen()+2*ToIdType(subNodesInSeg->getNumberOfTuples()));
+ mcIdType nodesCnt(getNumberOfNodes());
MCAuto<DataArrayInt> c(DataArrayInt::New()); c->alloc((std::size_t)lgthToReach);
MCAuto<DataArrayDouble> addCoo(DataArrayDouble::New()); addCoo->alloc(0,1);
const int *subPtr(subNodesInSeg->begin()),*subIPtr(subNodesInSegI->begin()),*descPtr(desc->begin()),*descIPtr(descI->begin()),*oldConn(getNodalConnectivity()->begin());
addCoo->rearrange(2);
MCAuto<DataArrayDouble> coo(DataArrayDouble::Aggregate(getCoords(),addCoo));//info are copied from getCoords() by using Aggregate
setCoords(coo);
- return addCoo->getNumberOfTuples();
+ return ToIdType(addCoo->getNumberOfTuples());
}
MCAuto<MEDCouplingUMesh> ret1(BuildMesh1DCutFrom(mesh1D,intersectEdge2,mesh2D->getCoords(),addCoo,mergedNodes,colinear2,intersectEdge1,
idsInRet1Colinear,idsInDescMesh2DForIdsInRetColinear));
MCAuto<DataArrayInt> ret3(DataArrayInt::New()); ret3->alloc(ret1->getNumberOfCells()*2,1); ret3->fillWithValue(std::numeric_limits<int>::max()); ret3->rearrange(2);
- MCAuto<DataArrayInt> idsInRet1NotColinear(idsInRet1Colinear->buildComplement(ret1->getNumberOfCells()));
+ MCAuto<DataArrayInt> idsInRet1NotColinear(idsInRet1Colinear->buildComplement(ToIdType(ret1->getNumberOfCells())));
// deal with cells in mesh2D that are not cut but only some of their edges are
MCAuto<DataArrayInt> idsInDesc2DToBeRefined(idsInDescMesh2DForIdsInRetColinear->deepCopy());
idsInDesc2DToBeRefined->abs(); idsInDesc2DToBeRefined->applyLin(1,-1);
MCAuto<MEDCouplingUMesh> ret1NonCol(static_cast<MEDCouplingUMesh *>(ret1->buildPartOfMySelf(idsInRet1NotColinear->begin(),idsInRet1NotColinear->end())));
MCAuto<DataArrayDouble> baryRet1(ret1NonCol->computeCellCenterOfMass());
MCAuto<DataArrayInt> elts,eltsIndex;
- mesh2D->getCellsContainingPoints(baryRet1->begin(),baryRet1->getNumberOfTuples(),eps,elts,eltsIndex);
+ mesh2D->getCellsContainingPoints(baryRet1->begin(),ToIdType(baryRet1->getNumberOfTuples()),eps,elts,eltsIndex);
MCAuto<DataArrayInt> eltsIndex2(DataArrayInt::New()); eltsIndex2->alloc(0,1);
if (eltsIndex->getNumberOfTuples() > 1)
eltsIndex2 = eltsIndex->deltaShiftIndex();
if(eltsIndex2->count(0)+eltsIndex3->getNumberOfTuples()!=ret1NonCol->getNumberOfCells())
throw INTERP_KERNEL::Exception("Intersect2DMeshWith1DLine : internal error 1 !");
MCAuto<DataArrayInt> cellsToBeModified(elts->buildUnique());
- MCAuto<DataArrayInt> untouchedCells(cellsToBeModified->buildComplement(mesh2D->getNumberOfCells()));
+ MCAuto<DataArrayInt> untouchedCells(cellsToBeModified->buildComplement(ToIdType(mesh2D->getNumberOfCells())));
if((DataArrayInt *)out0s)
untouchedCells=untouchedCells->buildSubstraction(out0s);//if some edges in ret1 are colinear to descending mesh of mesh2D remove cells from untouched one
std::vector< MCAuto<MEDCouplingUMesh> > outMesh2DSplit;
outMesh2DSplit.push_back(BuildRefined2DCell(ret1->getCoords(),mesh2D,*it,dptr+diptr[*it],dptr+diptr[*it+1],intersectEdge1));
ret1->setCoords(outMesh2DSplit.back()->getCoords());
}
- int offset(ret2->getNumberOfTuples());
+ mcIdType offset(ToIdType(ret2->getNumberOfTuples()));
ret2->pushBackValsSilent(fewModifiedCells->begin(),fewModifiedCells->end());
MCAuto<DataArrayInt> partOfRet3(DataArrayInt::New()); partOfRet3->alloc(2*idsInRet1Colinear->getNumberOfTuples(),1);
partOfRet3->fillWithValue(std::numeric_limits<int>::max()); partOfRet3->rearrange(2);
MCAuto<DataArrayInt> idsNonColPerCell2(idsInRet1NotColinear->selectByTupleId(idsNonColPerCell->begin(),idsNonColPerCell->end()));
MCAuto<MEDCouplingUMesh> partOfMesh1CuttingCur2DCell(static_cast<MEDCouplingUMesh *>(ret1NonCol->buildPartOfMySelf(idsNonColPerCell->begin(),idsNonColPerCell->end())));
MCAuto<DataArrayInt> partOfRet3;
- MCAuto<MEDCouplingUMesh> splitOfOneCell(BuildMesh2DCutFrom(eps,*it,m1Desc,partOfMesh1CuttingCur2DCell,dd1->begin()+dd2->getIJ(*it,0),dd1->begin()+dd2->getIJ((*it)+1,0),intersectEdge1,ret2->getNumberOfTuples(),partOfRet3));
+ MCAuto<MEDCouplingUMesh> splitOfOneCell(BuildMesh2DCutFrom(eps,*it,m1Desc,partOfMesh1CuttingCur2DCell,dd1->begin()+dd2->getIJ(*it,0),dd1->begin()+dd2->getIJ((*it)+1,0),intersectEdge1,ToIdType(ret2->getNumberOfTuples()),partOfRet3));
ret3->setPartOfValues3(partOfRet3,idsNonColPerCell2->begin(),idsNonColPerCell2->end(),0,2,1,true);
outMesh2DSplit.push_back(splitOfOneCell);
for(std::size_t i=0;i<splitOfOneCell->getNumberOfCells();i++)
const int *c(mDesc->getNodalConnectivity()->begin()),*ci(mDesc->getNodalConnectivityIndex()->begin()),*rd(revDesc1->begin()),*rdi(revDescIndx1->begin());
MCAuto<DataArrayDouble> bboxArr(mDesc->getBoundingBoxForBBTree(eps));
const double *bbox(bboxArr->begin()),*coords(getCoords()->begin());
- int nCell(getNumberOfCells()),nDescCell(mDesc->getNumberOfCells());
+ mcIdType nCell=ToIdType(getNumberOfCells()),nDescCell=ToIdType(mDesc->getNumberOfCells());
std::vector< std::vector<int> > intersectEdge(nDescCell),overlapEdge(nDescCell);
std::vector<double> addCoo;
BBTree<SPACEDIM,int> myTree(bbox,0,0,nDescCell,-eps);
if(getSpaceDimension()!=2 || getMeshDimension()!=2)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::colinearize2D : This method only works for meshes with spaceDim=2 and meshDim=2 !");
INTERP_KERNEL::QuadraticPlanarPrecision prec(eps);
- int nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes());
+ mcIdType nbOfCells(ToIdType(getNumberOfCells())),nbOfNodes(getNumberOfNodes());
const int *cptr(_nodal_connec->begin()),*ciptr(_nodal_connec_index->begin());
MCAuto<DataArrayInt> newc(DataArrayInt::New()),newci(DataArrayInt::New()); newci->alloc(nbOfCells+1,1); newc->alloc(0,1); newci->setIJ(0,0,0);
std::map<int, bool> forbiddenPoints; // list of points that can not be removed (or it will break conformity)
{
if(Colinearize2DCell(coords,cptr+ciptr[0],cptr+ciptr[1],nbOfNodes,forbiddenPoints, /*out*/ newc,appendedCoords))
ret->pushBackSilent(i);
- newciptr[1]=newc->getNumberOfTuples();
+ newciptr[1]=ToIdType(newc->getNumberOfTuples());
}
//
if(ret->empty())
const std::vector<int>& insidePoints, std::vector<int>& modifiedFace)
{
using namespace std;
- int dst = distance(sIdxConn, sIdxConnE);
+ mcIdType dst = ToIdType(distance(sIdxConn, sIdxConnE));
modifiedFace.reserve(dst + insidePoints.size()-2);
modifiedFace.resize(dst);
copy(sIdxConn, sIdxConnE, modifiedFace.data());
vector<int>::iterator endPos = find(modifiedFace.begin(),shortEnd, endNode);
if (endPos == shortEnd)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ReplaceEdgeInFace: internal error, should never happen!");
- int d = distance(startPos, endPos);
+ mcIdType d = ToIdType(distance(startPos, endPos));
if (d == 1 || d == (1-dst)) // don't use modulo, for neg numbers, result is implementation defined ...
modifiedFace.insert(++startPos, ++insidePoints.begin(), --insidePoints.end()); // insidePoints also contains start and end node. Those don't need to be inserted.
else
// Build BBTree
MCAuto<DataArrayDouble> bboxArr(mDesc->getBoundingBoxForBBTree(eps));
const double *bbox(bboxArr->begin()); getCoords()->begin();
- int nDescCell(mDesc->getNumberOfCells());
+ mcIdType nDescCell=ToIdType(mDesc->getNumberOfCells());
BBTree<SPACEDIM,int> myTree(bbox,0,0,nDescCell,-eps);
// Surfaces - handle biggest first
MCAuto<MEDCouplingFieldDouble> surfF = mDesc->getMeasureField(true);
// Sort faces by decreasing surface:
vector< pair<double,int> > S;
- for(std::size_t i=0;i < surfs->getNumberOfTuples();i++)
+ for(mcIdType i=0;i < ToIdType(surfs->getNumberOfTuples());i++)
{
pair<double,int> p = make_pair(surfs->begin()[i], i);
S.push_back(p);
MCAuto<DataArrayDouble> baryPartXY = baryPart->keepSelectedComponents(compo);
mPartRef->changeSpaceDimension(2,0.0);
MCAuto<DataArrayInt> cc(DataArrayInt::New()), ccI(DataArrayInt::New());
- mPartRef->getCellsContainingPoints(baryPartXY->begin(), baryPartXY->getNumberOfTuples(), eps, cc, ccI);
+ mPartRef->getCellsContainingPoints(baryPartXY->begin(), ToIdType(baryPartXY->getNumberOfTuples()), eps, cc, ccI);
if (!cc->getNumberOfTuples())
continue;
const int *cDesc2(mDesc2->getNodalConnectivity()->begin()),*cIDesc2(mDesc2->getNodalConnectivityIndex()->begin());
MCAuto<DataArrayDouble> bboxArr(mDesc2->getBoundingBoxForBBTree(eps));
const double *bbox2(bboxArr->begin());
- int nDesc2Cell=mDesc2->getNumberOfCells();
+ mcIdType nDesc2Cell=ToIdType(mDesc2->getNumberOfCells());
BBTree<SPACEDIM,int> myTree2(bbox2,0,0,nDesc2Cell,-eps);
// Edges - handle longest first
// Sort edges by decreasing length:
vector<pair<double,int> > S;
- for(std::size_t i=0;i < lens->getNumberOfTuples();i++)
+ for(mcIdType i=0;i < ToIdType(lens->getNumberOfTuples());i++)
{
pair<double,int> p = make_pair(lens->getIJ(i, 0), i);
S.push_back(p);
int nbElemsNotM1;
{
MCAuto<DataArrayInt> tmp(nodeMap->findIdsNotEqual(-1));
- nbElemsNotM1 = tmp->getNbOfElems();
+ nbElemsNotM1 = ToIdType(tmp->getNbOfElems());
}
MCAuto<DataArrayInt> nodeMapInv = nodeMap->invertArrayO2N2N2O(nbElemsNotM1);
double * cooPartRef(mPartRef->_coords->getPointer());
MCAuto<DataArrayInt> idx(DataArrayInt::New()); idx->alloc(1); idx->fillWithValue(0);
MCAuto<DataArrayInt> vals(DataArrayInt::New()); vals->alloc(0);
newConn->set3(superIdx, idx, vals);
- for(std::size_t ii = 0; ii < getNumberOfCells(); ii++)
+ mcIdType nbCells=ToIdType(getNumberOfCells());
+ for(mcIdType ii = 0; ii < nbCells; ii++)
for (int jj=descIP[ii]; jj < descIP[ii+1]; jj++)
{
int sz, faceIdx = abs(descP[jj])-1;
MCAuto<MEDCouplingUMesh> m(MEDCouplingUMesh::New("",2));
m->setCoords(skinOfRes2->getCoords());
m->allocateCells();
- m->insertNextCell(INTERP_KERNEL::NORM_POLYGON,vdi[0]->getNumberOfTuples(),vdi[0]->begin());
+ m->insertNextCell(INTERP_KERNEL::NORM_POLYGON,ToIdType(vdi[0]->getNumberOfTuples()),vdi[0]->begin());
return m;
}
MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::New("",2));
ret->setCoords(m->getCoords());
ret->allocateCells();
- ret->insertNextCell(INTERP_KERNEL::NORM_POLYGON,resConn.size(),&resConn[0]);
+ ret->insertNextCell(INTERP_KERNEL::NORM_POLYGON,ToIdType(resConn.size()),&resConn[0]);
return ret;
}
const int *cPtr(tmp2->getNodalConnectivity()->begin()),*ciPtr(tmp2->getNodalConnectivityIndex()->begin());
conn.insert(conn.end(),cPtr+1,cPtr+ciPtr[1]);
}
- MCAuto<DataArrayInt> remain(comm->buildComplement(skinOfRes->getNumberOfCells()));
+ MCAuto<DataArrayInt> remain(comm->buildComplement(ToIdType(skinOfRes->getNumberOfCells())));
{
MCAuto<MEDCouplingUMesh> tmp(skinOfRes->buildPartOfMySelf(remain->begin(),remain->end(),true));
const int *cPtr(tmp->getNodalConnectivity()->begin()),*ciPtr(tmp->getNodalConnectivityIndex()->begin());
conn.insert(conn.end(),cPtr+ciPtr[i]+1,cPtr+ciPtr[i+1]);
}
}
- ret->insertNextCell(INTERP_KERNEL::NORM_POLYHED,conn.size(),&conn[0]);
+ ret->insertNextCell(INTERP_KERNEL::NORM_POLYHED,ToIdType(conn.size()),&conn[0]);
return ret;
}
throw INTERP_KERNEL::Exception("Voronoize1D : spacedim must be equal to 1 and meshdim also equal to 1 !");
if(m->getNumberOfCells()!=1)
throw INTERP_KERNEL::Exception("Voronoize1D : mesh is expected to have only one cell !");
- int nbPts(points->getNumberOfTuples());
+ mcIdType nbPts=ToIdType(points->getNumberOfTuples());
if(nbPts<1)
throw INTERP_KERNEL::Exception("Voronoize1D : at least one point expected !");
std::vector<double> bbox(4);
throw INTERP_KERNEL::Exception("Voronoize2D : spacedim must be equal to 2 and meshdim also equal to 2 !");
if(m->getNumberOfCells()!=1)
throw INTERP_KERNEL::Exception("Voronoize2D : mesh is expected to have only one cell !");
- int nbPts(points->getNumberOfTuples());
+ mcIdType nbPts=ToIdType(points->getNumberOfTuples());
if(nbPts<1)
throw INTERP_KERNEL::Exception("Voronoize2D : at least one point expected !");
std::vector<double> bbox(4);
throw INTERP_KERNEL::Exception("Voronoize2D : internal error");
MCAuto<MEDCouplingUMesh> newVorCell;
{
- MCAuto<DataArrayInt> tmp(part->buildComplement(a->getNumberOfCells()));
+ MCAuto<DataArrayInt> tmp(part->buildComplement(ToIdType(a->getNumberOfCells())));
newVorCell=a->buildPartOfMySelf(tmp->begin(),tmp->end());
}
newVorCell->zipCoords();
throw INTERP_KERNEL::Exception("Voronoize3D : spacedim must be equal to 3 and meshdim also equal to 3 !");
if(m->getNumberOfCells()!=1)
throw INTERP_KERNEL::Exception("Voronoize3D : mesh is expected to have only one cell !");
- int nbPts(points->getNumberOfTuples());
+ mcIdType nbPts=ToIdType(points->getNumberOfTuples());
if(nbPts<1)
throw INTERP_KERNEL::Exception("Voronoize3D : at least one point expected !");
std::vector< MCAuto<MEDCouplingUMesh> > l0(1,MCAuto<MEDCouplingUMesh>(m->deepCopy()));
{
cells=Split3DCellInParts(tile,pt,seed,eps,tmp);
}
- catch(INTERP_KERNEL::Exception& e)
+ catch(INTERP_KERNEL::Exception&)
{
continue;
}