xcoll 0.3.6__py3-none-any.whl → 0.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of xcoll might be problematic. Click here for more details.
- xcoll/__init__.py +13 -4
- xcoll/beam_elements/__init__.py +14 -6
- xcoll/beam_elements/absorber.py +41 -7
- xcoll/beam_elements/base.py +1202 -247
- xcoll/beam_elements/blowup.py +198 -0
- xcoll/beam_elements/elements_src/black_absorber.h +136 -0
- xcoll/beam_elements/elements_src/black_crystal.h +129 -0
- xcoll/beam_elements/elements_src/blowup.h +42 -0
- xcoll/beam_elements/elements_src/emittance_monitor.h +109 -0
- xcoll/beam_elements/{collimators_src → elements_src}/everest_block.h +59 -30
- xcoll/beam_elements/elements_src/everest_collimator.h +237 -0
- xcoll/beam_elements/elements_src/everest_crystal.h +280 -0
- xcoll/beam_elements/everest.py +65 -119
- xcoll/beam_elements/monitor.py +428 -0
- xcoll/colldb.py +276 -747
- xcoll/general.py +5 -5
- xcoll/headers/checks.h +1 -1
- xcoll/headers/particle_states.h +2 -2
- xcoll/initial_distribution.py +207 -0
- xcoll/install.py +179 -0
- xcoll/interaction_record/__init__.py +1 -0
- xcoll/interaction_record/interaction_record.py +298 -0
- xcoll/interaction_record/interaction_record_src/interaction_record.h +98 -0
- xcoll/{impacts → interaction_record}/interaction_types.py +11 -4
- xcoll/line_tools.py +82 -0
- xcoll/lossmap.py +219 -0
- xcoll/manager.py +2 -937
- xcoll/rf_sweep.py +1 -1
- xcoll/scattering_routines/everest/amorphous.h +232 -0
- xcoll/scattering_routines/everest/channeling.h +240 -0
- xcoll/scattering_routines/everest/crystal_parameters.h +137 -0
- xcoll/scattering_routines/everest/everest.h +11 -30
- xcoll/scattering_routines/everest/everest.py +13 -10
- xcoll/scattering_routines/everest/jaw.h +28 -197
- xcoll/scattering_routines/everest/materials.py +37 -15
- xcoll/scattering_routines/everest/multiple_coulomb_scattering.h +31 -10
- xcoll/scattering_routines/everest/nuclear_interaction.h +86 -0
- xcoll/scattering_routines/everest/properties.h +6 -1
- xcoll/scattering_routines/fluka/flukaio/lib/libFlukaIO64.a +0 -0
- xcoll/scattering_routines/geant4/collimasim/.git +1 -0
- xcoll/scattering_routines/geant4/collimasim/.gitignore +12 -0
- xcoll/scattering_routines/geant4/collimasim/.gitmodules +3 -0
- xcoll/scattering_routines/geant4/collimasim/CMakeLists.txt +26 -0
- xcoll/scattering_routines/geant4/collimasim/README.md +21 -0
- xcoll/scattering_routines/geant4/collimasim/docs/Makefile +20 -0
- xcoll/scattering_routines/geant4/collimasim/docs/make.bat +35 -0
- xcoll/scattering_routines/geant4/collimasim/docs/source/collimasim.rst +10 -0
- xcoll/scattering_routines/geant4/collimasim/docs/source/conf.py +59 -0
- xcoll/scattering_routines/geant4/collimasim/docs/source/index.rst +26 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.appveyor.yml +37 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-format +19 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-tidy +65 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.cmake-format.yaml +73 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.git +1 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CODEOWNERS +9 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CONTRIBUTING.md +386 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/bug-report.yml +45 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/config.yml +8 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/dependabot.yml +16 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler.yml +8 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler_merged.yml +3 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/pull_request_template.md +19 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/ci.yml +969 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/configure.yml +84 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/format.yml +48 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/labeler.yml +16 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/pip.yml +103 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.gitignore +45 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.pre-commit-config.yaml +151 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.readthedocs.yml +3 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/CMakeLists.txt +297 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/LICENSE +29 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/MANIFEST.in +6 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/README.rst +180 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Doxyfile +23 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Makefile +192 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/_static/theme_overrides.css +11 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/chrono.rst +81 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/custom.rst +93 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/eigen.rst +310 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/functional.rst +109 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/index.rst +43 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/overview.rst +171 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/stl.rst +251 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/strings.rst +305 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/classes.rst +1297 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/embedding.rst +262 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/exceptions.rst +396 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/functions.rst +568 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/misc.rst +337 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/index.rst +13 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/numpy.rst +463 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/object.rst +286 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/utilities.rst +155 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/smart_ptrs.rst +174 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/basics.rst +308 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.py +91 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.rst +95 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/changelog.rst +2050 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/classes.rst +542 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/cmake/index.rst +8 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/compiling.rst +648 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/conf.py +381 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/faq.rst +343 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/index.rst +48 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/installing.rst +105 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/limitations.rst +72 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11-logo.png +0 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python1.png +0 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python1.svg +427 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python2.png +0 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python2.svg +427 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/reference.rst +130 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/release.rst +96 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/requirements.txt +8 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/upgrade.rst +548 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/attr.h +605 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/buffer_info.h +144 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/cast.h +1432 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/chrono.h +213 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/common.h +2 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/complex.h +65 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/class.h +709 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/common.h +1021 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/descr.h +104 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/init.h +346 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/internals.h +467 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/type_caster_base.h +978 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/typeid.h +55 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eigen.h +606 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/embed.h +284 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eval.h +163 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/functional.h +121 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/gil.h +193 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/iostream.h +275 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/numpy.h +1741 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/operators.h +163 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/options.h +65 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pybind11.h +2497 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pytypes.h +1879 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl/filesystem.h +103 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl.h +375 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl_bind.h +747 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/noxfile.py +88 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__init__.py +11 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__main__.py +52 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.py +12 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.pyi +6 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/commands.py +21 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/py.typed +0 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.py +482 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.pyi +63 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pyproject.toml +41 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.cfg +56 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.py +155 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/CMakeLists.txt +503 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/conftest.py +208 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/constructor_stats.h +275 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/cross_module_gil_utils.cpp +73 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/env.py +33 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_python_package/pytest.ini +0 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_python_package/test_files.py +279 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_setuptools/pytest.ini +0 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_setuptools/test_setuphelper.py +143 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/local_bindings.h +85 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/object.h +179 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_cross_module_tests.cpp +151 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.cpp +91 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.h +85 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pytest.ini +19 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/requirements.txt +12 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.cpp +26 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.py +25 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.cpp +216 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.py +163 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.cpp +286 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.py +536 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.cpp +107 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.py +248 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.cpp +227 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.py +202 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.cpp +84 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.py +210 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.cpp +550 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.py +473 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/CMakeLists.txt +84 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/embed.cpp +21 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_embed/CMakeLists.txt +28 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_function/CMakeLists.txt +39 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_target/CMakeLists.txt +46 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/main.cpp +6 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt +41 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt +35 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_target/CMakeLists.txt +41 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/test.py +10 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.cpp +165 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.py +53 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.cpp +238 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.py +126 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.cpp +141 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.py +117 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.cpp +41 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.py +50 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.cpp +69 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.py +42 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.cpp +348 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.py +771 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/CMakeLists.txt +47 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/catch.cpp +22 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/external_module.cpp +23 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.cpp +326 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.py +15 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.cpp +148 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.py +272 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.cpp +119 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.py +51 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval_call.py +5 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.cpp +285 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.h +12 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.py +265 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.cpp +397 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.py +520 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.cpp +49 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.py +94 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.cpp +125 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.py +331 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.cpp +153 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.py +284 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.cpp +107 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.py +257 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.cpp +412 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.py +517 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.cpp +102 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.py +92 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.cpp +233 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.py +360 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.cpp +472 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.py +593 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.cpp +524 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.py +441 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.cpp +103 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.py +267 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.cpp +73 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.py +59 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.cpp +235 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.py +146 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.cpp +189 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.py +82 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.cpp +560 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.py +651 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.cpp +500 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.py +253 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.cpp +452 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.py +318 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.cpp +342 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.py +291 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.cpp +131 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.py +318 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.cpp +144 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.py +29 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.cpp +66 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.py +44 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.cpp +22 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.py +9 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.cpp +510 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.py +408 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-numpy-scipy.supp +140 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-python.supp +117 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindCatch.cmake +70 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindEigen3.cmake +86 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindPythonLibsNew.cmake +257 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/check-style.sh +44 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/cmake_uninstall.cmake.in +23 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/libsize.py +39 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/make_changelog.py +64 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Common.cmake +402 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Config.cmake.in +233 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11NewTools.cmake +276 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Tools.cmake +214 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pyproject.toml +3 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_global.py.in +65 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_main.py.in +41 -0
- xcoll/scattering_routines/geant4/collimasim/pyproject.toml +8 -0
- xcoll/scattering_routines/geant4/collimasim/setup.py +144 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.cpp +403 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.hh +100 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.cpp +763 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.hh +118 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/__init__.py +8 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/bindings.cpp +63 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/pyCollimatorPass.py +142 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/xtrack_collimator.py +556 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/PKG-INFO +6 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/SOURCES.txt +24 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/dependency_links.txt +1 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/not-zip-safe +1 -0
- xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/top_level.txt +1 -0
- xcoll/scattering_routines/geant4/collimasim/tests/README.md +25 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_forions.dat +25 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_new_example.dat +18 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_old_example.dat +68 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_testing.dat +15 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_yaml_example.yaml +110 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps.dat +7 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps_pyat_test.dat +3 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/collonly_twiss_file_example.tfs +54 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/settings.gmad +3 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/settings_black_absorber.gmad +3 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/settings_ions.gmad +5 -0
- xcoll/scattering_routines/geant4/collimasim/tests/resources/twiss_file_testing.tfs +51 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_pyat.py +65 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_passmethod.py +59 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_tracking.py +102 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack.py +75 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_angle.py +74 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_colldb_load.py +84 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_interaction.py +159 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_interaction_ion.py +99 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_ions.py +78 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_lost_energy.py +88 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tilt.py +80 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tracking.py +97 -0
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tracking_ions.py +96 -0
- xcoll/scattering_routines/geometry/__init__.py +6 -0
- xcoll/scattering_routines/geometry/collimator_geometry.h +218 -0
- xcoll/scattering_routines/geometry/crystal_geometry.h +153 -0
- xcoll/scattering_routines/geometry/geometry.py +26 -0
- xcoll/scattering_routines/geometry/get_s.h +92 -0
- xcoll/scattering_routines/geometry/methods.h +111 -0
- xcoll/scattering_routines/geometry/objects.h +154 -0
- xcoll/scattering_routines/geometry/rotation.h +23 -0
- xcoll/scattering_routines/geometry/segments.h +226 -0
- xcoll/scattering_routines/geometry/sort.h +184 -0
- {xcoll-0.3.6.dist-info → xcoll-0.5.0.dist-info}/METADATA +1 -1
- xcoll-0.5.0.dist-info/RECORD +413 -0
- xcoll/beam_elements/collimators_src/absorber.h +0 -141
- xcoll/beam_elements/collimators_src/everest_collimator.h +0 -142
- xcoll/beam_elements/collimators_src/everest_crystal.h +0 -115
- xcoll/collimator_settings.py +0 -457
- xcoll/impacts/__init__.py +0 -1
- xcoll/impacts/impacts.py +0 -102
- xcoll/impacts/impacts_src/impacts.h +0 -99
- xcoll/scattering_routines/everest/crystal.h +0 -1302
- xcoll/scattering_routines/everest/scatter.h +0 -169
- xcoll/scattering_routines/everest/scatter_crystal.h +0 -260
- xcoll/scattering_routines/fluka/build_fluka_input.py +0 -58
- xcoll-0.3.6.dist-info/RECORD +0 -111
- {xcoll-0.3.6.dist-info → xcoll-0.5.0.dist-info}/LICENSE +0 -0
- {xcoll-0.3.6.dist-info → xcoll-0.5.0.dist-info}/NOTICE +0 -0
- {xcoll-0.3.6.dist-info → xcoll-0.5.0.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
import pytest
|
|
3
|
+
|
|
4
|
+
import env # noqa: F401
|
|
5
|
+
|
|
6
|
+
m = pytest.importorskip("pybind11_tests.virtual_functions")
|
|
7
|
+
from pybind11_tests import ConstructorStats # noqa: E402
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def test_override(capture, msg):
|
|
11
|
+
class ExtendedExampleVirt(m.ExampleVirt):
|
|
12
|
+
def __init__(self, state):
|
|
13
|
+
super(ExtendedExampleVirt, self).__init__(state + 1)
|
|
14
|
+
self.data = "Hello world"
|
|
15
|
+
|
|
16
|
+
def run(self, value):
|
|
17
|
+
print("ExtendedExampleVirt::run(%i), calling parent.." % value)
|
|
18
|
+
return super(ExtendedExampleVirt, self).run(value + 1)
|
|
19
|
+
|
|
20
|
+
def run_bool(self):
|
|
21
|
+
print("ExtendedExampleVirt::run_bool()")
|
|
22
|
+
return False
|
|
23
|
+
|
|
24
|
+
def get_string1(self):
|
|
25
|
+
return "override1"
|
|
26
|
+
|
|
27
|
+
def pure_virtual(self):
|
|
28
|
+
print("ExtendedExampleVirt::pure_virtual(): %s" % self.data)
|
|
29
|
+
|
|
30
|
+
class ExtendedExampleVirt2(ExtendedExampleVirt):
|
|
31
|
+
def __init__(self, state):
|
|
32
|
+
super(ExtendedExampleVirt2, self).__init__(state + 1)
|
|
33
|
+
|
|
34
|
+
def get_string2(self):
|
|
35
|
+
return "override2"
|
|
36
|
+
|
|
37
|
+
ex12 = m.ExampleVirt(10)
|
|
38
|
+
with capture:
|
|
39
|
+
assert m.runExampleVirt(ex12, 20) == 30
|
|
40
|
+
assert (
|
|
41
|
+
capture
|
|
42
|
+
== """
|
|
43
|
+
Original implementation of ExampleVirt::run(state=10, value=20, str1=default1, str2=default2)
|
|
44
|
+
""" # noqa: E501 line too long
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
with pytest.raises(RuntimeError) as excinfo:
|
|
48
|
+
m.runExampleVirtVirtual(ex12)
|
|
49
|
+
assert (
|
|
50
|
+
msg(excinfo.value)
|
|
51
|
+
== 'Tried to call pure virtual function "ExampleVirt::pure_virtual"'
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
ex12p = ExtendedExampleVirt(10)
|
|
55
|
+
with capture:
|
|
56
|
+
assert m.runExampleVirt(ex12p, 20) == 32
|
|
57
|
+
assert (
|
|
58
|
+
capture
|
|
59
|
+
== """
|
|
60
|
+
ExtendedExampleVirt::run(20), calling parent..
|
|
61
|
+
Original implementation of ExampleVirt::run(state=11, value=21, str1=override1, str2=default2)
|
|
62
|
+
""" # noqa: E501 line too long
|
|
63
|
+
)
|
|
64
|
+
with capture:
|
|
65
|
+
assert m.runExampleVirtBool(ex12p) is False
|
|
66
|
+
assert capture == "ExtendedExampleVirt::run_bool()"
|
|
67
|
+
with capture:
|
|
68
|
+
m.runExampleVirtVirtual(ex12p)
|
|
69
|
+
assert capture == "ExtendedExampleVirt::pure_virtual(): Hello world"
|
|
70
|
+
|
|
71
|
+
ex12p2 = ExtendedExampleVirt2(15)
|
|
72
|
+
with capture:
|
|
73
|
+
assert m.runExampleVirt(ex12p2, 50) == 68
|
|
74
|
+
assert (
|
|
75
|
+
capture
|
|
76
|
+
== """
|
|
77
|
+
ExtendedExampleVirt::run(50), calling parent..
|
|
78
|
+
Original implementation of ExampleVirt::run(state=17, value=51, str1=override1, str2=override2)
|
|
79
|
+
""" # noqa: E501 line too long
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
cstats = ConstructorStats.get(m.ExampleVirt)
|
|
83
|
+
assert cstats.alive() == 3
|
|
84
|
+
del ex12, ex12p, ex12p2
|
|
85
|
+
assert cstats.alive() == 0
|
|
86
|
+
assert cstats.values() == ["10", "11", "17"]
|
|
87
|
+
assert cstats.copy_constructions == 0
|
|
88
|
+
assert cstats.move_constructions >= 0
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def test_alias_delay_initialization1(capture):
|
|
92
|
+
"""`A` only initializes its trampoline class when we inherit from it
|
|
93
|
+
|
|
94
|
+
If we just create and use an A instance directly, the trampoline initialization is
|
|
95
|
+
bypassed and we only initialize an A() instead (for performance reasons).
|
|
96
|
+
"""
|
|
97
|
+
|
|
98
|
+
class B(m.A):
|
|
99
|
+
def __init__(self):
|
|
100
|
+
super(B, self).__init__()
|
|
101
|
+
|
|
102
|
+
def f(self):
|
|
103
|
+
print("In python f()")
|
|
104
|
+
|
|
105
|
+
# C++ version
|
|
106
|
+
with capture:
|
|
107
|
+
a = m.A()
|
|
108
|
+
m.call_f(a)
|
|
109
|
+
del a
|
|
110
|
+
pytest.gc_collect()
|
|
111
|
+
assert capture == "A.f()"
|
|
112
|
+
|
|
113
|
+
# Python version
|
|
114
|
+
with capture:
|
|
115
|
+
b = B()
|
|
116
|
+
m.call_f(b)
|
|
117
|
+
del b
|
|
118
|
+
pytest.gc_collect()
|
|
119
|
+
assert (
|
|
120
|
+
capture
|
|
121
|
+
== """
|
|
122
|
+
PyA.PyA()
|
|
123
|
+
PyA.f()
|
|
124
|
+
In python f()
|
|
125
|
+
PyA.~PyA()
|
|
126
|
+
"""
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def test_alias_delay_initialization2(capture):
|
|
131
|
+
"""`A2`, unlike the above, is configured to always initialize the alias
|
|
132
|
+
|
|
133
|
+
While the extra initialization and extra class layer has small virtual dispatch
|
|
134
|
+
performance penalty, it also allows us to do more things with the trampoline
|
|
135
|
+
class such as defining local variables and performing construction/destruction.
|
|
136
|
+
"""
|
|
137
|
+
|
|
138
|
+
class B2(m.A2):
|
|
139
|
+
def __init__(self):
|
|
140
|
+
super(B2, self).__init__()
|
|
141
|
+
|
|
142
|
+
def f(self):
|
|
143
|
+
print("In python B2.f()")
|
|
144
|
+
|
|
145
|
+
# No python subclass version
|
|
146
|
+
with capture:
|
|
147
|
+
a2 = m.A2()
|
|
148
|
+
m.call_f(a2)
|
|
149
|
+
del a2
|
|
150
|
+
pytest.gc_collect()
|
|
151
|
+
a3 = m.A2(1)
|
|
152
|
+
m.call_f(a3)
|
|
153
|
+
del a3
|
|
154
|
+
pytest.gc_collect()
|
|
155
|
+
assert (
|
|
156
|
+
capture
|
|
157
|
+
== """
|
|
158
|
+
PyA2.PyA2()
|
|
159
|
+
PyA2.f()
|
|
160
|
+
A2.f()
|
|
161
|
+
PyA2.~PyA2()
|
|
162
|
+
PyA2.PyA2()
|
|
163
|
+
PyA2.f()
|
|
164
|
+
A2.f()
|
|
165
|
+
PyA2.~PyA2()
|
|
166
|
+
"""
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
# Python subclass version
|
|
170
|
+
with capture:
|
|
171
|
+
b2 = B2()
|
|
172
|
+
m.call_f(b2)
|
|
173
|
+
del b2
|
|
174
|
+
pytest.gc_collect()
|
|
175
|
+
assert (
|
|
176
|
+
capture
|
|
177
|
+
== """
|
|
178
|
+
PyA2.PyA2()
|
|
179
|
+
PyA2.f()
|
|
180
|
+
In python B2.f()
|
|
181
|
+
PyA2.~PyA2()
|
|
182
|
+
"""
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
# PyPy: Reference count > 1 causes call with noncopyable instance
|
|
187
|
+
# to fail in ncv1.print_nc()
|
|
188
|
+
@pytest.mark.xfail("env.PYPY")
|
|
189
|
+
@pytest.mark.skipif(
|
|
190
|
+
not hasattr(m, "NCVirt"), reason="NCVirt does not work on Intel/PGI/NVCC compilers"
|
|
191
|
+
)
|
|
192
|
+
def test_move_support():
|
|
193
|
+
class NCVirtExt(m.NCVirt):
|
|
194
|
+
def get_noncopyable(self, a, b):
|
|
195
|
+
# Constructs and returns a new instance:
|
|
196
|
+
nc = m.NonCopyable(a * a, b * b)
|
|
197
|
+
return nc
|
|
198
|
+
|
|
199
|
+
def get_movable(self, a, b):
|
|
200
|
+
# Return a referenced copy
|
|
201
|
+
self.movable = m.Movable(a, b)
|
|
202
|
+
return self.movable
|
|
203
|
+
|
|
204
|
+
class NCVirtExt2(m.NCVirt):
|
|
205
|
+
def get_noncopyable(self, a, b):
|
|
206
|
+
# Keep a reference: this is going to throw an exception
|
|
207
|
+
self.nc = m.NonCopyable(a, b)
|
|
208
|
+
return self.nc
|
|
209
|
+
|
|
210
|
+
def get_movable(self, a, b):
|
|
211
|
+
# Return a new instance without storing it
|
|
212
|
+
return m.Movable(a, b)
|
|
213
|
+
|
|
214
|
+
ncv1 = NCVirtExt()
|
|
215
|
+
assert ncv1.print_nc(2, 3) == "36"
|
|
216
|
+
assert ncv1.print_movable(4, 5) == "9"
|
|
217
|
+
ncv2 = NCVirtExt2()
|
|
218
|
+
assert ncv2.print_movable(7, 7) == "14"
|
|
219
|
+
# Don't check the exception message here because it differs under debug/non-debug mode
|
|
220
|
+
with pytest.raises(RuntimeError):
|
|
221
|
+
ncv2.print_nc(9, 9)
|
|
222
|
+
|
|
223
|
+
nc_stats = ConstructorStats.get(m.NonCopyable)
|
|
224
|
+
mv_stats = ConstructorStats.get(m.Movable)
|
|
225
|
+
assert nc_stats.alive() == 1
|
|
226
|
+
assert mv_stats.alive() == 1
|
|
227
|
+
del ncv1, ncv2
|
|
228
|
+
assert nc_stats.alive() == 0
|
|
229
|
+
assert mv_stats.alive() == 0
|
|
230
|
+
assert nc_stats.values() == ["4", "9", "9", "9"]
|
|
231
|
+
assert mv_stats.values() == ["4", "5", "7", "7"]
|
|
232
|
+
assert nc_stats.copy_constructions == 0
|
|
233
|
+
assert mv_stats.copy_constructions == 1
|
|
234
|
+
assert nc_stats.move_constructions >= 0
|
|
235
|
+
assert mv_stats.move_constructions >= 0
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
def test_dispatch_issue(msg):
|
|
239
|
+
"""#159: virtual function dispatch has problems with similar-named functions"""
|
|
240
|
+
|
|
241
|
+
class PyClass1(m.DispatchIssue):
|
|
242
|
+
def dispatch(self):
|
|
243
|
+
return "Yay.."
|
|
244
|
+
|
|
245
|
+
class PyClass2(m.DispatchIssue):
|
|
246
|
+
def dispatch(self):
|
|
247
|
+
with pytest.raises(RuntimeError) as excinfo:
|
|
248
|
+
super(PyClass2, self).dispatch()
|
|
249
|
+
assert (
|
|
250
|
+
msg(excinfo.value)
|
|
251
|
+
== 'Tried to call pure virtual function "Base::dispatch"'
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
return m.dispatch_issue_go(PyClass1())
|
|
255
|
+
|
|
256
|
+
b = PyClass2()
|
|
257
|
+
assert m.dispatch_issue_go(b) == "Yay.."
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
def test_override_ref():
|
|
261
|
+
"""#392/397: overriding reference-returning functions"""
|
|
262
|
+
o = m.OverrideTest("asdf")
|
|
263
|
+
|
|
264
|
+
# Not allowed (see associated .cpp comment)
|
|
265
|
+
# i = o.str_ref()
|
|
266
|
+
# assert o.str_ref() == "asdf"
|
|
267
|
+
assert o.str_value() == "asdf"
|
|
268
|
+
|
|
269
|
+
assert o.A_value().value == "hi"
|
|
270
|
+
a = o.A_ref()
|
|
271
|
+
assert a.value == "hi"
|
|
272
|
+
a.value = "bye"
|
|
273
|
+
assert a.value == "bye"
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
def test_inherited_virtuals():
|
|
277
|
+
class AR(m.A_Repeat):
|
|
278
|
+
def unlucky_number(self):
|
|
279
|
+
return 99
|
|
280
|
+
|
|
281
|
+
class AT(m.A_Tpl):
|
|
282
|
+
def unlucky_number(self):
|
|
283
|
+
return 999
|
|
284
|
+
|
|
285
|
+
obj = AR()
|
|
286
|
+
assert obj.say_something(3) == "hihihi"
|
|
287
|
+
assert obj.unlucky_number() == 99
|
|
288
|
+
assert obj.say_everything() == "hi 99"
|
|
289
|
+
|
|
290
|
+
obj = AT()
|
|
291
|
+
assert obj.say_something(3) == "hihihi"
|
|
292
|
+
assert obj.unlucky_number() == 999
|
|
293
|
+
assert obj.say_everything() == "hi 999"
|
|
294
|
+
|
|
295
|
+
for obj in [m.B_Repeat(), m.B_Tpl()]:
|
|
296
|
+
assert obj.say_something(3) == "B says hi 3 times"
|
|
297
|
+
assert obj.unlucky_number() == 13
|
|
298
|
+
assert obj.lucky_number() == 7.0
|
|
299
|
+
assert obj.say_everything() == "B says hi 1 times 13"
|
|
300
|
+
|
|
301
|
+
for obj in [m.C_Repeat(), m.C_Tpl()]:
|
|
302
|
+
assert obj.say_something(3) == "B says hi 3 times"
|
|
303
|
+
assert obj.unlucky_number() == 4444
|
|
304
|
+
assert obj.lucky_number() == 888.0
|
|
305
|
+
assert obj.say_everything() == "B says hi 1 times 4444"
|
|
306
|
+
|
|
307
|
+
class CR(m.C_Repeat):
|
|
308
|
+
def lucky_number(self):
|
|
309
|
+
return m.C_Repeat.lucky_number(self) + 1.25
|
|
310
|
+
|
|
311
|
+
obj = CR()
|
|
312
|
+
assert obj.say_something(3) == "B says hi 3 times"
|
|
313
|
+
assert obj.unlucky_number() == 4444
|
|
314
|
+
assert obj.lucky_number() == 889.25
|
|
315
|
+
assert obj.say_everything() == "B says hi 1 times 4444"
|
|
316
|
+
|
|
317
|
+
class CT(m.C_Tpl):
|
|
318
|
+
pass
|
|
319
|
+
|
|
320
|
+
obj = CT()
|
|
321
|
+
assert obj.say_something(3) == "B says hi 3 times"
|
|
322
|
+
assert obj.unlucky_number() == 4444
|
|
323
|
+
assert obj.lucky_number() == 888.0
|
|
324
|
+
assert obj.say_everything() == "B says hi 1 times 4444"
|
|
325
|
+
|
|
326
|
+
class CCR(CR):
|
|
327
|
+
def lucky_number(self):
|
|
328
|
+
return CR.lucky_number(self) * 10
|
|
329
|
+
|
|
330
|
+
obj = CCR()
|
|
331
|
+
assert obj.say_something(3) == "B says hi 3 times"
|
|
332
|
+
assert obj.unlucky_number() == 4444
|
|
333
|
+
assert obj.lucky_number() == 8892.5
|
|
334
|
+
assert obj.say_everything() == "B says hi 1 times 4444"
|
|
335
|
+
|
|
336
|
+
class CCT(CT):
|
|
337
|
+
def lucky_number(self):
|
|
338
|
+
return CT.lucky_number(self) * 1000
|
|
339
|
+
|
|
340
|
+
obj = CCT()
|
|
341
|
+
assert obj.say_something(3) == "B says hi 3 times"
|
|
342
|
+
assert obj.unlucky_number() == 4444
|
|
343
|
+
assert obj.lucky_number() == 888000.0
|
|
344
|
+
assert obj.say_everything() == "B says hi 1 times 4444"
|
|
345
|
+
|
|
346
|
+
class DR(m.D_Repeat):
|
|
347
|
+
def unlucky_number(self):
|
|
348
|
+
return 123
|
|
349
|
+
|
|
350
|
+
def lucky_number(self):
|
|
351
|
+
return 42.0
|
|
352
|
+
|
|
353
|
+
for obj in [m.D_Repeat(), m.D_Tpl()]:
|
|
354
|
+
assert obj.say_something(3) == "B says hi 3 times"
|
|
355
|
+
assert obj.unlucky_number() == 4444
|
|
356
|
+
assert obj.lucky_number() == 888.0
|
|
357
|
+
assert obj.say_everything() == "B says hi 1 times 4444"
|
|
358
|
+
|
|
359
|
+
obj = DR()
|
|
360
|
+
assert obj.say_something(3) == "B says hi 3 times"
|
|
361
|
+
assert obj.unlucky_number() == 123
|
|
362
|
+
assert obj.lucky_number() == 42.0
|
|
363
|
+
assert obj.say_everything() == "B says hi 1 times 123"
|
|
364
|
+
|
|
365
|
+
class DT(m.D_Tpl):
|
|
366
|
+
def say_something(self, times):
|
|
367
|
+
return "DT says:" + (" quack" * times)
|
|
368
|
+
|
|
369
|
+
def unlucky_number(self):
|
|
370
|
+
return 1234
|
|
371
|
+
|
|
372
|
+
def lucky_number(self):
|
|
373
|
+
return -4.25
|
|
374
|
+
|
|
375
|
+
obj = DT()
|
|
376
|
+
assert obj.say_something(3) == "DT says: quack quack quack"
|
|
377
|
+
assert obj.unlucky_number() == 1234
|
|
378
|
+
assert obj.lucky_number() == -4.25
|
|
379
|
+
assert obj.say_everything() == "DT says: quack 1234"
|
|
380
|
+
|
|
381
|
+
class DT2(DT):
|
|
382
|
+
def say_something(self, times):
|
|
383
|
+
return "DT2: " + ("QUACK" * times)
|
|
384
|
+
|
|
385
|
+
def unlucky_number(self):
|
|
386
|
+
return -3
|
|
387
|
+
|
|
388
|
+
class BT(m.B_Tpl):
|
|
389
|
+
def say_something(self, times):
|
|
390
|
+
return "BT" * times
|
|
391
|
+
|
|
392
|
+
def unlucky_number(self):
|
|
393
|
+
return -7
|
|
394
|
+
|
|
395
|
+
def lucky_number(self):
|
|
396
|
+
return -1.375
|
|
397
|
+
|
|
398
|
+
obj = BT()
|
|
399
|
+
assert obj.say_something(3) == "BTBTBT"
|
|
400
|
+
assert obj.unlucky_number() == -7
|
|
401
|
+
assert obj.lucky_number() == -1.375
|
|
402
|
+
assert obj.say_everything() == "BT -7"
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
def test_issue_1454():
|
|
406
|
+
# Fix issue #1454 (crash when acquiring/releasing GIL on another thread in Python 2.7)
|
|
407
|
+
m.test_gil()
|
|
408
|
+
m.test_gil_from_thread()
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Valgrind suppression file for NumPy & SciPy errors and leaks in pybind11 tests
|
|
2
|
+
#
|
|
3
|
+
# On updating a dependency, to get a list of "default" leaks in e.g. NumPy, run
|
|
4
|
+
# `PYTHONMALLOC=malloc valgrind --leak-check=full --show-leak-kinds=definite,indirect python3.9-dbg -c "import numpy"`
|
|
5
|
+
# To use these suppression files, add e.g. `--suppressions=valgrind-numpy-scipy.supp`
|
|
6
|
+
|
|
7
|
+
{
|
|
8
|
+
Leaks when importing NumPy
|
|
9
|
+
Memcheck:Leak
|
|
10
|
+
fun:malloc
|
|
11
|
+
fun:_PyMem_RawMalloc
|
|
12
|
+
fun:PyObject_Malloc
|
|
13
|
+
fun:_PyObject_GC_Alloc
|
|
14
|
+
fun:_PyObject_GC_Malloc
|
|
15
|
+
fun:_PyObject_GC_NewVar
|
|
16
|
+
fun:tuple_alloc
|
|
17
|
+
fun:PyTuple_Pack
|
|
18
|
+
...
|
|
19
|
+
fun:__pyx_pymod_exec_*
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
{
|
|
23
|
+
Leaks when importing NumPy (bis)
|
|
24
|
+
Memcheck:Leak
|
|
25
|
+
fun:malloc
|
|
26
|
+
fun:_PyMem_RawMalloc
|
|
27
|
+
fun:PyObject_Malloc
|
|
28
|
+
fun:_PyObject_New
|
|
29
|
+
fun:PyCode_NewWithPosOnlyArgs
|
|
30
|
+
fun:PyCode_New
|
|
31
|
+
...
|
|
32
|
+
fun:__pyx_pymod_exec_*
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
{
|
|
36
|
+
Leaks when importing NumPy (ter)
|
|
37
|
+
Memcheck:Leak
|
|
38
|
+
fun:malloc
|
|
39
|
+
fun:_PyMem_RawMalloc
|
|
40
|
+
fun:PyObject_Malloc
|
|
41
|
+
fun:_PyObject_GC_Alloc
|
|
42
|
+
fun:_PyObject_GC_Malloc
|
|
43
|
+
fun:_PyObject_GC_NewVar
|
|
44
|
+
fun:tuple_alloc
|
|
45
|
+
fun:_PyTuple_FromArray
|
|
46
|
+
fun:_PyObject_MakeTpCall
|
|
47
|
+
fun:_PyObject_VectorcallTstate
|
|
48
|
+
fun:PyObject_Vectorcall
|
|
49
|
+
fun:call_function
|
|
50
|
+
fun:_PyEval_EvalFrameDefault
|
|
51
|
+
fun:_PyEval_EvalFrame
|
|
52
|
+
fun:function_code_fastcall
|
|
53
|
+
fun:_PyFunction_Vectorcall
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
{
|
|
57
|
+
Leaks when importing NumPy (quater)
|
|
58
|
+
Memcheck:Leak
|
|
59
|
+
fun:malloc
|
|
60
|
+
fun:_PyMem_RawMalloc
|
|
61
|
+
fun:PyObject_Malloc
|
|
62
|
+
fun:_PyObject_GC_Alloc
|
|
63
|
+
fun:_PyObject_GC_Malloc
|
|
64
|
+
fun:_PyObject_GC_NewVar
|
|
65
|
+
fun:tuple_alloc
|
|
66
|
+
fun:_PyTuple_FromArray
|
|
67
|
+
fun:_PyObject_MakeTpCall
|
|
68
|
+
fun:_PyObject_VectorcallTstate
|
|
69
|
+
fun:_PyObject_CallFunctionVa
|
|
70
|
+
fun:PyObject_CallFunction
|
|
71
|
+
fun:PyImport_Import
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
{
|
|
75
|
+
Leaks when importing NumPy (quinquies)
|
|
76
|
+
Memcheck:Leak
|
|
77
|
+
fun:malloc
|
|
78
|
+
fun:_PyMem_RawMalloc
|
|
79
|
+
fun:PyObject_Malloc
|
|
80
|
+
fun:_PyObject_GC_Alloc
|
|
81
|
+
fun:_PyObject_GC_Malloc
|
|
82
|
+
fun:_PyObject_GC_NewVar
|
|
83
|
+
fun:tuple_alloc
|
|
84
|
+
fun:PyTuple_New
|
|
85
|
+
fun:r_object
|
|
86
|
+
fun:r_object
|
|
87
|
+
fun:r_object
|
|
88
|
+
fun:r_object
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
{
|
|
92
|
+
Leaks when importing NumPy (sexies)
|
|
93
|
+
Memcheck:Leak
|
|
94
|
+
fun:malloc
|
|
95
|
+
fun:_PyMem_RawMalloc
|
|
96
|
+
fun:PyObject_Malloc
|
|
97
|
+
fun:_PyObject_GC_Alloc
|
|
98
|
+
fun:_PyObject_GC_Malloc
|
|
99
|
+
fun:_PyObject_GC_NewVar
|
|
100
|
+
fun:tuple_alloc
|
|
101
|
+
fun:PyTuple_New
|
|
102
|
+
fun:dictiter_iternextitem
|
|
103
|
+
fun:list_extend
|
|
104
|
+
fun:_PyList_Extend
|
|
105
|
+
fun:PySequence_List
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
{
|
|
109
|
+
Leak when importing scipy.fft
|
|
110
|
+
Memcheck:Leak
|
|
111
|
+
fun:_Znwm
|
|
112
|
+
fun:PyInit_pypocketfft
|
|
113
|
+
fun:_PyImport_LoadDynamicModuleWithSpec
|
|
114
|
+
fun:_imp_create_dynamic_impl*
|
|
115
|
+
fun:_imp_create_dynamic
|
|
116
|
+
fun:cfunction_vectorcall_FASTCALL
|
|
117
|
+
fun:PyVectorcall_Call
|
|
118
|
+
fun:_PyObject_Call
|
|
119
|
+
fun:PyObject_Call
|
|
120
|
+
fun:do_call_core
|
|
121
|
+
fun:_PyEval_EvalFrameDefault
|
|
122
|
+
fun:_PyEval_EvalFrame
|
|
123
|
+
fun:_PyEval_EvalCode
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
{
|
|
127
|
+
NumPy leaks when spawning a subprocess
|
|
128
|
+
Memcheck:Leak
|
|
129
|
+
fun:malloc
|
|
130
|
+
...
|
|
131
|
+
fun:_buffer_get_info
|
|
132
|
+
fun:array_getbuffer
|
|
133
|
+
fun:PyObject_GetBuffer
|
|
134
|
+
fun:__Pyx__GetBufferAndValidate*
|
|
135
|
+
fun:__pyx_f_5numpy_6random_13bit_generator_12SeedSequence_mix_entropy
|
|
136
|
+
fun:__pyx_pw_5numpy_6random_13bit_generator_12SeedSequence_1__init__
|
|
137
|
+
fun:type_call
|
|
138
|
+
fun:__Pyx__PyObject_CallOneArg
|
|
139
|
+
fun:__pyx_pw_5numpy_6random_13bit_generator_12BitGenerator_1__init__
|
|
140
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Valgrind suppression file for CPython errors and leaks in pybind11 tests
|
|
2
|
+
|
|
3
|
+
# Taken verbatim from https://github.com/python/cpython/blob/3.9/Misc/valgrind-python.supp#L266-L272
|
|
4
|
+
{
|
|
5
|
+
Uninitialised byte(s) false alarm, see bpo-35561
|
|
6
|
+
Memcheck:Param
|
|
7
|
+
epoll_ctl(event)
|
|
8
|
+
fun:epoll_ctl
|
|
9
|
+
fun:pyepoll_internal_ctl
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
{
|
|
13
|
+
Python leaks when spawning a subprocess
|
|
14
|
+
Memcheck:Leak
|
|
15
|
+
fun:malloc
|
|
16
|
+
fun:_PyMem_RawMalloc
|
|
17
|
+
fun:PyMem_RawMalloc
|
|
18
|
+
fun:PyThread_allocate_lock
|
|
19
|
+
fun:_PyEval_InitState
|
|
20
|
+
fun:PyInterpreterState_New
|
|
21
|
+
...
|
|
22
|
+
fun:pyinit_core*
|
|
23
|
+
fun:Py_InitializeFromConfig
|
|
24
|
+
fun:pymain_init
|
|
25
|
+
fun:pymain_main
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
{
|
|
29
|
+
Python leaks when spawning a subprocess
|
|
30
|
+
Memcheck:Leak
|
|
31
|
+
fun:malloc
|
|
32
|
+
fun:_PyMem_RawMalloc
|
|
33
|
+
fun:_PyMem_DebugRawAlloc
|
|
34
|
+
fun:_PyMem_DebugRawMalloc
|
|
35
|
+
fun:PyMem_RawMalloc
|
|
36
|
+
fun:PyThread_allocate_lock
|
|
37
|
+
fun:_PyRuntimeState_Init_impl
|
|
38
|
+
fun:_PyRuntimeState_Init
|
|
39
|
+
fun:_PyRuntime_Initialize
|
|
40
|
+
fun:pymain_init
|
|
41
|
+
fun:pymain_main
|
|
42
|
+
fun:Py_BytesMain
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
{
|
|
46
|
+
Python leaks when spawning a subprocess
|
|
47
|
+
Memcheck:Leak
|
|
48
|
+
fun:malloc
|
|
49
|
+
fun:_PyMem_RawMalloc
|
|
50
|
+
fun:PyMem_RawMalloc
|
|
51
|
+
fun:PyThread_allocate_lock
|
|
52
|
+
fun:_PyImport_AcquireLock
|
|
53
|
+
fun:_imp_acquire_lock_impl*
|
|
54
|
+
fun:_imp_acquire_lock
|
|
55
|
+
fun:cfunction_vectorcall_NOARGS
|
|
56
|
+
fun:_PyObject_VectorcallTstate
|
|
57
|
+
fun:PyObject_Vectorcall
|
|
58
|
+
fun:call_function
|
|
59
|
+
fun:_PyEval_EvalFrameDefault
|
|
60
|
+
fun:_PyEval_EvalFrame
|
|
61
|
+
fun:function_code_fastcall
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
{
|
|
65
|
+
Python leaks when spawning a subprocess
|
|
66
|
+
Memcheck:Leak
|
|
67
|
+
fun:malloc
|
|
68
|
+
fun:_PyMem_RawMalloc
|
|
69
|
+
fun:PyMem_RawMalloc
|
|
70
|
+
fun:PyThread_allocate_lock
|
|
71
|
+
fun:newlockobject
|
|
72
|
+
...
|
|
73
|
+
fun:cfunction_vectorcall_NOARGS
|
|
74
|
+
fun:_PyObject_VectorcallTstate
|
|
75
|
+
fun:PyObject_Vectorcall
|
|
76
|
+
fun:call_function
|
|
77
|
+
fun:_PyEval_EvalFrameDefault
|
|
78
|
+
fun:_PyEval_EvalFrame
|
|
79
|
+
fun:function_code_fastcall
|
|
80
|
+
fun:_PyFunction_Vectorcall
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
{
|
|
84
|
+
Python leaks when spawning a subprocess
|
|
85
|
+
Memcheck:Leak
|
|
86
|
+
fun:malloc
|
|
87
|
+
fun:_PyMem_RawMalloc
|
|
88
|
+
fun:PyMem_RawMalloc
|
|
89
|
+
fun:PyThread_allocate_lock
|
|
90
|
+
fun:rlock_new
|
|
91
|
+
fun:type_call
|
|
92
|
+
fun:_PyObject_Call
|
|
93
|
+
fun:PyObject_Call
|
|
94
|
+
fun:do_call_core
|
|
95
|
+
fun:_PyEval_EvalFrameDefault
|
|
96
|
+
fun:_PyEval_EvalFrame
|
|
97
|
+
fun:_PyEval_EvalCode
|
|
98
|
+
fun:_PyFunction_Vectorcall
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
# Not really CPython-specific, see link
|
|
102
|
+
{
|
|
103
|
+
dlopen leak (https://stackoverflow.com/questions/1542457/memory-leak-reported-by-valgrind-in-dlopen)
|
|
104
|
+
Memcheck:Leak
|
|
105
|
+
fun:malloc
|
|
106
|
+
...
|
|
107
|
+
fun:dl_open_worker
|
|
108
|
+
fun:_dl_catch_exception
|
|
109
|
+
fun:_dl_open
|
|
110
|
+
fun:dlopen_doit
|
|
111
|
+
fun:_dl_catch_exception
|
|
112
|
+
fun:_dl_catch_error
|
|
113
|
+
fun:_dlerror_run
|
|
114
|
+
fun:dlopen@@GLIBC_2.2.5
|
|
115
|
+
fun:_PyImport_FindSharedFuncptr
|
|
116
|
+
fun:_PyImport_LoadDynamicModuleWithSpec
|
|
117
|
+
}
|