<div dir="ltr">Hi Jeff,<div><br></div><div>I commented that line out to mainly remove the SetExtent() call. When you set the <span style="font-size:12.8000001907349px"> </span><span style="font-size:12.8000001907349px">CAN_HANDLE_PIECE_REQUEST() key instead of the </span><span style="font-size:12.8000001907349px">CAN_PRODUCE_SUB_EXTENT() key, the filter is no longer passed an update extent local to the MPI rank it is on. Rather it is passed a global update extent and is asked to partition it as it sees fit. This means that you can no longer do</span></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">imageData.SetExtent(updateExtent)</span><br></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">Rather, you have to do:</span></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">self.GetOutput().ShallowCopy(xmit,GetOutput())</span><br></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">This copy will copy the extent from the xmit filter's output. The transmit filter internally decides on a partition so you need to use that.</span></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">For reference to others that may be following this thread, I recommended to Jeff that he uses the Nrrd reader, which uses MPI-IO to read raw files (structured datasets). It is a more efficient approach.</span></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">Best,</span></div><div><span style="font-size:12.8000001907349px">-berk</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 7, 2015 at 2:22 PM, Jeff Becker <span dir="ltr"><<a href="mailto:jeffrey.c.becker@nasa.gov" target="_blank">jeffrey.c.becker@nasa.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div>Hi again. I have a quick question
      below.<span class=""><br>
      <br>
      On 08/07/2015 10:47 AM, Jeff Becker wrote:<br>
    </span></div><span class="">
    <blockquote type="cite">
      
      <div>Hi Berk,<br>
        <br>
        On 08/07/2015 10:08 AM, Berk Geveci wrote:<br>
      </div>
      <blockquote type="cite">
        <div dir="ltr">Hey Jeff,
          <div><br>
          </div>
          <div>Can you clarify a bit? What kind of wrong is the output?</div>
        </div>
      </blockquote>
      <br>
      I have an updated report in the mail I sent to the list on
      Wednesday. I will forward you that directly.  Please see updated
      code in that mail. Right now, if I run my script on two
      processors, it looks like both processors get the same half of the
      data.<br>
      <br>
      In the meantime, I will try to incorporate your suggestion below.
      Thanks.<br>
    </blockquote>
    <br></span>
    In your version of my code below, you commented out the line:<br>
    <br>
    imagedata = self.GetOutput()<br>
    <br>
    I was using the example in:<br>
    <br>
<a href="http://www.paraview.org/Wiki/ParaView/Simple_ParaView_3_Python_Filters#Producing_Image_Data_.28Source.29" target="_blank">http://www.paraview.org/Wiki/ParaView/Simple_ParaView_3_Python_Filters#Producing_Image_Data_.28Source.29</a><br>
    <br>
    Instead should I generate a new vtkImageData instance?<br>
    <br>
    <br>
    Thanks again,<br>
    <br>
    -jeff<div><div class="h5"><br>
    <blockquote type="cite"> <br>
      -jeff<br>
      <blockquote type="cite">
        <div dir="ltr">
          <div><br>
          </div>
          <div>Also, I would probably do this a bit differently,
            assuming you use a newer ParaView (>= 4.2). The issue is
            that <span style="font-size:12.8000001907349px">vtkTransmitImageDataPiece

              is not a "CAN_PRODUCE_SUB_EXTENT()" filter. Rather it is a
              "CAN_HANDLE_PIECE_REQUEST()" filter. Meaning that it wants
              to determine the extents of the output based on the piece
              request it receives. So some changes:</span></div>
          <div><span style="font-size:12.8000001907349px"><br>
            </span></div>
          <div><span style="font-size:12.8000001907349px">* Swap </span><span style="font-size:12.8000001907349px">CAN_PRODUCE_SUB_EXTENT()

              with </span><span style="font-size:12.8000001907349px">CAN_HANDLE_PIECE_REQUEST()

              in request info.</span></div>
          <div><span style="font-size:12.8000001907349px">* In the main
              script, do something like this:</span></div>
          <div><span style="font-size:12.8000001907349px"><br>
            </span></div>
          <div><span style="font-size:12.8000001907349px">executive =
              self.GetExecutive()</span><br style="font-size:12.8000001907349px">
            <span style="font-size:12.8000001907349px">outInfo =
              executive.GetOutputInformation</span><span style="font-size:12.8000001907349px">(0)</span><br style="font-size:12.8000001907349px">
            <span style="font-size:12.8000001907349px">#updateExtent =
              [executive.UPDATE_EXTENT().Get</span><span style="font-size:12.8000001907349px">(outInfo, i) for i in
              xrange(6)]</span><br style="font-size:12.8000001907349px">
            <span style="font-size:12.8000001907349px">#imageData =
              self.GetOutput()</span><br style="font-size:12.8000001907349px">
            <span style="font-size:12.8000001907349px">#imageData.SetExtent(updateExte</span><span style="font-size:12.8000001907349px">nt)</span></div>
          <div># >> this probably needs to happen on rank 0 only<br style="font-size:12.8000001907349px">
            <span style="font-size:12.8000001907349px">myout =
              ns.numpy_to_vtk(bmag.ravel(),1</span><span style="font-size:12.8000001907349px">,vtk.VTK_FLOAT)</span><br style="font-size:12.8000001907349px">
            <span style="font-size:12.8000001907349px">myout.SetName("B
              field magnitude")</span><br style="font-size:12.8000001907349px">
            <span style="font-size:12.8000001907349px">imageData.GetPointData().SetSc</span><span style="font-size:12.8000001907349px">alars(myout)</span><br style="font-size:12.8000001907349px">
            <span style="font-size:12.8000001907349px">tp =
              vtk.vtkTrivialProducer()</span><br style="font-size:12.8000001907349px">
            <span style="font-size:12.8000001907349px">tp.SetOutput(imageData)</span><br style="font-size:12.8000001907349px">
            <span style="font-size:12.8000001907349px">tp.SetWholeExtent(0,

              mesh.MX-1, 0, mesh.MY-1, 0, mesh.MZ-1)</span><br style="font-size:12.8000001907349px">
            <span style="font-size:12.8000001907349px">xmit =
              vtk.vtkTransmitImageDataPiece(</span><span style="font-size:12.8000001907349px">)</span><br style="font-size:12.8000001907349px">
            <span style="font-size:12.8000001907349px">xmit.SetInputConnection(tp.Get</span><span style="font-size:12.8000001907349px">OutputPort())</span><br style="font-size:12.8000001907349px">
            <span style="font-size:12.8000001907349px">xmit.UpdateInformation()</span><br style="font-size:12.8000001907349px">
            <span style="font-size:12.8000001907349px">xmit.SetUpdateExtent(rank,

              nranks, 0)</span><br style="font-size:12.8000001907349px">
            <span style="font-size:12.8000001907349px">xmit.Update()</span><span style="font-size:12.8000001907349px"><br>
            </span></div>
          <div><span style="font-size:12.8000001907349px">self.GetOutput().ShallowCopy(xmit,GetOutput())</span></div>
          <div><span style="font-size:12.8000001907349px"><br>
            </span></div>
          <div><span style="font-size:12.8000001907349px">I didn't
              verify the code so it may need tweaking.</span></div>
          <div><span style="font-size:12.8000001907349px"><br>
            </span></div>
          <div><span style="font-size:12.8000001907349px">Best,</span></div>
          <div><span style="font-size:12.8000001907349px">-berk</span></div>
          <div><span style="font-size:12.8000001907349px"><br>
            </span></div>
        </div>
        <div class="gmail_extra"><br>
          <div class="gmail_quote">On Tue, Aug 4, 2015 at 2:14 PM, Jeff
            Becker <span dir="ltr"><<a href="mailto:jeffrey.c.becker@nasa.gov" target="_blank">jeffrey.c.becker@nasa.gov</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi. I'm
              trying to run a Python Programmable source across four
              nodes (started with mpirun -np 4 pvserver). My script
              contains the following code, but the output looks wrong,
              so I'm not sure if the extents are right.  The
              partitioning among nodes is correct (using processId
              filter). Also I'm careful to set Output Data Set Type to
              vtkImageData.<br>
              <br>
              import vtk<br>
              import vtk.util.numpy_support as ns<br>
              contr =
              vtk.vtkMultiProcessController.GetGlobalController()<br>
              nranks = contr.GetNumberOfProcesses()<br>
              rank = contr.GetLocalProcessId()<br>
              <br>
              ...<br>
              executive = self.GetExecutive()<br>
              outInfo = executive.GetOutputInformation(0)<br>
              updateExtent = [executive.UPDATE_EXTENT().Get(outInfo, i)
              for i in xrange(6)]<br>
              imageData = self.GetOutput()<br>
              imageData.SetExtent(updateExtent)<br>
              myout = ns.numpy_to_vtk(bmag.ravel(),1,vtk.VTK_FLOAT)<br>
              myout.SetName("B field magnitude")<br>
              imageData.GetPointData().SetScalars(myout)<br>
              tp = vtk.vtkTrivialProducer()<br>
              tp.SetOutput(imageData)<br>
              tp.SetWholeExtent(0, mesh.MX-1, 0, mesh.MY-1, 0,
              mesh.MZ-1)<br>
              xmit = vtk.vtkTransmitImageDataPiece()<br>
              xmit.SetInputConnection(tp.GetOutputPort())<br>
              xmit.UpdateInformation()<br>
              xmit.SetUpdateExtent(rank, nranks, 0)<br>
              xmit.Update()<br>
              <br>
              For completeness, here is my requestInformation script
              (mesh has dimensions, and coordinate arrays for each of
              X,Y,Z)<br>
              <br>
              executive = self.GetExecutive()<br>
              outInfo = executive.GetOutputInformation(0)<br>
              outInfo.Set(vtk.vtkAlgorithm.CAN_PRODUCE_SUB_EXTENT(), 1)<br>
              outInfo.Set(executive.WHOLE_EXTENT(), 0, mesh.MX-1, 0,
              mesh.MY-1, 0, mesh.MZ-1)<br>
              xspacing = (mesh.xcoords[-1] - mesh.xcoords[0])/mesh.MX<br>
              yspacing = (mesh.ycoords[-1] - mesh.ycoords[0])/mesh.MY<br>
              zspacing = (mesh.zcoords[-1] - mesh.zcoords[0])/mesh.MZ<br>
              outInfo.Set(vtk.vtkDataObject.SPACING(), xspacing,
              yspacing, zspacing)<br>
              <br>
              This is what I've been able to come up with after spending
              much time reading documentation and examples, but I've
              obviously missed something. Please advise. Thanks.<br>
              <br>
              -jeff<br>
              <br>
              _______________________________________________<br>
              Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
              <br>
              Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
              <br>
              Please keep messages on-topic and check the ParaView Wiki
              at: <a href="http://paraview.org/Wiki/ParaView" rel="noreferrer" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
              <br>
              Search the list archives at: <a href="http://markmail.org/search/?q=ParaView" rel="noreferrer" target="_blank">http://markmail.org/search/?q=ParaView</a><br>
              <br>
              Follow this link to subscribe/unsubscribe:<br>
              <a href="http://public.kitware.com/mailman/listinfo/paraview" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/paraview</a><br>
            </blockquote>
          </div>
          <br>
        </div>
      </blockquote>
      <br>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a>

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>

Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a>

Search the list archives at: <a href="http://markmail.org/search/?q=ParaView" target="_blank">http://markmail.org/search/?q=ParaView</a>

Follow this link to subscribe/unsubscribe:
<a href="http://public.kitware.com/mailman/listinfo/paraview" target="_blank">http://public.kitware.com/mailman/listinfo/paraview</a>
</pre>
    </blockquote>
    <br>
  </div></div></div>

</blockquote></div><br></div>