[vtkusers] How to extract nodesets and sidesets for Exodus data

Slaughter, Andrew E andrew.slaughter at inl.gov
Fri Jan 29 13:30:20 EST 2016


David,

Thanks for the motivation to keep digging, I finally figured it out. My
problem was how I was interpreting the indices added to the vtkExtractBlock.

Just in case anyone else is interested, the following prints out the
indices of an Exodus file to use with vtkExtractBlock.

# Read Exodus Data
reader = vtk.vtkExodusIIReader()
reader.SetFileName('mug_blocks_out.e')
reader.SetTimeStep(10)
reader.UpdateInformation()
reader.Update()

reader.SetAllArrayStatus(vtk.vtkExodusIIReader.NODAL, 1)
reader.SetAllArrayStatus(vtk.vtkExodusIIReader.NODAL_TEMPORAL, 1)

reader.SetObjectStatus(vtk.vtkExodusIIReader.ELEM_BLOCK, 0, 1)
reader.SetObjectStatus(vtk.vtkExodusIIReader.ELEM_BLOCK, 1, 1)
reader.SetObjectStatus(vtk.vtkExodusIIReader.SIDE_SET, 0, 1)
reader.SetObjectStatus(vtk.vtkExodusIIReader.SIDE_SET, 1, 1)
reader.SetObjectStatus(vtk.vtkExodusIIReader.NODE_SET, 0, 1)
reader.SetObjectStatus(vtk.vtkExodusIIReader.NODE_SET, 1, 1)

index = 1
for i in range(reader.GetOutput().GetNumberOfBlocks()):
    print 'reader.GetOutput().GetBlock(', i, ')', index
    index += 1
    for j in range(reader.GetOutput().GetBlock(i).GetNumberOfBlocks()):
        print '    reader.GetOutput().GetBlock(', i, ')', '.GetBlock(',j,
')', index
        index += 1

blocks0 = vtk.vtkExtractBlock()
blocks0.SetInputConnection(reader.GetOutputPort())
blocks0.AddIndex(8) # Set the indices here to view the various 'blocks'
blocks0.Update()


-Andrew



On Fri, Jan 29, 2016 at 9:40 AM, David Thompson <david.thompson at kitware.com>
wrote:

> Hi Andrew,
>
> Since the Exodus reader generates a 2-level multiblock dataset, you should
> be able to use vtkExtractBlock to do everything you want; each Exodus
> block, side set, and node set should be placed in separate leaf-node of the
> VTK multiblock dataset. The reader also groups all of the leaf nodes that
> are Exodus blocks together, all of the leaf nodes that are side sets
> together, and so on -- this is what makes the reader's output a multi-level
> multiblock dataset.
>
>         David
>
> > On Jan 29, 2016, at 11:12 AM, Slaughter, Andrew E <
> andrew.slaughter at inl.gov> wrote:
> >
> > I have been working on this for sometime and still haven't come up with
> a solution, is there anyone who could help me find a solution, if it is
> possible?
> >
> > I will provide another description of what I am trying to accomplish:
> >
> > (1) I would like to read an ExodusII file that contains BLOCKS,
> SIDE_SETS, and NODE_SETS. When reading the file I want to enable everything
> (SetAllArrayStatus enabled for each type).
> >
> > (2) I would like to extract the various parts (each BLOCK, SIDE_SET,
> NODE_SET) so that I can create a unique geometry->mapper->actor objects.
> This will enable me to show any combination of the parts, each with a
> different colormap, etc., but with only a single reader open.
> >
> > I was able to get number (2) working using vtkExtractBlock for BLOCKS,
> but I can't figure out how to also extract out the SIDE_SET and NODE_SET.
> One idea I have was to use vtkExtractCell, but was unable to find the
> correct methodology for that idea.
> >
> > Is this type extraction possible? If so, any hint in the correct
> direction would be greatly appreciated.
> >
> > Thanks,
> > Andrew
> >
> >
> >
> >
> >
> >
> >
> >
> > On Tue, Dec 8, 2015 at 9:02 PM, Slaughter, Andrew E <
> andrew.slaughter at inl.gov> wrote:
> > I am creating a visualization tool for Exodus data capable of displaying
> any combination of nodeset, sideset, and subdomain information from an
> ExodusII file. I would like to be able to have a single reader object and
> multiple renderers for showing the nodesets, sidesets, and/or subdomains.
> >
> > However, I am unable to figure out how to enable all of the above in
> vtkExodusIIReader but limit what is shown in the renderer.
> >
> > I have attached a script (OSX with VTK6.3) that I would like to have
> display the nodesets on the left-side of the screen and the subdomains on
> the right, but I am unable to get the desired result.
> >
> > I would appreciate any help that could be provided.
> >
> > Thanks,
> > Andrew
> >
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.kitware.com_opensource_opensource.html&d=BQIFAg&c=54IZrppPQZKX9mLzcGdPfFD1hxrcB__aEkJFOKJFd00&r=h7heP8xwI1i_HikChvhFbEBurKirgfOCdwgBxB9lM8c&m=IzvSV8J8_UY6qt_rnM6naTRnGNk_stEmtgGBVwg5eCA&s=kl_8I3anInVvggyEaod6WrX7KeURy8h_C7mbTsZyOVI&e=
> >
> > Please keep messages on-topic and check the VTK FAQ at:
> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.vtk.org_Wiki_VTK-5FFAQ&d=BQIFAg&c=54IZrppPQZKX9mLzcGdPfFD1hxrcB__aEkJFOKJFd00&r=h7heP8xwI1i_HikChvhFbEBurKirgfOCdwgBxB9lM8c&m=IzvSV8J8_UY6qt_rnM6naTRnGNk_stEmtgGBVwg5eCA&s=aiN7SFhWFQJe3Wj4LjzkP_bvTS-kyIr411JaPQb5Z6Y&e=
> >
> > Search the list archives at:
> https://urldefense.proofpoint.com/v2/url?u=http-3A__markmail.org_search_-3Fq-3Dvtkusers&d=BQIFAg&c=54IZrppPQZKX9mLzcGdPfFD1hxrcB__aEkJFOKJFd00&r=h7heP8xwI1i_HikChvhFbEBurKirgfOCdwgBxB9lM8c&m=IzvSV8J8_UY6qt_rnM6naTRnGNk_stEmtgGBVwg5eCA&s=_RvOk4cwnd3I4lZci8ZiXALDQ5S68i2l8goeAGzkXNs&e=
> >
> > Follow this link to subscribe/unsubscribe:
> >
> https://urldefense.proofpoint.com/v2/url?u=http-3A__public.kitware.com_mailman_listinfo_vtkusers&d=BQIFAg&c=54IZrppPQZKX9mLzcGdPfFD1hxrcB__aEkJFOKJFd00&r=h7heP8xwI1i_HikChvhFbEBurKirgfOCdwgBxB9lM8c&m=IzvSV8J8_UY6qt_rnM6naTRnGNk_stEmtgGBVwg5eCA&s=wzPIk1KYN2NI_Inwd0yJDYEjbO7-t_4M7aAcPeej758&e=
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160129/27782f8e/attachment.html>


More information about the vtkusers mailing list