[vtkusers] get unstructured grid from vtkXdmf3Reader

Nico Schlömer nico.schloemer at gmail.com
Fri Jun 19 14:00:07 EDT 2015


Thanks David for the reply.

> Probably a bug that it reports 0 when you have a single atomic ("uniform"
in xdmf terms of "vtkDataSet" in vtk terms) grid.

I'll file a report for this.

Cheers,
Nico

On Fri, Jun 19, 2015 at 3:33 AM David E DeMarle <dave.demarle at kitware.com>
wrote:

> Hi Nico,
>
> That is for multi-block xdmf files. If you happen to have a file with
> several blocks in it it will return the correct number (try IronProtein
> from the paraview regression test data). Probably a bug that it reports 0
> when you have a single atomic ("uniform" in xdmf terms of "vtkDataSet" in
> vtk terms) grid.
>
> I don't happen to have a small example of its use in VTK. In ParaView it
> is used in the Block selection part of the object inspector when you open
> the xdmf file.
>
> hth
>
>
>
>
>
> David E DeMarle
> Kitware, Inc.
> R&D Engineer
> 21 Corporate Drive
> Clifton Park, NY 12065-8662
> Phone: 518-881-4909
>
> On Tue, Jun 16, 2015 at 9:04 AM, Nico Schlömer <nico.schloemer at gmail.com>
> wrote:
>
>> Apparently,
>> ```
>>  xreader->GetNumberOfGrids()
>> ```
>> doesn't say much. One can simply
>> ```
>>   vtkDataObject *rOutput = xreader->GetOutputDataObject(0);
>>   TEUCHOS_ASSERT(rOutput != nullptr);
>>   vtkUnstructuredGrid * m = dynamic_cast<vtkUnstructuredGrid*>(rOutput);
>>   TEUCHOS_ASSERT(m != nullptr);
>> ```
>> which gives you a pointer to the vtkUnstructuredGrid, if there is one.
>>
>> Cheers,
>> Nico
>>
>
>> On Tue, Jun 16, 2015 at 1:46 PM, Nico Schlömer <nico.schloemer at gmail.com>
>> wrote:
>> > Hi everyone,
>> >
>> > I have an XDMF file which I'm reading with vtk::vtkXdmf3Reader,
>> > ```
>> >   vtkXdmf3Reader *xreader = vtkXdmf3Reader::New();
>> >   xreader->SetFileName("data/brick-w-hole.xmf");
>> >   xreader->Update();
>> > ```
>> > and I would like to get the corresponding vtk::UnstructuredGrid from
>> > this. For some reason, however,
>> > ```
>> >  xreader->GetNumberOfGrids()
>> > ```
>> > returns 0. Also, I wouldn't know how to retrieve the grid if there was
>> one.
>> >
>> > Is there example code for this around?
>> >
>> > Cheers,
>> > Nico
>>
> _______________________________________________
>> 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/20150619/37eed909/attachment.html>


More information about the vtkusers mailing list