Ok, it seems that the programmable source is not my ideal solution but it may serve, I will try playing around with it. The coprocessing library looks closer to what I had in mind, thanks for the suggestion! I will check it out. If I make progress I will report back here on my experiences.<br>




<br><div class="gmail_quote">On Tue, Jun 19, 2012 at 1:56 PM, David E DeMarle <span dir="ltr">&lt;<a href="mailto:dave.demarle@kitware.com" target="_blank">dave.demarle@kitware.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div>On Tue, Jun 19, 2012 at 7:24 AM, Gertjan van Zwieten<br>
&lt;<a href="mailto:gertjanvanzwieten@gmail.com" target="_blank">gertjanvanzwieten@gmail.com</a>&gt; wrote:<br>
&gt; Hi Hal, thanks for your quick reply and the example code. That&#39;s very<br>
&gt; helpful. I do have these remaining questions that perhaps you could help me<br>
&gt; with:<br>
&gt;<br>
&gt; In your experience, is a programmable source a suitable place to call a<br>
&gt; potentially long running finite element code?<br>
<br>
</div>ParaView is single threaded so the GUI will be non-responsive while<br>
the simulation runs unless you get very creative.<br>
<div><br>
&gt; Is it possible to update the data structure while it is already being<br>
&gt; displayed, that is, before the script finishes?<br>
<br>
</div>There is no support in ParaView for this. The primary reasons being<br>
its single threaded nature and pull pipeline architecture. It can and<br>
has been done before (with open source all things are possible given<br>
time) but it took significant effort and was never done robustly<br>
enough to make it into the official code repository. Search the<br>
mailing list for livedata and coprocessing for discussions on this<br>
topic.<br>
<div><br>
&gt; And is it possible to have a programmable source output multiple data sets<br>
&gt; if necessary?<br>
<br>
</div>Hal is right, the right thing to do is produce vtkMultiblockData.<br>
<br>
&gt;<br>
&gt; Thanks again!<br>
&gt; Gertjan<br>
&gt;<br>
<br>
You should also investigate ParaView&#39;s coprocessing library as an option.<br>
<a href="http://paraview.org/Wiki/CoProcessing" target="_blank">http://paraview.org/Wiki/CoProcessing</a><br>
<div><div><br>
&gt;<br>
&gt; On Tue, Jun 19, 2012 at 12:44 PM, Hal Canary &lt;<a href="mailto:hal@cs.unc.edu" target="_blank">hal@cs.unc.edu</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; On 06/19/2012 06:10 AM, Gertjan van Zwieten wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; [...]<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; So my question is simply if it is possible to inject objects from python<br>
&gt;&gt;&gt; into an already running or separately spawned paraview instance? If so,<br>
&gt;&gt;&gt; any pointers in that direction (an example script?) would of course be<br>
&gt;&gt;&gt; enormously helpful.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; I use a programmable source.  Here&#39;s a macro to create an image:<br>
&gt;&gt;<br>
&gt;&gt; #####################<br>
&gt;&gt; script=&quot;&quot;&quot;<br>
&gt;&gt; image = self.GetImageDataOutput()<br>
&gt;&gt; image.SetSpacing(0.01,0.01,0.01)<br>
&gt;&gt; image.SetOrigin(0,0,0)<br>
&gt;&gt; image.SetDimensions(101,101,101)<br>
&gt;&gt; array = numpy.zeros((101,101,101,), dtype=numpy.float32)<br>
&gt;&gt; space = numpy.linspace(0,1,101)<br>
&gt;&gt; for i,x in enumerate(space):<br>
&gt;&gt;        for j,y in enumerate(space):<br>
&gt;&gt;                for k,z in enumerate(space):<br>
&gt;&gt;                        array[i,j,k] = (math.sin(4*x)<br>
&gt;&gt;                                + math.sin(4*y) + math.sin(4*z))<br>
&gt;&gt; image.GetPointData().AddArray(<br>
&gt;&gt;        paraview.vtk.dataset_adapter.numpyTovtkDataArray(<br>
&gt;&gt;                array.reshape(101*101*101), name=&quot;myarray&quot;))<br>
&gt;&gt; &quot;&quot;&quot;<br>
&gt;&gt; script_request_information = &quot;&quot;&quot;<br>
&gt;&gt; from paraview import util<br>
&gt;&gt; util.SetOutputWholeExtent(self, [0, 100, 0, 100, 0, 100])<br>
&gt;&gt; &quot;&quot;&quot;<br>
&gt;&gt; ps = ProgrammableSource(<br>
&gt;&gt;  guiName=&quot;My Source&quot;,<br>
&gt;&gt;  Script=script,<br>
&gt;&gt;  ScriptRequestInformation=script_request_information,<br>
&gt;&gt;  OutputDataSetType=&#39;vtkImageData&#39; )<br>
&gt;&gt; Show(ps)<br>
&gt;&gt; ###################################<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;&gt;<br>
&gt;&gt; Visit other Kitware open-source projects at<br>
&gt;&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;&gt;<br>
&gt;&gt; Please keep messages on-topic and check the ParaView Wiki at:<br>
&gt;&gt; <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
&gt;&gt;<br>
&gt;&gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt; <a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; Visit other Kitware open-source projects at<br>
&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;<br>
&gt; Please keep messages on-topic and check the ParaView Wiki at:<br>
&gt; <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
&gt;<br>
</div></div></blockquote></div><br>