Make divide by volume in particle density estimate a little safer

While going through the VTK-m code to identify where a cast-and-call was
happening against VTKM_DEFAULT_TYPE_LIST, I ran into a subtle case in
`ParticleDensityBase` that was calling a worklet with an
`UnknownArrayHandle`. This works OK, but was probably compiling for
unnecessary types (for example, vectors). Changed the field resolution
to be more intentional.
This commit is contained in:
Kenneth Moreland 2023-03-21 14:01:42 -06:00
parent af6218936f
commit 014c429eb0

@ -47,7 +47,10 @@ VTKM_CONT void ParticleDensityBase::DoDivideByVolume(
const vtkm::cont::UnknownArrayHandle& density) const
{
auto volume = this->Spacing[0] * this->Spacing[1] * this->Spacing[2];
this->Invoke(DivideByVolumeWorklet{ volume }, density);
auto resolve = [&](const auto& concreteDensity) {
this->Invoke(DivideByVolumeWorklet{ volume }, concreteDensity);
};
this->CastAndCallScalarField(density, resolve);
}
} // namespace density_estimate
} // namespace filter