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,291 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- import pytest
3
-
4
- from pybind11_tests import ConstructorStats, UserType
5
- from pybind11_tests import stl as m
6
-
7
-
8
- def test_vector(doc):
9
- """std::vector <-> list"""
10
- lst = m.cast_vector()
11
- assert lst == [1]
12
- lst.append(2)
13
- assert m.load_vector(lst)
14
- assert m.load_vector(tuple(lst))
15
-
16
- assert m.cast_bool_vector() == [True, False]
17
- assert m.load_bool_vector([True, False])
18
-
19
- assert doc(m.cast_vector) == "cast_vector() -> List[int]"
20
- assert doc(m.load_vector) == "load_vector(arg0: List[int]) -> bool"
21
-
22
- # Test regression caused by 936: pointers to stl containers weren't castable
23
- assert m.cast_ptr_vector() == ["lvalue", "lvalue"]
24
-
25
-
26
- def test_deque(doc):
27
- """std::deque <-> list"""
28
- lst = m.cast_deque()
29
- assert lst == [1]
30
- lst.append(2)
31
- assert m.load_deque(lst)
32
- assert m.load_deque(tuple(lst))
33
-
34
-
35
- def test_array(doc):
36
- """std::array <-> list"""
37
- lst = m.cast_array()
38
- assert lst == [1, 2]
39
- assert m.load_array(lst)
40
-
41
- assert doc(m.cast_array) == "cast_array() -> List[int[2]]"
42
- assert doc(m.load_array) == "load_array(arg0: List[int[2]]) -> bool"
43
-
44
-
45
- def test_valarray(doc):
46
- """std::valarray <-> list"""
47
- lst = m.cast_valarray()
48
- assert lst == [1, 4, 9]
49
- assert m.load_valarray(lst)
50
-
51
- assert doc(m.cast_valarray) == "cast_valarray() -> List[int]"
52
- assert doc(m.load_valarray) == "load_valarray(arg0: List[int]) -> bool"
53
-
54
-
55
- def test_map(doc):
56
- """std::map <-> dict"""
57
- d = m.cast_map()
58
- assert d == {"key": "value"}
59
- assert "key" in d
60
- d["key2"] = "value2"
61
- assert "key2" in d
62
- assert m.load_map(d)
63
-
64
- assert doc(m.cast_map) == "cast_map() -> Dict[str, str]"
65
- assert doc(m.load_map) == "load_map(arg0: Dict[str, str]) -> bool"
66
-
67
-
68
- def test_set(doc):
69
- """std::set <-> set"""
70
- s = m.cast_set()
71
- assert s == {"key1", "key2"}
72
- s.add("key3")
73
- assert m.load_set(s)
74
-
75
- assert doc(m.cast_set) == "cast_set() -> Set[str]"
76
- assert doc(m.load_set) == "load_set(arg0: Set[str]) -> bool"
77
-
78
-
79
- def test_recursive_casting():
80
- """Tests that stl casters preserve lvalue/rvalue context for container values"""
81
- assert m.cast_rv_vector() == ["rvalue", "rvalue"]
82
- assert m.cast_lv_vector() == ["lvalue", "lvalue"]
83
- assert m.cast_rv_array() == ["rvalue", "rvalue", "rvalue"]
84
- assert m.cast_lv_array() == ["lvalue", "lvalue"]
85
- assert m.cast_rv_map() == {"a": "rvalue"}
86
- assert m.cast_lv_map() == {"a": "lvalue", "b": "lvalue"}
87
- assert m.cast_rv_nested() == [[[{"b": "rvalue", "c": "rvalue"}], [{"a": "rvalue"}]]]
88
- assert m.cast_lv_nested() == {
89
- "a": [[["lvalue", "lvalue"]], [["lvalue", "lvalue"]]],
90
- "b": [[["lvalue", "lvalue"], ["lvalue", "lvalue"]]],
91
- }
92
-
93
- # Issue #853 test case:
94
- z = m.cast_unique_ptr_vector()
95
- assert z[0].value == 7 and z[1].value == 42
96
-
97
-
98
- def test_move_out_container():
99
- """Properties use the `reference_internal` policy by default. If the underlying function
100
- returns an rvalue, the policy is automatically changed to `move` to avoid referencing
101
- a temporary. In case the return value is a container of user-defined types, the policy
102
- also needs to be applied to the elements, not just the container."""
103
- c = m.MoveOutContainer()
104
- moved_out_list = c.move_list
105
- assert [x.value for x in moved_out_list] == [0, 1, 2]
106
-
107
-
108
- @pytest.mark.skipif(not hasattr(m, "has_optional"), reason="no <optional>")
109
- def test_optional():
110
- assert m.double_or_zero(None) == 0
111
- assert m.double_or_zero(42) == 84
112
- pytest.raises(TypeError, m.double_or_zero, "foo")
113
-
114
- assert m.half_or_none(0) is None
115
- assert m.half_or_none(42) == 21
116
- pytest.raises(TypeError, m.half_or_none, "foo")
117
-
118
- assert m.test_nullopt() == 42
119
- assert m.test_nullopt(None) == 42
120
- assert m.test_nullopt(42) == 42
121
- assert m.test_nullopt(43) == 43
122
-
123
- assert m.test_no_assign() == 42
124
- assert m.test_no_assign(None) == 42
125
- assert m.test_no_assign(m.NoAssign(43)) == 43
126
- pytest.raises(TypeError, m.test_no_assign, 43)
127
-
128
- assert m.nodefer_none_optional(None)
129
-
130
- holder = m.OptionalHolder()
131
- mvalue = holder.member
132
- assert mvalue.initialized
133
- assert holder.member_initialized()
134
-
135
-
136
- @pytest.mark.skipif(
137
- not hasattr(m, "has_exp_optional"), reason="no <experimental/optional>"
138
- )
139
- def test_exp_optional():
140
- assert m.double_or_zero_exp(None) == 0
141
- assert m.double_or_zero_exp(42) == 84
142
- pytest.raises(TypeError, m.double_or_zero_exp, "foo")
143
-
144
- assert m.half_or_none_exp(0) is None
145
- assert m.half_or_none_exp(42) == 21
146
- pytest.raises(TypeError, m.half_or_none_exp, "foo")
147
-
148
- assert m.test_nullopt_exp() == 42
149
- assert m.test_nullopt_exp(None) == 42
150
- assert m.test_nullopt_exp(42) == 42
151
- assert m.test_nullopt_exp(43) == 43
152
-
153
- assert m.test_no_assign_exp() == 42
154
- assert m.test_no_assign_exp(None) == 42
155
- assert m.test_no_assign_exp(m.NoAssign(43)) == 43
156
- pytest.raises(TypeError, m.test_no_assign_exp, 43)
157
-
158
- holder = m.OptionalExpHolder()
159
- mvalue = holder.member
160
- assert mvalue.initialized
161
- assert holder.member_initialized()
162
-
163
-
164
- @pytest.mark.skipif(not hasattr(m, "has_filesystem"), reason="no <filesystem>")
165
- def test_fs_path():
166
- from pathlib import Path
167
-
168
- class PseudoStrPath:
169
- def __fspath__(self):
170
- return "foo/bar"
171
-
172
- class PseudoBytesPath:
173
- def __fspath__(self):
174
- return b"foo/bar"
175
-
176
- assert m.parent_path(Path("foo/bar")) == Path("foo")
177
- assert m.parent_path("foo/bar") == Path("foo")
178
- assert m.parent_path(b"foo/bar") == Path("foo")
179
- assert m.parent_path(PseudoStrPath()) == Path("foo")
180
- assert m.parent_path(PseudoBytesPath()) == Path("foo")
181
-
182
-
183
- @pytest.mark.skipif(not hasattr(m, "load_variant"), reason="no <variant>")
184
- def test_variant(doc):
185
- assert m.load_variant(1) == "int"
186
- assert m.load_variant("1") == "std::string"
187
- assert m.load_variant(1.0) == "double"
188
- assert m.load_variant(None) == "std::nullptr_t"
189
-
190
- assert m.load_variant_2pass(1) == "int"
191
- assert m.load_variant_2pass(1.0) == "double"
192
-
193
- assert m.cast_variant() == (5, "Hello")
194
-
195
- assert (
196
- doc(m.load_variant) == "load_variant(arg0: Union[int, str, float, None]) -> str"
197
- )
198
-
199
-
200
- def test_vec_of_reference_wrapper():
201
- """#171: Can't return reference wrappers (or STL structures containing them)"""
202
- assert (
203
- str(m.return_vec_of_reference_wrapper(UserType(4)))
204
- == "[UserType(1), UserType(2), UserType(3), UserType(4)]"
205
- )
206
-
207
-
208
- def test_stl_pass_by_pointer(msg):
209
- """Passing nullptr or None to an STL container pointer is not expected to work"""
210
- with pytest.raises(TypeError) as excinfo:
211
- m.stl_pass_by_pointer() # default value is `nullptr`
212
- assert (
213
- msg(excinfo.value)
214
- == """
215
- stl_pass_by_pointer(): incompatible function arguments. The following argument types are supported:
216
- 1. (v: List[int] = None) -> List[int]
217
-
218
- Invoked with:
219
- """ # noqa: E501 line too long
220
- )
221
-
222
- with pytest.raises(TypeError) as excinfo:
223
- m.stl_pass_by_pointer(None)
224
- assert (
225
- msg(excinfo.value)
226
- == """
227
- stl_pass_by_pointer(): incompatible function arguments. The following argument types are supported:
228
- 1. (v: List[int] = None) -> List[int]
229
-
230
- Invoked with: None
231
- """ # noqa: E501 line too long
232
- )
233
-
234
- assert m.stl_pass_by_pointer([1, 2, 3]) == [1, 2, 3]
235
-
236
-
237
- def test_missing_header_message():
238
- """Trying convert `list` to a `std::vector`, or vice versa, without including
239
- <pybind11/stl.h> should result in a helpful suggestion in the error message"""
240
- import pybind11_cross_module_tests as cm
241
-
242
- expected_message = (
243
- "Did you forget to `#include <pybind11/stl.h>`? Or <pybind11/complex.h>,\n"
244
- "<pybind11/functional.h>, <pybind11/chrono.h>, etc. Some automatic\n"
245
- "conversions are optional and require extra headers to be included\n"
246
- "when compiling your pybind11 module."
247
- )
248
-
249
- with pytest.raises(TypeError) as excinfo:
250
- cm.missing_header_arg([1.0, 2.0, 3.0])
251
- assert expected_message in str(excinfo.value)
252
-
253
- with pytest.raises(TypeError) as excinfo:
254
- cm.missing_header_return()
255
- assert expected_message in str(excinfo.value)
256
-
257
-
258
- def test_function_with_string_and_vector_string_arg():
259
- """Check if a string is NOT implicitly converted to a list, which was the
260
- behavior before fix of issue #1258"""
261
- assert m.func_with_string_or_vector_string_arg_overload(("A", "B")) == 2
262
- assert m.func_with_string_or_vector_string_arg_overload(["A", "B"]) == 2
263
- assert m.func_with_string_or_vector_string_arg_overload("A") == 3
264
-
265
-
266
- def test_stl_ownership():
267
- cstats = ConstructorStats.get(m.Placeholder)
268
- assert cstats.alive() == 0
269
- r = m.test_stl_ownership()
270
- assert len(r) == 1
271
- del r
272
- assert cstats.alive() == 0
273
-
274
-
275
- def test_array_cast_sequence():
276
- assert m.array_cast_sequence((1, 2, 3)) == [1, 2, 3]
277
-
278
-
279
- def test_issue_1561():
280
- """check fix for issue #1561"""
281
- bar = m.Issue1561Outer()
282
- bar.list = [m.Issue1561Inner("bar")]
283
- bar.list
284
- assert bar.list[0].data == "bar"
285
-
286
-
287
- def test_return_vector_bool_raw_ptr():
288
- # Add `while True:` for manual leak checking.
289
- v = m.return_vector_bool_raw_ptr()
290
- assert isinstance(v, list)
291
- assert len(v) == 4513
@@ -1,131 +0,0 @@
1
- /*
2
- tests/test_stl_binders.cpp -- Usage of stl_binders functions
3
-
4
- Copyright (c) 2016 Sergey Lyskov
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
- #include "pybind11_tests.h"
11
-
12
- #include <pybind11/stl_bind.h>
13
- #include <pybind11/numpy.h>
14
- #include <map>
15
- #include <deque>
16
- #include <unordered_map>
17
-
18
- class El {
19
- public:
20
- El() = delete;
21
- explicit El(int v) : a(v) {}
22
-
23
- int a;
24
- };
25
-
26
- std::ostream & operator<<(std::ostream &s, El const&v) {
27
- s << "El{" << v.a << '}';
28
- return s;
29
- }
30
-
31
- /// Issue #487: binding std::vector<E> with E non-copyable
32
- class E_nc {
33
- public:
34
- explicit E_nc(int i) : value{i} {}
35
- E_nc(const E_nc &) = delete;
36
- E_nc &operator=(const E_nc &) = delete;
37
- E_nc(E_nc &&) = default;
38
- E_nc &operator=(E_nc &&) = default;
39
-
40
- int value;
41
- };
42
-
43
- template <class Container> Container *one_to_n(int n) {
44
- auto v = new Container();
45
- for (int i = 1; i <= n; i++)
46
- v->emplace_back(i);
47
- return v;
48
- }
49
-
50
- template <class Map> Map *times_ten(int n) {
51
- auto m = new Map();
52
- for (int i = 1; i <= n; i++)
53
- m->emplace(int(i), E_nc(10*i));
54
- return m;
55
- }
56
-
57
- template <class NestMap> NestMap *times_hundred(int n) {
58
- auto m = new NestMap();
59
- for (int i = 1; i <= n; i++)
60
- for (int j = 1; j <= n; j++)
61
- (*m)[i].emplace(int(j*10), E_nc(100*j));
62
- return m;
63
- }
64
-
65
- TEST_SUBMODULE(stl_binders, m) {
66
- // test_vector_int
67
- py::bind_vector<std::vector<unsigned int>>(m, "VectorInt", py::buffer_protocol());
68
-
69
- // test_vector_custom
70
- py::class_<El>(m, "El")
71
- .def(py::init<int>());
72
- py::bind_vector<std::vector<El>>(m, "VectorEl");
73
- py::bind_vector<std::vector<std::vector<El>>>(m, "VectorVectorEl");
74
-
75
- // test_map_string_double
76
- py::bind_map<std::map<std::string, double>>(m, "MapStringDouble");
77
- py::bind_map<std::unordered_map<std::string, double>>(m, "UnorderedMapStringDouble");
78
-
79
- // test_map_string_double_const
80
- py::bind_map<std::map<std::string, double const>>(m, "MapStringDoubleConst");
81
- py::bind_map<std::unordered_map<std::string, double const>>(m, "UnorderedMapStringDoubleConst");
82
-
83
- py::class_<E_nc>(m, "ENC")
84
- .def(py::init<int>())
85
- .def_readwrite("value", &E_nc::value);
86
-
87
- // test_noncopyable_containers
88
- py::bind_vector<std::vector<E_nc>>(m, "VectorENC");
89
- m.def("get_vnc", &one_to_n<std::vector<E_nc>>);
90
- py::bind_vector<std::deque<E_nc>>(m, "DequeENC");
91
- m.def("get_dnc", &one_to_n<std::deque<E_nc>>);
92
- py::bind_map<std::map<int, E_nc>>(m, "MapENC");
93
- m.def("get_mnc", &times_ten<std::map<int, E_nc>>);
94
- py::bind_map<std::unordered_map<int, E_nc>>(m, "UmapENC");
95
- m.def("get_umnc", &times_ten<std::unordered_map<int, E_nc>>);
96
- // Issue #1885: binding nested std::map<X, Container<E>> with E non-copyable
97
- py::bind_map<std::map<int, std::vector<E_nc>>>(m, "MapVecENC");
98
- m.def("get_nvnc", [](int n)
99
- {
100
- auto m = new std::map<int, std::vector<E_nc>>();
101
- for (int i = 1; i <= n; i++)
102
- for (int j = 1; j <= n; j++)
103
- (*m)[i].emplace_back(j);
104
- return m;
105
- });
106
- py::bind_map<std::map<int, std::map<int, E_nc>>>(m, "MapMapENC");
107
- m.def("get_nmnc", &times_hundred<std::map<int, std::map<int, E_nc>>>);
108
- py::bind_map<std::unordered_map<int, std::unordered_map<int, E_nc>>>(m, "UmapUmapENC");
109
- m.def("get_numnc", &times_hundred<std::unordered_map<int, std::unordered_map<int, E_nc>>>);
110
-
111
- // test_vector_buffer
112
- py::bind_vector<std::vector<unsigned char>>(m, "VectorUChar", py::buffer_protocol());
113
- // no dtype declared for this version:
114
- struct VUndeclStruct { bool w; uint32_t x; double y; bool z; };
115
- m.def("create_undeclstruct", [m] () mutable {
116
- py::bind_vector<std::vector<VUndeclStruct>>(m, "VectorUndeclStruct", py::buffer_protocol());
117
- });
118
-
119
- // The rest depends on numpy:
120
- try { py::module_::import("numpy"); }
121
- catch (...) { return; }
122
-
123
- // test_vector_buffer_numpy
124
- struct VStruct { bool w; uint32_t x; double y; bool z; };
125
- PYBIND11_NUMPY_DTYPE(VStruct, w, x, y, z);
126
- py::class_<VStruct>(m, "VStruct").def_readwrite("x", &VStruct::x);
127
- py::bind_vector<std::vector<VStruct>>(m, "VectorStruct", py::buffer_protocol());
128
- m.def("get_vectorstruct", [] {
129
- return std::vector<VStruct>{{false, 5, 3.0, true}, {true, 30, -1e4, false}};
130
- });
131
- }