diff --git a/tests/regression_tests/plot/plots.xml b/tests/regression_tests/plot/plots.xml
index 2cec871ea3..ecfe69125b 100644
--- a/tests/regression_tests/plot/plots.xml
+++ b/tests/regression_tests/plot/plots.xml
@@ -24,7 +24,7 @@
- 50 50 10
+ 100 100 10
0. 0. 0.
20 20 10
diff --git a/tests/regression_tests/plot/results_true.dat b/tests/regression_tests/plot/results_true.dat
index f72a4ecd76..ba8a49226a 100644
--- a/tests/regression_tests/plot/results_true.dat
+++ b/tests/regression_tests/plot/results_true.dat
@@ -1 +1 @@
-3337721f8f6d3777dd36c404ed117fe5bc07b1d9691a0c91131d48e7e73e21191e72401cf9bb621e3250ca51345514f90ea612e0fb6236bec33ce78655988dec
\ No newline at end of file
+01ecda0f3820a49c8a41d8dc47d1e5c58767a04301621c2437231fcc04401ddea47b67d0529ca56a32d4d97b4f1416a2e0b6120d3bdc87d74a7e9889758a8808
\ No newline at end of file
diff --git a/tests/regression_tests/plot/test.py b/tests/regression_tests/plot/test.py
index 90e04f913f..bfaef019c1 100644
--- a/tests/regression_tests/plot/test.py
+++ b/tests/regression_tests/plot/test.py
@@ -1,7 +1,6 @@
import glob
import hashlib
import os
-from subprocess import call
import h5py
import openmc
@@ -19,15 +18,6 @@ class PlotTestHarness(TestHarness):
def _run_openmc(self):
openmc.plot_geometry(openmc_exec=config['exe'])
- # TEMP: this should always be checked once vtk is added
- # to Python3.7
- try:
- import vtk
- call(['../../../scripts/openmc-voxel-to-vtk'] +
- glob.glob('plot_4.h5'))
- except:
- pass
-
def _test_output_created(self):
"""Make sure *.ppm has been created."""
for fname in self._plot_names:
@@ -66,14 +56,6 @@ class PlotTestHarness(TestHarness):
def test_plot():
- expected_plots = ['plot_1.ppm', 'plot_2.ppm', 'plot_3.ppm', 'plot_4.h5']
- # TEMP: this should always be checked once vtk is added
- # to Python3.7
- try:
- import vtk
- expected_plots.append('plot.vti')
- except:
- pass
-
- harness = PlotTestHarness(expected_plots)
+ harness = PlotTestHarness(('plot_1.ppm', 'plot_2.ppm', 'plot_3.ppm',
+ 'plot_4.h5'))
harness.main()
diff --git a/tests/regression_tests/plot_voxel/__init__.py b/tests/regression_tests/plot_voxel/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/regression_tests/plot_voxel/geometry.xml b/tests/regression_tests/plot_voxel/geometry.xml
new file mode 100644
index 0000000000..83619d9f78
--- /dev/null
+++ b/tests/regression_tests/plot_voxel/geometry.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+ |
+ |
+ |
+
+
diff --git a/tests/regression_tests/plot_voxel/materials.xml b/tests/regression_tests/plot_voxel/materials.xml
new file mode 100644
index 0000000000..90b3542675
--- /dev/null
+++ b/tests/regression_tests/plot_voxel/materials.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/regression_tests/plot_voxel/plots.xml b/tests/regression_tests/plot_voxel/plots.xml
new file mode 100644
index 0000000000..833329b427
--- /dev/null
+++ b/tests/regression_tests/plot_voxel/plots.xml
@@ -0,0 +1,10 @@
+
+
+
+
+ 50 50 10
+ 0. 0. 0.
+ 20 20 10
+
+
+
diff --git a/tests/regression_tests/plot_voxel/results_true.dat b/tests/regression_tests/plot_voxel/results_true.dat
new file mode 100644
index 0000000000..41193c9bc3
--- /dev/null
+++ b/tests/regression_tests/plot_voxel/results_true.dat
@@ -0,0 +1 @@
+20a0c3598bb698efa4bba65c5e55d71f4385e5b1bcf0067964e45001c12f5c0a729935a96409c760dbd3ec439ae6c676fce77d6e578b41f8f3e0ac68c9277acb
\ No newline at end of file
diff --git a/tests/regression_tests/plot_voxel/settings.xml b/tests/regression_tests/plot_voxel/settings.xml
new file mode 100644
index 0000000000..adf256d2d4
--- /dev/null
+++ b/tests/regression_tests/plot_voxel/settings.xml
@@ -0,0 +1,13 @@
+
+
+
+ plot
+
+
+ 5 4 3
+ -10 -10 -10
+ 10 10 10
+
+ 1
+
+
diff --git a/tests/regression_tests/plot_voxel/test.py b/tests/regression_tests/plot_voxel/test.py
new file mode 100644
index 0000000000..1e57e557d6
--- /dev/null
+++ b/tests/regression_tests/plot_voxel/test.py
@@ -0,0 +1,64 @@
+import glob
+import hashlib
+import os
+from subprocess import run
+import importlib
+import h5py
+import openmc
+import pytest
+
+from tests.testing_harness import TestHarness
+from tests.regression_tests import config
+
+
+pytestmark = pytest.mark.skipif(
+ importlib.util.find_spec('vtk') is None,
+ reason="vtk module is not installed.")
+class PlotVoxelTestHarness(TestHarness):
+ """Specialized TestHarness for running OpenMC voxel plot tests."""
+ def __init__(self, plot_names):
+ super().__init__(None)
+ self._plot_names = plot_names
+
+ def _run_openmc(self):
+ openmc.plot_geometry(openmc_exec=config['exe'])
+
+ run(['../../../scripts/openmc-voxel-to-vtk'] +
+ glob.glob('plot_4.h5'), check=True)
+
+ def _test_output_created(self):
+ """Make sure *.ppm has been created."""
+ for fname in self._plot_names:
+ assert os.path.exists(fname), 'Plot output file does not exist.'
+
+ def _cleanup(self):
+ super()._cleanup()
+ for fname in self._plot_names:
+ if os.path.exists(fname):
+ os.remove(fname)
+
+ def _get_results(self):
+ """Return a string hash of the plot files."""
+ outstr = bytes()
+
+ for fname in self._plot_names:
+ if fname.endswith('.h5'):
+ # Add voxel data to results
+ with h5py.File(fname, 'r') as fh:
+ outstr += fh.attrs['filetype']
+ outstr += fh.attrs['num_voxels'].tostring()
+ outstr += fh.attrs['lower_left'].tostring()
+ outstr += fh.attrs['voxel_width'].tostring()
+ outstr += fh['data'].value.tostring()
+
+ # Hash the information and return.
+ sha512 = hashlib.sha512()
+ sha512.update(outstr)
+ outstr = sha512.hexdigest()
+
+ return outstr
+
+
+def test_plot():
+ harness = PlotVoxelTestHarness(('plot_4.h5', 'plot.vti'))
+ harness.main()