ENH: use GeometricField clamp_min, clamp_max, clamp_range

- newer naming allows for less confusing code.
  Eg,
      max(lower)  ->  clamp_min(lower)
      min(upper)  ->  clamp_max(upper)

- prefer combined method, for few operations.
  Eg,
      max(lower) + min(upper) -> clamp_range(lower, upper)

  The updated naming also helps avoid some obvious coding errors.
  Eg,

     Re.min(1200.0);
     Re.max(18800.0);

  instead of
     Re.clamp_range(1200.0, 18800.0);

- can also use implicit conversion of zero_one to MinMax<Type> for
  this type of code:

      lambda_.clamp_range(zero_one{});
This commit is contained in:
Mark Olesen
2023-01-20 09:48:40 +01:00
parent 4d7180ae7c
commit 3d8a6a5433
45 changed files with 163 additions and 145 deletions

View File

@ -48,7 +48,7 @@ if (Y.size())
fvOptions.correct(Yi);
Yi.max(0.0);
Yi.clamp_min(0);
Yt += Yi;
}
}
@ -56,6 +56,6 @@ if (Y.size())
if (Y.size())
{
Y[inertIndex] = scalar(1) - Yt;
Y[inertIndex].max(0.0);
Y[inertIndex].clamp_min(0);
}
}