xcoll 0.5.12__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.
- xcoll/__init__.py +5 -18
- xcoll/beam_elements/__init__.py +1 -0
- xcoll/beam_elements/absorber.py +12 -2
- xcoll/beam_elements/base.py +162 -62
- xcoll/beam_elements/blowup.py +1 -0
- xcoll/beam_elements/elements_src/black_absorber.h +57 -58
- xcoll/beam_elements/elements_src/black_crystal.h +49 -50
- xcoll/beam_elements/elements_src/everest_block.h +21 -11
- xcoll/beam_elements/elements_src/everest_collimator.h +100 -91
- xcoll/beam_elements/elements_src/everest_crystal.h +145 -140
- xcoll/beam_elements/elements_src/transparent_collimator.h +126 -0
- xcoll/beam_elements/elements_src/transparent_crystal.h +118 -0
- xcoll/beam_elements/everest.py +16 -5
- xcoll/beam_elements/monitor.py +1 -0
- xcoll/beam_elements/transparent.py +83 -0
- xcoll/colldb.py +15 -6
- xcoll/general.py +1 -1
- xcoll/headers/particle_states.py +51 -0
- xcoll/initial_distribution.py +121 -91
- xcoll/interaction_record/interaction_record.py +2 -1
- xcoll/interaction_record/interaction_types.py +2 -2
- xcoll/line_tools.py +163 -73
- xcoll/lossmap.py +519 -127
- xcoll/plot.py +109 -0
- xcoll/rf_sweep.py +6 -0
- xcoll/scattering_routines/engine.py +414 -217
- xcoll/scattering_routines/environment.py +297 -0
- xcoll/scattering_routines/everest/amorphous.h +95 -71
- xcoll/scattering_routines/everest/{channeling.h → channelling.h} +121 -112
- xcoll/scattering_routines/everest/constants.h +1 -1
- xcoll/scattering_routines/everest/crystal_parameters.h +9 -9
- xcoll/scattering_routines/everest/everest.h +8 -3
- xcoll/scattering_routines/everest/everest.py +2 -1
- xcoll/scattering_routines/everest/ionisation_loss.h +141 -0
- xcoll/scattering_routines/everest/jaw.h +19 -24
- xcoll/scattering_routines/everest/materials.py +2 -0
- xcoll/scattering_routines/everest/multiple_coulomb_scattering.h +2 -2
- xcoll/scattering_routines/everest/nuclear_interaction.h +35 -19
- xcoll/scattering_routines/everest/properties.h +3 -72
- xcoll/xaux.py +65 -109
- {xcoll-0.5.12.dist-info → xcoll-0.6.0.dist-info}/METADATA +5 -5
- xcoll-0.6.0.dist-info/RECORD +135 -0
- xcoll/_manager.py +0 -22
- xcoll/headers/particle_states.h +0 -25
- xcoll/install.py +0 -35
- xcoll/scattering_routines/geant4/collimasim/.git +0 -1
- xcoll/scattering_routines/geant4/collimasim/.gitignore +0 -12
- xcoll/scattering_routines/geant4/collimasim/.gitmodules +0 -3
- xcoll/scattering_routines/geant4/collimasim/CMakeLists.txt +0 -26
- xcoll/scattering_routines/geant4/collimasim/README.md +0 -21
- xcoll/scattering_routines/geant4/collimasim/docs/Makefile +0 -20
- xcoll/scattering_routines/geant4/collimasim/docs/make.bat +0 -35
- xcoll/scattering_routines/geant4/collimasim/docs/source/collimasim.rst +0 -10
- xcoll/scattering_routines/geant4/collimasim/docs/source/conf.py +0 -59
- xcoll/scattering_routines/geant4/collimasim/docs/source/index.rst +0 -26
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.appveyor.yml +0 -37
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-format +0 -19
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-tidy +0 -65
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.cmake-format.yaml +0 -73
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.git +0 -1
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CODEOWNERS +0 -9
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CONTRIBUTING.md +0 -386
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/bug-report.yml +0 -45
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/config.yml +0 -8
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/dependabot.yml +0 -16
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler.yml +0 -8
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler_merged.yml +0 -3
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/pull_request_template.md +0 -19
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/ci.yml +0 -969
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/configure.yml +0 -84
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/format.yml +0 -48
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/labeler.yml +0 -16
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/pip.yml +0 -103
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.gitignore +0 -45
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.pre-commit-config.yaml +0 -151
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.readthedocs.yml +0 -3
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/CMakeLists.txt +0 -297
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/LICENSE +0 -29
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/MANIFEST.in +0 -6
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/README.rst +0 -180
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Doxyfile +0 -23
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Makefile +0 -192
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/_static/theme_overrides.css +0 -11
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/chrono.rst +0 -81
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/custom.rst +0 -93
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/eigen.rst +0 -310
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/functional.rst +0 -109
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/index.rst +0 -43
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/overview.rst +0 -171
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/stl.rst +0 -251
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/strings.rst +0 -305
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/classes.rst +0 -1297
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/embedding.rst +0 -262
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/exceptions.rst +0 -396
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/functions.rst +0 -568
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/misc.rst +0 -337
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/index.rst +0 -13
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/numpy.rst +0 -463
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/object.rst +0 -286
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/utilities.rst +0 -155
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/smart_ptrs.rst +0 -174
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/basics.rst +0 -308
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.py +0 -91
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.rst +0 -95
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/changelog.rst +0 -2050
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/classes.rst +0 -542
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/cmake/index.rst +0 -8
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/compiling.rst +0 -648
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/conf.py +0 -381
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/faq.rst +0 -343
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/index.rst +0 -48
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/installing.rst +0 -105
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/limitations.rst +0 -72
- 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 +0 -427
- 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 +0 -427
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/reference.rst +0 -130
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/release.rst +0 -96
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/requirements.txt +0 -8
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/upgrade.rst +0 -548
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/attr.h +0 -605
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/buffer_info.h +0 -144
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/cast.h +0 -1432
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/chrono.h +0 -213
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/common.h +0 -2
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/complex.h +0 -65
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/class.h +0 -709
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/common.h +0 -1021
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/descr.h +0 -104
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/init.h +0 -346
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/internals.h +0 -467
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/type_caster_base.h +0 -978
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/typeid.h +0 -55
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eigen.h +0 -606
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/embed.h +0 -284
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eval.h +0 -163
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/functional.h +0 -121
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/gil.h +0 -193
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/iostream.h +0 -275
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/numpy.h +0 -1741
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/operators.h +0 -163
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/options.h +0 -65
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pybind11.h +0 -2497
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pytypes.h +0 -1879
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl/filesystem.h +0 -103
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl.h +0 -375
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl_bind.h +0 -747
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/noxfile.py +0 -88
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__init__.py +0 -11
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__main__.py +0 -52
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.py +0 -12
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.pyi +0 -6
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/commands.py +0 -21
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/py.typed +0 -0
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.py +0 -482
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.pyi +0 -63
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pyproject.toml +0 -41
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.cfg +0 -56
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.py +0 -155
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/CMakeLists.txt +0 -503
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/conftest.py +0 -208
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/constructor_stats.h +0 -275
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/cross_module_gil_utils.cpp +0 -73
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/env.py +0 -33
- 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 +0 -279
- 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 +0 -143
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/local_bindings.h +0 -85
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/object.h +0 -179
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_cross_module_tests.cpp +0 -151
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.cpp +0 -91
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.h +0 -85
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pytest.ini +0 -19
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/requirements.txt +0 -12
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.cpp +0 -26
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.py +0 -25
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.cpp +0 -216
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.py +0 -163
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.cpp +0 -286
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.py +0 -536
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.cpp +0 -107
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.py +0 -248
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.cpp +0 -227
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.py +0 -202
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.cpp +0 -84
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.py +0 -210
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.cpp +0 -550
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.py +0 -473
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/CMakeLists.txt +0 -84
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/embed.cpp +0 -21
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_embed/CMakeLists.txt +0 -28
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_function/CMakeLists.txt +0 -39
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_target/CMakeLists.txt +0 -46
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/main.cpp +0 -6
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt +0 -41
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt +0 -35
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_target/CMakeLists.txt +0 -41
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/test.py +0 -10
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.cpp +0 -165
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.py +0 -53
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.cpp +0 -238
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.py +0 -126
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.cpp +0 -141
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.py +0 -117
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.cpp +0 -41
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.py +0 -50
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.cpp +0 -69
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.py +0 -42
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.cpp +0 -348
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.py +0 -771
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/CMakeLists.txt +0 -47
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/catch.cpp +0 -22
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/external_module.cpp +0 -23
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.cpp +0 -326
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.py +0 -15
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.cpp +0 -148
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.py +0 -272
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.cpp +0 -119
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.py +0 -51
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval_call.py +0 -5
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.cpp +0 -285
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.h +0 -12
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.py +0 -265
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.cpp +0 -397
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.py +0 -520
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.cpp +0 -49
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.py +0 -94
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.cpp +0 -125
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.py +0 -331
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.cpp +0 -153
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.py +0 -284
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.cpp +0 -107
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.py +0 -257
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.cpp +0 -412
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.py +0 -517
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.cpp +0 -102
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.py +0 -92
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.cpp +0 -233
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.py +0 -360
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.cpp +0 -472
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.py +0 -593
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.cpp +0 -524
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.py +0 -441
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.cpp +0 -103
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.py +0 -267
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.cpp +0 -73
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.py +0 -59
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.cpp +0 -235
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.py +0 -146
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.cpp +0 -189
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.py +0 -82
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.cpp +0 -560
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.py +0 -651
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.cpp +0 -500
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.py +0 -253
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.cpp +0 -452
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.py +0 -318
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.cpp +0 -342
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.py +0 -291
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.cpp +0 -131
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.py +0 -318
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.cpp +0 -144
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.py +0 -29
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.cpp +0 -66
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.py +0 -44
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.cpp +0 -22
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.py +0 -9
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.cpp +0 -510
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.py +0 -408
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-numpy-scipy.supp +0 -140
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-python.supp +0 -117
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindCatch.cmake +0 -70
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindEigen3.cmake +0 -86
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindPythonLibsNew.cmake +0 -257
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/check-style.sh +0 -44
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/cmake_uninstall.cmake.in +0 -23
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/libsize.py +0 -39
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/make_changelog.py +0 -64
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Common.cmake +0 -402
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Config.cmake.in +0 -233
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11NewTools.cmake +0 -276
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Tools.cmake +0 -214
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pyproject.toml +0 -3
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_global.py.in +0 -65
- xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_main.py.in +0 -41
- xcoll/scattering_routines/geant4/collimasim/pyproject.toml +0 -8
- xcoll/scattering_routines/geant4/collimasim/setup.py +0 -144
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.cpp +0 -403
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.hh +0 -100
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.cpp +0 -763
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.hh +0 -118
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/__init__.py +0 -8
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/bindings.cpp +0 -63
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/pyCollimatorPass.py +0 -142
- xcoll/scattering_routines/geant4/collimasim/src/collimasim/xtrack_collimator.py +0 -556
- xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/PKG-INFO +0 -6
- xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/SOURCES.txt +0 -24
- xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/dependency_links.txt +0 -1
- xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/not-zip-safe +0 -1
- xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/top_level.txt +0 -1
- xcoll/scattering_routines/geant4/collimasim/tests/README.md +0 -25
- xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_forions.dat +0 -25
- xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_new_example.dat +0 -18
- xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_old_example.dat +0 -68
- xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_testing.dat +0 -15
- xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_yaml_example.yaml +0 -110
- xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps.dat +0 -7
- xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps_pyat_test.dat +0 -3
- xcoll/scattering_routines/geant4/collimasim/tests/resources/collonly_twiss_file_example.tfs +0 -54
- xcoll/scattering_routines/geant4/collimasim/tests/resources/settings.gmad +0 -3
- xcoll/scattering_routines/geant4/collimasim/tests/resources/settings_black_absorber.gmad +0 -3
- xcoll/scattering_routines/geant4/collimasim/tests/resources/settings_ions.gmad +0 -5
- xcoll/scattering_routines/geant4/collimasim/tests/resources/twiss_file_testing.tfs +0 -51
- xcoll/scattering_routines/geant4/collimasim/tests/test_pyat.py +0 -65
- xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_passmethod.py +0 -59
- xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_tracking.py +0 -102
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack.py +0 -75
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_angle.py +0 -74
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_colldb_load.py +0 -84
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_interaction.py +0 -159
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_interaction_ion.py +0 -99
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_ions.py +0 -78
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_lost_energy.py +0 -88
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tilt.py +0 -80
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tracking.py +0 -97
- xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tracking_ions.py +0 -96
- xcoll-0.5.12.dist-info/RECORD +0 -415
- {xcoll-0.5.12.dist-info → xcoll-0.6.0.dist-info}/LICENSE +0 -0
- {xcoll-0.5.12.dist-info → xcoll-0.6.0.dist-info}/NOTICE +0 -0
- {xcoll-0.5.12.dist-info → xcoll-0.6.0.dist-info}/WHEEL +0 -0
xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.cpp
DELETED
|
@@ -1,412 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
tests/test_methods_and_attributes.cpp -- constructors, deconstructors, attribute access,
|
|
3
|
-
__str__, argument and return value conventions
|
|
4
|
-
|
|
5
|
-
Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>
|
|
6
|
-
|
|
7
|
-
All rights reserved. Use of this source code is governed by a
|
|
8
|
-
BSD-style license that can be found in the LICENSE file.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
#include "pybind11_tests.h"
|
|
12
|
-
#include "constructor_stats.h"
|
|
13
|
-
|
|
14
|
-
#if !defined(PYBIND11_OVERLOAD_CAST)
|
|
15
|
-
template <typename... Args>
|
|
16
|
-
using overload_cast_ = pybind11::detail::overload_cast_impl<Args...>;
|
|
17
|
-
#endif
|
|
18
|
-
|
|
19
|
-
class ExampleMandA {
|
|
20
|
-
public:
|
|
21
|
-
ExampleMandA() { print_default_created(this); }
|
|
22
|
-
explicit ExampleMandA(int value) : value(value) { print_created(this, value); }
|
|
23
|
-
ExampleMandA(const ExampleMandA &e) : value(e.value) { print_copy_created(this); }
|
|
24
|
-
explicit ExampleMandA(std::string &&) {}
|
|
25
|
-
ExampleMandA(ExampleMandA &&e) noexcept : value(e.value) { print_move_created(this); }
|
|
26
|
-
~ExampleMandA() { print_destroyed(this); }
|
|
27
|
-
|
|
28
|
-
std::string toString() const { return "ExampleMandA[value=" + std::to_string(value) + "]"; }
|
|
29
|
-
|
|
30
|
-
void operator=(const ExampleMandA &e) { print_copy_assigned(this); value = e.value; }
|
|
31
|
-
void operator=(ExampleMandA &&e) noexcept {
|
|
32
|
-
print_move_assigned(this);
|
|
33
|
-
value = e.value;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// NOLINTNEXTLINE(performance-unnecessary-value-param)
|
|
37
|
-
void add1(ExampleMandA other) { value += other.value; } // passing by value
|
|
38
|
-
void add2(ExampleMandA &other) { value += other.value; } // passing by reference
|
|
39
|
-
void add3(const ExampleMandA &other) { value += other.value; } // passing by const reference
|
|
40
|
-
void add4(ExampleMandA *other) { value += other->value; } // passing by pointer
|
|
41
|
-
void add5(const ExampleMandA *other) { value += other->value; } // passing by const pointer
|
|
42
|
-
|
|
43
|
-
void add6(int other) { value += other; } // passing by value
|
|
44
|
-
void add7(int &other) { value += other; } // passing by reference
|
|
45
|
-
void add8(const int &other) { value += other; } // passing by const reference
|
|
46
|
-
// NOLINTNEXTLINE(readability-non-const-parameter) Deliberately non-const for testing
|
|
47
|
-
void add9(int *other) { value += *other; } // passing by pointer
|
|
48
|
-
void add10(const int *other) { value += *other; } // passing by const pointer
|
|
49
|
-
|
|
50
|
-
void consume_str(std::string&&) {}
|
|
51
|
-
|
|
52
|
-
ExampleMandA self1() { return *this; } // return by value
|
|
53
|
-
ExampleMandA &self2() { return *this; } // return by reference
|
|
54
|
-
const ExampleMandA &self3() const { return *this; } // return by const reference
|
|
55
|
-
ExampleMandA *self4() { return this; } // return by pointer
|
|
56
|
-
const ExampleMandA *self5() const { return this; } // return by const pointer
|
|
57
|
-
|
|
58
|
-
int internal1() const { return value; } // return by value
|
|
59
|
-
int &internal2() { return value; } // return by reference
|
|
60
|
-
const int &internal3() const { return value; } // return by const reference
|
|
61
|
-
int *internal4() { return &value; } // return by pointer
|
|
62
|
-
const int *internal5() { return &value; } // return by const pointer
|
|
63
|
-
|
|
64
|
-
py::str overloaded() { return "()"; }
|
|
65
|
-
py::str overloaded(int) { return "(int)"; }
|
|
66
|
-
py::str overloaded(int, float) { return "(int, float)"; }
|
|
67
|
-
py::str overloaded(float, int) { return "(float, int)"; }
|
|
68
|
-
py::str overloaded(int, int) { return "(int, int)"; }
|
|
69
|
-
py::str overloaded(float, float) { return "(float, float)"; }
|
|
70
|
-
py::str overloaded(int) const { return "(int) const"; }
|
|
71
|
-
py::str overloaded(int, float) const { return "(int, float) const"; }
|
|
72
|
-
py::str overloaded(float, int) const { return "(float, int) const"; }
|
|
73
|
-
py::str overloaded(int, int) const { return "(int, int) const"; }
|
|
74
|
-
py::str overloaded(float, float) const { return "(float, float) const"; }
|
|
75
|
-
|
|
76
|
-
static py::str overloaded(float) { return "static float"; }
|
|
77
|
-
|
|
78
|
-
int value = 0;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
struct TestProperties {
|
|
82
|
-
int value = 1;
|
|
83
|
-
static int static_value;
|
|
84
|
-
|
|
85
|
-
int get() const { return value; }
|
|
86
|
-
void set(int v) { value = v; }
|
|
87
|
-
|
|
88
|
-
static int static_get() { return static_value; }
|
|
89
|
-
static void static_set(int v) { static_value = v; }
|
|
90
|
-
};
|
|
91
|
-
int TestProperties::static_value = 1;
|
|
92
|
-
|
|
93
|
-
struct TestPropertiesOverride : TestProperties {
|
|
94
|
-
int value = 99;
|
|
95
|
-
static int static_value;
|
|
96
|
-
};
|
|
97
|
-
int TestPropertiesOverride::static_value = 99;
|
|
98
|
-
|
|
99
|
-
struct TestPropRVP {
|
|
100
|
-
UserType v1{1};
|
|
101
|
-
UserType v2{1};
|
|
102
|
-
static UserType sv1;
|
|
103
|
-
static UserType sv2;
|
|
104
|
-
|
|
105
|
-
const UserType &get1() const { return v1; }
|
|
106
|
-
const UserType &get2() const { return v2; }
|
|
107
|
-
UserType get_rvalue() const { return v2; }
|
|
108
|
-
void set1(int v) { v1.set(v); }
|
|
109
|
-
void set2(int v) { v2.set(v); }
|
|
110
|
-
};
|
|
111
|
-
UserType TestPropRVP::sv1(1);
|
|
112
|
-
UserType TestPropRVP::sv2(1);
|
|
113
|
-
|
|
114
|
-
// Test None-allowed py::arg argument policy
|
|
115
|
-
class NoneTester { public: int answer = 42; };
|
|
116
|
-
int none1(const NoneTester &obj) { return obj.answer; }
|
|
117
|
-
int none2(NoneTester *obj) { return obj ? obj->answer : -1; }
|
|
118
|
-
int none3(std::shared_ptr<NoneTester> &obj) { return obj ? obj->answer : -1; }
|
|
119
|
-
int none4(std::shared_ptr<NoneTester> *obj) { return obj && *obj ? (*obj)->answer : -1; }
|
|
120
|
-
int none5(const std::shared_ptr<NoneTester> &obj) { return obj ? obj->answer : -1; }
|
|
121
|
-
|
|
122
|
-
// Issue #2778: implicit casting from None to object (not pointer)
|
|
123
|
-
class NoneCastTester {
|
|
124
|
-
public:
|
|
125
|
-
int answer = -1;
|
|
126
|
-
NoneCastTester() = default;
|
|
127
|
-
explicit NoneCastTester(int v) : answer(v) {}
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
struct StrIssue {
|
|
131
|
-
int val = -1;
|
|
132
|
-
|
|
133
|
-
StrIssue() = default;
|
|
134
|
-
explicit StrIssue(int i) : val{i} {}
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
// Issues #854, #910: incompatible function args when member function/pointer is in unregistered base class
|
|
138
|
-
class UnregisteredBase {
|
|
139
|
-
public:
|
|
140
|
-
void do_nothing() const {}
|
|
141
|
-
void increase_value() { rw_value++; ro_value += 0.25; }
|
|
142
|
-
void set_int(int v) { rw_value = v; }
|
|
143
|
-
int get_int() const { return rw_value; }
|
|
144
|
-
double get_double() const { return ro_value; }
|
|
145
|
-
int rw_value = 42;
|
|
146
|
-
double ro_value = 1.25;
|
|
147
|
-
};
|
|
148
|
-
class RegisteredDerived : public UnregisteredBase {
|
|
149
|
-
public:
|
|
150
|
-
using UnregisteredBase::UnregisteredBase;
|
|
151
|
-
double sum() const { return rw_value + ro_value; }
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
// Test explicit lvalue ref-qualification
|
|
155
|
-
struct RefQualified {
|
|
156
|
-
int value = 0;
|
|
157
|
-
|
|
158
|
-
void refQualified(int other) & { value += other; }
|
|
159
|
-
int constRefQualified(int other) const & { return value + other; }
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
TEST_SUBMODULE(methods_and_attributes, m) {
|
|
163
|
-
// test_methods_and_attributes
|
|
164
|
-
py::class_<ExampleMandA> emna(m, "ExampleMandA");
|
|
165
|
-
emna.def(py::init<>())
|
|
166
|
-
.def(py::init<int>())
|
|
167
|
-
.def(py::init<std::string&&>())
|
|
168
|
-
.def(py::init<const ExampleMandA&>())
|
|
169
|
-
.def("add1", &ExampleMandA::add1)
|
|
170
|
-
.def("add2", &ExampleMandA::add2)
|
|
171
|
-
.def("add3", &ExampleMandA::add3)
|
|
172
|
-
.def("add4", &ExampleMandA::add4)
|
|
173
|
-
.def("add5", &ExampleMandA::add5)
|
|
174
|
-
.def("add6", &ExampleMandA::add6)
|
|
175
|
-
.def("add7", &ExampleMandA::add7)
|
|
176
|
-
.def("add8", &ExampleMandA::add8)
|
|
177
|
-
.def("add9", &ExampleMandA::add9)
|
|
178
|
-
.def("add10", &ExampleMandA::add10)
|
|
179
|
-
.def("consume_str", &ExampleMandA::consume_str)
|
|
180
|
-
.def("self1", &ExampleMandA::self1)
|
|
181
|
-
.def("self2", &ExampleMandA::self2)
|
|
182
|
-
.def("self3", &ExampleMandA::self3)
|
|
183
|
-
.def("self4", &ExampleMandA::self4)
|
|
184
|
-
.def("self5", &ExampleMandA::self5)
|
|
185
|
-
.def("internal1", &ExampleMandA::internal1)
|
|
186
|
-
.def("internal2", &ExampleMandA::internal2)
|
|
187
|
-
.def("internal3", &ExampleMandA::internal3)
|
|
188
|
-
.def("internal4", &ExampleMandA::internal4)
|
|
189
|
-
.def("internal5", &ExampleMandA::internal5)
|
|
190
|
-
#if defined(PYBIND11_OVERLOAD_CAST)
|
|
191
|
-
.def("overloaded", py::overload_cast<>(&ExampleMandA::overloaded))
|
|
192
|
-
.def("overloaded", py::overload_cast<int>(&ExampleMandA::overloaded))
|
|
193
|
-
.def("overloaded", py::overload_cast<int, float>(&ExampleMandA::overloaded))
|
|
194
|
-
.def("overloaded", py::overload_cast<float, int>(&ExampleMandA::overloaded))
|
|
195
|
-
.def("overloaded", py::overload_cast<int, int>(&ExampleMandA::overloaded))
|
|
196
|
-
.def("overloaded", py::overload_cast<float, float>(&ExampleMandA::overloaded))
|
|
197
|
-
.def("overloaded_float", py::overload_cast<float, float>(&ExampleMandA::overloaded))
|
|
198
|
-
.def("overloaded_const", py::overload_cast<int >(&ExampleMandA::overloaded, py::const_))
|
|
199
|
-
.def("overloaded_const", py::overload_cast<int, float>(&ExampleMandA::overloaded, py::const_))
|
|
200
|
-
.def("overloaded_const", py::overload_cast<float, int>(&ExampleMandA::overloaded, py::const_))
|
|
201
|
-
.def("overloaded_const", py::overload_cast<int, int>(&ExampleMandA::overloaded, py::const_))
|
|
202
|
-
.def("overloaded_const", py::overload_cast<float, float>(&ExampleMandA::overloaded, py::const_))
|
|
203
|
-
#else
|
|
204
|
-
// Use both the traditional static_cast method and the C++11 compatible overload_cast_
|
|
205
|
-
.def("overloaded", overload_cast_<>()(&ExampleMandA::overloaded))
|
|
206
|
-
.def("overloaded", overload_cast_<int>()(&ExampleMandA::overloaded))
|
|
207
|
-
.def("overloaded", overload_cast_<int, float>()(&ExampleMandA::overloaded))
|
|
208
|
-
.def("overloaded", static_cast<py::str (ExampleMandA::*)(float, int)>(&ExampleMandA::overloaded))
|
|
209
|
-
.def("overloaded", static_cast<py::str (ExampleMandA::*)(int, int)>(&ExampleMandA::overloaded))
|
|
210
|
-
.def("overloaded", static_cast<py::str (ExampleMandA::*)(float, float)>(&ExampleMandA::overloaded))
|
|
211
|
-
.def("overloaded_float", overload_cast_<float, float>()(&ExampleMandA::overloaded))
|
|
212
|
-
.def("overloaded_const", overload_cast_<int >()(&ExampleMandA::overloaded, py::const_))
|
|
213
|
-
.def("overloaded_const", overload_cast_<int, float>()(&ExampleMandA::overloaded, py::const_))
|
|
214
|
-
.def("overloaded_const", static_cast<py::str (ExampleMandA::*)(float, int) const>(&ExampleMandA::overloaded))
|
|
215
|
-
.def("overloaded_const", static_cast<py::str (ExampleMandA::*)(int, int) const>(&ExampleMandA::overloaded))
|
|
216
|
-
.def("overloaded_const", static_cast<py::str (ExampleMandA::*)(float, float) const>(&ExampleMandA::overloaded))
|
|
217
|
-
#endif
|
|
218
|
-
// test_no_mixed_overloads
|
|
219
|
-
// Raise error if trying to mix static/non-static overloads on the same name:
|
|
220
|
-
.def_static("add_mixed_overloads1", []() {
|
|
221
|
-
auto emna = py::reinterpret_borrow<py::class_<ExampleMandA>>(py::module_::import("pybind11_tests.methods_and_attributes").attr("ExampleMandA"));
|
|
222
|
-
emna.def ("overload_mixed1", static_cast<py::str (ExampleMandA::*)(int, int)>(&ExampleMandA::overloaded))
|
|
223
|
-
.def_static("overload_mixed1", static_cast<py::str ( *)(float )>(&ExampleMandA::overloaded));
|
|
224
|
-
})
|
|
225
|
-
.def_static("add_mixed_overloads2", []() {
|
|
226
|
-
auto emna = py::reinterpret_borrow<py::class_<ExampleMandA>>(py::module_::import("pybind11_tests.methods_and_attributes").attr("ExampleMandA"));
|
|
227
|
-
emna.def_static("overload_mixed2", static_cast<py::str ( *)(float )>(&ExampleMandA::overloaded))
|
|
228
|
-
.def ("overload_mixed2", static_cast<py::str (ExampleMandA::*)(int, int)>(&ExampleMandA::overloaded));
|
|
229
|
-
})
|
|
230
|
-
.def("__str__", &ExampleMandA::toString)
|
|
231
|
-
.def_readwrite("value", &ExampleMandA::value);
|
|
232
|
-
|
|
233
|
-
// test_copy_method
|
|
234
|
-
// Issue #443: can't call copied methods in Python 3
|
|
235
|
-
emna.attr("add2b") = emna.attr("add2");
|
|
236
|
-
|
|
237
|
-
// test_properties, test_static_properties, test_static_cls
|
|
238
|
-
py::class_<TestProperties>(m, "TestProperties")
|
|
239
|
-
.def(py::init<>())
|
|
240
|
-
.def_readonly("def_readonly", &TestProperties::value)
|
|
241
|
-
.def_readwrite("def_readwrite", &TestProperties::value)
|
|
242
|
-
.def_property("def_writeonly", nullptr, [](TestProperties &s, int v) { s.value = v; })
|
|
243
|
-
.def_property("def_property_writeonly", nullptr, &TestProperties::set)
|
|
244
|
-
.def_property_readonly("def_property_readonly", &TestProperties::get)
|
|
245
|
-
.def_property("def_property", &TestProperties::get, &TestProperties::set)
|
|
246
|
-
.def_property("def_property_impossible", nullptr, nullptr)
|
|
247
|
-
.def_readonly_static("def_readonly_static", &TestProperties::static_value)
|
|
248
|
-
.def_readwrite_static("def_readwrite_static", &TestProperties::static_value)
|
|
249
|
-
.def_property_static("def_writeonly_static",
|
|
250
|
-
nullptr,
|
|
251
|
-
[](const py::object &, int v) { TestProperties::static_value = v; })
|
|
252
|
-
.def_property_readonly_static(
|
|
253
|
-
"def_property_readonly_static",
|
|
254
|
-
[](const py::object &) { return TestProperties::static_get(); })
|
|
255
|
-
.def_property_static(
|
|
256
|
-
"def_property_writeonly_static",
|
|
257
|
-
nullptr,
|
|
258
|
-
[](const py::object &, int v) { return TestProperties::static_set(v); })
|
|
259
|
-
.def_property_static(
|
|
260
|
-
"def_property_static",
|
|
261
|
-
[](const py::object &) { return TestProperties::static_get(); },
|
|
262
|
-
[](const py::object &, int v) { TestProperties::static_set(v); })
|
|
263
|
-
.def_property_static(
|
|
264
|
-
"static_cls",
|
|
265
|
-
[](py::object cls) { return cls; },
|
|
266
|
-
[](const py::object &cls, const py::function &f) { f(cls); });
|
|
267
|
-
|
|
268
|
-
py::class_<TestPropertiesOverride, TestProperties>(m, "TestPropertiesOverride")
|
|
269
|
-
.def(py::init<>())
|
|
270
|
-
.def_readonly("def_readonly", &TestPropertiesOverride::value)
|
|
271
|
-
.def_readonly_static("def_readonly_static", &TestPropertiesOverride::static_value);
|
|
272
|
-
|
|
273
|
-
auto static_get1 = [](const py::object &) -> const UserType & { return TestPropRVP::sv1; };
|
|
274
|
-
auto static_get2 = [](const py::object &) -> const UserType & { return TestPropRVP::sv2; };
|
|
275
|
-
auto static_set1 = [](const py::object &, int v) { TestPropRVP::sv1.set(v); };
|
|
276
|
-
auto static_set2 = [](const py::object &, int v) { TestPropRVP::sv2.set(v); };
|
|
277
|
-
auto rvp_copy = py::return_value_policy::copy;
|
|
278
|
-
|
|
279
|
-
// test_property_return_value_policies
|
|
280
|
-
py::class_<TestPropRVP>(m, "TestPropRVP")
|
|
281
|
-
.def(py::init<>())
|
|
282
|
-
.def_property_readonly("ro_ref", &TestPropRVP::get1)
|
|
283
|
-
.def_property_readonly("ro_copy", &TestPropRVP::get2, rvp_copy)
|
|
284
|
-
.def_property_readonly("ro_func", py::cpp_function(&TestPropRVP::get2, rvp_copy))
|
|
285
|
-
.def_property("rw_ref", &TestPropRVP::get1, &TestPropRVP::set1)
|
|
286
|
-
.def_property("rw_copy", &TestPropRVP::get2, &TestPropRVP::set2, rvp_copy)
|
|
287
|
-
.def_property(
|
|
288
|
-
"rw_func", py::cpp_function(&TestPropRVP::get2, rvp_copy), &TestPropRVP::set2)
|
|
289
|
-
.def_property_readonly_static("static_ro_ref", static_get1)
|
|
290
|
-
.def_property_readonly_static("static_ro_copy", static_get2, rvp_copy)
|
|
291
|
-
.def_property_readonly_static("static_ro_func", py::cpp_function(static_get2, rvp_copy))
|
|
292
|
-
.def_property_static("static_rw_ref", static_get1, static_set1)
|
|
293
|
-
.def_property_static("static_rw_copy", static_get2, static_set2, rvp_copy)
|
|
294
|
-
.def_property_static(
|
|
295
|
-
"static_rw_func", py::cpp_function(static_get2, rvp_copy), static_set2)
|
|
296
|
-
// test_property_rvalue_policy
|
|
297
|
-
.def_property_readonly("rvalue", &TestPropRVP::get_rvalue)
|
|
298
|
-
.def_property_readonly_static("static_rvalue",
|
|
299
|
-
[](const py::object &) { return UserType(1); });
|
|
300
|
-
|
|
301
|
-
// test_metaclass_override
|
|
302
|
-
struct MetaclassOverride { };
|
|
303
|
-
py::class_<MetaclassOverride>(m, "MetaclassOverride", py::metaclass((PyObject *) &PyType_Type))
|
|
304
|
-
.def_property_readonly_static("readonly", [](const py::object &) { return 1; });
|
|
305
|
-
|
|
306
|
-
// test_overload_ordering
|
|
307
|
-
m.def("overload_order", [](const std::string &) { return 1; });
|
|
308
|
-
m.def("overload_order", [](const std::string &) { return 2; });
|
|
309
|
-
m.def("overload_order", [](int) { return 3; });
|
|
310
|
-
m.def("overload_order", [](int) { return 4; }, py::prepend{});
|
|
311
|
-
|
|
312
|
-
#if !defined(PYPY_VERSION)
|
|
313
|
-
// test_dynamic_attributes
|
|
314
|
-
class DynamicClass {
|
|
315
|
-
public:
|
|
316
|
-
DynamicClass() { print_default_created(this); }
|
|
317
|
-
DynamicClass(const DynamicClass&) = delete;
|
|
318
|
-
~DynamicClass() { print_destroyed(this); }
|
|
319
|
-
};
|
|
320
|
-
py::class_<DynamicClass>(m, "DynamicClass", py::dynamic_attr())
|
|
321
|
-
.def(py::init());
|
|
322
|
-
|
|
323
|
-
class CppDerivedDynamicClass : public DynamicClass { };
|
|
324
|
-
py::class_<CppDerivedDynamicClass, DynamicClass>(m, "CppDerivedDynamicClass")
|
|
325
|
-
.def(py::init());
|
|
326
|
-
#endif
|
|
327
|
-
|
|
328
|
-
// test_bad_arg_default
|
|
329
|
-
// Issue/PR #648: bad arg default debugging output
|
|
330
|
-
#if !defined(NDEBUG)
|
|
331
|
-
m.attr("debug_enabled") = true;
|
|
332
|
-
#else
|
|
333
|
-
m.attr("debug_enabled") = false;
|
|
334
|
-
#endif
|
|
335
|
-
m.def("bad_arg_def_named", []{
|
|
336
|
-
auto m = py::module_::import("pybind11_tests");
|
|
337
|
-
m.def("should_fail", [](int, UnregisteredType) {}, py::arg(), py::arg("a") = UnregisteredType());
|
|
338
|
-
});
|
|
339
|
-
m.def("bad_arg_def_unnamed", []{
|
|
340
|
-
auto m = py::module_::import("pybind11_tests");
|
|
341
|
-
m.def("should_fail", [](int, UnregisteredType) {}, py::arg(), py::arg() = UnregisteredType());
|
|
342
|
-
});
|
|
343
|
-
|
|
344
|
-
// [workaround(intel)] ICC 20/21 breaks with py::arg().stuff, using py::arg{}.stuff works.
|
|
345
|
-
|
|
346
|
-
// test_accepts_none
|
|
347
|
-
py::class_<NoneTester, std::shared_ptr<NoneTester>>(m, "NoneTester")
|
|
348
|
-
.def(py::init<>());
|
|
349
|
-
m.def("no_none1", &none1, py::arg{}.none(false));
|
|
350
|
-
m.def("no_none2", &none2, py::arg{}.none(false));
|
|
351
|
-
m.def("no_none3", &none3, py::arg{}.none(false));
|
|
352
|
-
m.def("no_none4", &none4, py::arg{}.none(false));
|
|
353
|
-
m.def("no_none5", &none5, py::arg{}.none(false));
|
|
354
|
-
m.def("ok_none1", &none1);
|
|
355
|
-
m.def("ok_none2", &none2, py::arg{}.none(true));
|
|
356
|
-
m.def("ok_none3", &none3);
|
|
357
|
-
m.def("ok_none4", &none4, py::arg{}.none(true));
|
|
358
|
-
m.def("ok_none5", &none5);
|
|
359
|
-
|
|
360
|
-
m.def("no_none_kwarg", &none2, "a"_a.none(false));
|
|
361
|
-
m.def("no_none_kwarg_kw_only", &none2, py::kw_only(), "a"_a.none(false));
|
|
362
|
-
|
|
363
|
-
// test_casts_none
|
|
364
|
-
// Issue #2778: implicit casting from None to object (not pointer)
|
|
365
|
-
py::class_<NoneCastTester>(m, "NoneCastTester")
|
|
366
|
-
.def(py::init<>())
|
|
367
|
-
.def(py::init<int>())
|
|
368
|
-
.def(py::init([](py::none const&) { return NoneCastTester{}; }));
|
|
369
|
-
py::implicitly_convertible<py::none, NoneCastTester>();
|
|
370
|
-
m.def("ok_obj_or_none", [](NoneCastTester const& foo) { return foo.answer; });
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
// test_str_issue
|
|
374
|
-
// Issue #283: __str__ called on uninitialized instance when constructor arguments invalid
|
|
375
|
-
py::class_<StrIssue>(m, "StrIssue")
|
|
376
|
-
.def(py::init<int>())
|
|
377
|
-
.def(py::init<>())
|
|
378
|
-
.def("__str__", [](const StrIssue &si) {
|
|
379
|
-
return "StrIssue[" + std::to_string(si.val) + "]"; }
|
|
380
|
-
);
|
|
381
|
-
|
|
382
|
-
// test_unregistered_base_implementations
|
|
383
|
-
//
|
|
384
|
-
// Issues #854/910: incompatible function args when member function/pointer is in unregistered
|
|
385
|
-
// base class The methods and member pointers below actually resolve to members/pointers in
|
|
386
|
-
// UnregisteredBase; before this test/fix they would be registered via lambda with a first
|
|
387
|
-
// argument of an unregistered type, and thus uncallable.
|
|
388
|
-
py::class_<RegisteredDerived>(m, "RegisteredDerived")
|
|
389
|
-
.def(py::init<>())
|
|
390
|
-
.def("do_nothing", &RegisteredDerived::do_nothing)
|
|
391
|
-
.def("increase_value", &RegisteredDerived::increase_value)
|
|
392
|
-
.def_readwrite("rw_value", &RegisteredDerived::rw_value)
|
|
393
|
-
.def_readonly("ro_value", &RegisteredDerived::ro_value)
|
|
394
|
-
// Uncommenting the next line should trigger a static_assert:
|
|
395
|
-
// .def_readwrite("fails", &UserType::value)
|
|
396
|
-
// Uncommenting the next line should trigger a static_assert:
|
|
397
|
-
// .def_readonly("fails", &UserType::value)
|
|
398
|
-
.def_property("rw_value_prop", &RegisteredDerived::get_int, &RegisteredDerived::set_int)
|
|
399
|
-
.def_property_readonly("ro_value_prop", &RegisteredDerived::get_double)
|
|
400
|
-
// This one is in the registered class:
|
|
401
|
-
.def("sum", &RegisteredDerived::sum);
|
|
402
|
-
|
|
403
|
-
using Adapted = decltype(py::method_adaptor<RegisteredDerived>(&RegisteredDerived::do_nothing));
|
|
404
|
-
static_assert(std::is_same<Adapted, void (RegisteredDerived::*)() const>::value, "");
|
|
405
|
-
|
|
406
|
-
// test_methods_and_attributes
|
|
407
|
-
py::class_<RefQualified>(m, "RefQualified")
|
|
408
|
-
.def(py::init<>())
|
|
409
|
-
.def_readonly("value", &RefQualified::value)
|
|
410
|
-
.def("refQualified", &RefQualified::refQualified)
|
|
411
|
-
.def("constRefQualified", &RefQualified::constRefQualified);
|
|
412
|
-
}
|