<div dir="ltr"><div><br></div>I recommend you follow the pattern of the filters Filters/SMP (first appearing vtk 6.1).<div>OpenMP is one of the threading back ends that these filters can use efficiently.<br></div><div><div>

<br></div></div><div class="gmail_extra"><div>David E DeMarle<br>Kitware, Inc.<br>R&D Engineer<br>21 Corporate Drive<br>Clifton Park, NY 12065-8662<br>Phone: <a href="tel:518-881-4909" value="+15188814909" target="_blank">518-881-4909</a></div>


<br><br><div class="gmail_quote">On Mon, Mar 17, 2014 at 4:35 PM, Sunrise <span dir="ltr"><<a href="mailto:helios.corona@gmail.com" target="_blank">helios.corona@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



  

    
  
  <div text="#000000" bgcolor="#FFFFFF">
    Hello,<br>
    <br>
    I would like to parallelize the vtk filter that I wrote using
    OpenMP, and I just started learning OpenMP on a need basis. A part
    of code is a <font face="Courier New, Courier, monospace">for</font>
    loop over tuples of a <font face="Courier New, Courier, monospace">vtkDoubleArray</font>.
    Each tuple is associated with a point on Data. The computation for
    each point is totally independent and embarrassingly
    parallelize-able. A short version of part of the code is<br>
    <font face="Courier New, Courier, monospace"><br>
      vtkDoubleArray *InputArray = ... // Get it from Input Data<br>
      vtkDoubleArray *OutputArray = ... // Define new array</font><br>
    <font face="Courier New, Courier, monospace"><br>
      #pragma omp parallel for<br>
      for(int PointId = 0; PointId <
      InputArray->GetNumberOfTuples(); PointId++)<br>
      {<br>
          double InputValue = InputArray->GetTuple1(PointId);<br>
          double OutputValue = DoSomething(InputValue,OtherParameters);<br>
          OutputArray->SetTuple1(OutputValue);<br>
      }</font><br>
    <br>
    However, I am getting the following error for <font face="Courier
      New, Courier, monospace">GetTuple1()</font> method:<br>
    <br>
    <font face="Courier New, Courier, monospace">ERROR: In
      /SomePath/paraview/ParaView-4.1.0-source/VTK/Common/Core/vtkDataArrayTemplate.txx,
      line 598<br>
      vtkDoubleArray (0x14bf6808): Unable to allocate 1 elements of size
      8 bytes. </font><br>
    <font face="Courier New, Courier, monospace"><br>
      Aborted</font><br>
    <br>
    Could anyone help me to use OpenMP within my filter?<br>
    <br>
    Thank you,<br>
    -Sia<br>
  </div>

<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div></div>