2015-09-14 21:42:25 -04:00
|
|
|
import glob
|
2018-01-29 10:53:46 -06:00
|
|
|
|
2017-04-07 10:25:24 -05:00
|
|
|
from openmc import StatePoint
|
2014-03-11 18:59:37 -04:00
|
|
|
|
2018-01-29 10:53:46 -06:00
|
|
|
from tests.testing_harness import TestHarness
|
|
|
|
|
|
2014-03-11 18:59:37 -04:00
|
|
|
|
2015-06-25 00:10:07 -06:00
|
|
|
class SourcepointTestHarness(TestHarness):
|
|
|
|
|
def _test_output_created(self):
|
2018-01-29 10:53:46 -06:00
|
|
|
"""Make sure statepoint files have been created."""
|
|
|
|
|
statepoint = glob.glob('statepoint.*.h5')
|
|
|
|
|
assert len(statepoint) == 5, 'Five statepoint files must exist.'
|
2015-06-25 00:10:07 -06:00
|
|
|
|
|
|
|
|
def _get_results(self):
|
2015-06-28 00:06:33 -06:00
|
|
|
"""Digest info in the statepoint and return as a string."""
|
|
|
|
|
# Get the eigenvalue information.
|
|
|
|
|
outstr = TestHarness._get_results(self)
|
2015-06-25 00:10:07 -06:00
|
|
|
|
2017-04-07 10:25:24 -05:00
|
|
|
# Read the statepoint file.
|
2018-01-29 10:53:46 -06:00
|
|
|
with StatePoint(self._sp_name) as sp:
|
2017-04-07 10:25:24 -05:00
|
|
|
# Add the source information.
|
2019-03-01 14:46:21 -06:00
|
|
|
xyz = sp.source[0]['r']
|
2017-04-07 10:25:24 -05:00
|
|
|
outstr += ' '.join(['{0:12.6E}'.format(x) for x in xyz])
|
|
|
|
|
outstr += "\n"
|
2015-06-25 00:10:07 -06:00
|
|
|
|
2015-06-28 00:06:33 -06:00
|
|
|
return outstr
|
2015-06-25 00:10:07 -06:00
|
|
|
|
|
|
|
|
|
2018-01-29 12:10:24 -06:00
|
|
|
def test_sourcepoint_batch():
|
2017-04-07 10:25:24 -05:00
|
|
|
harness = SourcepointTestHarness('statepoint.08.h5')
|
2015-06-29 18:50:53 -06:00
|
|
|
harness.main()
|