diff --git a/openmc/model/funcs.py b/openmc/model/funcs.py index 0023a98d93..5f2db4d30f 100644 --- a/openmc/model/funcs.py +++ b/openmc/model/funcs.py @@ -2,6 +2,7 @@ from collections import OrderedDict from collections.abc import Iterable from math import sqrt from numbers import Real +from functools import partial from openmc import XPlane, YPlane, Plane, ZCylinder, Quadric from openmc.checkvalue import check_type, check_value diff --git a/openmc/surface.py b/openmc/surface.py index 4c44c68b60..0f10e7f486 100644 --- a/openmc/surface.py +++ b/openmc/surface.py @@ -1,7 +1,6 @@ from abc import ABCMeta, abstractmethod from collections import OrderedDict from copy import deepcopy -from functools import partial from numbers import Real, Integral from xml.etree import ElementTree as ET from warnings import warn diff --git a/tests/unit_tests/test_geometry.py b/tests/unit_tests/test_geometry.py index 4968c6fa39..f3718630a5 100644 --- a/tests/unit_tests/test_geometry.py +++ b/tests/unit_tests/test_geometry.py @@ -203,6 +203,30 @@ def test_get_by_name(): assert not univs +def test_hex_prism(): + hex_prism = openmc.model.get_hexagonal_prism(edge_length=5.0, + origin=(0.0, 0.0), + orientation='y') + # clear checks + assert (0.0, 0.0, 0.0) in hex_prism + assert (10.0, 10.0, 10.0) not in hex_prism + # edge checks + assert (0.0, 5.01, 0.0) not in hex_prism + assert (0.0, 4.99, 0.0) in hex_prism + + rounded_hex_prism = openmc.model.get_hexagonal_prism(edge_length=5.0, + origin=(0.0, 0.0), + orientation='y', + corner_radius=1.0) + + # clear checks + assert (0.0, 0.0, 0.0) in rounded_hex_prism + assert (10.0, 10.0, 10.0) not in rounded_hex_prism + # edge checks + assert (0.0, 5.01, 0.0) not in rounded_hex_prism + assert (0.0, 4.99, 0.0) not in rounded_hex_prism + + def test_get_lattice_by_name(cell_with_lattice): cells, _, _, lattice = cell_with_lattice geom = openmc.Geometry([cells[-1]]) @@ -245,6 +269,7 @@ def test_determine_paths(cell_with_lattice): assert geom.get_instances(cells[0].paths[i]) == i assert geom.get_instances(mats[-1].paths[i]) == i + def test_from_xml(run_in_tmpdir, mixed_lattice_model): # Export model mixed_lattice_model.export_to_xml()