${CMAKE_CURRENT_SOURCE_DIR}/GaussPoints
)
+IF (NOT DEFINED MSVC)
+ ADD_DEFINITIONS(-Wsign-compare -Wconversion)
+ENDIF()
+
SET(PLATFORM_MMAP)
IF(NOT WIN32)
SET(PLATFORM_MMAP "-D_POSIX_MAPPED_FILES")
if(_dim==2)
{
if(_type==NORM_POLYGON)
- return lgth;
+ return FromIdType<unsigned>(lgth);
else
- return lgth/2;
+ return FromIdType<unsigned>(lgth/2);
}
else if(_dim==1)
- return lgth;//NORM_POLYL
+ return FromIdType<unsigned>(lgth);//NORM_POLYL
else
- return std::count(conn,conn+lgth,-1)+1;
+ return (unsigned)std::count(conn,conn+lgth,-1)+1;
}
unsigned CellModel::getNumberOfEdgesIn3D(const mcIdType *conn, mcIdType lgth) const
if(!isDynamic())
return _nb_of_little_sons;
else//polyhedron
- return (lgth-std::count(conn,conn+lgth,-1))/2;
+ return FromIdType<unsigned>(lgth-std::count(conn,conn+lgth,-1))/2;
}
/*!
}
const mcIdType *where2=std::find(where,nodalConn+lgth,-1);
std::copy(where,where2,sonNodalConn);
- return where2-where;
+ return FromIdType<unsigned>(where2-where);
}
else
throw INTERP_KERNEL::Exception("CellModel::fillSonCellNodalConnectivity2 : no sons on NORM_POLYL !");
where++;
}
const mcIdType *where2=std::find(where,nodalConn+lgth,-1);
- return where2-where;
+ return FromIdType<unsigned>(where2-where);
}
else
throw INTERP_KERNEL::Exception("CellModel::getNumberOfNodesConstituentTheSon2 : no sons on NORM_POLYL !");
}
else
{
- int p=(lgth+1)/2;
+ mcIdType p=(lgth+1)/2;
std::vector<mcIdType> tmp(2*p);
std::vector<mcIdType>::iterator it=std::copy(conn1,conn1+p,tmp.begin());
std::copy(conn1,conn1+p,it);
char *INTERP_KERNEL::AsmX86::copyToExecMemZone(const std::vector<char>& ml, unsigned& offset) const
{
char *ret=0;
- int lgth=ml.size();
+ std::size_t lgth=ml.size();
#ifdef _POSIX_MAPPED_FILES
# ifdef __APPLE__
ret=(char *)mmap(0,lgth,PROT_EXEC | PROT_WRITE,MAP_ANON | MAP_PRIVATE,-1,0);
for(int k=0;k<nbOfByte;k++)
{
j=i&255;
- v=j;
+ v=(char)j;
ml.push_back(v);
i>>=8;
}
DecompositionInUnitBase &DecompositionInUnitBase::operator*(const DecompositionInUnitBase& other)
{
- _value[0]+=other._value[0]; _value[1]+=other._value[1]; _value[2]+=other._value[2]; _value[3]+=other._value[3]; _value[4]+=other._value[4];
+ // += causes ' conversion to 'short int' from 'int' may alter its value [-Wconversion]'
+ _value[0]=(short)(_value[0]+other._value[0]); _value[1]=(short)(_value[1]+other._value[1]); _value[2]=(short)(_value[2]+other._value[2]); _value[3]=(short)(_value[3]+other._value[3]); _value[4]=(short)(_value[4]+other._value[4]);
_mult_fact_to_base*=other._mult_fact_to_base;
_add_to_base=0.;
return *this;
DecompositionInUnitBase &DecompositionInUnitBase::operator/(const DecompositionInUnitBase& other)
{
- _value[0]-=other._value[0]; _value[1]-=other._value[1]; _value[2]-=other._value[2]; _value[3]-=other._value[3]; _value[4]-=other._value[4];
+ // -= causes ' conversion to 'short int' from 'int' may alter its value [-Wconversion]'
+ _value[0]=(short)(_value[0]-other._value[0]); _value[1]=(short)(_value[1]-other._value[1]); _value[2]=(short)(_value[2]-other._value[2]); _value[3]=(short)(_value[3]-other._value[3]); _value[4]=(short)(_value[4]-other._value[4]);
_mult_fact_to_base/=other._mult_fact_to_base;
_add_to_base=0.;
return *this;
if(!other.isAdimensional())
throw INTERP_KERNEL::Exception("Trying to execute operator ^ with a second member not adimensionnal");
int exp=couldItBeConsideredAsInt(other._mult_fact_to_base);
- _value[0]*=exp; _value[1]*=exp; _value[2]*=exp; _value[3]*=exp; _value[4]*=exp;
+ // *= causes ' conversion to 'short int' from 'int' may alter its value [-Wconversion]'
+ _value[0]=(short)(_value[0]*exp); _value[1]=(short)(_value[1]*exp); _value[2]=(short)(_value[2]*exp); _value[3]=(short)(_value[3]*exp); _value[4]=(short)(_value[4]*exp);
_mult_fact_to_base=powInt(_mult_fact_to_base,exp);
_add_to_base=0.;
return *this;
{
if( _my_nb_gauss )
{
- return _my_gauss_coord.size()/_my_nb_gauss;
+ return (int)_my_gauss_coord.size()/_my_nb_gauss;
}
else
{
{
if( _my_nb_ref )
{
- return _my_reference_coord.size()/_my_nb_ref;
+ return (int)(_my_reference_coord.size()/_my_nb_ref);
}
else
{
aReferenceCoord.push_back(theReferenceCoord[i]);
- GaussInfo* info = new GaussInfo( theGeometry, aGaussCoord, theNbGauss, aReferenceCoord, theNbRef);
+ GaussInfo* info = new GaussInfo( theGeometry, aGaussCoord, FromIdType<int>(theNbGauss), aReferenceCoord, FromIdType<int>(theNbRef));
info->initLocalInfo();
//If info with cell type doesn't exist add it
}
else
{
- int index = std::distance(_my_gauss_info.begin(),it);
+ std::size_t index = std::distance(_my_gauss_info.begin(),it);
delete (*it);
_my_gauss_info[index] = info;
}
std::vector<double> radialDistrib3(radialDistrib.size());
std::transform(radialDistrib2.begin(),radialDistrib2.end(),radialDistrib.begin(),radialDistrib3.begin(),std::minus<double>());
std::vector<double>::iterator iter3=max_element(radialDistrib3.begin(),radialDistrib3.end());
- int i=iter3-radialDistrib3.begin();
+ std::size_t i=iter3-radialDistrib3.begin();
// ok for e1 - Let's go.
EdgeInfLin *e1=new EdgeInfLin(nodeToTest,radialDistrib[i]+radialDistrib3[i]/2.);
double ref=e1->getCharactValue(*nodeToTest);
*/
void Edge::Interpolate1DLin(const std::vector<double>& distrib1, const std::vector<double>& distrib2, std::map<int, std::map<int,double> >& result)
{
- int nbOfV1=distrib1.size()-1;
- int nbOfV2=distrib2.size()-1;
+ std::size_t nbOfV1=distrib1.size()-1;
+ std::size_t nbOfV2=distrib2.size()-1;
Node *n1=new Node(0.,0.); Node *n3=new Node(0.,0.);
Node *n2=new Node(0.,0.); Node *n4=new Node(0.,0.);
MergePoints commonNode;
- for(int i=0;i<nbOfV1;i++)
+ for(unsigned int i=0;i<nbOfV1;i++)
{
std::vector<double>::const_iterator iter=find_if(distrib2.begin()+1,distrib2.end(),bind2nd(std::greater_equal<double>(),distrib1[i]));
if(iter!=distrib2.end())
{
- for(int j=(iter-1)-distrib2.begin();j<nbOfV2;j++)
+ for(unsigned int j=(unsigned)((iter-1)-distrib2.begin());j<nbOfV2;j++)
{
if(distrib2[j]<=distrib1[i+1])
{
tmpp2[tmpp.size()+1]=endId;
std::vector<mcIdType>::iterator itt=std::unique(tmpp2.begin(),tmpp2.end());
tmpp2.resize(std::distance(tmpp2.begin(),itt));
- int nbOfEdges=tmpp2.size()-1;
- for(int i=0;i<nbOfEdges;i++)
+ std::size_t nbOfEdges=tmpp2.size()-1;
+ for(std::size_t i=0;i<nbOfEdges;i++)
{
edgesThis.push_back(tmpp2[i]);
edgesThis.push_back(tmpp2[i+1]);
std::vector<mcIdType>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,mcIdType>& mapAddCoo) const
{
if (!_direction)
- skipStartOrEnd *= -1; // invert value - see QuadraticPolygon::splitAbs()
+ skipStartOrEnd = (short)(-skipStartOrEnd); // invert value - see QuadraticPolygon::splitAbs()
_ptr->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,skipStartOrEnd,edgesOther,addCoo,mapAddCoo);
}
//
std::map<INTERP_KERNEL::Node *,mcIdType>::const_iterator thisStart(mapThis.find(curThis->getStartNode())),thisEnd(mapThis.find(curThis->getEndNode())),
otherStart(mapOther.find(curOtherTmp->getStartNode())),otherEnd(mapOther.find(curOtherTmp->getEndNode()));
- int thisStart2(thisStart==mapThis.end()?-1:(*thisStart).second), thisEnd2(thisEnd==mapThis.end()?-1:(*thisEnd).second),
+ mcIdType thisStart2(thisStart==mapThis.end()?-1:(*thisStart).second), thisEnd2(thisEnd==mapThis.end()?-1:(*thisEnd).second),
otherStart2(otherStart==mapOther.end()?-1:(*otherStart).second+offset1),otherEnd2(otherEnd==mapOther.end()?-1:(*otherEnd).second+offset1);
//
if(curThis->getPtr()->intersectWith(curOtherTmp->getPtr(),merge,*cThis,*cOther))
// Converting back to integer connectivity:
if(otherTmp._sub_edges.size()>1) // only if a new point has been added (i.e. an actual intersection was done)
{
- int jj = 0, sz(otherTmp._sub_edges.size());
+ std::size_t jj = 0, sz(otherTmp._sub_edges.size());
for(std::list<ElementaryEdge *>::const_iterator it=otherTmp._sub_edges.begin();it!=otherTmp._sub_edges.end();it++, jj++)
{
short skipStartOrEnd = jj == 0 ? -1 : (jj == sz-1 ? 1 : 0); // -1 means START, 1 means END, 0 other
if(!isQuad)
{
bool direct=descBg[edgePos]>0;
- mcIdType edgeId=abs(descBg[edgePos])-1; // back to C indexing mode
+ mcIdType edgeId=std::abs(descBg[edgePos])-1; // back to C indexing mode
const std::vector<mcIdType>& subEdge=intersectEdges[edgeId];
std::size_t nbOfSubEdges=subEdge.size()/2;
for(std::size_t j=0;j<nbOfSubEdges;j++)
delete e1; delete e2;
//
bool direct=descBg[edgePos]>0;
- mcIdType edgeId=abs(descBg[edgePos])-1;
+ mcIdType edgeId=std::abs(descBg[edgePos])-1;
const std::vector<mcIdType>& subEdge=intersectEdges[edgeId];
std::size_t nbOfSubEdges=subEdge.size()/2;
if(colinearity)
for(std::size_t i=0;i<nbOfSeg;i++)//loop over all edges of pol2
{
bool direct=descBg[i]>0;
- mcIdType edgeId=abs(descBg[i])-1;//current edge id of pol2
+ mcIdType edgeId=std::abs(descBg[i])-1;//current edge id of pol2
std::map<mcIdType,std::vector<INTERP_KERNEL::ElementaryEdge *> >::const_iterator it1=alreadyExistingIn2.find(descBg[i]),it2=alreadyExistingIn2.find(-descBg[i]);
if(it1!=alreadyExistingIn2.end() || it2!=alreadyExistingIn2.end())
{
std::size_t nbOfEdgesIn1=std::distance(descBg1,descEnd1);
for(std::size_t j=0;j<nbOfEdgesIn1;j++)
{
- mcIdType edgeId1=abs(descBg1[j])-1;
+ mcIdType edgeId1=std::abs(descBg1[j])-1;
if(std::find(c.begin(),c.end(),edgeId1)!=c.end())
{
idIns1.push_back(std::pair<mcIdType,std::pair<bool,mcIdType> >(edgeId1,std::pair<bool,mcIdType>(descBg1[j]>0,offset1)));// it exists an edge into pol1 given by tuple (idIn1,direct1) that is colinear at edge 'edgeId' in pol2
}
else
{//the current subedge of edge 'edgeId' of pol2 is part of the colinear edge 'idIn1' of pol1 -> reuse Edge instance of pol1
- ElementaryEdge *e=pol1[offset1+(direct1?offset2:nbOfSubEdges1-offset2-1)];
+ ElementaryEdge *e=pol1[FromIdType<int>(offset1+(direct1?offset2:nbOfSubEdges1-offset2-1))];
Edge *ee=e->getPtr();
ee->incrRef();
ElementaryEdge *e2=new ElementaryEdge(ee,!(direct1^direction11));
for(std::size_t i=0;i<nbOfSeg;i++)//loop over all edges of pol2
{
bool direct=descBg[i]>0;
- mcIdType edgeId=abs(descBg[i])-1;//current edge id of pol2
+ mcIdType edgeId=std::abs(descBg[i])-1;//current edge id of pol2
const std::vector<mcIdType>& c=colinear1[edgeId];
if(c.empty())
continue;
mcIdType offset1=0;
for(std::size_t j=0;j<nbOfEdgesIn1;j++)
{
- mcIdType edgeId1=abs(descBg1[j])-1;
+ mcIdType edgeId1=std::abs(descBg1[j])-1;
if(std::find(c.begin(),c.end(),edgeId1)!=c.end())
{
for(std::size_t k=0;k<nbOfSubEdges;k++)
}
if(found)
{
- ElementaryEdge *e=pol1[offset1+(direct1?offset2:nbOfSubEdges1-offset2-1)];
+ ElementaryEdge *e=pol1[FromIdType<int>(offset1+(direct1?offset2:nbOfSubEdges1-offset2-1))];
e->getPtr()->declareOn();
}
}
}
else
{
- int quadOff = lgth/2;
+ mcIdType quadOff = lgth/2;
mcIdType *tmpQuad = new mcIdType[quadOff];
for(int i = 0; i < quadOff; i++)
if(conn[i] != conn[(i+1)%quadOff] || conn[i] != conn[i+quadOff]) // zip nul segments/arcs (quad point must match too)
{
std::set<mcIdType> nodes(conn,conn+lgth);
nodes.erase(-1);
- int nbOfNodes=(int)nodes.size();
- int magicNumber=100*nbOfNodes+nbOfFaces;
+ std::size_t nbOfNodes=nodes.size();
+ mcIdType magicNumber=100*nbOfNodes+nbOfFaces;
switch(magicNumber)
{
case 806:
std::vector< std::pair<mcIdType,mcIdType> >::iterator it=std::find(oppEdges.begin(),oppEdges.end(),pInOpp);
if(it==oppEdges.end())//the opposite edge of side face is not found opposite face ... maybe problem of orientation of polyhedron
return false;
- int pos2=(int)std::distance(oppEdges.begin(),it);
- int offset=pos-pos2;
+ mcIdType pos2=std::distance(oppEdges.begin(),it);
+ mcIdType offset=pos-pos2;
if(offset<0)
offset+=lgthBaseFace;
//this is the end copy the result
std::set<mcIdType> quad4S(quad4,quad4+4);
w=conn;
bool ok=true;
- int point=-1;
+ mcIdType point=-1;
for(std::size_t i=0;i<5 && ok;i++)
{
if(i!=quad4_pos)
if(std::find_if(conn+lgth,conn+lgth+nbOfFaces,std::bind2nd(std::not_equal_to<mcIdType>(),ToIdType(INTERP_KERNEL::NORM_TRI3)))==conn+lgth+nbOfFaces)
{
std::set<mcIdType> tribase(conn,conn+3);
- int point=-1;
+ mcIdType point=-1;
bool ok=true;
for(int i=1;i<4 && ok;i++)
{
return std::string(meth);
}
-bool INTERP_KERNEL::InterpolationOptions::setInterpolationOptions(long print_level,
+bool INTERP_KERNEL::InterpolationOptions::setInterpolationOptions(int print_level,
std::string intersection_type,
double precision,
double median_plane,
double bounding_box_adjustment,
double bounding_box_adjustment_abs,
double max_distance_for_3Dsurf_intersect,
- long orientation,
+ int orientation,
bool measure_abs,
std::string splitting_policy)
{
void init();
- bool setInterpolationOptions(long print_level,
+ bool setInterpolationOptions(int print_level,
std::string intersection_type,
double precision,
double median_plane,
double bounding_box_adjustment,
double bounding_box_adjustment_abs,
double max_distance_for_3Dsurf_intersect,
- long orientation,
+ int orientation,
bool measure_abs,
std::string splitting_policy);
void copyOptions(const InterpolationOptions & other) { *this = other; }
for(mcIdType i=0;i<nbOfFaces;i++,tmp+=3)
{
tmp[0]=0.; tmp[1]=0.; tmp[2]=0.;
- mcIdType nbOfNodesOfFace(ToIdType(std::distance(work,std::find(work,nodalConnEnd,-1))));
+ mcIdType nbOfNodesOfFace(std::distance(work,std::find(work,nodalConnEnd,-1)));
for(mcIdType j=0;j<nbOfNodesOfFace;j++,conn+=4)
{
conn[0]=work[j]; conn[1]=work[(j+1)%nbOfNodesOfFace]; conn[2]=-(i+1); conn[3]=-(nbOfFaces+1);
tmp[0]+=coords[3*work[j]+0]; tmp[1]+=coords[3*work[j]+1]; tmp[2]+=coords[3*work[j]+2];
}
- tmp[0]/=nbOfNodesOfFace; tmp[1]/=nbOfNodesOfFace; tmp[2]/=nbOfNodesOfFace;
+ double nbNF = FromIdType<double>(nbOfNodesOfFace);
+ tmp[0]/=nbNF; tmp[1]/=nbNF; tmp[2]/=nbNF;
tmp2[0]+=tmp[0]; tmp2[1]+=tmp[1]; tmp2[2]+=tmp[2];
work+=nbOfNodesOfFace+1;
}
- tmp2[0]/=nbOfFaces; tmp2[1]/=nbOfFaces; tmp2[2]/=nbOfFaces;
+ double nbF = FromIdType<double>(nbOfFaces);
+ tmp2[0]/=nbF; tmp2[1]/=nbF; tmp2[2]/=nbF;
return ;
}
default:
const long double delta = MULT_PREC_F * ( std::fabs(term1) + std::fabs(term2) );
- if( epsilonEqual(_doubleProducts[8*seg + dp], 0.0, THRESHOLD_F * delta))
+ if( epsilonEqual(_doubleProducts[8*seg + dp], 0.0, (double)(THRESHOLD_F * delta)))
{
// debug output
#if LOG_LEVEL >= 5
const long double delta = MULT_PREC_F * (std::fabs(p_term) + std::fabs(q_term) + std::fabs(r_term));
#endif
- if( epsilonEqual( p_term + q_term + r_term, 0.0, THRESHOLD_F * delta) )
+ if( epsilonEqual( p_term + q_term + r_term, 0.0, (double)(THRESHOLD_F * delta)) )
{
LOG(4, "Reset imprecise triple product for corner " << corner << " to zero" );
return 0.0;