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"><<a href="mailto:dave.demarle@kitware.com" target="_blank">dave.demarle@kitware.com</a>></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>
<<a href="mailto:gertjanvanzwieten@gmail.com" target="_blank">gertjanvanzwieten@gmail.com</a>> wrote:<br>
> Hi Hal, thanks for your quick reply and the example code. That's very<br>
> helpful. I do have these remaining questions that perhaps you could help me<br>
> with:<br>
><br>
> In your experience, is a programmable source a suitable place to call a<br>
> 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>
> Is it possible to update the data structure while it is already being<br>
> 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>
> And is it possible to have a programmable source output multiple data sets<br>
> if necessary?<br>
<br>
</div>Hal is right, the right thing to do is produce vtkMultiblockData.<br>
<br>
><br>
> Thanks again!<br>
> Gertjan<br>
><br>
<br>
You should also investigate ParaView'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>
><br>
> On Tue, Jun 19, 2012 at 12:44 PM, Hal Canary <<a href="mailto:hal@cs.unc.edu" target="_blank">hal@cs.unc.edu</a>> wrote:<br>
>><br>
>> On 06/19/2012 06:10 AM, Gertjan van Zwieten wrote:<br>
>>><br>
>>> [...]<br>
>>><br>
>>> So my question is simply if it is possible to inject objects from python<br>
>>> into an already running or separately spawned paraview instance? If so,<br>
>>> any pointers in that direction (an example script?) would of course be<br>
>>> enormously helpful.<br>
>><br>
>><br>
>> I use a programmable source. Here's a macro to create an image:<br>
>><br>
>> #####################<br>
>> script="""<br>
>> image = self.GetImageDataOutput()<br>
>> image.SetSpacing(0.01,0.01,0.01)<br>
>> image.SetOrigin(0,0,0)<br>
>> image.SetDimensions(101,101,101)<br>
>> array = numpy.zeros((101,101,101,), dtype=numpy.float32)<br>
>> space = numpy.linspace(0,1,101)<br>
>> for i,x in enumerate(space):<br>
>> for j,y in enumerate(space):<br>
>> for k,z in enumerate(space):<br>
>> array[i,j,k] = (math.sin(4*x)<br>
>> + math.sin(4*y) + math.sin(4*z))<br>
>> image.GetPointData().AddArray(<br>
>> paraview.vtk.dataset_adapter.numpyTovtkDataArray(<br>
>> array.reshape(101*101*101), name="myarray"))<br>
>> """<br>
>> script_request_information = """<br>
>> from paraview import util<br>
>> util.SetOutputWholeExtent(self, [0, 100, 0, 100, 0, 100])<br>
>> """<br>
>> ps = ProgrammableSource(<br>
>> guiName="My Source",<br>
>> Script=script,<br>
>> ScriptRequestInformation=script_request_information,<br>
>> OutputDataSetType='vtkImageData' )<br>
>> Show(ps)<br>
>> ###################################<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<br>
>> <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 ParaView Wiki at:<br>
>> <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
>><br>
>> Follow this link to subscribe/unsubscribe:<br>
>> <a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
><br>
><br>
><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<br>
> <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 ParaView Wiki at:<br>
> <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
><br>
</div></div></blockquote></div><br>