STYLE: use clamp/clamp_range instead of min(max(..., upper), lower)

This commit is contained in:
Mark Olesen
2023-02-01 18:39:19 +01:00
parent ba6667a344
commit 1cc72ea7e3
50 changed files with 122 additions and 167 deletions

View File

@ -529,11 +529,7 @@ void Foam::edgeInterpolation::makeCorrectionVectors() const
if (owner.size() > 0)
{
scalarField sinAlpha(deltaCoeffs*mag(CorrVecs.internalField()));
forAll(sinAlpha, edgeI)
{
sinAlpha[edgeI] = max(-1, min(sinAlpha[edgeI], 1));
}
sinAlpha.clamp_range(-1, 1);
NonOrthogCoeff = max(Foam::asin(sinAlpha)*180.0/M_PI);
}

View File

@ -110,7 +110,7 @@ public:
gradcf = stabilise(gradcf, SMALL);
scalar phict = 1 - 0.5*gradf/gradcf;
scalar limiter = min(max(phict/k_, 0), 1);
scalar limiter = clamp(phict/k_, 0, 1);
return lerp(udWeight, cdWeight, limiter);
}