vtkm help with using the CleanGrid filter

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

vtkm help with using the CleanGrid filter

sunayanag
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
Reply | Threaded
Open this post in threaded view
|

Re: vtkm help with using the CleanGrid filter

Allie Vacanti
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 <[hidden email]> 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

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: vtkm help with using the CleanGrid filter

sunayanag
This post was updated on .
Thanks for your reply Allie, I looked into the vtkmCleanGrid.cxx file and
tried to reproduce the code  :

auto fieldsFlag = tovtkm::FieldsFlag::None;
vtkm::cont::DataSet in = tovtkm::Convert(vtkMesh, fieldsFlag);
 //apply the filter
 vtkmInputFilterPolicy policy;
 vtkm::filter::CleanGrid filter;
filter.SetCompactPointFields(false);
auto result = filter.Execute(in, policy);

and end up getting the following error :
include\vtk-8.2\vtkm/internal/ListTagDetail.h(207): error C2027: use of
undefined type 'vtkm::cont::vtkmCellSetExplicitAOS'

I also tried using directly the vtkmCleanGrid class, in this case it
worked where the output was of type vtkUnstructuredGrid which I converted
back to vtkPolyData using the vtkDataSetSurfaceFilter.

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
Reply | Threaded
Open this post in threaded view
|

Re: vtkm help with using the CleanGrid filter

Allie Vacanti
On Fri, Jun 28, 2019 at 6:21 AM sunayanag <[hidden email]> wrote:
Thanks for your reply Allie, I looked into the vtkmCleanGrid.cxx file and
tried to reproduce the code  :

auto fieldsFlag = tovtkm::FieldsFlag::None;
vtkm::cont::DataSet in = tovtkm::Convert(vtkMesh, fieldsFlag);
 //apply the filter
 vtkmInputFilterPolicy policy;
 vtkm::filter::CleanGrid filter;
filter.SetCompactPointFields(false);
auto result = filter.Execute(in, policy);

and end up getting the following error :
include\vtk-8.2\vtkm/internal/ListTagDetail.h(207): error C2027: use of
undefined type 'vtkm::cont::vtkmCellSetExplicitAOS'

You can include the file "vtkmCellSetExplicit.h" to fix that. You might also need to include "vtkmCellSetSingleType.h" if you see errors about single type cellsets being undefined.
 
I also tried using the directly the vtkmCleanGrid class, in this case it
worked where the output was of type vtkUnstructuredGrid which I converted
back to vtkPolyData using the vtkDataSetSurfaceFilter.

If you use the vtkm filter directly, it should work to use the fromvtk::Convert method from Accelerators/Vtkm/vtkmlib/PolyDataConverter.h to skip that extra step.

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: vtkm help with using the CleanGrid filter

sunayanag
Thanks, that worked




--
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