Re: vtkm help with using the CleanGrid filter

Allie Vacanti <[email protected]> Thu, 27 Jun 2019 11:14:25 -0400
Newsgroups gmane.comp.lib.vtk.user
Message-ID <CA+=e1oua9=9jTiV+faGPVpjBCpYY5jJHbWRA5eRcqE1ZFbL-YQ@mail.gmail.com>
--===============0640952489==
Content-Type: multipart/alternative; boundary="000000000000b1f25a058c4f9e63"

--000000000000b1f25a058c4f9e63
Content-Type: text/plain; charset="UTF-8"

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 <[email protected]> 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
>

--000000000000b1f25a058c4f9e63
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">For the clean grid filter, you can just use the `vtkmClean=
Grid` filter in VTK, which takes care of the conversions and everything for=
 you.<br><br>If you want to use the vtk-m filters directly with a dataset b=
uilt 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 VT=
K-m. See the Accelerators/Vtkm/vtkmCleanGrid.cxx file in VTK for an example=
 of this:<br><br><p style=3D"margin:0px;white-space:pre-wrap"><font color=
=3D"#000000">#include &quot;vtkmFilterPolicy.h&quot;
<br></font></p><p style=3D"margin:0px;white-space:pre-wrap"><font color=3D"=
#000000">vtkmInputFilterPolicy policy;
</font></p><p style=3D"margin:0px;white-space:pre-wrap"><font color=3D"#000=
000">vtkm::filter::CleanGrid filter;</font></p><p style=3D"margin:0px;white=
-space:pre-wrap"><font color=3D"#000000">auto result =3D filter.Execute(in,=
 policy);<br></font></p><p style=3D"margin:0px;white-space:pre-wrap">
HTH,
Allie</p></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gma=
il_attr">On Thu, Jun 27, 2019 at 11:06 AM sunayanag &lt;<a href=3D"mailto:s=
[email protected]">[email protected]</a>&gt; wrote:<br></div><blockquote=
 class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px so=
lid rgb(204,204,204);padding-left:1ex">Hi All,<br>
<br>
Just started using vtk-m and having some issues with the CleanGrid filter.<=
br>
Assuming that vtkMesh is an object of type vtkSmartPointer&lt;vtkPolyData&g=
t;,<br>
here is the piece of code<br>
<br>
vtkm::cont::DataSet mMesh =3D tovtkm::Convert(vtkMesh,<br>
tovtkm::FieldsFlag::PointsAndCells);<br>
vtkm::filter::CleanGrid cleanGrid;<br>
<br>
try <br>
{<br>
=C2=A0 =C2=A0 vtkm::cont::DataSet outMesh =3D cleanGrid.Execute(mMesh);<br>
}<br>
=C2=A0catch(std::exception&amp; e)<br>
=C2=A0{<br>
=C2=A0 =C2=A0 =C2=A0std::cerr &lt;&lt; e.what();<br>
}<br>
<br>
where the exception thrown is: /Could not find appropriate cast for cell<br=
>
set./<br>
<br>
could anyone help with what I am getting wrong.<br>
<br>
Thanks<br>
Sunayana<br>
<br>
<br>
<br>
--<br>
Sent from: <a href=3D"http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.h=
tml" rel=3D"noreferrer" target=3D"_blank">http://vtk.1045678.n5.nabble.com/=
VTK-Users-f1224199.html</a><br>
_______________________________________________<br>
Powered by <a href=3D"http://www.kitware.com" rel=3D"noreferrer" target=3D"=
_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href=3D"http://www.kitware.c=
om/opensource/opensource.html" rel=3D"noreferrer" target=3D"_blank">http://=
www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href=3D"http://w=
ww.vtk.org/Wiki/VTK_FAQ" rel=3D"noreferrer" target=3D"_blank">http://www.vt=
k.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href=3D"http://markmail.org/search/?q=3Dvtk=
users" rel=3D"noreferrer" target=3D"_blank">http://markmail.org/search/?q=
=3Dvtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href=3D"https://vtk.org/mailman/listinfo/vtkusers" rel=3D"noreferrer" ta=
rget=3D"_blank">https://vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div>

--000000000000b1f25a058c4f9e63--

--===============0640952489==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
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

--===============0640952489==--