[vtkusers] VTM : Multiblock of DataSet

Antoine Mazuyer amazuyer at stanford.edu
Mon Jul 30 23:39:23 EDT 2018


Hi everyone.


My goal is to have a vtm file witch n Blocks, each block containing some DataSet


With this sample of code , running on MPI with 2 processes,


         vtkSmartPointer<vtkXMLPMultiBlockDataWriter> vtm = vtkXMLPMultiBlockDataWriter::New()

         vtkSmartPointer<vtkMultiBlockDataSet> block= vtkMultiBlockDataSet::New();
         block->SetNumberOfBlocks(4);
         vtkSmartPointer<vtkMultiBlockDataSet> multi_block= vtkMultiBlockDataSet::New();
         multi_block->SetNumberOfBlocks(Communicator::worldSize());
         multi_block->SetBlock(Communicator::worldRank(),block);


         std::string filename = m_name + ".vtm";
         vtm->SetInputData(multi_block);
         vtm->SetFileName(filename.c_str());
         vtm->Write();

I have this output

<?xml version="1.0"?>
<VTKFile type="vtkMultiBlockDataSet" version="1.0" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
  <vtkMultiBlockDataSet>
    <Block index="0">
      <DataSet index="0"/>
      <DataSet index="1"/>
      <DataSet index="2"/>
      <DataSet index="3"/>
    </Block>
    <DataSet index="1"/>
  </vtkMultiBlockDataSet>
</VTKFile>

I don' t understand why I have one Block with 4 DataSets and one DataSet alone.

The result that I expect is :

<?xml version="1.0"?>
<VTKFile type="vtkMultiBlockDataSet" version="1.0" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
  <vtkMultiBlockDataSet>
    <Block index="0">
      <DataSet index="0"/>
      <DataSet index="1"/>
      <DataSet index="2"/>
      <DataSet index="3"/>
    </Block>
    <Block index="1">
      <DataSet index="0"/>
      <DataSet index="1"/>
      <DataSet index="2"/>
      <DataSet index="3"/>
    </Block>
  </vtkMultiBlockDataSet>
</VTKFile>

What am I doing wrong ? How can I achieve to have two blocks (corresponding of the number of MPI processes), each one containing several DataSets ?

Thanks in advance,

Antoine.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20180731/7e07bdb7/attachment.html>


More information about the vtkusers mailing list