Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
24c751f
refactor moeller_Truborer intersections
Lomholy Apr 28, 2026
89f6f13
Merge pull request #2423 from mccode-dev/main
Lomholy Apr 28, 2026
1dcc38a
Add in prefactored r_within mesh and implement edge intersection for …
Lomholy May 6, 2026
06ac97b
Fix erroneous transposition of rotation matrix for shell points
Lomholy May 6, 2026
d30e602
Switch to clearer r_within_mesh implementation by using refactoring o…
Lomholy May 6, 2026
c169bff
Merge branch 'main' into mesh_bugs
willend May 6, 2026
f971228
Update rotation to be correct for shell point in mesh. Also add edge …
Lomholy May 7, 2026
f7963eb
Merge branch 'mesh_bugs' of https://github.com/mccode-dev/McCode into…
Lomholy May 7, 2026
6a83449
Fix mismatch in mesh_overlap_mesh when checking for edge intersection…
Lomholy May 7, 2026
12e1b15
Fix upper case error in Test definition of Test_mesh_boxes
Lomholy May 7, 2026
c32fe7d
Remove the last vestiges of vertices represented as 9 double arrays
Lomholy May 7, 2026
f635cc0
Add error statement if file load fails for Union mesh
Lomholy May 7, 2026
b744553
Use linter on Union_mesh
Lomholy May 7, 2026
86b1679
Remove unused function
Lomholy May 7, 2026
19c7fe3
Merge branch 'main' into mesh_bugs
Lomholy May 7, 2026
d42517c
Merge branch 'mesh_bugs' of https://github.com/mccode-dev/McCode into…
Lomholy May 7, 2026
ffe4e78
Fix linter complaints
Lomholy May 7, 2026
d77b314
Cleanup of debugging statements and formatting
Lomholy May 11, 2026
6f2bb71
Remove unused parameter from test example
Lomholy May 11, 2026
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
/********************************************************************************
*
* McStas, neutron ray-tracing package
* Copyright (C) 1997-2008, All rights reserved
* Risoe National Laboratory, Roskilde, Denmark
* Institut Laue Langevin, Grenoble, France
*
* This file was written by McStasScript, which is a
* python based McStas instrument generator written by
* Mads Bertelsen in 2019 while employed at the
* European Spallation Source Data Management and
* Software Centre
*
* Instrument: Test_mesh_boxes
*
* %Identification
* Written by: Sam Lambrick with Python McStas Instrument Generator
* Date: 10:07:56 on March 05, 2026
* Origin: ESS DMSC / ISIS
* %INSTRUMENT_SITE: Tests_union
*
*
* A small instrument to investigate mesh boxes in a user configuration
*
* %Description
* Instrument provided by Sam Lambrick from ISIS, that uses three meshes to
* make their boxes.
*
* %Example: Detector: psd_detector_I=10.7752
*
* %Parameters
*
* %End
********************************************************************************/

DEFINE INSTRUMENT Test_mesh_boxes(
)

DECLARE
%{
%}

INITIALIZE
%{
// Start of initialize for generated test_union_filter
%}

TRACE
COMPONENT armOrigin = Arm()
AT (0, 0, 0) ABSOLUTE

COMPONENT Source = Moderator(
radius = 0.1, Emin = 1,
Emax = 20, dist = 2,
focus_xw = 0.1, focus_yh = 0.1,
Ec = 1000)
AT (0, 0, 0) RELATIVE armOrigin

COMPONENT armFilter = Arm()
AT (0, 0, 2) RELATIVE armOrigin

COMPONENT init = Union_init()
AT (0, 0, 0) ABSOLUTE

COMPONENT Be_NCrystal = NCrystal_process(
cfg = "Be_sg194.ncmat", interact_fraction = 1)
AT (0, 0, 0) ABSOLUTE

COMPONENT Cd_absorber = Incoherent_process(
sigma = 3.46, unit_cell_volume = 43.2,
interact_fraction = 1)
AT (0, 0, 0) ABSOLUTE

COMPONENT Be = Union_make_material(
process_string = "Be_NCrystal", my_absorption = 0.0)
AT (0, 0, 0) ABSOLUTE

COMPONENT Cd = Union_make_material(
process_string = "Cd_absorber", my_absorption = 11627.906976744185)
AT (0, 0, 0) ABSOLUTE

COMPONENT Be_envelope = Union_mesh(
filename = "./box.stl", material_string = "Be",
priority = 1, coordinate_scale = 1)
AT (0, 0, 0) RELATIVE armFilter

COMPONENT Cd_blade1 = Union_mesh(
filename = "./single_blade.stl", material_string = "Cd",
priority = 2, coordinate_scale = 1)
AT (0, -0.02, 0) RELATIVE armFilter

COMPONENT Cd_blade2 = Union_mesh(
filename = "./single_blade.stl", material_string = "Cd",
priority = 2.5, coordinate_scale = 1)
AT (0, 0.02, 0) RELATIVE armFilter

COMPONENT zy_logger = Union_logger_2D_space(
target_geometry = "Be_envelope,Cd_blade1,Cd_blade2", D_direction_1 = "z",
D1_min = -0.02, D1_max = 0.02,
n1 = 100, D_direction_2 = "y",
D2_min = -0.05, D2_max = 0.05,
n2 = 100, filename = "zy_logger.dat")
AT (0, 0, 0) RELATIVE armFilter

COMPONENT zy_logger_abs = Union_abs_logger_2D_space(
target_geometry = "Be_envelope,Cd_blade1,Cd_blade2", D_direction_1 = "z",
D1_min = -0.02, D1_max = 0.02,
n1 = 100, D_direction_2 = "y",
D2_min = -0.05, D2_max = 0.05,
n2 = 100, filename = "zy_logge_abs.dat")
AT (0, 0, 0) RELATIVE armFilter

COMPONENT master = Union_master(verbal=1)
AT (0, 0, 0) RELATIVE armFilter

COMPONENT stop = Union_stop()
AT (0, 0, 0) RELATIVE armFilter

COMPONENT psd_detector = PSD_monitor(
nx = 201, ny = 201,
filename = "psd_detector.dat", xwidth = 0.1,
yheight = 0.1, restore_neutron = 1)
AT (0, 0, 0.15) RELATIVE armFilter

COMPONENT e_detector = E_monitor(
filename = "e_detector.dat", xwidth = 0.1,
yheight = 0.1, Emin = 1,
Emax = 20)
AT (0, 0, 0.15) RELATIVE armFilter

FINALLY
%{
// Start of finally for generated test_union_filter
%}

END
87 changes: 87 additions & 0 deletions mcstas-comps/examples/Tests_union/Test_mesh_boxes/box.stl
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
solid
facet normal -1.0 0.0 0.0
outer loop
vertex -0.025 -0.025 0.005
vertex -0.025 0.025 0.005
vertex -0.025 -0.025 -0.005
endloop
endfacet
facet normal 0.0 -1.0 0.0
outer loop
vertex 0.025 -0.025 -0.005
vertex -0.025 -0.025 0.005
vertex -0.025 -0.025 -0.005
endloop
endfacet
facet normal -1.0 0.0 0.0
outer loop
vertex -0.025 -0.025 -0.005
vertex -0.025 0.025 0.005
vertex -0.025 0.025 -0.005
endloop
endfacet
facet normal 0.0 0.0 -1.0
outer loop
vertex -0.025 0.025 -0.005
vertex 0.025 -0.025 -0.005
vertex -0.025 -0.025 -0.005
endloop
endfacet
facet normal 0.0 0.0 1.0
outer loop
vertex -0.025 -0.025 0.005
vertex 0.025 0.025 0.005
vertex -0.025 0.025 0.005
endloop
endfacet
facet normal 0.0 -1.0 0.0
outer loop
vertex 0.025 -0.025 0.005
vertex -0.025 -0.025 0.005
vertex 0.025 -0.025 -0.005
endloop
endfacet
facet normal 0.0 0.0 1.0
outer loop
vertex 0.025 -0.025 0.005
vertex 0.025 0.025 0.005
vertex -0.025 -0.025 0.005
endloop
endfacet
facet normal 0.0 1.0 0.0
outer loop
vertex -0.025 0.025 0.005
vertex 0.025 0.025 0.005
vertex -0.025 0.025 -0.005
endloop
endfacet
facet normal 0.0 0.0 -1.0
outer loop
vertex 0.025 0.025 -0.005
vertex 0.025 -0.025 -0.005
vertex -0.025 0.025 -0.005
endloop
endfacet
facet normal 0.0 1.0 0.0
outer loop
vertex -0.025 0.025 -0.005
vertex 0.025 0.025 0.005
vertex 0.025 0.025 -0.005
endloop
endfacet
facet normal 1.0 0.0 0.0
outer loop
vertex 0.025 0.025 -0.005
vertex 0.025 -0.025 0.005
vertex 0.025 -0.025 -0.005
endloop
endfacet
facet normal 1.0 0.0 0.0
outer loop
vertex 0.025 0.025 0.005
vertex 0.025 -0.025 0.005
vertex 0.025 0.025 -0.005
endloop
endfacet

endsolid
87 changes: 87 additions & 0 deletions mcstas-comps/examples/Tests_union/Test_mesh_boxes/single_blade.stl
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
solid
facet normal -1.0 0.0 0.0
outer loop
vertex -0.03 -0.00202669681901379 0.005735198340406318
vertex -0.03 -5.708131298937399e-05 0.006082494695740179
vertex -0.03 5.708131298937399e-05 -0.006082494695740179
endloop
endfacet
facet normal 0.0 -0.9848077530122082 -0.17364817766693036
outer loop
vertex 0.03 5.708131298937399e-05 -0.006082494695740179
vertex -0.03 -0.00202669681901379 0.005735198340406318
vertex -0.03 5.708131298937399e-05 -0.006082494695740179
endloop
endfacet
facet normal -1.0 0.0 0.0
outer loop
vertex -0.03 5.708131298937399e-05 -0.006082494695740179
vertex -0.03 -5.708131298937399e-05 0.006082494695740179
vertex -0.03 0.00202669681901379 -0.005735198340406318
endloop
endfacet
facet normal 0.0 0.17364817766693036 -0.9848077530122082
outer loop
vertex -0.03 0.00202669681901379 -0.005735198340406318
vertex 0.03 5.708131298937399e-05 -0.006082494695740179
vertex -0.03 5.708131298937399e-05 -0.006082494695740179
endloop
endfacet
facet normal 0.0 -0.17364817766693036 0.9848077530122082
outer loop
vertex -0.03 -0.00202669681901379 0.005735198340406318
vertex 0.03 -5.708131298937399e-05 0.006082494695740179
vertex -0.03 -5.708131298937399e-05 0.006082494695740179
endloop
endfacet
facet normal 0.0 -0.9848077530122082 -0.17364817766693036
outer loop
vertex 0.03 -0.00202669681901379 0.005735198340406318
vertex -0.03 -0.00202669681901379 0.005735198340406318
vertex 0.03 5.708131298937399e-05 -0.006082494695740179
endloop
endfacet
facet normal 0.0 -0.17364817766693036 0.9848077530122082
outer loop
vertex 0.03 -0.00202669681901379 0.005735198340406318
vertex 0.03 -5.708131298937399e-05 0.006082494695740179
vertex -0.03 -0.00202669681901379 0.005735198340406318
endloop
endfacet
facet normal 0.0 0.9848077530122082 0.17364817766693036
outer loop
vertex -0.03 -5.708131298937399e-05 0.006082494695740179
vertex 0.03 -5.708131298937399e-05 0.006082494695740179
vertex -0.03 0.00202669681901379 -0.005735198340406318
endloop
endfacet
facet normal 0.0 0.17364817766693036 -0.9848077530122082
outer loop
vertex 0.03 0.00202669681901379 -0.005735198340406318
vertex 0.03 5.708131298937399e-05 -0.006082494695740179
vertex -0.03 0.00202669681901379 -0.005735198340406318
endloop
endfacet
facet normal 0.0 0.9848077530122082 0.17364817766693036
outer loop
vertex -0.03 0.00202669681901379 -0.005735198340406318
vertex 0.03 -5.708131298937399e-05 0.006082494695740179
vertex 0.03 0.00202669681901379 -0.005735198340406318
endloop
endfacet
facet normal 1.0 0.0 0.0
outer loop
vertex 0.03 0.00202669681901379 -0.005735198340406318
vertex 0.03 -0.00202669681901379 0.005735198340406318
vertex 0.03 5.708131298937399e-05 -0.006082494695740179
endloop
endfacet
facet normal 1.0 0.0 0.0
outer loop
vertex 0.03 -5.708131298937399e-05 0.006082494695740179
vertex 0.03 -0.00202669681901379 0.005735198340406318
vertex 0.03 0.00202669681901379 -0.005735198340406318
endloop
endfacet

endsolid
Loading
Loading