Line data Source code
1 : // SPDX-FileCopyrightText: 2024 Pairinteraction Developers 2 : // SPDX-License-Identifier: LGPL-3.0-or-later 3 : 4 : #include "./Info.py.hpp" 5 : #include "./LoggerBridge.hpp" 6 : #include "./basis/Basis.py.hpp" 7 : #include "./database/Database.py.hpp" 8 : #include "./diagonalize/Diagonalizer.py.hpp" 9 : #include "./enums/FloatType.py.hpp" 10 : #include "./enums/OperatorType.py.hpp" 11 : #include "./enums/Parity.py.hpp" 12 : #include "./enums/TransformationType.py.hpp" 13 : #include "./interfaces/DiagonalizerInterface.py.hpp" 14 : #include "./interfaces/TransformationBuilderInterface.py.hpp" 15 : #include "./ket/Ket.py.hpp" 16 : #include "./operator/Operator.py.hpp" 17 : #include "./paths.py.hpp" 18 : #include "./system/System.py.hpp" 19 : #include "./tools/run_unit_tests.py.hpp" 20 : #include "./version.py.hpp" 21 : 22 : #include <nanobind/nanobind.h> 23 : #include <nanobind/stl/string.h> 24 : #include <nanobind/stl/vector.h> 25 : 26 : namespace nb = nanobind; 27 : 28 8 : NB_MODULE(_backend, m) // NOLINT 29 : { 30 : // https://nanobind.readthedocs.io/en/latest/faq.html#why-am-i-getting-errors-about-leaked-functions-and-types 31 2 : nanobind::set_leak_warnings(false); 32 : 33 : // wrap the get_pending_logs method of the logger bridge instance 34 2 : static LoggerBridge bridge; 35 4 : nb::class_<LoggerBridge::LogEntry>(m, "LogEntry") 36 2 : .def_ro("level", &LoggerBridge::LogEntry::level) 37 : .def_ro("message", &LoggerBridge::LogEntry::message); 38 2573 : m.def("get_pending_logs", []() { return bridge.get_pending_logs(); }); 39 : 40 : // enums 41 2 : bind_operator_type(m); 42 2 : bind_parity(m); 43 2 : bind_transformation_type(m); 44 2 : bind_float_type(m); 45 : 46 : // interfaces 47 2 : bind_diagonalizer_interface(m); 48 2 : bind_transformation_builder_interface(m); 49 : 50 : // operator 51 2 : bind_operator(m); 52 : 53 : // database 54 2 : bind_database(m); 55 : 56 : // diagonalizer 57 2 : bind_diagonalizer(m); 58 : 59 : // ket 60 2 : bind_ket(m); 61 : 62 : // basis 63 2 : bind_basis(m); 64 : 65 : // system 66 2 : bind_system(m); 67 : 68 : // tools 69 2 : bind_run_unit_tests(m); 70 : 71 : // paths 72 2 : bind_paths(m); 73 : 74 : // version 75 2 : bind_version(m); 76 : 77 : // info 78 2 : bind_info(m); 79 2 : }