COMP: rename field methods clamp() -> clamp_range()

- this is slightly longer to write (but consistent with clamp_min
  etc). The main reason is that this allows easier use of the clamp()
  free function.

STYLE: skip checks for bad/invalid clamping ranges

- ranges are either already validated before calling, the caller logic
  has already made the branching decision.
This commit is contained in:
Mark Olesen
2023-02-02 14:15:24 +01:00
parent a7d77391fa
commit 4d7180ae7c
8 changed files with 158 additions and 160 deletions

View File

@ -162,9 +162,16 @@ int main(int argc, char *argv[])
Info<< "result: " << result << nl;
someField.clamp(zero_one{});
someField.clamp_range(zero_one{});
Info<< "inplace: " << someField << nl;
scalar val(1.414);
Info<< "clamp " << val
// nope << " : " << clamp(val, zero_one{})
// nope << " : " << clamp(val, scalarMinMax(zero_one{}))
<< " : " << clamp(val, 0, 1)
<< nl;
}
Info<< nl << "\nDone\n" << endl;