MantisBT - VTK
View Issue Details
0012994VTK(No Category)public2012-03-14 03:582015-01-09 13:53
nikolay.zhavoronok 
Utkarsh Ayachit 
normalminorhave not tried
closedfixed 
5.8.0 
6.0.0 
TBD
incorrect functionality
0012994: vtkXMLMultiBlockDataWriter does not write names for leaf nodes of the multiblock dataset
The following code will assign the name for 0 block, but will not write this name into vtu file:
============================================
vtkNew<vtkUnstructuredGrid> ugrid;
vtkNew<vtkMultiBlockDataSet> mb;
mb->SetNumberOfBlocks( 1 );
mb->SetBlock( 0, ugrid.GetPointer() );
mb->GetMetaData( 0 )->Set(vtkCompositeDataSet::NAME(), "My Material 1");
mb->GetMetaData( 0 )->Print( std::cout ); // for debuggin to see the name
vtkXMLMultiBlockDataWriter *writer = vtkXMLMultiBlockDataWriter::New();
writer->SetInput( mb.GetPointer() );
writer->SetFileName("test.vtm");
writer->Write();
============================================
The problem is inside vtkXMLMultiBlockDataWriter.cxx, int vtkXMLMultiBlockDataWriter::WriteComposite method iterates over multiblock data set items, and writes names only for vtkCompositeDataSet datasets.

The fix looks easy, I am attaching the fixed file.

VTK Reader & Paraview support reading of leaf dataset names correctly, so the problem is only in writer.

Thanks,
Nikolay
No tags attached.
cxx vtkXMLMultiBlockDataWriter.cxx (4,382) 2012-03-14 03:58
https://www.vtk.org/Bug/file/9132/vtkXMLMultiBlockDataWriter.cxx
Issue History
2012-03-14 03:58nikolay.zhavoronokNew Issue
2012-03-14 03:58nikolay.zhavoronokFile Added: vtkXMLMultiBlockDataWriter.cxx
2012-03-29 17:10Utkarsh AyachitAssigned To => Utkarsh Ayachit
2012-03-29 17:10Utkarsh AyachitStatusbacklog => tabled
2012-03-29 17:22Utkarsh AyachitNote Added: 0028407
2012-03-29 17:23Utkarsh AyachitNote Added: 0028408
2012-03-29 17:23Utkarsh AyachitStatustabled => gatekeeper review
2012-03-29 17:23Utkarsh AyachitResolutionopen => fixed
2013-05-17 13:53Utkarsh AyachitNote Added: 0030795
2013-07-22 19:39Dave DeMarleStatusgatekeeper review => closed
2013-07-22 19:39Dave DeMarleFixed in Version => 6.0.0
2015-01-09 13:48Utkarsh AyachitSource_changeset_attached => VTK master 77b0673c
2015-01-09 13:48Utkarsh AyachitSource_changeset_attached => VTK master 3a192370
2015-01-09 13:53Utkarsh AyachitSource_changeset_attached => VTK master 3f2b5202

Notes
(0028407)
Utkarsh Ayachit   
2012-03-29 17:22   
commit aca416248b949c0bb76863a68914e18b9a009a98
Author: Utkarsh Ayachit <utkarsh.ayachit@kitware.com>
Date: Thu Mar 29 17:19:50 2012 -0400

    BUG 0012994. vtkXMLMultiBlockDataWriter not writing names for leaf nodes.
    
    vtkXMLMultiBlockDataWriter was not saving out names for leaf nodes the the
    mulitblock dataset. Names were only being saved for non-leaf nodes. Fixed that.
    
    Change-Id: Ie3ce7e735f7349c517078d4135bc8cb5446486a6
(0028408)
Utkarsh Ayachit   
2012-03-29 17:23   
awaiting gerrit review.
(0030795)
Utkarsh Ayachit   
2013-05-17 13:53   
Not sure how the old topic was lost. Adding a new one.

Attempt #2: http://review.source.kitware.com/#/t/2775/ [^]