From: vuzlov Date: Fri, 4 Sep 2020 11:48:13 +0000 (+0300) Subject: fix removed functions c++17 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a2fc8032e0d9655789038aedd6f1fde0b184fa2c;p=tools%2Fmedcoupling.git fix removed functions c++17 --- diff --git a/src/INTERP_KERNEL/Bases/InterpKernelStlExt.hxx b/src/INTERP_KERNEL/Bases/InterpKernelStlExt.hxx index 270417155..3f49558aa 100644 --- a/src/INTERP_KERNEL/Bases/InterpKernelStlExt.hxx +++ b/src/INTERP_KERNEL/Bases/InterpKernelStlExt.hxx @@ -26,8 +26,8 @@ namespace INTERP_KERNEL { namespace STLEXT { - template - struct Select1st : public std::unary_function<_Pair, typename _Pair::first_type> + template + struct Select1st //: public std::unary_function<_Pair, typename _Pair::first_type> { typename _Pair::first_type& operator()(_Pair& __x) const { return __x.first; } const typename _Pair::first_type&operator()(const _Pair& __x) const { return __x.first; } diff --git a/src/INTERP_KERNEL/ExprEval/InterpKernelValue.cxx b/src/INTERP_KERNEL/ExprEval/InterpKernelValue.cxx index 3388bd97f..165f7dd57 100644 --- a/src/INTERP_KERNEL/ExprEval/InterpKernelValue.cxx +++ b/src/INTERP_KERNEL/ExprEval/InterpKernelValue.cxx @@ -438,93 +438,93 @@ void ValueDoubleExpr::negate() void ValueDoubleExpr::sqrt() { - double *it=std::find_if(_dest_data,_dest_data+_sz_dest_data,std::bind2nd(std::less(),0.)); + double *it=std::find_if(_dest_data,_dest_data+_sz_dest_data,std::bind(std::less(), std::placeholders::_1,0.)); if(it!=_dest_data+_sz_dest_data) throw INTERP_KERNEL::Exception("Trying to apply sqrt on < 0. value !"); - std::transform(_dest_data,_dest_data+_sz_dest_data,_dest_data,std::ptr_fun(std::sqrt)); + std::transform(_dest_data, _dest_data + _sz_dest_data, _dest_data, [](double c) {return std::sqrt(c); }); //std::ptr_fun(std::sqrt) } void ValueDoubleExpr::cos() { - std::transform(_dest_data,_dest_data+_sz_dest_data,_dest_data,std::ptr_fun(std::cos)); + std::transform(_dest_data,_dest_data+_sz_dest_data,_dest_data, [](double c) {return std::cos(c); }); } void ValueDoubleExpr::sin() { - std::transform(_dest_data,_dest_data+_sz_dest_data,_dest_data,std::ptr_fun(std::sin)); + std::transform(_dest_data,_dest_data+_sz_dest_data,_dest_data, [](double c) {return std::sin(c); }); } void ValueDoubleExpr::tan() { - std::transform(_dest_data,_dest_data+_sz_dest_data,_dest_data,std::ptr_fun(std::tan)); + std::transform(_dest_data,_dest_data+_sz_dest_data,_dest_data, [](double c) {return std::tan(c); }); } void ValueDoubleExpr::acos() { - double *it=std::find_if(_dest_data,_dest_data+_sz_dest_data,std::bind2nd(std::less(),-1.)); + double *it=std::find_if(_dest_data,_dest_data+_sz_dest_data,std::bind(std::less(), std::placeholders::_1,-1.)); if(it!=_dest_data+_sz_dest_data) throw INTERP_KERNEL::Exception("Trying to apply acos on < 1. value !"); - it=std::find_if(_dest_data,_dest_data+_sz_dest_data,std::bind2nd(std::greater(),1.)); + it=std::find_if(_dest_data,_dest_data+_sz_dest_data,std::bind(std::greater(),std::placeholders::_1,1.)); if(it!=_dest_data+_sz_dest_data) throw INTERP_KERNEL::Exception("Trying to apply acos on > 1. value !"); - std::transform(_dest_data,_dest_data+_sz_dest_data,_dest_data,std::ptr_fun(std::acos)); + std::transform(_dest_data,_dest_data+_sz_dest_data,_dest_data, [](double c) {return std::acos(c); }); //std::ptr_fun(std::acos) } void ValueDoubleExpr::asin() { - double *it=std::find_if(_dest_data,_dest_data+_sz_dest_data,std::bind2nd(std::less(),-1.)); + double *it=std::find_if(_dest_data,_dest_data+_sz_dest_data,std::bind(std::less(), std::placeholders::_1,-1.)); if(it!=_dest_data+_sz_dest_data) throw INTERP_KERNEL::Exception("Trying to apply asin on < 1. value !"); - it=std::find_if(_dest_data,_dest_data+_sz_dest_data,std::bind2nd(std::greater(),1.)); + it=std::find_if(_dest_data,_dest_data+_sz_dest_data,std::bind(std::greater(),std::placeholders::_1,1.)); if(it!=_dest_data+_sz_dest_data) throw INTERP_KERNEL::Exception("Trying to apply asin on > 1. value !"); - std::transform(_dest_data,_dest_data+_sz_dest_data,_dest_data,std::ptr_fun(std::asin)); + std::transform(_dest_data,_dest_data+_sz_dest_data,_dest_data, [](double c) {return std::asin(c); }); } void ValueDoubleExpr::atan() { - std::transform(_dest_data,_dest_data+_sz_dest_data,_dest_data,std::ptr_fun(std::atan)); + std::transform(_dest_data,_dest_data+_sz_dest_data,_dest_data, [](double c) {return std::atan(c); }); } void ValueDoubleExpr::cosh() { - std::transform(_dest_data,_dest_data+_sz_dest_data,_dest_data,std::ptr_fun(std::cosh)); + std::transform(_dest_data,_dest_data+_sz_dest_data,_dest_data, [](double c) {return std::cosh(c); }); } void ValueDoubleExpr::sinh() { - std::transform(_dest_data,_dest_data+_sz_dest_data,_dest_data,std::ptr_fun(std::sinh)); + std::transform(_dest_data,_dest_data+_sz_dest_data,_dest_data, [](double c) {return std::sinh(c); }); } void ValueDoubleExpr::tanh() { - std::transform(_dest_data,_dest_data+_sz_dest_data,_dest_data,std::ptr_fun(std::tanh)); + std::transform(_dest_data,_dest_data+_sz_dest_data,_dest_data, [](double c) {return std::tanh(c); }); } void ValueDoubleExpr::abs() { - std::transform(_dest_data,_dest_data+_sz_dest_data,_dest_data,std::ptr_fun(fabs)); + std::transform(_dest_data,_dest_data+_sz_dest_data,_dest_data, [](double c) {return std::fabs(c); }); } void ValueDoubleExpr::exp() { - std::transform(_dest_data,_dest_data+_sz_dest_data,_dest_data,std::ptr_fun(std::exp)); + std::transform(_dest_data,_dest_data+_sz_dest_data,_dest_data, [](double c) {return std::exp(c); }); } void ValueDoubleExpr::ln() { - double *it=std::find_if(_dest_data,_dest_data+_sz_dest_data,std::bind2nd(std::less_equal(),0.)); + double *it=std::find_if(_dest_data,_dest_data+_sz_dest_data,std::bind(std::less_equal(),std::placeholders::_1,0.)); if(it!=_dest_data+_sz_dest_data) throw INTERP_KERNEL::Exception("Trying to apply neperian/natural log on <= 0. value !"); - std::transform(_dest_data,_dest_data+_sz_dest_data,_dest_data,std::ptr_fun(std::log)); + std::transform(_dest_data,_dest_data+_sz_dest_data,_dest_data, [](double c) {return std::log(c); }); } void ValueDoubleExpr::log10() { - double *it=std::find_if(_dest_data,_dest_data+_sz_dest_data,std::bind2nd(std::less_equal(),0.)); + double *it=std::find_if(_dest_data,_dest_data+_sz_dest_data,std::bind(std::less_equal(),std::placeholders::_1,0.)); if(it!=_dest_data+_sz_dest_data) throw INTERP_KERNEL::Exception("Trying to apply log10 on <= 0. value !"); - std::transform(_dest_data,_dest_data+_sz_dest_data,_dest_data,std::ptr_fun(std::log10)); + std::transform(_dest_data,_dest_data+_sz_dest_data,_dest_data, [](double c) {return std::log10(c); }); } Value *ValueDoubleExpr::plus(const Value *other) const @@ -566,11 +566,11 @@ Value *ValueDoubleExpr::pow(const Value *other) const { const ValueDoubleExpr *otherC=static_cast(other); double p=otherC->getData()[0]; - double *it=std::find_if(_dest_data,_dest_data+_sz_dest_data,std::bind2nd(std::less(),0.)); + double *it=std::find_if(_dest_data,_dest_data+_sz_dest_data,std::bind(std::less(),std::placeholders::_1,0.)); if(it!=_dest_data+_sz_dest_data) throw INTERP_KERNEL::Exception("Trying to operate pow(a,b) with a<0. !"); ValueDoubleExpr *ret=new ValueDoubleExpr(_sz_dest_data,_src_data); - std::transform(_dest_data,_dest_data+_sz_dest_data,ret->getData(),std::bind2nd(std::ptr_fun(std::pow),p)); + std::transform(_dest_data, _dest_data + _sz_dest_data, ret->getData(), std::bind([](double x, double y) {return std::pow(x, y); }, std::placeholders::_1, p)); //std::ptr_fun(std::pow) return ret; } @@ -578,7 +578,7 @@ Value *ValueDoubleExpr::max(const Value *other) const { const ValueDoubleExpr *otherC=static_cast(other); ValueDoubleExpr *ret=new ValueDoubleExpr(_sz_dest_data,_src_data); - std::transform(_dest_data,_dest_data+_sz_dest_data,otherC->getData(),ret->getData(),std::ptr_fun(std::max)); + std::transform(_dest_data, _dest_data + _sz_dest_data, otherC->getData(), ret->getData(), [](const double& x, const double& y) {return std::max(x, y); }); //std::ptr_fun(std::max) return ret; } @@ -586,7 +586,7 @@ Value *ValueDoubleExpr::min(const Value *other) const { const ValueDoubleExpr *otherC=static_cast(other); ValueDoubleExpr *ret=new ValueDoubleExpr(_sz_dest_data,_src_data); - std::transform(_dest_data,_dest_data+_sz_dest_data,otherC->getData(),ret->getData(),std::ptr_fun(std::min)); + std::transform(_dest_data, _dest_data + _sz_dest_data, otherC->getData(), ret->getData(), [](const double& x, const double& y) {return std::min(x, y); }); //std::ptr_fun(std::min) return ret; } diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx index be520b484..dc041eaac 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx @@ -605,7 +605,7 @@ void Edge::getNormalVector(double *vectOutput) const std::copy((const double *)(*_end),(const double *)(*_end)+2,vectOutput); std::transform(vectOutput,vectOutput+2,(const double *)(*_start),vectOutput,std::minus()); double norm=1./Node::norm(vectOutput); - std::transform(vectOutput,vectOutput+2,vectOutput,bind2nd(std::multiplies(),norm)); + std::transform(vectOutput,vectOutput+2,vectOutput,bind(std::multiplies(),std::placeholders::_1,norm)); double tmp=vectOutput[0]; vectOutput[0]=vectOutput[1]; vectOutput[1]=-tmp; @@ -691,7 +691,7 @@ void Edge::Interpolate1DLin(const std::vector& distrib1, const std::vect MergePoints commonNode; for(unsigned int i=0;i::const_iterator iter=find_if(distrib2.begin()+1,distrib2.end(),bind2nd(std::greater_equal(),distrib1[i])); + std::vector::const_iterator iter=find_if(distrib2.begin()+1,distrib2.end(),bind(std::greater_equal(),std::placeholders::_1,distrib1[i])); if(iter!=distrib2.end()) { for(unsigned int j=(unsigned)((iter-1)-distrib2.begin());j(),ToIdType(INTERP_KERNEL::NORM_QUAD4)))==conn+lgth+nbOfFaces) + if(std::find_if(conn+lgth,conn+lgth+nbOfFaces,std::bind(std::not_equal_to(),std::placeholders::_1,ToIdType(INTERP_KERNEL::NORM_QUAD4)))==conn+lgth+nbOfFaces) {//6 faces are QUAD4. int oppositeFace=-1; std::set conn1(conn,conn+4); @@ -493,7 +493,7 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPyra5(const mcIdType */ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyTetra4(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth) { - if(std::find_if(conn+lgth,conn+lgth+nbOfFaces,std::bind2nd(std::not_equal_to(),ToIdType(INTERP_KERNEL::NORM_TRI3)))==conn+lgth+nbOfFaces) + if(std::find_if(conn+lgth,conn+lgth+nbOfFaces,std::bind(std::not_equal_to(),std::placeholders::_1,ToIdType(INTERP_KERNEL::NORM_TRI3)))==conn+lgth+nbOfFaces) { std::set tribase(conn,conn+3); mcIdType point=-1; diff --git a/src/INTERP_KERNEL/InterpolationUtils.hxx b/src/INTERP_KERNEL/InterpolationUtils.hxx index f429f2fd8..9308374e9 100644 --- a/src/INTERP_KERNEL/InterpolationUtils.hxx +++ b/src/INTERP_KERNEL/InterpolationUtils.hxx @@ -153,13 +153,13 @@ namespace INTERP_KERNEL double tmp[SPACEDIM]; std::transform(triIn,triIn+SPACEDIM,triIn+SPACEDIM,tmp,std::plus()); //2nd point - std::transform(tmp,tmp+SPACEDIM,quadOut+SPACEDIM,std::bind2nd(std::multiplies(),0.5)); + std::transform(tmp,tmp+SPACEDIM,quadOut+SPACEDIM,std::bind(std::multiplies(),std::placeholders::_1,0.5)); std::transform(tmp,tmp+SPACEDIM,triIn+2*SPACEDIM,tmp,std::plus()); //3rd point - std::transform(tmp,tmp+SPACEDIM,quadOut+2*SPACEDIM,std::bind2nd(std::multiplies(),1/3.)); + std::transform(tmp,tmp+SPACEDIM,quadOut+2*SPACEDIM,std::bind(std::multiplies(), std::placeholders::_1,1/3.)); //4th point std::transform(triIn,triIn+SPACEDIM,triIn+2*SPACEDIM,tmp,std::plus()); - std::transform(tmp,tmp+SPACEDIM,quadOut+3*SPACEDIM,std::bind2nd(std::multiplies(),0.5)); + std::transform(tmp,tmp+SPACEDIM,quadOut+3*SPACEDIM,std::bind(std::multiplies(), std::placeholders::_1,0.5)); } /*! @@ -176,15 +176,15 @@ namespace INTERP_KERNEL std::copy(polygIn,polygIn+SPACEDIM,polygOut); std::transform(polygIn,polygIn+SPACEDIM,polygIn+SPACEDIM,polygOut+SPACEDIM,std::plus()); //2nd point - std::transform(polygOut+SPACEDIM,polygOut+2*SPACEDIM,polygOut+SPACEDIM,std::bind2nd(std::multiplies(),0.5)); + std::transform(polygOut+SPACEDIM,polygOut+2*SPACEDIM,polygOut+SPACEDIM,std::bind(std::multiplies(), std::placeholders::_1,0.5)); double tmp[SPACEDIM]; // for(mcIdType i=0;i()); - std::transform(tmp,tmp+SPACEDIM,polygOut+(2*i+3)*SPACEDIM,std::bind2nd(std::multiplies(),0.5)); + std::transform(tmp,tmp+SPACEDIM,polygOut+(2*i+3)*SPACEDIM,std::bind(std::multiplies(), std::placeholders::_1,0.5)); std::transform(polygIn+(i+1)*SPACEDIM,polygIn+(i+2)*SPACEDIM,tmp,tmp,std::plus()); - std::transform(tmp,tmp+SPACEDIM,polygOut+(2*i+2)*SPACEDIM,std::bind2nd(std::multiplies(),1./3.)); + std::transform(tmp,tmp+SPACEDIM,polygOut+(2*i+2)*SPACEDIM,std::bind(std::multiplies(), std::placeholders::_1,1./3.)); } } @@ -371,7 +371,7 @@ namespace INTERP_KERNEL while (n<(int)SZ); } s=B[np];//s is the Pivot - std::transform(B+k*nr,B+(k+1)*nr,B+k*nr,std::bind2nd(std::divides(),s)); + std::transform(B+k*nr,B+(k+1)*nr,B+k*nr,std::bind(std::divides(), std::placeholders::_1,s)); for(j=0;j sw(3,false); double inpVect2[3]; - std::transform(inpVect,inpVect+3,inpVect2,std::ptr_fun(fabs)); + std::transform(inpVect,inpVect+3,inpVect2,[](double c) {return fabs(c);}); // std::ptr_fun(fabs) std::size_t posMin(std::distance(inpVect2,std::min_element(inpVect2,inpVect2+3))); sw[posMin]=true; std::size_t posMax(std::distance(inpVect2,std::max_element(inpVect2,inpVect2+3))); diff --git a/src/INTERP_KERNEL/VolSurfUser.cxx b/src/INTERP_KERNEL/VolSurfUser.cxx index 1e2dcaa35..f578d744a 100644 --- a/src/INTERP_KERNEL/VolSurfUser.cxx +++ b/src/INTERP_KERNEL/VolSurfUser.cxx @@ -220,7 +220,7 @@ namespace INTERP_KERNEL double baryOfNodes[3]={0.,0.,0.}; for(std::size_t i=0;i(),1./((double)nbOfEdges))); + std::transform(baryOfNodes,baryOfNodes+3,baryOfNodes,std::bind(std::multiplies(),std::placeholders::_1,1./((double)nbOfEdges))); double matrix[12]; if(!ComputeRotTranslationMatrixToPut3PointsOnOXY(coords+3*connOfPolygonBg[0],coords+3*connOfPolygonBg[1],baryOfNodes,matrix)) return std::numeric_limits::max(); diff --git a/src/INTERP_KERNEL/VolSurfUser.txx b/src/INTERP_KERNEL/VolSurfUser.txx index c84a381f2..8900e5240 100644 --- a/src/INTERP_KERNEL/VolSurfUser.txx +++ b/src/INTERP_KERNEL/VolSurfUser.txx @@ -244,7 +244,7 @@ namespace INTERP_KERNEL std::copy(coords+SPACEDIM*OTT::coo2C(connec[0]), coords+SPACEDIM*OTT::coo2C(connec[0]+1),res); std::transform(res,res+SPACEDIM,coords+SPACEDIM*OTT::coo2C(connec[1]),res,std::plus()); - std::transform(res,res+SPACEDIM,res,std::bind2nd(std::multiplies(),0.5)); + std::transform(res,res+SPACEDIM,res,std::bind(std::multiplies(),std::placeholders::_1,0.5)); break; } case NORM_SEG3: @@ -264,7 +264,7 @@ namespace INTERP_KERNEL std::copy(coords+SPACEDIM*OTT::coo2C(connec[0]), coords+SPACEDIM*OTT::coo2C(connec[0]+1),res); std::transform(res,res+SPACEDIM,coords+SPACEDIM*OTT::coo2C(connec[1]),res,std::plus()); - std::transform(res,res+SPACEDIM,res,std::bind2nd(std::multiplies(),0.5)); + std::transform(res,res+SPACEDIM,res,std::bind(std::multiplies(),std::placeholders::_1,0.5)); } else throw INTERP_KERNEL::Exception("computeBarycenter for SEG3 only SPACEDIM 1,2 or 3 supported !"); @@ -277,7 +277,7 @@ namespace INTERP_KERNEL coords+SPACEDIM*OTT::coo2C(connec[0]+1),res); std::transform(res,res+SPACEDIM,coords+SPACEDIM*OTT::coo2C(connec[1]),res,std::plus()); std::transform(res,res+SPACEDIM,coords+SPACEDIM*OTT::coo2C(connec[2]),res,std::plus()); - std::transform(res,res+SPACEDIM,res,std::bind2nd(std::multiplies(),1./3.)); + std::transform(res,res+SPACEDIM,res,std::bind(std::multiplies(),std::placeholders::_1,1./3.)); break; } case NORM_TRI6: diff --git a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx index 2ff53aaa1..345c903fa 100644 --- a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx +++ b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx @@ -883,7 +883,7 @@ DataArrayDouble *MEDCoupling1SGTUMesh::computeIsoBarycenterOfNodesPerCell() cons std::ostringstream oss; oss << "MEDCoupling1SGTUMesh::computeIsoBarycenterOfNodesPerCell : on cell #" << i << " presence of nodeId #" << *nodal << " should be in [0," << nbOfNodes << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - std::transform(ptToFill,ptToFill+spaceDim,ptToFill,std::bind2nd(std::multiplies(),coeff)); + std::transform(ptToFill,ptToFill+spaceDim,ptToFill,std::bind(std::multiplies(),std::placeholders::_1,coeff)); } return ret.retn(); } @@ -1232,7 +1232,7 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::Merge1SGTUMeshesLL(std::vectorgetNodalConnectivityLength(); const mcIdType *curC=(*it)->_conn->begin(); - cPtr=std::transform(curC,curC+curConnLgth,cPtr,std::bind2nd(std::plus(),offset)); + cPtr=std::transform(curC,curC+curConnLgth,cPtr,std::bind(std::plus(),std::placeholders::_1,offset)); offset+=(*it)->getNumberOfNodes(); } // @@ -1611,7 +1611,7 @@ void MEDCoupling1SGTUMesh::getReverseNodalConnectivity(DataArrayIdType *revNodal { for(int j=0;j(),-1))=eltId; + *std::find_if(revNodalPtr+revNodalIndxPtr[*conn],revNodalPtr+revNodalIndxPtr[*conn+1],std::bind(std::equal_to(),std::placeholders::_1,-1))=eltId; } } } @@ -2664,7 +2664,7 @@ DataArrayDouble *MEDCoupling1DGTUMesh::computeIsoBarycenterOfNodesPerCell() cons std::ostringstream oss; oss << "MEDCoupling1DGTUMesh::computeIsoBarycenterOfNodesPerCell : on cell #" << i << " presence of nodeId #" << *nodal << " should be in [0," << nbOfNodes << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - std::transform(ptToFill,ptToFill+spaceDim,ptToFill,std::bind2nd(std::multiplies(),1./double(nodali[1]-nodali[0]))); + std::transform(ptToFill,ptToFill+spaceDim,ptToFill,std::bind(std::multiplies(),std::placeholders::_1,1./double(nodali[1]-nodali[0]))); } } else @@ -2697,7 +2697,7 @@ DataArrayDouble *MEDCoupling1DGTUMesh::computeIsoBarycenterOfNodesPerCell() cons } } if(nbOfNod!=0) - std::transform(ptToFill,ptToFill+spaceDim,ptToFill,std::bind2nd(std::multiplies(),1./nbOfNod)); + std::transform(ptToFill,ptToFill+spaceDim,ptToFill,std::bind(std::multiplies(),std::placeholders::_1,1./nbOfNod)); else { std::ostringstream oss; oss << "MEDCoupling1DGTUMesh::computeIsoBarycenterOfNodesPerCell (polyhedron) : no nodes in cell #" << i << " !"; @@ -2941,7 +2941,7 @@ void MEDCoupling1DGTUMesh::getReverseNodalConnectivity(DataArrayIdType *revNodal { mcIdType nodeId=conn[conni[eltId]+j]; if(nodeId!=-1) - *std::find_if(revNodalPtr+revNodalIndxPtr[nodeId],revNodalPtr+revNodalIndxPtr[nodeId+1],std::bind2nd(std::equal_to(),-1))=eltId; + *std::find_if(revNodalPtr+revNodalIndxPtr[nodeId],revNodalPtr+revNodalIndxPtr[nodeId+1],std::bind(std::equal_to(),std::placeholders::_1,-1))=eltId; } } } diff --git a/src/MEDCoupling/MEDCouplingAMRAttribute.cxx b/src/MEDCoupling/MEDCouplingAMRAttribute.cxx index 180420336..98858cb06 100755 --- a/src/MEDCoupling/MEDCouplingAMRAttribute.cxx +++ b/src/MEDCoupling/MEDCouplingAMRAttribute.cxx @@ -486,7 +486,7 @@ void MEDCouplingGridCollection::copyOverlappedZoneFrom(mcIdType ghostLev, const std::vector deltaThis,deltaOther; std::vector< std::pair > rgThis((*it).first->positionRelativeToGodFather(deltaThis)); std::vector thisSt((*it).first->getImageMesh()->getCellGridStructure()); - std::transform(thisSt.begin(),thisSt.end(),thisSt.begin(),std::bind2nd(std::plus(),2*ghostLev)); + std::transform(thisSt.begin(),thisSt.end(),thisSt.begin(),std::bind(std::plus(),std::placeholders::_1,2*ghostLev)); for(std::vector< std::pair > >::const_iterator it2=other._map_of_dadc.begin();it2!=other._map_of_dadc.end();it2++) { std::vector< std::pair > rgOther((*it2).first->positionRelativeToGodFather(deltaOther)); @@ -499,7 +499,7 @@ void MEDCouplingGridCollection::copyOverlappedZoneFrom(mcIdType ghostLev, const std::vector otherSt((*it2).first->getImageMesh()->getCellGridStructure()); MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(pThis,ghostLev); MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(pOther,ghostLev); - std::transform(otherSt.begin(),otherSt.end(),otherSt.begin(),std::bind2nd(std::plus(),2*ghostLev)); + std::transform(otherSt.begin(),otherSt.end(),otherSt.begin(),std::bind(std::plus(),std::placeholders::_1,2*ghostLev)); mcIdType sz((*it2).second->size()); for(mcIdType i=0;igetConstPointer(); mcIdType nbOfNodes=getCoordsAt(i)->getNbOfElems(); double ref=pos[i]; - const double *w=std::find_if(d,d+nbOfNodes,std::bind2nd(std::greater_equal(),ref)); + const double *w=std::find_if(d,d+nbOfNodes,std::bind(std::greater_equal(),std::placeholders::_1,ref)); mcIdType w2=ToIdType(std::distance(d,w)); if(w2getConstPointer(),_x_array->getConstPointer()+_x_array->getNbOfElems(), - _x_array->getPointer(),std::bind2nd(std::plus(),vector[0])); + _x_array->getPointer(),std::bind(std::plus(),std::placeholders::_1,vector[0])); if(_y_array) std::transform(_y_array->getConstPointer(),_y_array->getConstPointer()+_y_array->getNbOfElems(), - _y_array->getPointer(),std::bind2nd(std::plus(),vector[1])); + _y_array->getPointer(),std::bind(std::plus(),std::placeholders::_1,vector[1])); if(_z_array) std::transform(_z_array->getConstPointer(),_z_array->getConstPointer()+_z_array->getNbOfElems(), - _z_array->getPointer(),std::bind2nd(std::plus(),vector[2])); + _z_array->getPointer(),std::bind(std::plus(),std::placeholders::_1,vector[2])); } /*! @@ -678,9 +678,9 @@ void MEDCouplingCMesh::scale(const double *point, double factor) { double *coords=c->getPointer(); mcIdType lgth=ToIdType(c->getNbOfElems()); - std::transform(coords,coords+lgth,coords,std::bind2nd(std::minus(),point[i])); - std::transform(coords,coords+lgth,coords,std::bind2nd(std::multiplies(),factor)); - std::transform(coords,coords+lgth,coords,std::bind2nd(std::plus(),point[i])); + std::transform(coords,coords+lgth,coords,std::bind(std::minus(),std::placeholders::_1,point[i])); + std::transform(coords,coords+lgth,coords,std::bind(std::multiplies(),std::placeholders::_1,factor)); + std::transform(coords,coords+lgth,coords,std::bind(std::plus(),std::placeholders::_1,point[i])); c->declareAsNew(); } } @@ -752,7 +752,7 @@ DataArrayDouble *MEDCouplingCMesh::computeCellCenterOfMass() const const double *srcPtr=tabs[j]->getConstPointer(); tabsPtr[j].insert(tabsPtr[j].end(),srcPtr,srcPtr+sz); std::transform(tabsPtr[j].begin(),tabsPtr[j].end(),srcPtr+1,tabsPtr[j].begin(),std::plus()); - std::transform(tabsPtr[j].begin(),tabsPtr[j].end(),tabsPtr[j].begin(),std::bind2nd(std::multiplies(),0.5)); + std::transform(tabsPtr[j].begin(),tabsPtr[j].end(),tabsPtr[j].begin(),std::bind(std::multiplies(),std::placeholders::_1,0.5)); } mcIdType tmp2[3]; for(int i=0;i()); std::vector< std::pair > p2RefinedAbs(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dimsP2NotRefined)); std::vector dimsP2RefinedGhost(dimsP2Refined.size()); - std::transform(dimsP2Refined.begin(),dimsP2Refined.end(),dimsP2RefinedGhost.begin(),std::bind2nd(std::plus(),2*ghostLev)); + std::transform(dimsP2Refined.begin(),dimsP2Refined.end(),dimsP2RefinedGhost.begin(),std::bind(std::plus(),std::placeholders::_1,2*ghostLev)); MCAuto fineP2(DataArrayDouble::New()); fineP2->alloc(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(dimsP2RefinedGhost),dataOnP2->getNumberOfComponents()); MEDCouplingIMesh::SpreadCoarseToFineGhost(dataOnP2,dimsP2NotRefined,fineP2,p2RefinedAbs,factors,ghostLev); if(isConservative) { mcIdType fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(factors)); - std::transform(fineP2->begin(),fineP2->end(),fineP2->getPointer(),std::bind2nd(std::multiplies(),1./((double)fact))); + std::transform(fineP2->begin(),fineP2->end(),fineP2->getPointer(),std::bind(std::multiplies(),std::placeholders::_1,1./((double)fact))); } // UpdateNeighborsOfOneWithTwoInternal(ghostLev,p1->getMesh()->getFather()->getFactors(),p1pp,p2pp,dataOnP1,fineP2); @@ -509,7 +509,7 @@ void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwoInternal(mcIdType mcIdType dim(ToIdType(factors.size())); std::vector dimsCoarse(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(p1));//[3,2] std::transform(dimsCoarse.begin(),dimsCoarse.end(),factors.begin(),dimsCoarse.begin(),std::multiplies());//[12,8] - std::transform(dimsCoarse.begin(),dimsCoarse.end(),dimsCoarse.begin(),std::bind2nd(std::plus(),2*ghostLev));//[14,10] + std::transform(dimsCoarse.begin(),dimsCoarse.end(),dimsCoarse.begin(),std::bind(std::plus(),std::placeholders::_1,2*ghostLev));//[14,10] std::vector< std::pair > rangeCoarse(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dimsCoarse));//[(0,14),(0,10)] std::vector fakeFactors(dim,1); // @@ -1215,7 +1215,7 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatch(mcIdType patchId, cons if(isConservative) { mcIdType fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors())); - std::transform(cellFieldOnPatch->begin(),cellFieldOnPatch->end(),cellFieldOnPatch->getPointer(),std::bind2nd(std::multiplies(),1./((double)fact))); + std::transform(cellFieldOnPatch->begin(),cellFieldOnPatch->end(),cellFieldOnPatch->getPointer(),std::bind(std::multiplies(),std::placeholders::_1,1./((double)fact))); } } @@ -1239,7 +1239,7 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchGhost(mcIdType patchId, if(isConservative) { mcIdType fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors())); - std::transform(cellFieldOnPatch->begin(),cellFieldOnPatch->end(),cellFieldOnPatch->getPointer(),std::bind2nd(std::multiplies(),1./((double)fact))); + std::transform(cellFieldOnPatch->begin(),cellFieldOnPatch->end(),cellFieldOnPatch->getPointer(),std::bind(std::multiplies(),std::placeholders::_1,1./((double)fact))); } } @@ -1494,7 +1494,7 @@ DataArrayDouble *MEDCouplingCartesianAMRMeshGen::extractGhostFrom(mcIdType ghost { std::vector st(_mesh->getCellGridStructure()); std::vector< std::pair > p(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(st)); - std::transform(st.begin(),st.end(),st.begin(),std::bind2nd(std::plus(),2*ghostSz)); + std::transform(st.begin(),st.end(),st.begin(),std::bind(std::plus(),std::placeholders::_1,2*ghostSz)); MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(p,ghostSz); MCAuto ret(MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,arr,p)); return ret.retn(); diff --git a/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx b/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx index d33914551..f2ef17b8b 100755 --- a/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx @@ -686,7 +686,7 @@ void MEDCouplingCurveLinearMesh::scale(const double *point, double factor) for(mcIdType i=0;i()); - std::transform(coords+i*dim,coords+(i+1)*dim,coords+i*dim,std::bind2nd(std::multiplies(),factor)); + std::transform(coords+i*dim,coords+(i+1)*dim,coords+i*dim,std::bind(std::multiplies(),std::placeholders::_1,factor)); std::transform(coords+i*dim,coords+(i+1)*dim,point,coords+i*dim,std::plus()); } _coords->declareAsNew(); @@ -790,7 +790,7 @@ void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim1(DataArrayDouble * { int spaceDim=getSpaceDimension(); std::transform(_coords->begin()+spaceDim,_coords->end(),_coords->begin(),bary->getPointer(),std::plus()); - std::transform(bary->begin(),bary->end(),bary->getPointer(),std::bind2nd(std::multiplies(),0.5)); + std::transform(bary->begin(),bary->end(),bary->getPointer(),std::bind(std::multiplies(),std::placeholders::_1,0.5)); } void MEDCouplingCurveLinearMesh::renumberCells(const mcIdType * /*old2NewBg*/, bool /*check*/) diff --git a/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx b/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx index b858903c6..5bdd8d1be 100755 --- a/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx @@ -251,7 +251,7 @@ void MEDCouplingFieldDiscretization::normL1(const MEDCouplingMesh *mesh, const D res[j]+=fabs(arrPtr[i*nbOfCompo+j])*v; deno+=v; } - std::transform(res,res+nbOfCompo,res,std::bind2nd(std::multiplies(),1./deno)); + std::transform(res,res+nbOfCompo,res,std::bind(std::multiplies(),std::placeholders::_1,1./deno)); } /*! @@ -275,8 +275,8 @@ void MEDCouplingFieldDiscretization::normL2(const MEDCouplingMesh *mesh, const D res[j]+=arrPtr[i*nbOfCompo+j]*arrPtr[i*nbOfCompo+j]*v; deno+=v; } - std::transform(res,res+nbOfCompo,res,std::bind2nd(std::multiplies(),1./deno)); - std::transform(res,res+nbOfCompo,res,std::ptr_fun(std::sqrt)); + std::transform(res,res+nbOfCompo,res,std::bind(std::multiplies(),std::placeholders::_1,1./deno)); + std::transform(res,res+nbOfCompo,res, [](double c) {return sqrt(c); });//std::ptr_fun(std::sqrt) } /*! @@ -304,7 +304,7 @@ void MEDCouplingFieldDiscretization::integral(const MEDCouplingMesh *mesh, const INTERP_KERNEL::AutoPtr tmp=new double[nbOfCompo]; for(mcIdType i=0;i(),volPtr[i])); + std::transform(arrPtr+i*nbOfCompo,arrPtr+(i+1)*nbOfCompo,(double *)tmp,std::bind(std::multiplies(),std::placeholders::_1,volPtr[i])); std::transform((double *)tmp,(double *)tmp+nbOfCompo,res,res,std::plus()); } } @@ -446,13 +446,13 @@ void MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr(double eps, cons mcIdType newNb=old2NewPtr[i]; if(newNb>=0)//if newNb<0 the node is considered as out. { - if(std::find_if(ptToFill+newNb*nbOfComp,ptToFill+(newNb+1)*nbOfComp,std::bind2nd(std::not_equal_to(),std::numeric_limits::max())) + if(std::find_if(ptToFill+newNb*nbOfComp,ptToFill+(newNb+1)*nbOfComp,std::bind(std::not_equal_to(),std::placeholders::_1,std::numeric_limits::max())) ==ptToFill+(newNb+1)*nbOfComp) std::copy(ptSrc+i*nbOfComp,ptSrc+(i+1)*nbOfComp,ptToFill+newNb*nbOfComp); else { std::transform(ptSrc+i*nbOfComp,ptSrc+(i+1)*nbOfComp,ptToFill+newNb*nbOfComp,(double *)tmp,std::minus()); - std::transform((double *)tmp,((double *)tmp)+nbOfComp,(double *)tmp,std::ptr_fun(fabs)); + std::transform((double *)tmp,((double *)tmp)+nbOfComp,(double *)tmp, [](double c) {return fabs(c); }); //std::ptr_fun(fabs) //if(!std::equal(ptSrc+i*nbOfComp,ptSrc+(i+1)*nbOfComp,ptToFill+newNb*nbOfComp)) if(*std::max_element((double *)tmp,((double *)tmp)+nbOfComp)>eps) { @@ -1071,7 +1071,7 @@ void MEDCouplingFieldDiscretizationP1::getValueInCell(const MEDCouplingMesh *mes for(std::size_t i=0;igetTuple(conn[i],(double *)tmp2); - std::transform((double *)tmp2,((double *)tmp2)+sz,(double *)tmp2,std::bind2nd(std::multiplies(),tmp[i])); + std::transform((double *)tmp2,((double *)tmp2)+sz,(double *)tmp2,std::bind(std::multiplies(),std::placeholders::_1,tmp[i])); std::transform(res,res+sz,(double *)tmp2,res,std::plus()); } } @@ -1755,7 +1755,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationGauss::getMeasureField(con mcIdType nbOfGaussPt=loc.getNumberOfGaussPt(); INTERP_KERNEL::AutoPtr weights=new double[nbOfGaussPt]; double sum=std::accumulate(loc.getWeights().begin(),loc.getWeights().end(),0.); - std::transform(loc.getWeights().begin(),loc.getWeights().end(),(double *)weights,std::bind2nd(std::multiplies(),1./sum)); + std::transform(loc.getWeights().begin(),loc.getWeights().end(),(double *)weights,std::bind(std::multiplies(),std::placeholders::_1,1./sum)); for(const mcIdType *cellId=curIds->begin();cellId!=curIds->end();cellId++) for(mcIdType j=0;j wArr2=new double[wArrSz]; double sum=std::accumulate(wArr,wArr+wArrSz,0.); - std::transform(wArr,wArr+wArrSz,(double *)wArr2,std::bind2nd(std::multiplies(),1./sum)); + std::transform(wArr,wArr+wArrSz,(double *)wArr2,std::bind(std::multiplies(),std::placeholders::_1,1./sum)); MCAuto ids=mesh->giveCellsWithType(*it); MCAuto ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell); const mcIdType *ptIds2=ids2->begin(),*ptIds=ids->begin(); @@ -2704,7 +2704,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationGaussNE::getMeasureField(c const double *wArr=GetWeightArrayFromGeometricType(*it,wArrSz); INTERP_KERNEL::AutoPtr wArr2=new double[wArrSz]; double sum=std::accumulate(wArr,wArr+wArrSz,0.); - std::transform(wArr,wArr+wArrSz,(double *)wArr2,std::bind2nd(std::multiplies(),1./sum)); + std::transform(wArr,wArr+wArrSz,(double *)wArr2,std::bind(std::multiplies(),std::placeholders::_1,1./sum)); MCAuto ids=mesh->giveCellsWithType(*it); MCAuto ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell); const mcIdType *ptIds2=ids2->begin(),*ptIds=ids->begin(); diff --git a/src/MEDCoupling/MEDCouplingFieldDouble.cxx b/src/MEDCoupling/MEDCouplingFieldDouble.cxx index 260b101d2..76a632d2a 100755 --- a/src/MEDCoupling/MEDCouplingFieldDouble.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDouble.cxx @@ -233,7 +233,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::nodeToCellDiscretization() const for(std::size_t k=0;k()); if(nbNodesInCell!=0) - std::transform(pt,pt+nbCompo,pt,std::bind2nd(std::multiplies(),1./((double)nbNodesInCell))); + std::transform(pt,pt+nbCompo,pt,std::bind(std::multiplies(), std::placeholders::_1, 1./((double)nbNodesInCell))); else { std::ostringstream oss; oss << "MEDCouplingFieldDouble::nodeToCellDiscretization : Cell id #" << i << " has been detected to have no nodes !"; @@ -706,7 +706,7 @@ void MEDCouplingFieldDouble::getWeightedAverageValue(double *res, bool isWAbs) c arr->multiplyEqual(w->getArray()); arr->accumulate(res); std::size_t nCompo = getArray()->getNumberOfComponents(); - std::transform(res,res+nCompo,res,std::bind2nd(std::multiplies(),1./deno)); + std::transform(res, res + nCompo, res, std::bind(std::multiplies(), std::placeholders::_1, 1. / deno)); } /*! diff --git a/src/MEDCoupling/MEDCouplingGaussLocalization.cxx b/src/MEDCoupling/MEDCouplingGaussLocalization.cxx index 145e35cf1..da473994d 100644 --- a/src/MEDCoupling/MEDCouplingGaussLocalization.cxx +++ b/src/MEDCoupling/MEDCouplingGaussLocalization.cxx @@ -324,6 +324,6 @@ bool MEDCouplingGaussLocalization::AreAlmostEqual(const std::vector& v1, return false; std::vector tmp(sz); std::transform(v1.begin(),v1.end(),v2.begin(),tmp.begin(),std::minus()); - std::transform(tmp.begin(),tmp.end(),tmp.begin(),std::ptr_fun(fabs)); + std::transform(tmp.begin(),tmp.end(),tmp.begin(), [](double c) {return fabs(c); }); //std::ptr_fun(fabs) return *std::max_element(tmp.begin(),tmp.end())& co throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarseGhost : All input vectors (dimension) must have the same size !"); if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarseGhost : the parameters 1 or 3 are NULL or not allocated !"); - std::vector coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); + std::vector coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind(std::plus(),std::placeholders::_1,2*ghostSize)); std::size_t meshDim(coarseSt.size()); mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); std::size_t nbCompo(fineDA->getNumberOfComponents()); @@ -433,7 +433,7 @@ void MEDCouplingIMesh::CondenseFineToCoarseGhost(const std::vector& co // std::vector fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies()); - std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); + std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind(std::plus(),std::placeholders::_1,2*ghostSize)); mcIdType nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); if(fineDA->getNumberOfTuples()!=nbTuplesFineExp) { @@ -654,7 +654,7 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhost : All input vectors (dimension) must have the same size !"); if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhost : the parameters 1 or 3 are NULL or not allocated !"); - std::vector coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); + std::vector coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind(std::plus(),std::placeholders::_1,2*ghostSize)); std::size_t meshDim(coarseSt.size()); mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); std::size_t nbCompo=fineDA->getNumberOfComponents(); @@ -670,7 +670,7 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, // std::vector fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies()); - std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); + std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind(std::plus(),std::placeholders::_1,2*ghostSize)); mcIdType nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); if(fineDA->getNumberOfTuples()!=nbTuplesFineExp) { @@ -747,7 +747,7 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhostZone(const DataArrayDouble *coarse throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhostZone : All input vectors (dimension) must have the same size !"); if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhostZone : the parameters 1 or 3 are NULL or not allocated !"); - std::vector coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); + std::vector coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind(std::plus(),std::placeholders::_1,2*ghostSize)); std::size_t meshDim(coarseSt.size()); mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); std::size_t nbCompo=fineDA->getNumberOfComponents(); @@ -763,7 +763,7 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhostZone(const DataArrayDouble *coarse // std::vector fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies()); - std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); + std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind(std::plus(),std::placeholders::_1,2*ghostSize)); mcIdType nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); if(fineDA->getNumberOfTuples()!=nbTuplesFineExp) { @@ -1164,8 +1164,8 @@ void MEDCouplingIMesh::scale(const double *point, double factor) checkSpaceDimension(); int dim(getSpaceDimension()); std::transform(_origin,_origin+dim,point,_origin,std::minus()); - std::transform(_origin,_origin+dim,_origin,std::bind2nd(std::multiplies(),factor)); - std::transform(_dxyz,_dxyz+dim,_dxyz,std::bind2nd(std::multiplies(),factor)); + std::transform(_origin,_origin+dim,_origin,std::bind(std::multiplies(),std::placeholders::_1,factor)); + std::transform(_dxyz,_dxyz+dim,_dxyz,std::bind(std::multiplies(),std::placeholders::_1,factor)); std::transform(_origin,_origin+dim,point,_origin,std::plus()); declareAsNew(); } @@ -1219,7 +1219,7 @@ DataArrayDouble *MEDCouplingIMesh::computeCellCenterOfMass() const mcIdType nbCells(ToIdType(getNumberOfCells())),tmp[3],tmp2[3]; ret->alloc(nbCells,spaceDim); double *pt(ret->getPointer()),shiftOrigin[3]; - std::transform(_dxyz,_dxyz+spaceDim,shiftOrigin,std::bind2nd(std::multiplies(),0.5)); + std::transform(_dxyz,_dxyz+spaceDim,shiftOrigin,std::bind(std::multiplies(),std::placeholders::_1,0.5)); std::transform(_origin,_origin+spaceDim,shiftOrigin,shiftOrigin,std::plus()); getSplitCellValues(tmp); ret->setInfoOnComponents(buildInfoOnComponents()); diff --git a/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx index 69bafba04..44be0a232 100644 --- a/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx +++ b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx @@ -285,7 +285,7 @@ DataArrayIdType *MEDCouplingMappedExtrudedMesh::giveCellsWithType(INTERP_KERNEL: ret->alloc(nbOfLevs*nbOfTuples,1); mcIdType *pt(ret->getPointer()); for(int i=0;ibegin(),tmp->end(),pt,std::bind2nd(std::plus(),i*nbOfCells2D)); + std::transform(tmp->begin(),tmp->end(),pt,std::bind(std::plus(),std::placeholders::_1,i*nbOfCells2D)); MCAuto ret2(ret->renumberR(_mesh3D_ids->begin())); ret2->sort(); return ret2.retn(); @@ -344,8 +344,8 @@ void MEDCouplingMappedExtrudedMesh::getNodeIdsOfCell(mcIdType cellId, std::vecto std::vector tmp,tmp2; _mesh2D->getNodeIdsOfCell(locId,tmp); tmp2=tmp; - std::transform(tmp.begin(),tmp.end(),tmp.begin(),std::bind2nd(std::plus(),nbOfNodes2D*lev)); - std::transform(tmp2.begin(),tmp2.end(),tmp2.begin(),std::bind2nd(std::plus(),nbOfNodes2D*(lev+1))); + std::transform(tmp.begin(),tmp.end(),tmp.begin(),std::bind(std::plus(),std::placeholders::_1,nbOfNodes2D*lev)); + std::transform(tmp2.begin(),tmp2.end(),tmp2.begin(),std::bind(std::plus(),std::placeholders::_1,nbOfNodes2D*(lev+1))); conn.insert(conn.end(),tmp.begin(),tmp.end()); conn.insert(conn.end(),tmp2.begin(),tmp2.end()); } @@ -624,7 +624,7 @@ void MEDCouplingMappedExtrudedMesh::computeBaryCenterOfFace(const std::vectorgetCoords()->begin()); for(std::vector::const_iterator iter=nodalConnec.begin();iter!=nodalConnec.end();iter++) std::transform(zoneToUpdate,zoneToUpdate+3,coords+3*(*iter),zoneToUpdate,std::plus()); - std::transform(zoneToUpdate,zoneToUpdate+3,zoneToUpdate,std::bind2nd(std::multiplies(),(1./(double)nodalConnec.size()))); + std::transform(zoneToUpdate,zoneToUpdate+3,zoneToUpdate,std::bind(std::multiplies(),std::placeholders::_1,(1./(double)nodalConnec.size()))); } mcIdType MEDCouplingMappedExtrudedMesh::FindCorrespCellByNodalConn(const std::vector& nodalConnec, const mcIdType *revNodalPtr, const mcIdType *revNodalIndxPtr) @@ -677,7 +677,7 @@ void MEDCouplingMappedExtrudedMesh::Project1DMeshes(const MEDCouplingUMesh *m1, m1->getCoordinatesOfNode(c[1],ref2); std::transform(ref2.begin(),ref2.end(),ref.begin(),v,std::minus()); double n=INTERP_KERNEL::norm<3>(v); - std::transform(v,v+3,v,std::bind2nd(std::multiplies(),1/n)); + std::transform(v,v+3,v,std::bind(std::multiplies(),std::placeholders::_1,1/n)); m1->project1D(&ref[0],v,eps,m1r->getCoords()->getPointer()); m2->project1D(&ref[0],v,eps,m2r->getCoords()->getPointer()); } diff --git a/src/MEDCoupling/MEDCouplingMemArray.cxx b/src/MEDCoupling/MEDCouplingMemArray.cxx index 4b7fd907d..eb4b152c4 100755 --- a/src/MEDCoupling/MEDCouplingMemArray.cxx +++ b/src/MEDCoupling/MEDCouplingMemArray.cxx @@ -2011,13 +2011,13 @@ DataArrayDouble *DataArrayDouble::fromCartToCylGiven(const DataArrayDouble *coor throw INTERP_KERNEL::Exception("DataArrayDouble::fromCartToCylGiven : magnitude of vect is too low !"); double Ur[3],Uteta[3],Uz[3],*retPtr(ret->getPointer()); const double *coo(coords->begin()),*vectField(begin()); - std::transform(vect,vect+3,Uz,std::bind2nd(std::multiplies(),1./magOfVect)); + std::transform(vect,vect+3,Uz,std::bind(std::multiplies(),std::placeholders::_1,1./magOfVect)); for(mcIdType i=0;i()); Uteta[0]=Uz[1]*Ur[2]-Uz[2]*Ur[1]; Uteta[1]=Uz[2]*Ur[0]-Uz[0]*Ur[2]; Uteta[2]=Uz[0]*Ur[1]-Uz[1]*Ur[0]; double magOfTeta(sqrt(Uteta[0]*Uteta[0]+Uteta[1]*Uteta[1]+Uteta[2]*Uteta[2])); - std::transform(Uteta,Uteta+3,Uteta,std::bind2nd(std::multiplies(),1./magOfTeta)); + std::transform(Uteta,Uteta+3,Uteta,std::bind(std::multiplies(),std::placeholders::_1,1./magOfTeta)); Ur[0]=Uteta[1]*Uz[2]-Uteta[2]*Uz[1]; Ur[1]=Uteta[2]*Uz[0]-Uteta[0]*Uz[2]; Ur[2]=Uteta[0]*Uz[1]-Uteta[1]*Uz[0]; retPtr[0]=Ur[0]*vectField[0]+Ur[1]*vectField[1]+Ur[2]*vectField[2]; retPtr[1]=Uteta[0]*vectField[0]+Uteta[1]*vectField[1]+Uteta[2]*vectField[2]; @@ -3464,18 +3464,18 @@ void DataArrayDouble::Rotate3DAlg(const double *center, const double *vect, doub double norm(sqrt(vect[0]*vect[0]+vect[1]*vect[1]+vect[2]*vect[2])); if(norm::min()) throw INTERP_KERNEL::Exception("DataArrayDouble::Rotate3DAlg : magnitude of input vector is too close of 0. !"); - std::transform(vect,vect+3,vectorNorm,std::bind2nd(std::multiplies(),1/norm)); + std::transform(vect,vect+3,vectorNorm,std::bind(std::multiplies(),std::placeholders::_1,1/norm)); //rotation matrix computation matrix[0]=cosa; matrix[1]=0.; matrix[2]=0.; matrix[3]=0.; matrix[4]=cosa; matrix[5]=0.; matrix[6]=0.; matrix[7]=0.; matrix[8]=cosa; matrixTmp[0]=vectorNorm[0]*vectorNorm[0]; matrixTmp[1]=vectorNorm[0]*vectorNorm[1]; matrixTmp[2]=vectorNorm[0]*vectorNorm[2]; matrixTmp[3]=vectorNorm[1]*vectorNorm[0]; matrixTmp[4]=vectorNorm[1]*vectorNorm[1]; matrixTmp[5]=vectorNorm[1]*vectorNorm[2]; matrixTmp[6]=vectorNorm[2]*vectorNorm[0]; matrixTmp[7]=vectorNorm[2]*vectorNorm[1]; matrixTmp[8]=vectorNorm[2]*vectorNorm[2]; - std::transform(matrixTmp,matrixTmp+9,matrixTmp,std::bind2nd(std::multiplies(),1-cosa)); + std::transform(matrixTmp,matrixTmp+9,matrixTmp,std::bind(std::multiplies(),std::placeholders::_1,1-cosa)); std::transform(matrix,matrix+9,matrixTmp,matrix,std::plus()); matrixTmp[0]=0.; matrixTmp[1]=-vectorNorm[2]; matrixTmp[2]=vectorNorm[1]; matrixTmp[3]=vectorNorm[2]; matrixTmp[4]=0.; matrixTmp[5]=-vectorNorm[0]; matrixTmp[6]=-vectorNorm[1]; matrixTmp[7]=vectorNorm[0]; matrixTmp[8]=0.; - std::transform(matrixTmp,matrixTmp+9,matrixTmp,std::bind2nd(std::multiplies(),sina)); + std::transform(matrixTmp,matrixTmp+9,matrixTmp,std::bind(std::multiplies(),std::placeholders::_1,sina)); std::transform(matrix,matrix+9,matrixTmp,matrix,std::plus()); //rotation matrix computed. double tmp[3]; diff --git a/src/MEDCoupling/MEDCouplingMemArray.txx b/src/MEDCoupling/MEDCouplingMemArray.txx index dbccfc92a..b9bb8cc6a 100755 --- a/src/MEDCoupling/MEDCouplingMemArray.txx +++ b/src/MEDCoupling/MEDCouplingMemArray.txx @@ -2713,7 +2713,7 @@ namespace MEDCoupling T *ptr(this->getPointer()); const T *ptrc(other->begin()); for(mcIdType i=0;ibegin()),*a1Ptr(a1->begin()); T *res(ret->getPointer()); for(mcIdType i=0;icopyStringInfoFrom(*a1); return ret.retn(); } @@ -2987,7 +2987,7 @@ namespace MEDCoupling const T *aMaxPtr(aMax->begin()); T *res=ret->getPointer(); for(mcIdType i=0;icopyStringInfoFrom(*aMax); } else @@ -3403,7 +3403,7 @@ struct NotInRange this->checkAllocated(); T *ptr(this->getPointer()); std::size_t nbOfElems(this->getNbOfElems()); - std::transform(ptr,ptr+nbOfElems,ptr,std::ptr_fun(std::abs)); + std::transform(ptr,ptr+nbOfElems,ptr, [](T c) {return std::abs(c);}); //std::ptr_fun(std::abs) this->declareAsNew(); } @@ -3426,7 +3426,7 @@ struct NotInRange mcIdType nbOfTuples(this->getNumberOfTuples()); std::size_t nbOfComp(this->getNumberOfComponents()); newArr->alloc(nbOfTuples,nbOfComp); - std::transform(this->begin(),this->end(),newArr->getPointer(),std::ptr_fun(std::abs)); + std::transform(this->begin(),this->end(),newArr->getPointer(),[](T c) {return std::abs(c);}); //std::ptr_fun(std::abs) newArr->copyStringInfoFrom(*this); return newArr.retn(); } @@ -4342,7 +4342,7 @@ struct NotInRange std::set castsDetected; for(mcIdType i=0;i(), work[i])); + rintstart res=std::find_if(bg,end2,std::bind(std::less_equal(),std::placeholders::_1, work[i])); std::size_t pos=std::distance(bg,res); std::size_t pos2=nbOfCast-pos; if(pos2checkAllocated(); T *ptr=this->getPointer(); std::size_t nbOfElems=this->getNbOfElems(); - std::transform(ptr,ptr+nbOfElems,ptr,std::bind2nd(std::divides(),val)); + std::transform(ptr,ptr+nbOfElems,ptr,std::bind(std::divides(),std::placeholders::_1,val)); this->declareAsNew(); } @@ -5416,7 +5416,7 @@ struct NotInRange this->checkAllocated(); T *ptr=this->getPointer(); std::size_t nbOfElems=this->getNbOfElems(); - std::transform(ptr,ptr+nbOfElems,ptr,std::bind2nd(std::modulus(),val)); + std::transform(ptr,ptr+nbOfElems,ptr,std::bind(std::modulus(),std::placeholders::_1,val)); this->declareAsNew(); } @@ -6465,7 +6465,7 @@ struct NotInRange T *ptr=this->getPointer(); const T *ptrc=other->getConstPointer(); for(mcIdType i=0;i(),*ptrc++)); + std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptr+i*nbOfComp,std::bind(std::modulus(),std::placeholders::_1,*ptrc++)); } else throw INTERP_KERNEL::Exception(msg); @@ -6706,7 +6706,7 @@ struct NotInRange const T *a1Ptr=a1->getConstPointer(); T *res=ret->getPointer(); for(mcIdType i=0;i(),a2Ptr[i])); + res=std::transform(a1Ptr+i*nbOfComp1,a1Ptr+(i+1)*nbOfComp1,res,std::bind(std::modulus(),std::placeholders::_1,a2Ptr[i])); ret->copyStringInfoFrom(*a1); return ret.retn(); } @@ -7020,7 +7020,7 @@ struct NotInRange ret->alloc(retSz,1); T *pt=ret->getPointer(); *pt++=0; for(typename std::vector::const_iterator it=arrs.begin();it!=arrs.end();it++) - pt=std::transform((*it)->begin()+1,(*it)->end(),pt,std::bind2nd(std::plus(),pt[-1])); + pt=std::transform((*it)->begin()+1,(*it)->end(),pt,std::bind(std::plus(),std::placeholders::_1,pt[-1])); ret->copyStringInfoFrom(*(arrs[0])); return ret.retn(); } diff --git a/src/MEDCoupling/MEDCouplingPartDefinition.cxx b/src/MEDCoupling/MEDCouplingPartDefinition.cxx index fa9304642..d91822e5a 100644 --- a/src/MEDCoupling/MEDCouplingPartDefinition.cxx +++ b/src/MEDCoupling/MEDCouplingPartDefinition.cxx @@ -151,7 +151,7 @@ PartDefinition *DataArrayPartDefinition::composeWith(const PartDefinition *other { MCAuto arr(DataArrayIdType::New()); arr->alloc(_arr->getNumberOfTuples(),1); - std::transform(_arr->begin(),_arr->end(),arr->getPointer(),std::bind2nd(std::plus(),a)); + std::transform(_arr->begin(),_arr->end(),arr->getPointer(),std::bind(std::plus(),std::placeholders::_1,a)); return DataArrayPartDefinition::New(arr); } } diff --git a/src/MEDCoupling/MEDCouplingPointSet.cxx b/src/MEDCoupling/MEDCouplingPointSet.cxx index a80603925..1d7455ba4 100755 --- a/src/MEDCoupling/MEDCouplingPointSet.cxx +++ b/src/MEDCoupling/MEDCouplingPointSet.cxx @@ -444,7 +444,7 @@ void MEDCouplingPointSet::renumberNodesCenter(const mcIdType *newNodeNumbers, mc div[newNodeNumbers[i]]++; } for(mcIdType i=0;i(),1./(double)div[i])); + ptToFill=std::transform(ptToFill,ptToFill+spaceDim,ptToFill,std::bind(std::multiplies(),std::placeholders::_1,1./(double)div[i])); setCoords(newCoords); newCoords->decrRef(); renumberNodesInConn(newNodeNumbers); @@ -608,7 +608,7 @@ void MEDCouplingPointSet::scale(const double *point, double factor) for(mcIdType i=0;i()); - std::transform(coords+i*dim,coords+(i+1)*dim,coords+i*dim,std::bind2nd(std::multiplies(),factor)); + std::transform(coords+i*dim,coords+(i+1)*dim,coords+i*dim,std::bind(std::multiplies(),std::placeholders::_1,factor)); std::transform(coords+i*dim,coords+(i+1)*dim,point,coords+i*dim,std::plus()); } _coords->declareAsNew(); @@ -1220,7 +1220,7 @@ bool MEDCouplingPointSet::areCellsFrom2MeshEqual(const MEDCouplingPointSet *othe getCoordinatesOfNode(c1[0],n1); other->getCoordinatesOfNode(c2[0],n2); std::transform(n1.begin(),n1.end(),n2.begin(),n1.begin(),std::minus()); - std::transform(n1.begin(),n1.end(),n1.begin(),std::ptr_fun(fabs)); + std::transform(n1.begin(),n1.end(),n1.begin(), [](double c) {return fabs(c); }); //std::ptr_fun(fabs if(*std::max_element(n1.begin(),n1.end())>prec) return false; } @@ -1263,7 +1263,7 @@ void MEDCouplingPointSet::tryToShareSameCoordsPermute(const MEDCouplingPointSet& throw INTERP_KERNEL::Exception("MEDCouplingPointSet::tryToShareSameCoordsPermute fails : no nodes are mergeable with specified given epsilon !"); } mcIdType maxId=*std::max_element(da->getConstPointer(),da->getConstPointer()+otherNbOfNodes); - const mcIdType *pt=std::find_if(da->getConstPointer()+otherNbOfNodes,da->getConstPointer()+da->getNbOfElems(),std::bind2nd(std::greater(),maxId)); + const mcIdType *pt=std::find_if(da->getConstPointer()+otherNbOfNodes,da->getConstPointer()+da->getNbOfElems(),std::bind(std::greater(),std::placeholders::_1,maxId)); if(pt!=da->getConstPointer()+da->getNbOfElems()) { setCoords(oldCoords); @@ -1425,7 +1425,7 @@ void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int //mergeNodes if(!areNodesMerged && oldNbOfNodes != 0) throw INTERP_KERNEL::Exception("checkDeepEquivalWith : Nodes are incompatible ! "); - const mcIdType *pt=std::find_if(da->getConstPointer()+oldNbOfNodes,da->getConstPointer()+da->getNbOfElems(),std::bind2nd(std::greater(),oldNbOfNodes-1)); + const mcIdType *pt=std::find_if(da->getConstPointer()+oldNbOfNodes,da->getConstPointer()+da->getNbOfElems(),std::bind(std::greater(),std::placeholders::_1,oldNbOfNodes-1)); if(pt!=da->getConstPointer()+da->getNbOfElems()) throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some nodes in other are not in this !"); m->renumberNodes(da->getConstPointer(),newNbOfNodes); @@ -1488,7 +1488,7 @@ void MEDCouplingPointSet::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh MCAuto m=mergeMyselfWithOnSameCoords(otherC); MCAuto da=m->zipConnectivityTraducer(cellCompPol); mcIdType maxId=*std::max_element(da->getConstPointer(),da->getConstPointer()+getNumberOfCells()); - const mcIdType *pt=std::find_if(da->getConstPointer()+getNumberOfCells(),da->getConstPointer()+da->getNbOfElems(),std::bind2nd(std::greater(),maxId)); + const mcIdType *pt=std::find_if(da->getConstPointer()+getNumberOfCells(),da->getConstPointer()+da->getNbOfElems(),std::bind(std::greater(),std::placeholders::_1,maxId)); if(pt!=da->getConstPointer()+da->getNbOfElems()) { throw INTERP_KERNEL::Exception("checkDeepEquivalOnSameNodesWith : some cells in other are not in this !"); diff --git a/src/MEDCoupling/MEDCouplingRemapper.cxx b/src/MEDCoupling/MEDCouplingRemapper.cxx index f0fd8df51..e1f801acf 100755 --- a/src/MEDCoupling/MEDCouplingRemapper.cxx +++ b/src/MEDCoupling/MEDCouplingRemapper.cxx @@ -1233,7 +1233,7 @@ void MEDCouplingRemapper::computeProduct(const double *inputPointer, int inputNb std::map::const_iterator iter3=_deno_multiply[idx].begin(); for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++,iter3++) { - std::transform(inputPointer+(*iter2).first*inputNbOfCompo,inputPointer+((*iter2).first+1)*inputNbOfCompo,tmp,std::bind2nd(std::multiplies(),(*iter2).second/(*iter3).second)); + std::transform(inputPointer+(*iter2).first*inputNbOfCompo,inputPointer+((*iter2).first+1)*inputNbOfCompo,tmp,std::bind(std::multiplies(),std::placeholders::_1,(*iter2).second/(*iter3).second)); std::transform(tmp,tmp+inputNbOfCompo,resPointer+idx*inputNbOfCompo,resPointer+idx*inputNbOfCompo,std::plus()); } } @@ -1251,7 +1251,7 @@ void MEDCouplingRemapper::computeReverseProduct(const double *inputPointer, int for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) { isReached[(*iter2).first]=true; - std::transform(inputPointer+idx*inputNbOfCompo,inputPointer+(idx+1)*inputNbOfCompo,tmp,std::bind2nd(std::multiplies(),(*iter2).second/_deno_reverse_multiply[(*iter2).first][idx])); + std::transform(inputPointer+idx*inputNbOfCompo,inputPointer+(idx+1)*inputNbOfCompo,tmp,std::bind(std::multiplies(),std::placeholders::_1,(*iter2).second/_deno_reverse_multiply[(*iter2).first][idx])); std::transform(tmp,tmp+inputNbOfCompo,resPointer+((*iter2).first)*inputNbOfCompo,resPointer+((*iter2).first)*inputNbOfCompo,std::plus()); } } diff --git a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx index 4a81b7376..5a6fc6f9b 100755 --- a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx +++ b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx @@ -1331,7 +1331,7 @@ void MEDCouplingStructuredMesh::GetPosFromId(mcIdType eltId, int meshDim, const std::vector MEDCouplingStructuredMesh::getCellGridStructure() const { std::vector ret(getNodeGridStructure()); - std::transform(ret.begin(),ret.end(),ret.begin(),std::bind2nd(std::plus(),-1)); + std::transform(ret.begin(),ret.end(),ret.begin(),std::bind(std::plus(),std::placeholders::_1,-1)); return ret; } @@ -1999,7 +1999,7 @@ void MEDCouplingStructuredMesh::MultiplyPartOf(const std::vector& st, for(mcIdType k=0;k(),factor)); + std::transform(pt+nbCompo*offset,pt+nbCompo*(offset+1),pt+nbCompo*offset,std::bind(std::multiplies(),std::placeholders::_1,factor)); } } } @@ -2013,7 +2013,7 @@ void MEDCouplingStructuredMesh::MultiplyPartOf(const std::vector& st, for(mcIdType k=0;k(),factor)); + std::transform(pt+nbCompo*offset,pt+nbCompo*(offset+1),pt+nbCompo*offset,std::bind(std::multiplies(),std::placeholders::_1,factor)); } } break; @@ -2023,7 +2023,7 @@ void MEDCouplingStructuredMesh::MultiplyPartOf(const std::vector& st, for(mcIdType k=0;k(),factor)); + std::transform(pt+nbCompo*offset,pt+nbCompo*(offset+1),pt+nbCompo*offset,std::bind(std::multiplies(),std::placeholders::_1,factor)); } break; } @@ -2073,7 +2073,7 @@ void MEDCouplingStructuredMesh::PutInGhostFormat(mcIdType ghostSize, const std:: if(part[i].first<0 || part[i].first>part[i].second || part[i].second>st[i]) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::PutInGhostFormat : the specified part is invalid ! The begin must be >= 0 and <= end ! The end must be <= to the size at considered dimension !"); stWithGhost.resize(st.size()); - std::transform(st.begin(),st.end(),stWithGhost.begin(),std::bind2nd(std::plus(),2*ghostSize)); + std::transform(st.begin(),st.end(),stWithGhost.begin(),std::bind(std::plus(),std::placeholders::_1,2*ghostSize)); partWithGhost=part; ApplyGhostOnCompactFrmt(partWithGhost,ghostSize); } diff --git a/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx b/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx index 5dc6547ab..67dce78d9 100644 --- a/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx +++ b/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx @@ -2481,9 +2481,9 @@ void MEDCouplingLinearTime::getValueForTime(double time, const std::vector(),alpha)); + std::transform(vals.begin(),vals.begin()+nbComp,res,std::bind(std::multiplies(),std::placeholders::_1,alpha)); std::vector tmp(nbComp); - std::transform(vals.begin()+nbComp,vals.end(),tmp.begin(),std::bind2nd(std::multiplies(),1-alpha)); + std::transform(vals.begin()+nbComp,vals.end(),tmp.begin(),std::bind(std::multiplies(),std::placeholders::_1,1-alpha)); std::transform(tmp.begin(),tmp.end(),res,res,std::plus()); } @@ -2495,13 +2495,13 @@ void MEDCouplingLinearTime::getValueOnTime(mcIdType eltId, double time, double * else throw INTERP_KERNEL::Exception("No start array existing."); std::size_t nbComp=_array->getNumberOfComponents(); - std::transform(value,value+nbComp,value,std::bind2nd(std::multiplies(),alpha)); + std::transform(value,value+nbComp,value,std::bind(std::multiplies(),std::placeholders::_1,alpha)); std::vector tmp(nbComp); if(_end_array) _end_array->getTuple(eltId,&tmp[0]); else throw INTERP_KERNEL::Exception("No end array existing."); - std::transform(tmp.begin(),tmp.end(),tmp.begin(),std::bind2nd(std::multiplies(),1-alpha)); + std::transform(tmp.begin(),tmp.end(),tmp.begin(),std::bind(std::multiplies(),std::placeholders::_1,1-alpha)); std::transform(tmp.begin(),tmp.end(),value,value,std::plus()); } diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index 3e0f0f0ab..3207dd837 100755 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -618,7 +618,7 @@ void MEDCouplingUMesh::getReverseNodalConnectivity(DataArrayIdType *revNodal, Da const mcIdType *endNdlConnOfCurCell=conn+connIndex[eltId+1]; for(const mcIdType *iter=strtNdlConnOfCurCell;iter!=endNdlConnOfCurCell;iter++) if(*iter>=0)//for polyhedrons - *std::find_if(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1],std::bind2nd(std::equal_to(),-1))=eltId; + *std::find_if(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1],std::bind(std::equal_to(),std::placeholders::_1,-1))=eltId; } } @@ -1735,7 +1735,7 @@ void MEDCouplingUMesh::FindCommonCellsAlg(int compType, mcIdType startCellId, co { if(!isFetched[i]) { - const mcIdType *connOfNode=std::find_if(connPtr+connIPtr[i]+1,connPtr+connIPtr[i+1],std::bind2nd(std::not_equal_to(),-1)); + const mcIdType *connOfNode=std::find_if(connPtr+connIPtr[i]+1,connPtr+connIPtr[i+1],std::bind(std::not_equal_to(),std::placeholders::_1,-1)); std::vector v,v2; if(connOfNode!=connPtr+connIPtr[i+1]) { @@ -1770,7 +1770,7 @@ void MEDCouplingUMesh::FindCommonCellsAlg(int compType, mcIdType startCellId, co { if(!isFetched[i]) { - const mcIdType *connOfNode=std::find_if(connPtr+connIPtr[i]+1,connPtr+connIPtr[i+1],std::bind2nd(std::not_equal_to(),-1)); + const mcIdType *connOfNode=std::find_if(connPtr+connIPtr[i]+1,connPtr+connIPtr[i+1],std::bind(std::not_equal_to(),std::placeholders::_1,-1)); // v2 contains the result of successive intersections using rev nodal on on each node of cell #i std::vector v,v2; if(connOfNode!=connPtr+connIPtr[i+1]) @@ -3016,7 +3016,7 @@ mcIdType MEDCouplingUMesh::getNumberOfNodesInCell(mcIdType cellId) const if(pt[ptI[cellId]]!=INTERP_KERNEL::NORM_POLYHED) return ptI[cellId+1]-ptI[cellId]-1; else - return ToIdType(std::count_if(pt+ptI[cellId]+1,pt+ptI[cellId+1],std::bind2nd(std::not_equal_to(),-1))); + return ToIdType(std::count_if(pt+ptI[cellId]+1,pt+ptI[cellId+1],std::bind(std::not_equal_to(),std::placeholders::_1,-1))); } /*! @@ -3253,7 +3253,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getMeasureField(bool isAbs) const area_vol[iel]=INTERP_KERNEL::computeVolSurfOfCell2(type,connec+ipt+1,connec_index[iel+1]-ipt-1,coords,dim_space); } if(isAbs) - std::transform(area_vol,area_vol+nbelem,area_vol,std::ptr_fun(fabs)); + std::transform(area_vol, area_vol + nbelem, area_vol, [](double c) {return fabs(c); }); //std::ptr_fun(fabs) } else { @@ -3306,7 +3306,7 @@ DataArrayDouble *MEDCouplingUMesh::getPartMeasureField(bool isAbs, const mcIdTyp *area_vol++=INTERP_KERNEL::computeVolSurfOfCell2(type,connec+ipt+1,connec_index[*iel+1]-ipt-1,coords,dim_space); } if(isAbs) - std::transform(array->getPointer(),area_vol,array->getPointer(),std::ptr_fun(fabs)); + std::transform(array->getPointer(),area_vol,array->getPointer(), [](double c) {return fabs(c); }); } else { @@ -3403,7 +3403,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildOrthogonalField() const mcIdType offset=connI[i]; INTERP_KERNEL::crossprod<3>(locPtr+3*i,coords+3*conn[offset+1],coords+3*conn[offset+2],vals); double n=INTERP_KERNEL::norm<3>(vals); - std::transform(vals,vals+3,vals,std::bind2nd(std::multiplies(),1./n)); + std::transform(vals,vals+3,vals,std::bind(std::multiplies(),std::placeholders::_1,1./n)); } } else @@ -3422,7 +3422,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildOrthogonalField() const mcIdType offset=connI[i]; std::transform(coords+2*conn[offset+2],coords+2*conn[offset+2]+2,coords+2*conn[offset+1],tmp,std::minus()); double n=INTERP_KERNEL::norm<2>(tmp); - std::transform(tmp,tmp+2,tmp,std::bind2nd(std::multiplies(),1./n)); + std::transform(tmp,tmp+2,tmp,std::bind(std::multiplies(),std::placeholders::_1,1./n)); *vals++=-tmp[1]; *vals++=tmp[0]; } @@ -3482,7 +3482,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildPartOrthogonalField(const mcIdTyp mcIdType offset=connI[*i]; INTERP_KERNEL::crossprod<3>(locPtr,coords+3*conn[offset+1],coords+3*conn[offset+2],vals); double n=INTERP_KERNEL::norm<3>(vals); - std::transform(vals,vals+3,vals,std::bind2nd(std::multiplies(),1./n)); + std::transform(vals,vals+3,vals,std::bind(std::multiplies(),std::placeholders::_1,1./n)); } } else @@ -3499,7 +3499,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildPartOrthogonalField(const mcIdTyp mcIdType offset=connI[*i]; std::transform(coords+2*conn[offset+2],coords+2*conn[offset+2]+2,coords+2*conn[offset+1],tmp,std::minus()); double n=INTERP_KERNEL::norm<2>(tmp); - std::transform(tmp,tmp+2,tmp,std::bind2nd(std::multiplies(),1./n)); + std::transform(tmp,tmp+2,tmp,std::bind(std::multiplies(),std::placeholders::_1,1./n)); *vals++=-tmp[1]; *vals++=tmp[0]; } @@ -6414,7 +6414,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::keepSpecifiedCells(INTERP_KERNEL::Normalized for(mcIdType j=0;j(),offset)); + idsPtr=std::transform(idsPerGeoTypeBg,idsPerGeoTypeEnd,idsPtr,std::bind(std::plus(),std::placeholders::_1,offset)); offset+=code[3*i+1]; } MCAuto ret=static_cast(buildPartOfMySelf(idsTokeep->begin(),idsTokeep->end(),true)); @@ -6549,7 +6549,7 @@ DataArrayDouble *MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell() const } mcIdType nbOfNodesInCell=nodalI[i+1]-nodalI[i]-1; if(nbOfNodesInCell>0) - std::transform(ptToFill,ptToFill+spaceDim,ptToFill,std::bind2nd(std::multiplies(),1./(double)nbOfNodesInCell)); + std::transform(ptToFill,ptToFill+spaceDim,ptToFill,std::bind(std::multiplies(),std::placeholders::_1,1./(double)nbOfNodesInCell)); else { std::ostringstream oss; oss << "MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell : on cell #" << i << " presence of cell with no nodes !"; @@ -6571,7 +6571,7 @@ DataArrayDouble *MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell() const } } if(!s.empty()) - std::transform(ptToFill,ptToFill+spaceDim,ptToFill,std::bind2nd(std::multiplies(),1./(double)s.size())); + std::transform(ptToFill,ptToFill+spaceDim,ptToFill,std::bind(std::multiplies(),std::placeholders::_1,1./(double)s.size())); else { std::ostringstream oss; oss << "MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell : on polyhedron cell #" << i << " there are no nodes !"; @@ -6686,7 +6686,7 @@ DataArrayDouble *MEDCouplingUMesh::computePlaneEquationOf3DFaces() const for(mcIdType offset=nodalI[0]+1;offset()); mcIdType nbOfNodesInCell(nodalI[1]-nodalI[0]-1); - std::transform(dd,dd+3,dd,std::bind2nd(std::multiplies(),1./(double)nbOfNodesInCell)); + std::transform(dd,dd+3,dd,std::bind(std::multiplies(),std::placeholders::_1,1./(double)nbOfNodesInCell)); std::copy(dd,dd+3,matrix+4*2); INTERP_KERNEL::inverseMatrix(matrix,4,matrix2); retPtr[0]=matrix2[3]; retPtr[1]=matrix2[7]; retPtr[2]=matrix2[11]; retPtr[3]=matrix2[15]; @@ -6895,7 +6895,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesOnSameCoords(const std::vectorgetNodalConnectivityArrayLen(); nodalPtr=std::copy(nod,nod+meshLgth2,nodalPtr); if(iter!=meshes.begin()) - nodalIndexPtr=std::transform(index+1,index+nbOfCells+1,nodalIndexPtr,std::bind2nd(std::plus(),offset)); + nodalIndexPtr=std::transform(index+1,index+nbOfCells+1,nodalIndexPtr,std::bind(std::plus(),std::placeholders::_1,offset)); else nodalIndexPtr=std::copy(index,index+nbOfCells+1,nodalIndexPtr); offset+=meshLgth2; diff --git a/src/MEDCoupling/MEDCouplingUMesh_internal.cxx b/src/MEDCoupling/MEDCouplingUMesh_internal.cxx index 3cdd52bfe..af6598ed5 100755 --- a/src/MEDCoupling/MEDCouplingUMesh_internal.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh_internal.cxx @@ -801,7 +801,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildExtrudedMeshFromThisLowLev(mcIdType nbO for(mcIdType iz=0;iz(),newConnIPtr[iz*nbOf2DCells])); + std::transform(newConnIPtr+1,newConnIPtr+1+nbOf2DCells,newConnIPtr+1+iz*nbOf2DCells,std::bind(std::plus(), std::placeholders::_1, newConnIPtr[iz*nbOf2DCells])); const mcIdType *posOfTypeOfCell(newConnIPtr); for(std::vector::const_iterator iter=newc.begin();iter!=newc.end();iter++,newConnPtr++) { @@ -1342,7 +1342,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesLL(const std::vectorgetNumberOfCells()); const mcIdType *curCI=(*it)->_nodal_connec_index->begin(); const mcIdType *curC=(*it)->_nodal_connec->begin(); - cIPtr=std::transform(curCI+1,curCI+curNbOfCell+1,cIPtr,std::bind2nd(std::plus(),offset)); + cIPtr=std::transform(curCI+1,curCI+curNbOfCell+1,cIPtr,std::bind(std::plus(), std::placeholders::_1, offset)); for(mcIdType j=0;j rConnBg(connEnd); std::reverse_iterator rConnEnd(connBg+1); - std::transform(rConnBg,rConnEnd,ii,std::bind2nd(std::plus(),deltaz)); + std::transform(rConnBg,rConnEnd,ii,std::bind(std::plus(),std::placeholders::_1,deltaz)); std::size_t nbOfRadFaces=std::distance(connBg+1,connEnd); for(std::size_t i=0;i=0)//for polyhedrons - *std::find_if(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1],std::bind2nd(std::equal_to(),-1))=eltId; + *std::find_if(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1],std::bind(std::equal_to(), std::placeholders::_1,-1))=eltId; } // DataArrayIdType *commonCells=0,*commonCellsI=0; diff --git a/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx b/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx index 92a6e8d40..fe2e763bd 100644 --- a/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx @@ -1477,8 +1477,8 @@ void InsertNodeInConnIfNecessary(mcIdType nodeIdToInsert, std::vector& mcIdType pt0(conn[i]),pt1(conn[(i+1)%sz]); double v1[3]={coords[3*pt1+0]-coords[3*pt0+0],coords[3*pt1+1]-coords[3*pt0+1],coords[3*pt1+2]-coords[3*pt0+2]},v2[3]={coords[3*nodeIdToInsert+0]-coords[3*pt0+0],coords[3*nodeIdToInsert+1]-coords[3*pt0+1],coords[3*nodeIdToInsert+2]-coords[3*pt0+2]}; double normm(sqrt(v1[0]*v1[0]+v1[1]*v1[1]+v1[2]*v1[2])); - std::transform(v1,v1+3,v1,std::bind2nd(std::multiplies(),1./normm)); - std::transform(v2,v2+3,v2,std::bind2nd(std::multiplies(),1./normm)); + std::transform(v1,v1+3,v1,std::bind(std::multiplies(),std::placeholders::_1,1./normm)); + std::transform(v2,v2+3,v2,std::bind(std::multiplies(),std::placeholders::_1,1./normm)); double v3[3]; v3[0]=v1[1]*v2[2]-v1[2]*v2[1]; v3[1]=v1[2]*v2[0]-v1[0]*v2[2]; v3[2]=v1[0]*v2[1]-v1[1]*v2[0]; double normm2(sqrt(v3[0]*v3[0]+v3[1]*v3[1]+v3[2]*v3[2])),dotTest(v1[0]*v2[0]+v1[1]*v2[1]+v1[2]*v2[2]); diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx index 64c7b133a..adb635365 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx @@ -1385,7 +1385,7 @@ void MEDCouplingBasicsTest1::testMergeField1() double values[7]={0.25,0.125,0.125,0.25,0.25,0.5,0.5}; const double *tmp=f3->getArray()->getConstPointer(); std::transform(tmp,tmp+7,values,values,std::minus()); - std::transform(values,values+7,values,std::ptr_fun(fabs)); + std::transform(values,values+7,values, [](double c) {return fabs(c); }); //std::ptr_fun(fabs) double max=*std::max_element(values,values+7); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12); m4->decrRef(); @@ -1439,7 +1439,7 @@ void MEDCouplingBasicsTest1::testFillFromAnalytic() double values1[5]={-0.1,0.23333333333333336,0.56666666666666665,0.4,0.9}; const double *tmp=f1->getArray()->getConstPointer(); std::transform(tmp,tmp+5,values1,values1,std::minus()); - std::transform(values1,values1+5,values1,std::ptr_fun(fabs)); + std::transform(values1,values1+5,values1, [](double c) {return fabs(c); }); //std::ptr_fun(fabs) double max=*std::max_element(values1,values1+5); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12); f1->decrRef(); @@ -1453,7 +1453,7 @@ void MEDCouplingBasicsTest1::testFillFromAnalytic() double values2[9]={-0.6,-0.1,0.4,-0.1,0.4,0.9,0.4,0.9,1.4}; tmp=f1->getArray()->getConstPointer(); std::transform(tmp,tmp+9,values2,values2,std::minus()); - std::transform(values2,values2+9,values2,std::ptr_fun(fabs)); + std::transform(values2,values2+9,values2, [](double c) {return fabs(c); }); //std::ptr_fun(fabs) max=*std::max_element(values2,values2+9); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12); f1->decrRef(); @@ -1467,7 +1467,7 @@ void MEDCouplingBasicsTest1::testFillFromAnalytic() double values3[18]={-0.6,-1.2,-0.1,-0.2,0.4,0.8,-0.1,-0.2,0.4,0.8,0.9,1.8,0.4,0.8,0.9,1.8,1.4,2.8}; tmp=f1->getArray()->getConstPointer(); std::transform(tmp,tmp+18,values3,values3,std::minus()); - std::transform(values3,values3+18,values3,std::ptr_fun(fabs)); + std::transform(values3,values3+18,values3, [](double c) {return fabs(c); }); //std::ptr_fun(fabs) max=*std::max_element(values3,values3+18); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12); double values4[2]; @@ -1497,7 +1497,7 @@ void MEDCouplingBasicsTest1::testFillFromAnalytic2() double values1[5]={-0.1,0.23333333333333336,0.56666666666666665,0.4,0.9}; const double *tmp=f1->getArray()->getConstPointer(); std::transform(tmp,tmp+5,values1,values1,std::minus()); - std::transform(values1,values1+5,values1,std::ptr_fun(fabs)); + std::transform(values1,values1+5,values1, [](double c) {return fabs(c); }); double max=*std::max_element(values1,values1+5); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12); f1->decrRef(); @@ -1511,7 +1511,7 @@ void MEDCouplingBasicsTest1::testFillFromAnalytic2() double values2[9]={-0.9,0.1,1.1,-0.4,0.6,1.6,0.1,1.1,2.1}; tmp=f1->getArray()->getConstPointer(); std::transform(tmp,tmp+9,values2,values2,std::minus()); - std::transform(values2,values2+9,values2,std::ptr_fun(fabs)); + std::transform(values2,values2+9,values2, [](double c) {return fabs(c); }); max=*std::max_element(values2,values2+9); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12); f1->decrRef(); @@ -1524,7 +1524,7 @@ void MEDCouplingBasicsTest1::testFillFromAnalytic2() tmp=f1->getArray()->getConstPointer(); double values2Bis[9]={-0.9,0.1,1.1,-0.4,0.6,1.6,0.1,1.1,2.1}; std::transform(tmp,tmp+9,values2Bis,values2Bis,std::minus()); - std::transform(values2,values2+9,values2Bis,std::ptr_fun(fabs)); + std::transform(values2,values2+9,values2Bis, [](double c) {return fabs(c); }); max=*std::max_element(values2Bis,values2Bis+9); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12); f1->decrRef(); @@ -1538,7 +1538,7 @@ void MEDCouplingBasicsTest1::testFillFromAnalytic2() double values3[18]={-0.6,-1.2,-0.1,-0.2,0.4,0.8,-0.1,-0.2,0.4,0.8,0.9,1.8,0.4,0.8,0.9,1.8,1.4,2.8}; tmp=f1->getArray()->getConstPointer(); std::transform(tmp,tmp+18,values3,values3,std::minus()); - std::transform(values3,values3+18,values3,std::ptr_fun(fabs)); + std::transform(values3,values3+18,values3, [](double c) {return fabs(c); }); max=*std::max_element(values3,values3+18); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12); double values4[2]; @@ -1572,7 +1572,7 @@ void MEDCouplingBasicsTest1::testApplyFunc() double values1[9]={-1.8,-0.3,1.2,-0.3,1.2,2.7,1.2,2.7,4.2}; const double *tmp=f1->getArray()->getConstPointer(); std::transform(tmp,tmp+9,values1,values1,std::minus()); - std::transform(values1,values1+9,values1,std::ptr_fun(fabs)); + std::transform(values1,values1+9,values1, [](double c) {return fabs(c); }); double max=*std::max_element(values1,values1+9); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12); f1->decrRef(); @@ -1605,7 +1605,7 @@ void MEDCouplingBasicsTest1::testApplyFunc2() 5.0423700574830965, 17.435300118916864}; const double *tmp=f2->getArray()->getConstPointer(); std::transform(tmp,tmp+18,values2,values2,std::minus()); - std::transform(values2,values2+18,values2,std::ptr_fun(fabs)); + std::transform(values2,values2+18,values2, [](double c) {return fabs(c); }); double max=*std::max_element(values2,values2+18); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12); f2->decrRef(); @@ -1618,7 +1618,7 @@ void MEDCouplingBasicsTest1::testApplyFunc2() double values1[9]={-1.8,-0.3,1.2,-0.3,1.2,2.7,1.2,2.7,4.2}; tmp=f1->getArray()->getConstPointer(); std::transform(tmp,tmp+9,values1,values1,std::minus()); - std::transform(values1,values1+9,values1,std::ptr_fun(fabs)); + std::transform(values1,values1+9,values1, [](double c) {return fabs(c); }); max=*std::max_element(values1,values1+9); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12); f1->decrRef(); @@ -1639,7 +1639,7 @@ void MEDCouplingBasicsTest1::testOperationsOnFields() double values1[9]={-1.2,-0.2,0.8,-0.2,0.8,1.8,0.8,1.8,2.8}; const double *tmp=f3->getArray()->getConstPointer(); std::transform(tmp,tmp+9,values1,values1,std::minus()); - std::transform(values1,values1+9,values1,std::ptr_fun(fabs)); + std::transform(values1,values1+9,values1, [](double c) {return fabs(c); }); double max=*std::max_element(values1,values1+9); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12); f3->decrRef(); @@ -1651,7 +1651,7 @@ void MEDCouplingBasicsTest1::testOperationsOnFields() double values2[9]={0.36,0.01,0.16,0.01,0.16,0.81,0.16,0.81,1.96}; tmp=f3->getArray()->getConstPointer(); std::transform(tmp,tmp+9,values2,values2,std::minus()); - std::transform(values2,values2+9,values2,std::ptr_fun(fabs)); + std::transform(values2,values2+9,values2, [](double c) {return fabs(c); }); max=*std::max_element(values2,values2+9); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12); f3->decrRef(); @@ -1664,7 +1664,7 @@ void MEDCouplingBasicsTest1::testOperationsOnFields() double values3[9]={0.6,0.1,-0.4,0.1,-0.4,-0.9,-0.4,-0.9,-1.4}; tmp=f4->getArray()->getConstPointer(); std::transform(tmp,tmp+9,values3,values3,std::minus()); - std::transform(values3,values3+9,values3,std::ptr_fun(fabs)); + std::transform(values3,values3+9,values3, [](double c) {return fabs(c); }); max=*std::max_element(values3,values3+9); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12); f3->decrRef(); @@ -1695,7 +1695,7 @@ void MEDCouplingBasicsTest1::testOperationsOnFields() tmp=f3->getArray()->getConstPointer(); double values4[9]={-1.2,-0.2,0.8,-0.2,0.8,1.8,0.8,1.8,2.8}; std::transform(tmp,tmp+9,values4,values4,std::minus()); - std::transform(values4,values4+9,values4,std::ptr_fun(fabs)); + std::transform(values4,values4+9,values4, [](double c) {return fabs(c); }); max=*std::max_element(values4,values4+9); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12); f5->decrRef(); @@ -1717,7 +1717,7 @@ void MEDCouplingBasicsTest1::testOperationsOnFields() tmp=f3->getArray()->getConstPointer(); double values5[9]={-1.2,-0.2,0.8,-0.2,0.8,1.8,0.8,1.8,2.8}; std::transform(tmp,tmp+9,values5,values5,std::minus()); - std::transform(values5,values5+9,values5,std::ptr_fun(fabs)); + std::transform(values5,values5+9,values5, [](double c) {return fabs(c); }); max=*std::max_element(values5,values5+9); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12); f5->decrRef(); diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx index 138bfe200..e91f09fba 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx @@ -2077,7 +2077,7 @@ void MEDCouplingBasicsTest2::testFillFromAnalytic3() double values1[5]={-0.1,0.23333333333333336,0.56666666666666665,0.4,0.9}; const double *tmp=f1->getArray()->getConstPointer(); std::transform(tmp,tmp+5,values1,values1,std::minus()); - std::transform(values1,values1+5,values1,std::ptr_fun(fabs)); + std::transform(values1,values1+5,values1, [](double c) {return fabs(c); }); //std::ptr_fun(fabs) double max=*std::max_element(values1,values1+5); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12); f1->decrRef(); @@ -2094,7 +2094,7 @@ void MEDCouplingBasicsTest2::testFillFromAnalytic3() double values2[9]={-0.9,0.1,1.1,-0.4,0.6,1.6,0.1,1.1,2.1}; tmp=f1->getArray()->getConstPointer(); std::transform(tmp,tmp+9,values2,values2,std::minus()); - std::transform(values2,values2+9,values2,std::ptr_fun(fabs)); + std::transform(values2,values2+9,values2, [](double c) {return fabs(c); }); max=*std::max_element(values2,values2+9); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12); f1->decrRef(); @@ -2111,12 +2111,12 @@ void MEDCouplingBasicsTest2::testFillFromAnalytic3() double values2Bis[9]={-0.9,0.1,1.1,-0.4,0.6,1.6,0.1,1.1,2.1}; double values2BisBis[9]; std::transform(tmp,tmp+9,values2Bis,values2BisBis,std::minus()); - std::transform(values2,values2+9,values2BisBis,std::ptr_fun(fabs)); + std::transform(values2,values2+9,values2BisBis, [](double c) {return fabs(c); }); max=*std::max_element(values2BisBis,values2BisBis+9); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12); tmp=f1->getEndArray()->getConstPointer(); std::transform(tmp,tmp+9,values2Bis,values2BisBis,std::minus()); - std::transform(values2,values2+9,values2BisBis,std::ptr_fun(fabs)); + std::transform(values2,values2+9,values2BisBis, [](double c) {return fabs(c); }); max=*std::max_element(values2BisBis,values2BisBis+9); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12); f1->decrRef(); @@ -2132,7 +2132,7 @@ void MEDCouplingBasicsTest2::testFillFromAnalytic3() double values3[18]={-0.6,-1.2,-0.1,-0.2,0.4,0.8,-0.1,-0.2,0.4,0.8,0.9,1.8,0.4,0.8,0.9,1.8,1.4,2.8}; tmp=f1->getArray()->getConstPointer(); std::transform(tmp,tmp+18,values3,values3,std::minus()); - std::transform(values3,values3+18,values3,std::ptr_fun(fabs)); + std::transform(values3,values3+18,values3, [](double c) {return fabs(c); }); max=*std::max_element(values3,values3+18); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,max,1.e-12); double values4[2]; @@ -2240,9 +2240,9 @@ void MEDCouplingBasicsTest2::testAreaBary3D2() mcIdType tmpConn[8]={0,1,2,3,4,5,6,7}; mesh->allocateCells(3); mesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,tmpConn); - std::transform(tmpConn,tmpConn+8,tmpConn,std::bind2nd(std::plus(),8)); + std::transform(tmpConn,tmpConn+8,tmpConn,std::bind(std::plus(), std::placeholders::_1,8)); mesh->insertNextCell(INTERP_KERNEL::NORM_PENTA6,6,tmpConn); - std::transform(tmpConn,tmpConn+8,tmpConn,std::bind2nd(std::plus(),6)); + std::transform(tmpConn,tmpConn+8,tmpConn,std::bind(std::plus(),std::placeholders::_1,6)); mesh->insertNextCell(INTERP_KERNEL::NORM_PYRA5,5,tmpConn); mesh->finishInsertingCells(); mesh->checkConsistencyLight(); diff --git a/src/MEDLoader/MEDFileField1TS.cxx b/src/MEDLoader/MEDFileField1TS.cxx index 104575a7b..88594e77e 100644 --- a/src/MEDLoader/MEDFileField1TS.cxx +++ b/src/MEDLoader/MEDFileField1TS.cxx @@ -439,7 +439,7 @@ int MEDFileAnyTypeField1TSWithoutSDA::getNonEmptyLevels(const std::string& /*mna } int ret=*std::max_element(ret1.begin(),ret1.end()); std::copy(ret1.rbegin(),ret1.rend(),std::back_insert_iterator >(levs)); - std::transform(levs.begin(),levs.end(),levs.begin(),std::bind2nd(std::plus(),-ret)); + std::transform(levs.begin(),levs.end(),levs.begin(),std::bind(std::plus(),std::placeholders::_1,-ret)); return ret; } diff --git a/src/MEDLoader/MEDFileFieldOverView.cxx b/src/MEDLoader/MEDFileFieldOverView.cxx index a856382c7..3ad0ebe19 100644 --- a/src/MEDLoader/MEDFileFieldOverView.cxx +++ b/src/MEDLoader/MEDFileFieldOverView.cxx @@ -1400,7 +1400,7 @@ MEDMeshMultiLev *MEDCMeshMultiLev::prepare() const MCAuto nnr; std::vector cgs,ngs(getNodeGridStructure()); cgs.resize(ngs.size()); - std::transform(ngs.begin(),ngs.end(),cgs.begin(),std::bind2nd(std::plus(),-1)); + std::transform(ngs.begin(),ngs.end(),cgs.begin(),std::bind(std::plus(),std::placeholders::_1,-1)); if(pfl) { std::vector< std::pair > cellParts; @@ -1536,7 +1536,7 @@ MEDMeshMultiLev *MEDCurveLinearMeshMultiLev::prepare() const MCAuto nnr; std::vector cgs,ngs(getNodeGridStructure()); cgs.resize(ngs.size()); - std::transform(ngs.begin(),ngs.end(),cgs.begin(),std::bind2nd(std::plus(),-1)); + std::transform(ngs.begin(),ngs.end(),cgs.begin(),std::bind(std::plus(),std::placeholders::_1,-1)); if(pfl) { std::vector< std::pair > cellParts,nodeParts; diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index 8a0aa5460..973c9da0a 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -2241,7 +2241,7 @@ void MEDFileMesh::TranslateFamilyIds(mcIdType offset, DataArrayIdType *famArr, s { if(offset<0) std::transform((*it1).begin(),(*it1).end(),(*it1).begin(),std::negate()); - std::transform((*it1).begin(),(*it1).end(),(*it1).begin(),std::bind2nd(std::plus(),offset)); + std::transform((*it1).begin(),(*it1).end(),(*it1).begin(),std::bind(std::plus(), std::placeholders::_1,offset)); } } diff --git a/src/MEDLoader/MEDFileMeshElt.cxx b/src/MEDLoader/MEDFileMeshElt.cxx index 1bcca1191..e366fced3 100644 --- a/src/MEDLoader/MEDFileMeshElt.cxx +++ b/src/MEDLoader/MEDFileMeshElt.cxx @@ -203,7 +203,7 @@ void MEDFileUMeshPerType::loadFromStaticType(med_idt fid, const char *mName, int mcIdType nbOfNodesPerCell(mc->getNumberOfNodesPerCell()); conn->alloc(nbOfNodesPerCell*curNbOfElem,1); MEDFILESAFECALLERRD0(MEDmeshElementConnectivityRd,(fid,mName,dt,it,entity,geoElt,MED_NODAL,MED_FULL_INTERLACE,conn->getPointer())); - std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus(),-1)); + std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind(std::plus(), std::placeholders::_1,-1)); mc->setNodalConnectivity(FromMedIntArray(conn)); loadCommonPart(fid,mName,dt,it,curNbOfElem,geoElt,entity,mrs); } @@ -228,7 +228,7 @@ void MEDFileUMeshPerType::loadPartStaticType(med_idt fid, const char *mName, int /*lastblocksize=useless because count=1*/0,&filter); MEDFILESAFECALLERRD0(MEDmeshElementConnectivityAdvancedRd,(fid,mName,dt,it,entity,geoElt,MED_NODAL,&filter,conn->getPointer())); MEDfilterClose(&filter); - std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus(),-1)); + std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind(std::plus(),std::placeholders::_1,-1)); mc->setNodalConnectivity(FromMedIntArray(conn)); loadPartOfCellCommonPart(fid,mName,strt,end,step,dt,it,mdim,curNbOfElem,geoElt,entity,mrs); } @@ -304,8 +304,8 @@ void MEDFileUMeshPerType::loadPolyg(med_idt fid, const char *mName, int dt, int MCAuto conn(DataArrayMedInt::New()),connI(DataArrayMedInt::New()); conn->alloc(arraySize,1); connI->alloc(curNbOfElem+1,1); MEDFILESAFECALLERRD0(MEDmeshPolygon2Rd,(fid,mName,dt,it,MED_CELL,geoElt,MED_NODAL,connI->getPointer(),conn->getPointer())); - std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus(),-1)); - std::transform(connI->begin(),connI->end(),connI->getPointer(),std::bind2nd(std::plus(),-1)); + std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind(std::plus(),std::placeholders::_1,-1)); + std::transform(connI->begin(),connI->end(),connI->getPointer(),std::bind(std::plus(),std::placeholders::_1,-1)); mc->setNodalConnectivity(FromMedIntArray(conn),FromMedIntArray(connI)); loadCommonPart(fid,mName,dt,it,curNbOfElem,geoElt,entity,mrs); } @@ -335,11 +335,11 @@ void MEDFileUMeshPerType::loadPolyh(med_idt fid, const char *mName, int dt, int for(mcIdType i=0;i(),-1)); + wFinalConn=std::transform(locConn+indexFace[index[i]-1]-1,locConn+indexFace[index[i]]-1,wFinalConn,std::bind(std::plus(),std::placeholders::_1,-1)); for(mcIdType j=index[i];j(),-1)); + wFinalConn=std::transform(locConn+indexFace[j]-1,locConn+indexFace[j+1]-1,wFinalConn,std::bind(std::plus(),std::placeholders::_1,-1)); } } mc->setNodalConnectivity(conn,connI); @@ -362,7 +362,7 @@ void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int /*mdi if(!m0) throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::Write : internal error #1 !"); MCAuto arr(DataArrayMedInt::Copy(m0->getNodalConnectivity())); - std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus(),1)); + std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind(std::plus(),std::placeholders::_1,1)); MEDFILESAFECALLERWR0(MEDmeshElementConnectivityWr,(fid,mname.c_str(),dt,it,timm,MED_CELL,curMedType,MED_NODAL,MED_FULL_INTERLACE,ToMedInt(nbOfCells),arr->begin())); } else @@ -373,8 +373,8 @@ void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int /*mdi if(ikt==INTERP_KERNEL::NORM_POLYGON || ikt==INTERP_KERNEL::NORM_QPOLYG) { MCAuto arr(DataArrayMedInt::Copy(m0->getNodalConnectivity())),arrI(DataArrayMedInt::Copy(m0->getNodalConnectivityIndex())); - std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus(),1)); - std::transform(arrI->begin(),arrI->end(),arrI->getPointer(),std::bind2nd(std::plus(),1)); + std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind(std::plus(),std::placeholders::_1,1)); + std::transform(arrI->begin(),arrI->end(),arrI->getPointer(),std::bind(std::plus(),std::placeholders::_1,1)); MEDFILESAFECALLERWR0(MEDmeshPolygon2Wr,(fid,mname.c_str(),dt,it,timm,MED_CELL,ikt==INTERP_KERNEL::NORM_POLYGON?MED_POLYGON:MED_POLYGON2,MED_NODAL,ToMedInt(nbOfCells+1),arrI->begin(),arr->begin())); } else @@ -394,7 +394,7 @@ void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int /*mdi for(const mcIdType *w=conn+connI[i];w!=conn+connI[i+1];w2++) { const mcIdType *wend=std::find(w,conn+connI[i+1],-1); - bt=std::transform(w,wend,bt,std::bind2nd(std::plus(),1)); + bt=std::transform(w,wend,bt,std::bind(std::plus(),std::placeholders::_1,1)); std::size_t nbOfNode=std::distance(w,wend); w2[1]=w2[0]+(med_int)nbOfNode; if(wend!=conn+connI[i+1])