std::vector<double> CoordsT;
const ConnType *startOfCellNodeConnT=Intersector3DP1P1<MyMeshType,MyMatrix>::getStartConnOfTargetCell(targetCell);
Intersector3DP1P1<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(targetCell),CoordsT);
- int nbOfNodesT=CoordsT.size()/SPACEDIM;
+ std::size_t nbOfNodesT=CoordsT.size()/SPACEDIM;
const double *coordsS=Intersector3DP1P1<MyMeshType,MyMatrix>::_src_mesh.getCoordinatesPtr();
- for(int nodeIdT=0;nodeIdT<nbOfNodesT;nodeIdT++)
+ for(std::size_t nodeIdT=0;nodeIdT<nbOfNodesT;nodeIdT++)
{
typename MyMatrix::value_type& resRow=res[OTT<ConnType,numPol>::ind2C(startOfCellNodeConnT[nodeIdT])];
if(!resRow.empty())
void CurveIntersector<MyMeshType,MyMatrix>::adjustBoundingBoxes (std::vector<double>& bbox,
double adjustmentEpsAbs)
{
- long size = bbox.size()/(2*SPACEDIM);
- for (int i=0; i<size; i++)
+ std::size_t size = bbox.size()/(2*SPACEDIM);
+ for (std::size_t i=0; i<size; i++)
{
for(int idim=0; idim<SPACEDIM; idim++)
{
nodes[1]=new Node(quadrangle[SPACEDIM],quadrangle[SPACEDIM+1]);
nodes[2]=new Node(quadrangle[2*SPACEDIM],quadrangle[2*SPACEDIM+1]);
nodes[3]=new Node(quadrangle[3*SPACEDIM],quadrangle[3*SPACEDIM+1]);
- int nbOfSourceNodes=sourceCoords.size()/SPACEDIM;
+ std::size_t nbOfSourceNodes=sourceCoords.size()/SPACEDIM;
std::vector<Node *> nodes2(nbOfSourceNodes);
- for(int i=0;i<nbOfSourceNodes;i++)
+ for(std::size_t i=0;i<nbOfSourceNodes;i++)
nodes2[i]=new Node(sourceCoords[i*SPACEDIM],sourceCoords[i*SPACEDIM+1]);
QuadraticPolygon *p1=QuadraticPolygon::BuildLinearPolygon(nodes);
QuadraticPolygon *p2;
double GEO2D_INTERSECTOR::intersectGeometryGeneral(const std::vector<double>& targetCoords,
const std::vector<double>& sourceCoords)
{
- int nbOfTargetNodes=targetCoords.size()/SPACEDIM;
+ std::size_t nbOfTargetNodes=targetCoords.size()/SPACEDIM;
std::vector<Node *> nodes(nbOfTargetNodes);
- for(int i=0;i<nbOfTargetNodes;i++)
+ for(std::size_t i=0;i<nbOfTargetNodes;i++)
nodes[i]=new Node(targetCoords[i*SPACEDIM],targetCoords[i*SPACEDIM+1]);
- int nbOfSourceNodes=sourceCoords.size()/SPACEDIM;
+ std::size_t nbOfSourceNodes=sourceCoords.size()/SPACEDIM;
std::vector<Node *> nodes2(nbOfSourceNodes);
- for(int i=0;i<nbOfSourceNodes;i++)
+ for(std::size_t i=0;i<nbOfSourceNodes;i++)
nodes2[i]=new Node(sourceCoords[i*SPACEDIM],sourceCoords[i*SPACEDIM+1]);
QuadraticPolygon *p1=QuadraticPolygon::BuildLinearPolygon(nodes);
QuadraticPolygon *p2=QuadraticPolygon::BuildLinearPolygon(nodes2);
nodes[0]=new Node(sourceTria[0*SPACEDIM],sourceTria[0*SPACEDIM+1]);
nodes[1]=new Node(sourceTria[1*SPACEDIM],sourceTria[1*SPACEDIM+1]);
nodes[2]=new Node(sourceTria[2*SPACEDIM],sourceTria[2*SPACEDIM+1]);
- int nbOfTargetNodes=targetCell.size()/SPACEDIM;
+ std::size_t nbOfTargetNodes=targetCell.size()/SPACEDIM;
std::vector<Node *> nodes2(nbOfTargetNodes);
- for(int i=0;i<nbOfTargetNodes;i++)
+ for(std::size_t i=0;i<nbOfTargetNodes;i++)
nodes2[i]=new Node(targetCell[i*SPACEDIM],targetCell[i*SPACEDIM+1]);
QuadraticPolygon *p1=QuadraticPolygon::BuildLinearPolygon(nodes);
QuadraticPolygon *p2;
INTERSECTOR_TEMPLATE
QuadraticPolygon *GEO2D_INTERSECTOR::buildPolygonFrom(const std::vector<double>& coords, NormalizedCellType type)
{
- int nbNodes=coords.size()/SPACEDIM;
+ std::size_t nbNodes=coords.size()/SPACEDIM;
std::vector<Node *> nodes(nbNodes);
- for(int i=0;i<nbNodes;i++)
+ for(std::size_t i=0;i<nbNodes;i++)
nodes[i]=new Node(coords[i*SPACEDIM],coords[i*SPACEDIM+1]);
if(!CellModel::GetCellModel(type).isQuadratic())
return QuadraticPolygon::BuildLinearPolygon(nodes);
static const NumberingPolicy numPol=MyMeshType::My_numPol;
long global_start =clock();
- int counter=0;
+ std::size_t counter=0;
/***********************************************************/
/* Check both meshes are made of triangles and quadrangles */
/***********************************************************/
static const NumberingPolicy numPol = MyMeshType::My_numPol;
long global_start = clock();
- int counter=0;
+ std::size_t counter=0;
long nbMailleS = myMeshS.getNumberOfElements();
long nbMailleT = myMeshT.getNumberOfElements();
static const NumberingPolicy numPol=MyMeshType::My_numPol;
long global_start =clock();
- int counter=0;
+ std::size_t counter=0;
/***********************************************************/
/* Check both meshes are made of triangles and quadrangles */
/***********************************************************/
inline std::vector<double> bary_poly(const std::vector<double>& V)
{
std::vector<double> Bary;
- long taille=V.size();
+ std::size_t taille=V.size();
double x=0;
double y=0;
- for(long i=0;i<taille/2;i++)
+ for(std::size_t i=0;i<taille/2;i++)
{
x=x+V[2*i];
y=y+V[2*i+1];
}
- double A=2*x/((double)taille);
- double B=2*y/((double)taille);
+ double A=2*x/(static_cast<double>(taille));
+ double B=2*y/(static_cast<double>(taille));
Bary.push_back(A);//taille vecteur=2*nb de points.
Bary.push_back(B);
inline void verif_point_dans_vect(const double* P, std::vector<double>& V, double absolute_precision )
{
- long taille=V.size();
+ std::size_t taille=V.size();
bool isPresent=false;
- for(long i=0;i<taille/2;i++)
+ for(std::size_t i=0;i<taille/2;i++)
{
if (sqrt(((P[0]-V[2*i])*(P[0]-V[2*i])+(P[1]-V[2*i+1])*(P[1]-V[2*i+1])))<absolute_precision)
isPresent=true;
inline void verif_maill_dans_vect(int Num, std::vector<int>& V)
{
- long taille=V.size();
+ std::size_t taille=V.size();
int A=0;
- for(long i=0;i<taille;i++)
+ for(std::size_t i=0;i<taille;i++)
{
if(Num==V[i])
{
std::vector<double> CoordsT;
const ConnType *startOfCellNodeConnT=Intersector3DP1P1<MyMeshType,MyMatrix>::getStartConnOfTargetCell(targetCell);
Intersector3DP1P1<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(targetCell),CoordsT);
- int nbOfNodesT=CoordsT.size()/SPACEDIM;
+ std::size_t nbOfNodesT=CoordsT.size()/SPACEDIM;
const double *coordsS=Intersector3DP1P1<MyMeshType,MyMatrix>::_src_mesh.getCoordinatesPtr();
- for(int nodeIdT=0;nodeIdT<nbOfNodesT;nodeIdT++)
+ for(std::size_t nodeIdT=0;nodeIdT<nbOfNodesT;nodeIdT++)
{
typename MyMatrix::value_type& resRow=res[OTT<ConnType,numPol>::ind2C(startOfCellNodeConnT[nodeIdT])];
if(!resRow.empty())
{
/* We build the segment tree for locating possible matching intersections*/
- long size = bbox.size()/(2*SPACEDIM);
- for (int i=0; i<size; i++)
+ std::size_t size = bbox.size()/(2*SPACEDIM);
+ for (std::size_t i=0; i<size; i++)
{
double max=- std::numeric_limits<double>::max();
for(int idim=0; idim<SPACEDIM; idim++)
INTERSECTOR_TEMPLATE
QuadraticPolygon *PTLOC2D_INTERSECTOR::buildPolygonFrom(const std::vector<double>& coords, NormalizedCellType type)
{
- int nbNodes=coords.size()/SPACEDIM;
+ std::size_t nbNodes=coords.size()/SPACEDIM;
std::vector<Node *> nodes(nbNodes);
- for(int i=0;i<nbNodes;i++)
+ for(std::size_t i=0;i<nbNodes;i++)
nodes[i]=new Node(coords[i*SPACEDIM],coords[i*SPACEDIM+1]);
if(!CellModel::GetCellModel(type).isQuadratic())
return QuadraticPolygon::BuildLinearPolygon(nodes);
{
std::vector<double> coordsTarget;
Intersector3DP0P1<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(targetCell),coordsTarget);
- int nbNodesT=coordsTarget.size()/SPACEDIM;
+ std::size_t nbNodesT=coordsTarget.size()/SPACEDIM;
const double *coordsS=Intersector3DP0P1<MyMeshType,MyMatrix>::_src_mesh.getCoordinatesPtr();
const ConnType *startOfCellNodeConnT=Intersector3DP0P1<MyMeshType,MyMatrix>::getStartConnOfTargetCell(targetCell);
for(typename std::vector<ConnType>::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++)
const CellModel& cmTypeS=CellModel::GetCellModel(tS);
std::vector<ConnType> connOfCurCellS;
Intersector3DP0P1<MyMeshType,MyMatrix>::getConnOfSourceCell(OTT<ConnType,numPol>::indFC(*iterCellS),connOfCurCellS);
- for(int nodeIdT=0;nodeIdT<nbNodesT;nodeIdT++)
+ for(std::size_t nodeIdT=0;nodeIdT<nbNodesT;nodeIdT++)
{
if(PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg3D(&coordsTarget[nodeIdT*SPACEDIM],&connOfCurCellS[0],connOfCurCellS.size(),coordsS,cmTypeS,_precision))
{
{
std::vector<double> CoordsT;
Intersector3DP1P1<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(targetCell),CoordsT);
- int nbOfNodesT=CoordsT.size()/SPACEDIM;
+ std::size_t nbOfNodesT=CoordsT.size()/SPACEDIM;
const double *coordsS=Intersector3DP1P1<MyMeshType,MyMatrix>::_src_mesh.getCoordinatesPtr();
for(typename std::vector<ConnType>::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++)
{
throw INTERP_KERNEL::Exception("Invalid source cell detected for meshdim==3. Only TETRA4 supported !");
const CellModel& cmTypeS=CellModel::GetCellModel(tS);
const ConnType *startOfCellNodeConnT=Intersector3DP1P1<MyMeshType,MyMatrix>::getStartConnOfTargetCell(targetCell);
- for(int nodeIdT=0;nodeIdT<nbOfNodesT;nodeIdT++)
+ for(std::size_t nodeIdT=0;nodeIdT<nbOfNodesT;nodeIdT++)
{
typename MyMatrix::value_type& resRow=res[OTT<ConnType,numPol>::ind2C(startOfCellNodeConnT[nodeIdT])];
std::vector<ConnType> connOfCurCellS;
bool isSourceQuad)
{
double result = 0.;
- ConnType nbNodesS=sourceCoords.size()/SPACEDIM;
+ ConnType nbNodesS=static_cast<ConnType>(sourceCoords.size())/SPACEDIM;
//Compute the intersection area
double area[SPACEDIM];
for(ConnType iT = 1; iT<3; iT++)
const std::vector<double>& sourceCoords)
{
double result = 0.;
- ConnType nbNodesS=sourceCoords.size()/SPACEDIM;
- ConnType nbNodesT=targetCoords.size()/SPACEDIM;
+ ConnType nbNodesS=static_cast<ConnType>(sourceCoords.size())/SPACEDIM;
+ ConnType nbNodesT=static_cast<ConnType>(targetCoords.size())/SPACEDIM;
//Compute the intersection area
double area[SPACEDIM];
for(ConnType iT = 1; iT<nbNodesT-1; iT++)
double inter_area[SPACEDIM], total_area = 0.;
double total_barycenter[SPACEDIM]={0.,0.};
- const ConnType nbNodesT=targetCell.size()/SPACEDIM;
+ const ConnType nbNodesT=(ConnType)targetCell.size()/SPACEDIM;
for(ConnType iT = 1; iT<nbNodesT-1; iT++)
{
std::vector<double> inter;
int MEDCouplingBasicsTest::countNonZero(const std::vector< std::map<int,double> >& matrix)
{
- int ret=0.;
+ int ret=0;
for(std::vector< std::map<int,double> >::const_iterator iter=matrix.begin();iter!=matrix.end();iter++)
for(std::map<int,double>::const_iterator iter2=(*iter).begin();iter2!=(*iter).end();iter2++)
if (!INTERP_KERNEL::epsilonEqual((*iter2).second, 0.)) ret +=1;
//
targetMesh=build3DTargetMesh_1();
bool areNodesMerged;
- unsigned int time=targetMesh->getTimeOfThis();
+ std::size_t time=targetMesh->getTimeOfThis();
o2n=targetMesh->mergeNodes(1e-10,areNodesMerged,newNbOfNodes);
targetMesh->updateTime();
CPPUNIT_ASSERT(time==targetMesh->getTimeOfThis());
void MEDCouplingBasicsTest1::testOperationsOnFields4()
{
MEDCouplingUMesh *m=build2DTargetMesh_1();
- int nbOfCells=m->getNumberOfCells();
+ std::size_t nbOfCells=m->getNumberOfCells();
MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,CONST_ON_TIME_INTERVAL);
f1->setMesh(m);
DataArrayDouble *array=DataArrayDouble::New();
{
MEDCouplingUMesh *targetMesh=build2DTargetMesh_1();
MEDCouplingFieldDouble *fieldOnCells=MEDCouplingFieldDouble::New(ON_CELLS);
- int nbOfCells=targetMesh->getNumberOfCells();
+ std::size_t nbOfCells=targetMesh->getNumberOfCells();
fieldOnCells->setMesh(targetMesh);
DataArrayDouble *array=DataArrayDouble::New();
array->alloc(nbOfCells,2);
fieldOnCells->setArray(array);
double *tmp=array->getPointer();
- for(int i=0;i<nbOfCells;i++)
+ for(std::size_t i=0;i<nbOfCells;i++)
{ tmp[2*i]=7.+(double)i; tmp[2*i+1]=17.+(double)i; }
array->decrRef();
//
MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME);
f->setMesh(m);
DataArrayDouble *arr=DataArrayDouble::New();
- int nbOfCells=m->getNumberOfCells();
- arr->alloc(nbOfCells,3);
+
+ arr->alloc(m->getNumberOfCells(),3);
f->setArray(arr);
arr->decrRef();
const double values1[15]={7.,107.,10007.,8.,108.,10008.,9.,109.,10009.,10.,110.,10010.,11.,111.,10011.};
bool isExcep=false;
try { mesh1->checkGeoEquivalWith(mesh2,0,1e-12,cellCor,nodeCor);//deepEqual fails
}
- catch(INTERP_KERNEL::Exception& e) { isExcep=true; }
+ catch(INTERP_KERNEL::Exception&) { isExcep=true; }
CPPUNIT_ASSERT(isExcep); isExcep=false;
CPPUNIT_ASSERT(cellCor==0);
CPPUNIT_ASSERT(nodeCor==0);
try { mesh1->checkGeoEquivalWith(mesh2,1,1e-12,cellCor,nodeCor);//fastEqual has detected something
}
- catch(INTERP_KERNEL::Exception& e) { isExcep=true; }
+ catch(INTERP_KERNEL::Exception&) { isExcep=true; }
CPPUNIT_ASSERT(isExcep); isExcep=false;
CPPUNIT_ASSERT(cellCor==0);
CPPUNIT_ASSERT(nodeCor==0);
void MEDCouplingBasicsTest2::testCopyTinyStringsFromOnFields()
{
MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
- int nbOfCells=m->getNumberOfCells();
+ std::size_t nbOfCells=m->getNumberOfCells();
MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,LINEAR_TIME);
f->setMesh(m);
CPPUNIT_ASSERT_EQUAL(5,f->getNumberOfMeshPlacesExpected());
void MEDCouplingBasicsTest2::testGetMaxValue1()
{
MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
- int nbOfCells=m->getNumberOfCells();
+ std::size_t nbOfCells=m->getNumberOfCells();
MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,LINEAR_TIME);
f->setMesh(m);
DataArrayDouble *a1=DataArrayDouble::New();
MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME);
f->setMesh(m);
DataArrayDouble *arr=DataArrayDouble::New();
- int nbOfCells=m->getNumberOfCells();
+ std::size_t nbOfCells=m->getNumberOfCells();
arr->alloc(nbOfCells,3);
f->setArray(arr);
arr->decrRef();