What you are doing to the DataObjectGenerator and Fetch command isn't going
to work out.  Fetch is creating a copy, it's not giving you access to the
real data object.

Here is a trick you can do, it only works if you are running paraview with a
builtin server.  A real, true builtin server, not the fancy new mpi builtin
server.  When client and server share the same memory space, you can use
GetClientSideObject() to get the "server side" vtk object belonging to a
paraview object.

mb = get_manipulated_vtkmultiblock_from_someplace()

t = TrivialProducer()
filter = t.GetClientSideObject()  # filter is a vtkTrivialProducer
filter.SetOutput(mb)
t.UpdatePipeline()

Now you can attach paraview filters to the trivial producer.

Pat

On Wed, Feb 9, 2011 at 4:59 PM, Tim Gallagher <tim.gallag...@gatech.edu>wrote:

> We had looked at the programmable source, but we didn't know how to access
> the XDMFReader. But, with what you pointed out, it looks like that isn't
> hard so I'll give it a shot.
>
> Out of curiosity, what is wrong with the approach I was trying? Is it
> possible to completely copy information from one source in a pipeline into
> another source in a pipeline and delete the original source? Why does
> Fetch() show data inside the DataObjectGenerator but no filter can seem to
> access it?
>
> Thanks for the help,
>
> Tim
>
> ------------------------------
> *From: *"pat marion" <pat.mar...@kitware.com>
> *To: *gtg0...@mail.gatech.edu
> *Cc: *paraview@paraview.org
> *Sent: *Wednesday, February 9, 2011 4:55:05 PM
> *Subject: *Re: [Paraview] Scripting and new VTK objects
>
>
> Hi Tim,
>
> Have you looked at the python programmable source?  With the python
> programmable source you can specify python code to run on the server side.
> You won't be able to use paraview python api though.  Instead of
>
> XDMFReader(FileName=...)
>
> it would look like:
>
> reader = vtkXDMFReader()
> reader.SetFileName(...)
> reader.Update()
> data = reader.GetOutput()
>
> You can find examples of the python programmable source:
>
>
> http://www.paraview.org/Wiki/Python_Programmable_Filter#Generating_Data_.28Programmable_Source.29
>
> http://www.paraview.org/Wiki/Here_are_some_more_examples_of_simple_ParaView_3_python_filters
> .
>
> Pat
>
> On Wed, Feb 9, 2011 at 4:20 PM, Tim Gallagher <tim.gallag...@gatech.edu>wrote:
>
>> Hi,
>>
>> I've searched online at length for this and couldn't find the answer, so
>> hopefully somebody here can help me.
>>
>> I am trying to create a new VTK object (vtkMultiBlockDataSet) composed of
>> portions of manipulated data from some other VTK object (in this case, a
>> vtkStructuredGrid). I then want to delete the vtkStructuredGrid object and
>> visualize the new vtkMultiBlockDataSet.
>>
>> So, here's the general outline of what I do in a python script:
>>
>> newSource = DataGeneratorObject(Program="MB{}")
>> newSource.UpdatePipeline()
>>
>> newData = servermanager.Fetch(newSource)
>> newData.SetNumberOfBlocks(64)
>>
>> for n in range(0,64):
>>    myData = XDMFReader(FileName=...)
>>    myData.UpdatePipeline()
>>
>>    localData = servermanager.Fetch(myData)
>>
>>    <manipulate the data>
>>
>>    newData.SetBlock(n,vtk.vtkStructuredGrid())
>>    newData.GetBlock(n).DeepCopy(localData)
>>
>>    Delete(localData)
>>    Delete(myData)
>>
>> newData.DataHasBeenGenerated()
>> newSource.UpdatePipelineInformation()
>> newSource.UpdatePipeline()
>>
>> With all that done, if I try to apply a filter to newSource, it doesn't
>> work. The data is definitely inside newData -- I can print it out and such,
>> even after I delete the localData (which is why I used DeepCopy).
>>
>> But I don't know how to send that data back to the server. Or, maybe I
>> don't need the DataObjectGenerator -- if that's the case, how do I create a
>> local VTK object and then send it to the server to visualize?
>>
>> Hopefully that example is clear... I appreciate any help you guys can
>> provide. It would be easiest if I could create my own custom reader, but I
>> can't do that because we use Paraview on a lot of machines that we can't
>> recompile to include the new plugin.
>>
>> Thanks,
>>
>> Tim
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the ParaView Wiki at:
>> http://paraview.org/Wiki/ParaView
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.paraview.org/mailman/listinfo/paraview
>>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview
>
>
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview

Reply via email to