[vtkusers] Is vtkCutter thread-safe?

Luca Pallozzi Lavorante lplavorante at gmail.com
Wed Mar 15 13:01:04 EDT 2017


Hi Steven, once again, thank you for your reply.
Is there any plan of incorporating  a thread-safe version of vtkCutter into
VTK? I mean, something equivalent to Paraview's  vtkThreeSliceFilter?

  Thank you

     Luca

On Wed, Mar 15, 2017 at 10:40 AM, Luca Pallozzi Lavorante <
lplavorante at gmail.com> wrote:

> I understand. I don't know if this is a silly question, but will this
> class be incorporated into VTK?
>
>   Thank you
>
>      Luca
>
> On Wed, Mar 15, 2017 at 9:46 AM, Hahn, Steven E. <hahnse at ornl.gov> wrote:
>
>> ​Luca,
>>
>>
>> Yes, ParaView's vtkThreeSliceFilter does multiple cuts in different
>> threads.
>>
>> https://gitlab.kitware.com/paraview/paraview/merge_requests/1273
>>
>> Steven
>>
>> ------------------------------
>> *From:* Luca Pallozzi Lavorante <lplavorante at gmail.com>
>> *Sent:* Wednesday, March 15, 2017 7:41 AM
>> *To:* Hahn, Steven E.
>> *Cc:* vtk
>> *Subject:* Re: [vtkusers] Is vtkCutter thread-safe?
>>
>> 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/0ee4e811/attachment-0001.html>


More information about the vtkusers mailing list