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

Orange: add volume definition and JSON I/O for surface/volume #307

Merged
merged 7 commits into from
Nov 11, 2021
Merged
Show file tree
Hide file tree
Changes from 6 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
224 changes: 224 additions & 0 deletions app/demo-loop/simple-cms.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
{
"_format": "SCALE ORANGE",
"_version": 0,
"materials": {
"cell_to_mat": [
-1,
5,
0,
1,
2,
3,
4,
5
],
"names": [
"si",
"pb",
"c",
"ti",
"fe",
"galactic"
]
},
"universes": [
{
"_type": "simple unit",
"bbox": [
[
-1000.0,
-1000.0,
-2000.0
],
[
1000.0,
1000.0,
2000.0
]
],
"cell_names": [
"[EXTERIOR]",
"guide_tube",
"silicon_tracker",
"crystal_em_calorimeter",
"hadron_calorimeter",
"superconducting_solenoid",
"iron_muon_chambers",
"fill"
],
"cells": [
{
"faces": [
0,
1,
2,
3,
4,
5
],
"flags": 1,
"logic": "0 1 ~ & 2 & 3 ~ & 4 & 5 ~ & ~",
"num_intersections": 6,
"zorder": 1
},
{
"faces": [
6,
7,
8
],
"logic": "0 ~ 1 & 2 ~ &",
"num_intersections": 4,
"zorder": 1
},
{
"faces": [
6,
7,
8,
9
],
"flags": 1,
"logic": "0 ~ 1 & 2 ~ & ~ 1 2 ~ & 3 ~ & &",
"num_intersections": 6,
"zorder": 1
},
{
"faces": [
7,
8,
9,
10
],
"flags": 1,
"logic": "0 1 ~ & 2 ~ & ~ 0 1 ~ & 3 ~ & &",
"num_intersections": 6,
"zorder": 1
},
{
"faces": [
7,
8,
10,
11
],
"flags": 1,
"logic": "0 1 ~ & 2 ~ & ~ 0 1 ~ & 3 ~ & &",
"num_intersections": 6,
"zorder": 1
},
{
"faces": [
7,
8,
11,
12
],
"flags": 1,
"logic": "0 1 ~ & 2 ~ & ~ 0 1 ~ & 3 ~ & &",
"num_intersections": 6,
"zorder": 1
},
{
"faces": [
7,
8,
12,
13
],
"flags": 1,
"logic": "0 1 ~ & 2 ~ & ~ 0 1 ~ & 3 ~ & &",
"num_intersections": 6,
"zorder": 1
},
{
"faces": [
0,
1,
2,
3,
4,
5,
7,
8,
13
],
"flags": 1,
"logic": "0 1 ~ & 2 & 3 ~ & 4 & 5 ~ & 6 7 ~ & 8 ~ & ~ &",
"num_intersections": 10,
"zorder": 1
}
],
"md": {
"name": "global",
"provenance": "simple-cms.org.omn:17"
},
"surface_names": [
"world_box.mx",
"world_box.px",
"world_box.my",
"world_box.py",
"world_box.mz",
"world_box.pz",
"guide_tube.coz",
"crystal_em_calorimeter_outer.mz",
"crystal_em_calorimeter_outer.pz",
"silicon_tracker_outer.coz",
"crystal_em_calorimeter_outer.coz",
"hadron_calorimeter_outer.coz",
"superconducting_solenoid_outer.coz",
"iron_muon_chambers_outer.coz"
],
"surfaces": {
"data": [
-1000.0,
1000.0,
-1000.0,
1000.0,
-2000.0,
2000.0,
900.0,
-700.0,
700.0,
15625.0,
30625.0,
75625.0,
140625.0,
490000.0
],
"sizes": [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
],
"types": [
"px",
"px",
"py",
"py",
"pz",
"pz",
"czc",
"pz",
"pz",
"czc",
"czc",
"czc",
"czc",
"czc"
]
}
}
]
}
87 changes: 87 additions & 0 deletions app/demo-loop/simple-cms.org.omn
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
!##############################################################################
! File : Geometria/orange/test/data/simple-cms.org.omn
!
! Simplified Compact Muon Solenoid proxy geometry
!##############################################################################

[GEOMETRY]
global "global"
comp : matid
si 0
pb 1
c 2
ti 3
fe 4
galactic 5

[UNIVERSE=general global]
interior "world_box"

!##############################################################################
! SHAPES ("solids")
!##############################################################################

[UNIVERSE][SHAPE=cyl guide_tube]
axis z
radius 30
length 1400

[UNIVERSE][SHAPE=cyl silicon_tracker_outer]
axis z
radius 125
length 1400

[UNIVERSE][SHAPE=cyl crystal_em_calorimeter_outer]
axis z
radius 175
length 1400

[UNIVERSE][SHAPE=cyl hadron_calorimeter_outer]
axis z
radius 275
length 1400

[UNIVERSE][SHAPE=cyl superconducting_solenoid_outer]
axis z
radius 375
length 1400

[UNIVERSE][SHAPE=cyl iron_muon_chambers_outer]
axis z
radius 700
length 1400

[UNIVERSE][SHAPE=box world_box]
widths 2000 2000 4000

!##############################################################################
! CELLS ("volumes")
!##############################################################################

[UNIVERSE][CELL guide_tube]
comp galactic
shapes guide_tube

[UNIVERSE][CELL silicon_tracker]
comp si
shapes silicon_tracker_outer ~guide_tube

[UNIVERSE][CELL crystal_em_calorimeter]
comp pb
shapes crystal_em_calorimeter_outer ~silicon_tracker_outer

[UNIVERSE][CELL hadron_calorimeter]
comp c
shapes hadron_calorimeter_outer ~crystal_em_calorimeter_outer

[UNIVERSE][CELL superconducting_solenoid]
comp ti
shapes superconducting_solenoid_outer ~hadron_calorimeter_outer

[UNIVERSE][CELL iron_muon_chambers]
comp fe
shapes iron_muon_chambers_outer ~superconducting_solenoid_outer

[UNIVERSE][CELL fill]
comp galactic
shapes -world_box +iron_muon_chambers_outer
40 changes: 40 additions & 0 deletions scripts/dev/celeritas-gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,43 @@ class {name}Test : public celeritas::Test

'''

OMN_TOP = '''\
! Copyright {year} UT-Battelle, LLC and other Celeritas Developers.
! See the top-level COPYRIGHT file for details.
! SPDX-License-Identifier: (Apache-2.0 OR MIT)
'''

ORANGE_FILE = '''
[GEOMETRY]
global "global"
comp : matid
galactic 0
detector 1

!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!

[UNIVERSE=general global]
interior "world_box"

[UNIVERSE][SHAPE=box world_box]
widths 10000 10000 10000 ! note: units are in cm

[UNIVERSE][SHAPE=cyl mycyl]
axis z
radius 10
length 20

!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!

[UNIVERSE][CELL detector]
comp detector
shapes mycyl

[UNIVERSE][CELL world_fill]
comp galactic
shapes world_box ~mycyl
'''

YEAR = datetime.today().year

TEMPLATES = {
Expand All @@ -293,6 +330,7 @@ class {name}Test : public celeritas::Test
'CMakeLists.txt': CMAKELISTS_FILE,
'py': PYTHON_FILE,
'sh': SHELL_FILE,
'org.omn': ORANGE_FILE,
}

LANG = {
Expand All @@ -306,6 +344,7 @@ class {name}Test : public celeritas::Test
'CMakeLists.txt': "CMake",
'py': "Python",
'sh': "Shell",
'omn': "Omnibus",
}

TOPS = {
Expand All @@ -315,6 +354,7 @@ class {name}Test : public celeritas::Test
'CMake': CMAKE_TOP,
'Python': PYTHON_TOP,
'Shell': SHELL_TOP,
'Omnibus': OMN_TOP,
}

HEXT = {
Expand Down
3 changes: 3 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ list(APPEND SOURCES
geometry/detail/ScopedTimeAndRedirect.cc
orange/Types.cc
orange/construct/SurfaceInserter.cc
orange/construct/VolumeInserter.cc
orange/surfaces/SurfaceIO.cc
io/ImportProcess.cc
io/ImportPhysicsTable.cc
Expand Down Expand Up @@ -133,6 +134,8 @@ if(CELERITAS_USE_JSON)
list(APPEND SOURCES
comm/DeviceIO.json.cc
comm/KernelDiagnosticsIO.json.cc
orange/construct/SurfaceInputIO.json.cc
orange/construct/VolumeInputIO.json.cc
)
list(APPEND PUBLIC_DEPS nlohmann_json::nlohmann_json)
endif()
Expand Down
Loading