Commit 08061ab2 authored by Haocheng LIU's avatar Haocheng LIU Committed by Kitware Robot
Browse files

Merge topic 'Allow-custom-range-in-histogram-filter'

5393745e

 Allow histogram filter to take custom types
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Utkarsh Ayachit's avatarUtkarsh Ayachit <utkarsh.ayachit@kitware.com>
Merge-request: !1261
parents 31260373 5393745e
#Allow histogram filter to take custom types
By passing TypeList and StorageList type into FieldRangeGlobalCompute,
upstream users(VTK) can pass custom types into the histogram filter.
...@@ -232,14 +232,19 @@ template <typename DerivedPolicy> ...@@ -232,14 +232,19 @@ template <typename DerivedPolicy>
inline VTKM_CONT void Histogram::PreExecute(const vtkm::cont::MultiBlock& input, inline VTKM_CONT void Histogram::PreExecute(const vtkm::cont::MultiBlock& input,
const vtkm::filter::PolicyBase<DerivedPolicy>&) const vtkm::filter::PolicyBase<DerivedPolicy>&)
{ {
using TypeList = typename DerivedPolicy::FieldTypeList;
using StorageList = typename DerivedPolicy::FieldStorageList;
if (this->Range.IsNonEmpty()) if (this->Range.IsNonEmpty())
{ {
this->ComputedRange = this->Range; this->ComputedRange = this->Range;
} }
else else
{ {
auto handle = vtkm::cont::FieldRangeGlobalCompute( auto handle = vtkm::cont::FieldRangeGlobalCompute(input,
input, this->GetActiveFieldName(), this->GetActiveFieldAssociation()); this->GetActiveFieldName(),
this->GetActiveFieldAssociation(),
TypeList(),
StorageList());
if (handle.GetNumberOfValues() != 1) if (handle.GetNumberOfValues() != 1)
{ {
throw vtkm::cont::ErrorFilterExecution("expecting scalar field."); throw vtkm::cont::ErrorFilterExecution("expecting scalar field.");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment