[Paraview] [EXT] Re: Exodus Block Names

Shawn Waldon shawn.waldon at kitware.com
Mon Aug 31 10:47:55 EDT 2015


Dennis,

Given those block names, I think I know what you are missing.  It is
possible for a block to be a vtkMultiBlockDataSet itself, in which case you
would need to get the block with mbi.GetBlock(0) and then do another loop
over the blocks in that one to look at the block names.  A quick way to
check this is to look at the Information panel in ParaView.  The tree there
reflects the tree in the data and each node you can expand is a
vtkMultiBlockDataSet (or other composite dataset type, but that one is the
most common).

Shawn

On Mon, Aug 31, 2015 at 10:40 AM, Dennis Conklin <
dennis_conklin at goodyear.com> wrote:

> Shawn,
>
>
>
> Ok, I’m dense.
>
>
>
> When I run your code inside the Programmable Filter, I see some confusing
> things:
>
> mbi.GetNumberOfBlocks returns 8, which is NOT the number of blocks in my
> model but IS the number of MetaData blocks.
>
>
>
> The mbi.GetMetaData[i].Get(vtk.vtkCompositeDataSet.NAME()) then is
>
> Value of i             Name
>
> 0                            Element Blocks
>
> 1                            Face Blocks
>
> 2                            Edge Blocks
>
> 3                            Element Sets
>
> 4                            Side Sets
>
> 5                            Face Sets
>
> 6                            Edge Sets
>
> 7                            Node Sets
>
> 8                            <out of range>
>
>
>
> I am poking around mbi.GetMetaData[0] (Element Blocks) but I still haven’t
> found any Block Names there.    I feel like I am completely missing
> something here, but I have no idea what it is.
>
>
>
> Dennis
>
>
>
>
>
> *From:* Shawn Waldon [mailto:shawn.waldon at kitware.com]
> *Sent:* Monday, August 31, 2015 9:46 AM
> *To:* Dennis Conklin
> *Cc:* Paraview (paraview at paraview.org)
> *Subject:* Re: [EXT] Re: [Paraview] Exodus Block Names
>
>
>
> Hi Dennis,
>
> The metadata is on the reader's output, which is a vtkMultiBlockDataSet.
> reader.GetOutput() should get you the dataset in your python script.
> Inside the programmable filter you will need to get the input dataset
> (self.GetInput() should get you the input dataset and self.GetOutput()
> should get you the output dataset).  So something like the following for
> your programmable filter:
>
> mbi = self.GetInput()
>
> mbo = self.GetOutput()
>
> mbo.ShallowCopy(mbi)
>
> for i in range(mbo.GetNumberOfBlocks()):
>   metadata = mbo.GetMetaData(i)
>   name = metadata.Get(vtk.vtkCompositeDataSet.NAME())
>
>   # do something with the name
>
>
>
>
>
> HTH,
>
> Shawn
>
>
>
> On Mon, Aug 31, 2015 at 8:31 AM, Dennis Conklin <
> dennis_conklin at goodyear.com> wrote:
>
> Shawn,
>
>
>
> Thanks for that tip but I can’t seem to access this structure.   Really, I
> need it within the Programmable Filter, but even when I run a Python script
> and try to find it directly in an Exodus reader, I can’t seem to locate
> this metadata.
>
>
>
> If I print dir(ExodusReader), there doesn’t seem to be anything about
> metadata.
>
> Dennis
>
>
>
> *From:* Shawn Waldon [mailto:shawn.waldon at kitware.com]
> *Sent:* Friday, August 28, 2015 4:44 PM
> *To:* Dennis Conklin
> *Cc:* Paraview (paraview at paraview.org)
> *Subject:* [EXT] Re: [Paraview] Exodus Block Names
>
>
>
> Hi Dennis,
>
> The block name is in the block metadata, which is not where I looked the
> first time either.  Here is a code snippet that shows how to access it.
>
> mb = vtk.vtkMultiBlockDataSet()
> ...
>
> for i in range(mb.GetNumberOfBlocks):
>
>   metadata = mb.GetMetaData(i)
>
>   name = metadata.Get(vtk.vtkCompositeDataSet.NAME())
>
> HTH,
>
> Shawn
>
>
>
> On Fri, Aug 28, 2015 at 4:13 PM, Dennis Conklin <
> dennis_conklin at goodyear.com> wrote:
>
> All,
>
>
>
> Once again, I need help.  We are starting to assign names to our Exodus
> blocks (outside of Paraview).   This is very useful for ease and clarity of
> post processing and allows convenient reference to actual components.   The
> good news is that Paraview seems perfectly happy to read in the Block Names
> and use them in the Properties Panel and the Multi-block Inspector and the
> Find Data screen if they exist (no action or programming required for
> this).  So, for instance, instead of Paraview generating the non-useful
> name of “Unnamed block ID: 13 Type: hex” when the blockname is empty, it
> will automagically use the more useful Blockname of “Tread”  if that is in
> the Exodus file.
>
>
>
> However, there has been an unintended consequence of this change.   If I
> select some elements and examine them in Spreadsheet View, I see Block
> Number 14( the +1 offset from Block_ID and Block Number is NOT the
> problem!).   And now I can no longer associate the element (Block Number
> 14) with it’s block in the Properties Panel or the Multi-block Inspector or
> the Find Data panel – where the same block is called “Tread”.
>
>
>
> So, to remedy this situation I would like to add an element variable of
> BlockName, which would contain “Tread” for all the elements in BlockID 13,
> etc., etc. for all the blocks.
>
>
>
> My only problem is I can’t seem to find the list of Block Names.   I’m
> pretty weak at vtk, so it must be available but I surrender – I can’t seem
> to find it.   If someone can help me find the list of Block Names from
> inside the Programmable Filter, I’ll be happy to add the element variable
> myself.
>
>
>
> Thanks for any help, again!
>
>
>
> 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
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20150831/bfcfd0af/attachment.html>


More information about the ParaView mailing list