Hi there!
As a part of a long term task to further integrate VTK-m into ParaView, we are trying to expose VTK-m filters in the ParaView UI not as independent filters (such as vtkmContour) but instead under the same name as its corresponding PV filter (such as Contour).
So far we have came up with the following strategy:
In VTK, we override VTK filters that has its corresponding in VTK-m using the vtkObjectFactory
pattern
In PV, we changed the implementation of the vtkPV*Filters
that have a corresponding filter in VTK-m to delegate into a vtk*Filter
instead of its superclass. This allows us to create a vtkm or vtk filter using the convienient vtkObjectFactory::CreateInstance
at the vtkPV*Filter
at run-time.
In other words:
In the vtkPV*Filter.h
...
vtk*Filter* impl;
};
In the vtkPV*Filter.cpp
vtkPV*Filter::vtkPV*Filter()
{
// First we try to create the filter from vtkObjectFactory
this->impl = static_cast<vtk*Filter*>(vtkObjectFactory::CreateInstance("vtk*Filter"));
if (!this->impl)
{
// If it fails we default to standard vtk*Filter
this->impl = vtk*Filter::New();
}
Still this brings some issues as:
- What do we do with VTKm filters that do not have its corresponding in ParaView? A simple approach is to remove its “vtkm” prefix (Ex: vtkmExternalFaces → ExternalFaces).
- Where would be a good place to place a button/switch to toggle “using vtkm as a backend for filters”.
Also, I wonder how sound is the strategy that we came up, we are really looking forward feedback on original ideas to achieve our goals.
Vicente