throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::splitProfilePerType : input profile is NULL !");
if(profile->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::splitProfilePerType : input profile should have exactly one component !");
- mcIdType nbTuples=ToIdType(profile->getNumberOfTuples()),nbOfCells=ToIdType(getNumberOfCells());
+ mcIdType nbTuples=profile->getNumberOfTuples(),nbOfCells=ToIdType(getNumberOfCells());
code.resize(3); idsInPflPerType.resize(1);
code[0]=(int)getCellModelEnum(); code[1]=nbTuples;
idsInPflPerType.resize(1);
{
checkConsistencyLight();
const DataArrayInt *c1(_conn);
- mcIdType nbOfTuples=ToIdType(c1->getNumberOfTuples());
+ mcIdType nbOfTuples(c1->getNumberOfTuples());
mcIdType nbOfNodesPerCell=ToIdType(_cm->getNumberOfNodes());
if(nbOfTuples%nbOfNodesPerCell!=0)
{
throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::Merge1SGTUMeshes : all items must have the same geo type !");
std::vector< MCAuto<MEDCoupling1SGTUMesh> > bb(sz);
std::vector< const MEDCoupling1SGTUMesh * > aa(sz);
- int spaceDim=-3;
+ mcIdType spaceDim=-3;
for(std::size_t i=0;i<sz && spaceDim==-3;i++)
{
const MEDCoupling1SGTUMesh *cur=a[i];
quadsTmp->findCommonCells(3,0,cc,cci);
ccSafe=cc; cciSafe=cci;
const int *ccPtr(ccSafe->begin());
- mcIdType nbOfPair=ToIdType(cci->getNumberOfTuples())-1;
+ mcIdType nbOfPair=cci->getNumberOfTuples()-1;
for(int i=0;i<nbOfPair;i++)
{ ptNeigh[ccPtr[2*i+0]]=ccPtr[2*i+1]/6; ptNeigh[ccPtr[2*i+1]]=ccPtr[2*i+0]/6; }
}
}
}
}
- ciArr->setIJ(i+1,0,ToIdType(cArr->getNumberOfTuples()));
+ ciArr->setIJ(i+1,0,cArr->getNumberOfTuples());
}
ret->setNodalConnectivity(cArr,ciArr);
return ret.retn();
}
std::vector<int> zePolyg(MEDCoupling1DGTUMesh::BuildAPolygonFromParts(polyg));
cArr->insertAtTheEnd(zePolyg.begin(),zePolyg.end());
- ciArr->setIJ(i+1,0,ToIdType(cArr->getNumberOfTuples()));
+ ciArr->setIJ(i+1,0,cArr->getNumberOfTuples());
}
ret->setNodalConnectivity(cArr,ciArr);
return ret.retn();
else
throw INTERP_KERNEL::Exception("Nodal connectivity array not defined !");
//
- mcIdType sz2=ToIdType(_conn->getNumberOfTuples());
+ mcIdType sz2(_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 !");
//
- mcIdType nbOfTuples=ToIdType(c1->getNumberOfTuples());
+ mcIdType nbOfTuples(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
- mcIdType nbOfCells=ToIdType(_conn_indx->getNumberOfTuples())-1;
+ mcIdType nbOfCells=_conn_indx->getNumberOfTuples()-1;
MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfCells,1);
int *retPtr=ret->getPointer();
return ret.retn();
}
// for polyhedrons
- mcIdType nbOfCells=ToIdType(_conn_indx->getNumberOfTuples())-1;
+ mcIdType nbOfCells=_conn_indx->getNumberOfTuples()-1;
MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfCells,1);
int *retPtr=ret->getPointer();
{
checkConsistencyLight();
_conn_indx->checkMonotonic(true);
- mcIdType nbOfCells=ToIdType(_conn_indx->getNumberOfTuples())-1;
+ mcIdType nbOfCells=_conn_indx->getNumberOfTuples()-1;
MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfCells,1);
int *retPtr(ret->getPointer());
{
getNumberOfCells();//only to check that all is well defined.
//
- std::size_t nbOfTuples(_conn->getNumberOfTuples());
+ mcIdType nbOfTuples(_conn->getNumberOfTuples());
int *pt(_conn->getPointer());
- for(std::size_t i=0;i<nbOfTuples;i++,pt++)
+ for(mcIdType i=0;i<nbOfTuples;i++,pt++)
{
if(*pt==-1) continue;
*pt+=offset;
{
getNumberOfCells();//only to check that all is well defined.
//
- mcIdType nbElemsIn(getNumberOfNodes()),nbOfTuples(ToIdType(_conn->getNumberOfTuples()));
+ mcIdType nbElemsIn(getNumberOfNodes()),nbOfTuples(_conn->getNumberOfTuples());
int *pt(_conn->getPointer());
for(int i=0;i<nbOfTuples;i++,pt++)
{
throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::Merge1DGTUMeshes : all items must have the same geo type !");
std::vector< MCAuto<MEDCoupling1DGTUMesh> > bb(sz);
std::vector< const MEDCoupling1DGTUMesh * > aa(sz);
- int spaceDim=-3;
+ mcIdType spaceDim=-3;
for(std::size_t i=0;i<sz && spaceDim==-3;i++)
{
const MEDCoupling1DGTUMesh *cur=a[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 !");
- std::size_t nbOfTuples=0;
+ mcIdType 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=ToIdType((*it)->getNumberOfTuples());
+ mcIdType curNbt=(*it)->getNumberOfTuples();
const int *inPt=(*it)->begin();
int offset=offsetInNodeIdsPerElt[i];
for(int j=0;j<curNbt;j++,pt++)
{
getNumberOfCells();//only to check that all is well defined.
int *begPtr(_conn->getPointer());
- mcIdType nbElt=ToIdType(_conn->getNumberOfTuples());
+ mcIdType nbElt(_conn->getNumberOfTuples());
int *endPtr(begPtr+nbElt);
for(int *it=begPtr;it!=endPtr;it++)
{
{
getNumberOfCells();//only to check that all is well defined.
//
- mcIdType nbOfTuples=ToIdType(_conn->getNumberOfTuples());
+ mcIdType nbOfTuples(_conn->getNumberOfTuples());
int *pt(_conn->getPointer());
for(int i=0;i<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(ToIdType(_x_array->getNumberOfTuples()));
+ ret.push_back(_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(ToIdType(_y_array->getNumberOfTuples()));
+ ret.push_back(_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(ToIdType(_z_array->getNumberOfTuples()));
+ ret.push_back(_z_array->getNumberOfTuples());
}
return ret;
}
std::string st;
if(thisArr[i])
{
- val=ToIdType(thisArr[i]->getNumberOfTuples());
+ val=thisArr[i]->getNumberOfTuples();
st=thisArr[i]->getInfoOnComponent(0);
}
tinyInfo.push_back(val);
for(int i=0;i<3;i++)
{
if(thisArr[i])
- sz+=ToIdType(thisArr[i]->getNumberOfTuples());
+ sz+=thisArr[i]->getNumberOfTuples();
}
a2=DataArrayDouble::New();
a2->alloc(sz,1);
stream2[i] << "set but not allocated.";
else
{
- mcIdType nbCompo=ToIdType(thisArr[i]->getNumberOfComponents());
+ std::size_t nbCompo=thisArr[i]->getNumberOfComponents();
if(nbCompo==1)
{
- mcIdType nbTuples=ToIdType(thisArr[i]->getNumberOfTuples());
+ mcIdType nbTuples=thisArr[i]->getNumberOfTuples();
if(nbTuples<1)
{ stream2[i] << "set and allocated - WARNING number of elements < 1 !"; nbOfCells=-1; nbOfNodes=-1; }
else
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkConsistencyLight : the array is not allocated !");
if(_coords->getNumberOfComponents()<1)
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkConsistencyLight : the array should have >= 1 components !");
- if(_coords->getNumberOfTuples()!=nbOfNodes)
+ if(_coords->getNumberOfTuples()!=ToIdType(nbOfNodes))
{
std::ostringstream oss; oss << "MEDCouplingCurveLinearMesh::checkConsistencyLight : structure said that number of nodes should be equal to " << nbOfNodes << " but number of tuples in array is equal to " << _coords->getNumberOfTuples() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
{
if(!((const DataArrayDouble *)_coords))
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getCoordinatesOfNode : Coordinates not set !");
- mcIdType nbOfCompo=ToIdType(_coords->getNumberOfComponents());
- if(nodeId>=0 && nodeId<(ToIdType(_coords->getNumberOfTuples())))
+ std::size_t nbOfCompo=_coords->getNumberOfComponents();
+ if(nodeId>=0 && nodeId<_coords->getNumberOfTuples())
coo.insert(coo.end(),_coords->begin()+nodeId*nbOfCompo,_coords->begin()+(nodeId+1)*nbOfCompo);
else
{ std::ostringstream oss; oss << "MEDCouplingCurveLinearMesh::getCoordinatesOfNode : nodeId has to be in [0," << _coords->getNumberOfTuples() << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); }
if(!((DataArrayDouble *)_coords))
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::rotate : no coordinates set !");
int spaceDim=getSpaceDimension();
- mcIdType nbNodes=ToIdType(_coords->getNumberOfTuples());
+ mcIdType nbNodes(_coords->getNumberOfTuples());
double *coords=_coords->getPointer();
if(spaceDim==3)
DataArrayDouble::Rotate3DAlg(center,vector,angle,nbNodes,coords,coords);
if(!((DataArrayDouble *)_coords))
throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::scale : no coordinates set !");
double *coords=_coords->getPointer();
- mcIdType nbNodes=ToIdType(_coords->getNumberOfTuples());
- mcIdType dim=ToIdType(_coords->getNumberOfComponents());
+ mcIdType nbNodes(_coords->getNumberOfTuples());
+ std::size_t dim(_coords->getNumberOfComponents());
for(int i=0;i<nbNodes;i++)
{
std::transform(coords+i*dim,coords+(i+1)*dim,point,coords+i*dim,std::minus<double>());
{ stream << std::endl << "No coordinates set !"; return ; }
if(!coo->isAllocated())
{ stream << std::endl << "Coordinates set but not allocated !"; return ; }
- mcIdType nbOfCompo=ToIdType(coo->getNumberOfComponents());
+ std::size_t nbOfCompo(coo->getNumberOfComponents());
int nbOfCompoExp(-1);
try
{
catch(INTERP_KERNEL::Exception&)
{
}
- if(nbOfCompo!=nbOfCompoExp)
+ if(ToIdType(nbOfCompo)!=nbOfCompoExp)
{ stream << std::endl << "Coordinates set and allocated but mismatch number of components !"; return ; }
stream << std::endl << "Coordinates ( number of tuples = " << coo->getNumberOfTuples() << " ) : ";
coo->reprQuickOverviewData(stream,200);
void MEDCouplingFieldDiscretization::normL1(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, double *res) const
{
MCAuto<MEDCouplingFieldDouble> vol=getMeasureField(mesh,true);
- mcIdType nbOfCompo=ToIdType(arr->getNumberOfComponents());
+ std::size_t nbOfCompo=arr->getNumberOfComponents();
int nbOfElems=getNumberOfTuples(mesh);
std::fill(res,res+nbOfCompo,0.);
const double *arrPtr=arr->getConstPointer();
for(int i=0;i<nbOfElems;i++)
{
double v=fabs(volPtr[i]);
- for(int j=0;j<nbOfCompo;j++)
+ for(std::size_t j=0;j<nbOfCompo;j++)
res[j]+=fabs(arrPtr[i*nbOfCompo+j])*v;
deno+=v;
}
void MEDCouplingFieldDiscretization::normL2(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, double *res) const
{
MCAuto<MEDCouplingFieldDouble> vol=getMeasureField(mesh,true);
- mcIdType nbOfCompo=ToIdType(arr->getNumberOfComponents());
+ std::size_t nbOfCompo=arr->getNumberOfComponents();
int nbOfElems=getNumberOfTuples(mesh);
std::fill(res,res+nbOfCompo,0.);
const double *arrPtr=arr->getConstPointer();
for(int i=0;i<nbOfElems;i++)
{
double v=fabs(volPtr[i]);
- for(int j=0;j<nbOfCompo;j++)
+ for(std::size_t j=0;j<nbOfCompo;j++)
res[j]+=arrPtr[i*nbOfCompo+j]*arrPtr[i*nbOfCompo+j]*v;
deno+=v;
}
if(!arr)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretization::integral : input array is NULL !");
MCAuto<MEDCouplingFieldDouble> vol=getMeasureField(mesh,isWAbs);
- std::size_t nbOfCompo(arr->getNumberOfComponents()),nbOfElems(getNumberOfTuples(mesh));
+ std::size_t nbOfCompo(arr->getNumberOfComponents());
+ mcIdType nbOfElems(getNumberOfTuples(mesh));
if(nbOfElems!=arr->getNumberOfTuples())
{
std::ostringstream oss; oss << "MEDCouplingFieldDiscretization::integral : field is not correct ! number of tuples in array is " << arr->getNumberOfTuples();
std::fill(res,res+nbOfCompo,0.);
const double *arrPtr(arr->begin()),*volPtr(vol->getArray()->begin());
INTERP_KERNEL::AutoPtr<double> tmp=new double[nbOfCompo];
- for(std::size_t i=0;i<nbOfElems;i++)
+ for(mcIdType i=0;i<nbOfElems;i++)
{
std::transform(arrPtr+i*nbOfCompo,arrPtr+(i+1)*nbOfCompo,(double *)tmp,std::bind2nd(std::multiplies<double>(),volPtr[i]));
std::transform((double *)tmp,(double *)tmp+nbOfCompo,res,res,std::plus<double>());
{
if(!arr)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr : input array is NULL !");
- mcIdType oldNbOfElems=ToIdType(arr->getNumberOfTuples());
- mcIdType nbOfComp=ToIdType(arr->getNumberOfComponents());
+ mcIdType oldNbOfElems=arr->getNumberOfTuples();
+ std::size_t nbOfComp=arr->getNumberOfComponents();
int newNbOfTuples=newNbOfEntity;
MCAuto<DataArrayDouble> arrCpy=arr->deepCopy();
const double *ptSrc=arrCpy->getConstPointer();
void MEDCouplingFieldDiscretization::RenumberEntitiesFromN2OArr(const int *new2OldPtr, int new2OldSz, DataArrayDouble *arr, const std::string& msg)
{
- mcIdType nbOfComp=ToIdType(arr->getNumberOfComponents());
+ std::size_t nbOfComp=arr->getNumberOfComponents();
MCAuto<DataArrayDouble> arrCpy=arr->deepCopy();
const double *ptSrc=arrCpy->getConstPointer();
arr->reAlloc(new2OldSz);
{
if(!mesh || !da)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::checkCoherencyBetween : NULL input mesh or DataArray !");
- if(mesh->getNumberOfCells()!=da->getNumberOfTuples())
+ if(ToIdType(mesh->getNumberOfCells())!=da->getNumberOfTuples())
{
std::ostringstream message;
message << "Field on cells invalid because there are " << mesh->getNumberOfCells();
mesh->getCellsContainingPoints(loc,nbOfPoints,_precision,eltsArr,eltsIndexArr);
const int *elts(eltsArr->begin()),*eltsIndex(eltsIndexArr->begin());
int spaceDim=mesh->getSpaceDimension();
- mcIdType nbOfComponents=ToIdType(arr->getNumberOfComponents());
+ std::size_t nbOfComponents=arr->getNumberOfComponents();
MCAuto<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);
- mcIdType sz=ToIdType(arr->getNumberOfComponents());
+ std::size_t sz=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();
- mcIdType nbOfComponents=ToIdType(arr->getNumberOfComponents());
+ std::size_t nbOfComponents=arr->getNumberOfComponents();
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(nbOfPoints,nbOfComponents);
double *ptToFill=ret->getPointer();
*/
void MEDCouplingFieldDiscretizationPerCell::renumberCells(const int *old2NewBg, bool check)
{
- mcIdType nbCells=ToIdType(_discr_per_cell->getNumberOfTuples());
+ mcIdType nbCells=_discr_per_cell->getNumberOfTuples();
const int *array=old2NewBg;
if(check)
array=DataArrayInt::CheckAndPreparePermutation(old2NewBg,old2NewBg+nbCells);
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode : invalid input code !");
int nbOfSplit=(int)idsPerType.size();
int nbOfTypes=(int)code.size()/3;
- std::size_t ret(0);
+ mcIdType ret(0);
for(int i=0;i<nbOfTypes;i++)
{
int nbOfEltInChunk=code[3*i+1];
if (_discr_per_cell == 0)
throw INTERP_KERNEL::Exception("Discretization is not initialized!");
const int *dcPtr=_discr_per_cell->getConstPointer();
- mcIdType nbOfTuples=ToIdType(_discr_per_cell->getNumberOfTuples());
+ mcIdType nbOfTuples=_discr_per_cell->getNumberOfTuples();
mcIdType maxSz=ToIdType(_loc.size());
for(const int *w=dcPtr;w!=dcPtr+nbOfTuples;w++)
{
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getOffsetArr : NULL input mesh !");
- std::size_t nbOfTuples(mesh->getNumberOfCells());
+ mcIdType nbOfTuples=ToIdType(mesh->getNumberOfCells());
MCAuto<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfTuples+1,1);
int *retPtr(ret->getPointer());
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getOffsetArr : mismatch between the mesh and the discretization ids array length !");
int maxPossible=(int)_loc.size();
retPtr[0]=0;
- for(std::size_t i=0;i<nbOfTuples;i++,start++)
+ for(mcIdType i=0;i<nbOfTuples;i++,start++)
{
if(*start>=0 && *start<maxPossible)
retPtr[i+1]=retPtr[i]+_loc[*start].getNumberOfGaussPt();
const int *array=old2NewBg;
if(check)
array=DataArrayInt::CheckAndPreparePermutation(old2NewBg,old2NewBg+mesh->getNumberOfCells());
- mcIdType nbOfCells=ToIdType(_discr_per_cell->getNumberOfTuples());
+ mcIdType nbOfCells=_discr_per_cell->getNumberOfTuples();
int nbOfTuples=getNumberOfTuples(0);
const int *dcPtr=_discr_per_cell->getConstPointer();
int *array2=new int[nbOfTuples];//stores the final conversion array old2New to give to arrays in renumberInPlace.
{
int val=-1;
if(_discr_per_cell)
- val=ToIdType(_discr_per_cell->getNumberOfTuples());
+ val=_discr_per_cell->getNumberOfTuples();
tinyInfo.push_back(val);
tinyInfo.push_back((int)_loc.size());
if(_loc.empty())
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
- std::size_t nbOfTuples(getNumberOfTuples(mesh));
+ mcIdType nbOfTuples(getNumberOfTuples(mesh));
if(nbOfTuples!=da->getNumberOfTuples())
{
std::ostringstream oss; oss << "Invalid number of tuples in the array : expecting " << nbOfTuples << " having " << da->getNumberOfTuples() << " !";
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::buildSubMeshDataRange : no discretization array set !");
di=0; beginOut=0; endOut=0; stepOut=stepCellIds;
const char msg[]="MEDCouplingFieldDiscretizationGauss::buildSubMeshDataRange : cell #";
- mcIdType nbOfTuples=ToIdType(_discr_per_cell->getNumberOfTuples());
+ mcIdType nbOfTuples=_discr_per_cell->getNumberOfTuples();
const int *w=_discr_per_cell->begin();
int nbMaxOfLocId=(int)_loc.size();
for(int i=0;i<nbOfTuples;i++,w++)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::computeTupleIdsToSelectFromCellIds : null mesh !");
MCAuto<DataArrayInt> nbOfNodesPerCell=buildNbOfGaussPointPerCellField();//check of _discr_per_cell not NULL pointer
std::size_t nbOfCells(mesh->getNumberOfCells());
- if(_discr_per_cell->getNumberOfTuples()!=nbOfCells)
+ if(_discr_per_cell->getNumberOfTuples()!=ToIdType(nbOfCells))
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::computeTupleIdsToSelectFromCellIds : mismatch of nb of tuples of cell ids array and number of cells !");
nbOfNodesPerCell->computeOffsetsFull();
MCAuto<DataArrayInt> sel=DataArrayInt::New(); sel->useArray(startCellIds,false,DeallocType::CPP_DEALLOC,(int)std::distance(startCellIds,endCellIds),1);
{
if(locId<0 || locId>=(int)_loc.size())
throw INTERP_KERNEL::Exception("Invalid locId given : must be in range [0:getNbOfGaussLocalization()) !");
- mcIdType nbOfTuples=ToIdType(_discr_per_cell->getNumberOfTuples());
+ mcIdType nbOfTuples=_discr_per_cell->getNumberOfTuples();
const int *ptr=_discr_per_cell->getConstPointer();
for(int i=0;i<nbOfTuples;i++)
if(ptr[i]==locId)
{
if(!_discr_per_cell)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::buildNbOfGaussPointPerCellField : no discretization array set !");
- mcIdType nbOfTuples=ToIdType(_discr_per_cell->getNumberOfTuples());
+ mcIdType nbOfTuples=_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();
- mcIdType nbOfTuples=ToIdType(_discr_per_cell->getNumberOfTuples());
+ mcIdType nbOfTuples=_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 || !arr)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::integral : input mesh or array is null !");
- mcIdType nbOfCompo=ToIdType(arr->getNumberOfComponents());
+ std::size_t nbOfCompo=arr->getNumberOfComponents();
std::fill(res,res+nbOfCompo,0.);
//
MCAuto<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();
- mcIdType nbOfCellsWithCurGeoType=ToIdType(ids->getNumberOfTuples());
+ mcIdType nbOfCellsWithCurGeoType=ids->getNumberOfTuples();
for(int i=0;i<nbOfCellsWithCurGeoType;i++,ptIds++,ptIds2+=wArrSz)
{
- for(int k=0;k<nbOfCompo;k++)
+ for(std::size_t k=0;k<nbOfCompo;k++)
{
double tmp=0.;
for(std::size_t j=0;j<wArrSz;j++)
void MEDCouplingFieldDiscretizationGaussNE::checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const
{
- std::size_t nbOfTuples(getNumberOfTuples(mesh));
+ mcIdType nbOfTuples(getNumberOfTuples(mesh));
if(nbOfTuples!=da->getNumberOfTuples())
{
std::ostringstream oss; oss << "Invalid number of tuples in the array : expecting " << nbOfTuples << " !";
MCAuto<DataArrayInt> ids=mesh->giveCellsWithType(*it);
MCAuto<DataArrayInt> ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell);
const int *ptIds2=ids2->begin(),*ptIds=ids->begin();
- mcIdType nbOfCellsWithCurGeoType=ToIdType(ids->getNumberOfTuples());
+ mcIdType nbOfCellsWithCurGeoType=ids->getNumberOfTuples();
for(int i=0;i<nbOfCellsWithCurGeoType;i++,ptIds++)
for(std::size_t j=0;j<wArrSz;j++,ptIds2++)
arrPtr[*ptIds2]=wArr2[j]*volPtr[*ptIds];
if(!arr || !arr->isAllocated())
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::getValueOnMulti : input array is null or not allocated !");
mcIdType nbOfRows=ToIdType(getNumberOfMeshPlaces(mesh));
- if(ToIdType(arr->getNumberOfTuples())!=nbOfRows)
+ if(arr->getNumberOfTuples()!=nbOfRows)
{
std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationKriging::getValueOnMulti : input array does not have correct number of tuples ! Excepted " << nbOfRows << " having " << arr->getNumberOfTuples() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- int nbCols(-1),nbCompo(ToIdType(arr->getNumberOfComponents()));
+ int nbCols(-1);
+ std::size_t nbCompo=arr->getNumberOfComponents();
MCAuto<DataArrayDouble> m(computeEvaluationMatrixOnGivenPts(mesh,loc,nbOfTargetPoints,nbCols));
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
ret->alloc(nbOfTargetPoints,nbCompo);
- INTERP_KERNEL::matrixProduct(m->begin(),nbOfTargetPoints,nbCols,arr->begin(),nbOfRows,nbCompo,ret->getPointer());
+ INTERP_KERNEL::matrixProduct(m->begin(),nbOfTargetPoints,nbCols,arr->begin(),nbOfRows,ToIdType(nbCompo),ret->getPointer());
return ret.retn();
}
MCAuto<DataArrayDouble> matrixInv(computeInverseMatrix(mesh,isDrift,nbRows));
//
MCAuto<DataArrayDouble> coords=getLocalizationOfDiscValues(mesh);
- mcIdType nbOfPts(ToIdType(coords->getNumberOfTuples())),dimension(ToIdType(coords->getNumberOfComponents()));
+ mcIdType nbOfPts(coords->getNumberOfTuples());
+ std::size_t dimension(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));
- mcIdType nbOfPts=ToIdType(coords->getNumberOfTuples());
+ mcIdType nbOfPts(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(),ToIdType(arr2->getNumberOfTuples()),1,KnewiK->getPointer());
+ INTERP_KERNEL::matrixProduct(matrixInv->getConstPointer(),nbRows,nbRows,arr2->getConstPointer(),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 !");
- mcIdType spaceDimension=ToIdType(arr->getNumberOfComponents()),nbOfPts=ToIdType(arr->getNumberOfTuples()),nbOfEltInMatrx=ToIdType(matr->getNumberOfTuples());
- delta=spaceDimension+1;
+ std::size_t spaceDimension(arr->getNumberOfComponents());
+ mcIdType nbOfPts(arr->getNumberOfTuples()),nbOfEltInMatrx(matr->getNumberOfTuples());
+ delta=ToIdType(spaceDimension)+1;
int nbOfCols(nbOfEltInMatrx/nbOfPts);
if(nbOfEltInMatrx%nbOfPts!=0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::PerformDriftRect : size of input dense matrix and input arrays mismatch ! NbOfElems in matrix % nb of tuples in array must be equal to 0 !");
*/
DataArrayDouble *MEDCouplingFieldDiscretizationKriging::performDrift(const DataArrayDouble *matr, const DataArrayDouble *arr, int& delta) const
{
- mcIdType spaceDimension=ToIdType(arr->getNumberOfComponents());
- delta=spaceDimension+1;
- mcIdType szOfMatrix=ToIdType(arr->getNumberOfTuples());
- if(szOfMatrix*szOfMatrix!=ToIdType(matr->getNumberOfTuples()))
+ std::size_t spaceDimension(arr->getNumberOfComponents());
+ delta=ToIdType(spaceDimension)+1;
+ mcIdType szOfMatrix(arr->getNumberOfTuples());
+ if(szOfMatrix*szOfMatrix!=matr->getNumberOfTuples())
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::performDrift : invalid size");
MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc((szOfMatrix+delta)*(szOfMatrix+delta),1);
std::fill(destWork,destWork+spaceDimension+1,0.); destWork+=spaceDimension+1;
MCAuto<DataArrayDouble> arrNoI=arr->toNoInterlace();
srcWork2=arrNoI->getConstPointer();
- for(mcIdType i=0;i<spaceDimension;i++)
+ for(std::size_t i=0;i<spaceDimension;i++)
{
destWork=std::copy(srcWork2,srcWork2+szOfMatrix,destWork);
srcWork2+=szOfMatrix;
std::vector< MCAuto<DataArrayDouble> > outArrsSafe(sz); std::vector<DataArrayDouble *> outArrs(sz);
for(std::size_t j=0;j<sz;j++)
{
- mcIdType nbCompo=ToIdType(arrs[j]->getNumberOfComponents());
+ std::size_t nbCompo(arrs[j]->getNumberOfComponents());
outArrsSafe[j]=DataArrayDouble::New(); outArrsSafe[j]->alloc(nbCells,nbCompo);
outArrsSafe[j]->copyStringInfoFrom(*arrs[j]);
outArrs[j]=outArrsSafe[j];
MCAuto<DataArrayDouble> arr=getArray()->deepCopy();
arr->multiplyEqual(w->getArray());
arr->accumulate(res);
- mcIdType nCompo = ToIdType(getArray()->getNumberOfComponents());
+ std::size_t nCompo = getArray()->getNumberOfComponents();
std::transform(res,res+nCompo,res,std::bind2nd(std::multiplies<double>(),1./deno));
}
*/
double MEDCouplingFieldDouble::getWeightedAverageValue(int compId, bool isWAbs) const
{
- mcIdType nbComps=ToIdType(getArray()->getNumberOfComponents());
- if(compId<0 || compId>=nbComps)
+ std::size_t nbComps=getArray()->getNumberOfComponents();
+ if(compId<0 || compId>=ToIdType(nbComps))
{
std::ostringstream oss; oss << "MEDCouplingFieldDouble::getWeightedAverageValue : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !";
throw INTERP_KERNEL::Exception(oss.str());
throw INTERP_KERNEL::Exception("No mesh underlying this field to perform normL1 !");
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform normL1 !");
- mcIdType nbComps=ToIdType(getArray()->getNumberOfComponents());
- if(compId<0 || compId>=nbComps)
+ std::size_t nbComps=getArray()->getNumberOfComponents();
+ if(compId<0 || compId>=ToIdType(nbComps))
{
std::ostringstream oss; oss << "MEDCouplingFieldDouble::normL1 : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !";
throw INTERP_KERNEL::Exception(oss.str());
throw INTERP_KERNEL::Exception("No mesh underlying this field to perform normL2");
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform normL2 !");
- mcIdType nbComps=ToIdType(getArray()->getNumberOfComponents());
- if(compId<0 || compId>=nbComps)
+ std::size_t nbComps=getArray()->getNumberOfComponents();
+ if(compId<0 || compId>=ToIdType(nbComps))
{
std::ostringstream oss; oss << "MEDCouplingFieldDouble::normL2 : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !";
throw INTERP_KERNEL::Exception(oss.str());
{
if(getArray()==0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::normMax : no default array defined !");
- mcIdType nbComps=ToIdType(getArray()->getNumberOfComponents());
- if(compId<0 || compId>=nbComps)
+ std::size_t nbComps=getArray()->getNumberOfComponents();
+ if(compId<0 || compId>=ToIdType(nbComps))
{
std::ostringstream oss; oss << "MEDCouplingFieldDouble::normMax : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !";
throw INTERP_KERNEL::Exception(oss.str());
throw INTERP_KERNEL::Exception("No mesh underlying this field to perform integral");
if(_type.isNull())
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform integral !");
- mcIdType nbComps=ToIdType(getArray()->getNumberOfComponents());
- if(compId<0 || compId>=nbComps)
+ std::size_t nbComps=getArray()->getNumberOfComponents();
+ if(compId<0 || compId>=ToIdType(nbComps))
{
std::ostringstream oss; oss << "MEDCouplingFieldDouble::integral : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !";
throw INTERP_KERNEL::Exception(oss.str());
inpMeshBase=fieldToWO->getMesh();
inpMesh=inpMeshBase->buildUnstructured();
}
- mcIdType nbCells=ToIdType(inpMesh->getNumberOfCells());
+ std::size_t nbCells(inpMesh->getNumberOfCells());
const MEDCouplingFieldDiscretization *disc(fieldToWO->getDiscretization());
const MEDCouplingFieldDiscretizationGauss *disc2(dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(disc));
if(!disc2)
{
if(getArray()->isAllocated())
{
- mcIdType nbOfCompo=ToIdType(getArray()->getNumberOfComponents());
+ std::size_t nbOfCompo=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(mcIdType i=0;i<nbOfCompo;i++)
+ for(std::size_t i=0;i<nbOfCompo;i++)
ret << "\"" << getArray()->getInfoOnComponent(i) << "\" ";
ret << "\n";
}
const double *coords(mesh->getCoords()->begin());
const int *connI(mesh->getNodalConnectivityIndex()->begin()),*conn(mesh->getNodalConnectivity()->begin());
//
- mcIdType nbPts=ToIdType(ptsInRefCoo->getNumberOfTuples());
+ mcIdType nbPts(ptsInRefCoo->getNumberOfTuples());
INTERP_KERNEL::NormalizedCellType typ(getType());
int dim(INTERP_KERNEL::CellModel::GetCellModel(typ).getDimension()),outDim(mesh->getSpaceDimension());
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : the parameters 1 or 3 are NULL or not allocated !");
std::size_t meshDim(coarseSt.size());
mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseSt)),nbOfTuplesInFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(fineLocInCoarse));
- mcIdType nbCompo=ToIdType(fineDA->getNumberOfComponents());
- if(ToIdType(coarseDA->getNumberOfComponents())!=nbCompo)
+ std::size_t nbCompo=fineDA->getNumberOfComponents();
+ if(coarseDA->getNumberOfComponents()!=nbCompo)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : the number of components of fine DA and coarse one mismatches !");
if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size())
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !");
- if(ToIdType(coarseDA->getNumberOfTuples())!=nbOfTuplesInCoarseExp)
+ if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp)
{
std::ostringstream oss; oss << "MEDCouplingIMesh::CondenseFineToCoarse : Expecting " << nbOfTuplesInCoarseExp << " tuples having " << coarseDA->getNumberOfTuples() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- mcIdType nbTuplesFine=ToIdType(fineDA->getNumberOfTuples());
+ mcIdType nbTuplesFine(fineDA->getNumberOfTuples());
if(nbOfTuplesInFineExp==0)
{
if(nbTuplesFine==0)
std::vector<int> coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus<int>(),2*ghostSize));
std::size_t meshDim(coarseSt.size());
mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG));
- mcIdType nbCompo=ToIdType(fineDA->getNumberOfComponents());
- if(ToIdType(coarseDA->getNumberOfComponents())!=nbCompo)
+ std::size_t nbCompo(fineDA->getNumberOfComponents());
+ if(coarseDA->getNumberOfComponents()!=nbCompo)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarseGhost : the number of components of fine DA and coarse one mismatches !");
if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size())
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarseGhost : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !");
- if(ToIdType(coarseDA->getNumberOfTuples())!=nbOfTuplesInCoarseExp)
+ if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp)
{
std::ostringstream oss; oss << "MEDCouplingIMesh::CondenseFineToCoarseGhost : Expecting " << nbOfTuplesInCoarseExp << " tuples in coarse DataArray having " << coarseDA->getNumberOfTuples() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
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));
- mcIdType nbTuplesFine(ToIdType(fineDA->getNumberOfTuples())),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG));
- if(ToIdType(fineDA->getNumberOfTuples())!=nbTuplesFineExp)
+ mcIdType nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG));
+ if(fineDA->getNumberOfTuples()!=nbTuplesFineExp)
{
std::ostringstream oss; oss << "MEDCouplingIMesh::CondenseFineToCoarseGhost : Expecting " << nbTuplesFineExp << " tuples in fine DataArray having " << nbTuplesFine << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : the parameters 1 or 3 are NULL or not allocated !");
std::size_t meshDim(coarseSt.size());
mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseSt)),nbOfTuplesInFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(fineLocInCoarse));
- mcIdType nbCompo=ToIdType(fineDA->getNumberOfComponents());
- if(ToIdType(coarseDA->getNumberOfComponents())!=nbCompo)
+ std::size_t nbCompo=fineDA->getNumberOfComponents();
+ if(coarseDA->getNumberOfComponents()!=nbCompo)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : the number of components of fine DA and coarse one mismatches !");
if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size())
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !");
- if(ToIdType(coarseDA->getNumberOfTuples())!=nbOfTuplesInCoarseExp)
+ if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp)
{
std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFine : Expecting " << nbOfTuplesInCoarseExp << " tuples having " << coarseDA->getNumberOfTuples() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- mcIdType nbTuplesFine=ToIdType(fineDA->getNumberOfTuples());
+ mcIdType nbTuplesFine(fineDA->getNumberOfTuples());
if(nbTuplesFine%nbOfTuplesInFineExp!=0)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : Invalid nb of tuples in fine DataArray regarding its structure !");
int fact(std::accumulate(facts.begin(),facts.end(),1,std::multiplies<int>()));
std::vector<int> coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus<int>(),2*ghostSize));
std::size_t meshDim(coarseSt.size());
mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG));
- mcIdType nbCompo=ToIdType(fineDA->getNumberOfComponents());
- if(ToIdType(coarseDA->getNumberOfComponents())!=nbCompo)
+ std::size_t nbCompo=fineDA->getNumberOfComponents();
+ if(coarseDA->getNumberOfComponents()!=nbCompo)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhost : the number of components of fine DA and coarse one mismatches !");
if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size())
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhost : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !");
- if(ToIdType(coarseDA->getNumberOfTuples())!=nbOfTuplesInCoarseExp)
+ if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp)
{
std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFineGhost : Expecting " << nbOfTuplesInCoarseExp << " tuples having " << coarseDA->getNumberOfTuples() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
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));
- mcIdType nbTuplesFine=ToIdType(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG));
- if(ToIdType(fineDA->getNumberOfTuples())!=nbTuplesFineExp)
+ mcIdType nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG));
+ if(fineDA->getNumberOfTuples()!=nbTuplesFineExp)
{
std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFineGhost : Expecting " << nbTuplesFineExp << " tuples in fine DataArray having " << nbTuplesFine << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
case 2:
{
- SpreadCoarseToFineGhost2D(inPtr,outPtr,nbCompo,coarseSt,fineLocInCoarse,facts,ghostSize);
+ SpreadCoarseToFineGhost2D(inPtr,outPtr,ToIdType(nbCompo),coarseSt,fineLocInCoarse,facts,ghostSize);
break;
}
case 3:
int nxyWgCoarse((coarseSt[0]+2*ghostSize)*(coarseSt[1]+2*ghostSize)),nxyWgFine((dims[0]*fact0+2*ghostSize)*(dims[1]*fact1+2*ghostSize));
int offset((fineLocInCoarse[2].first+ghostSize-1)*nxyWgCoarse);//offset is always >=0 thanks to the fact that ghostSize>=1 !
for(int i=0;i<ghostSize;i++,outPtr+=nxyWgFine*nbCompo)
- SpreadCoarseToFineGhost2D(inPtr+offset*nbCompo,outPtr,nbCompo,coarseSt,fineLocInCoarse,facts,ghostSize);
+ SpreadCoarseToFineGhost2D(inPtr+offset*nbCompo,outPtr,ToIdType(nbCompo),coarseSt,fineLocInCoarse,facts,ghostSize);
offset+=nxyWgCoarse;
for(int i=0;i<dims[2];i++,offset+=nxyWgCoarse)
for(int j=0;j<fact2;j++,outPtr+=nxyWgFine*nbCompo)
- SpreadCoarseToFineGhost2D(inPtr+offset*nbCompo,outPtr,nbCompo,coarseSt,fineLocInCoarse,facts,ghostSize);
+ SpreadCoarseToFineGhost2D(inPtr+offset*nbCompo,outPtr,ToIdType(nbCompo),coarseSt,fineLocInCoarse,facts,ghostSize);
for(int i=0;i<ghostSize;i++,outPtr+=nxyWgFine*nbCompo)
- SpreadCoarseToFineGhost2D(inPtr+offset*nbCompo,outPtr,nbCompo,coarseSt,fineLocInCoarse,facts,ghostSize);
+ SpreadCoarseToFineGhost2D(inPtr+offset*nbCompo,outPtr,ToIdType(nbCompo),coarseSt,fineLocInCoarse,facts,ghostSize);
break;
}
default:
std::vector<int> coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus<int>(),2*ghostSize));
std::size_t meshDim(coarseSt.size());
mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG));
- mcIdType nbCompo=ToIdType(fineDA->getNumberOfComponents());
- if(ToIdType(coarseDA->getNumberOfComponents())!=nbCompo)
+ std:size_t nbCompo=fineDA->getNumberOfComponents();
+ if(coarseDA->getNumberOfComponents()!=nbCompo)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhostZone : the number of components of fine DA and coarse one mismatches !");
if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size())
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhostZone : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !");
- if(ToIdType(coarseDA->getNumberOfTuples())!=nbOfTuplesInCoarseExp)
+ if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp)
{
std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFineGhostZone : Expecting " << nbOfTuplesInCoarseExp << " tuples having " << coarseDA->getNumberOfTuples() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
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));
- mcIdType nbTuplesFine=ToIdType(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG));
- if(ToIdType(fineDA->getNumberOfTuples())!=nbTuplesFineExp)
+ mcIdType nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG));
+ if(fineDA->getNumberOfTuples()!=nbTuplesFineExp)
{
std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFineGhostZone : Expecting " << nbTuplesFineExp << " tuples in fine DataArray having " << nbTuplesFine << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
case 2:
{
- SpreadCoarseToFineGhostZone2D(inPtr,outPtr,nbCompo,coarseSt,fineLocInCoarse,facts,ghostSize);
+ SpreadCoarseToFineGhostZone2D(inPtr,outPtr,ToIdType(nbCompo),coarseSt,fineLocInCoarse,facts,ghostSize);
break;
}
case 3:
int nxyWgCoarse((coarseSt[0]+2*ghostSize)*(coarseSt[1]+2*ghostSize)),nxyWgFine((dims[0]*fact0+2*ghostSize)*(dims[1]*fact1+2*ghostSize));
int offset((fineLocInCoarse[2].first+ghostSize-1)*nxyWgCoarse);//offset is always >=0 thanks to the fact that ghostSize>=1 !
for(int i=0;i<ghostSize;i++,outPtr+=nxyWgFine*nbCompo)
- SpreadCoarseToFineGhost2D(inPtr+offset*nbCompo,outPtr,nbCompo,coarseSt,fineLocInCoarse,facts,ghostSize);
+ SpreadCoarseToFineGhost2D(inPtr+offset*nbCompo,outPtr,ToIdType(nbCompo),coarseSt,fineLocInCoarse,facts,ghostSize);
offset+=nxyWgCoarse;
for(int i=0;i<dims[2];i++,offset+=nxyWgCoarse)
for(int j=0;j<fact2;j++,outPtr+=nxyWgFine*nbCompo)
- SpreadCoarseToFineGhostZone2D(inPtr+offset*nbCompo,outPtr,nbCompo,coarseSt,fineLocInCoarse,facts,ghostSize);
+ SpreadCoarseToFineGhostZone2D(inPtr+offset*nbCompo,outPtr,ToIdType(nbCompo),coarseSt,fineLocInCoarse,facts,ghostSize);
for(int i=0;i<ghostSize;i++,outPtr+=nxyWgFine*nbCompo)
- SpreadCoarseToFineGhost2D(inPtr+offset*nbCompo,outPtr,nbCompo,coarseSt,fineLocInCoarse,facts,ghostSize);
+ SpreadCoarseToFineGhost2D(inPtr+offset*nbCompo,outPtr,ToIdType(nbCompo),coarseSt,fineLocInCoarse,facts,ghostSize);
break;
}
default:
MCAuto<DataArrayInt> tmp(_mesh2D->giveCellsWithType(revExtTyp));
mcIdType nbOfLevs=ToIdType(_mesh1D->getNumberOfCells());
mcIdType nbOfCells2D=ToIdType(_mesh2D->getNumberOfCells());
- mcIdType nbOfTuples=ToIdType(tmp->getNumberOfTuples());
+ mcIdType nbOfTuples(tmp->getNumberOfTuples());
ret->alloc(nbOfLevs*nbOfTuples,1);
int *pt(ret->getPointer());
for(int i=0;i<nbOfLevs;i++,pt+=nbOfTuples)
vec->checkAllocated();
if(vec->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DenseMatrix::MatVecMult : input vector must have only one component !");
- if(ToIdType(vec->getNumberOfTuples())!=mat->getNumberOfCols())
+ if(vec->getNumberOfTuples()!=mat->getNumberOfCols())
throw INTERP_KERNEL::Exception("DenseMatrix::MatVecMult : Number of columns of this must be equal to number of tuples of vec !");
MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(mat->getNumberOfRows(),1);
- INTERP_KERNEL::matrixProduct(mat->getData()->begin(),mat->getNumberOfRows(),mat->getNumberOfCols(),vec->begin(),ToIdType(vec->getNumberOfTuples()),1,ret->getPointer());
+ INTERP_KERNEL::matrixProduct(mat->getData()->begin(),mat->getNumberOfRows(),mat->getNumberOfCols(),vec->begin(),vec->getNumberOfTuples(),1,ret->getPointer());
return ret.retn();
}
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),ToIdType(a2->getNumberOfTuples()),1));
+ MCAuto<DenseMatrix> a2Bis(DenseMatrix::New(const_cast<DataArrayDouble *>(a2),a2->getNumberOfTuples(),1));
return DenseMatrix::Multiply(a1,a2Bis);
}
checkAllocated();
mcIdType nbTuple(getNumberOfTuples());
std::size_t nbComps(getNumberOfComponents());
- if(nbComps!=std::distance(tupleBg,tupleEnd))
+ if(nbComps!=(std::size_t)std::distance(tupleBg,tupleEnd))
{ std::ostringstream oss; oss << "DataArrayDouble::distanceToTuple : size of input tuple is " << std::distance(tupleBg,tupleEnd) << " should be equal to the number of components in this : " << nbComps << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); }
if(nbTuple==0)
throw INTERP_KERNEL::Exception("DataArrayDouble::distanceToTuple : no tuple in this ! No distance to compute !");
ret->alloc(nbOfTuple,1);
double *retPtr=ret->getPointer();
const double *a1Ptr=a1->begin(),*a2Ptr(a2->begin());
- for(std::size_t i=0;i<nbOfTuple;i++)
+ for(mcIdType i=0;i<nbOfTuple;i++)
{
double sum=0.;
for(std::size_t j=0;j<nbOfComp;j++)
std::string DataArrayDoubleTuple::repr() const
{
std::ostringstream oss; oss.precision(17); oss << "(";
- for(int i=0;i<_nb_of_compo-1;i++)
+ for(std::size_t i=0;i<_nb_of_compo-1;i++)
oss << _pt[i] << ", ";
oss << _pt[_nb_of_compo-1] << ")";
return oss.str();
std::string DataArrayInt32Tuple::repr() const
{
std::ostringstream oss; oss << "(";
- for(mcIdType i=0;i<_nb_of_compo-1;i++)
+ for(std::size_t i=0;i<_nb_of_compo-1;i++)
oss << _pt[i] << ", ";
oss << _pt[_nb_of_compo-1] << ")";
return oss.str();
std::string DataArrayInt64Tuple::repr() const
{
std::ostringstream oss; oss << "(";
- for(mcIdType i=0;i<_nb_of_compo-1;i++)
+ for(std::size_t i=0;i<_nb_of_compo-1;i++)
oss << _pt[i] << ", ";
oss << _pt[_nb_of_compo-1] << ")";
return oss.str();
if(this->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::switchOnTupleEqualTo : number of components of this should be equal to one !");
mcIdType nbOfTuples(this->getNumberOfTuples());
- if(nbOfTuples!=vec.size())
+ if(nbOfTuples!=ToIdType(vec.size()))
throw INTERP_KERNEL::Exception("DataArrayInt::switchOnTupleEqualTo : number of tuples of this should be equal to size of input vector of bool !");
const T *pt(this->begin());
for(mcIdType i=0;i<nbOfTuples;i++)
std::ostringstream oss2; oss2 << "[";
std::string oss2Str(oss2.str());
bool isFinished=true;
- for(std::size_t i=0;i<nbOfTuples && isFinished;i++)
+ for(mcIdType i=0;i<nbOfTuples && isFinished;i++)
{
if(nbOfCompo>1)
{
previousArrI=*arrIPtr;
*arrIPtr=ToIdType(arrOut.size());
}
- if(arr->getNumberOfTuples()==arrOut.size())
+ if(arr->getNumberOfTuples()==ToIdType(arrOut.size()))
return false;
arr->alloc(arrOut.size(),1);
std::copy(arrOut.begin(),arrOut.end(),arr->getPointer());
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayChar::isUniform : must be applied on DataArrayChar with only one component, you can call 'rearrange' method before !");
- mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
+ mcIdType nbOfTuples=getNumberOfTuples();
const char *w=getConstPointer();
const char *end2=w+nbOfTuples;
for(;w!=end2;w++)
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);
- mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
+ mcIdType nbOfTuples=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);
- mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
+ mcIdType nbOfTuples=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();
- mcIdType nbOfCompo=ToIdType(getNumberOfComponents());
- if(nbOfCompo!=1)
+ if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayChar::findIdSequence : works only for DataArrayChar instance with one component !");
const char *cptr=getConstPointer();
std::size_t nbOfVals=getNbOfElems();
int DataArrayChar::findIdFirstEqualTuple(const std::vector<char>& tupl) const
{
checkAllocated();
- mcIdType nbOfCompo=ToIdType(getNumberOfComponents());
+ std::size_t nbOfCompo=getNumberOfComponents();
if(nbOfCompo==0)
throw INTERP_KERNEL::Exception("DataArrayChar::findIdFirstEqualTuple : 0 components in 'this' !");
- if(nbOfCompo!=(int)tupl.size())
+ if(nbOfCompo!=tupl.size())
{
std::ostringstream oss; oss << "DataArrayChar::findIdFirstEqualTuple : 'this' contains " << nbOfCompo << " components and searching for a tuple of length " << tupl.size() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
if(std::distance(cptr,work)%nbOfCompo!=0)
work++;
else
- return ToIdType(std::distance(cptr,work))/nbOfCompo;
+ return ToIdType(std::distance(cptr,work)/nbOfCompo);
}
}
return -1;
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayChar::presenceOfValue : the array must have only one component, you can call 'rearrange' method before !");
const char *cptr=getConstPointer();
- mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
+ mcIdType nbOfTuples=getNumberOfTuples();
const char *ret=std::find(cptr,cptr+nbOfTuples,value);
if(ret!=cptr+nbOfTuples)
return ToIdType(std::distance(cptr,ret));
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();
- mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
+ mcIdType nbOfTuples=getNumberOfTuples();
for(const char *w=cptr;w!=cptr+nbOfTuples;w++)
if(vals2.find(*w)!=vals2.end())
return ToIdType(std::distance(cptr,w));
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);
- mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
+ mcIdType nbOfTuples=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());
- std::size_t nbt=(*it++)->getNumberOfTuples();
+ mcIdType 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();
- std::size_t nbOfTuples=(*it)->getNumberOfTuples();
- std::vector<int> nbc(a.size());
+ mcIdType nbOfTuples=(*it)->getNumberOfTuples();
+ std::vector<std::size_t> nbc(a.size());
std::vector<const char *> pts(a.size());
- nbc[0]=ToIdType((*it)->getNumberOfComponents());
+ nbc[0]=(*it)->getNumberOfComponents();
pts[0]=(*it++)->getConstPointer();
for(std::size_t i=1;it!=a.end();it++,i++)
{
if(nbOfTuples!=(*it)->getNumberOfTuples())
throw INTERP_KERNEL::Exception("DataArrayChar::meld : mismatch of number of tuples !");
- nbc[i]=ToIdType((*it)->getNumberOfComponents());
+ nbc[i]=(*it)->getNumberOfComponents();
pts[i]=(*it)->getConstPointer();
}
- int totalNbOfComp=std::accumulate(nbc.begin(),nbc.end(),0);
+ std::size_t totalNbOfComp=std::accumulate(nbc.begin(),nbc.end(),(std::size_t)0);
DataArrayChar *ret=a[0]->buildEmptySpecializedDAChar();
ret->alloc(nbOfTuples,totalNbOfComp);
char *retPtr=ret->getPointer();
- for(std::size_t i=0;i<nbOfTuples;i++)
+ for(mcIdType i=0;i<nbOfTuples;i++)
for(int j=0;j<(int)a.size();j++)
{
retPtr=std::copy(pts[j],pts[j]+nbc[j],retPtr);
}
int k=0;
for(int i=0;i<(int)a.size();i++)
- for(int j=0;j<nbc[i];j++,k++)
+ for(std::size_t j=0;j<nbc[i];j++,k++)
ret->setInfoOnComponent(k,a[i]->getInfoOnComponent(j));
return ret;
}
if(_mem.reprHeader(ToIdType(getNumberOfComponents()),stream))
{
const char *data=begin();
- mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
- mcIdType nbCompo=ToIdType(getNumberOfComponents());
+ mcIdType nbOfTuples=getNumberOfTuples();
+ std::size_t nbCompo=getNumberOfComponents();
for(int i=0;i<nbOfTuples;i++,data+=nbCompo)
{
stream << "Tuple #" << i << " : ";
void DataArrayByte::reprCppStream(const std::string& varName, std::ostream& stream) const
{
- mcIdType nbTuples=ToIdType(getNumberOfTuples()),nbComp=ToIdType(getNumberOfComponents());
+ mcIdType nbTuples=getNumberOfTuples();
+ std::size_t nbComp=getNumberOfComponents();
const char *data=getConstPointer();
stream << "DataArrayByte *" << varName << "=DataArrayByte::New();" << std::endl;
if(nbTuples*nbComp>=1)
std::size_t nbOfCompo=_info_on_compo.size();
if(nbOfCompo>=1)
{
- std::size_t nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=getNumberOfTuples();
stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl;
reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR);
}
void DataArrayByte::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const
{
const char *data=begin();
- mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
- mcIdType nbOfCompo=ToIdType(_info_on_compo.size());
+ mcIdType nbOfTuples=getNumberOfTuples();
+ std::size_t nbOfCompo=_info_on_compo.size();
std::ostringstream oss2; oss2 << "[";
std::string oss2Str(oss2.str());
bool isFinished=true;
if(nbOfCompo>1)
{
oss2 << "(";
- for(int j=0;j<nbOfCompo;j++,data++)
+ for(std::size_t j=0;j<nbOfCompo;j++,data++)
{
oss2 << (int)*data;
if(j!=nbOfCompo-1) oss2 << ", ";
checkAllocated();
if(getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("DataArrayByte::toVectorOfBool : this method can be used only if this has one component !");
- mcIdType nbt=ToIdType(getNumberOfTuples());
+ mcIdType nbt(getNumberOfTuples());
std::vector<bool> ret(nbt,false);
const char *pt(begin());
for(int i=0;i<nbt;i++,pt++)
_da->incrRef();
if(_da->isAllocated())
{
- _nb_comp=ToIdType(da->getNumberOfComponents());
- _nb_tuple=ToIdType(da->getNumberOfTuples());
+ _nb_comp=da->getNumberOfComponents();
+ _nb_tuple=da->getNumberOfTuples();
_pt=da->getPointer();
}
}
std::string DataArrayByteTuple::repr() const
{
std::ostringstream oss; oss << "(";
- for(int i=0;i<_nb_of_compo-1;i++)
+ for(std::size_t i=0;i<_nb_of_compo-1;i++)
oss << (int)_pt[i] << ", ";
oss << _pt[_nb_of_compo-1] << ")";
return oss.str();
if(_mem.reprHeader(ToIdType(getNumberOfComponents()),stream))
{
const char *data=begin();
- mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
- mcIdType nbCompo=ToIdType(getNumberOfComponents());
+ mcIdType nbOfTuples=getNumberOfTuples();
+ std::size_t nbCompo=getNumberOfComponents();
for(int i=0;i<nbOfTuples;i++,data+=nbCompo)
{
stream << "Tuple #" << i << " : \"";
void DataArrayAsciiChar::reprCppStream(const std::string& varName, std::ostream& stream) const
{
- mcIdType nbTuples=ToIdType(getNumberOfTuples()),nbComp=ToIdType(getNumberOfComponents());
+ mcIdType nbTuples=getNumberOfTuples();
+ std::size_t nbComp=getNumberOfComponents();
const char *data=getConstPointer();
stream << "DataArrayAsciiChar *" << varName << "=DataArrayAsciiChar::New();" << std::endl;
if(nbTuples*nbComp>=1)
std::size_t nbOfCompo=_info_on_compo.size();
if(nbOfCompo>=1)
{
- std::size_t nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=getNumberOfTuples();
stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl;
reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR);
}
void DataArrayAsciiChar::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const
{
const char *data=begin();
- mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
- mcIdType nbOfCompo=ToIdType(_info_on_compo.size());
+ mcIdType nbOfTuples=getNumberOfTuples();
+ std::size_t nbOfCompo=_info_on_compo.size();
std::ostringstream oss2; oss2 << "[";
std::string oss2Str(oss2.str());
bool isFinished=true;
for(int i=0;i<nbOfTuples && isFinished;i++)
{
bool isAscii=true;
- for(int j=0;j<nbOfCompo;j++)
+ for(std::size_t j=0;j<nbOfCompo;j++)
if(data[j]<32) isAscii=false;
if(isAscii)
{
oss2 << "\'";
- for(int j=0;j<nbOfCompo;j++,data++)
+ for(std::size_t j=0;j<nbOfCompo;j++,data++)
oss2 << *data;
oss2 << "\'";
}
else
{
oss2 << "(";
- for(int j=0;j<nbOfCompo;j++,data++)
+ for(std::size_t j=0;j<nbOfCompo;j++,data++)
{
oss2 << (int)*data;
if(j!=nbOfCompo-1) oss2 << ", ";
_da->incrRef();
if(_da->isAllocated())
{
- _nb_comp=ToIdType(da->getNumberOfComponents());
- _nb_tuple=ToIdType(da->getNumberOfTuples());
+ _nb_comp=da->getNumberOfComponents();
+ _nb_tuple=da->getNumberOfTuples();
_pt=da->getPointer();
}
}
void DataArrayFloat::reprCppStream(const std::string& varName, std::ostream& stream) const
{
- mcIdType nbTuples=ToIdType(getNumberOfTuples()),nbComp=ToIdType(getNumberOfComponents());
+ mcIdType nbTuples(getNumberOfTuples());
+ std::size_t nbComp(getNumberOfComponents());
const float *data(begin());
stream.precision(7);
stream << "DataArrayFloat *" << varName << "=DataArrayFloat::New();" << std::endl;
int nbOfCompo=(int)_info_on_compo.size();
if(nbOfCompo>=1)
{
- std::size_t nbOfTuples=getNumberOfTuples();
+ mcIdType nbOfTuples=getNumberOfTuples();
stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl;
reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR);
}
void DataArrayFloat::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const
{
const float *data(begin());
- mcIdType nbOfTuples=ToIdType(getNumberOfTuples());
- mcIdType nbOfCompo=ToIdType(_info_on_compo.size());
+ mcIdType nbOfTuples(getNumberOfTuples());
+ std::size_t nbOfCompo=_info_on_compo.size();
std::ostringstream oss2; oss2 << "[";
oss2.precision(7);
std::string oss2Str(oss2.str());
if(nbOfCompo>1)
{
oss2 << "(";
- for(int j=0;j<nbOfCompo;j++,data++)
+ for(std::size_t j=0;j<nbOfCompo;j++,data++)
{
oss2 << *data;
if(j!=nbOfCompo-1) oss2 << ", ";
std::string DataArrayFloatTuple::repr() const
{
std::ostringstream oss; oss.precision(7); oss << "(";
- for(int i=0;i<_nb_of_compo-1;i++)
+ for(std::size_t i=0;i<_nb_of_compo-1;i++)
oss << _pt[i] << ", ";
oss << _pt[_nb_of_compo-1] << ")";
return oss.str();
std::vector<int> ret;
getCellsContainingPoint(work,eps,ret);
elts->insertAtTheEnd(ret.begin(),ret.end());
- eltsIndexPtr[i+1]=ToIdType(elts->getNumberOfTuples());
+ eltsIndexPtr[i+1]=elts->getNumberOfTuples();
}
}
int DataArrayPartDefinition::getNumberOfElems() const
{
checkInternalArrayOK();
- return ToIdType(_arr->getNumberOfTuples());
+ return _arr->getNumberOfTuples();
}
PartDefinition *DataArrayPartDefinition::operator+(const PartDefinition& other) const
int MEDCouplingPointSet::getNumberOfNodes() const
{
if(_coords)
- return ToIdType(_coords->getNumberOfTuples());
+ return _coords->getNumberOfTuples();
else
throw INTERP_KERNEL::Exception("Unable to get number of nodes because no coordinates specified !");
}
if(!_coords)
throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getCaracteristicDimension : Coordinates not set !");
const double *coords=_coords->getConstPointer();
- mcIdType nbOfValues=ToIdType(_coords->getNbOfElems());
+ std::size_t nbOfValues=_coords->getNbOfElems();
return std::abs(*std::max_element(coords,coords+nbOfValues,MEDCouplingCompAbs()));
}
mcIdType nbCells=ToIdType(getNumberOfCells());
if (nbCells != ToIdType(other->getNumberOfCells()))
throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some cells in other are not in this !");
- mcIdType dan=ToIdType(da->getNumberOfTuples());
+ mcIdType dan(da->getNumberOfTuples());
if (dan)
{
MCAuto<DataArrayInt> da1(DataArrayInt::New()),da2(DataArrayInt::New());
throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some cells in other are not in this !");
}
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();
+ nodeCor=nodeCor2->isIota(nodeCor2->getNumberOfTuples())?0:nodeCor2.retn();
+ cellCor=cellCor2->isIota(cellCor2->getNumberOfTuples())?0:cellCor2.retn();
}
/*!
throw INTERP_KERNEL::Exception("checkDeepEquivalOnSameNodesWith : some cells in other are not in this !");
}
MCAuto<DataArrayInt> cellCor2=da->selectByTupleIdSafeSlice(ToIdType(getNumberOfCells()),ToIdType(da->getNbOfElems()),1);
- cellCor=cellCor2->isIota(ToIdType(cellCor2->getNumberOfTuples()))?0:cellCor2.retn();
+ cellCor=cellCor2->isIota(cellCor2->getNumberOfTuples())?0:cellCor2.retn();
}
void MEDCouplingPointSet::checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
DataArrayDouble *array(srcField->getArray());
- mcIdType trgNbOfCompo=ToIdType(targetField->getNumberOfComponents());
+ std::size_t trgNbOfCompo=targetField->getNumberOfComponents();
if(array)
{
srcField->checkConsistencyLight();
- if(trgNbOfCompo!=srcField->getNumberOfTuplesExpected())
+ if(trgNbOfCompo!=(std::size_t)srcField->getNumberOfTuplesExpected())
throw INTERP_KERNEL::Exception("Number of components mismatch !");
}
else
computeDeno(srcField->getNature(),srcField,targetField);
double *resPointer(srcField->getArray()->getPointer());
const double *inputPointer=targetField->getArray()->getConstPointer();
- computeReverseProduct(inputPointer,trgNbOfCompo,dftValue,resPointer);
+ computeReverseProduct(inputPointer,ToIdType(trgNbOfCompo),dftValue,resPointer);
}
/*!
MCAuto<DataArrayDouble> srcLoc=_src_ft->getLocalizationOfDiscr();
const double *srcLocPtr=srcLoc->begin();
MCAuto<DataArrayInt> eltsArr,eltsIndexArr;
- mcIdType trgNbOfGaussPts=ToIdType(trgLoc->getNumberOfTuples());
+ mcIdType trgNbOfGaussPts=trgLoc->getNumberOfTuples();
_matrix.resize(trgNbOfGaussPts);
_src_ft->getMesh()->getCellsContainingPointsLinearPartOnlyOnNonDynType(trgLoc->begin(),trgNbOfGaussPts,getPrecision(),eltsArr,eltsIndexArr);
const int *elts(eltsArr->begin()),*eltsIndex(eltsIndexArr->begin());
}
_matrix[*trgId][srcEntry]=1.;
}
- if(ToIdType(ids0->getNumberOfTuples())!=trgNbOfGaussPts)
+ if(ids0->getNumberOfTuples()!=trgNbOfGaussPts)
{
MCAuto<DataArrayInt> orphanTrgIds=nbOfSrcCellsShTrgPts->findIdsEqual(0);
MCAuto<DataArrayDouble> orphanTrg=trgLoc->selectByTupleId(orphanTrgIds->begin(),orphanTrgIds->end());
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
DataArrayDouble *array(targetField->getArray());
- mcIdType srcNbOfCompo=ToIdType(srcField->getNumberOfComponents());
+ std::size_t srcNbOfCompo(srcField->getNumberOfComponents());
if(array)
{
targetField->checkConsistencyLight();
- if(srcNbOfCompo!=ToIdType(targetField->getNumberOfComponents()))
+ if(srcNbOfCompo!=targetField->getNumberOfComponents())
throw INTERP_KERNEL::Exception("Number of components mismatch !");
}
else
computeDeno(srcField->getNature(),srcField,targetField);
double *resPointer(targetField->getArray()->getPointer());
const double *inputPointer(srcField->getArray()->getConstPointer());
- computeProduct(inputPointer,srcNbOfCompo,isDftVal,dftValue,resPointer);
+ computeProduct(inputPointer,ToIdType(srcNbOfCompo),isDftVal,dftValue,resPointer);
}
void MEDCouplingRemapper::computeDeno(NatureOfField nat, const MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *trgField)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::splitProfilePerType : input profile is NULL or not allocated !");
if(profile->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::splitProfilePerType : input profile should have exactly one component !");
- mcIdType nbTuples=ToIdType(profile->getNumberOfTuples());
+ mcIdType nbTuples(profile->getNumberOfTuples());
mcIdType nbOfCells=ToIdType(getNumberOfCells());
code.resize(3); idsInPflPerType.resize(1);
code[0]=(int)getTypeOfCell(0); code[1]=nbOfCells;
idsPerType.clear();
return ;
}
- code[1]=ToIdType(profile->getNumberOfTuples());
+ code[1]=profile->getNumberOfTuples();
code[2]=0;
profile->checkAllIdsInRange(0,nbOfCells);
idsPerType.resize(1);
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom : input array of double is NULL or not allocated!");
if(st.size()!=partCompactFormat.size())
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom : input arrays must have the same size !");
- if(ToIdType(fieldOfDbl->getNumberOfTuples())!=DeduceNumberOfGivenStructure(st))
+ if(fieldOfDbl->getNumberOfTuples()!=DeduceNumberOfGivenStructure(st))
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom : invalid size of input array of double regarding the structure !");
std::vector<int> dims(GetDimensionsFromCompactFrmt(partCompactFormat));
- int nbOfTuplesOfOutField(DeduceNumberOfGivenStructure(dims)),nbComp(ToIdType(fieldOfDbl->getNumberOfComponents()));
+ int nbOfTuplesOfOutField(DeduceNumberOfGivenStructure(dims));
+ std::size_t nbComp(fieldOfDbl->getNumberOfComponents());
MCAuto<DataArrayDouble> ret(DataArrayDouble::New()); ret->alloc(nbOfTuplesOfOutField,nbComp);
ret->copyStringInfoFrom(*fieldOfDbl);
double *ptRet(ret->getPointer());
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::MultiplyPartOf : invalid input range 3 !");
dims[i]=part[i].second-part[i].first;
}
- int nbOfTuplesExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(st)),nbCompo(ToIdType(da->getNumberOfComponents()));
- if(ToIdType(da->getNumberOfTuples())!=nbOfTuplesExp)
+ int nbOfTuplesExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(st));
+ std::size_t nbCompo(da->getNumberOfComponents());
+ if(da->getNumberOfTuples()!=nbOfTuplesExp)
{
std::ostringstream oss; oss << "MEDCouplingStructuredMesh::MultiplyPartOf : invalid nb of tuples ! Expected " << nbOfTuplesExp << " having " << da->getNumberOfTuples() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
tinyInfo.push_back(_end.getOrder());
if(_end_array)
{
- tinyInfo.push_back(ToIdType(_end_array->getNumberOfTuples()));
+ tinyInfo.push_back(_end_array->getNumberOfTuples());
tinyInfo.push_back(ToIdType(_end_array->getNumberOfComponents()));
}
else
void MEDCouplingTwoTimeSteps::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
{
- mcIdType nbOfCompo=ToIdType(_array->getNumberOfComponents());
- for(int i=0;i<nbOfCompo;i++)
+ std::size_t nbOfCompo=_array->getNumberOfComponents();
+ for(std::size_t i=0;i<nbOfCompo;i++)
tinyInfo.push_back(_array->getInfoOnComponent(i));
- for(int i=0;i<nbOfCompo;i++)
+ for(std::size_t i=0;i<nbOfCompo;i++)
tinyInfo.push_back(_end_array->getInfoOnComponent(i));
}
_array->getTuple(eltId,value);
else
throw INTERP_KERNEL::Exception("No start array existing.");
- mcIdType nbComp=ToIdType(_array->getNumberOfComponents());
+ std::size_t nbComp=_array->getNumberOfComponents();
std::transform(value,value+nbComp,value,std::bind2nd(std::multiplies<double>(),alpha));
std::vector<double> tmp(nbComp);
if(_end_array)
{
if(_array)
{
- tinyInfo.push_back(ToIdType(_array->getNumberOfTuples()));
+ tinyInfo.push_back(_array->getNumberOfTuples());
tinyInfo.push_back(ToIdType(_array->getNumberOfComponents()));
}
else
template<class T>
void MEDCouplingTimeDiscretizationTemplate<T>::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
{
- mcIdType nbOfCompo=ToIdType(_array->getNumberOfComponents());
- for(int i=0;i<nbOfCompo;i++)
+ std::size_t nbOfCompo(_array->getNumberOfComponents());
+ for(std::size_t 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];
- mcIdType nbOfCompo=ToIdType(_array->getNumberOfComponents());
- for(int i=0;i<nbOfCompo;i++)
+ std::size_t nbOfCompo=_array->getNumberOfComponents();
+ for(std::size_t i=0;i<nbOfCompo;i++)
_array->setInfoOnComponent(i,tinyInfoS[i]);
}
s.insert(ne+nei[*it],ne+nei[*it+1]);
s.erase(i);
cellNeigh->insertAtTheEnd(s.begin(),s.end());
- cellNeighIndex->pushBackSilent(ToIdType(cellNeigh->getNumberOfTuples()));
+ cellNeighIndex->pushBackSilent(cellNeigh->getNumberOfTuples());
}
}
const int *revDescPtr=revDesc->begin();
const int *revDescIPtr=revDescIndx->begin();
//
- mcIdType nbCells=ToIdType(descIndx->getNumberOfTuples())-1;
+ mcIdType nbCells=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=ToIdType(out0->getNumberOfTuples());
+ *out1Ptr=out0->getNumberOfTuples();
}
neighbors=out0.retn();
neighborsIndx=out1.retn();
}
else
connNew->insertAtTheEnd(conn+index[i],conn+index[i+1]);
- *connINewPtr=ToIdType(connNew->getNumberOfTuples());
+ *connINewPtr=connNew->getNumberOfTuples();
}
if(changed)
setConnectivity(connNew,connINew,false);
DataArrayInt *& commonCellsArr, DataArrayInt *& commonCellsIArr)
{
MCAuto<DataArrayInt> commonCells=DataArrayInt::New(),commonCellsI=DataArrayInt::New(); commonCells->alloc(0,1);
- mcIdType nbOfCells=ToIdType(nodalI->getNumberOfTuples())-1;
+ mcIdType nbOfCells=nodalI->getNumberOfTuples()-1;
commonCellsI->reserve(1); commonCellsI->pushBackSilent(0);
const int *revNodalPtr=revNodal->getConstPointer(),*revNodalIPtr=revNodalI->getConstPointer();
const int *connPtr=nodal->getConstPointer(),*connIPtr=nodalI->getConstPointer();
if(AreCellsEqualInPool(v2,compType,connPtr,connIPtr,commonCells))
{
int pos=commonCellsI->back();
- commonCellsI->pushBackSilent(ToIdType(commonCells->getNumberOfTuples()));
+ commonCellsI->pushBackSilent(commonCells->getNumberOfTuples());
for(const int *it=commonCells->begin()+pos;it!=commonCells->end();it++)
isFetched[*it]=true;
}
if(AreCellsEqualInPool(v2,compType,connPtr,connIPtr,commonCells))
{
int pos=commonCellsI->back();
- commonCellsI->pushBackSilent(ToIdType(commonCells->getNumberOfTuples()));
+ commonCellsI->pushBackSilent(commonCells->getNumberOfTuples());
for(const int *it=commonCells->begin()+pos;it!=commonCells->end();it++)
isFetched[*it]=true;
}
arr2->alloc(otherNbCells,1);
arr2->fillWithZero();
int *arr2Ptr=arr2->getPointer();
- mcIdType nbOfCommon=ToIdType(commonCellsI->getNumberOfTuples())-1;
- for(int i=0;i<nbOfCommon;i++)
+ mcIdType nbOfCommon=commonCellsI->getNumberOfTuples()-1;
+ for(mcIdType i=0;i<nbOfCommon;i++)
{
int start=commonCellsPtr[commonCellsIPtr[i]];
if(start<thisNbCells)
// Connex zone without the crack (to compute the next seed really)
int dnu;
DAInt connexCheck = MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(&seed, &seed+1, neighInit00,neighIInit00, -1, dnu);
- std::size_t cnt(0);
+ mcIdType cnt(0);
for (int * ptr = connexCheck->getPointer(); cnt < connexCheck->getNumberOfTuples(); ptr++, cnt++)
hitCells->setIJ(*ptr,0,1);
// Connex zone WITH the crack (to identify cells lying on either part of the crack)
if (nIter >= nIterMax)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::findNodesToDuplicate(): internal error - too many iterations.");
- DAInt cellsToModifyConn1_torenum=cellsToModifyConn0_torenum->buildComplement(ToIdType(neighI00->getNumberOfTuples())-1);
+ DAInt cellsToModifyConn1_torenum=cellsToModifyConn0_torenum->buildComplement(neighI00->getNumberOfTuples()-1);
cellsToModifyConn0_torenum->transformWithIndArr(cellsAroundGroup->begin(),cellsAroundGroup->end());
cellsToModifyConn1_torenum->transformWithIndArr(cellsAroundGroup->begin(),cellsAroundGroup->end());
//
if(cut3DSurf[i].first!=-2)
{
conn->pushBackSilent((int)INTERP_KERNEL::NORM_SEG2); conn->pushBackSilent(cut3DSurf[i].first); conn->pushBackSilent(cut3DSurf[i].second);
- connI->pushBackSilent(ToIdType(conn->getNumberOfTuples()));
+ connI->pushBackSilent(conn->getNumberOfTuples());
cellIds2->pushBackSilent(i);
}
else
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(ToIdType(conn->getNumberOfTuples()));
+ connI->pushBackSilent(conn->getNumberOfTuples());
cellIds2->pushBackSilent(cellId3DSurf);
}
}
{
conn->pushBackSilent((int)INTERP_KERNEL::NORM_POLYGON);
conn->insertAtTheEnd(res[i].begin(),res[i].end());
- connI->pushBackSilent(ToIdType(conn->getNumberOfTuples()));
+ connI->pushBackSilent(conn->getNumberOfTuples());
}
MCAuto<MEDCouplingUMesh> ret(MEDCouplingUMesh::New("",2));
ret->setCoords(mDesc1->getCoords());
}
}
conn2->insertAtTheEnd(cell0.begin(),cell0.end());
- conn2I->pushBackSilent(ToIdType(conn2->getNumberOfTuples()));
+ conn2I->pushBackSilent(conn2->getNumberOfTuples());
conn2->insertAtTheEnd(cell1.begin(),cell1.end());
- conn2I->pushBackSilent(ToIdType(conn2->getNumberOfTuples()));
+ conn2I->pushBackSilent(conn2->getNumberOfTuples());
ret2->setConnectivity(conn2,conn2I,true);
ret2->checkConsistencyLight();
ret2->orientCorrectlyPolyhedrons();
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,ToIdType(coo->getNumberOfTuples()),coo->getPointer(),coo->getPointer());
+ DataArrayDouble::Rotate3DAlg(origin,vec2,angle,coo->getNumberOfTuples(),coo->getPointer(),coo->getPointer());
MCAuto<MEDCouplingUMesh> mw=clone(false);//false -> shallow copy
mw->setCoords(coo);
mw->getBoundingBox(bbox);
mcIdType nbCells=ToIdType(getNumberOfCells());
if(nbCells==0)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::distanceToPoints : no cells in this !");
- mcIdType nbOfPts=ToIdType(pts->getNumberOfTuples());
+ mcIdType nbOfPts=pts->getNumberOfTuples();
MCAuto<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();
isChanged->alloc(0,1);
for(int i=0;i<nbOfCells;i++,workIndexOut++)
{
- mcIdType pos=ToIdType(nodalConnecOut->getNumberOfTuples());
+ mcIdType pos=nodalConnecOut->getNumberOfTuples();
if(BuildConvexEnvelopOf2DCellJarvis(coords,nodalConnecIn+nodalConnecIndexIn[i],nodalConnecIn+nodalConnecIndexIn[i+1],nodalConnecOut))
isChanged->pushBackSilent(i);
types.insert((INTERP_KERNEL::NormalizedCellType)nodalConnecOut->getIJ(pos,0));
- workIndexOut[1]=ToIdType(nodalConnecOut->getNumberOfTuples());
+ workIndexOut[1]=nodalConnecOut->getNumberOfTuples();
}
if(isChanged->empty())
return 0;
}
if(newPos!=initMeshLgth)
_nodal_connec->reAlloc(newPos);
- const mcIdType nCellDel=ToIdType(ret->getNumberOfTuples());
+ const mcIdType nCellDel=ret->getNumberOfTuples();
if (nCellDel)
_nodal_connec_index->reAlloc(nbOfCells-nCellDel+1);
computeTypes();
ret->setMesh(this);
std::set<INTERP_KERNEL::NormalizedCellType> types;
ComputeAllTypesInternal(types,_nodal_connec,_nodal_connec_index);
- mcIdType spaceDim(ToIdType(getSpaceDimension())),nbCells(ToIdType(getNumberOfCells()));
+ mcIdType spaceDim(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++)
MCAuto<DataArrayInt> tmp1=rankInsideCast;
MCAuto<DataArrayInt> tmp2=castsPresent;
//
- mcIdType nbOfCastsFinal=ToIdType(castsPresent->getNumberOfTuples());
+ mcIdType nbOfCastsFinal=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]=ToIdType(tmp3->getNumberOfTuples());
+ code[3*i+1]=tmp3->getNumberOfTuples();
MCAuto<DataArrayInt> tmp4=rankInsideCast->selectByTupleId(tmp3->begin(),tmp3->begin()+tmp3->getNumberOfTuples());
if(!smartPflKiller || !tmp4->isIota(typeRangeVals[castId+1]-typeRangeVals[castId]))
{
if(_types.size()!=1)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertNodalConnectivityToDynamicGeoTypeMesh : current mesh does not contain exactly one geometric type !");
mcIdType nbCells=ToIdType(getNumberOfCells()),
- lgth=ToIdType(_nodal_connec->getNumberOfTuples());
+ lgth=_nodal_connec->getNumberOfTuples();
if(lgth<nbCells)
throw INTERP_KERNEL::Exception(msg0);
MCAuto<DataArrayInt> c(DataArrayInt::New()),ci(DataArrayInt::New());
if(name.empty())
ret->setName("Mesh");
ret->setCoords(da);
- mcIdType nbOfTuples=ToIdType(da->getNumberOfTuples());
+ mcIdType nbOfTuples(da->getNumberOfTuples());
MCAuto<DataArrayInt> c(DataArrayInt::New()),cI(DataArrayInt::New());
c->alloc(2*nbOfTuples,1);
cI->alloc(nbOfTuples+1,1);
DataArrayInt *comm,*commI;
coo->findCommonTuples(eps,-1,comm,commI);
MCAuto<DataArrayInt> tmp1(comm),tmp2(commI);
- mcIdType oldNbOfNodes=ToIdType(coo->getNumberOfTuples());
+ mcIdType oldNbOfNodes=coo->getNumberOfTuples();
int newNbOfNodes;
MCAuto<DataArrayInt> o2n=DataArrayInt::ConvertIndexArrayToO2N(oldNbOfNodes,comm->begin(),commI->begin(),commI->end(),newNbOfNodes);
if(oldNbOfNodes==newNbOfNodes)
if (comm1->findIdFirstEqual(i) < 0)
{
comm1->pushBackSilent(i);
- commI1->pushBackSilent(mcIdType(comm1->getNumberOfTuples()));
+ commI1->pushBackSilent(comm1->getNumberOfTuples());
}
MCAuto<DataArrayInt> comm1Auto(comm1),commI1Auto(commI1);
const int *comm1Ptr=comm1->begin();
const int *commI1Ptr=commI1->begin();
- mcIdType nbOfGrps1=ToIdType(commI1Auto->getNumberOfTuples())-1;
+ mcIdType nbOfGrps1=commI1Auto->getNumberOfTuples()-1;
res->pushBackSilent((int)INTERP_KERNEL::NORM_POLYHED);
//
for(int i=0;i<nbOfGrps1;i++)
if (comm2->findIdFirstEqual(j) < 0)
{
comm2->pushBackSilent(j);
- commI2->pushBackSilent(ToIdType(comm2->getNumberOfTuples()));
+ commI2->pushBackSilent(comm2->getNumberOfTuples());
}
MCAuto<DataArrayInt> comm2Auto(comm2),commI2Auto(commI2);
const int *comm2Ptr=comm2->begin();
const int *commI2Ptr=commI2->begin();
- mcIdType nbOfGrps2=ToIdType(commI2Auto->getNumberOfTuples())-1;
+ mcIdType nbOfGrps2=commI2Auto->getNumberOfTuples()-1;
for(int j=0;j<nbOfGrps2;j++)
{
if(commI2Ptr[j+1] == commI2Ptr[j] + 1)
{ stream << std::endl << "Nodal connectivity NOT set !"; return ; }
if(!_nodal_connec_index->isAllocated())
{ stream << std::endl << "Nodal connectivity set but not allocated !"; return ; }
- mcIdType lgth=ToIdType(_nodal_connec_index->getNumberOfTuples());
- mcIdType cpt=ToIdType(_nodal_connec_index->getNumberOfComponents());
+ mcIdType lgth=_nodal_connec_index->getNumberOfTuples();
+ std::size_t cpt=_nodal_connec_index->getNumberOfComponents();
if(cpt!=1 || lgth<1)
return ;
stream << std::endl << "Number of cells : " << lgth-1 << ".";
nbOfDepthPeelingPerformed=0;
if(!arrIndxIn)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed : arrIndxIn input pointer is NULL !");
- mcIdType nbOfTuples=ToIdType(arrIndxIn->getNumberOfTuples())-1;
+ mcIdType nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
if(nbOfTuples<=0)
{
DataArrayInt *ret=DataArrayInt::New(); ret->alloc(0,1);
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSpreadZonesWithPoly : meshdimension supported are [2,3] ! Not implemented yet for others !");
}
- ret->insertNextCell((INTERP_KERNEL::NormalizedCellType)cell->getIJSafe(0,0),ToIdType(cell->getNumberOfTuples())-1,cell->begin()+1);
+ ret->insertNextCell((INTERP_KERNEL::NormalizedCellType)cell->getIJSafe(0,0),cell->getNumberOfTuples()-1,cell->begin()+1);
}
//
ret->finishInsertingCells();
if(!arrIn || !arrIndxIn)
throw INTERP_KERNEL::Exception("PartitionBySpreadZone : null input pointers !");
arrIn->checkAllocated(); arrIndxIn->checkAllocated();
- mcIdType nbOfTuples=ToIdType(arrIndxIn->getNumberOfTuples());
+ mcIdType nbOfTuples(arrIndxIn->getNumberOfTuples());
if(arrIn->getNumberOfComponents()!=1 || arrIndxIn->getNumberOfComponents()!=1 || nbOfTuples<1)
throw INTERP_KERNEL::Exception("PartitionBySpreadZone : invalid arrays in input !");
int nbOfCellsCur(nbOfTuples-1);
if(!addPts->empty())
{
addPts->rearrange(3);
- nbOfAdditionalPoints=ToIdType(addPts->getNumberOfTuples());
+ nbOfAdditionalPoints=addPts->getNumberOfTuples();
addPts=DataArrayDouble::Aggregate(getCoords(),addPts);
ret0->setCoords(addPts);
}
newConnIPtr[1]=newConnIPtr[0]+3;
}
}
- if(addCoo.empty() && newConn.size()==_nodal_connec->getNumberOfTuples())//nothing happens during tessellation : no update needed
+ if(addCoo.empty() && ToIdType(newConn.size())==_nodal_connec->getNumberOfTuples())//nothing happens during tessellation : no update needed
return ;
_types=types;
DataArrayInt::SetArrayIn(newConnI,_nodal_connec_index);
const int *cPtr=_nodal_connec->begin();
const int *icPtr=_nodal_connec_index->begin();
int lastVal=0;
- mcIdType offset=ToIdType(coordsTmpSafe->getNumberOfTuples());
+ mcIdType offset=coordsTmpSafe->getNumberOfTuples();
for(int i=0;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+ToIdType(ret->getNumberOfTuples()));
+ newConn->pushBackSilent(offset+ret->getNumberOfTuples());
lastVal+=(icPtr[1]-icPtr[0])+(descIPtr[1]-descIPtr[0])+1;
newConnI->pushBackSilent(lastVal);
ret->pushBackSilent(i);
const int *cPtr=_nodal_connec->begin();
const int *icPtr=_nodal_connec_index->begin();
int lastVal=0;
- mcIdType offset=ToIdType(coordsTmpSafe->getNumberOfTuples());
+ mcIdType offset=coordsTmpSafe->getNumberOfTuples();
for(int i=0;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];
- mcIdType tmpPos=ToIdType(newConn->getNumberOfTuples());
+ mcIdType tmpPos=newConn->getNumberOfTuples();
newConn->pushBackSilent(nodeId2);
ret2D->pushBackSilent(nodeId2); ret1D->pushBackSilent(tmpPos);
}
- newConn->pushBackSilent(offset+ToIdType(ret->getNumberOfTuples()));
+ newConn->pushBackSilent(offset+ret->getNumberOfTuples());
lastVal+=(icPtr[1]-icPtr[0])+(descIPtr[1]-descIPtr[0])+(desc2IPtr[1]-desc2IPtr[0])+1;
newConnI->pushBackSilent(lastVal);
ret->pushBackSilent(i);
}
}
MCAuto<DataArrayInt> diffRet2D=ret2D->getDifferentValues();
- MCAuto<DataArrayInt> o2nRet2D=diffRet2D->invertArrayN2O2O2N(ToIdType(coordsTmp2Safe->getNumberOfTuples()));
+ MCAuto<DataArrayInt> o2nRet2D=diffRet2D->invertArrayN2O2O2N(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=ToIdType(coordsTmp2Safe->getNumberOfTuples());
+ offset=coordsTmp2Safe->getNumberOfTuples();
for(const int *elt=ret->begin();elt!=ret->end();elt++)
c[cI[(*elt)+1]-1]+=offset;
coords=DataArrayDouble::Aggregate(v); conn=newConn.retn(); connI=newConnI.retn();
nbOfDepthPeelingPerformed=0;
if(!seedBg || !seedEnd || !arrIn || !arrIndxIn)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeedAlg : some input pointer is NULL !");
- mcIdType nbOfTuples=ToIdType(arrIndxIn->getNumberOfTuples())-1;
+ mcIdType nbOfTuples=arrIndxIn->getNumberOfTuples()-1;
std::vector<bool> fetched2(nbOfTuples,false);
int i=0;
for(const int *seedElt=seedBg;seedElt!=seedEnd;seedElt++,i++)
if(conn.size()>3)
{
nodalRes->insertAtTheEnd(conn.begin(),conn.end());
- nodalResIndx->pushBackSilent(ToIdType(nodalRes->getNumberOfTuples()));
+ nodalResIndx->pushBackSilent(nodalRes->getNumberOfTuples());
cellIds->pushBackSilent(i);
}
}
{
if(stp-start>1)
{
- mcIdType tmp2(0),tmp3(ToIdType(appendedCoords->getNumberOfTuples())/2);
+ mcIdType tmp2(0),tmp3(appendedCoords->getNumberOfTuples()/2);
InternalAddPointOriented(e,-1,coords,tmp[1],tmp[2],*appendedCoords,tmp2);
middles.push_back(tmp3+offset);
}
{
if(stp-start>1)
{
- mcIdType tmp2(0),tmp3(ToIdType(appendedCoords->getNumberOfTuples())/2);
+ mcIdType tmp2(0),tmp3(appendedCoords->getNumberOfTuples()/2);
InternalAddPointOriented(e,-1,coords,tmpSrt,tmpEnd,*appendedCoords,tmp2);
middles.push_back(tmp3+offset);
}
if(stp-start>1) // if we are covering more than one segment we need to create a new mid point
{
mcIdType tmpSrt(connBg[start]),tmpEnd(connBg[stp % nbOfEdges]); // % to handle last seg.
- mcIdType tmp2(0),tmp3(ToIdType(appendedCoords->getNumberOfTuples())/2);
+ mcIdType tmp2(0),tmp3(appendedCoords->getNumberOfTuples()/2);
InternalAddPointOriented(e,-1,coords,tmpSrt,tmpEnd,*appendedCoords,tmp2);
middles.push_back(tmp3+offset);
}
const DataArrayDouble *coo2(mesh1D->getCoords());
const int *c(mesh1D->getNodalConnectivity()->begin()),*ci(mesh1D->getNodalConnectivityIndex()->begin());
const double *coo2Ptr(coo2->begin());
- mcIdType offset1=ToIdType(coords1->getNumberOfTuples());
- mcIdType offset2=(offset1+ToIdType(coo2->getNumberOfTuples()));
+ mcIdType offset1(coords1->getNumberOfTuples());
+ mcIdType offset2(offset1+coo2->getNumberOfTuples());
mcIdType offset3(offset2+ToIdType(addCoo.size())/2);
std::vector<double> addCooQuad;
MCAuto<DataArrayInt> cOut(DataArrayInt::New()),ciOut(DataArrayInt::New()); cOut->alloc(0,1); ciOut->alloc(1,1); ciOut->setIJ(0,0,0);
std::vector<int> allEdges,centers;
const double *coordsPtr(coords->begin());
MCAuto<DataArrayDouble> addCoo(DataArrayDouble::New()); addCoo->alloc(0,1);
- mcIdType offset=ToIdType(coords->getNumberOfTuples());
+ mcIdType offset(coords->getNumberOfTuples());
for(const int *it2(descBg);it2!=descEnd;it2++,ii++)
{
INTERP_KERNEL::NormalizedCellType typeOfSon;
colinear2.resize(nDescCell2);
subDiv2.resize(nDescCell2);
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);
+ BBTreePts<SPACEDIM,int> treeNodes2(m2Desc->getCoords()->begin(),0,0,m2Desc->getCoords()->getNumberOfTuples(),eps);
std::vector<int> candidates1(1);
int offset1(m1Desc->getNumberOfNodes());
{
checkConnectivityFullyDefined();
mcIdType ncells=ToIdType(getNumberOfCells());
- mcIdType lgthToReach(getNodalConnectivityArrayLen()+ToIdType(subNodesInSeg->getNumberOfTuples()));
+ mcIdType lgthToReach(getNodalConnectivityArrayLen()+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());
{
checkConsistencyLight();
mcIdType ncells=ToIdType(getNumberOfCells());
- mcIdType lgthToReach(getNodalConnectivityArrayLen()+2*ToIdType(subNodesInSeg->getNumberOfTuples()));
+ mcIdType lgthToReach(getNodalConnectivityArrayLen()+2*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);
addCoo->rearrange(2);
MCAuto<DataArrayDouble> coo(DataArrayDouble::Aggregate(getCoords(),addCoo));//info are copied from getCoords() by using Aggregate
setCoords(coo);
- return ToIdType(addCoo->getNumberOfTuples());
+ return addCoo->getNumberOfTuples();
}
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(),ToIdType(baryRet1->getNumberOfTuples()),eps,elts,eltsIndex);
+ mesh2D->getCellsContainingPoints(baryRet1->begin(),baryRet1->getNumberOfTuples(),eps,elts,eltsIndex);
MCAuto<DataArrayInt> eltsIndex2(DataArrayInt::New()); eltsIndex2->alloc(0,1);
if (eltsIndex->getNumberOfTuples() > 1)
eltsIndex2 = eltsIndex->deltaShiftIndex();
MCAuto<DataArrayInt> eltsIndex3(eltsIndex2->findIdsEqual(1));
- if(eltsIndex2->count(0)+eltsIndex3->getNumberOfTuples()!=ret1NonCol->getNumberOfCells())
+ if(eltsIndex2->count(0)+eltsIndex3->getNumberOfTuples()!=ToIdType(ret1NonCol->getNumberOfCells()))
throw INTERP_KERNEL::Exception("Intersect2DMeshWith1DLine : internal error 1 !");
MCAuto<DataArrayInt> cellsToBeModified(elts->buildUnique());
MCAuto<DataArrayInt> untouchedCells(cellsToBeModified->buildComplement(ToIdType(mesh2D->getNumberOfCells())));
outMesh2DSplit.push_back(BuildRefined2DCell(ret1->getCoords(),mesh2D,*it,dptr+diptr[*it],dptr+diptr[*it+1],intersectEdge1));
ret1->setCoords(outMesh2DSplit.back()->getCoords());
}
- mcIdType offset(ToIdType(ret2->getNumberOfTuples()));
+ mcIdType offset(ret2->getNumberOfTuples());
ret2->pushBackValsSilent(fewModifiedCells->begin(),fewModifiedCells->end());
MCAuto<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,ToIdType(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,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++)
{
if(Colinearize2DCell(coords,cptr+ciptr[0],cptr+ciptr[1],nbOfNodes,forbiddenPoints, /*out*/ newc,appendedCoords))
ret->pushBackSilent(i);
- newciptr[1]=ToIdType(newc->getNumberOfTuples());
+ newciptr[1]=newc->getNumberOfTuples();
}
//
if(ret->empty())
// Sort faces by decreasing surface:
vector< pair<double,int> > S;
- for(mcIdType i=0;i < ToIdType(surfs->getNumberOfTuples());i++)
+ for(mcIdType i=0;i < surfs->getNumberOfTuples();i++)
{
pair<double,int> p = make_pair(surfs->begin()[i], i);
S.push_back(p);
MCAuto<MEDCouplingUMesh> mPartCand(mDesc->buildPartOfMySelf(&cands2[0], &cands2[0]+cands2.size(), false)); // false=zipCoords is called
double * cooPartRef(mPartRef->_coords->getPointer());
double * cooPartCand(mPartCand->_coords->getPointer());
- for (std::size_t ii = 0; ii < mPartRef->_coords->getNumberOfTuples(); ii++)
+ for (mcIdType ii = 0; ii < mPartRef->_coords->getNumberOfTuples(); ii++)
rotation.transform_vector(cooPartRef+SPACEDIM*ii);
- for (std::size_t ii = 0; ii < mPartCand->_coords->getNumberOfTuples(); ii++)
+ for (mcIdType ii = 0; ii < mPartCand->_coords->getNumberOfTuples(); ii++)
rotation.transform_vector(cooPartCand+SPACEDIM*ii);
// Localize faces in 2D thanks to barycenters
MCAuto<DataArrayDouble> baryPartXY = baryPart->keepSelectedComponents(compo);
mPartRef->changeSpaceDimension(2,0.0);
MCAuto<DataArrayInt> cc(DataArrayInt::New()), ccI(DataArrayInt::New());
- mPartRef->getCellsContainingPoints(baryPartXY->begin(), ToIdType(baryPartXY->getNumberOfTuples()), eps, cc, ccI);
+ mPartRef->getCellsContainingPoints(baryPartXY->begin(), baryPartXY->getNumberOfTuples(), eps, cc, ccI);
if (!cc->getNumberOfTuples())
continue;
// Sort edges by decreasing length:
vector<pair<double,int> > S;
- for(mcIdType i=0;i < ToIdType(lens->getNumberOfTuples());i++)
+ for(mcIdType i=0;i < lens->getNumberOfTuples();i++)
{
pair<double,int> p = make_pair(lens->getIJ(i, 0), i);
S.push_back(p);
MCAuto<DataArrayInt> nodeMapInv = nodeMap->invertArrayO2N2N2O(nbElemsNotM1);
double * cooPartRef(mPartRef->_coords->getPointer());
double * cooPartCand(mPartCand->_coords->getPointer());
- for (std::size_t ii = 0; ii < mPartRef->_coords->getNumberOfTuples(); ii++)
+ for (mcIdType ii = 0; ii < mPartRef->_coords->getNumberOfTuples(); ii++)
rotation.transform_vector(cooPartRef+SPACEDIM*ii);
- for (std::size_t ii = 0; ii < mPartCand->_coords->getNumberOfTuples(); ii++)
+ for (mcIdType ii = 0; ii < mPartCand->_coords->getNumberOfTuples(); ii++)
rotation.transform_vector(cooPartCand+SPACEDIM*ii);
MCAuto<MEDCouplingUMesh> m(MEDCouplingUMesh::New("",2));
m->setCoords(skinOfRes2->getCoords());
m->allocateCells();
- m->insertNextCell(INTERP_KERNEL::NORM_POLYGON,ToIdType(vdi[0]->getNumberOfTuples()),vdi[0]->begin());
+ m->insertNextCell(INTERP_KERNEL::NORM_POLYGON,vdi[0]->getNumberOfTuples(),vdi[0]->begin());
return m;
}
ret->allocateCells();
std::vector<int> conn;
int jj(0);
- for(int i=0;i<ToIdType(commI->getNumberOfTuples())-1;i++,jj++)
+ for(mcIdType i=0;i<commI->getNumberOfTuples()-1;i++,jj++)
{
if(jj!=0)
conn.push_back(-1);
{
MCAuto<MEDCouplingUMesh> tmp(skinOfRes->buildPartOfMySelf(remain->begin(),remain->end(),true));
const int *cPtr(tmp->getNodalConnectivity()->begin()),*ciPtr(tmp->getNodalConnectivityIndex()->begin());
- for(std::size_t i=0;i<remain->getNumberOfTuples();i++,jj++)
+ for(mcIdType i=0;i<remain->getNumberOfTuples();i++,jj++)
{
if(jj!=0)
conn.push_back(-1);
throw INTERP_KERNEL::Exception("Voronoize1D : spacedim must be equal to 1 and meshdim also equal to 1 !");
if(m->getNumberOfCells()!=1)
throw INTERP_KERNEL::Exception("Voronoize1D : mesh is expected to have only one cell !");
- mcIdType nbPts=ToIdType(points->getNumberOfTuples());
+ mcIdType nbPts(points->getNumberOfTuples());
if(nbPts<1)
throw INTERP_KERNEL::Exception("Voronoize1D : at least one point expected !");
std::vector<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 !");
- mcIdType nbPts=ToIdType(points->getNumberOfTuples());
+ mcIdType nbPts(points->getNumberOfTuples());
if(nbPts<1)
throw INTERP_KERNEL::Exception("Voronoize2D : at least one point expected !");
std::vector<double> bbox(4);
newCoords=a->getCoords()->selectByTupleId(tmp->begin(),tmp->end());
}
const double *cPtr(newCoords->begin());
- for(std::size_t j=0;j<newCoords->getNumberOfTuples();j++,cPtr+=2)
+ for(mcIdType j=0;j<newCoords->getNumberOfTuples();j++,cPtr+=2)
{
std::set<int> zeCandidates;
{
throw INTERP_KERNEL::Exception("Voronoize3D : spacedim must be equal to 3 and meshdim also equal to 3 !");
if(m->getNumberOfCells()!=1)
throw INTERP_KERNEL::Exception("Voronoize3D : mesh is expected to have only one cell !");
- mcIdType nbPts=ToIdType(points->getNumberOfTuples());
+ mcIdType nbPts(points->getNumberOfTuples());
if(nbPts<1)
throw INTERP_KERNEL::Exception("Voronoize3D : at least one point expected !");
std::vector< MCAuto<MEDCouplingUMesh> > l0(1,MCAuto<MEDCouplingUMesh>(m->deepCopy()));
MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME);
f->setMesh(m);
DataArrayDouble *arr=DataArrayDouble::New();
-
arr->alloc(m->getNumberOfCells(),3);
f->setArray(arr);
arr->decrRef();