Skip to content
Snippets Groups Projects

Add minMax and clip field functions

Merged Mark OLESEN requested to merge feature-fieldLimits into develop
  1. Jan 31, 2019
    • Mark OLESEN's avatar
      ENH: add clip() method to GeometricField · 27981d42
      Mark OLESEN authored
      27981d42
    • Mark OLESEN's avatar
      ENH: minMax, minMaxMag as functions and field functions · c6ee663e
      Mark OLESEN authored
      - Global functions are unary or combining binary functions, which are
        defined in MinMax.H (MinMaxOps.H).
      
        There are also global reduction functions (gMinMax, gMinMaxMag)
        as well as supporting 'Op' classes:
      
        - minMaxOp, minMaxEqOp, minMaxMagOp, minMaxMagEqOp
      
        Since the result of the functions represents a content reduction
        into a single MinMax<T> value (a min/max pair), field operations
        returning a field simply do not make sense.
      
      - Implemented for lists, fields, field-fields, DimensionedField,
        GeometricField (parallel reducing, with boundaries).
      
      - Since the minMax evaluates during its operation, this makes it more
        efficient for cases where both min/max values are required since it
        avoids looping twice through the data.
      
        * Changed GeometricField writeMinMax accordingly.
      
      ENH: clip as field function
      
      - clipping provides a more efficient, single-pass operation to apply
        lower/upper limits on single or multiple values.
      
        Examples,
      
          scalarMinMax limiter(0, 1);
      
          limiter.clip(value)
      
             -> returns a const-ref to the value if within the range, or else
                returns the appropriate lower/upper limit
      
          limiter.inplaceClip(value)
      
             -> Modifies the value if necessary to be within lower/upper limit
      
        Function calls
      
          clip(value, limiter)
      
             -> returns a copy after applying lower/upper limit
      
          clip(values, limiter)
      
             -> returns a tmp<Field> of clipped values
      c6ee663e