[vtkusers] vtkXdmfReader

David E DeMarle dave.demarle at kitware.com
Sun Dec 13 17:56:41 EST 2015


Some vtkAlgorithms produce more than one thing and you use the port to
specify which thing you want. An example being vtkGaussianCube reader
(molecule = port0, field = port 1).

This reader does not so 0 is what you want.

hth

David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909

On Sun, Dec 13, 2015 at 5:40 PM, Nico Schlömer <nico.schloemer at gmail.com>
wrote:

> Thanks for the reply!
> `GetOutputDataObject` takes a `port` as input argument, and putting `0`
> seems to work, but I don't actually know what I'm doing. Any more hints
> here?
>
> Cheers,
> Nico
>
> On Sun, Dec 13, 2015 at 2:55 PM David E DeMarle <dave.demarle at kitware.com>
> wrote:
>
>> The reader will produce different types of data dependent on the file it
>> reads, so you need to use GetOutputDataObject instead and cast
>> appropriately.
>>
>>
>>
>> David E DeMarle
>> Kitware, Inc.
>> R&D Engineer
>> 21 Corporate Drive
>> Clifton Park, NY 12065-8662
>> Phone: 518-881-4909
>>
>> On Sun, Dec 13, 2015 at 7:36 AM, Nico Schlömer <nico.schloemer at gmail.com>
>> wrote:
>>
>>> Hi everyone,
>>>
>>> I've been using the `vtkUnstructuredGridReader` and the
>>> `vtkXMLUnstructuredGridReader` for a while now to read VTK/VTU meshes, e.g.,
>>> ```
>>>         reader = vtk.vtkUnstructuredGridReader()
>>>         reader.SetFileName(filename)
>>>         reader.Update()
>>>         vtk_mesh = reader.GetOutput()
>>> ```
>>> and then
>>> ```
>>>     points = vtk.util.numpy_support.vtk_to_numpy(
>>>             vtk_mesh.GetPoints().GetData()
>>>             )
>>> ```
>>> etc. From the documentation, it seemed easy enough to phase in the
>>> `vtkXdmfReader`. However,
>>> ```
>>> AttributeError: 'vtkIOXdmf2Python.vtkXdmfReader' object has no attribute
>>> 'GetOutput'
>>> ```
>>> Any hints on how to use the `vtkXdmfReader`?
>>>
>>> Cheers,
>>> Nico
>>>
>>> [1] http://www.vtk.org/doc/nightly/html/classvtkXdmfReader.html
>>>
>>> _______________________________________________
>>> 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 VTK FAQ at:
>>> http://www.vtk.org/Wiki/VTK_FAQ
>>>
>>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://public.kitware.com/mailman/listinfo/vtkusers
>>>
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20151213/db1a7648/attachment.html>


More information about the vtkusers mailing list