xcoll 0.3.6__py3-none-any.whl → 0.5.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of xcoll might be problematic. Click here for more details.

Files changed (350) hide show
  1. xcoll/__init__.py +13 -4
  2. xcoll/beam_elements/__init__.py +14 -6
  3. xcoll/beam_elements/absorber.py +41 -7
  4. xcoll/beam_elements/base.py +1202 -247
  5. xcoll/beam_elements/blowup.py +198 -0
  6. xcoll/beam_elements/elements_src/black_absorber.h +136 -0
  7. xcoll/beam_elements/elements_src/black_crystal.h +129 -0
  8. xcoll/beam_elements/elements_src/blowup.h +42 -0
  9. xcoll/beam_elements/elements_src/emittance_monitor.h +109 -0
  10. xcoll/beam_elements/{collimators_src → elements_src}/everest_block.h +59 -30
  11. xcoll/beam_elements/elements_src/everest_collimator.h +237 -0
  12. xcoll/beam_elements/elements_src/everest_crystal.h +280 -0
  13. xcoll/beam_elements/everest.py +65 -119
  14. xcoll/beam_elements/monitor.py +428 -0
  15. xcoll/colldb.py +276 -747
  16. xcoll/general.py +5 -5
  17. xcoll/headers/checks.h +1 -1
  18. xcoll/headers/particle_states.h +2 -2
  19. xcoll/initial_distribution.py +207 -0
  20. xcoll/install.py +179 -0
  21. xcoll/interaction_record/__init__.py +1 -0
  22. xcoll/interaction_record/interaction_record.py +298 -0
  23. xcoll/interaction_record/interaction_record_src/interaction_record.h +98 -0
  24. xcoll/{impacts → interaction_record}/interaction_types.py +11 -4
  25. xcoll/line_tools.py +82 -0
  26. xcoll/lossmap.py +219 -0
  27. xcoll/manager.py +2 -937
  28. xcoll/rf_sweep.py +1 -1
  29. xcoll/scattering_routines/everest/amorphous.h +232 -0
  30. xcoll/scattering_routines/everest/channeling.h +240 -0
  31. xcoll/scattering_routines/everest/crystal_parameters.h +137 -0
  32. xcoll/scattering_routines/everest/everest.h +11 -30
  33. xcoll/scattering_routines/everest/everest.py +13 -10
  34. xcoll/scattering_routines/everest/jaw.h +28 -197
  35. xcoll/scattering_routines/everest/materials.py +37 -15
  36. xcoll/scattering_routines/everest/multiple_coulomb_scattering.h +31 -10
  37. xcoll/scattering_routines/everest/nuclear_interaction.h +86 -0
  38. xcoll/scattering_routines/everest/properties.h +6 -1
  39. xcoll/scattering_routines/fluka/flukaio/lib/libFlukaIO64.a +0 -0
  40. xcoll/scattering_routines/geant4/collimasim/.git +1 -0
  41. xcoll/scattering_routines/geant4/collimasim/.gitignore +12 -0
  42. xcoll/scattering_routines/geant4/collimasim/.gitmodules +3 -0
  43. xcoll/scattering_routines/geant4/collimasim/CMakeLists.txt +26 -0
  44. xcoll/scattering_routines/geant4/collimasim/README.md +21 -0
  45. xcoll/scattering_routines/geant4/collimasim/docs/Makefile +20 -0
  46. xcoll/scattering_routines/geant4/collimasim/docs/make.bat +35 -0
  47. xcoll/scattering_routines/geant4/collimasim/docs/source/collimasim.rst +10 -0
  48. xcoll/scattering_routines/geant4/collimasim/docs/source/conf.py +59 -0
  49. xcoll/scattering_routines/geant4/collimasim/docs/source/index.rst +26 -0
  50. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.appveyor.yml +37 -0
  51. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-format +19 -0
  52. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-tidy +65 -0
  53. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.cmake-format.yaml +73 -0
  54. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.git +1 -0
  55. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CODEOWNERS +9 -0
  56. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CONTRIBUTING.md +386 -0
  57. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/bug-report.yml +45 -0
  58. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/config.yml +8 -0
  59. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/dependabot.yml +16 -0
  60. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler.yml +8 -0
  61. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler_merged.yml +3 -0
  62. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/pull_request_template.md +19 -0
  63. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/ci.yml +969 -0
  64. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/configure.yml +84 -0
  65. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/format.yml +48 -0
  66. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/labeler.yml +16 -0
  67. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/pip.yml +103 -0
  68. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.gitignore +45 -0
  69. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.pre-commit-config.yaml +151 -0
  70. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.readthedocs.yml +3 -0
  71. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/CMakeLists.txt +297 -0
  72. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/LICENSE +29 -0
  73. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/MANIFEST.in +6 -0
  74. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/README.rst +180 -0
  75. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Doxyfile +23 -0
  76. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Makefile +192 -0
  77. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/_static/theme_overrides.css +11 -0
  78. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/chrono.rst +81 -0
  79. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/custom.rst +93 -0
  80. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/eigen.rst +310 -0
  81. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/functional.rst +109 -0
  82. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/index.rst +43 -0
  83. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/overview.rst +171 -0
  84. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/stl.rst +251 -0
  85. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/strings.rst +305 -0
  86. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/classes.rst +1297 -0
  87. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/embedding.rst +262 -0
  88. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/exceptions.rst +396 -0
  89. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/functions.rst +568 -0
  90. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/misc.rst +337 -0
  91. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/index.rst +13 -0
  92. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/numpy.rst +463 -0
  93. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/object.rst +286 -0
  94. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/utilities.rst +155 -0
  95. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/smart_ptrs.rst +174 -0
  96. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/basics.rst +308 -0
  97. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.py +91 -0
  98. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.rst +95 -0
  99. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/changelog.rst +2050 -0
  100. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/classes.rst +542 -0
  101. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/cmake/index.rst +8 -0
  102. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/compiling.rst +648 -0
  103. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/conf.py +381 -0
  104. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/faq.rst +343 -0
  105. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/index.rst +48 -0
  106. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/installing.rst +105 -0
  107. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/limitations.rst +72 -0
  108. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11-logo.png +0 -0
  109. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python1.png +0 -0
  110. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python1.svg +427 -0
  111. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python2.png +0 -0
  112. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python2.svg +427 -0
  113. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/reference.rst +130 -0
  114. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/release.rst +96 -0
  115. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/requirements.txt +8 -0
  116. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/upgrade.rst +548 -0
  117. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/attr.h +605 -0
  118. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/buffer_info.h +144 -0
  119. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/cast.h +1432 -0
  120. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/chrono.h +213 -0
  121. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/common.h +2 -0
  122. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/complex.h +65 -0
  123. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/class.h +709 -0
  124. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/common.h +1021 -0
  125. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/descr.h +104 -0
  126. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/init.h +346 -0
  127. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/internals.h +467 -0
  128. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/type_caster_base.h +978 -0
  129. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/typeid.h +55 -0
  130. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eigen.h +606 -0
  131. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/embed.h +284 -0
  132. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eval.h +163 -0
  133. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/functional.h +121 -0
  134. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/gil.h +193 -0
  135. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/iostream.h +275 -0
  136. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/numpy.h +1741 -0
  137. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/operators.h +163 -0
  138. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/options.h +65 -0
  139. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pybind11.h +2497 -0
  140. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pytypes.h +1879 -0
  141. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl/filesystem.h +103 -0
  142. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl.h +375 -0
  143. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl_bind.h +747 -0
  144. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/noxfile.py +88 -0
  145. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__init__.py +11 -0
  146. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__main__.py +52 -0
  147. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.py +12 -0
  148. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.pyi +6 -0
  149. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/commands.py +21 -0
  150. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/py.typed +0 -0
  151. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.py +482 -0
  152. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.pyi +63 -0
  153. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pyproject.toml +41 -0
  154. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.cfg +56 -0
  155. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.py +155 -0
  156. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/CMakeLists.txt +503 -0
  157. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/conftest.py +208 -0
  158. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/constructor_stats.h +275 -0
  159. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/cross_module_gil_utils.cpp +73 -0
  160. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/env.py +33 -0
  161. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_python_package/pytest.ini +0 -0
  162. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_python_package/test_files.py +279 -0
  163. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_setuptools/pytest.ini +0 -0
  164. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_setuptools/test_setuphelper.py +143 -0
  165. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/local_bindings.h +85 -0
  166. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/object.h +179 -0
  167. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_cross_module_tests.cpp +151 -0
  168. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.cpp +91 -0
  169. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.h +85 -0
  170. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pytest.ini +19 -0
  171. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/requirements.txt +12 -0
  172. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.cpp +26 -0
  173. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.py +25 -0
  174. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.cpp +216 -0
  175. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.py +163 -0
  176. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.cpp +286 -0
  177. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.py +536 -0
  178. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.cpp +107 -0
  179. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.py +248 -0
  180. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.cpp +227 -0
  181. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.py +202 -0
  182. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.cpp +84 -0
  183. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.py +210 -0
  184. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.cpp +550 -0
  185. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.py +473 -0
  186. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/CMakeLists.txt +84 -0
  187. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/embed.cpp +21 -0
  188. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_embed/CMakeLists.txt +28 -0
  189. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_function/CMakeLists.txt +39 -0
  190. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_target/CMakeLists.txt +46 -0
  191. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/main.cpp +6 -0
  192. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt +41 -0
  193. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt +35 -0
  194. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_target/CMakeLists.txt +41 -0
  195. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/test.py +10 -0
  196. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.cpp +165 -0
  197. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.py +53 -0
  198. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.cpp +238 -0
  199. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.py +126 -0
  200. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.cpp +141 -0
  201. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.py +117 -0
  202. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.cpp +41 -0
  203. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.py +50 -0
  204. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.cpp +69 -0
  205. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.py +42 -0
  206. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.cpp +348 -0
  207. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.py +771 -0
  208. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/CMakeLists.txt +47 -0
  209. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/catch.cpp +22 -0
  210. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/external_module.cpp +23 -0
  211. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.cpp +326 -0
  212. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.py +15 -0
  213. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.cpp +148 -0
  214. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.py +272 -0
  215. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.cpp +119 -0
  216. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.py +51 -0
  217. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval_call.py +5 -0
  218. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.cpp +285 -0
  219. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.h +12 -0
  220. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.py +265 -0
  221. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.cpp +397 -0
  222. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.py +520 -0
  223. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.cpp +49 -0
  224. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.py +94 -0
  225. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.cpp +125 -0
  226. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.py +331 -0
  227. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.cpp +153 -0
  228. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.py +284 -0
  229. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.cpp +107 -0
  230. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.py +257 -0
  231. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.cpp +412 -0
  232. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.py +517 -0
  233. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.cpp +102 -0
  234. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.py +92 -0
  235. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.cpp +233 -0
  236. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.py +360 -0
  237. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.cpp +472 -0
  238. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.py +593 -0
  239. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.cpp +524 -0
  240. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.py +441 -0
  241. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.cpp +103 -0
  242. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.py +267 -0
  243. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.cpp +73 -0
  244. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.py +59 -0
  245. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.cpp +235 -0
  246. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.py +146 -0
  247. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.cpp +189 -0
  248. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.py +82 -0
  249. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.cpp +560 -0
  250. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.py +651 -0
  251. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.cpp +500 -0
  252. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.py +253 -0
  253. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.cpp +452 -0
  254. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.py +318 -0
  255. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.cpp +342 -0
  256. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.py +291 -0
  257. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.cpp +131 -0
  258. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.py +318 -0
  259. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.cpp +144 -0
  260. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.py +29 -0
  261. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.cpp +66 -0
  262. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.py +44 -0
  263. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.cpp +22 -0
  264. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.py +9 -0
  265. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.cpp +510 -0
  266. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.py +408 -0
  267. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-numpy-scipy.supp +140 -0
  268. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-python.supp +117 -0
  269. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindCatch.cmake +70 -0
  270. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindEigen3.cmake +86 -0
  271. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindPythonLibsNew.cmake +257 -0
  272. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/check-style.sh +44 -0
  273. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/cmake_uninstall.cmake.in +23 -0
  274. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/libsize.py +39 -0
  275. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/make_changelog.py +64 -0
  276. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Common.cmake +402 -0
  277. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Config.cmake.in +233 -0
  278. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11NewTools.cmake +276 -0
  279. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Tools.cmake +214 -0
  280. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pyproject.toml +3 -0
  281. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_global.py.in +65 -0
  282. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_main.py.in +41 -0
  283. xcoll/scattering_routines/geant4/collimasim/pyproject.toml +8 -0
  284. xcoll/scattering_routines/geant4/collimasim/setup.py +144 -0
  285. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.cpp +403 -0
  286. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.hh +100 -0
  287. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.cpp +763 -0
  288. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.hh +118 -0
  289. xcoll/scattering_routines/geant4/collimasim/src/collimasim/__init__.py +8 -0
  290. xcoll/scattering_routines/geant4/collimasim/src/collimasim/bindings.cpp +63 -0
  291. xcoll/scattering_routines/geant4/collimasim/src/collimasim/pyCollimatorPass.py +142 -0
  292. xcoll/scattering_routines/geant4/collimasim/src/collimasim/xtrack_collimator.py +556 -0
  293. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/PKG-INFO +6 -0
  294. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/SOURCES.txt +24 -0
  295. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/dependency_links.txt +1 -0
  296. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/not-zip-safe +1 -0
  297. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/top_level.txt +1 -0
  298. xcoll/scattering_routines/geant4/collimasim/tests/README.md +25 -0
  299. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_forions.dat +25 -0
  300. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_new_example.dat +18 -0
  301. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_old_example.dat +68 -0
  302. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_testing.dat +15 -0
  303. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_yaml_example.yaml +110 -0
  304. xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps.dat +7 -0
  305. xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps_pyat_test.dat +3 -0
  306. xcoll/scattering_routines/geant4/collimasim/tests/resources/collonly_twiss_file_example.tfs +54 -0
  307. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings.gmad +3 -0
  308. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings_black_absorber.gmad +3 -0
  309. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings_ions.gmad +5 -0
  310. xcoll/scattering_routines/geant4/collimasim/tests/resources/twiss_file_testing.tfs +51 -0
  311. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat.py +65 -0
  312. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_passmethod.py +59 -0
  313. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_tracking.py +102 -0
  314. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack.py +75 -0
  315. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_angle.py +74 -0
  316. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_colldb_load.py +84 -0
  317. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_interaction.py +159 -0
  318. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_interaction_ion.py +99 -0
  319. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_ions.py +78 -0
  320. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_lost_energy.py +88 -0
  321. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tilt.py +80 -0
  322. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tracking.py +97 -0
  323. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tracking_ions.py +96 -0
  324. xcoll/scattering_routines/geometry/__init__.py +6 -0
  325. xcoll/scattering_routines/geometry/collimator_geometry.h +218 -0
  326. xcoll/scattering_routines/geometry/crystal_geometry.h +153 -0
  327. xcoll/scattering_routines/geometry/geometry.py +26 -0
  328. xcoll/scattering_routines/geometry/get_s.h +92 -0
  329. xcoll/scattering_routines/geometry/methods.h +111 -0
  330. xcoll/scattering_routines/geometry/objects.h +154 -0
  331. xcoll/scattering_routines/geometry/rotation.h +23 -0
  332. xcoll/scattering_routines/geometry/segments.h +226 -0
  333. xcoll/scattering_routines/geometry/sort.h +184 -0
  334. {xcoll-0.3.6.dist-info → xcoll-0.5.0.dist-info}/METADATA +1 -1
  335. xcoll-0.5.0.dist-info/RECORD +413 -0
  336. xcoll/beam_elements/collimators_src/absorber.h +0 -141
  337. xcoll/beam_elements/collimators_src/everest_collimator.h +0 -142
  338. xcoll/beam_elements/collimators_src/everest_crystal.h +0 -115
  339. xcoll/collimator_settings.py +0 -457
  340. xcoll/impacts/__init__.py +0 -1
  341. xcoll/impacts/impacts.py +0 -102
  342. xcoll/impacts/impacts_src/impacts.h +0 -99
  343. xcoll/scattering_routines/everest/crystal.h +0 -1302
  344. xcoll/scattering_routines/everest/scatter.h +0 -169
  345. xcoll/scattering_routines/everest/scatter_crystal.h +0 -260
  346. xcoll/scattering_routines/fluka/build_fluka_input.py +0 -58
  347. xcoll-0.3.6.dist-info/RECORD +0 -111
  348. {xcoll-0.3.6.dist-info → xcoll-0.5.0.dist-info}/LICENSE +0 -0
  349. {xcoll-0.3.6.dist-info → xcoll-0.5.0.dist-info}/NOTICE +0 -0
  350. {xcoll-0.3.6.dist-info → xcoll-0.5.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,111 @@
1
+ // copyright ############################### #
2
+ // This file is part of the Xcoll Package. #
3
+ // Copyright (c) CERN, 2024. #
4
+ // ######################################### #
5
+
6
+ #ifndef XCOLL_GEOM_METHODS_H
7
+ #define XCOLL_GEOM_METHODS_H
8
+ #include <math.h>
9
+ #include <stdio.h>
10
+ #include <stdint.h>
11
+ #include <stdlib.h>
12
+
13
+ #define S_MAX 1.e21
14
+
15
+
16
+ /*gpufun*/
17
+ void find_crossing(int8_t* n_hit, double* s, double part_x, double part_tan, \
18
+ Segment* segments, int8_t n_segments){
19
+ for (int8_t i=0; i<n_segments;i++) {
20
+ segments[i]->crossing(n_hit, s, part_x, part_tan, segments[i]);
21
+ }
22
+ sort_array_of_double(s, (int64_t) *n_hit);
23
+ }
24
+
25
+
26
+ // IMPORTANT:
27
+ // The array and interval are assumed to be sorted!
28
+ // Furthermore, the array should have one extra slot allocated at the end, in case it needs to be expanded..
29
+ // This is always true for the arrays created by get_s, as we create them with 2*n_segments slots.
30
+ /*gpufun*/
31
+ void calculate_overlap_array_interval(double* arr, int8_t* length, double* interval){
32
+ if (arr[0] > interval[1]){
33
+ // No overlap
34
+ *length = 0;
35
+ }
36
+ if ((*length)%2 == 1){
37
+ // Special case: last interval of array is open until infinity,
38
+ // so we add an extra point at the end to represent infinity.
39
+ arr[*length] = S_MAX*0.1;
40
+ (*length)++;
41
+ } else if (arr[*length-1] < interval[0]){
42
+ // No overlap
43
+ *length = 0;
44
+ }
45
+ int8_t i_start = 0;
46
+ // Find the start of overlap
47
+ for (int8_t i=0; i<*length; i++){
48
+ if (arr[i] >= interval[0]){
49
+ if (i%2 == 0){
50
+ // This is the first point of overlap
51
+ i_start = i;
52
+ } else {
53
+ // The vertical restriction is the first point of overlap
54
+ i_start = i-1;
55
+ arr[i_start] = interval[0];
56
+ }
57
+ break;
58
+ }
59
+ }
60
+ // Find the end of overlap
61
+ int8_t i_stop = *length - 1;
62
+ for (int8_t i=0; i<*length; i++){
63
+ if (arr[i] >= interval[1]){
64
+ if (i%2 == 0){
65
+ // The previous point is the last point of overlap
66
+ i_stop = i-1;
67
+ } else {
68
+ // The vertical restriction is the first point of overlap
69
+ i_stop = i;
70
+ arr[i_stop] = interval[1];
71
+ }
72
+ break;
73
+ }
74
+ }
75
+ *length = i_stop - i_start + 1;
76
+ if (i_start > 0){
77
+ for (int8_t i=0; i<*length; i++){
78
+ arr[i] = arr[i+i_start];
79
+ }
80
+ }
81
+ }
82
+
83
+
84
+ /*gpufun*/
85
+ void find_crossing_with_vlimit(int8_t* n_hit, double* s, double part_x, double part_tan_x, \
86
+ double part_y, double part_tan_y, Segment* segments, \
87
+ int8_t n_segments, double y_min, double y_max){
88
+ if (fabs(part_tan_y) < 1.e-12){
89
+ // Trajectory parallel to s axis
90
+ if (part_y < y_min || part_y > y_max){
91
+ // No crossing
92
+ return;
93
+ } else {
94
+ // The particle is completely inside the vertical limits, so only check horizontal
95
+ find_crossing(n_hit, s, part_x, part_tan_x, segments, n_segments);
96
+ return;
97
+ }
98
+ } else {
99
+ find_crossing(n_hit, s, part_x, part_tan_x, segments, n_segments);
100
+ // restrict_s is the region [s0, s1] where the particle is inside the vertical limits
101
+ double* restrict_s = (double*) malloc(2*sizeof(double));
102
+ restrict_s[0] = (y_min - part_y)/part_tan_y;
103
+ restrict_s[1] = (y_max - part_y)/part_tan_y;
104
+ SWAP(restrict_s, 0, 1); // To make sure these are sorted
105
+ calculate_overlap_array_interval(s, n_hit, restrict_s);
106
+ free(restrict_s);
107
+ }
108
+ }
109
+
110
+
111
+ #endif /* XCOLL_GEOM_METHODS_H */
@@ -0,0 +1,154 @@
1
+ // copyright ############################### #
2
+ // This file is part of the Xcoll Package. #
3
+ // Copyright (c) CERN, 2024. #
4
+ // ######################################### #
5
+
6
+ #ifndef XCOLL_GEOM_OBJECTS_H
7
+ #define XCOLL_GEOM_OBJECTS_H
8
+ #include <math.h>
9
+ #include <stdio.h>
10
+ #include <stdint.h>
11
+ #include <stdlib.h>
12
+
13
+
14
+ // Assumption for all objects: the particle at -inf is outside the object (otherwise some comparisons might give wrong results)
15
+
16
+
17
+ // Collimator jaw
18
+ // --------------
19
+
20
+ /*gpufun*/
21
+ Segment* create_jaw(double s_U, double x_U, double s_D, double x_D, double tilt_tan, int8_t side){
22
+ Segment* segments= (Segment*) malloc(3*sizeof(Segment));
23
+ segments[0] = (Segment) create_halfopen_line_segment(s_U, x_U, tilt_tan, side);
24
+ segments[1] = (Segment) create_line_segment(s_U, x_U, s_D, x_D);
25
+ segments[2] = (Segment) create_halfopen_line_segment(s_D, x_D, tilt_tan, side);
26
+ return segments;
27
+ }
28
+
29
+ /*gpufun*/
30
+ void destroy_jaw(Segment* segments){
31
+ free((HalfOpenLineSegment) segments[0]);
32
+ free((LineSegment) segments[1]);
33
+ free((HalfOpenLineSegment) segments[2]);
34
+ free(segments);
35
+ }
36
+
37
+
38
+ // Polygon
39
+ // -------
40
+
41
+ /*gpufun*/
42
+ Segment* create_polygon(double* s_poly, double* x_poly, int8_t num_polys){
43
+ Segment* segments= (Segment*) malloc((unsigned int) num_polys*sizeof(Segment));
44
+ for (int8_t i=0; i<num_polys-1; i++){
45
+ segments[i] = (Segment) create_line_segment(s_poly[i], x_poly[i], s_poly[i+1], x_poly[i+1]);
46
+ }
47
+ segments[num_polys-1] = (Segment) create_line_segment(s_poly[num_polys-1], x_poly[num_polys-1], \
48
+ s_poly[0], x_poly[0]);
49
+ return segments;
50
+ }
51
+
52
+ /*gpufun*/
53
+ void destroy_polygon(Segment* segments, int8_t num_polys){
54
+ for (int8_t i=0; i<num_polys; i++) {
55
+ free((LineSegment) segments[i]);
56
+ }
57
+ free(segments);
58
+ }
59
+
60
+
61
+ // Open polygon
62
+ // ------------
63
+
64
+ /*gpufun*/
65
+ Segment* create_open_polygon(double* s_poly, double* x_poly, int8_t num_polys, double tilt_tan, int8_t side){
66
+ Segment* segments= (Segment*) malloc((num_polys+1)*sizeof(Segment));
67
+ segments[0] = (Segment) create_halfopen_line_segment(s_poly[0], x_poly[0], tilt_tan, side);
68
+ for (int8_t i=1; i<num_polys; i++){
69
+ segments[i] = (Segment) create_line_segment(s_poly[i-1], x_poly[i-1], s_poly[i], x_poly[i]);
70
+ }
71
+ segments[num_polys] = (Segment) create_halfopen_line_segment(s_poly[num_polys-1], x_poly[num_polys-1], \
72
+ tilt_tan, side);
73
+ return segments;
74
+ }
75
+
76
+ /*gpufun*/
77
+ void destroy_open_polygon(Segment* segments, int8_t num_polys){
78
+ free((HalfOpenLineSegment) segments[0]);
79
+ for (int8_t i=1; i<num_polys; i++) {
80
+ free((LineSegment) segments[i]);
81
+ }
82
+ free((HalfOpenLineSegment) segments[num_polys]);
83
+ free(segments);
84
+ }
85
+
86
+
87
+ // Crystal
88
+ // -------
89
+
90
+ // The four corners A, B, C, D are such that AB is the front face, BC the curve furthest from the beam,
91
+ // CD the back face, and DA the curve closest to the beam.
92
+ /*gpufun*/
93
+ Segment* create_crystal(double R, double width, double length, double jaw_U, double tilt_sin, double tilt_cos){
94
+ Segment* segments= (Segment*) malloc(4*sizeof(Segment));
95
+
96
+ // First corner is what defines the crystal position
97
+ double A_s = 0;
98
+ double A_x = jaw_U;
99
+
100
+ // Manipulate R in function of sign
101
+ double sgnR = (R > 0) - (R < 0);
102
+ double R_short = sgnR*(fabs(R) - width);
103
+ double sin_a = length/fabs(R);
104
+ double cos_a = sqrt(1 - length*length/R/R);
105
+ if (fabs(R) < 1.e-12){
106
+ // straight crystal - not yet implemented
107
+ printf("Straight crystal not yet implemented!"); //only_for_context cpu_serial
108
+ fflush(stdout); //only_for_context cpu_serial
109
+ return NULL;
110
+
111
+ } else if (R < 0){
112
+ // This distinction is needed to keep the crystal at the same location when changing the bend direction
113
+ double R_temp = R_short;
114
+ R_short = R;
115
+ R = R_temp;
116
+ }
117
+
118
+ // Bending centre is defined w.r.t. A
119
+ double R_s = A_s - R*tilt_sin;
120
+ double R_x = A_x + R*tilt_cos;
121
+
122
+ // Three remaining corner points of crystal
123
+ double B_s = R_s + R_short*tilt_sin;
124
+ double C_s = R_s + fabs(R_short)*sin_a*tilt_cos + R_short*cos_a*tilt_sin;
125
+ double D_s = R_s + fabs(R)*sin_a*tilt_cos + R*cos_a*tilt_sin;
126
+ double B_x = R_x - R_short*tilt_cos;
127
+ double C_x = R_x - cos_a*tilt_cos*R_short + sin_a*tilt_sin*fabs(R_short);
128
+ double D_x = R_x - cos_a*tilt_cos*R + sin_a*tilt_sin*fabs(R);
129
+ double A_t = atan2(A_x - R_x, A_s - R_s);
130
+ double D_t = atan2(D_x - R_x, D_s - R_s);
131
+ double t1 = MIN(A_t, D_t);
132
+ double t2 = MAX(A_t, D_t);
133
+
134
+ // Fill segments
135
+ segments[0] = (Segment) create_line_segment(A_s, A_x, B_s, B_x);
136
+ segments[1] = (Segment) create_circular_segment(R, R_s, R_x, t1, t2);
137
+ segments[2] = (Segment) create_line_segment(C_s, C_x, D_s, D_x);
138
+ segments[3] = (Segment) create_circular_segment(R_short, R_s, R_x, t1, t2);
139
+
140
+ // printf("R: (%f, %f) A: (%f, %f) B: (%f, %f) C: (%f, %f) D: (%f, %f) t1: %f t2: %f\n", R_s,R_x,A_s,A_x,B_s,B_x,C_s,C_x,D_s,D_x,t1*180/3.141592653589793,t2*180/3.141592653589793); fflush(stdout);
141
+ return segments;
142
+ }
143
+
144
+ /*gpufun*/
145
+ void destroy_crystal(Segment* segments){
146
+ free((LineSegment) segments[0]);
147
+ free((CircularSegment) segments[1]);
148
+ free((LineSegment) segments[2]);
149
+ free((CircularSegment) segments[3]);
150
+ free(segments);
151
+ }
152
+
153
+
154
+ #endif /* XCOLL_GEOM_OBJECTS_H */
@@ -0,0 +1,23 @@
1
+ // copyright ############################### #
2
+ // This file is part of the Xcoll Package. #
3
+ // Copyright (c) CERN, 2024. #
4
+ // ######################################### #
5
+
6
+ #ifndef XCOLL_GEOM_ROT_H
7
+ #define XCOLL_GEOM_ROT_H
8
+ #include <math.h>
9
+ #include <stdio.h>
10
+
11
+
12
+ /*gpufun*/
13
+ double YRotation_single_particle_rotate_only(LocalParticle* part, double s, double angle){
14
+ double x = LocalParticle_get_x(part);
15
+ double rpp = LocalParticle_get_rpp(part);
16
+ double sin_y = sin(angle);
17
+ double cos_y = cos(angle);
18
+ LocalParticle_set_x(part, x*cos_y - s*sin_y);
19
+ LocalParticle_add_to_px(part,-angle/rpp);
20
+ return x*sin_y + s*cos_y; // new s
21
+ }
22
+
23
+ #endif /* XCOLL_GEOM_ROT_H */
@@ -0,0 +1,226 @@
1
+ // copyright ############################### #
2
+ // This file is part of the Xcoll Package. #
3
+ // Copyright (c) CERN, 2024. #
4
+ // ######################################### #
5
+
6
+ #ifndef XCOLL_GEOM_SEGMENTS_H
7
+ #define XCOLL_GEOM_SEGMENTS_H
8
+ #include <math.h>
9
+ #include <stdio.h>
10
+ #include <stdint.h>
11
+ #include <stdlib.h>
12
+
13
+
14
+ // These functions compare a particle trajectory (straight line with slope part_tan going
15
+ // through the point [0, part_x]) with a given segment of specific type.
16
+ // The results are always stored in an array s, and n_hit keeps track of the number of hits.
17
+
18
+
19
+ #define XC_MAX_CROSS_PER_SEGMENT 2 // Update if new segment type allows more crossings
20
+
21
+
22
+ // Function that calculates the crossing with a given segment
23
+ typedef void (*CrossingFunc)(int8_t*, double*, double, double, void*);
24
+
25
+
26
+ // Parent type for all segments
27
+ // ----------------------------
28
+ typedef struct Segment_{
29
+ CrossingFunc crossing;
30
+ } Segment_;
31
+ typedef Segment_* Segment;
32
+
33
+
34
+ // Line segment
35
+ // ------------
36
+
37
+ // Line segment defined by two points (s1, x1), (s2, x2). The function will fill in the segment
38
+ // points in the trajectory equation; if the results have opposite sign, the two points lie on
39
+ // different sides of the trajectory and hence the segment is crossed.
40
+
41
+ typedef struct LineSegment_ {
42
+ CrossingFunc crossing;
43
+ double point1_s;
44
+ double point1_x;
45
+ double point2_s;
46
+ double point2_x;
47
+ } LineSegment_;
48
+ typedef LineSegment_* LineSegment;
49
+
50
+ /*gpufun*/
51
+ void get_s_of_crossing_with_line_segment(int8_t* n_hit, double* s, double part_x, double part_tan, void* self){
52
+ // Get segment data
53
+ LineSegment seg = (LineSegment) self;
54
+ double s_p1 = seg->point1_s;
55
+ double s_p2 = seg->point2_s;
56
+ double x_p1 = seg->point1_x;
57
+ double x_p2 = seg->point2_x;
58
+ // Calculate crossings
59
+ double trajectory_p1 = x_p1 - part_x - s_p1*part_tan;
60
+ double trajectory_p2 = x_p2 - part_x - s_p2*part_tan;
61
+ if (trajectory_p1*trajectory_p2 <= 0){
62
+ // It's a crossing
63
+ if (fabs(s_p2 - s_p1) < 1.e-12){
64
+ s[*n_hit] = s_p1;
65
+ (*n_hit)++;
66
+ } else {
67
+ double poly_tan = (x_p2 - x_p1)/(s_p2 - s_p1);
68
+ if (fabs(poly_tan - part_tan) < 1.e-12){
69
+ s[*n_hit] = s_p1;
70
+ (*n_hit)++;
71
+ } else {
72
+ s[*n_hit] = (part_x - x_p1 + s_p1*poly_tan)/(poly_tan - part_tan);
73
+ (*n_hit)++;
74
+ }
75
+ }
76
+ }
77
+ }
78
+
79
+ /*gpufun*/
80
+ LineSegment create_line_segment(double point1_s, double point1_x, double point2_s, double point2_x){
81
+ LineSegment seg = (LineSegment) malloc(sizeof(LineSegment_));
82
+ seg->crossing = &get_s_of_crossing_with_line_segment;
83
+ seg->point1_s = point1_s;
84
+ seg->point2_s = point2_s;
85
+ seg->point1_x = point1_x;
86
+ seg->point2_x = point2_x;
87
+ return seg;
88
+ }
89
+
90
+
91
+ // Half-open line segment
92
+ // ----------------------
93
+
94
+ // This function works as above, but considers a half-open segment. For this reason,
95
+ // the function needs to know whether this is a positive or negative jaw (representing
96
+ // to which infinite it points), and the overall tilt of the jaw.
97
+ typedef struct HalfOpenLineSegment_ {
98
+ CrossingFunc crossing;
99
+ double point_s;
100
+ double point_x;
101
+ int8_t side;
102
+ // Important: this is the perpendicular angle (hence we will use -1/point_tan)
103
+ // This is done because the case "point_tan == 0" cannot take place in our setup,
104
+ // but "point_tan == inf" can (when the jaws have no tilt).
105
+ double point_tan;
106
+ } HalfOpenLineSegment_;
107
+ typedef HalfOpenLineSegment_* HalfOpenLineSegment;
108
+
109
+ // A half-open segment implies one of its points lies at +-inf.
110
+ // In practice we just add a polygon point at the wall overflow (at 1km for the x-coordinate).
111
+ /*gpufun*/
112
+ void get_s_of_crossing_with_halfopen_line_segment(int8_t* n_hit, double* s, double part_x, double part_tan, void* self){
113
+ // Get segment data
114
+ HalfOpenLineSegment seg = (HalfOpenLineSegment) self;
115
+ double s_p1 = seg->point_s;
116
+ double x_p1 = seg->point_x;
117
+ double x_p2 = 1.e3*seg->side;
118
+ double s_p2;
119
+ if (fabs(seg->point_tan) < 1.e-12){
120
+ s_p2 = s_p1;
121
+ } else {
122
+ s_p2 = -(x_p2 - x_p1 - s_p1/seg->point_tan)*seg->point_tan;
123
+ }
124
+ // Calculate crossings
125
+ double trajectory_p1 = x_p1 - part_x - s_p1*part_tan;
126
+ double trajectory_p2 = x_p2 - part_x - s_p2*part_tan;
127
+ if (trajectory_p1*trajectory_p2 <= 0){
128
+ // It's a crossing
129
+ if (fabs(s_p2 - s_p1) < 1.e-12){
130
+ s[*n_hit] = s_p1;
131
+ (*n_hit)++;
132
+ } else {
133
+ double poly_tan = (x_p2 - x_p1)/(s_p2 - s_p1);
134
+ if (fabs(poly_tan - part_tan) < 1.e-12){
135
+ s[*n_hit] = s_p1;
136
+ (*n_hit)++;
137
+ } else {
138
+ s[*n_hit] = (part_x - x_p1 + s_p1*poly_tan)/(poly_tan - part_tan);
139
+ (*n_hit)++;
140
+ }
141
+ }
142
+ }
143
+ }
144
+
145
+ /*gpufun*/
146
+ HalfOpenLineSegment create_halfopen_line_segment(double point_s, double point_x, double point_tan, int8_t side){
147
+ HalfOpenLineSegment seg = (HalfOpenLineSegment) malloc(sizeof(HalfOpenLineSegment_));
148
+ seg->crossing = &get_s_of_crossing_with_halfopen_line_segment;
149
+ seg->point_s = point_s;
150
+ seg->point_x = point_x;
151
+ seg->side = side;
152
+ seg->point_tan = point_tan;
153
+ return seg;
154
+ }
155
+
156
+
157
+ // Circular arc segment
158
+ // --------------------
159
+
160
+ // This function finds the crossing points between a line defined by a point (s=0, x) and a tangent,
161
+ // and a circular arc segment defined by a radius R, a centre (Rs, Rx), and angles t1 and t2.
162
+ // The results are stored in an array s, and n_hit keeps track of the number of hits.
163
+ typedef struct CircularSegment_ {
164
+ CrossingFunc crossing;
165
+ double R;
166
+ double centre_s;
167
+ double centre_x;
168
+ double point1_angle;
169
+ double point2_angle;
170
+ } CircularSegment_;
171
+ typedef CircularSegment_* CircularSegment;
172
+
173
+ /*gpufun*/
174
+ void get_s_of_crossing_with_circular_segment(int8_t* n_hit, double* s, double part_x, double part_tan, void* self){
175
+ // Get segment data
176
+ CircularSegment seg = (CircularSegment) self;
177
+ double R = seg->R;
178
+ double R_s = seg->centre_s;
179
+ double R_x = seg->centre_x;
180
+ double t1 = seg->point1_angle;
181
+ double t2 = seg->point2_angle;
182
+ // Calculate crossings
183
+ int8_t reversed = 0;
184
+ if (t2 < t1){
185
+ reversed = 1;
186
+ }
187
+ double a = 1 + part_tan*part_tan;
188
+ double bb = R_s - part_tan*(part_x - R_x);
189
+ double c = R_s*R_s + (part_x - R_x)*(part_x - R_x) - R*R;
190
+ double disc = bb*bb - a*c;
191
+ if (disc >= 0){
192
+ for (int8_t i = 0; i < 2; i++) {
193
+ double sgnD = i*2-1; // negative and positive solutions
194
+ double new_s = 1/a*(bb + sgnD*sqrt(bb*bb - a*c));
195
+ double x = part_x + new_s*part_tan;
196
+ double t = atan2(x - R_x, new_s - R_s);
197
+ if (reversed){
198
+ // t2 < t1, so we are looking at the inverted region of angles
199
+ if (t1 >= t || t >= t2){
200
+ s[*n_hit] = new_s;
201
+ (*n_hit)++;
202
+ }
203
+ } else {
204
+ if (t1 <= t && t <= t2){
205
+ s[*n_hit] = new_s;
206
+ (*n_hit)++;
207
+ }
208
+ }
209
+ }
210
+ }
211
+ }
212
+
213
+ /*gpufun*/
214
+ CircularSegment create_circular_segment(double R, double centre_s, double centre_x, double point1_angle, double point2_angle){
215
+ CircularSegment seg = (CircularSegment) malloc(sizeof(CircularSegment_));
216
+ seg->crossing = &get_s_of_crossing_with_circular_segment;
217
+ seg->R = R;
218
+ seg->centre_s = centre_s;
219
+ seg->centre_x = centre_x;
220
+ seg->point1_angle = point1_angle;
221
+ seg->point2_angle = point2_angle;
222
+ return seg;
223
+ }
224
+
225
+
226
+ #endif /* XCOLL_GEOM_SEGMENTS_H */
@@ -0,0 +1,184 @@
1
+ // copyright ############################### #
2
+ // This file is part of the Xcoll Package. #
3
+ // Copyright (c) CERN, 2024. #
4
+ // ######################################### #
5
+
6
+ #ifndef XCOLL_GEOM_SORT_H
7
+ #define XCOLL_GEOM_SORT_H
8
+ #include <math.h>
9
+ #include <stdio.h>
10
+ #include <stdint.h>
11
+ #include <stdlib.h>
12
+
13
+ #pragma GCC diagnostic push
14
+ #pragma GCC diagnostic ignored "-Warray-bounds"
15
+
16
+ #ifdef MAX
17
+ #undef MAX
18
+ #pragma message ("Xcoll geometry: Compiler macro MAX redefined")
19
+ #endif
20
+ #define MAX(x, y) ({const __typeof__ (x) _x = (x); \
21
+ const __typeof__ (y) _y = (y); \
22
+ _x > _y ? _x : _y; })
23
+ #ifdef MIN
24
+ #undef MIN
25
+ #pragma message ("Xcoll geometry: Compiler macro MIN redefined")
26
+ #endif
27
+ #define MIN(x, y) ({const __typeof__ (x) _x = (x); \
28
+ const __typeof__ (y) _y = (y); \
29
+ _x < _y ? _x : _y; })
30
+ #ifdef SWAP
31
+ #error "Xcoll geometry: Compiler macro SWAP already defined!"
32
+ #endif
33
+ #define SWAP(d,x,y) ({const __typeof__(*d) _x = MIN(d[x], d[y]); \
34
+ const __typeof__(*d) _y = MAX(d[x], d[y]); \
35
+ d[x] = _x; d[y] = _y; })
36
+
37
+
38
+ // Fast methods
39
+ // ------------
40
+
41
+ static inline void sort_array_of_2_double(double* d){
42
+ SWAP(d, 0, 1);
43
+ }
44
+
45
+ static inline void sort_array_of_3_double(double* d){
46
+ SWAP(d, 0, 1); SWAP(d, 1, 2); SWAP(d, 0, 1);
47
+ }
48
+
49
+ static inline void sort_array_of_4_double(double* d){
50
+ SWAP(d, 0, 1); SWAP(d, 2, 3); SWAP(d, 0, 2); SWAP(d, 1, 3); SWAP(d, 1, 2);
51
+ }
52
+
53
+ static inline void sort_array_of_5_double(double* d){
54
+ SWAP(d, 0, 1); SWAP(d, 3, 4); SWAP(d, 2, 4); SWAP(d, 2, 3); SWAP(d, 1, 4);
55
+ SWAP(d, 0, 3); SWAP(d, 0, 2); SWAP(d, 1, 3); SWAP(d, 1, 2);
56
+ }
57
+
58
+ static inline void sort_array_of_6_double(double* d){
59
+ SWAP(d, 1, 2); SWAP(d, 4, 5); SWAP(d, 0, 2); SWAP(d, 3, 5); SWAP(d, 0, 1);
60
+ SWAP(d, 3, 4); SWAP(d, 1, 4); SWAP(d, 0, 3); SWAP(d, 2, 5); SWAP(d, 1, 3);
61
+ SWAP(d, 2, 4); SWAP(d, 2, 3);
62
+ }
63
+
64
+ static inline void sort_array_of_7_double(double* d){
65
+ SWAP(d, 1, 2); SWAP(d, 3, 4); SWAP(d, 5, 6); SWAP(d, 0, 2); SWAP(d, 3, 5);
66
+ SWAP(d, 4, 6); SWAP(d, 0, 1); SWAP(d, 4, 5); SWAP(d, 2, 6); SWAP(d, 0, 4);
67
+ SWAP(d, 1, 5); SWAP(d, 0, 3); SWAP(d, 2, 5); SWAP(d, 1, 3); SWAP(d, 2, 4);
68
+ SWAP(d, 2, 3);
69
+ }
70
+
71
+ static inline void sort_array_of_8_double(double* d){
72
+ SWAP(d, 0, 1); SWAP(d, 2, 3); SWAP(d, 4, 5); SWAP(d, 6, 7); SWAP(d, 0, 2);
73
+ SWAP(d, 1, 3); SWAP(d, 4, 6); SWAP(d, 5, 7); SWAP(d, 1, 2); SWAP(d, 5, 6);
74
+ SWAP(d, 0, 4); SWAP(d, 3, 7); SWAP(d, 1, 5); SWAP(d, 2, 6); SWAP(d, 1, 4);
75
+ SWAP(d, 3, 6); SWAP(d, 2, 4); SWAP(d, 3, 5); SWAP(d, 3, 4);
76
+ }
77
+
78
+ static inline void sort_array_of_2_int64(int64_t* d){
79
+ SWAP(d, 0, 1);
80
+ }
81
+
82
+ static inline void sort_array_of_3_int64(int64_t* d){
83
+ SWAP(d, 0, 1); SWAP(d, 1, 2); SWAP(d, 0, 1);
84
+ }
85
+
86
+ static inline void sort_array_of_4_int64(int64_t* d){
87
+ SWAP(d, 0, 1); SWAP(d, 2, 3); SWAP(d, 0, 2); SWAP(d, 1, 3); SWAP(d, 1, 2);
88
+ }
89
+
90
+ static inline void sort_array_of_5_int64(int64_t* d){
91
+ SWAP(d, 0, 1); SWAP(d, 3, 4); SWAP(d, 2, 4); SWAP(d, 2, 3); SWAP(d, 1, 4);
92
+ SWAP(d, 0, 3); SWAP(d, 0, 2); SWAP(d, 1, 3); SWAP(d, 1, 2);
93
+ }
94
+
95
+ static inline void sort_array_of_6_int64(int64_t* d){
96
+ SWAP(d, 1, 2); SWAP(d, 4, 5); SWAP(d, 0, 2); SWAP(d, 3, 5); SWAP(d, 0, 1);
97
+ SWAP(d, 3, 4); SWAP(d, 1, 4); SWAP(d, 0, 3); SWAP(d, 2, 5); SWAP(d, 1, 3);
98
+ SWAP(d, 2, 4); SWAP(d, 2, 3);
99
+ }
100
+
101
+ static inline void sort_array_of_7_int64(int64_t* d){
102
+ SWAP(d, 1, 2); SWAP(d, 3, 4); SWAP(d, 5, 6); SWAP(d, 0, 2); SWAP(d, 3, 5);
103
+ SWAP(d, 4, 6); SWAP(d, 0, 1); SWAP(d, 4, 5); SWAP(d, 2, 6); SWAP(d, 0, 4);
104
+ SWAP(d, 1, 5); SWAP(d, 0, 3); SWAP(d, 2, 5); SWAP(d, 1, 3); SWAP(d, 2, 4);
105
+ SWAP(d, 2, 3);
106
+ }
107
+
108
+ static inline void sort_array_of_8_int64(int64_t* d){
109
+ SWAP(d, 0, 1); SWAP(d, 2, 3); SWAP(d, 4, 5); SWAP(d, 6, 7); SWAP(d, 0, 2);
110
+ SWAP(d, 1, 3); SWAP(d, 4, 6); SWAP(d, 5, 7); SWAP(d, 1, 2); SWAP(d, 5, 6);
111
+ SWAP(d, 0, 4); SWAP(d, 3, 7); SWAP(d, 1, 5); SWAP(d, 2, 6); SWAP(d, 1, 4);
112
+ SWAP(d, 3, 6); SWAP(d, 2, 4); SWAP(d, 3, 5); SWAP(d, 3, 4);
113
+ }
114
+
115
+
116
+ // Generic methods
117
+ // ---------------
118
+
119
+ int cmpfunc_double(const void * a, const void * b) {
120
+ return ( *(double*)a - *(double*)b );
121
+ }
122
+
123
+ static inline void sort_array_of_double(double* arr, int64_t length){
124
+ switch(length){
125
+ case 2:
126
+ sort_array_of_2_double(arr);
127
+ break;
128
+ case 3:
129
+ sort_array_of_3_double(arr);
130
+ break;
131
+ case 4:
132
+ sort_array_of_4_double(arr);
133
+ break;
134
+ case 5:
135
+ sort_array_of_5_double(arr);
136
+ break;
137
+ case 6:
138
+ sort_array_of_6_double(arr);
139
+ break;
140
+ case 7:
141
+ sort_array_of_7_double(arr);
142
+ break;
143
+ case 8:
144
+ sort_array_of_8_double(arr);
145
+ break;
146
+ default:
147
+ qsort(arr, length, sizeof(double), cmpfunc_double);
148
+ }
149
+ }
150
+
151
+ int cmpfunc_int64(const void * a, const void * b) {
152
+ return ( *(int64_t*)a - *(int64_t*)b );
153
+ }
154
+
155
+ static inline void sort_array_of_int64(int64_t* arr, int64_t length){
156
+ switch(length){
157
+ case 2:
158
+ sort_array_of_2_int64(arr);
159
+ break;
160
+ case 3:
161
+ sort_array_of_3_int64(arr);
162
+ break;
163
+ case 4:
164
+ sort_array_of_4_int64(arr);
165
+ break;
166
+ case 5:
167
+ sort_array_of_5_int64(arr);
168
+ break;
169
+ case 6:
170
+ sort_array_of_6_int64(arr);
171
+ break;
172
+ case 7:
173
+ sort_array_of_7_int64(arr);
174
+ break;
175
+ case 8:
176
+ sort_array_of_8_int64(arr);
177
+ break;
178
+ default:
179
+ qsort(arr, length, sizeof(int64_t), cmpfunc_int64);
180
+ }
181
+ }
182
+
183
+ #pragma GCC diagnostic pop
184
+ #endif /* XCOLL_GEOM_SORT_H */