<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi Berk,<br>
<br>
On 08/07/2015 10:08 AM, Berk Geveci wrote:<br>
</div>
<blockquote
cite="mid:CAE32kpWvMxdCWz5s9uJQH01arxHJDD=nZUWv2XKwFwP93_C2+Q@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<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>
<br>
-jeff<br>
<blockquote
cite="mid:CAE32kpWvMxdCWz5s9uJQH01arxHJDD=nZUWv2XKwFwP93_C2+Q@mail.gmail.com"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
href="http://www.kitware.com" rel="noreferrer"
target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a
moz-do-not-send="true"
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 moz-do-not-send="true"
href="http://paraview.org/Wiki/ParaView" rel="noreferrer"
target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Search the list archives at: <a moz-do-not-send="true"
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 moz-do-not-send="true"
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>
</body>
</html>