Skip to content
Snippets Groups Projects
Commit dd72c6a6 authored by Philippe Hoch's avatar Philippe Hoch
Browse files

Add Barth Jespersen Lim

parent 5a3117ae
Branches
No related tags found
No related merge requests found
Pipeline #1976 failed
#ifndef LIMITATION_TOOLS_HPP
#define LIMITATION_TOOLS_HPP
namespace toolsLimitation
{
inline double
computeCoefLimitationBarthJespersen(const double State,
const double minval,
const double maxval,
const double minvalvois,
const double maxvalvois,
bool enableWeakBoundPositivityOnly = false)
{
static constexpr double epsZer0 = 1e-14;
// on applique le traitement idem de l'ordre 2..
double coef1 = 0, coef2 = 0;
if (enableWeakBoundPositivityOnly) {
coef1 = 1;
const double minGlobal = 1e-12;
if (std::fabs(minval - State) <= epsZer0) // epsIsEqualAbs())
coef2 = 1.;
else
coef2 = (minGlobal - State) / ((minval - State));
} else {
if (std::fabs(maxval - State) <= epsZer0) // epsIsEqualAbs())
coef1 = 1.;
else
coef1 = (maxvalvois - State) / ((maxval - State));
if (std::fabs(minval - State) <= epsZer0) // epsIsEqualAbs())
coef2 = 1.;
else
coef2 = (minvalvois - State) / ((minval - State));
}
// return alfa =
return std::max(0., std::min(1., std::min(coef1, coef2)));
// return alfa;
}
} // namespace toolsLimitation
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment