diff --git a/bindings/mnt/pyfiction/include/pyfiction/utils/layout_utils.hpp b/bindings/mnt/pyfiction/include/pyfiction/utils/layout_utils.hpp index 8dd9bc6c9..6612fe2c3 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/utils/layout_utils.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/utils/layout_utils.hpp @@ -1,25 +1,90 @@ // -// Created by Jan Drewniok on 11.11.24. +// Created by marcel on 21.11.23. // -#ifndef PYFICTION_VERSION_INFO_HPP -#define PYFICTION_VERSION_INFO_HPP +#ifndef PYFICTION_LAYOUT_UTILS_HPP +#define PYFICTION_LAYOUT_UTILS_HPP -#include +#include "pyfiction/documentation.hpp" +#include "pyfiction/types.hpp" + +#include +#include #include namespace pyfiction { -inline void version_info(pybind11::module& m) +namespace detail +{ + +template +void num_adjacent_coordinates(pybind11::module& m) +{ + namespace py = pybind11; + + m.def("num_adjacent_coordinates", &fiction::num_adjacent_coordinates, py::arg("lyt"), py::arg("c"), + DOC(fiction_num_adjacent_coordinates)); +} + +template +void normalize_layout_coordinates(pybind11::module& m) +{ + namespace py = pybind11; + + m.def("normalize_layout_coordinates", &fiction::normalize_layout_coordinates, py::arg("lyt"), + DOC(fiction_normalize_layout_coordinates)); +} + +template +void convert_to_siqad_coordinates(pybind11::module& m) +{ + namespace py = pybind11; + + m.def("convert_layout_to_siqad_coordinates", &fiction::convert_layout_to_siqad_coordinates, py::arg("lyt"), + DOC(fiction_convert_layout_to_siqad_coordinates)); +} + +template +void random_coordinate(pybind11::module& m) +{ + namespace py = pybind11; + + m.def("random_coordinate", &fiction::random_coordinate>, py::arg("coordinate1"), + py::arg("coordinate_2"), DOC(fiction_random_coordinate)); +} + +} // namespace detail + +inline void layout_utils(pybind11::module& m) { - m.attr("__version__") = fiction::FICTION_VERSION; - m.attr("__repo__") = fiction::FICTION_REPO; - m.attr("__compiled_date__") = fiction::COMPILED_DATE; - m.attr("__compiled_time__") = fiction::COMPILED_TIME; + // NOTE be careful with the order of the following calls! Python will resolve the first matching overload! + + detail::num_adjacent_coordinates(m); + detail::num_adjacent_coordinates(m); + detail::num_adjacent_coordinates(m); + detail::num_adjacent_coordinates(m); + detail::num_adjacent_coordinates(m); + detail::num_adjacent_coordinates(m); + + detail::normalize_layout_coordinates(m); + detail::normalize_layout_coordinates(m); + detail::normalize_layout_coordinates(m); + + detail::convert_to_siqad_coordinates(m); + + detail::random_coordinate(m); + detail::random_coordinate(m); + detail::random_coordinate(m); + detail::random_coordinate(m); + detail::random_coordinate(m); + detail::random_coordinate(m); + detail::random_coordinate(m); + detail::random_coordinate(m); + detail::random_coordinate(m); } } // namespace pyfiction -#endif // PYFICTION_VERSION_INFO_HPP +#endif // PYFICTION_LAYOUT_UTILS_HPP