From 64c464b9922a0a4c5f2e7c1745aea11568912349 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Fri, 19 Sep 2025 14:58:12 -0500 Subject: [PATCH] Expand tests for fill transformations --- src/openmc_mcnp_adapter/openmc_conversion.py | 1 + tests/test_geometry.py | 23 ++++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/openmc_mcnp_adapter/openmc_conversion.py b/src/openmc_mcnp_adapter/openmc_conversion.py index 69b2bdf..6dc0ce4 100644 --- a/src/openmc_mcnp_adapter/openmc_conversion.py +++ b/src/openmc_mcnp_adapter/openmc_conversion.py @@ -536,6 +536,7 @@ def get_openmc_universes(cells, surfaces, materials, data): # Apply transformation to fill if 'fill' in c['parameters']: + # TODO: Check for existing transformations on the fill fill = c['parameters']['fill'] if use_degrees: c['parameters']['*fill'] = f'{fill} {trcl}' diff --git a/tests/test_geometry.py b/tests/test_geometry.py index 9de30ed..91ecf8f 100644 --- a/tests/test_geometry.py +++ b/tests/test_geometry.py @@ -135,17 +135,32 @@ def test_trcl(cell_card, surface_cards, points_inside, points_outside): assert point not in cell.region -def test_trcl_fill(): - mcnp_str = dedent(""" +@mark.parametrize( + "keywords", + [ + "FILL=10 TRCL=(2.0 0.0 0.0)", + "FILL=10(2.0 0.0 0.0)", + "FILL=10 TRCL=(2.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0)", + "FILL=10(2.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0)", + "FILL=10 *TRCL=(2.0 0.0 0.0 0.0 90.0 90.0 90.0 0.0 90.0 90.0 90.0 0.0)", + "*FILL=10(2.0 0.0 0.0 0.0 90.0 90.0 90.0 0.0 90.0 90.0 90.0 0.0)", + "FILL=10(1)", + "FILL=10(2)", + ] +) +def test_fill_transformation(keywords): + mcnp_str = dedent(f""" title - 1 0 -1 FILL=10 TRCL=(2.0 0.0 0.0) + 1 0 -1 {keywords} 2 0 -2 U=10 3 0 +2 U=10 1 so 10.0 2 so 1.0 - m1 1001.80c 1.0 + m1 1001.80c 1.0 + tr1 2.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 + *tr2 2.0 0.0 0.0 0.0 90.0 90.0 90.0 0.0 90.0 90.0 90.0 0.0 """) model = mcnp_str_to_model(mcnp_str) geometry = model.geometry