[vtkusers] Can I use XDMF as a container for a set of vtkDataSets?

David E DeMarle dave.demarle at kitware.com
Thu Dec 15 15:24:10 EST 2016


not clear yet why that would go wrong. What does stack trace say?

Also, before calling Write(), call m_mds->PrintSelf() to verify that the
multiblock has what you expect in it.

Could also debug by trying one of VTK's other writers (perhaps
vtkXMLMultiBlockDataWriter for example) and see if that also fails.


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

On Thu, Dec 15, 2016 at 3:10 PM, Patricio Palma C. <patriciop at gmail.com>
wrote:

> Hi Dave
>
> I've modified the classes to use a multiblock dataset, however it' seems
> there is something  wrong with the writer  since it crashes when Write()
> method is called.
>
> This is a part of the code:
>
> class X {
>
> // this are the member definition
> vtkSmartPointer<vtkXdmfWriter> m_writer;
> vtkSmartPointer<vtkMultiBlockDataSet> m_mds;
> int m_index;
> .
>
> X::X() : m_writer(vtkSmartPointer<vtkXdmfWriter>::New()),
> M_mds(vtkSmartPointer<vtkMultiBlockDataSet>::New()),
> m_index(0) { }
>
>
> void X::addData(vtkDataSet* data)
> {
>   m_mds->SetBlock(m_index++, data);
> }
>
> void X::finishAndWrite()
> {
>   m_writer->SetFileName("outputfile.xfm");
>   m_writer->SetInputData(m_mds);
>   m_writer->Write(); // the application crashes here
> }
>
> };
>
> I pass each dataset with addData() and  at the end I call
> finishAndWrite(). I'm not sure what I am doing wrong.
>
>
> Thanks
>
> On Thu, Dec 15, 2016 at 8:25 AM, David E DeMarle <dave.demarle at kitware.com
> > wrote:
>
>> Yes. Gather them together into a multblock first and then write that.
>>
>> On Dec 15, 2016 2:11 AM, "Patricio Palma C." <patriciop at gmail.com> wrote:
>>
>>> Hi experts
>>>
>>> ​I would like to export a set of vtkUnstructuredGrids and vtkPolyDatas
>>> to a file in XDMF format by using vtkXdmfWriter. For the moment I've
>>> managed to generate a XDMF output for each vtkUnstructuredGrids and
>>> vtkPolydata object, which is a a bit cumbersome (a lot of files :) ).
>>>
>>> My expectation is to get only one XDMF file with the description of the
>>> each dataset and one .H5 file with  the data (points, cells, data
>>> attributes) of the datasets.
>>>
>>> Is it possible to do that with vtkXdfmWriter?
>>>
>>>>>> Thanks​
>>> --
>>> Patricio Palma Contreras
>>>
>>> _______________________________________________
>>> 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
>>>
>>>
>
>
> --
> Patricio Palma Contreras
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161215/3b661203/attachment.html>


More information about the vtkusers mailing list