[vtkusers] vtkm help with using the CleanGrid filter

Allie Vacanti allison.vacanti at kitware.com
Thu Jun 27 11:14:25 EDT 2019


For the clean grid filter, you can just use the `vtkmCleanGrid` filter in
VTK, which takes care of the conversions and everything for you.

If you want to use the vtk-m filters directly with a dataset built using
tovtkm::Convert, it is necessary to pass a Policy to the filter so that it
is aware of the custom data structures used to adapt VTK into VTK-m. See
the Accelerators/Vtkm/vtkmCleanGrid.cxx file in VTK for an example of this:

#include "vtkmFilterPolicy.h"

vtkmInputFilterPolicy policy;

vtkm::filter::CleanGrid filter;

auto result = filter.Execute(in, policy);

HTH, Allie

On Thu, Jun 27, 2019 at 11:06 AM sunayanag <sunayanag at gmail.com> wrote:

> Hi All,
>
> Just started using vtk-m and having some issues with the CleanGrid filter.
> Assuming that vtkMesh is an object of type vtkSmartPointer<vtkPolyData>,
> here is the piece of code
>
> vtkm::cont::DataSet mMesh = tovtkm::Convert(vtkMesh,
> tovtkm::FieldsFlag::PointsAndCells);
> vtkm::filter::CleanGrid cleanGrid;
>
> try
> {
>     vtkm::cont::DataSet outMesh = cleanGrid.Execute(mMesh);
> }
>  catch(std::exception& e)
>  {
>      std::cerr << e.what();
> }
>
> where the exception thrown is: /Could not find appropriate cast for cell
> set./
>
> could anyone help with what I am getting wrong.
>
> Thanks
> Sunayana
>
>
>
> --
> Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> https://vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20190627/16bf303b/attachment.html>


More information about the vtkusers mailing list