[vtkusers] Exodus block IDs and vtkExodusIIReader

Thompson, David C dcthomp at sandia.gov
Thu Feb 17 12:52:30 EST 2011


Hi Nathan,

Yes, there is an easier way to get the block IDs out; any time after you've called UpdateInformation() on the reader with the filename set properly, you can call this method:
    int GetObjectId( int objectType, int objectIndex );
to get the numeric ID of any object (which may be a block, set, or map). The first argument should be one of the vtkExodusIIReader::ObjectType enum values (in your case, it sounds like you want vtkExodusIIReader::ELEM_BLOCK) and the next object should be the integer offset of the block you're interested in (from 0 to GetNumberOfObjects(vtkExodusIIReader::ELEM_BLOCK)-1 in your case).

The return value will be the ID or -1 if you pass an invalid argument.

    Hope this helps,
    David
________________________________________
From: vtkusers-bounces at vtk.org [vtkusers-bounces at vtk.org] On Behalf Of Nathan Smith [nathanjsmith at gmail.com]
Sent: Thursday, February 17, 2011 09:22
To: vtkusers at vtk.org
Subject: [vtkusers] Exodus block IDs and vtkExodusIIReader

Hello all,

I am trying to read the block IDs out of an Exodus file using the vtkExodusIIReader class.  I read through the really helpful "vtk.vtkExodusIIReader: information in GetOutput()?" thread and see how to get the name of the blocks out of the reader object.  In the files that I've looked at, the name includes the block IDs.  Getting at them, though, would require parsing the strings, which seems terribly error prone.  Is there a method to read the block IDs from the reader or its output that does not require string parsing?

Thanks!

Nathan




More information about the vtkusers mailing list