Skip to content
  • David Thompson's avatar
    Methods to compute and return unique array values. · 1df5d6a2
    David Thompson authored
    Determining unique values is the "abstract" (or categorical)
    equivalent of determining the range of interval-valued array.
    It only makes sense for arrays with a small number of distinct
    values, and this also happens to be when it is computationally
    efficient to compute.
    
    This adds methods `GetUniqueComponentValues` and
    `UpdateDiscreteValueSet` to `vtkAbstractArray`.
    The `GetUniqueComponentValues` method populates a `vtkVariantArray`
    you pass with a list of unique values taken on by a component, or,
    clears it to an empty array if there are more than
    `vtkAbstractArray::MAX_DISCRETE_VALUES` distinct values present.
    
    The unique values are identified by sampling at most log2(n)
    tuples for large arrays, so obtaining the summary information --
    which is cached once computed -- is an inexpensive operation.
    This does mean that rare observations will go undetected.
    
    You may also obtain a list of unique *tuples* instead of unique
    component values by passing -1 for the component number.
    
    Unique values are cached in the `vtkInformation` associated with the array.
    This commit also adds 2 new key types: one for storing `vtkVariant`
    objects as values, and another for storing vectors of variants.
    A variant vector is used to store unique tuples and unique component values.
    
    Change-Id: I241cf61372966bba381eb28d14bdc043a54ba197
    1df5d6a2