restructured sourcepoint restart test

This commit is contained in:
Bryan Herman 2014-02-21 14:14:56 -05:00
parent d1a42b79ce
commit 411aea322d
4 changed files with 1713 additions and 1717 deletions

View file

@ -11,7 +11,7 @@ import statepoint
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.7.binary')
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# extract tally results and convert to vector

File diff suppressed because it is too large Load diff

View file

@ -1,8 +1,8 @@
<?xml version="1.0"?>
<settings>
<state_point batches="7" />
<source_point source_separate="true" />
<state_point batches="7 10" />
<source_point batches="7" source_separate="true" />
<eigenvalue>
<batches>10</batches>

View file

@ -24,49 +24,49 @@ def test_run():
assert returncode == 0
def test_created_statepoint():
statepoint = glob.glob(pwd + '/statepoint.7.*')
assert len(statepoint) == 1
statepoint = glob.glob(pwd + '/statepoint.*')
assert len(statepoint) == 2
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
sourcepoint = glob.glob(pwd + '/source.7.*')
assert len(sourcepoint) == 1
assert sourcepoint[0].endswith('binary') or sourcepoint[0].endswith('h5')
def test_results():
statepoint = glob.glob(pwd + '/statepoint.7.*')
statepoint = glob.glob(pwd + '/statepoint.10.*')
call(['python', 'results.py', statepoint[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.rename('results_test.dat', 'results_error.dat')
assert compare
os.remove(statepoint[0])
def test_restart_form1():
statepoint = glob.glob(pwd + '/statepoint.7.*')
sourcepoint = glob.glob(pwd + '/source.7.*')
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path,
'-r', statepoint[0]],
'-r', statepoint[0], sourcepoint[0]],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path, '-r', statepoint[0]], stderr=STDOUT, stdout=PIPE)
proc = Popen([openmc_path, '-r', statepoint[0], sourcepoint[0]], stderr=STDOUT, stdout=PIPE)
print(proc.communicate()[0])
returncode = proc.returncode
assert returncode == 0
def test_created_statepoint_form1():
statepoint = glob.glob(pwd + '/statepoint.7.*')
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
sourcepoint = glob.glob(pwd + '/source.7.*')
assert len(sourcepoint) == 1
assert sourcepoint[0].endswith('binary') or sourcepoint[0].endswith('h5')
def test_results_form1():
statepoint = glob.glob(pwd + '/statepoint.7.*')
statepoint = glob.glob(pwd + '/statepoint.10.*')
call(['python', 'results.py', statepoint[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.rename('results_test.dat', 'results_error.dat')
assert compare
os.remove(statepoint[0])
def test_restart_form2():
statepoint = glob.glob(pwd + '/statepoint.7.*')
@ -74,50 +74,46 @@ def test_restart_form2():
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path,
'--restart', statepoint[0], source[0]],
'--restart', statepoint[0], sourcepoint[0]],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path, '--restart', statepoint[0]],
proc = Popen([openmc_path, '--restart', statepoint[0], sourcepoint[0]],
stderr=STDOUT, stdout=PIPE)
print(proc.communicate()[0])
returncode = proc.returncode
assert returncode == 0
def test_created_statepoint_form2():
statepoint = glob.glob(pwd + '/statepoint.7.*')
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
sourcepoint = glob.glob(pwd + '/source.7.*')
assert len(sourcepoint) == 1
assert sourcepoint[0].endswith('binary') or sourcepoint[0].endswith('h5')
def test_results_form2():
statepoint = glob.glob(pwd + '/statepoint.7.*')
statepoint = glob.glob(pwd + '/statepoint.10.*')
call(['python', 'results.py', statepoint[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.rename('results_test.dat', 'results_error.dat')
assert compare
os.remove(statepoint[0])
def test_restart_serial():
statepoint = glob.glob(pwd + '/statepoint.7.*')
sourcepoint = glob.glob(pwd + '/source.7.*')
openmc_path = pwd + '/../../src/openmc'
proc = Popen([openmc_path, '--restart', statepoint[0]],
proc = Popen([openmc_path, '--restart', statepoint[0], sourcepoint[0]],
stderr=STDOUT, stdout=PIPE)
print(proc.communicate()[0])
returncode = proc.returncode
assert returncode == 0
def test_created_statepoint_serial():
statepoint = glob.glob(pwd + '/statepoint.7.*')
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
sourcepoint = glob.glob(pwd + '/source.7.*')
assert len(sourcepoint) == 1
assert sourcepoint[0].endswith('binary') or sourcepoint[0].endswith('h5')
def test_results_serial():
statepoint = glob.glob(pwd + '/statepoint.7.*')
statepoint = glob.glob(pwd + '/statepoint.10.*')
call(['python', 'results.py', statepoint[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
@ -125,8 +121,8 @@ def test_results_serial():
assert compare
def teardown():
output = glob.glob(pwd + '/statepoint.7.*')
output += glob.glob(pwd + '/source.7.*')
output = glob.glob(pwd + '/statepoint.*')
output += glob.glob(pwd + '/source.*')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):