Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openmc_py and openmc_xml lower case #166

Merged
merged 2 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/usage/python_api_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ The following example shows a usage with every attributes specified.
title="Converted with GEOUNED",
geometryName="csg",
outFormat=(
"openMC_XML",
"openMC_PY",
"openmc_xml",
"openmc_py",
"serpent",
"phits",
"mcnp",
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/python_cli_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Here is a complete JSON file specification
"export_csg":{
"title": "Converted with GEOUNED",
"geometryName": "csg",
"outFormat": ["openMC_XML", "openMC_PY", "serpent", "phits", "mcnp"],
"outFormat": ["openmc_xml", "openmc_py", "serpent", "phits", "mcnp"],
"volSDEF": false,
"volCARD": true,
"dummyMat": false,
Expand Down
4 changes: 2 additions & 2 deletions scripts/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ stepFile = stepfilename.stp
geometryName = pieza
matFile = materials.txt

# format of the converted geometry : mcnp, openMC_XML, openMC_PY, serpent, phits
outFormat = mcnp, openMC_PY, openMC_XML
# format of the converted geometry : mcnp, openmc_xml, openmc_py, serpent, phits
outFormat = mcnp, openmc_py, openmc_xml


[Parameters]
Expand Down
2 changes: 1 addition & 1 deletion scripts/configReverse.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
inputFile = my_CSG_model
CADFile = modelCAD

# CSG format allowed are mcnp or openMC_XML
# CSG format allowed are mcnp or openmc_xml
inFormat = mcnp

# box dim in cm
Expand Down
2 changes: 1 addition & 1 deletion scripts/geounedClassCall.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

GEO.set("stepFile", stepFileName)
GEO.set("geometryName", "Placa")
GEO.set("outFormat", ("mcnp", "openMC_XML"))
GEO.set("outFormat", ("mcnp", "openmc_xml"))
GEO.set("planeDistance", 0.05)
GEO.set("quadricPY", True)
GEO.set("P_abc", "12f")
Expand Down
4 changes: 2 additions & 2 deletions src/geouned/GEOReverse/reverse.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ def reverse(optFile="configRevese.ini"):
# get geometry definition from MCNP input
if inFormat == "mcnp":
geom = McnpInput(geomfile)
elif inFormat == "openMC_XML":
elif inFormat == "openmc_xml":
geom = XmlInput(geomfile)
else:
msg = f"input format type {inFormat} is not supported." 'Supported options are "mcnp" or "openMC_XML"'
msg = f"input format type {inFormat} is not supported." 'Supported options are "mcnp" or "openmc_xml"'
raise ValueError(msg)

CADCells, fails = buildCAD(UnivCell, geom, CADselection)
Expand Down
12 changes: 6 additions & 6 deletions src/geouned/GEOUNED/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def export_csg(
title: str = "Converted with GEOUNED",
geometryName: str = "csg",
outFormat: typing.Tuple[str] = (
"openMC_XML",
"openMC_PY",
"openmc_xml",
"openmc_py",
"serpent",
"phits",
"mcnp",
Expand All @@ -90,8 +90,8 @@ def export_csg(
geometryName (str, optional): the file stem of the output file(s).
Defaults to "converted_with_geouned".
outFormat (typing.Tuple[str], optional): Format for the output
geometry. Available format are: "mcnp", "openMC_XML",
"openMC_PY", "phits" and "serpent". Several output format can
geometry. Available format are: "mcnp", "openmc_xml",
"openmc_py", "phits" and "serpent". Several output format can
be written in the same method call. Defaults to output all codes.
volSDEF (bool, optional): Write SDEF definition and tally of solid
cell for stochastic volume checking. Defaults to False.
Expand Down Expand Up @@ -221,9 +221,9 @@ def set_configuration(self, configFile=None):
if v.lower() == "mcnp":
outFormat.append("mcnp")
elif v.lower() == "openmc_xml":
outFormat.append("openMC_XML")
outFormat.append("openmc_xml")
elif v.lower() == "openmc_py":
outFormat.append("openMC_PY")
outFormat.append("openmc_py")
elif v.lower() == "serpent":
outFormat.append("serpent")
elif v.lower() == "phits":
Expand Down
11 changes: 4 additions & 7 deletions src/geouned/GEOUNED/write/write_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ def write_geometry(
stepFile,
):

# Currently there are two was of setting outFormat (via a .set method and
# a class attribute. Once we have a single method then move this validating
# input code to the attribute @setter
supported_mc_codes = ("mcnp", "openMC_XML", "openMC_PY", "serpent", "phits")
supported_mc_codes = ("mcnp", "openmc_xml", "openmc_py", "serpent", "phits")
for out_format in outFormat:
if out_format not in supported_mc_codes:
msg = f"outFormat {out_format} not in supported MC codes ({supported_mc_codes})"
Expand Down Expand Up @@ -71,14 +68,14 @@ def write_geometry(
MCNPfile.set_sdef((outSphere, outBox))
MCNPfile.write_input(mcnpFilename)

if "openMC_XML" in outFormat or "openMC_PY" in outFormat:
if "openmc_xml" in outFormat or "openmc_py" in outFormat:
OMCFile = OpenmcInput(MetaList, Surfaces, options, tolerances, numeric_format)

if "openMC_XML" in outFormat:
if "openmc_xml" in outFormat:
omcFilename = geometryName + ".xml"
OMCFile.write_xml(omcFilename)

if "openMC_PY" in outFormat:
if "openmc_py" in outFormat:
omcFilename = geometryName + ".py"
OMCFile.write_py(omcFilename)

Expand Down
2 changes: 1 addition & 1 deletion tests/config_complete_defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"export_csg":{
"title": "Converted with GEOUNED",
"geometryName": "csg",
"outFormat": ["openMC_XML", "openMC_PY", "serpent", "phits", "mcnp"],
"outFormat": ["openmc_xml", "openmc_py", "serpent", "phits", "mcnp"],
"volSDEF": false,
"volCARD": true,
"dummyMat": false,
Expand Down
6 changes: 3 additions & 3 deletions tests/test_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ def test_conversion(input_step_file):
title="Converted with GEOUNED",
geometryName=f"{output_filename_stem.resolve()}",
outFormat=(
"openMC_XML",
"openMC_PY",
"openmc_xml",
"openmc_py",
"serpent",
"phits",
"mcnp",
Expand Down Expand Up @@ -189,7 +189,7 @@ def test_writing_to_new_folders():
geo = geouned.CadToCsg(stepFile="testing/inputSTEP/BC.stp")
geo.start()

for outformat in ["mcnp", "phits", "serpent", "openMC_XML", "openMC_PY"]:
for outformat in ["mcnp", "phits", "serpent", "openmc_xml", "openmc_py"]:
geo.export_csg(
geometryName=f"tests_outputs/new_folder_for_testing_{outformat}/csg",
cellCommentFile=False,
Expand Down