mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
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:
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
|
||||
|
Loading…
Reference in New Issue
Block a user