-// Copyright (C) 2007-2019 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2024 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
////////////////////////
-MEDCouplingTimeDiscretizationInt::MEDCouplingTimeDiscretizationInt(const MEDCouplingTimeDiscretizationInt& other, bool deepCopy):MEDCouplingTimeDiscretizationSimple<int>(other,deepCopy)
+MEDCouplingTimeDiscretizationInt32::MEDCouplingTimeDiscretizationInt32(const MEDCouplingTimeDiscretizationInt32& other, bool deepCopy):MEDCouplingTimeDiscretizationSimple<Int32>(other,deepCopy)
{
}
-MEDCouplingTimeDiscretizationInt *MEDCouplingTimeDiscretizationInt::performCopyOrIncrRef(bool deepCopy) const
+MEDCouplingTimeDiscretizationInt32 *MEDCouplingTimeDiscretizationInt32::performCopyOrIncrRef(bool deepCopy) const
{
- return new MEDCouplingTimeDiscretizationInt(*this,deepCopy);
+ return new MEDCouplingTimeDiscretizationInt32(*this,deepCopy);
}
-MEDCouplingTimeDiscretizationInt *MEDCouplingTimeDiscretizationInt::New(TypeOfTimeDiscretization type)
+MEDCouplingTimeDiscretizationInt32 *MEDCouplingTimeDiscretizationInt32::New(TypeOfTimeDiscretization type)
{
switch(type)
{
- case MEDCouplingTimeDiscretizationInt::DISCRETIZATION:
- return new MEDCouplingTimeDiscretizationInt;
+ case MEDCouplingTimeDiscretizationInt32::DISCRETIZATION:
+ return new MEDCouplingTimeDiscretizationInt32;
default:
throw INTERP_KERNEL::Exception("Time discretization not implemented yet for integers !");
}
}
-bool MEDCouplingTimeDiscretizationInt::isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<int> *other, int prec, std::string& reason) const
+bool MEDCouplingTimeDiscretizationInt32::isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<Int32> *other, Int32 prec, std::string& reason) const
{
if(prec!=0)
throw INTERP_KERNEL::Exception("isEqualIfNotWhy : only precision equal to 0 supported for int !");
reason="Time discretization is NULL.";
return false;
}
- const MEDCouplingTimeDiscretizationInt *otherC(dynamic_cast<const MEDCouplingTimeDiscretizationInt *>(other));
+ const MEDCouplingTimeDiscretizationInt32 *otherC(dynamic_cast<const MEDCouplingTimeDiscretizationInt32 *>(other));
if(!otherC)
- throw INTERP_KERNEL::Exception("isEqualIfNotWhy : other is not a MEDCouplingTimeDiscretizationInt !");
- if(!MEDCouplingTimeDiscretizationTemplate<int>::areStrictlyCompatible(other,reason))
+ throw INTERP_KERNEL::Exception("isEqualIfNotWhy : other is not a MEDCouplingTimeDiscretizationInt32 !");
+ if(!MEDCouplingTimeDiscretizationTemplate<Int32>::areStrictlyCompatible(other,reason))
return false;
if(!_tk.isEqualIfNotWhy(otherC->_tk,_time_tolerance,reason))
return false;
return _array->isEqualIfNotWhy(*other->getArray(),reason);
}
-bool MEDCouplingTimeDiscretizationInt::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<int> *other, int prec) const
+bool MEDCouplingTimeDiscretizationInt32::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<Int32> *other, Int32 prec) const
{
if(prec!=0)
- throw INTERP_KERNEL::Exception("MEDCouplingTimeDiscretizationInt::isEqualWithoutConsideringStr : only precision 0 is supported !");
- const MEDCouplingTimeDiscretizationInt *otherC(dynamic_cast<const MEDCouplingTimeDiscretizationInt *>(other));
+ throw INTERP_KERNEL::Exception("MEDCouplingTimeDiscretizationInt32::isEqualWithoutConsideringStr : only precision 0 is supported !");
+ const MEDCouplingTimeDiscretizationInt32 *otherC(dynamic_cast<const MEDCouplingTimeDiscretizationInt32 *>(other));
+ if(!otherC)
+ throw INTERP_KERNEL::Exception("isEqualWithoutConsideringStr : other is not a MEDCouplingTimeDiscretizationInt !");
+ std::string tmp;
+ if(!areStrictlyCompatible(other,tmp))
+ return false;
+ std::string reason;
+ if(!_tk.isEqualIfNotWhy(otherC->_tk,_time_tolerance,reason))
+ return false;
+ if(_array==other->getArray())
+ return true;
+ return _array->isEqualWithoutConsideringStr(*(other->getArray()));
+}
+
+////////////////////////
+
+MEDCouplingTimeDiscretizationInt64::MEDCouplingTimeDiscretizationInt64(const MEDCouplingTimeDiscretizationInt64& other, bool deepCopy):MEDCouplingTimeDiscretizationSimple<Int64>(other,deepCopy)
+{
+}
+
+MEDCouplingTimeDiscretizationInt64 *MEDCouplingTimeDiscretizationInt64::performCopyOrIncrRef(bool deepCopy) const
+{
+ return new MEDCouplingTimeDiscretizationInt64(*this,deepCopy);
+}
+
+MEDCouplingTimeDiscretizationInt64 *MEDCouplingTimeDiscretizationInt64::New(TypeOfTimeDiscretization type)
+{
+ switch(type)
+ {
+ case MEDCouplingTimeDiscretizationInt64::DISCRETIZATION:
+ return new MEDCouplingTimeDiscretizationInt64;
+ default:
+ throw INTERP_KERNEL::Exception("Time discretization not implemented yet for integers !");
+ }
+}
+
+bool MEDCouplingTimeDiscretizationInt64::isEqualIfNotWhy(const MEDCouplingTimeDiscretizationTemplate<Int64> *other, Int64 prec, std::string& reason) const
+{
+ if(prec!=0)
+ throw INTERP_KERNEL::Exception("isEqualIfNotWhy : only precision equal to 0 supported for int !");
+ if(!other)
+ {
+ reason="Time discretization is NULL.";
+ return false;
+ }
+ const MEDCouplingTimeDiscretizationInt64 *otherC(dynamic_cast<const MEDCouplingTimeDiscretizationInt64 *>(other));
+ if(!otherC)
+ throw INTERP_KERNEL::Exception("isEqualIfNotWhy : other is not a MEDCouplingTimeDiscretizationInt64 !");
+ if(!MEDCouplingTimeDiscretizationTemplate<Int64>::areStrictlyCompatible(other,reason))
+ return false;
+ if(!_tk.isEqualIfNotWhy(otherC->_tk,_time_tolerance,reason))
+ return false;
+ if(_array==other->getArray())
+ return true;
+ return _array->isEqualIfNotWhy(*other->getArray(),reason);
+}
+
+bool MEDCouplingTimeDiscretizationInt64::isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretizationTemplate<Int64> *other, Int64 prec) const
+{
+ if(prec!=0)
+ throw INTERP_KERNEL::Exception("MEDCouplingTimeDiscretizationInt64::isEqualWithoutConsideringStr : only precision 0 is supported !");
+ const MEDCouplingTimeDiscretizationInt64 *otherC(dynamic_cast<const MEDCouplingTimeDiscretizationInt64 *>(other));
if(!otherC)
throw INTERP_KERNEL::Exception("isEqualWithoutConsideringStr : other is not a MEDCouplingTimeDiscretizationInt !");
std::string tmp;
{
double alpha=(_end.getTimeValue()-time)/(_end.getTimeValue()-_start.getTimeValue());
std::size_t nbComp=vals.size()/2;
- std::transform(vals.begin(),vals.begin()+nbComp,res,std::bind2nd(std::multiplies<double>(),alpha));
+ std::transform(vals.begin(),vals.begin()+nbComp,res,std::bind(std::multiplies<double>(),std::placeholders::_1,alpha));
std::vector<double> tmp(nbComp);
- std::transform(vals.begin()+nbComp,vals.end(),tmp.begin(),std::bind2nd(std::multiplies<double>(),1-alpha));
+ std::transform(vals.begin()+nbComp,vals.end(),tmp.begin(),std::bind(std::multiplies<double>(),std::placeholders::_1,1-alpha));
std::transform(tmp.begin(),tmp.end(),res,res,std::plus<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<double>(),alpha));
+ std::transform(value,value+nbComp,value,std::bind(std::multiplies<double>(),std::placeholders::_1,alpha));
std::vector<double> 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<double>(),1-alpha));
+ std::transform(tmp.begin(),tmp.end(),tmp.begin(),std::bind(std::multiplies<double>(),std::placeholders::_1,1-alpha));
std::transform(tmp.begin(),tmp.end(),value,value,std::plus<double>());
}