Commit c7aa834f authored by David Thompson's avatar David Thompson

Test reading a polyhedral Exodus dataset.

Change-Id: I0afa93976faf09b742c35d3a987c5e7a0c58fc3a
parent 52eb52d2
vtk_add_test_python(
TestExodusPolyhedra.py
)
#!/usr/bin/env python
from vtk import *
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
rdr = vtkExodusIIReader()
rdr.SetFileName(str(VTK_DATA_ROOT) + "/Data/dodecahedron.exo")
rdr.Update()
ph = rdr.GetOutput().GetBlock(0).GetBlock(0).GetCell(0)
print '%d polyhedral faces' % ph.GetNumberOfFaces()
if ph.GetNumberOfFaces() != 12:
sys.exit(1)
for i in range(ph.GetNumberOfFaces()):
pg = ph.GetFace(i)
if pg.GetNumberOfEdges() != 5 or pg.GetNumberOfPoints() != 5:
print ' %d edges on face %d' % (pg.GetNumberOfEdges(), i)
print ' %d points on face %d' % (pg.GetNumberOfPoints(), i)
sys.exit(1)
#for j in range(pg.GetNumberOfPoints()):
# pid = pg.GetPointId(j)
# x = [0.0,0.0,0.0]
# pg.GetPoints().GetPoint(pid, x)
# print ' p%02d: %g %g %g' % (pid, x[0], x[1], x[2]);
renWin = vtkRenderWindow()
ri = vtkRenderWindowInteractor()
rr = vtkRenderer()
ac = vtkActor()
dm = vtkDataSetMapper()
ac.SetMapper(dm)
dm.SetInputData(rdr.GetOutput().GetBlock(0).GetBlock(0))
rr.AddActor(ac)
renWin.AddRenderer(rr)
rr.ResetCamera()
renWin.Render()
5b8d3f3f2e046e1b70f09a7d5c0892d2
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment