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,452 +0,0 @@
1
- /*
2
- tests/test_smart_ptr.cpp -- binding classes with custom reference counting,
3
- implicit conversions between types
4
-
5
- Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>
6
-
7
- All rights reserved. Use of this source code is governed by a
8
- BSD-style license that can be found in the LICENSE file.
9
- */
10
-
11
- #if defined(_MSC_VER) && _MSC_VER < 1910 // VS 2015's MSVC
12
- # pragma warning(disable: 4702) // unreachable code in system header (xatomic.h(382))
13
- #endif
14
-
15
- #include "pybind11_tests.h"
16
- #include "object.h"
17
-
18
- namespace {
19
-
20
- // This is just a wrapper around unique_ptr, but with extra fields to deliberately bloat up the
21
- // holder size to trigger the non-simple-layout internal instance layout for single inheritance with
22
- // large holder type:
23
- template <typename T> class huge_unique_ptr {
24
- std::unique_ptr<T> ptr;
25
- uint64_t padding[10];
26
- public:
27
- explicit huge_unique_ptr(T *p) : ptr(p) {}
28
- T *get() { return ptr.get(); }
29
- };
30
-
31
- // Simple custom holder that works like unique_ptr
32
- template <typename T>
33
- class custom_unique_ptr {
34
- std::unique_ptr<T> impl;
35
- public:
36
- explicit custom_unique_ptr(T *p) : impl(p) {}
37
- T* get() const { return impl.get(); }
38
- T* release_ptr() { return impl.release(); }
39
- };
40
-
41
- // Simple custom holder that works like shared_ptr and has operator& overload
42
- // To obtain address of an instance of this holder pybind should use std::addressof
43
- // Attempt to get address via operator& may leads to segmentation fault
44
- template <typename T>
45
- class shared_ptr_with_addressof_operator {
46
- std::shared_ptr<T> impl;
47
- public:
48
- shared_ptr_with_addressof_operator( ) = default;
49
- explicit shared_ptr_with_addressof_operator(T *p) : impl(p) {}
50
- T* get() const { return impl.get(); }
51
- T** operator&() { throw std::logic_error("Call of overloaded operator& is not expected"); }
52
- };
53
-
54
- // Simple custom holder that works like unique_ptr and has operator& overload
55
- // To obtain address of an instance of this holder pybind should use std::addressof
56
- // Attempt to get address via operator& may leads to segmentation fault
57
- template <typename T>
58
- class unique_ptr_with_addressof_operator {
59
- std::unique_ptr<T> impl;
60
- public:
61
- unique_ptr_with_addressof_operator() = default;
62
- explicit unique_ptr_with_addressof_operator(T *p) : impl(p) {}
63
- T* get() const { return impl.get(); }
64
- T* release_ptr() { return impl.release(); }
65
- T** operator&() { throw std::logic_error("Call of overloaded operator& is not expected"); }
66
- };
67
-
68
- // Custom object with builtin reference counting (see 'object.h' for the implementation)
69
- class MyObject1 : public Object {
70
- public:
71
- explicit MyObject1(int value) : value(value) { print_created(this, toString()); }
72
- std::string toString() const override { return "MyObject1[" + std::to_string(value) + "]"; }
73
- protected:
74
- ~MyObject1() override { print_destroyed(this); }
75
- private:
76
- int value;
77
- };
78
-
79
- // Object managed by a std::shared_ptr<>
80
- class MyObject2 {
81
- public:
82
- MyObject2(const MyObject2 &) = default;
83
- explicit MyObject2(int value) : value(value) { print_created(this, toString()); }
84
- std::string toString() const { return "MyObject2[" + std::to_string(value) + "]"; }
85
- virtual ~MyObject2() { print_destroyed(this); }
86
- private:
87
- int value;
88
- };
89
-
90
- // Object managed by a std::shared_ptr<>, additionally derives from std::enable_shared_from_this<>
91
- class MyObject3 : public std::enable_shared_from_this<MyObject3> {
92
- public:
93
- MyObject3(const MyObject3 &) = default;
94
- explicit MyObject3(int value) : value(value) { print_created(this, toString()); }
95
- std::string toString() const { return "MyObject3[" + std::to_string(value) + "]"; }
96
- virtual ~MyObject3() { print_destroyed(this); }
97
- private:
98
- int value;
99
- };
100
-
101
- // test_unique_nodelete
102
- // Object with a private destructor
103
- class MyObject4;
104
- std::unordered_set<MyObject4 *> myobject4_instances;
105
- class MyObject4 {
106
- public:
107
- explicit MyObject4(int value) : value{value} {
108
- print_created(this);
109
- myobject4_instances.insert(this);
110
- }
111
- int value;
112
-
113
- static void cleanupAllInstances() {
114
- auto tmp = std::move(myobject4_instances);
115
- myobject4_instances.clear();
116
- for (auto o : tmp)
117
- delete o;
118
- }
119
- private:
120
- ~MyObject4() {
121
- myobject4_instances.erase(this);
122
- print_destroyed(this);
123
- }
124
- };
125
-
126
- // test_unique_deleter
127
- // Object with std::unique_ptr<T, D> where D is not matching the base class
128
- // Object with a protected destructor
129
- class MyObject4a;
130
- std::unordered_set<MyObject4a *> myobject4a_instances;
131
- class MyObject4a {
132
- public:
133
- explicit MyObject4a(int i) {
134
- value = i;
135
- print_created(this);
136
- myobject4a_instances.insert(this);
137
- };
138
- int value;
139
-
140
- static void cleanupAllInstances() {
141
- auto tmp = std::move(myobject4a_instances);
142
- myobject4a_instances.clear();
143
- for (auto o : tmp)
144
- delete o;
145
- }
146
- protected:
147
- virtual ~MyObject4a() {
148
- myobject4a_instances.erase(this);
149
- print_destroyed(this);
150
- }
151
- };
152
-
153
- // Object derived but with public destructor and no Deleter in default holder
154
- class MyObject4b : public MyObject4a {
155
- public:
156
- explicit MyObject4b(int i) : MyObject4a(i) { print_created(this); }
157
- ~MyObject4b() override { print_destroyed(this); }
158
- };
159
-
160
- // test_large_holder
161
- class MyObject5 { // managed by huge_unique_ptr
162
- public:
163
- explicit MyObject5(int value) : value{value} { print_created(this); }
164
- ~MyObject5() { print_destroyed(this); }
165
- int value;
166
- };
167
-
168
- // test_shared_ptr_and_references
169
- struct SharedPtrRef {
170
- struct A {
171
- A() { print_created(this); }
172
- A(const A &) { print_copy_created(this); }
173
- A(A &&) noexcept { print_move_created(this); }
174
- ~A() { print_destroyed(this); }
175
- };
176
-
177
- A value = {};
178
- std::shared_ptr<A> shared = std::make_shared<A>();
179
- };
180
-
181
- // test_shared_ptr_from_this_and_references
182
- struct SharedFromThisRef {
183
- struct B : std::enable_shared_from_this<B> {
184
- B() { print_created(this); }
185
- // NOLINTNEXTLINE(bugprone-copy-constructor-init)
186
- B(const B &) : std::enable_shared_from_this<B>() { print_copy_created(this); }
187
- B(B &&) noexcept : std::enable_shared_from_this<B>() { print_move_created(this); }
188
- ~B() { print_destroyed(this); }
189
- };
190
-
191
- B value = {};
192
- std::shared_ptr<B> shared = std::make_shared<B>();
193
- };
194
-
195
- // Issue #865: shared_from_this doesn't work with virtual inheritance
196
- struct SharedFromThisVBase : std::enable_shared_from_this<SharedFromThisVBase> {
197
- SharedFromThisVBase() = default;
198
- SharedFromThisVBase(const SharedFromThisVBase &) = default;
199
- virtual ~SharedFromThisVBase() = default;
200
- };
201
- struct SharedFromThisVirt : virtual SharedFromThisVBase {};
202
-
203
- // test_move_only_holder
204
- struct C {
205
- C() { print_created(this); }
206
- ~C() { print_destroyed(this); }
207
- };
208
-
209
- // test_holder_with_addressof_operator
210
- struct TypeForHolderWithAddressOf {
211
- TypeForHolderWithAddressOf() { print_created(this); }
212
- TypeForHolderWithAddressOf(const TypeForHolderWithAddressOf &) { print_copy_created(this); }
213
- TypeForHolderWithAddressOf(TypeForHolderWithAddressOf &&) noexcept {
214
- print_move_created(this);
215
- }
216
- ~TypeForHolderWithAddressOf() { print_destroyed(this); }
217
- std::string toString() const {
218
- return "TypeForHolderWithAddressOf[" + std::to_string(value) + "]";
219
- }
220
- int value = 42;
221
- };
222
-
223
- // test_move_only_holder_with_addressof_operator
224
- struct TypeForMoveOnlyHolderWithAddressOf {
225
- explicit TypeForMoveOnlyHolderWithAddressOf(int value) : value{value} { print_created(this); }
226
- ~TypeForMoveOnlyHolderWithAddressOf() { print_destroyed(this); }
227
- std::string toString() const {
228
- return "MoveOnlyHolderWithAddressOf[" + std::to_string(value) + "]";
229
- }
230
- int value;
231
- };
232
-
233
- // test_smart_ptr_from_default
234
- struct HeldByDefaultHolder { };
235
-
236
- // test_shared_ptr_gc
237
- // #187: issue involving std::shared_ptr<> return value policy & garbage collection
238
- struct ElementBase {
239
- virtual ~ElementBase() = default; /* Force creation of virtual table */
240
- ElementBase() = default;
241
- ElementBase(const ElementBase&) = delete;
242
- };
243
-
244
- struct ElementA : ElementBase {
245
- explicit ElementA(int v) : v(v) {}
246
- int value() const { return v; }
247
- int v;
248
- };
249
-
250
- struct ElementList {
251
- void add(const std::shared_ptr<ElementBase> &e) { l.push_back(e); }
252
- std::vector<std::shared_ptr<ElementBase>> l;
253
- };
254
-
255
- } // namespace
256
-
257
- // ref<T> is a wrapper for 'Object' which uses intrusive reference counting
258
- // It is always possible to construct a ref<T> from an Object* pointer without
259
- // possible inconsistencies, hence the 'true' argument at the end.
260
- // Make pybind11 aware of the non-standard getter member function
261
- namespace pybind11 { namespace detail {
262
- template <typename T>
263
- struct holder_helper<ref<T>> {
264
- static const T *get(const ref<T> &p) { return p.get_ptr(); }
265
- };
266
- } // namespace detail
267
- } // namespace pybind11
268
-
269
- // Make pybind aware of the ref-counted wrapper type (s):
270
- PYBIND11_DECLARE_HOLDER_TYPE(T, ref<T>, true);
271
- // The following is not required anymore for std::shared_ptr, but it should compile without error:
272
- PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>);
273
- PYBIND11_DECLARE_HOLDER_TYPE(T, huge_unique_ptr<T>);
274
- PYBIND11_DECLARE_HOLDER_TYPE(T, custom_unique_ptr<T>);
275
- PYBIND11_DECLARE_HOLDER_TYPE(T, shared_ptr_with_addressof_operator<T>);
276
- PYBIND11_DECLARE_HOLDER_TYPE(T, unique_ptr_with_addressof_operator<T>);
277
-
278
- TEST_SUBMODULE(smart_ptr, m) {
279
- // Please do not interleave `struct` and `class` definitions with bindings code,
280
- // but implement `struct`s and `class`es in the anonymous namespace above.
281
- // This helps keeping the smart_holder branch in sync with master.
282
-
283
- // test_smart_ptr
284
-
285
- // Object implementation in `object.h`
286
- py::class_<Object, ref<Object>> obj(m, "Object");
287
- obj.def("getRefCount", &Object::getRefCount);
288
-
289
- py::class_<MyObject1, ref<MyObject1>>(m, "MyObject1", obj)
290
- .def(py::init<int>());
291
- py::implicitly_convertible<py::int_, MyObject1>();
292
-
293
- m.def("make_object_1", []() -> Object * { return new MyObject1(1); });
294
- m.def("make_object_2", []() -> ref<Object> { return ref<Object>(new MyObject1(2)); });
295
- m.def("make_myobject1_1", []() -> MyObject1 * { return new MyObject1(4); });
296
- m.def("make_myobject1_2", []() -> ref<MyObject1> { return ref<MyObject1>(new MyObject1(5)); });
297
- m.def("print_object_1", [](const Object *obj) { py::print(obj->toString()); });
298
- m.def("print_object_2", [](ref<Object> obj) { py::print(obj->toString()); });
299
- m.def("print_object_3", [](const ref<Object> &obj) { py::print(obj->toString()); });
300
- m.def("print_object_4", [](const ref<Object> *obj) { py::print((*obj)->toString()); });
301
- m.def("print_myobject1_1", [](const MyObject1 *obj) { py::print(obj->toString()); });
302
- m.def("print_myobject1_2", [](ref<MyObject1> obj) { py::print(obj->toString()); });
303
- m.def("print_myobject1_3", [](const ref<MyObject1> &obj) { py::print(obj->toString()); });
304
- m.def("print_myobject1_4", [](const ref<MyObject1> *obj) { py::print((*obj)->toString()); });
305
-
306
- // Expose constructor stats for the ref type
307
- m.def("cstats_ref", &ConstructorStats::get<ref_tag>);
308
-
309
- py::class_<MyObject2, std::shared_ptr<MyObject2>>(m, "MyObject2")
310
- .def(py::init<int>());
311
- m.def("make_myobject2_1", []() { return new MyObject2(6); });
312
- m.def("make_myobject2_2", []() { return std::make_shared<MyObject2>(7); });
313
- m.def("print_myobject2_1", [](const MyObject2 *obj) { py::print(obj->toString()); });
314
- // NOLINTNEXTLINE(performance-unnecessary-value-param)
315
- m.def("print_myobject2_2", [](std::shared_ptr<MyObject2> obj) { py::print(obj->toString()); });
316
- m.def("print_myobject2_3", [](const std::shared_ptr<MyObject2> &obj) { py::print(obj->toString()); });
317
- m.def("print_myobject2_4", [](const std::shared_ptr<MyObject2> *obj) { py::print((*obj)->toString()); });
318
-
319
- py::class_<MyObject3, std::shared_ptr<MyObject3>>(m, "MyObject3")
320
- .def(py::init<int>());
321
- m.def("make_myobject3_1", []() { return new MyObject3(8); });
322
- m.def("make_myobject3_2", []() { return std::make_shared<MyObject3>(9); });
323
- m.def("print_myobject3_1", [](const MyObject3 *obj) { py::print(obj->toString()); });
324
- // NOLINTNEXTLINE(performance-unnecessary-value-param)
325
- m.def("print_myobject3_2", [](std::shared_ptr<MyObject3> obj) { py::print(obj->toString()); });
326
- m.def("print_myobject3_3", [](const std::shared_ptr<MyObject3> &obj) { py::print(obj->toString()); });
327
- m.def("print_myobject3_4", [](const std::shared_ptr<MyObject3> *obj) { py::print((*obj)->toString()); });
328
-
329
- // test_smart_ptr_refcounting
330
- m.def("test_object1_refcounting", []() {
331
- auto o = ref<MyObject1>(new MyObject1(0));
332
- bool good = o->getRefCount() == 1;
333
- py::object o2 = py::cast(o, py::return_value_policy::reference);
334
- // always request (partial) ownership for objects with intrusive
335
- // reference counting even when using the 'reference' RVP
336
- good &= o->getRefCount() == 2;
337
- return good;
338
- });
339
-
340
- // test_unique_nodelete
341
- py::class_<MyObject4, std::unique_ptr<MyObject4, py::nodelete>>(m, "MyObject4")
342
- .def(py::init<int>())
343
- .def_readwrite("value", &MyObject4::value)
344
- .def_static("cleanup_all_instances", &MyObject4::cleanupAllInstances);
345
-
346
- // test_unique_deleter
347
- py::class_<MyObject4a, std::unique_ptr<MyObject4a, py::nodelete>>(m, "MyObject4a")
348
- .def(py::init<int>())
349
- .def_readwrite("value", &MyObject4a::value)
350
- .def_static("cleanup_all_instances", &MyObject4a::cleanupAllInstances);
351
-
352
- py::class_<MyObject4b, MyObject4a, std::unique_ptr<MyObject4b>>(m, "MyObject4b")
353
- .def(py::init<int>());
354
-
355
- // test_large_holder
356
- py::class_<MyObject5, huge_unique_ptr<MyObject5>>(m, "MyObject5")
357
- .def(py::init<int>())
358
- .def_readwrite("value", &MyObject5::value);
359
-
360
- // test_shared_ptr_and_references
361
- using A = SharedPtrRef::A;
362
- py::class_<A, std::shared_ptr<A>>(m, "A");
363
- py::class_<SharedPtrRef, std::unique_ptr<SharedPtrRef>>(m, "SharedPtrRef")
364
- .def(py::init<>())
365
- .def_readonly("ref", &SharedPtrRef::value)
366
- .def_property_readonly(
367
- "copy", [](const SharedPtrRef &s) { return s.value; }, py::return_value_policy::copy)
368
- .def_readonly("holder_ref", &SharedPtrRef::shared)
369
- .def_property_readonly(
370
- "holder_copy",
371
- [](const SharedPtrRef &s) { return s.shared; },
372
- py::return_value_policy::copy)
373
- .def("set_ref", [](SharedPtrRef &, const A &) { return true; })
374
- // NOLINTNEXTLINE(performance-unnecessary-value-param)
375
- .def("set_holder", [](SharedPtrRef &, std::shared_ptr<A>) { return true; });
376
-
377
- // test_shared_ptr_from_this_and_references
378
- using B = SharedFromThisRef::B;
379
- py::class_<B, std::shared_ptr<B>>(m, "B");
380
- py::class_<SharedFromThisRef, std::unique_ptr<SharedFromThisRef>>(m, "SharedFromThisRef")
381
- .def(py::init<>())
382
- .def_readonly("bad_wp", &SharedFromThisRef::value)
383
- .def_property_readonly("ref",
384
- [](const SharedFromThisRef &s) -> const B & { return *s.shared; })
385
- .def_property_readonly(
386
- "copy",
387
- [](const SharedFromThisRef &s) { return s.value; },
388
- py::return_value_policy::copy)
389
- .def_readonly("holder_ref", &SharedFromThisRef::shared)
390
- .def_property_readonly(
391
- "holder_copy",
392
- [](const SharedFromThisRef &s) { return s.shared; },
393
- py::return_value_policy::copy)
394
- .def("set_ref", [](SharedFromThisRef &, const B &) { return true; })
395
- // NOLINTNEXTLINE(performance-unnecessary-value-param)
396
- .def("set_holder", [](SharedFromThisRef &, std::shared_ptr<B>) { return true; });
397
-
398
- // Issue #865: shared_from_this doesn't work with virtual inheritance
399
- static std::shared_ptr<SharedFromThisVirt> sft(new SharedFromThisVirt());
400
- py::class_<SharedFromThisVirt, std::shared_ptr<SharedFromThisVirt>>(m, "SharedFromThisVirt")
401
- .def_static("get", []() { return sft.get(); });
402
-
403
- // test_move_only_holder
404
- py::class_<C, custom_unique_ptr<C>>(m, "TypeWithMoveOnlyHolder")
405
- .def_static("make", []() { return custom_unique_ptr<C>(new C); })
406
- .def_static("make_as_object", []() { return py::cast(custom_unique_ptr<C>(new C)); });
407
-
408
- // test_holder_with_addressof_operator
409
- using HolderWithAddressOf = shared_ptr_with_addressof_operator<TypeForHolderWithAddressOf>;
410
- py::class_<TypeForHolderWithAddressOf, HolderWithAddressOf>(m, "TypeForHolderWithAddressOf")
411
- .def_static("make", []() { return HolderWithAddressOf(new TypeForHolderWithAddressOf); })
412
- .def("get", [](const HolderWithAddressOf &self) { return self.get(); })
413
- .def("print_object_1",
414
- [](const TypeForHolderWithAddressOf *obj) { py::print(obj->toString()); })
415
- // NOLINTNEXTLINE(performance-unnecessary-value-param)
416
- .def("print_object_2", [](HolderWithAddressOf obj) { py::print(obj.get()->toString()); })
417
- .def("print_object_3",
418
- [](const HolderWithAddressOf &obj) { py::print(obj.get()->toString()); })
419
- .def("print_object_4",
420
- [](const HolderWithAddressOf *obj) { py::print((*obj).get()->toString()); });
421
-
422
- // test_move_only_holder_with_addressof_operator
423
- using MoveOnlyHolderWithAddressOf = unique_ptr_with_addressof_operator<TypeForMoveOnlyHolderWithAddressOf>;
424
- py::class_<TypeForMoveOnlyHolderWithAddressOf, MoveOnlyHolderWithAddressOf>(m, "TypeForMoveOnlyHolderWithAddressOf")
425
- .def_static("make", []() { return MoveOnlyHolderWithAddressOf(new TypeForMoveOnlyHolderWithAddressOf(0)); })
426
- .def_readwrite("value", &TypeForMoveOnlyHolderWithAddressOf::value)
427
- .def("print_object", [](const TypeForMoveOnlyHolderWithAddressOf *obj) { py::print(obj->toString()); });
428
-
429
- // test_smart_ptr_from_default
430
- py::class_<HeldByDefaultHolder, std::unique_ptr<HeldByDefaultHolder>>(m, "HeldByDefaultHolder")
431
- .def(py::init<>())
432
- // NOLINTNEXTLINE(performance-unnecessary-value-param)
433
- .def_static("load_shared_ptr", [](std::shared_ptr<HeldByDefaultHolder>) {});
434
-
435
- // test_shared_ptr_gc
436
- // #187: issue involving std::shared_ptr<> return value policy & garbage collection
437
- py::class_<ElementBase, std::shared_ptr<ElementBase>>(m, "ElementBase");
438
-
439
- py::class_<ElementA, ElementBase, std::shared_ptr<ElementA>>(m, "ElementA")
440
- .def(py::init<int>())
441
- .def("value", &ElementA::value);
442
-
443
- py::class_<ElementList, std::shared_ptr<ElementList>>(m, "ElementList")
444
- .def(py::init<>())
445
- .def("add", &ElementList::add)
446
- .def("get", [](ElementList &el) {
447
- py::list list;
448
- for (auto &e : el.l)
449
- list.append(py::cast(e));
450
- return list;
451
- });
452
- }