All,

I'm trying to retrieve the block names for blocks in an Exodus multi-block 
dataset.     There is a weird block_ID, block_number thing which I don't 
understand and can't get past.

Imagine I have many blocks in my dataset but I only load 2

   Block_ID         block_number(displayed in Spreadsheet)
          4                    5                               - this is 
actually 4th block in file
      101                 25                                - this is actually 
24th block in file

I am looping through blocks and getting block_names using this routine:

    def get_block_name(block):
       #
       # Get block ID - indexed from 1
       block_id=block.FieldData.GetArray('ElementBlockIds')
       #print block_id
       #
       #  Get Block name from metadata
       output=self.GetOutput()
       #
       # Element Block data is in DataBlock(0) of composite database
       ElementBlocks=output.GetBlock(0)
       #
       # meta indexed from 0 (use block_id-1)
       block_meta=ElementBlocks.GetMetaData(block_id-1)
       block_name=block_meta.Get(vtk.vtkCompositeDataSet.NAME())
       return block_name


Note that block.FieldData.GetArray('ElementBlockIds') returns 5 for the first 
block
I then need to call block_meta.Get(vtk.vtkCompositeDataSet.NAME()) with 4 to 
get the correct name

Now with the second block, block.FieldData.GetArray('ElementBlockIds') returns 
101,
I then call block_meta.Get(vtk.vtkCompositeDataSet.NAME()) with 100 and get an 
error of "NoneType object has no attribute 'Get'
It seems clear that I need a function which will return 25 for the second block 
(instead of 101) so that I can call NAME() with 24.

So, how do I get it to return the block number instead of the block ID

NOTE,  the first block is a hex block, while the 2nd block is a quad block - 
I'm suspicious that this is the real issue, but here all quad blocks are > 100 
by convention.

Summary - block name works for contiguously numbered hex blocks but 
discontinuously numbered quad blocks don't work.

Thanks for any help.

Dennis

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview

Reply via email to