Consolidate permutation for DoMapField
There are currently 18 filters that provide nontrivial implementations of DoMapField
. Every single one of these filters has some form of a simple permutation of either the cell or point field. Many of the implementations are different, and even those that share implementations compile them separately.
We are surely wasting a lot of time compiling the same permute operation over and over again. We should provide a function that takes an array (wrapped in a VariantArrayHandle
) and a vtkm::cont::ArrayHandle<vtkm::Id>
and produces a new basic array that contains the array permuted by the index array. There are lots of cases that should be supported, so they should be compiled once and stored in a library so that it can be used for all the filters.
I think the biggest design challenge here is altering the semantics of DoMapField
to accept a VariantArrayHandle
(or a Field
). Right now the filter superclasses, where appropriate, use the policy to pull concrete ArrayHandle
s from each Field
and pass them to DoMapField
. However, it would be wasteful to create all the code to pull any potential ArrayHandle
only to then put it back into a VariantArrayHandle
so it can be passed to a library. However, there are still a handful of filters that need more customized field processing (such as interpolation) that still need access to the base ArrayHandle
.