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

@ -670,7 +670,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::processValues
// Uniformity index
const scalar ui = 1 - numer/(2*mag(mean*areaTotal) + ROOTVSMALL);
return min(max(ui, 0), 1);
return clamp(ui, 0, 1);
}
default:
@ -756,7 +756,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::processValues
// Uniformity index
const scalar ui = 1 - numer/(2*mag(mean*areaTotal) + ROOTVSMALL);
return vector(min(max(ui, 0), 1), 0, 0);
return vector(clamp(ui, 0, 1), 0, 0);
}
default:

View File

@ -417,7 +417,7 @@ bool Foam::functionObjects::stabilityBlendingFactor::init(bool first)
max
(
indicator,
min(max(scalar(0), (Co - Co1_)/(Co2_ - Co1_)), scalar(1))
clamp((Co - Co1_)/(Co2_ - Co1_), zero_one{})
);
if (first)

View File

@ -152,7 +152,7 @@ Description
For option 6, the following relation is used:
\f[
fCoWeight = min(max((Co - Co1)/(Co2 - Co1), 0), 1)
fCoWeight = clamp((Co - Co1)/(Co2 - Co1), 0, 1)
\f]
where