[vtkusers] Is vtkCutter thread-safe?

Luca Pallozzi Lavorante lplavorante at gmail.com
Wed Mar 15 07:41:33 EDT 2017


Hi Steven, thank you for your reply.
I am using VTK 7.0. Are you using vtkCutter in different threads with the
same input data? This is my case.

     Thank you

        Luca

On Tue, Mar 14, 2017 at 6:08 PM, Hahn, Steven E. <hahnse at ornl.gov> wrote:

> Hi Luca,
>
>
>
> Are you using master? Last week I added a merge request making vtkCutter
> thread-safe.
>
> https://gitlab.kitware.com/vtk/vtk/merge_requests/2541
>
>
>
> Steven
>
>
>
> *From: *vtkusers <vtkusers-bounces at vtk.org> on behalf of Luca Pallozzi
> Lavorante <lplavorante at gmail.com>
> *Date: *Tuesday, March 14, 2017 at 2:47 PM
> *To: *vtk <vtkusers at vtk.org>
> *Subject: *[vtkusers] Is vtkCutter thread-safe?
>
>
>
> Hi vtkusers,
>
> I have tried to generate N slices from a vtkUnstructuredGrid using
> vtkCutter and OpenMP. The code I used is below. slicePosition and
> sliceNormals are arrays of planes' positions and normals, whereas polys is
> an array of vtkPolyData used to store each cut for a later append operation
> using vtkAppendPolyData.
>
> #pragma omp parallel for
>     for (size_t i = 0; i < numSlices; ++i) {
>         vtkSmartPointer<vtkPlane> slice = vtkSmartPointer<vtkPlane>::
> New();
>         slice->SetOrigin(slicePosition[i].x(), slicePosition[i].y(),
> slicePosition[i].z());
>         slice->SetNormal(sliceNormal[i].x(), sliceNormal[i].y(),
> sliceNormal[i].z());
>         slice->Modified();
>
>         vtkSmartPointer<vtkCutter> cutter = vtkSmartPointer<vtkCutter>::
> New();
>         cutter->SetInputData(m_data);
>         cutter->GenerateTrianglesOff();
>         cutter->ReleaseDataFlagOn();
>         cutter->SetCutFunction(slice);
>         cutter->Update();
>
>         vtkSmartPointer<vtkPolyData> poly =  vtkSmartPointer<vtkPolyData>::
> New();
>         poly->DeepCopy(cutter->GetOutput());
>         poly->Modified();
>         polys[i] = poly;
>     }
>
> This code generates segmentation faults and I would like to know whether
> it is safe to create and deal with a different instance of vtkCutter in
> different threads, as I am trying to do with the macro '#pragma omp
> parallel for'. What I am trying to do is to slice my dataset using a set of
> parallel planes.
>
>
> Thank you in advance for any help.
>
>        Luca Pallozzi Lavorante
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170315/e6aece0d/attachment.html>


More information about the vtkusers mailing list