[Paraview] How to extract data array tuples using pvpython

David E DeMarle dave.demarle at kitware.com
Wed Apr 7 11:48:31 EDT 2010


You need to call Fetch to bring the real data from the server (even if
it is the builtin server) to the client. Fetch returns a
vtkDataObject, which you can query to get the actual array values out
of.

David E DeMarle
Kitware, Inc.
R&D Engineer
28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-371-3971 x109



On Wed, Apr 7, 2010 at 11:12 AM, Andreas Maier <andi.maier at mytum.de> wrote:
> Hi,
>
> I want to read cell data tuples in pvpython, but somehow I am stuck. My data
> is read from an ensight case file and I can process it until that point when
> I need to access the single tuples of my cell data arrays. Please find an
> extract of my pvpython-code below. Does anyone know how to solve that
> problem? Thanks in advance for your efforts.
>
> Best regards,
>
> Andreas
>
>>from paraview import servermanager, vtk
>>
>>    # Set up connection to the Paraview server
>>if not servermanager.ActiveConnection:
>>       connection = servermanager.Connect()
>>if not connection:
>>       raise exceptions.RuntimeError, "Connection to server failed"
>>
>>    # read ensight source object
>>reader = servermanager.sources.ensight()
>>reader.ByteOrder = 1
>>resultfile = "...._structure_new2.case"
>>reader.CaseFileName = resultfile
>>reader.UpdatePipelineInformation()
>>
>>    # Point to Cell Data
>>ptc = servermanager.filters.PointDataToCellData(Input=reader)
>>ptc.UpdatePipeline()
>>
>>pdi = ptc.GetDataInformation().DataInformation
>>numCells = pdi.GetNumberOfCells()
>>celldata = pdi.GetCellDataInformation()
>>
>>    # here I get my vtkPVArrayInformation
>>vM_array = celldata.GetArrayInformation("vMises_stress")
>>for i in range(numCells):
>>       vMises_str = vM_array.GetTuple1(i) ## <- this does not work
> _______________________________________________
> 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
>


More information about the ParaView mailing list