Line data Source code
1 : // SPDX-FileCopyrightText: 2024 PairInteraction Developers 2 : // SPDX-License-Identifier: LGPL-3.0-or-later 3 : 4 : #include "./SorterBuilderInterface.py.hpp" 5 : 6 : #include "pairinteraction/interfaces/SorterBuilderInterface.hpp" 7 : 8 : #include <nanobind/nanobind.h> 9 : 10 : namespace nb = nanobind; 11 : using namespace nb::literals; 12 : using namespace pairinteraction; 13 : 14 2 : static void declare_permutation_matrix(nb::module_ &m) { 15 : nb::class_<Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic>> pyclass( 16 2 : m, "PermutationMatrix"); 17 2 : } 18 : 19 2 : static void declare_indices_of_blocks(nb::module_ &m) { 20 2 : nb::class_<IndicesOfBlock> pyclass(m, "IndicesOfBlock"); 21 6 : pyclass.def(nb::init<size_t, size_t>(), "start"_a, "end"_a) 22 2 : .def_rw("start", &IndicesOfBlock::start) 23 : .def_rw("end", &IndicesOfBlock::end); 24 2 : } 25 : 26 2 : static void declare_sorter_builder_interface(nb::module_ &m) { 27 2 : nb::class_<SorterBuilderInterface> pyclass(m, "SorterBuilderInterface"); 28 2 : } 29 : 30 2 : void bind_sorter_builder_interface(nb::module_ &m) { 31 2 : declare_permutation_matrix(m); 32 2 : declare_indices_of_blocks(m); 33 2 : declare_sorter_builder_interface(m); 34 2 : }