mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-29 06:35:48 -04:00
Merge pull request #402 from smharper/simplified_tests
Simplified testing system
This commit is contained in:
commit
f304fa04f5
223 changed files with 1156 additions and 218582 deletions
|
|
@ -35,9 +35,12 @@ class Executor(object):
|
|||
print(line, end='')
|
||||
|
||||
# If OpenMC is finished, break loop
|
||||
if line == '' and p.poll() != None:
|
||||
if not line and p.poll() != None:
|
||||
break
|
||||
|
||||
# Return the returncode (integer, zero if no problems encountered)
|
||||
return p.returncode
|
||||
|
||||
@property
|
||||
def working_directory(self):
|
||||
return self._working_directory
|
||||
|
|
@ -53,14 +56,15 @@ class Executor(object):
|
|||
|
||||
self._working_directory = working_directory
|
||||
|
||||
def plot_geometry(self, output=True):
|
||||
def plot_geometry(self, output=True, openmc_exec='openmc'):
|
||||
"""Run OpenMC in plotting mode"""
|
||||
|
||||
self._run_openmc('openmc -p', output)
|
||||
return self._run_openmc(openmc_exec + ' -p', output)
|
||||
|
||||
def run_simulation(self, particles=None, threads=None,
|
||||
geometry_debug=False, restart_file=None,
|
||||
tracks=False, mpi_procs=1, output=True):
|
||||
tracks=False, mpi_procs=1, output=True,
|
||||
openmc_exec='openmc', mpi_exec=None):
|
||||
"""Run an OpenMC simulation.
|
||||
|
||||
Parameters
|
||||
|
|
@ -79,6 +83,8 @@ class Executor(object):
|
|||
Number of MPI processes
|
||||
output : bool
|
||||
Capture OpenMC output from standard out
|
||||
openmc_exec : str
|
||||
Path to OpenMC executable
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -101,8 +107,22 @@ class Executor(object):
|
|||
post_args += '-t'
|
||||
|
||||
if isinstance(mpi_procs, Integral) and mpi_procs > 1:
|
||||
pre_args += 'mpirun -n {0} '.format(mpi_procs)
|
||||
np_present = True
|
||||
else:
|
||||
np_present = False
|
||||
|
||||
command = pre_args + 'openmc ' + post_args
|
||||
if mpi_exec is not None and isinstance(mpi_exec, basestring):
|
||||
mpi_exec_present = True
|
||||
else:
|
||||
mpi_exec_present = False
|
||||
|
||||
self._run_openmc(command, output)
|
||||
if np_present or mpi_exec_present:
|
||||
if mpi_exec_present:
|
||||
pre_args += mpi_exec + ' '
|
||||
else:
|
||||
pre_args += 'mpirun '
|
||||
pre_args += '-n {0} '.format(mpi_procs)
|
||||
|
||||
command = pre_args + openmc_exec + ' ' + post_args
|
||||
|
||||
return self._run_openmc(command, output)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue