[prev in list] [next in list] [prev in thread] [next in thread]
List: paraview
Subject: Re: [Paraview] [EXTERNAL] Re: [EXT] Re: Exodus Block Names
From: "Scott, W Alan" <wascott () sandia ! gov>
Date: 2015-08-31 19:16:51
Message-ID: 1bc10baecc0e4fe99f45832268aaf217 () ES01AMSNLNT ! srn ! sandia ! gov
[Download RAW message or body]
Excellent, thanks Dennis!
Alan
-----Original Message-----
From: ParaView [mailto:paraview-bounces@paraview.org] On Behalf Of Dennis Conklin
Sent: Monday, August 31, 2015 12:47 PM
To: David Thompson
Cc: Paraview (paraview@paraview.org)
Subject: [EXTERNAL] Re: [Paraview] [EXT] Re: Exodus Block Names
All,
Just to wrap this up for the benefit of anyone who searches on this later:
From a python script, it's pretty easy
# Get a pointer to Exodus Reader, either open a file or get Active Source
rdr=GetActiveSource()
Block1=rdr.ElementBlocks[0]
Print Block1
# output will be block name
In a Programmable Filter, things are a little more complicated:
# First create list of Block_names
#
Input=self.GetInput()
# Element Block data is in DataBlock(0) of composite database
ElementBlocks=input.GetBlock(0)
#Number of ElementBlocks
numElemBlocks=ElementBlocks.GetNumberOfBlocks()
#
Block_names=[] #list
#
# names for all blocks in file are available # normally only care about blocks that \
are loaded # make a list of all and index blocks of interest later For blk in \
range(numElemBlocks): meta=ElementBlocks.GetMetaData(blk)
Name=meta.Get(vtk.vtkCompositeDataSet.NAME())
Block_names.append(Name)
#
# Loop over all loaded blocks and find associated names For block in output:
Blk_id=block.FieldData.GetArray('ElementBlockIds')
Blk_name=Block_names[Blk_id-1]
Thanks to everyone for their help.
Dennis
-----Original Message-----
From: David Thompson [mailto:david.thompson@kitware.com]
Sent: Monday, August 31, 2015 10:50 AM
To: Dennis Conklin
Cc: Shawn Waldon; Paraview (paraview@paraview.org)
Subject: Re: [Paraview] [EXT] Re: Exodus Block Names
Hi all,
The Exodus reader creates 8 top-level blocks to identify different types of data \
present in each file (corresponding to the names you see for 0-7). Each of these \
blocks contains child blocks for the actual data loaded from the file (which may be a \
subset of the data present in the file). It is these sub-blocks whose metadata will \
hold the names from the Exodus file.
David
> On Aug 31, 2015, at 10:40 AM, Dennis Conklin <dennis_conklin@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@kitware.com]
> Sent: Monday, August 31, 2015 9:46 AM
> To: Dennis Conklin
> Cc: Paraview (paraview@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@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@kitware.com]
> Sent: Friday, August 28, 2015 4:44 PM
> To: Dennis Conklin
> Cc: Paraview (paraview@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@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
>
>
>
> _______________________________________________
> 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
_______________________________________________
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
_______________________________________________
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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic