#include <iostream>
-INTERP_KERNEL::Exception::Exception(const char *what):_reason(what)
+INTERP_KERNEL::Exception::Exception(const char *reason):_reason(reason)
{
- std::cerr << "AN INTERP_KERNEL::EXCEPTION HAS BEEN THROWN : " << what << "**********" << std::endl;
+ std::cerr << "AN INTERP_KERNEL::EXCEPTION HAS BEEN THROWN : " << reason << "**********" << std::endl;
}
-INTERP_KERNEL::Exception::Exception(const char *what, const char *file, int line):_reason(what)
+INTERP_KERNEL::Exception::Exception(const char *reason, const char *file, int line):_reason(reason)
{
}
class INTERPKERNEL_EXPORT Exception : public std::exception
{
public:
- Exception(const char *what);
- Exception(const char *what, const char *file, int line);
+ Exception(const char *reason);
+ Exception(const char *reason, const char *file, int line);
~Exception() throw ();
const char *what() const throw();
protected:
__DMP( "Solved = " << solved );
if ( _dim == 3 ) {
__DMP( " Eigen " << __TENSOR(0,0)<<", "<<__TENSOR(1,1)<<", "<<__TENSOR(2,2) );
- for ( int i=0; i <3; ++i )
- __DMP( i << ": " << __AXIS(i)[0] << ", " << __AXIS(i)[1] << ", " << __AXIS(i)[2] );
+ for ( int ii=0; ii <3; ++ii )
+ __DMP( ii << ": " << __AXIS(ii)[0] << ", " << __AXIS(ii)[1] << ", " << __AXIS(ii)[2] );
}
else {
__DMP( " Eigen " << __TENSOR(0,0) << ", " << __TENSOR(1,1) );
- for ( int i=0; i <2; ++i )
- __DMP( i << ": " << __AXIS(i)[0] << ", " << __AXIS(i)[1] );
+ for ( int ii=0; ii <2; ++ii )
+ __DMP( ii << ": " << __AXIS(ii)[0] << ", " << __AXIS(ii)[1] );
}
return solved;
void LeafExprVal::replaceValues(const std::vector<double>& valuesInExpr) throw(INTERP_KERNEL::Exception)
{
int pos=(int)_value;
- int lgth=valuesInExpr.size();
+ int lgth=(int)valuesInExpr.size();
if(pos>=lgth || pos<0)
throw INTERP_KERNEL::Exception("LeafExprVal::replaceValues : Big Problem detected ! Send expression to Salome support with expression !");
_value=valuesInExpr[pos];
}
return;
}
- _fast_pos=iter-vars.begin();
+ _fast_pos=(int)std::distance(vars.begin(),iter);
}
void LeafExprVar::prepareExprEvaluationVec() const throw(INTERP_KERNEL::Exception)
if(pos2!=std::string::npos && pos3!=std::string::npos)
return ;//Bracket group is not alone, can't conclude not recursively.
std::string newExp2=_expr.substr(pos1+1,_expr.length()-pos1-2);
- int nbOfParamsInFunc=std::count(newExp2.begin(),newExp2.end(),',')+1;
+ std::size_t nbOfParamsInFunc=std::count(newExp2.begin(),newExp2.end(),',')+1;
if(pos3!=std::string::npos)
- _func_btw_sub_expr.push_back(FunctionsFactory::buildFuncFromString(funcName.c_str(),nbOfParamsInFunc));
+ _func_btw_sub_expr.push_back(FunctionsFactory::buildFuncFromString(funcName.c_str(),(int)nbOfParamsInFunc));
else
{
- int lgth=funcName.length();
+ std::size_t lgth=funcName.length();
char tmp[2]; tmp[1]='\0';
- for(int i=0;i<lgth;i++)
+ for(std::size_t i=0;i<lgth;i++)
{
tmp[0]=funcName[i];
- _func_btw_sub_expr.push_back(FunctionsFactory::buildFuncFromString(tmp,nbOfParamsInFunc));
+ _func_btw_sub_expr.push_back(FunctionsFactory::buildFuncFromString(tmp,(int)nbOfParamsInFunc));
}
}
std::size_t pos6=0;
- for(int i=0;i<nbOfParamsInFunc;i++)
+ for(std::size_t i=0;i<nbOfParamsInFunc;i++)
{
std::size_t pos5=newExp2.find_first_of(',',pos6);
std::size_t len=std::string::npos;
std::ostringstream errMsg;
char MSGTYP1[]="Error in brackets : closing brackets ')' before openning '('";
errMsg << EXPR_PARSE_ERR_MSG << MSGTYP1;
- LocateError(errMsg,_expr,iter-_expr.begin());
+ LocateError(errMsg,_expr,(int)std::distance(_expr.begin(),iter));
throw INTERP_KERNEL::Exception(errMsg.str().c_str());
}
curLevel--;
void ValueUnit::setVarname(int fastPos, const std::string& var) throw(INTERP_KERNEL::Exception)
{
- double add,mult;
- const short *projInBase=UnitDataBase::_uniqueMapForExpr.getInfoForUnit(var,add,mult);
- _data.setInfo(projInBase,add,mult);
+ double add,mul;
+ const short *projInBase=UnitDataBase::_uniqueMapForExpr.getInfoForUnit(var,add,mul);
+ _data.setInfo(projInBase,add,mul);
}
void ValueUnit::positive() throw(INTERP_KERNEL::Exception)
EdgeInfLin *e1=new EdgeInfLin(nodeToTest,radialDistrib[i]+radialDistrib3[i]/2.);
double ref=e1->getCharactValue(*nodeToTest);
std::set< IntersectElement > inOutSwitch;
- for(std::list<ElementaryEdge *>::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
+ for(std::list<ElementaryEdge *>::const_iterator iter4=_sub_edges.begin();iter4!=_sub_edges.end();iter4++)
{
- ElementaryEdge *val=(*iter);
+ ElementaryEdge *val=(*iter4);
if(val)
{
Edge *e=val->getPtr();
}
e1->decrRef();
bool ret=false;
- for(std::set< IntersectElement >::iterator iter=inOutSwitch.begin();iter!=inOutSwitch.end();iter++)
+ for(std::set< IntersectElement >::iterator iter4=inOutSwitch.begin();iter4!=inOutSwitch.end();iter4++)
{
- if((*iter).getVal1()<ref)
+ if((*iter4).getVal1()<ref)
{
- if((*iter).getNodeOnly()->getLoc()==ON_1)
+ if((*iter4).getNodeOnly()->getLoc()==ON_1)
ret=!ret;
}
else
{
if(_node)
((Node *)_node)->decrRef();
- ((IntersectElement *)(this))->_node=node;
+ (const_cast<IntersectElement *>(this))->_node=node;
if(_node)
_node->incrRef();
}
return true;
if(_start->isEqual(*otherStartNode))
{
- (((Edge *)this)->_start)->decrRef();//un-const cast Ok thanks to 2 lines above.
- (((Edge *)this)->_start)=otherStartNode;
+ ((const_cast<Edge *>(this))->_start)->decrRef();//un-const cast Ok thanks to 2 lines above.
+ ((const_cast<Edge *>(this))->_start)=otherStartNode;
_start->incrRef();
return true;
}
return true;
if(_start->isEqualAndKeepTrack(*otherStartNode,track))
{
- (((Edge *)this)->_start)->decrRef();//un-const cast Ok thanks to 2 lines above.
- (((Edge *)this)->_start)=otherStartNode;
+ ((const_cast<Edge *>(this))->_start)->decrRef();//un-const cast Ok thanks to 2 lines above.
+ ((const_cast<Edge *>(this))->_start)=otherStartNode;
otherStartNode->incrRef();
return true;
}
return true;
if(_end->isEqual(*otherEndNode))
{
- (((Edge *)this)->_end)->decrRef();
- (((Edge *)this)->_end)=otherEndNode;
+ ((const_cast<Edge *>(this))->_end)->decrRef();
+ ((const_cast<Edge *>(this))->_end)=otherEndNode;
_end->incrRef();
return true;
}
return true;
if(_end->isEqualAndKeepTrack(*otherEndNode,track))
{
- (((Edge *)this)->_end)->decrRef();
- (((Edge *)this)->_end)=otherEndNode;
+ ((const_cast<Edge *>(this))->_end)->decrRef();
+ ((const_cast<Edge *>(this))->_end)=otherEndNode;
otherEndNode->incrRef();
return true;
}
if(start==_start && end==_end)
{
incrRef();
- vec.pushBack((Edge *)this);
+ vec.pushBack(const_cast<Edge *>(this));
return ;
}
vec.pushBack(buildEdgeLyingOnMe(start,end,true));
std::vector<Node *>::reverse_iterator iterR=newNodes.rbegin();
f1->addSubEdgeInVector(f1->getStartNode(),*iter,outValForF1);
f2->addSubEdgeInVector(f2->getStartNode(),order?*iter:*iterR,outValForF2);
- for(std::vector<Node *>::iterator iter=newNodes.begin();iter!=newNodes.end();iter++,iterR++)
+ for(std::vector<Node *>::iterator iter2=newNodes.begin();iter2!=newNodes.end();iter2++,iterR++)
{
- if((iter+1)==newNodes.end())
+ if((iter2+1)==newNodes.end())
{
- f1->addSubEdgeInVector(*iter,f1->getEndNode(),outValForF1);
- (*iter)->decrRef();
- f2->addSubEdgeInVector(order?*iter:*iterR,f2->getEndNode(),outValForF2);
+ f1->addSubEdgeInVector(*iter2,f1->getEndNode(),outValForF1);
+ (*iter2)->decrRef();
+ f2->addSubEdgeInVector(order?*iter2:*iterR,f2->getEndNode(),outValForF2);
}
else
{
- f1->addSubEdgeInVector(*iter,*(iter+1),outValForF1);
- (*iter)->decrRef();
- f2->addSubEdgeInVector(order?*iter:*iterR,order?*(iter+1):*(iterR+1),outValForF2);
+ f1->addSubEdgeInVector(*iter2,*(iter2+1),outValForF1);
+ (*iter2)->decrRef();
+ f2->addSubEdgeInVector(order?*iter2:*iterR,order?*(iter2+1):*(iterR+1),outValForF2);
}
}
return true;
e2->incrRef(); e2->incrRef();
outVal1.resize(3);
outVal1.setValueAt(0,e1->buildEdgeLyingOnMe(e1->getStartNode(),nS));
- outVal1.setValueAt(1,(Edge*)e2,direction);
+ outVal1.setValueAt(1,const_cast<Edge*>(e2),direction);
outVal1.setValueAt(2,e1->buildEdgeLyingOnMe(nE,e1->getEndNode()));
- outVal2.pushBack((Edge*)e2); e2->declareOn();
+ outVal2.pushBack(const_cast<Edge*>(e2)); e2->declareOn();
return true;
}
else
return true;
case OUT_BEFORE*OFFSET_FOR_TYPEOFLOCINEDGE+OUT_AFTER: // OUT_BEFORE - OUT_AFTER
e1->incrRef(); e1->incrRef();
- outVal1.pushBack((Edge*)e1);
+ outVal1.pushBack(const_cast<Edge*>(e1));
outVal2.resize(3);
outVal2.setValueAt(direction?0:2,e1->buildEdgeLyingOnMe(nS,e1->getStartNode(),direction));
- outVal2.setValueAt(1,(Edge*)e1,direction); e1->declareOn();
+ outVal2.setValueAt(1,const_cast<Edge*>(e1),direction); e1->declareOn();
outVal2.setValueAt(direction?2:0,e1->buildEdgeLyingOnMe(e1->getEndNode(),nE,direction));
return true;
case START*OFFSET_FOR_TYPEOFLOCINEDGE+END: // START - END
e1->incrRef(); e1->incrRef();
- outVal1.pushBack((Edge*)e1);
- outVal2.pushBack((Edge*)e1,direction); e1->declareOn();
+ outVal1.pushBack(const_cast<Edge*>(e1));
+ outVal2.pushBack(const_cast<Edge*>(e1),direction); e1->declareOn();
return true;
case START*OFFSET_FOR_TYPEOFLOCINEDGE+OUT_AFTER: // START - OUT_AFTER
e1->incrRef(); e1->incrRef();
- outVal1.pushBack((Edge*)e1);
+ outVal1.pushBack(const_cast<Edge*>(e1));
outVal2.resize(2);
- outVal2.setValueAt(direction?0:1,(Edge*)e1,direction); e1->declareOn();
+ outVal2.setValueAt(direction?0:1,const_cast<Edge*>(e1),direction); e1->declareOn();
outVal2.setValueAt(direction?1:0,e1->buildEdgeLyingOnMe(e1->getEndNode(),nE,direction));
return true;
case INSIDE*OFFSET_FOR_TYPEOFLOCINEDGE+END: // INSIDE - END
e2->incrRef(); e2->incrRef();
outVal1.pushBack(e1->buildEdgeLyingOnMe(e1->getStartNode(),nS,true));
- outVal1.pushBack((Edge*)e2,direction);
- outVal2.pushBack((Edge*)e2); e2->declareOn();
+ outVal1.pushBack(const_cast<Edge*>(e2),direction);
+ outVal2.pushBack(const_cast<Edge*>(e2)); e2->declareOn();
return true;
case OUT_BEFORE*OFFSET_FOR_TYPEOFLOCINEDGE+END: // OUT_BEFORE - END
e1->incrRef(); e1->incrRef();
- outVal1.pushBack((Edge*)e1);
+ outVal1.pushBack(const_cast<Edge*>(e1));
outVal2.resize(2);
outVal2.setValueAt(direction?0:1,e1->buildEdgeLyingOnMe(nS,e1->getStartNode(),direction));
- outVal2.setValueAt(direction?1:0,(Edge*)e1,direction); e1->declareOn();
+ outVal2.setValueAt(direction?1:0,const_cast<Edge*>(e1),direction); e1->declareOn();
return true;
case START*OFFSET_FOR_TYPEOFLOCINEDGE+INSIDE: // START - INSIDE
e2->incrRef(); e2->incrRef();
- outVal1.pushBack((Edge*)e2,direction);
+ outVal1.pushBack(const_cast<Edge*>(e2),direction);
outVal1.pushBack(e1->buildEdgeLyingOnMe(nE,e1->getEndNode()));
- outVal2.pushBack((Edge*)e2); e2->declareOn();
+ outVal2.pushBack(const_cast<Edge*>(e2)); e2->declareOn();
return true;
case INSIDE*OFFSET_FOR_TYPEOFLOCINEDGE+START: // INSIDE - START
outVal1.resize(2);
{
double x=(_cross*_dy)/_drSq+center[0];
double y=(-_cross*_dx)/_drSq+center[1];
- Node *intersect=new Node(x,y); intersect->declareOnTangent();
- bool i_1S=_e1.getStartNode()->isEqual(*intersect);
- bool i_1E=_e1.getEndNode()->isEqual(*intersect);
- bool i_2S=_e2.getStartNode()->isEqual(*intersect);
- bool i_2E=_e2.getEndNode()->isEqual(*intersect);
- ret.push_back(IntersectElement(_e1.getCharactValue(*intersect),_e2.getCharactValue(*intersect),i_1S,i_1E,i_2S,i_2E,intersect,_e1,_e2,keepOrder()));
+ Node *intersect3=new Node(x,y); intersect3->declareOnTangent();
+ bool i_1S=_e1.getStartNode()->isEqual(*intersect3);
+ bool i_1E=_e1.getEndNode()->isEqual(*intersect3);
+ bool i_2S=_e2.getStartNode()->isEqual(*intersect3);
+ bool i_2E=_e2.getEndNode()->isEqual(*intersect3);
+ ret.push_back(IntersectElement(_e1.getCharactValue(*intersect3),_e2.getCharactValue(*intersect3),i_1S,i_1E,i_2S,i_2E,intersect3,_e1,_e2,keepOrder()));
}
return ret;
}
bool isIn(double characterVal) const { return true; }
void dynCastFunction(const EdgeLin * &seg,
const EdgeArcCircle * &arcSeg) const { seg=this; }
- private:
+ protected:
~EdgeInfLin() { }
};
}
{
bool ret=isEqual(other);
if(ret)
- track.push_back((Node *)&other);
+ track.push_back(const_cast<Node *>(&other));
return ret;
}
*nodeId=(*it).second;
return;
}
- int id=addCoo.size()/2;
+ int id=(int)addCoo.size()/2;
addCoo.push_back(fact*_coords[0]+baryX);
addCoo.push_back(fact*_coords[1]+baryY);
*nodeId=offset2+id;
QuadraticPolygon *QuadraticPolygon::buildLinearPolygon(std::vector<Node *>& nodes)
{
QuadraticPolygon *ret=new QuadraticPolygon;
- int size=nodes.size();
- for(int i=0;i<size;i++)
+ std::size_t size=nodes.size();
+ for(std::size_t i=0;i<size;i++)
{
ret->pushBack(new EdgeLin(nodes[i],nodes[(i+1)%size]));
nodes[i]->decrRef();
QuadraticPolygon *QuadraticPolygon::buildArcCirclePolygon(std::vector<Node *>& nodes)
{
QuadraticPolygon *ret=new QuadraticPolygon;
- int size=nodes.size();
- for(int i=0;i<size/2;i++)
+ std::size_t size=nodes.size();
+ for(std::size_t i=0;i<size/2;i++)
{
EdgeLin *e1,*e2;
e1=new EdgeLin(nodes[i],nodes[i+size/2]);
*/
void QuadraticPolygon::buildFromCrudeDataArray(const std::map<int,INTERP_KERNEL::Node *>& mapp, bool isQuad, const int *descBg, const int *descEnd, const std::vector<std::vector<int> >& intersectEdges)
{
- int nbOfSeg=std::distance(descBg,descEnd);
- for(int i=0;i<nbOfSeg;i++)
+ std::size_t nbOfSeg=std::distance(descBg,descEnd);
+ for(std::size_t i=0;i<nbOfSeg;i++)
{
bool direct=descBg[i]>0;
int edgeId=abs(descBg[i])-1;
const std::vector<int>& subEdge=intersectEdges[edgeId];
- int nbOfSubEdges=subEdge.size()/2;
- for(int j=0;j<nbOfSubEdges;j++)
+ std::size_t nbOfSubEdges=subEdge.size()/2;
+ for(std::size_t j=0;j<nbOfSubEdges;j++)
{
Node *start=(*mapp.find(direct?subEdge[2*j]:subEdge[2*nbOfSubEdges-2*j-1])).second;
Node *end=(*mapp.find(direct?subEdge[2*j+1]:subEdge[2*nbOfSubEdges-2*j-2])).second;
{
polThis.resize(size());
polOther.resize(other.size());
- IteratorOnComposedEdge it1((QuadraticPolygon *)this);
+ IteratorOnComposedEdge it1(const_cast<QuadraticPolygon *>(this));
int edgeId=0;
for(it1.first();!it1.finished();it1.next(),edgeId++)
{
tmp.dispatchPerimeter(polThis[edgeId]);
}
//
- IteratorOnComposedEdge it2((QuadraticPolygon *)&other);
+ IteratorOnComposedEdge it2(const_cast<QuadraticPolygon *>(&other));
edgeId=0;
for(it2.first();!it2.finished();it2.next(),edgeId++)
{
void QuadraticPolygon::intersectForPoint(const QuadraticPolygon& other, std::vector< int >& numberOfCreatedPointsPerEdge) const
{
numberOfCreatedPointsPerEdge.resize(size());
- IteratorOnComposedEdge it1((QuadraticPolygon *)this);
+ IteratorOnComposedEdge it1(const_cast<QuadraticPolygon *>(this));
int edgeId=0;
for(it1.first();!it1.finished();it1.next(),edgeId++)
{
*/
bool QuadraticPolygon::amIAChanceToBeCompletedBy(const QuadraticPolygon& pol1Splitted,const QuadraticPolygon& pol2NotSplitted, bool& direction)
{
- IteratorOnComposedEdge it((QuadraticPolygon *)&pol1Splitted);
+ IteratorOnComposedEdge it(const_cast<QuadraticPolygon *>(&pol1Splitted));
bool found=false;
Node *n=getEndNode();
ElementaryEdge *cur=it.current();
std::list<QuadraticPolygon *>::iterator iEnd,
bool direction)
{
- IteratorOnComposedEdge it((QuadraticPolygon *)&pol1Splitted);
+ IteratorOnComposedEdge it(const_cast<QuadraticPolygon *>(&pol1Splitted));
bool found=false;
Node *n=getEndNode();
ElementaryEdge *cur;
std::vector<int> faces;
for(unsigned j=0;j<nbOfFaces;j++)
{
- INTERP_KERNEL::NormalizedCellType type;
- unsigned offset=cm.fillSonCellNodalConnectivity2(j,conn,lgth,work,type);
+ INTERP_KERNEL::NormalizedCellType type2;
+ unsigned offset=cm.fillSonCellNodalConnectivity2(j,conn,lgth,work,type2);
//
int *tmp2=new int[offset];
tmp2[0]=work[0];
continue;
}
int tmp3;
- faces.push_back(tryToUnPoly2D(CellModel::GetCellModel(type).isQuadratic(),tmp2,newPos,work,tmp3));
+ faces.push_back(tryToUnPoly2D(CellModel::GetCellModel(type2).isQuadratic(),tmp2,newPos,work,tmp3));
delete [] tmp2;
//
work+=newPos;
*work++=-1;
}
std::copy(faces.begin(),faces.end(),--work);
- retNbOfFaces=faces.size();
- retLgth=std::distance(tmp,work);
+ retNbOfFaces=(int)faces.size();
+ retLgth=(int)std::distance(tmp,work);
return tmp;
}
{
std::set<int> nodes(conn,conn+lgth);
nodes.erase(-1);
- int nbOfNodes=nodes.size();
+ int nbOfNodes=(int)nodes.size();
int magicNumber=100*nbOfNodes+nbOfFaces;
switch(magicNumber)
{
sideEdges[i]=r;
}
//end reverse sideFace
- std::set< std::pair<int,int> > baseEdgesS(baseEdges.begin(),baseEdges.end());
- std::set< std::pair<int,int> > sideEdgesS(sideEdges.begin(),sideEdges.end());
- std::set_intersection(baseEdgesS.begin(),baseEdgesS.end(),sideEdgesS.begin(),sideEdgesS.end(),std::back_insert_iterator< std::vector< std::pair<int,int> > >(tmp));
+ std::set< std::pair<int,int> > baseEdgesS2(baseEdges.begin(),baseEdges.end());
+ std::set< std::pair<int,int> > sideEdgesS2(sideEdges.begin(),sideEdges.end());
+ std::set_intersection(baseEdgesS2.begin(),baseEdgesS2.end(),sideEdgesS2.begin(),sideEdgesS2.end(),std::back_insert_iterator< std::vector< std::pair<int,int> > >(tmp));
if(tmp.empty())
return false;
}
}
if(!found)
return false;
- int pos=std::distance(baseEdges.begin(),std::find(baseEdges.begin(),baseEdges.end(),tmp[0]));
+ int pos=(int)std::distance(baseEdges.begin(),std::find(baseEdges.begin(),baseEdges.end(),tmp[0]));
std::vector< std::pair<int,int> >::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=std::distance(oppEdges.begin(),it);
+ int pos2=(int)std::distance(oppEdges.begin(),it);
int offset=pos-pos2;
if(offset<0)
offset+=lgthBaseFace;
INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyHexp12(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth)
{
- int nbOfHexagon=std::count(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_POLYGON);
- int nbOfQuad=std::count(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_QUAD4);
+ std::size_t nbOfHexagon=std::count(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_POLYGON);
+ std::size_t nbOfQuad=std::count(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_QUAD4);
if(nbOfQuad==6 && nbOfHexagon==2)
{
const int *hexag0=std::find(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_POLYGON);
- int hexg0Id=std::distance(conn+lgth,hexag0);
+ std::size_t hexg0Id=std::distance(conn+lgth,hexag0);
const int *hexag1=std::find(hexag0+1,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_POLYGON);
- int hexg1Id=std::distance(conn+lgth,hexag1);
+ std::size_t hexg1Id=std::distance(conn+lgth,hexag1);
const int *connHexag0=conn+5*hexg0Id;
- int lgthH0=std::distance(connHexag0,std::find(connHexag0,conn+lgth,-1));
+ std::size_t lgthH0=std::distance(connHexag0,std::find(connHexag0,conn+lgth,-1));
if(lgthH0==6)
{
const int *connHexag1=conn+5*hexg0Id+7+(hexg1Id-hexg0Id-1)*5;
- int lgthH1=std::distance(connHexag1,std::find(connHexag1,conn+lgth,-1));
+ std::size_t lgthH1=std::distance(connHexag1,std::find(connHexag1,conn+lgth,-1));
if(lgthH1==6)
{
std::vector<int> tmp;
*/
INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPenta6(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth)
{
- int nbOfTriFace=std::count(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_TRI3);
- int nbOfQuadFace=std::count(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_QUAD4);
+ std::size_t nbOfTriFace=std::count(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_TRI3);
+ std::size_t nbOfQuadFace=std::count(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_QUAD4);
if(nbOfTriFace==2 && nbOfQuadFace==3)
{
- int tri3_0=std::distance(conn+lgth,std::find(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_TRI3));
- int tri3_1=std::distance(conn+lgth,std::find(conn+lgth+tri3_0+1,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_TRI3));
+ std::size_t tri3_0=std::distance(conn+lgth,std::find(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_TRI3));
+ std::size_t tri3_1=std::distance(conn+lgth,std::find(conn+lgth+tri3_0+1,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_TRI3));
const int *tri_0=0,*tri_1=0;
const int *w=conn;
- for(int i=0;i<5;i++)
+ for(std::size_t i=0;i<5;i++)
{
if(i==tri3_0)
tri_0=w;
*/
INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPyra5(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth)
{
- int nbOfTriFace=std::count(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_TRI3);
- int nbOfQuadFace=std::count(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_QUAD4);
+ std::size_t nbOfTriFace=std::count(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_TRI3);
+ std::size_t nbOfQuadFace=std::count(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_QUAD4);
if(nbOfTriFace==4 && nbOfQuadFace==1)
{
- int quad4_pos=std::distance(conn+lgth,std::find(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_QUAD4));
+ std::size_t quad4_pos=std::distance(conn+lgth,std::find(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_QUAD4));
const int *quad4=0;
const int *w=conn;
- for(int i=0;i<5 && quad4==0;i++)
+ for(std::size_t i=0;i<5 && quad4==0;i++)
{
if(i==quad4_pos)
quad4=w;
w=conn;
bool ok=true;
int point=-1;
- for(int i=0;i<5 && ok;i++)
+ for(std::size_t i=0;i<5 && ok;i++)
{
if(i!=quad4_pos)
{
/**
\brief Function used to set the options for the intersection calculation
\details The following options can be modified:
- -# Intersection_type: the type of algorithm to be used in the computation of the cell-cell intersections.
+ -# intersectionType: the type of algorithm to be used in the computation of the cell-cell intersections.
- Values: Triangle, Convex.
- Default: Triangle.
- -# MedianPlane: Position of the median plane where both cells will be projected
+ -# medianPlan: Position of the median plane where both cells will be projected
- Values: between 0 and 1.
- Default: 0.5.
- -# DoRotate: rotate the coordinate system such that the target cell is in the Oxy plane.
+ -# doRotat: rotate the coordinate system such that the target cell is in the Oxy plane.
- Values: true (necessarilly if Intersection_type=Triangle), false.
- Default: true (as default Intersection_type=Triangle)
- -# Precision: Level of precision of the computations is precision times the characteristic size of the mesh.
+ -# precision: Level of precision of the computations is precision times the characteristic size of the mesh.
- Values: positive real number.
- Default: 1.0E-12.
- -# PrintLevel: Level of verboseness during the computations.
+ -# printLevel: Level of verboseness during the computations.
- Values: interger between 0 and 3.
- Default: 0.
*/
- void Interpolation3DSurf::setOptions(double precision, int printLevel, double medianPlane,
- IntersectionType intersectionType, bool doRotate, int orientation)
+ void Interpolation3DSurf::setOptions(double precision, int printLevel, double medianPlan,
+ IntersectionType intersectionType, bool doRotat, int orientation)
{
InterpolationPlanar<Interpolation3DSurf>::setOptions(precision,printLevel,intersectionType, orientation);
- InterpolationPlanar<Interpolation3DSurf>::setDoRotate(doRotate);
- InterpolationPlanar<Interpolation3DSurf>::setMedianPlane(medianPlane);
+ InterpolationPlanar<Interpolation3DSurf>::setDoRotate(doRotat);
+ InterpolationPlanar<Interpolation3DSurf>::setMedianPlane(medianPlan);
}
}
//std::cout<<"coucou1" << std::endl;
if( _is_in_intersection)
{
- for(int idim=0;idim<DIM;idim++) _Inter.push_back(Poly1[DIM*i_loc+idim]);
+ for(int iidim=0;iidim<DIM;iidim++)
+ _Inter.push_back(Poly1[DIM*i_loc+iidim]);
_End_segments.push_back(std::make_pair(i_glob,i_next_glob));
_End_segments.push_back(std::make_pair(i_glob,i_prev_glob));
}
Vect2 save;
Vect2 edge0;
Vect2 edge1;
- for (int i = 0; i < 2; ++i)
+ for (int ii = 0; ii < 2; ++ii)
{
- edge0[i] = projTri0[1][i] - projTri0[0][i];
- edge1[i] = projTri0[2][i] - projTri0[0][i];
+ edge0[ii] = projTri0[1][ii] - projTri0[0][ii];
+ edge1[ii] = projTri0[2][ii] - projTri0[0][ii];
}
if ((edge0[0] * edge1[1] - edge0[1] * edge1[0]) < (double) 0.)
{
// Triangle is clockwise, reorder it.
- for (int i = 0; i < 2; ++i)
+ for (int ii = 0; ii < 2; ++ii)
{
- save[i] = projTri0[1][i];
- projTri0[1][i] = projTri0[2][i];
- projTri0[2][i] = save[i];
+ save[ii] = projTri0[1][ii];
+ projTri0[1][ii] = projTri0[2][ii];
+ projTri0[2][ii] = save[ii];
}
}
- for (int i = 0; i < 2; ++i)
+ for (int ii = 0; ii < 2; ++ii)
{
- edge0[i] = projTri1[1][i] - projTri1[0][i];
- edge1[i] = projTri1[2][i] - projTri1[0][i];
+ edge0[ii] = projTri1[1][ii] - projTri1[0][ii];
+ edge1[ii] = projTri1[2][ii] - projTri1[0][ii];
}
if ((edge0[0] * edge1[1] - edge0[1] * edge1[0]) < (double) 0.)
{
// Triangle is clockwise, reorder it.
- for (int i = 0; i < 2; ++i)
+ for (int ii = 0; ii < 2; ++ii)
{
- save[i] = projTri1[1][i];
- projTri1[1][i] = projTri1[2][i];
- projTri1[2][i] = save[i];
+ save[ii] = projTri1[1][ii];
+ projTri1[1][ii] = projTri1[2][ii];
+ projTri1[2][ii] = save[ii];
}
}
double barycenter[3];
calculatePolygonBarycenter(A, barycenter);
sortIntersectionPolygon(A, barycenter);
- const int nbPoints = _polygonA.size();
- for(int i = 0 ; i < nbPoints ; ++i)
+ const std::size_t nbPoints = _polygonA.size();
+ for(std::size_t i = 0 ; i < nbPoints ; ++i)
tat->reverseApply(_polygonA[i], _polygonA[i]);
_volume = calculateSurfacePolygon();
}
*/
double TransformedTriangle::calculateSurfacePolygon()
{
- const int nbPoints = _polygonA.size();
+ const std::size_t nbPoints = _polygonA.size();
double pdt[3];
double sum[3] = {0., 0., 0.};
- for(int i = 0 ; i < nbPoints ; ++i)
+ for(std::size_t i = 0 ; i < nbPoints ; ++i)
{
const double *const ptCurr = _polygonA[i]; // pt "i"
const double *const ptNext = _polygonA[(i + 1) % nbPoints]; // pt "i+1" (pt nbPoints == pt 0)
std::vector<double*>& polygon = (poly == A) ? _polygonA : _polygonB;
// calculate barycenter
- const int m = polygon.size();
+ const std::size_t m = polygon.size();
for(int j = 0 ; j < 3 ; ++j)
{
if(m != 0)
{
- for(int i = 0 ; i < m ; ++i)
+ for(std::size_t i = 0 ; i < m ; ++i)
{
const double* pt = polygon[i];
for(int j = 0 ; j < 3 ; ++j)
std::vector<double*>& polygon = (poly == A) ? _polygonA : _polygonB;
double vol = 0.0;
- const int m = polygon.size();
+ const std::size_t m = polygon.size();
- for(int i = 0 ; i < m ; ++i)
+ for(std::size_t i = 0 ; i < m ; ++i)
{
const double* ptCurr = polygon[i]; // pt "i"
const double* ptNext = polygon[(i + 1) % m]; // pt "i+1" (pt m == pt 0)
// products 1 and 2 for each edge -> first condition in Grandy [30]
// products 3 and 4 for each edge -> third condition
// NB : some uncertainty whether these last are correct
- static const DoubleProduct DP_FOR_HALFSTRIP_INTERSECTION[12] =
- {
- C_10, C_01, C_ZH, C_10, // XY
- C_01, C_XY, C_XH, C_01, // YZ
- C_XY, C_10, C_YH, C_XY // ZX
- };
+ // DP_FOR_HALFSTRIP_INTERSECTION
// facets to use in second condition (S_m)
static const TetraFacet FACET_FOR_HALFSTRIP_INTERSECTION[3] =
baryCenter[0] = baryCenter[1] = baryCenter[2] = 0.;
std::list< std::vector< double* > >::iterator f = _faces.begin(), fEnd = _faces.end();
- double * P = f->at(0);
+ double * PP = f->at(0);
for ( ++f; f != fEnd; ++f )
{
bool pBelongsToPoly = false;
std::vector<double*>::iterator v = polygon.begin(), vEnd = polygon.end();
for ( ; !pBelongsToPoly && v != vEnd; ++v )
- pBelongsToPoly = samePoint( P, *v );
+ pBelongsToPoly = samePoint( PP, *v );
if ( pBelongsToPoly )
continue;
// Compute the barycenter of the volume. Barycenter of pyramid is on line
- // ( barycenter of polygon -> P ) with 1/4 of pyramid height from polygon.
+ // ( barycenter of polygon -> PP ) with 1/4 of pyramid height from polygon.
double bary[] = { 0, 0, 0 };
bary[1] += p[1];
bary[2] += p[2];
}
- bary[0] /= polygon.size();
- bary[1] /= polygon.size();
- bary[2] /= polygon.size();
+ bary[0] /= (int)polygon.size();
+ bary[1] /= (int)polygon.size();
+ bary[2] /= (int)polygon.size();
// pyramid volume
double vol = 0;
{
double* p1 = polygon[i];
double* p2 = polygon[(i+1)%polygon.size()];
- vol += std::fabs( calculateVolumeForTetra( p1, p2, bary, P ));
+ vol += std::fabs( calculateVolumeForTetra( p1, p2, bary, PP ));
}
- // put bary on the line ( barycenter of polygon -> P ) and multiply by volume
- baryCenter[0] += ( bary[0] * 0.75 + P[0] * 0.25 ) * vol;
- baryCenter[1] += ( bary[1] * 0.75 + P[1] * 0.25 ) * vol;
- baryCenter[2] += ( bary[2] * 0.75 + P[2] * 0.25 ) * vol;
+ // put bary on the line ( barycenter of polygon -> PP ) and multiply by volume
+ baryCenter[0] += ( bary[0] * 0.75 + PP[0] * 0.25 ) * vol;
+ baryCenter[1] += ( bary[1] * 0.75 + PP[1] * 0.25 ) * vol;
+ baryCenter[2] += ( bary[2] * 0.75 + PP[2] * 0.25 ) * vol;
}
if ( _int_volume < 0. )
_int_volume = -_int_volume;
sideAdded[j] = ++nbAddedSides != 0 ;
}
if ( !sideAdded[3] &&
- ( epsilonEqual( (coordSum[0]+coordSum[1]+coordSum[2]) / polygon.size(), 1. )))
+ ( epsilonEqual( (coordSum[0]+coordSum[1]+coordSum[2]) / (int)polygon.size(), 1. )))
sideAdded[3] = ++nbAddedSides != 0 ;
}
if ( nbAddedSides == NB_TETRA_SIDES )
// Add segments of already added polygons to future polygonal faces on sides of tetra
// ---------------------------------------------------------------------------------
- int nbIntersectPolygs = _faces.size();
+ std::size_t nbIntersectPolygs = _faces.size();
std::vector< double* > * sideFaces[ 4 ]; // future polygons on sides of tetra
for ( int i = 0; i < NB_TETRA_SIDES; ++i )
}
}
f = _faces.begin(), fEnd = _faces.end();
- for ( int iF = 0; iF < nbIntersectPolygs; ++f, ++iF ) // loop on added intersection polygons
+ for ( std::size_t iF = 0; iF < nbIntersectPolygs; ++f, ++iF ) // loop on added intersection polygons
{
std::vector< double* >& polygon = *f;
- for ( int i = 0; i < (int)polygon.size(); ++i )
+ for ( std::size_t i = 0; i < polygon.size(); ++i )
{
// segment ends
double* p1 = polygon[i];
for ( int ic = 0; ic < NB_TETRA_NODES; ++ic )
{
f = _faces.begin(), fEnd = _faces.end();
- for ( int iF = 0; iF < nbIntersectPolygs; ++f, ++iF ) // loop on added intersection polygons
+ for ( std::size_t iF = 0; iF < nbIntersectPolygs; ++f, ++iF ) // loop on added intersection polygons
{
std::vector< double* >& polygon = *f;
if ( !sideFaces[i] ) continue;
std::vector< double* >& sideFace = *sideFaces[i];
- int nbPoints = sideFace.size();
+ std::size_t nbPoints = sideFace.size();
if ( nbPoints == 0 )
continue; // not intersected face at all - no cut off corners can be detected
int nbCutOnSide = 0;
bool isSegmentOnEdge=false;
- for ( int ip = 0; ip < nbPoints; ++ip )
+ for ( std::size_t ip = 0; ip < nbPoints; ++ip )
{
- int isSegmentEnd = ( ip % 2 );
+ std::size_t isSegmentEnd = ( ip % 2 );
double* p = sideFace[ ip ];
double* p2 = isSegmentEnd ? 0 : sideFace[ip+1];
if ( !isSegmentOnEdge )
{ // segment ends are on different edges
- pCut[ind2] = isSegmentEnd; // believe that cutting triangles are well oriented
+ pCut[ind2] = (int)isSegmentEnd; // believe that cutting triangles are well oriented
cutOffIndex = pCut[0] + 2*pCut[1] + 3*pCut[2];
}
if ( epsilonEqual( p[ind2], 0.) || epsilonEqual( p[ind2], 1.))
isSegmentOnEdge = true;
if ( !isSegmentEnd )
{// segment ends are on different edges
- pCut[ind1] = 1-isSegmentEnd;
+ pCut[ind1] = 1-(int)isSegmentEnd;
cutOffIndex = pCut[0] + 2*pCut[1] + 3*pCut[2];
}
if ( epsilonEqual( p[ind1], 0.) || epsilonEqual( p[ind1], 1.))
isSegmentOnEdge = true;
if ( !isSegmentOnEdge )
{ //segment ends are on different edges
- pCut[ind1] = isSegmentEnd;
- pCut[ind2] = 1-isSegmentEnd;
+ pCut[ind1] = (int)isSegmentEnd;
+ pCut[ind2] = 1-(int)isSegmentEnd;
cutOffIndex = pCut[0] + 2*pCut[1] + 3*pCut[2];
}
}
// Sort corners of filled up faces on tetra sides and exclude equal points
// ------------------------------------------------------------------------
- int iF = 0;
+ std::size_t iF = 0;
for ( f = _faces.begin(); f != fEnd; ++f, ++iF )
{
std::vector< double* >& face = *f;
if ( iF >= nbIntersectPolygs )
{ // sort points of side faces
calculatePolygonBarycenter( A, _barycenterA );
- setTriangleOnSide( iF - nbIntersectPolygs );
+ setTriangleOnSide( (int)(iF-nbIntersectPolygs) );
sortIntersectionPolygon( A, _barycenterA );
}
// exclude equal points