<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Title" content="">
<meta name="Keywords" content="">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:Calibri;
color:windowtext;}
span.msoIns
{mso-style-type:export-only;
mso-style-name:"";
text-decoration:underline;
color:teal;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body bgcolor="white" lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">Hi Luca,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">Are you using master? Last week I added a merge request making vtkCutter thread-safe.<br>
<br>
<a href="https://gitlab.kitware.com/vtk/vtk/merge_requests/2541">https://gitlab.kitware.com/vtk/vtk/merge_requests/2541</a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">Steven<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-family:Calibri;color:black">From: </span>
</b><span style="font-family:Calibri;color:black">vtkusers <vtkusers-bounces@vtk.org> on behalf of Luca Pallozzi Lavorante <lplavorante@gmail.com><br>
<b>Date: </b>Tuesday, March 14, 2017 at 2:47 PM<br>
<b>To: </b>vtk <vtkusers@vtk.org><br>
<b>Subject: </b>[vtkusers] Is vtkCutter thread-safe?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Hi vtkusers,<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">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.<br>
<br>
#pragma omp parallel for<br>
for (size_t i = 0; i < numSlices; ++i) {<br>
vtkSmartPointer<vtkPlane> slice = vtkSmartPointer<vtkPlane>::New();<br>
slice->SetOrigin(slicePosition[i].x(), slicePosition[i].y(), slicePosition[i].z());<br>
slice->SetNormal(sliceNormal[i].x(), sliceNormal[i].y(), sliceNormal[i].z());<br>
slice->Modified();<br>
<br>
vtkSmartPointer<vtkCutter> cutter = vtkSmartPointer<vtkCutter>::New();<br>
cutter->SetInputData(m_data);<br>
cutter->GenerateTrianglesOff();<br>
cutter->ReleaseDataFlagOn();<br>
cutter->SetCutFunction(slice);<br>
cutter->Update();<br>
<br>
vtkSmartPointer<vtkPolyData> poly = vtkSmartPointer<vtkPolyData>::New();<br>
poly->DeepCopy(cutter->GetOutput());<br>
poly->Modified();<br>
polys[i] = poly;<br>
}<br>
<br>
<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">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.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
Thank you in advance for any help.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> Luca Pallozzi Lavorante<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</body>
</html>