xcoll 0.5.11__py3-none-any.whl → 0.6.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 (333) hide show
  1. xcoll/__init__.py +5 -18
  2. xcoll/beam_elements/__init__.py +1 -0
  3. xcoll/beam_elements/absorber.py +12 -2
  4. xcoll/beam_elements/base.py +162 -62
  5. xcoll/beam_elements/blowup.py +1 -0
  6. xcoll/beam_elements/elements_src/black_absorber.h +57 -58
  7. xcoll/beam_elements/elements_src/black_crystal.h +49 -50
  8. xcoll/beam_elements/elements_src/everest_block.h +21 -11
  9. xcoll/beam_elements/elements_src/everest_collimator.h +100 -91
  10. xcoll/beam_elements/elements_src/everest_crystal.h +145 -140
  11. xcoll/beam_elements/elements_src/transparent_collimator.h +126 -0
  12. xcoll/beam_elements/elements_src/transparent_crystal.h +118 -0
  13. xcoll/beam_elements/everest.py +16 -5
  14. xcoll/beam_elements/monitor.py +1 -0
  15. xcoll/beam_elements/transparent.py +83 -0
  16. xcoll/colldb.py +15 -6
  17. xcoll/general.py +1 -1
  18. xcoll/headers/particle_states.py +51 -0
  19. xcoll/initial_distribution.py +129 -103
  20. xcoll/interaction_record/interaction_record.py +2 -1
  21. xcoll/interaction_record/interaction_types.py +2 -2
  22. xcoll/line_tools.py +163 -74
  23. xcoll/lossmap.py +519 -127
  24. xcoll/plot.py +109 -0
  25. xcoll/rf_sweep.py +6 -0
  26. xcoll/scattering_routines/engine.py +600 -0
  27. xcoll/scattering_routines/environment.py +297 -0
  28. xcoll/scattering_routines/everest/amorphous.h +95 -71
  29. xcoll/scattering_routines/everest/{channeling.h → channelling.h} +121 -112
  30. xcoll/scattering_routines/everest/constants.h +1 -1
  31. xcoll/scattering_routines/everest/crystal_parameters.h +9 -9
  32. xcoll/scattering_routines/everest/everest.h +8 -3
  33. xcoll/scattering_routines/everest/everest.py +2 -1
  34. xcoll/scattering_routines/everest/ionisation_loss.h +141 -0
  35. xcoll/scattering_routines/everest/jaw.h +19 -24
  36. xcoll/scattering_routines/everest/materials.py +2 -0
  37. xcoll/scattering_routines/everest/multiple_coulomb_scattering.h +2 -2
  38. xcoll/scattering_routines/everest/nuclear_interaction.h +35 -19
  39. xcoll/scattering_routines/everest/properties.h +4 -73
  40. xcoll/xaux.py +73 -0
  41. {xcoll-0.5.11.dist-info → xcoll-0.6.0.dist-info}/METADATA +5 -5
  42. xcoll-0.6.0.dist-info/RECORD +135 -0
  43. xcoll/_manager.py +0 -22
  44. xcoll/headers/particle_states.h +0 -25
  45. xcoll/install.py +0 -35
  46. xcoll/scattering_routines/geant4/collimasim/.git +0 -1
  47. xcoll/scattering_routines/geant4/collimasim/.gitignore +0 -12
  48. xcoll/scattering_routines/geant4/collimasim/.gitmodules +0 -3
  49. xcoll/scattering_routines/geant4/collimasim/CMakeLists.txt +0 -26
  50. xcoll/scattering_routines/geant4/collimasim/README.md +0 -21
  51. xcoll/scattering_routines/geant4/collimasim/docs/Makefile +0 -20
  52. xcoll/scattering_routines/geant4/collimasim/docs/make.bat +0 -35
  53. xcoll/scattering_routines/geant4/collimasim/docs/source/collimasim.rst +0 -10
  54. xcoll/scattering_routines/geant4/collimasim/docs/source/conf.py +0 -59
  55. xcoll/scattering_routines/geant4/collimasim/docs/source/index.rst +0 -26
  56. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.appveyor.yml +0 -37
  57. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-format +0 -19
  58. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-tidy +0 -65
  59. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.cmake-format.yaml +0 -73
  60. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.git +0 -1
  61. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CODEOWNERS +0 -9
  62. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CONTRIBUTING.md +0 -386
  63. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/bug-report.yml +0 -45
  64. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/config.yml +0 -8
  65. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/dependabot.yml +0 -16
  66. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler.yml +0 -8
  67. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler_merged.yml +0 -3
  68. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/pull_request_template.md +0 -19
  69. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/ci.yml +0 -969
  70. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/configure.yml +0 -84
  71. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/format.yml +0 -48
  72. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/labeler.yml +0 -16
  73. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/pip.yml +0 -103
  74. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.gitignore +0 -45
  75. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.pre-commit-config.yaml +0 -151
  76. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.readthedocs.yml +0 -3
  77. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/CMakeLists.txt +0 -297
  78. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/LICENSE +0 -29
  79. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/MANIFEST.in +0 -6
  80. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/README.rst +0 -180
  81. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Doxyfile +0 -23
  82. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Makefile +0 -192
  83. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/_static/theme_overrides.css +0 -11
  84. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/chrono.rst +0 -81
  85. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/custom.rst +0 -93
  86. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/eigen.rst +0 -310
  87. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/functional.rst +0 -109
  88. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/index.rst +0 -43
  89. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/overview.rst +0 -171
  90. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/stl.rst +0 -251
  91. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/strings.rst +0 -305
  92. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/classes.rst +0 -1297
  93. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/embedding.rst +0 -262
  94. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/exceptions.rst +0 -396
  95. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/functions.rst +0 -568
  96. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/misc.rst +0 -337
  97. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/index.rst +0 -13
  98. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/numpy.rst +0 -463
  99. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/object.rst +0 -286
  100. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/utilities.rst +0 -155
  101. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/smart_ptrs.rst +0 -174
  102. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/basics.rst +0 -308
  103. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.py +0 -91
  104. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.rst +0 -95
  105. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/changelog.rst +0 -2050
  106. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/classes.rst +0 -542
  107. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/cmake/index.rst +0 -8
  108. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/compiling.rst +0 -648
  109. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/conf.py +0 -381
  110. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/faq.rst +0 -343
  111. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/index.rst +0 -48
  112. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/installing.rst +0 -105
  113. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/limitations.rst +0 -72
  114. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11-logo.png +0 -0
  115. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python1.png +0 -0
  116. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python1.svg +0 -427
  117. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python2.png +0 -0
  118. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python2.svg +0 -427
  119. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/reference.rst +0 -130
  120. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/release.rst +0 -96
  121. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/requirements.txt +0 -8
  122. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/upgrade.rst +0 -548
  123. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/attr.h +0 -605
  124. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/buffer_info.h +0 -144
  125. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/cast.h +0 -1432
  126. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/chrono.h +0 -213
  127. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/common.h +0 -2
  128. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/complex.h +0 -65
  129. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/class.h +0 -709
  130. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/common.h +0 -1021
  131. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/descr.h +0 -104
  132. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/init.h +0 -346
  133. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/internals.h +0 -467
  134. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/type_caster_base.h +0 -978
  135. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/typeid.h +0 -55
  136. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eigen.h +0 -606
  137. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/embed.h +0 -284
  138. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eval.h +0 -163
  139. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/functional.h +0 -121
  140. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/gil.h +0 -193
  141. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/iostream.h +0 -275
  142. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/numpy.h +0 -1741
  143. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/operators.h +0 -163
  144. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/options.h +0 -65
  145. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pybind11.h +0 -2497
  146. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pytypes.h +0 -1879
  147. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl/filesystem.h +0 -103
  148. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl.h +0 -375
  149. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl_bind.h +0 -747
  150. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/noxfile.py +0 -88
  151. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__init__.py +0 -11
  152. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__main__.py +0 -52
  153. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.py +0 -12
  154. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.pyi +0 -6
  155. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/commands.py +0 -21
  156. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/py.typed +0 -0
  157. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.py +0 -482
  158. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.pyi +0 -63
  159. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pyproject.toml +0 -41
  160. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.cfg +0 -56
  161. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.py +0 -155
  162. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/CMakeLists.txt +0 -503
  163. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/conftest.py +0 -208
  164. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/constructor_stats.h +0 -275
  165. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/cross_module_gil_utils.cpp +0 -73
  166. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/env.py +0 -33
  167. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_python_package/pytest.ini +0 -0
  168. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_python_package/test_files.py +0 -279
  169. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_setuptools/pytest.ini +0 -0
  170. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_setuptools/test_setuphelper.py +0 -143
  171. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/local_bindings.h +0 -85
  172. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/object.h +0 -179
  173. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_cross_module_tests.cpp +0 -151
  174. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.cpp +0 -91
  175. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.h +0 -85
  176. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pytest.ini +0 -19
  177. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/requirements.txt +0 -12
  178. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.cpp +0 -26
  179. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.py +0 -25
  180. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.cpp +0 -216
  181. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.py +0 -163
  182. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.cpp +0 -286
  183. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.py +0 -536
  184. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.cpp +0 -107
  185. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.py +0 -248
  186. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.cpp +0 -227
  187. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.py +0 -202
  188. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.cpp +0 -84
  189. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.py +0 -210
  190. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.cpp +0 -550
  191. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.py +0 -473
  192. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/CMakeLists.txt +0 -84
  193. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/embed.cpp +0 -21
  194. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_embed/CMakeLists.txt +0 -28
  195. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_function/CMakeLists.txt +0 -39
  196. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_target/CMakeLists.txt +0 -46
  197. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/main.cpp +0 -6
  198. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt +0 -41
  199. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt +0 -35
  200. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_target/CMakeLists.txt +0 -41
  201. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/test.py +0 -10
  202. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.cpp +0 -165
  203. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.py +0 -53
  204. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.cpp +0 -238
  205. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.py +0 -126
  206. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.cpp +0 -141
  207. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.py +0 -117
  208. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.cpp +0 -41
  209. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.py +0 -50
  210. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.cpp +0 -69
  211. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.py +0 -42
  212. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.cpp +0 -348
  213. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.py +0 -771
  214. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/CMakeLists.txt +0 -47
  215. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/catch.cpp +0 -22
  216. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/external_module.cpp +0 -23
  217. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.cpp +0 -326
  218. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.py +0 -15
  219. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.cpp +0 -148
  220. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.py +0 -272
  221. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.cpp +0 -119
  222. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.py +0 -51
  223. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval_call.py +0 -5
  224. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.cpp +0 -285
  225. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.h +0 -12
  226. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.py +0 -265
  227. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.cpp +0 -397
  228. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.py +0 -520
  229. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.cpp +0 -49
  230. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.py +0 -94
  231. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.cpp +0 -125
  232. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.py +0 -331
  233. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.cpp +0 -153
  234. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.py +0 -284
  235. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.cpp +0 -107
  236. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.py +0 -257
  237. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.cpp +0 -412
  238. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.py +0 -517
  239. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.cpp +0 -102
  240. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.py +0 -92
  241. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.cpp +0 -233
  242. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.py +0 -360
  243. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.cpp +0 -472
  244. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.py +0 -593
  245. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.cpp +0 -524
  246. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.py +0 -441
  247. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.cpp +0 -103
  248. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.py +0 -267
  249. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.cpp +0 -73
  250. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.py +0 -59
  251. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.cpp +0 -235
  252. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.py +0 -146
  253. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.cpp +0 -189
  254. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.py +0 -82
  255. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.cpp +0 -560
  256. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.py +0 -651
  257. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.cpp +0 -500
  258. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.py +0 -253
  259. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.cpp +0 -452
  260. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.py +0 -318
  261. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.cpp +0 -342
  262. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.py +0 -291
  263. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.cpp +0 -131
  264. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.py +0 -318
  265. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.cpp +0 -144
  266. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.py +0 -29
  267. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.cpp +0 -66
  268. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.py +0 -44
  269. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.cpp +0 -22
  270. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.py +0 -9
  271. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.cpp +0 -510
  272. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.py +0 -408
  273. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-numpy-scipy.supp +0 -140
  274. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-python.supp +0 -117
  275. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindCatch.cmake +0 -70
  276. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindEigen3.cmake +0 -86
  277. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindPythonLibsNew.cmake +0 -257
  278. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/check-style.sh +0 -44
  279. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/cmake_uninstall.cmake.in +0 -23
  280. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/libsize.py +0 -39
  281. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/make_changelog.py +0 -64
  282. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Common.cmake +0 -402
  283. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Config.cmake.in +0 -233
  284. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11NewTools.cmake +0 -276
  285. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Tools.cmake +0 -214
  286. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pyproject.toml +0 -3
  287. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_global.py.in +0 -65
  288. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_main.py.in +0 -41
  289. xcoll/scattering_routines/geant4/collimasim/pyproject.toml +0 -8
  290. xcoll/scattering_routines/geant4/collimasim/setup.py +0 -144
  291. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.cpp +0 -403
  292. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.hh +0 -100
  293. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.cpp +0 -763
  294. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.hh +0 -118
  295. xcoll/scattering_routines/geant4/collimasim/src/collimasim/__init__.py +0 -8
  296. xcoll/scattering_routines/geant4/collimasim/src/collimasim/bindings.cpp +0 -63
  297. xcoll/scattering_routines/geant4/collimasim/src/collimasim/pyCollimatorPass.py +0 -142
  298. xcoll/scattering_routines/geant4/collimasim/src/collimasim/xtrack_collimator.py +0 -556
  299. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/PKG-INFO +0 -6
  300. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/SOURCES.txt +0 -24
  301. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/dependency_links.txt +0 -1
  302. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/not-zip-safe +0 -1
  303. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/top_level.txt +0 -1
  304. xcoll/scattering_routines/geant4/collimasim/tests/README.md +0 -25
  305. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_forions.dat +0 -25
  306. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_new_example.dat +0 -18
  307. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_old_example.dat +0 -68
  308. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_testing.dat +0 -15
  309. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_yaml_example.yaml +0 -110
  310. xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps.dat +0 -7
  311. xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps_pyat_test.dat +0 -3
  312. xcoll/scattering_routines/geant4/collimasim/tests/resources/collonly_twiss_file_example.tfs +0 -54
  313. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings.gmad +0 -3
  314. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings_black_absorber.gmad +0 -3
  315. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings_ions.gmad +0 -5
  316. xcoll/scattering_routines/geant4/collimasim/tests/resources/twiss_file_testing.tfs +0 -51
  317. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat.py +0 -65
  318. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_passmethod.py +0 -59
  319. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_tracking.py +0 -102
  320. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack.py +0 -75
  321. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_angle.py +0 -74
  322. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_colldb_load.py +0 -84
  323. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_interaction.py +0 -159
  324. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_interaction_ion.py +0 -99
  325. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_ions.py +0 -78
  326. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_lost_energy.py +0 -88
  327. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tilt.py +0 -80
  328. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tracking.py +0 -97
  329. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tracking_ions.py +0 -96
  330. xcoll-0.5.11.dist-info/RECORD +0 -413
  331. {xcoll-0.5.11.dist-info → xcoll-0.6.0.dist-info}/LICENSE +0 -0
  332. {xcoll-0.5.11.dist-info → xcoll-0.6.0.dist-info}/NOTICE +0 -0
  333. {xcoll-0.5.11.dist-info → xcoll-0.6.0.dist-info}/WHEEL +0 -0
@@ -1,467 +0,0 @@
1
- /*
2
- pybind11/detail/internals.h: Internal data structure and related functions
3
-
4
- Copyright (c) 2017 Wenzel Jakob <wenzel.jakob@epfl.ch>
5
-
6
- All rights reserved. Use of this source code is governed by a
7
- BSD-style license that can be found in the LICENSE file.
8
- */
9
-
10
- #pragma once
11
-
12
- #include "../pytypes.h"
13
-
14
- /// Tracks the `internals` and `type_info` ABI version independent of the main library version.
15
- ///
16
- /// Some portions of the code use an ABI that is conditional depending on this
17
- /// version number. That allows ABI-breaking changes to be "pre-implemented".
18
- /// Once the default version number is incremented, the conditional logic that
19
- /// no longer applies can be removed. Additionally, users that need not
20
- /// maintain ABI compatibility can increase the version number in order to take
21
- /// advantage of any functionality/efficiency improvements that depend on the
22
- /// newer ABI.
23
- ///
24
- /// WARNING: If you choose to manually increase the ABI version, note that
25
- /// pybind11 may not be tested as thoroughly with a non-default ABI version, and
26
- /// further ABI-incompatible changes may be made before the ABI is officially
27
- /// changed to the new version.
28
- #ifndef PYBIND11_INTERNALS_VERSION
29
- # define PYBIND11_INTERNALS_VERSION 4
30
- #endif
31
-
32
- PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
33
-
34
- using ExceptionTranslator = void (*)(std::exception_ptr);
35
-
36
- PYBIND11_NAMESPACE_BEGIN(detail)
37
-
38
- // Forward declarations
39
- inline PyTypeObject *make_static_property_type();
40
- inline PyTypeObject *make_default_metaclass();
41
- inline PyObject *make_object_base_type(PyTypeObject *metaclass);
42
-
43
- // The old Python Thread Local Storage (TLS) API is deprecated in Python 3.7 in favor of the new
44
- // Thread Specific Storage (TSS) API.
45
- #if PY_VERSION_HEX >= 0x03070000
46
- // Avoid unnecessary allocation of `Py_tss_t`, since we cannot use
47
- // `Py_LIMITED_API` anyway.
48
- # if PYBIND11_INTERNALS_VERSION > 4
49
- # define PYBIND11_TLS_KEY_REF Py_tss_t &
50
- # ifdef __GNUC__
51
- // Clang on macOS warns due to `Py_tss_NEEDS_INIT` not specifying an initializer
52
- // for every field.
53
- # define PYBIND11_TLS_KEY_INIT(var) \
54
- _Pragma("GCC diagnostic push") /**/ \
55
- _Pragma("GCC diagnostic ignored \"-Wmissing-field-initializers\"") /**/ \
56
- Py_tss_t var \
57
- = Py_tss_NEEDS_INIT; \
58
- _Pragma("GCC diagnostic pop")
59
- # else
60
- # define PYBIND11_TLS_KEY_INIT(var) Py_tss_t var = Py_tss_NEEDS_INIT;
61
- # endif
62
- # define PYBIND11_TLS_KEY_CREATE(var) (PyThread_tss_create(&(var)) == 0)
63
- # define PYBIND11_TLS_GET_VALUE(key) PyThread_tss_get(&(key))
64
- # define PYBIND11_TLS_REPLACE_VALUE(key, value) PyThread_tss_set(&(key), (value))
65
- # define PYBIND11_TLS_DELETE_VALUE(key) PyThread_tss_set(&(key), nullptr)
66
- # define PYBIND11_TLS_FREE(key) PyThread_tss_delete(&(key))
67
- # else
68
- # define PYBIND11_TLS_KEY_REF Py_tss_t *
69
- # define PYBIND11_TLS_KEY_INIT(var) Py_tss_t *var = nullptr;
70
- # define PYBIND11_TLS_KEY_CREATE(var) \
71
- (((var) = PyThread_tss_alloc()) != nullptr && (PyThread_tss_create((var)) == 0))
72
- # define PYBIND11_TLS_GET_VALUE(key) PyThread_tss_get((key))
73
- # define PYBIND11_TLS_REPLACE_VALUE(key, value) PyThread_tss_set((key), (value))
74
- # define PYBIND11_TLS_DELETE_VALUE(key) PyThread_tss_set((key), nullptr)
75
- # define PYBIND11_TLS_FREE(key) PyThread_tss_free(key)
76
- # endif
77
- #else
78
- // Usually an int but a long on Cygwin64 with Python 3.x
79
- # define PYBIND11_TLS_KEY_REF decltype(PyThread_create_key())
80
- # define PYBIND11_TLS_KEY_INIT(var) PYBIND11_TLS_KEY_REF var = 0;
81
- # define PYBIND11_TLS_KEY_CREATE(var) (((var) = PyThread_create_key()) != -1)
82
- # define PYBIND11_TLS_GET_VALUE(key) PyThread_get_key_value((key))
83
- # if PY_MAJOR_VERSION < 3 || defined(PYPY_VERSION)
84
- // On CPython < 3.4 and on PyPy, `PyThread_set_key_value` strangely does not set
85
- // the value if it has already been set. Instead, it must first be deleted and
86
- // then set again.
87
- inline void tls_replace_value(PYBIND11_TLS_KEY_REF key, void *value) {
88
- PyThread_delete_key_value(key);
89
- PyThread_set_key_value(key, value);
90
- }
91
- # define PYBIND11_TLS_DELETE_VALUE(key) PyThread_delete_key_value(key)
92
- # define PYBIND11_TLS_REPLACE_VALUE(key, value) \
93
- ::pybind11::detail::tls_replace_value((key), (value))
94
- # else
95
- # define PYBIND11_TLS_DELETE_VALUE(key) PyThread_set_key_value((key), nullptr)
96
- # define PYBIND11_TLS_REPLACE_VALUE(key, value) PyThread_set_key_value((key), (value))
97
- # endif
98
- # define PYBIND11_TLS_FREE(key) (void) key
99
- #endif
100
-
101
- // Python loads modules by default with dlopen with the RTLD_LOCAL flag; under libc++ and possibly
102
- // other STLs, this means `typeid(A)` from one module won't equal `typeid(A)` from another module
103
- // even when `A` is the same, non-hidden-visibility type (e.g. from a common include). Under
104
- // libstdc++, this doesn't happen: equality and the type_index hash are based on the type name,
105
- // which works. If not under a known-good stl, provide our own name-based hash and equality
106
- // functions that use the type name.
107
- #if defined(__GLIBCXX__)
108
- inline bool same_type(const std::type_info &lhs, const std::type_info &rhs) { return lhs == rhs; }
109
- using type_hash = std::hash<std::type_index>;
110
- using type_equal_to = std::equal_to<std::type_index>;
111
- #else
112
- inline bool same_type(const std::type_info &lhs, const std::type_info &rhs) {
113
- return lhs.name() == rhs.name() || std::strcmp(lhs.name(), rhs.name()) == 0;
114
- }
115
-
116
- struct type_hash {
117
- size_t operator()(const std::type_index &t) const {
118
- size_t hash = 5381;
119
- const char *ptr = t.name();
120
- while (auto c = static_cast<unsigned char>(*ptr++))
121
- hash = (hash * 33) ^ c;
122
- return hash;
123
- }
124
- };
125
-
126
- struct type_equal_to {
127
- bool operator()(const std::type_index &lhs, const std::type_index &rhs) const {
128
- return lhs.name() == rhs.name() || std::strcmp(lhs.name(), rhs.name()) == 0;
129
- }
130
- };
131
- #endif
132
-
133
- template <typename value_type>
134
- using type_map = std::unordered_map<std::type_index, value_type, type_hash, type_equal_to>;
135
-
136
- struct override_hash {
137
- inline size_t operator()(const std::pair<const PyObject *, const char *>& v) const {
138
- size_t value = std::hash<const void *>()(v.first);
139
- value ^= std::hash<const void *>()(v.second) + 0x9e3779b9 + (value<<6) + (value>>2);
140
- return value;
141
- }
142
- };
143
-
144
- /// Internal data structure used to track registered instances and types.
145
- /// Whenever binary incompatible changes are made to this structure,
146
- /// `PYBIND11_INTERNALS_VERSION` must be incremented.
147
- struct internals {
148
- type_map<type_info *> registered_types_cpp; // std::type_index -> pybind11's type information
149
- std::unordered_map<PyTypeObject *, std::vector<type_info *>> registered_types_py; // PyTypeObject* -> base type_info(s)
150
- std::unordered_multimap<const void *, instance*> registered_instances; // void * -> instance*
151
- std::unordered_set<std::pair<const PyObject *, const char *>, override_hash> inactive_override_cache;
152
- type_map<std::vector<bool (*)(PyObject *, void *&)>> direct_conversions;
153
- std::unordered_map<const PyObject *, std::vector<PyObject *>> patients;
154
- std::forward_list<ExceptionTranslator> registered_exception_translators;
155
- std::unordered_map<std::string, void *> shared_data; // Custom data to be shared across extensions
156
- #if PYBIND11_INTERNALS_VERSION == 4
157
- std::vector<PyObject *> unused_loader_patient_stack_remove_at_v5;
158
- #endif
159
- std::forward_list<std::string> static_strings; // Stores the std::strings backing detail::c_str()
160
- PyTypeObject *static_property_type;
161
- PyTypeObject *default_metaclass;
162
- PyObject *instance_base;
163
- #if defined(WITH_THREAD)
164
- PYBIND11_TLS_KEY_INIT(tstate)
165
- # if PYBIND11_INTERNALS_VERSION > 4
166
- PYBIND11_TLS_KEY_INIT(loader_life_support_tls_key)
167
- # endif // PYBIND11_INTERNALS_VERSION > 4
168
- PyInterpreterState *istate = nullptr;
169
- ~internals() {
170
- # if PYBIND11_INTERNALS_VERSION > 4
171
- PYBIND11_TLS_FREE(loader_life_support_tls_key);
172
- # endif // PYBIND11_INTERNALS_VERSION > 4
173
-
174
- // This destructor is called *after* Py_Finalize() in finalize_interpreter().
175
- // That *SHOULD BE* fine. The following details what happens when PyThread_tss_free is
176
- // called. PYBIND11_TLS_FREE is PyThread_tss_free on python 3.7+. On older python, it does
177
- // nothing. PyThread_tss_free calls PyThread_tss_delete and PyMem_RawFree.
178
- // PyThread_tss_delete just calls TlsFree (on Windows) or pthread_key_delete (on *NIX).
179
- // Neither of those have anything to do with CPython internals. PyMem_RawFree *requires*
180
- // that the `tstate` be allocated with the CPython allocator.
181
- PYBIND11_TLS_FREE(tstate);
182
- }
183
- #endif
184
- };
185
-
186
- /// Additional type information which does not fit into the PyTypeObject.
187
- /// Changes to this struct also require bumping `PYBIND11_INTERNALS_VERSION`.
188
- struct type_info {
189
- PyTypeObject *type;
190
- const std::type_info *cpptype;
191
- size_t type_size, type_align, holder_size_in_ptrs;
192
- void *(*operator_new)(size_t);
193
- void (*init_instance)(instance *, const void *);
194
- void (*dealloc)(value_and_holder &v_h);
195
- std::vector<PyObject *(*)(PyObject *, PyTypeObject *)> implicit_conversions;
196
- std::vector<std::pair<const std::type_info *, void *(*)(void *)>> implicit_casts;
197
- std::vector<bool (*)(PyObject *, void *&)> *direct_conversions;
198
- buffer_info *(*get_buffer)(PyObject *, void *) = nullptr;
199
- void *get_buffer_data = nullptr;
200
- void *(*module_local_load)(PyObject *, const type_info *) = nullptr;
201
- /* A simple type never occurs as a (direct or indirect) parent
202
- * of a class that makes use of multiple inheritance */
203
- bool simple_type : 1;
204
- /* True if there is no multiple inheritance in this type's inheritance tree */
205
- bool simple_ancestors : 1;
206
- /* for base vs derived holder_type checks */
207
- bool default_holder : 1;
208
- /* true if this is a type registered with py::module_local */
209
- bool module_local : 1;
210
- };
211
-
212
- /// On MSVC, debug and release builds are not ABI-compatible!
213
- #if defined(_MSC_VER) && defined(_DEBUG)
214
- # define PYBIND11_BUILD_TYPE "_debug"
215
- #else
216
- # define PYBIND11_BUILD_TYPE ""
217
- #endif
218
-
219
- /// Let's assume that different compilers are ABI-incompatible.
220
- /// A user can manually set this string if they know their
221
- /// compiler is compatible.
222
- #ifndef PYBIND11_COMPILER_TYPE
223
- # if defined(_MSC_VER)
224
- # define PYBIND11_COMPILER_TYPE "_msvc"
225
- # elif defined(__INTEL_COMPILER)
226
- # define PYBIND11_COMPILER_TYPE "_icc"
227
- # elif defined(__clang__)
228
- # define PYBIND11_COMPILER_TYPE "_clang"
229
- # elif defined(__PGI)
230
- # define PYBIND11_COMPILER_TYPE "_pgi"
231
- # elif defined(__MINGW32__)
232
- # define PYBIND11_COMPILER_TYPE "_mingw"
233
- # elif defined(__CYGWIN__)
234
- # define PYBIND11_COMPILER_TYPE "_gcc_cygwin"
235
- # elif defined(__GNUC__)
236
- # define PYBIND11_COMPILER_TYPE "_gcc"
237
- # else
238
- # define PYBIND11_COMPILER_TYPE "_unknown"
239
- # endif
240
- #endif
241
-
242
- /// Also standard libs
243
- #ifndef PYBIND11_STDLIB
244
- # if defined(_LIBCPP_VERSION)
245
- # define PYBIND11_STDLIB "_libcpp"
246
- # elif defined(__GLIBCXX__) || defined(__GLIBCPP__)
247
- # define PYBIND11_STDLIB "_libstdcpp"
248
- # else
249
- # define PYBIND11_STDLIB ""
250
- # endif
251
- #endif
252
-
253
- /// On Linux/OSX, changes in __GXX_ABI_VERSION__ indicate ABI incompatibility.
254
- #ifndef PYBIND11_BUILD_ABI
255
- # if defined(__GXX_ABI_VERSION)
256
- # define PYBIND11_BUILD_ABI "_cxxabi" PYBIND11_TOSTRING(__GXX_ABI_VERSION)
257
- # else
258
- # define PYBIND11_BUILD_ABI ""
259
- # endif
260
- #endif
261
-
262
- #ifndef PYBIND11_INTERNALS_KIND
263
- # if defined(WITH_THREAD)
264
- # define PYBIND11_INTERNALS_KIND ""
265
- # else
266
- # define PYBIND11_INTERNALS_KIND "_without_thread"
267
- # endif
268
- #endif
269
-
270
- #define PYBIND11_INTERNALS_ID "__pybind11_internals_v" \
271
- PYBIND11_TOSTRING(PYBIND11_INTERNALS_VERSION) PYBIND11_INTERNALS_KIND PYBIND11_COMPILER_TYPE PYBIND11_STDLIB PYBIND11_BUILD_ABI PYBIND11_BUILD_TYPE "__"
272
-
273
- #define PYBIND11_MODULE_LOCAL_ID "__pybind11_module_local_v" \
274
- PYBIND11_TOSTRING(PYBIND11_INTERNALS_VERSION) PYBIND11_INTERNALS_KIND PYBIND11_COMPILER_TYPE PYBIND11_STDLIB PYBIND11_BUILD_ABI PYBIND11_BUILD_TYPE "__"
275
-
276
- /// Each module locally stores a pointer to the `internals` data. The data
277
- /// itself is shared among modules with the same `PYBIND11_INTERNALS_ID`.
278
- inline internals **&get_internals_pp() {
279
- static internals **internals_pp = nullptr;
280
- return internals_pp;
281
- }
282
-
283
- inline void translate_exception(std::exception_ptr p) {
284
- try {
285
- if (p) std::rethrow_exception(p);
286
- } catch (error_already_set &e) { e.restore(); return;
287
- } catch (const builtin_exception &e) { e.set_error(); return;
288
- } catch (const std::bad_alloc &e) { PyErr_SetString(PyExc_MemoryError, e.what()); return;
289
- } catch (const std::domain_error &e) { PyErr_SetString(PyExc_ValueError, e.what()); return;
290
- } catch (const std::invalid_argument &e) { PyErr_SetString(PyExc_ValueError, e.what()); return;
291
- } catch (const std::length_error &e) { PyErr_SetString(PyExc_ValueError, e.what()); return;
292
- } catch (const std::out_of_range &e) { PyErr_SetString(PyExc_IndexError, e.what()); return;
293
- } catch (const std::range_error &e) { PyErr_SetString(PyExc_ValueError, e.what()); return;
294
- } catch (const std::overflow_error &e) { PyErr_SetString(PyExc_OverflowError, e.what()); return;
295
- } catch (const std::exception &e) { PyErr_SetString(PyExc_RuntimeError, e.what()); return;
296
- } catch (...) {
297
- PyErr_SetString(PyExc_RuntimeError, "Caught an unknown exception!");
298
- return;
299
- }
300
- }
301
-
302
- #if !defined(__GLIBCXX__)
303
- inline void translate_local_exception(std::exception_ptr p) {
304
- try {
305
- if (p) std::rethrow_exception(p);
306
- } catch (error_already_set &e) { e.restore(); return;
307
- } catch (const builtin_exception &e) { e.set_error(); return;
308
- }
309
- }
310
- #endif
311
-
312
- /// Return a reference to the current `internals` data
313
- PYBIND11_NOINLINE internals &get_internals() {
314
- auto **&internals_pp = get_internals_pp();
315
- if (internals_pp && *internals_pp)
316
- return **internals_pp;
317
-
318
- // Ensure that the GIL is held since we will need to make Python calls.
319
- // Cannot use py::gil_scoped_acquire here since that constructor calls get_internals.
320
- struct gil_scoped_acquire_local {
321
- gil_scoped_acquire_local() : state (PyGILState_Ensure()) {}
322
- ~gil_scoped_acquire_local() { PyGILState_Release(state); }
323
- const PyGILState_STATE state;
324
- } gil;
325
-
326
- PYBIND11_STR_TYPE id(PYBIND11_INTERNALS_ID);
327
- auto builtins = handle(PyEval_GetBuiltins());
328
- if (builtins.contains(id) && isinstance<capsule>(builtins[id])) {
329
- internals_pp = static_cast<internals **>(capsule(builtins[id]));
330
-
331
- // We loaded builtins through python's builtins, which means that our `error_already_set`
332
- // and `builtin_exception` may be different local classes than the ones set up in the
333
- // initial exception translator, below, so add another for our local exception classes.
334
- //
335
- // libstdc++ doesn't require this (types there are identified only by name)
336
- // libc++ with CPython doesn't require this (types are explicitly exported)
337
- // libc++ with PyPy still need it, awaiting further investigation
338
- #if !defined(__GLIBCXX__)
339
- (*internals_pp)->registered_exception_translators.push_front(&translate_local_exception);
340
- #endif
341
- } else {
342
- if (!internals_pp) internals_pp = new internals*();
343
- auto *&internals_ptr = *internals_pp;
344
- internals_ptr = new internals();
345
- #if defined(WITH_THREAD)
346
-
347
- # if PY_VERSION_HEX < 0x03090000
348
- PyEval_InitThreads();
349
- # endif
350
- PyThreadState *tstate = PyThreadState_Get();
351
- if (!PYBIND11_TLS_KEY_CREATE(internals_ptr->tstate)) {
352
- pybind11_fail("get_internals: could not successfully initialize the tstate TSS key!");
353
- }
354
- PYBIND11_TLS_REPLACE_VALUE(internals_ptr->tstate, tstate);
355
-
356
- # if PYBIND11_INTERNALS_VERSION > 4
357
- if (!PYBIND11_TLS_KEY_CREATE(internals_ptr->loader_life_support_tls_key)) {
358
- pybind11_fail("get_internals: could not successfully initialize the "
359
- "loader_life_support TSS key!");
360
- }
361
- # endif
362
- internals_ptr->istate = tstate->interp;
363
- #endif
364
- builtins[id] = capsule(internals_pp);
365
- internals_ptr->registered_exception_translators.push_front(&translate_exception);
366
- internals_ptr->static_property_type = make_static_property_type();
367
- internals_ptr->default_metaclass = make_default_metaclass();
368
- internals_ptr->instance_base = make_object_base_type(internals_ptr->default_metaclass);
369
- }
370
- return **internals_pp;
371
- }
372
-
373
- // the internals struct (above) is shared between all the modules. local_internals are only
374
- // for a single module. Any changes made to internals may require an update to
375
- // PYBIND11_INTERNALS_VERSION, breaking backwards compatibility. local_internals is, by design,
376
- // restricted to a single module. Whether a module has local internals or not should not
377
- // impact any other modules, because the only things accessing the local internals is the
378
- // module that contains them.
379
- struct local_internals {
380
- type_map<type_info *> registered_types_cpp;
381
- std::forward_list<ExceptionTranslator> registered_exception_translators;
382
- #if defined(WITH_THREAD) && PYBIND11_INTERNALS_VERSION == 4
383
-
384
- // For ABI compatibility, we can't store the loader_life_support TLS key in
385
- // the `internals` struct directly. Instead, we store it in `shared_data` and
386
- // cache a copy in `local_internals`. If we allocated a separate TLS key for
387
- // each instance of `local_internals`, we could end up allocating hundreds of
388
- // TLS keys if hundreds of different pybind11 modules are loaded (which is a
389
- // plausible number).
390
- PYBIND11_TLS_KEY_INIT(loader_life_support_tls_key)
391
-
392
- // Holds the shared TLS key for the loader_life_support stack.
393
- struct shared_loader_life_support_data {
394
- PYBIND11_TLS_KEY_INIT(loader_life_support_tls_key)
395
- shared_loader_life_support_data() {
396
- if (!PYBIND11_TLS_KEY_CREATE(loader_life_support_tls_key)) {
397
- pybind11_fail("local_internals: could not successfully initialize the "
398
- "loader_life_support TLS key!");
399
- }
400
- }
401
- // We can't help but leak the TLS key, because Python never unloads extension modules.
402
- };
403
-
404
- local_internals() {
405
- auto &internals = get_internals();
406
- // Get or create the `loader_life_support_stack_key`.
407
- auto &ptr = internals.shared_data["_life_support"];
408
- if (!ptr) {
409
- ptr = new shared_loader_life_support_data;
410
- }
411
- loader_life_support_tls_key
412
- = static_cast<shared_loader_life_support_data *>(ptr)->loader_life_support_tls_key;
413
- }
414
- #endif // defined(WITH_THREAD) && PYBIND11_INTERNALS_VERSION == 4
415
- };
416
-
417
- /// Works like `get_internals`, but for things which are locally registered.
418
- inline local_internals &get_local_internals() {
419
- static local_internals locals;
420
- return locals;
421
- }
422
-
423
-
424
- /// Constructs a std::string with the given arguments, stores it in `internals`, and returns its
425
- /// `c_str()`. Such strings objects have a long storage duration -- the internal strings are only
426
- /// cleared when the program exits or after interpreter shutdown (when embedding), and so are
427
- /// suitable for c-style strings needed by Python internals (such as PyTypeObject's tp_name).
428
- template <typename... Args>
429
- const char *c_str(Args &&...args) {
430
- auto &strings = get_internals().static_strings;
431
- strings.emplace_front(std::forward<Args>(args)...);
432
- return strings.front().c_str();
433
- }
434
-
435
- PYBIND11_NAMESPACE_END(detail)
436
-
437
- /// Returns a named pointer that is shared among all extension modules (using the same
438
- /// pybind11 version) running in the current interpreter. Names starting with underscores
439
- /// are reserved for internal usage. Returns `nullptr` if no matching entry was found.
440
- PYBIND11_NOINLINE void *get_shared_data(const std::string &name) {
441
- auto &internals = detail::get_internals();
442
- auto it = internals.shared_data.find(name);
443
- return it != internals.shared_data.end() ? it->second : nullptr;
444
- }
445
-
446
- /// Set the shared data that can be later recovered by `get_shared_data()`.
447
- PYBIND11_NOINLINE void *set_shared_data(const std::string &name, void *data) {
448
- detail::get_internals().shared_data[name] = data;
449
- return data;
450
- }
451
-
452
- /// Returns a typed reference to a shared data entry (by using `get_shared_data()`) if
453
- /// such entry exists. Otherwise, a new object of default-constructible type `T` is
454
- /// added to the shared data under the given name and a reference to it is returned.
455
- template<typename T>
456
- T &get_or_create_shared_data(const std::string &name) {
457
- auto &internals = detail::get_internals();
458
- auto it = internals.shared_data.find(name);
459
- T *ptr = (T *) (it != internals.shared_data.end() ? it->second : nullptr);
460
- if (!ptr) {
461
- ptr = new T();
462
- internals.shared_data[name] = ptr;
463
- }
464
- return *ptr;
465
- }
466
-
467
- PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)