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

Patricio Palma C. patriciop at gmail.com
Thu Dec 15 15:10:06 EST 2016


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/dfdc6059/attachment.html>


More information about the vtkusers mailing list