Fix load_statepoint bugs, improve restart test

This commit is contained in:
Sterling Harper 2016-02-19 15:11:39 -05:00
parent 642f6a946e
commit 5ffaed9507
3 changed files with 1405 additions and 1392 deletions

View file

@ -658,7 +658,10 @@ contains
file_id = file_open(path_state_point, 'r', parallel=.true.)
! Read filetype
call read_dataset(file_id, "filetype", int_array(1))
call read_dataset(file_id, "filetype", word)
if (trim(word) /= 'statepoint') then
call fatal_error("OpenMC tried to restart from a non-statepoint file.")
end if
! Read revision number for state point file and make sure it matches with
! current version
@ -755,7 +758,8 @@ contains
! Check if tally results are present
tallies_group = open_group(file_id, "tallies")
call read_dataset(file_id, "tallies_present", int_array(1), indep=.true.)
call read_dataset(tallies_group, "tallies_present", int_array(1), &
indep=.true.)
! Read in sum and sum squared
if (int_array(1) == 1) then

File diff suppressed because it is too large Load diff

View file

@ -10,6 +10,11 @@ from openmc.executor import Executor
class StatepointRestartTestHarness(TestHarness):
def __init__(self, final_sp, restart_sp, tallies_present=False):
super(StatepointRestartTestHarness, self).__init__(final_sp,
tallies_present)
self._restart_sp = restart_sp
def execute_test(self):
"""Run OpenMC with the appropriate arguments and check the outputs."""
try:
@ -40,7 +45,9 @@ class StatepointRestartTestHarness(TestHarness):
def _run_openmc_restart(self):
# Get the name of the statepoint file.
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))
statepoint = glob.glob(os.path.join(os.getcwd(), self._restart_sp))
assert len(statepoint) == 1
statepoint = statepoint[0]
# Run OpenMC
executor = Executor()
@ -52,11 +59,13 @@ class StatepointRestartTestHarness(TestHarness):
mpi_exec=self._opts.mpi_exec)
else:
returncode = executor.run_simulation(openmc_exec=self._opts.exe)
returncode = executor.run_simulation(openmc_exec=self._opts.exe,
restart_file=statepoint)
assert returncode == 0, 'OpenMC did not exit successfully.'
if __name__ == '__main__':
harness = StatepointRestartTestHarness('statepoint.07.*', True)
harness = StatepointRestartTestHarness('statepoint.10.h5',
'statepoint.07.h5', True)
harness.main()