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

Nico Schlömer nico.schloemer at gmail.com
Sat Dec 11 16:25:48 EST 2010


Alright, so this

================= *snip* =================
    out = reader.GetOutput()
    for i in range( out.GetNumberOfBlocks() ):
        blk = out.GetBlock( i )
        for j in range( blk.GetNumberOfBlocks() ):
            sub_block = blk.GetBlock( j )
            if sub_block.IsA( "vtkUnstructuredGrid" ):
                vtk_mesh.append( sub_block )
================= *snap* =================

gives me all vtkUnstructuredGrid in the vtkExodusIIReader output. Nice!

However, there's more data in the Exodus file I'd like to retrieve,
for example a data array for point data. In the ExodusII file, the
values are declared as "vals_nod_var1=..." and "name_nod_var =
"x0_R",  "x0_Z" ;", but those are certainly not contained in the block
hierarchy above.

Is there a switch of some sort that needs to be set prior to reading
the data maybe?

--Nico





On Mon, Dec 6, 2010 at 9:21 PM, David Thompson <dcthomp at sandia.gov> wrote:
>> ... 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