[vtkusers] vtk.vtkExodusIIReader: information in GetOutput()?

David Thompson dcthomp at sandia.gov
Mon Dec 6 15:21:31 EST 2010


> ... when reading an ExodusII file with
>   reader = vtk.vtkExodusIIReader()
>   reader.Update()
>   out = reader.GetOutput()
> 'out' would contain a whole lot of output the significance of which  
> I don't quite understant;

Hi Nico,

The old vtkExodusReader used to output a single unstructured grid.  
This made it difficult to handle the case when a variable was defined  
on some cells (in one element block) but not on others (in a different  
element block). It was also awkward to provide information about node  
sets and face sets. At the time, there was also no concept of pedigree  
and global ID arrays in vtkDataSetAttributes. This made writing Exodus  
datasets back out to a file after some manipulation difficult since  
much of the information in the original file could not be preserved.  
The vtkExodusModel and vtkModelMetadata classes were attempts to  
encapsulate some of that information for later access by a writer.

The new vtkExodusIIReader outputs a multiblock dataset. Each  
multiblock dataset may have an arbitrary number of blocks, where each  
block is a arbitary dataset (an unstructured grid, an image, or even  
another multiblock dataset). The new reader outputs a multiblock  
dataset where each of the top-level blocks is itself a multiblock  
dataset holding unstructured grids of a single type (element blocks,  
face blocks, edge blocks, element sets, side sets, face sets, edge  
sets, node sets). When you "print out" you are seeing all of the  
internal variables associated with the one toplevel multiblock dataset  
and its children.

This should print some more concise information about the blocks:
====================== *snip* ======================
for i in range( out.GetNumberOfBlocks() ):
   print out.GetMetaData( i ).Get( vtkCompositeDataSet.NAME() )
   blk = out.GetBlock( i )
   for j in range( blk.GetNumberOfBlocks() ):
     print '  ' + blk.GetMetaData( j ).Get( vtkCompositeDataSet.NAME() )

====================== *snip* ======================
When the reader is told to read a block or set (only element blocks  
are read by default), then an unstructured grid will be inserted into  
the appropriate sub-block of the main reader's output.

	Hope this helps,
	David






More information about the vtkusers mailing list