Skip to content

Commit

Permalink
testing the setting of all class arguments (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
shimwell authored May 13, 2024
1 parent 17d4500 commit 68a0fd4
Showing 1 changed file with 72 additions and 29 deletions.
101 changes: 72 additions & 29 deletions tests/test_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,53 +23,96 @@ def test_conversion(input_step_file):
output_dir.mkdir(parents=True, exist_ok=True)
output_filename_stem = output_dir / input_step_file.stem

# creates the config file contents
template = {
"title": "Input Test",
"stepFile": f"{input_step_file.resolve()}",
"geometryName": f"{output_filename_stem.resolve()}",
"outFormat": ("mcnp", "openMC_XML", "openMC_PY", "serpent", "phits"),
"compSolids": False,
"volCARD": False,
"volSDEF": True,
"voidGen": True,
"dummyMat": True,
"minVoidSize": 100,
"cellSummaryFile": False,
"cellCommentFile": False,
"debug": False,
"simplify": "no",
}

# deletes the output MC files if they already exists
suffixes = (".mcnp", ".xml", ".inp", ".py", ".serp")
for suffix in suffixes:
output_filename_stem.with_suffix(suffix).unlink(missing_ok=True)

my_options = geouned.Options(
forceCylinder=False,
splitTolerance=0,
newSplitPlane=True,
delLastNumber=False,
enlargeBox=2,
nPlaneReverse=0,
splitTolerance=0,
scaleUp=True,
quadricPY=False,
Facets=False,
prnt3PPlane=False,
forceNoOverlap=False,
)

# default values used, just checking it can be passed in
my_tolerances = geouned.Tolerances(min_area=0.01)

# default values used, just checking it can be passed in
my_numeric_format = geouned.NumericFormat(C_r="12f")
my_tolerances = geouned.Tolerances(
relativeTol=False,
relativePrecision=0.000001,
value=0.000001,
distance=0.0001,
angle=0.0001,
pln_distance=0.0001,
pln_angle=0.0001,
cyl_distance=0.0001,
cyl_angle=0.0001,
sph_distance=0.0001,
kne_distance=0.0001,
kne_angle=0.0001,
tor_distance=0.0001,
tor_angle=0.0001,
min_area=0.01,
)
my_numeric_format = geouned.NumericFormat(
P_abc="14.7e",
P_d="14.7e",
P_xyz="14.7e",
S_r="14.7e",
S_xyz="14.7e",
C_r="12f",
C_xyz="12f",
K_xyz="13.6e",
K_tan2="12f",
T_r="14.7e",
T_xyz="14.7e",
GQ_1to6="18.15f",
GQ_7to9="18.15f",
GQ_10="18.15f",
)

geo = geouned.CadToCsg(
title="Input Test",
stepFile=f"{input_step_file.resolve()}",
matFile="",
voidGen=True,
debug=False,
compSolids=False, # changed from the default
simplify="no",
cellRange=[],
exportSolids="",
minVoidSize=100, # changed from the default
maxSurf=50,
maxBracket=30,
voidMat=[],
voidExclude=[],
startCell=1,
startSurf=1,
sort_enclosure=False,
options=my_options,
tolerances=my_tolerances,
numeric_format=my_numeric_format,
title="Converted with GEOUNED",
geometryName=f"{output_filename_stem.resolve()}",
outFormat=(
"openMC_XML",
"openMC_PY",
"serpent",
"phits",
"mcnp",
),
volSDEF=True, # changed from the default
volCARD=False, # changed from the default
UCARD=None,
dummyMat=True, # changed from the default
cellCommentFile=False,
cellSummaryFile=False, # changed from the default
)

# set parameters values stored in template dictionary
for key, value in template.items():
geo.set(key, value)

geo.start()

for suffix in suffixes:
Expand Down

0 comments on commit 68a0fd4

Please sign in to comment.