[vtkusers] Is vtkCutter thread-safe?
Luca Pallozzi Lavorante
lplavorante at gmail.com
Tue Mar 14 14:47:47 EDT 2017
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/20170314/16b64e74/attachment.html>
More information about the vtkusers
mailing list