Merge pull request #1189 from pshriwise/corner_radius

Fix for hexagonal prism convenience function
This commit is contained in:
Paul Romano 2019-03-12 06:52:05 -05:00 committed by GitHub
commit 2d13d41da3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 1 deletions

View file

@ -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

View file

@ -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

View file

@ -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()