mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Upgrading tests of model, and adding better file management, Model.calculate_volumes method and Model.plot_geometry method. These last two still need to be tested as well as Model.deplete
This commit is contained in:
parent
d45af5a4ef
commit
e62ba9b85a
5 changed files with 396 additions and 87 deletions
|
|
@ -1,10 +1,25 @@
|
|||
from collections.abc import Iterable
|
||||
from numbers import Integral
|
||||
import subprocess
|
||||
from contextlib import contextmanager
|
||||
from pathlib import Path
|
||||
import os
|
||||
|
||||
import openmc
|
||||
|
||||
|
||||
@contextmanager
|
||||
def change_directory(working_dir):
|
||||
"""A context manager for executing in a provided working directory"""
|
||||
start_dir = Path().absolute()
|
||||
try:
|
||||
Path.mkdir(working_dir, exist_ok=True)
|
||||
os.chdir(working_dir)
|
||||
yield
|
||||
finally:
|
||||
os.chdir(start_dir)
|
||||
|
||||
|
||||
def _run(args, output, cwd):
|
||||
# Launch a subprocess
|
||||
p = subprocess.Popen(args, cwd=cwd, stdout=subprocess.PIPE,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue