From: ageay Date: Wed, 25 Jan 2012 08:40:21 +0000 (+0000) Subject: Warning hunting X-Git-Tag: V6_main_FINAL~901 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bcbca66859466f73c961b58017380c4d4470061c;p=tools%2Fmedcoupling.git Warning hunting --- diff --git a/src/INTERP_KERNEL/Bases/InterpKernelException.cxx b/src/INTERP_KERNEL/Bases/InterpKernelException.cxx index 00c8d2f26..6bb9285f5 100644 --- a/src/INTERP_KERNEL/Bases/InterpKernelException.cxx +++ b/src/INTERP_KERNEL/Bases/InterpKernelException.cxx @@ -21,12 +21,12 @@ #include -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) { } diff --git a/src/INTERP_KERNEL/Bases/InterpKernelException.hxx b/src/INTERP_KERNEL/Bases/InterpKernelException.hxx index 298c05aa6..6482d3864 100644 --- a/src/INTERP_KERNEL/Bases/InterpKernelException.hxx +++ b/src/INTERP_KERNEL/Bases/InterpKernelException.hxx @@ -30,8 +30,8 @@ namespace INTERP_KERNEL 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: diff --git a/src/INTERP_KERNEL/DirectedBoundingBox.cxx b/src/INTERP_KERNEL/DirectedBoundingBox.cxx index 5a1c4e148..98ebf830a 100644 --- a/src/INTERP_KERNEL/DirectedBoundingBox.cxx +++ b/src/INTERP_KERNEL/DirectedBoundingBox.cxx @@ -159,13 +159,13 @@ T[i2] += s * ( t1 - tau * t2);\ __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; diff --git a/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx b/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx index 4bc2354c8..184e9ba24 100644 --- a/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx +++ b/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx @@ -77,7 +77,7 @@ void LeafExprVal::fillValue(Value *val) const throw(INTERP_KERNEL::Exception) void LeafExprVal::replaceValues(const std::vector& 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]; @@ -105,7 +105,7 @@ void LeafExprVar::prepareExprEvaluation(const std::vector& vars) co } return; } - _fast_pos=iter-vars.begin(); + _fast_pos=(int)std::distance(vars.begin(),iter); } void LeafExprVar::prepareExprEvaluationVec() const throw(INTERP_KERNEL::Exception) @@ -412,21 +412,21 @@ void ExprParser::parseUnaryFunc() 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;igetCharactValue(*nodeToTest); std::set< IntersectElement > inOutSwitch; - for(std::list::const_iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++) + for(std::list::const_iterator iter4=_sub_edges.begin();iter4!=_sub_edges.end();iter4++) { - ElementaryEdge *val=(*iter); + ElementaryEdge *val=(*iter4); if(val) { Edge *e=val->getPtr(); @@ -413,11 +413,11 @@ bool ComposedEdge::isInOrOut(Node *nodeToTest) const } 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()getLoc()==ON_1) + if((*iter4).getNodeOnly()->getLoc()==ON_1) ret=!ret; } else diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx index 6b06899a4..e3178aef5 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx @@ -260,7 +260,7 @@ void IntersectElement::setNode(Node *node) const { if(_node) ((Node *)_node)->decrRef(); - ((IntersectElement *)(this))->_node=node; + (const_cast(this))->_node=node; if(_node) _node->incrRef(); } @@ -457,8 +457,8 @@ bool Edge::changeStartNodeWith(Node *otherStartNode) const 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(this))->_start)->decrRef();//un-const cast Ok thanks to 2 lines above. + ((const_cast(this))->_start)=otherStartNode; _start->incrRef(); return true; } @@ -471,8 +471,8 @@ bool Edge::changeStartNodeWithAndKeepTrack(Node *otherStartNode, std::vectorisEqualAndKeepTrack(*otherStartNode,track)) { - (((Edge *)this)->_start)->decrRef();//un-const cast Ok thanks to 2 lines above. - (((Edge *)this)->_start)=otherStartNode; + ((const_cast(this))->_start)->decrRef();//un-const cast Ok thanks to 2 lines above. + ((const_cast(this))->_start)=otherStartNode; otherStartNode->incrRef(); return true; } @@ -485,8 +485,8 @@ bool Edge::changeEndNodeWith(Node *otherEndNode) const return true; if(_end->isEqual(*otherEndNode)) { - (((Edge *)this)->_end)->decrRef(); - (((Edge *)this)->_end)=otherEndNode; + ((const_cast(this))->_end)->decrRef(); + ((const_cast(this))->_end)=otherEndNode; _end->incrRef(); return true; } @@ -499,8 +499,8 @@ bool Edge::changeEndNodeWithAndKeepTrack(Node *otherEndNode, std::vector return true; if(_end->isEqualAndKeepTrack(*otherEndNode,track)) { - (((Edge *)this)->_end)->decrRef(); - (((Edge *)this)->_end)=otherEndNode; + ((const_cast(this))->_end)->decrRef(); + ((const_cast(this))->_end)=otherEndNode; otherEndNode->incrRef(); return true; } @@ -521,7 +521,7 @@ void Edge::addSubEdgeInVector(Node *start, Node *end, ComposedEdge& vec) const if(start==_start && end==_end) { incrRef(); - vec.pushBack((Edge *)this); + vec.pushBack(const_cast(this)); return ; } vec.pushBack(buildEdgeLyingOnMe(start,end,true)); @@ -691,19 +691,19 @@ bool Edge::Intersect(const Edge *f1, const Edge *f2, EdgeIntersector *intersecto std::vector::reverse_iterator iterR=newNodes.rbegin(); f1->addSubEdgeInVector(f1->getStartNode(),*iter,outValForF1); f2->addSubEdgeInVector(f2->getStartNode(),order?*iter:*iterR,outValForF2); - for(std::vector::iterator iter=newNodes.begin();iter!=newNodes.end();iter++,iterR++) + for(std::vector::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; @@ -756,9 +756,9 @@ bool Edge::SplitOverlappedEdges(const Edge *e1, const Edge *e2, Node *nS, Node * 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(e2),direction); outVal1.setValueAt(2,e1->buildEdgeLyingOnMe(nE,e1->getEndNode())); - outVal2.pushBack((Edge*)e2); e2->declareOn(); + outVal2.pushBack(const_cast(e2)); e2->declareOn(); return true; } else @@ -785,42 +785,42 @@ bool Edge::SplitOverlappedEdges(const Edge *e1, const Edge *e2, Node *nS, Node * 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(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(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(e1)); + outVal2.pushBack(const_cast(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(e1)); outVal2.resize(2); - outVal2.setValueAt(direction?0:1,(Edge*)e1,direction); e1->declareOn(); + outVal2.setValueAt(direction?0:1,const_cast(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(e2),direction); + outVal2.pushBack(const_cast(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(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(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(e2),direction); outVal1.pushBack(e1->buildEdgeLyingOnMe(nE,e1->getEndNode())); - outVal2.pushBack((Edge*)e2); e2->declareOn(); + outVal2.pushBack(const_cast(e2)); e2->declareOn(); return true; case INSIDE*OFFSET_FOR_TYPEOFLOCINEDGE+START: // INSIDE - START outVal1.resize(2); diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx index 06e2d053b..b9a8f0cdd 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx @@ -356,12 +356,12 @@ std::list< IntersectElement > ArcCSegIntersector::getIntersectionsCharacteristic { 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; } diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeInfLin.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeInfLin.hxx index 48d494e62..af24ff9bb 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeInfLin.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeInfLin.hxx @@ -32,7 +32,7 @@ namespace INTERP_KERNEL bool isIn(double characterVal) const { return true; } void dynCastFunction(const EdgeLin * &seg, const EdgeArcCircle * &arcSeg) const { seg=this; } - private: + protected: ~EdgeInfLin() { } }; } diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.cxx index a62faf266..a844c3d3c 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.cxx @@ -76,7 +76,7 @@ bool Node::isEqualAndKeepTrack(const Node& other, std::vector& track) co { bool ret=isEqual(other); if(ret) - track.push_back((Node *)&other); + track.push_back(const_cast(&other)); return ret; } @@ -155,7 +155,7 @@ void Node::fillGlobalInfoAbs(const std::map& mapThis, *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; diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx index 9dd449755..19c8a8001 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx @@ -69,8 +69,8 @@ QuadraticPolygon::~QuadraticPolygon() QuadraticPolygon *QuadraticPolygon::buildLinearPolygon(std::vector& nodes) { QuadraticPolygon *ret=new QuadraticPolygon; - int size=nodes.size(); - for(int i=0;ipushBack(new EdgeLin(nodes[i],nodes[(i+1)%size])); nodes[i]->decrRef(); @@ -81,8 +81,8 @@ QuadraticPolygon *QuadraticPolygon::buildLinearPolygon(std::vector& node QuadraticPolygon *QuadraticPolygon::buildArcCirclePolygon(std::vector& nodes) { QuadraticPolygon *ret=new QuadraticPolygon; - int size=nodes.size(); - for(int i=0;i& mapp, bool isQuad, const int *descBg, const int *descEnd, const std::vector >& intersectEdges) { - int nbOfSeg=std::distance(descBg,descEnd); - for(int i=0;i0; int edgeId=abs(descBg[i])-1; const std::vector& subEdge=intersectEdges[edgeId]; - int nbOfSubEdges=subEdge.size()/2; - for(int j=0;j(this)); int edgeId=0; for(it1.first();!it1.finished();it1.next(),edgeId++) { @@ -499,7 +499,7 @@ void QuadraticPolygon::intersectForPerimeterAdvanced(const QuadraticPolygon& oth tmp.dispatchPerimeter(polThis[edgeId]); } // - IteratorOnComposedEdge it2((QuadraticPolygon *)&other); + IteratorOnComposedEdge it2(const_cast(&other)); edgeId=0; for(it2.first();!it2.finished();it2.next(),edgeId++) { @@ -524,7 +524,7 @@ void QuadraticPolygon::intersectForPerimeterAdvanced(const QuadraticPolygon& oth void QuadraticPolygon::intersectForPoint(const QuadraticPolygon& other, std::vector< int >& numberOfCreatedPointsPerEdge) const { numberOfCreatedPointsPerEdge.resize(size()); - IteratorOnComposedEdge it1((QuadraticPolygon *)this); + IteratorOnComposedEdge it1(const_cast(this)); int edgeId=0; for(it1.first();!it1.finished();it1.next(),edgeId++) { @@ -721,7 +721,7 @@ void QuadraticPolygon::closePolygons(std::list& pol2Zip, con */ bool QuadraticPolygon::amIAChanceToBeCompletedBy(const QuadraticPolygon& pol1Splitted,const QuadraticPolygon& pol2NotSplitted, bool& direction) { - IteratorOnComposedEdge it((QuadraticPolygon *)&pol1Splitted); + IteratorOnComposedEdge it(const_cast(&pol1Splitted)); bool found=false; Node *n=getEndNode(); ElementaryEdge *cur=it.current(); @@ -770,7 +770,7 @@ std::list::iterator QuadraticPolygon::fillAsMuchAsPossibleWi std::list::iterator iEnd, bool direction) { - IteratorOnComposedEdge it((QuadraticPolygon *)&pol1Splitted); + IteratorOnComposedEdge it(const_cast(&pol1Splitted)); bool found=false; Node *n=getEndNode(); ElementaryEdge *cur; diff --git a/src/INTERP_KERNEL/InterpKernelCellSimplify.cxx b/src/INTERP_KERNEL/InterpKernelCellSimplify.cxx index d8d5e6ae9..15f0c6858 100644 --- a/src/INTERP_KERNEL/InterpKernelCellSimplify.cxx +++ b/src/INTERP_KERNEL/InterpKernelCellSimplify.cxx @@ -126,8 +126,8 @@ int *CellSimplify::getFullPolyh3DCell(INTERP_KERNEL::NormalizedCellType type, co std::vector faces; for(unsigned j=0;j nodes(conn,conn+lgth); nodes.erase(-1); - int nbOfNodes=nodes.size(); + int nbOfNodes=(int)nodes.size(); int magicNumber=100*nbOfNodes+nbOfFaces; switch(magicNumber) { @@ -215,9 +215,9 @@ bool CellSimplify::orientOppositeFace(const int *baseFace, int *retConn, const i sideEdges[i]=r; } //end reverse sideFace - std::set< std::pair > baseEdgesS(baseEdges.begin(),baseEdges.end()); - std::set< std::pair > sideEdgesS(sideEdges.begin(),sideEdges.end()); - std::set_intersection(baseEdgesS.begin(),baseEdgesS.end(),sideEdgesS.begin(),sideEdgesS.end(),std::back_insert_iterator< std::vector< std::pair > >(tmp)); + std::set< std::pair > baseEdgesS2(baseEdges.begin(),baseEdges.end()); + std::set< std::pair > sideEdgesS2(sideEdges.begin(),sideEdges.end()); + std::set_intersection(baseEdgesS2.begin(),baseEdgesS2.end(),sideEdgesS2.begin(),sideEdgesS2.end(),std::back_insert_iterator< std::vector< std::pair > >(tmp)); if(tmp.empty()) return false; } @@ -237,11 +237,11 @@ bool CellSimplify::orientOppositeFace(const int *baseFace, int *retConn, const i } 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 >::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; @@ -326,20 +326,20 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyHex8(const int *conn, 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 tmp; @@ -371,15 +371,15 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyHexp12(const int *con */ 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; @@ -415,14 +415,14 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPenta6(const int *con */ 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; @@ -433,7 +433,7 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPyra5(const int *conn 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) { diff --git a/src/INTERP_KERNEL/Interpolation3DSurf.cxx b/src/INTERP_KERNEL/Interpolation3DSurf.cxx index e24f0a731..957816859 100644 --- a/src/INTERP_KERNEL/Interpolation3DSurf.cxx +++ b/src/INTERP_KERNEL/Interpolation3DSurf.cxx @@ -34,27 +34,27 @@ namespace INTERP_KERNEL /** \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::setOptions(precision,printLevel,intersectionType, orientation); - InterpolationPlanar::setDoRotate(doRotate); - InterpolationPlanar::setMedianPlane(medianPlane); + InterpolationPlanar::setDoRotate(doRotat); + InterpolationPlanar::setMedianPlane(medianPlan); } } diff --git a/src/INTERP_KERNEL/PolygonAlgorithms.txx b/src/INTERP_KERNEL/PolygonAlgorithms.txx index d7aee3976..516e41c29 100644 --- a/src/INTERP_KERNEL/PolygonAlgorithms.txx +++ b/src/INTERP_KERNEL/PolygonAlgorithms.txx @@ -512,7 +512,8 @@ namespace INTERP_KERNEL //std::cout<<"coucou1" << std::endl; if( _is_in_intersection) { - for(int idim=0;idimreverseApply(_polygonA[i], _polygonA[i]); _volume = calculateSurfacePolygon(); } @@ -585,11 +585,11 @@ namespace INTERP_KERNEL */ 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) @@ -620,7 +620,7 @@ namespace INTERP_KERNEL std::vector& 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) { @@ -629,7 +629,7 @@ namespace INTERP_KERNEL 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) @@ -719,9 +719,9 @@ namespace INTERP_KERNEL std::vector& 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) diff --git a/src/INTERP_KERNEL/TransformedTriangleIntersect.cxx b/src/INTERP_KERNEL/TransformedTriangleIntersect.cxx index faf7c9b61..02a43a473 100644 --- a/src/INTERP_KERNEL/TransformedTriangleIntersect.cxx +++ b/src/INTERP_KERNEL/TransformedTriangleIntersect.cxx @@ -413,12 +413,7 @@ namespace INTERP_KERNEL // 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] = diff --git a/src/INTERP_KERNEL/UnitTetraIntersectionBary.cxx b/src/INTERP_KERNEL/UnitTetraIntersectionBary.cxx index 03737720a..49cc67e62 100644 --- a/src/INTERP_KERNEL/UnitTetraIntersectionBary.cxx +++ b/src/INTERP_KERNEL/UnitTetraIntersectionBary.cxx @@ -228,7 +228,7 @@ namespace INTERP_KERNEL 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 ) { @@ -239,12 +239,12 @@ namespace INTERP_KERNEL bool pBelongsToPoly = false; std::vector::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 }; @@ -256,9 +256,9 @@ namespace INTERP_KERNEL 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; @@ -266,13 +266,13 @@ namespace INTERP_KERNEL { 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; @@ -328,7 +328,7 @@ namespace INTERP_KERNEL 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 ) @@ -338,7 +338,7 @@ namespace INTERP_KERNEL // 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 ) @@ -351,10 +351,10 @@ namespace INTERP_KERNEL } } 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]; @@ -428,7 +428,7 @@ namespace INTERP_KERNEL 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; @@ -454,7 +454,7 @@ namespace INTERP_KERNEL 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 @@ -462,9 +462,9 @@ namespace INTERP_KERNEL 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]; @@ -483,7 +483,7 @@ namespace INTERP_KERNEL 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.)) @@ -499,7 +499,7 @@ namespace INTERP_KERNEL 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.)) @@ -515,8 +515,8 @@ namespace INTERP_KERNEL 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]; } } @@ -626,7 +626,7 @@ namespace INTERP_KERNEL // 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; @@ -639,7 +639,7 @@ namespace INTERP_KERNEL if ( iF >= nbIntersectPolygs ) { // sort points of side faces calculatePolygonBarycenter( A, _barycenterA ); - setTriangleOnSide( iF - nbIntersectPolygs ); + setTriangleOnSide( (int)(iF-nbIntersectPolygs) ); sortIntersectionPolygon( A, _barycenterA ); } // exclude equal points