Skip to content

Commit

Permalink
Merge pull request #47 from fusion-energy/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
shimwell authored Feb 22, 2023
2 parents 05fd085 + 6096890 commit 2986491
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 24 deletions.
7 changes: 5 additions & 2 deletions src/openmc_plot/dagmcslice_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ def create_dagmcslice_tab():
new_title = '<p style="font-family:sans-serif; color:Red; font-size: 30px;">Upload your geometry.xml</p>'
st.markdown(new_title, unsafe_allow_html=True)

st.markdown(
'Not got h5m files handy? Download sample [dagmc.h5m](https://raw.githubusercontent.com/fusion-energy/openmc_plot/main/examples/dagmc_geometry/dagmc_text.h5m "download")'
st.write(
"""
Not got a DAGMC h5m file handy, right mouse 🖱️ click and save these links
[ example 1 ](https://fusion-energy.github.io/openmc_geometry_plot/examples/dagmc_tokamak/dagmc_180_tokamak.h5m)
"""
)

else:
Expand Down
32 changes: 17 additions & 15 deletions src/openmc_plot/geometry_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,18 @@ def create_geometry_tab():
"""
)
file_label_col1, file_label_col2 = st.columns([1, 1])
file_label_col1.write(
file_col1, file_col2 = st.columns([1, 1])
file_col1.write(
"""
👉 Create your ```openmc.Geometry()``` and export the geometry xml file using ```export_to_xml()```.
Not got a geometry.xml file handy, right mouse 🖱️ click and save these links
[ example 1 ](https://fusion-energy.github.io/openmc_geometry_plot/examples/csg_tokamak/geometry.xml),
[ example 2 ](https://fusion-energy.github.io/openmc_geometry_plot/examples/csg_cylinder_box/geometry.xml)
"""
)
file_label_col2.write(
file_col2.write(
"""
👉 Create your DAGMC h5m file using tools like [CAD-to-h5m](https://github.com/fusion-energy/cad_to_dagmc), [STL-to_h5m](https://github.com/fusion-energy/stl_to_h5m) [vertices-to-h5m](https://github.com/fusion-energy/vertices_to_h5m), [Brep-to-h5m](https://github.com/fusion-energy/brep_to_h5m) or the [Cubit](https://coreform.com/products/coreform-cubit/) [Plugin](https://github.com/svalinn/Cubit-plugin)
Not got a DAGMC h5m file handy, right mouse 🖱️ click and save these links
[ example 1 ](https://fusion-energy.github.io/openmc_geometry_plot/examples/dagmc_tokamak/dagmc_180_tokamak.h5m)
"""
)
file_col1, file_col2 = st.columns([1, 1])
geometry_xml_file = file_col1.file_uploader(
"Upload your geometry.xml", type=["xml"]
)
Expand All @@ -52,9 +44,19 @@ def create_geometry_tab():
new_title = '<center><p style="font-family:sans-serif; color:Red; font-size: 30px;">Upload your geometry.xml or DAGMC h5m file</p></center>'
st.markdown(new_title, unsafe_allow_html=True)

sub_title = '<center><p> Not got geometry files handy? Download an example <a href="https://raw.githubusercontent.com/fusion-energy/openmc_plot/main/examples/tokamak/geometry.xml" download>geometry.xml</a> or DAGMC h5m file</p></center>'
st.markdown(sub_title, unsafe_allow_html=True)

st.write(
"""
Not got a geometry.xml file handy, right mouse 🖱️ click and save these links
[ example 1 ](https://fusion-energy.github.io/openmc_geometry_plot/examples/csg_tokamak/geometry.xml),
[ example 2 ](https://fusion-energy.github.io/openmc_geometry_plot/examples/csg_cylinder_box/geometry.xml)
"""
)
st.write(
"""
Not got a DAGMC h5m file handy, right mouse 🖱️ click and save these links
[ example 1 ](https://fusion-energy.github.io/openmc_geometry_plot/examples/dagmc_tokamak/dagmc_180_tokamak.h5m)
"""
)
# DAGMC route
elif dagmc_file is not None and geometry_xml_file is not None:

Expand Down
2 changes: 1 addition & 1 deletion src/openmc_plot/header.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def header():

st.write(
"""
# OpenMC plot ```v0.2.1```
# OpenMC plot ```v0.2.2```
### ⚛ A geometry plotting user interface for OpenMC.
Expand Down
4 changes: 4 additions & 0 deletions src/openmc_plot/launch.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import runpy
import sys
import openmc_plot
Expand All @@ -8,6 +9,9 @@ def main():

path_to_app = str(Path(openmc_plot.__path__[0])/'app.py')

# default is 200MB, this sets uplod file zise to 100GB
os.environ['STREAMLIT_SERVER_MAX_UPLOAD_SIZE'] = '100000'

sys.argv = ["streamlit", "run", path_to_app];
runpy.run_module("streamlit", run_name="__main__")

Expand Down
6 changes: 4 additions & 2 deletions src/openmc_plot/regularmesh_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ def create_regularmesh_tab():
st.markdown(new_title, unsafe_allow_html=True)

st.markdown(
'Not got statepoint.h5 files handy? Download sample [statepoint.h5](https://github.com/fusion-energy/openmc_plot/raw/adding_statepoint_example_file/examples/regularmesh_plot/statepoint.40.h5 "download")'
"""
Not got a Statepoint h5 file handy, right mouse 🖱️ click and save this link
[example 1](https://github.com/fusion-energy/openmc_plot/raw/adding_statepoint_example_file/examples/regularmesh_plot/statepoint.40.h5)
"""
)

else:

save_uploadedfile(statepoint_file)
Expand Down
5 changes: 4 additions & 1 deletion src/openmc_plot/source_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ def create_source_tab():
st.markdown(new_title, unsafe_allow_html=True)

st.markdown(
'Not got xml files handy? Download sample [settings.xml](https://raw.githubusercontent.com/fusion-energy/openmc_plot/main/examples/ring_source/settings.xml)'
"""
Not got a settings xml file handy, right mouse 🖱️ click and save this link
[example 1](https://fusion-energy.github.io/openmc_plot/examples/ring_source/settings.xml)
"""
)

else:
Expand Down
8 changes: 5 additions & 3 deletions src/openmc_plot/weightwindows_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ def create_weightwindow_tab():
new_title = '<p style="font-family:sans-serif; color:Red; font-size: 30px;">Upload your settings.xml</p>'
st.markdown(new_title, unsafe_allow_html=True)

st.markdown(
'Not got xml files handy? Download sample [settings.xml](https://raw.githubusercontent.com/fusion-energy/openmc_plot/main/examples/weightwindows/settings.xml)'
st.write(
"""
Not got a settings xml file handy, right mouse 🖱️ click and save these links
[ example 1 ](https://fusion-energy.github.io/openmc_plot/examples/weightwindows/settings.xml)
"""
)

else:

save_uploadedfile(settings_xml_file)
Expand Down

0 comments on commit 2986491

Please sign in to comment.