-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
161 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
from pathlib import Path | ||
|
||
|
||
import geouned | ||
|
||
suffixes = (".mcnp", ".xml", ".inp", ".py", ".serp") | ||
|
||
path_to_cad = Path("testing/inputSTEP") | ||
step_files = list(path_to_cad.rglob("*.stp")) + list(path_to_cad.rglob("*.step")) | ||
|
||
for input_step_file in step_files: | ||
|
||
# sets up an output folder for the results | ||
output_dir = Path("tests/regression_test") / input_step_file.with_suffix("") | ||
output_dir.mkdir(parents=True, exist_ok=True) | ||
output_filename_stem = output_dir / input_step_file.stem | ||
|
||
# deletes the output MC files if they already exists | ||
for suffix in suffixes: | ||
output_filename_stem.with_suffix(suffix).unlink(missing_ok=True) | ||
|
||
my_options = geouned.Options( | ||
forceCylinder=False, | ||
newSplitPlane=True, | ||
delLastNumber=False, | ||
enlargeBox=2, | ||
nPlaneReverse=0, | ||
splitTolerance=0, | ||
scaleUp=True, | ||
quadricPY=False, | ||
Facets=False, | ||
prnt3PPlane=False, | ||
forceNoOverlap=False, | ||
) | ||
|
||
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", | ||
) | ||
|
||
my_settings = geouned.Settings( | ||
matFile="", | ||
voidGen=True, | ||
debug=False, | ||
compSolids=True, | ||
simplify="no", | ||
cellRange=[], | ||
exportSolids="", | ||
minVoidSize=200.0, # units mm | ||
maxSurf=50, | ||
maxBracket=30, | ||
voidMat=[], | ||
voidExclude=[], | ||
startCell=1, | ||
startSurf=1, | ||
sort_enclosure=False, | ||
) | ||
|
||
geo = geouned.CadToCsg( | ||
stepFile=f"{input_step_file.resolve()}", | ||
options=my_options, | ||
settings=my_settings, | ||
tolerances=my_tolerances, | ||
numeric_format=my_numeric_format, | ||
) | ||
|
||
geo.start() | ||
|
||
geo.export_csg( | ||
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 | ||
) | ||
|
||
for suffix in suffixes: | ||
assert output_filename_stem.with_suffix(suffix).exists() |