[vtkusers] Exodus block IDs and vtkExodusIIReader

David Thompson dcthomp at sandia.gov
Fri Feb 18 04:36:06 EST 2011


Hi Nathan,

Please "reply all" so that other people can benefit from your  
experience. I'm glad to hear it worked for you. The ObjectType enum is  
not protected, but it is excluded from the Python wrapping -- the  
reader was written before enums could be wrapped. I'll check in a  
change so that it will get wrapped in the future.

	David

On Feb 17, 2011, at 15:55 , Nathan Smith wrote:

> Hi David,
>
> Thanks for the help.  I was able to get that to work, but it did  
> require some small hurdles.  The ObjectType enum is listed as  
> protected in the VTK documentation.  In Python, I was unable to  
> locate constants that reflected those values either, so I ended up  
> using vtkExodusIIReader::GetObjectTypeFromName("element"), which  
> returns a value of 1.  For my exodus files, this was the only object  
> type that had any data available.  I had seen  
> vtkExodusIIReader::GetObjectId() earlier, but without calling  
> UpdateInformation(), it seems to not have any data available.   
> Adding that call made everything click!
>
> Thanks again,
>
> Nathan
>
> On Thu, Feb 17, 2011 at 11:52 AM, Thompson, David C <dcthomp at sandia.gov 
> > wrote:
> 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