@@ -489,7 +489,7 @@ def test_umesh(run_in_tmpdir, simple_umesh, export_type):
489489
490490
491491@pytest .mark .skipif (not openmc .lib ._dagmc_enabled (), reason = "DAGMC not enabled." )
492- def test_write_vtkhdf (request , run_in_tmpdir ):
492+ def test_write_vtkhdf (request ):
493493 """Performs a minimal UnstructuredMesh simulation, reads in the resulting
494494 statepoint file and writes the mesh data to vtk and vtkhdf files. It is
495495 necessary to read in the unstructured mesh from a statepoint file to ensure
@@ -554,6 +554,25 @@ def test_write_vtkhdf(request, run_in_tmpdir):
554554 with h5py .File ("test_mesh.vtkhdf" , "r" ):
555555 ...
556556
557+ import vtk
558+ reader = vtk .vtkHDFReader ()
559+ reader .SetFileName ("test_mesh.vtkhdf" )
560+ reader .Update ()
561+
562+ # Get mean from file and make sure it matches original data
563+ num_elements = reader .GetOutput ().GetNumberOfCells ()
564+ assert num_elements == umesh_from_sp .n_elements
565+
566+ num_vertices = reader .GetOutput ().GetNumberOfPoints ()
567+ assert num_vertices == umesh_from_sp .n_vertices
568+
569+ arr = reader .GetOutput ().GetCellData ().GetArray ("mean" )
570+ mean = np .array ([arr .GetTuple1 (i ) for i in range (my_tally .mean .size )])
571+ np .testing .assert_almost_equal (mean , my_tally .mean .flatten ()/ umesh_from_sp .volumes )
572+
573+ std_dev = np .array ([arr .GetTuple1 (i ) for i in range (my_tally .std_dev .size )])
574+ np .testing .assert_almost_equal (std_dev , my_tally .std_dev .flatten ()/ umesh_from_sp .volumes )
575+
557576
558577def test_mesh_get_homogenized_materials ():
559578 """Test the get_homogenized_materials method"""
0 commit comments