From 4edd1e835e6f17a0c239b1f43b6c2a9b16f46756 Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Wed, 15 Nov 2023 15:11:12 +0100 Subject: [PATCH] :sparkles: Added a stub for `design_sidb_gates` in pyfiction to be enabled once CDS works for that function as an input type --- .../physical_design/design_sidb_gates.hpp | 74 +++++++++++++++++++ bindings/pyfiction/pyfiction.cpp | 38 +++++----- 2 files changed, 94 insertions(+), 18 deletions(-) create mode 100644 bindings/pyfiction/include/pyfiction/algorithms/physical_design/design_sidb_gates.hpp diff --git a/bindings/pyfiction/include/pyfiction/algorithms/physical_design/design_sidb_gates.hpp b/bindings/pyfiction/include/pyfiction/algorithms/physical_design/design_sidb_gates.hpp new file mode 100644 index 000000000..67fc69de8 --- /dev/null +++ b/bindings/pyfiction/include/pyfiction/algorithms/physical_design/design_sidb_gates.hpp @@ -0,0 +1,74 @@ +// +// Created by marcel on 15.11.23. +// + +#ifndef PYFICTION_DESIGN_SIDB_GATES_HPP +#define PYFICTION_DESIGN_SIDB_GATES_HPP + +#include "pyfiction/documentation.hpp" +#include "pyfiction/types.hpp" + +#include +#include +#include + +#include +#include + +namespace pyfiction +{ + +namespace detail +{ + +template +void design_sidb_gates(pybind11::module& m) +{ + using namespace pybind11::literals; + + m.def("design_sidb_gates", &fiction::design_sidb_gates, "skeleton"_a, "spec"_a, + "params"_a = fiction::design_sidb_gates_params{}, DOC(fiction_design_sidb_gates)); +} + +} // namespace detail + +inline void design_sidb_gates(pybind11::module& m) +{ + namespace py = pybind11; + + /** + * Design approach selector type. + */ + pybind11::enum_( + m, "design_sidb_gates_mode", DOC(fiction_design_sidb_gates_params_design_sidb_gates_mode)) + .value("EXHAUSTIVE", fiction::design_sidb_gates_params::design_sidb_gates_mode::EXHAUSTIVE, + DOC(fiction_design_sidb_gates_params_design_sidb_gates_mode_EXHAUSTIVE)) + .value("RANDOM", fiction::design_sidb_gates_params::design_sidb_gates_mode::RANDOM, + DOC(fiction_design_sidb_gates_params_design_sidb_gates_mode_RANDOM)) + + ; + + /** + * Parameters. + */ + py::class_(m, "design_sidb_gates_params", DOC(fiction_design_sidb_gates_params)) + .def(py::init<>()) + .def_readwrite("phys_params", &fiction::design_sidb_gates_params::phys_params, + DOC(fiction_design_sidb_gates_params_phys_params)) + .def_readwrite("design_mode", &fiction::design_sidb_gates_params::design_mode, + DOC(fiction_design_sidb_gates_params_design_mode)) + .def_readwrite("canvas", &fiction::design_sidb_gates_params::canvas, + DOC(fiction_design_sidb_gates_params_canvas)) + .def_readwrite("number_of_sidbs", &fiction::design_sidb_gates_params::number_of_sidbs, + DOC(fiction_design_sidb_gates_params_number_of_sidbs)) + .def_readwrite("sim_engine", &fiction::design_sidb_gates_params::sim_engine, + DOC(fiction_design_sidb_gates_params_sim_engine)) + + ; + + detail::design_sidb_gates(m); +} + +} // namespace pyfiction + +#endif // PYFICTION_DESIGN_SIDB_GATES_HPP diff --git a/bindings/pyfiction/pyfiction.cpp b/bindings/pyfiction/pyfiction.cpp index ae9e7b6b4..71fd9928d 100644 --- a/bindings/pyfiction/pyfiction.cpp +++ b/bindings/pyfiction/pyfiction.cpp @@ -12,6 +12,7 @@ #include "pyfiction/algorithms/path_finding/k_shortest_paths.hpp" #include "pyfiction/algorithms/physical_design/apply_gate_library.hpp" #include "pyfiction/algorithms/physical_design/color_routing.hpp" +// #include "pyfiction/algorithms/physical_design/design_sidb_gates.hpp" #include "pyfiction/algorithms/physical_design/exact.hpp" #include "pyfiction/algorithms/physical_design/hexagonalization.hpp" #include "pyfiction/algorithms/physical_design/orthogonal.hpp" @@ -82,24 +83,6 @@ PYBIND11_MODULE(pyfiction, m) pyfiction::gate_level_layouts(m); pyfiction::cell_level_layouts(m); pyfiction::obstruction_layouts(m); - /** - * Networks - */ - pyfiction::logic_network(m); - /** - * Algorithms: Physical Design - */ - pyfiction::exact(m); - pyfiction::orthogonal(m); - pyfiction::apply_gate_library(m); - pyfiction::color_routing(m); - pyfiction::hexagonalization(m); - pyfiction::post_layout_optimization(m); - /** - * Algorithms: Network Transformation - */ - pyfiction::fanout_substitution(m); - pyfiction::network_balancing(m); /** * Algorithms: Simulation */ @@ -116,6 +99,15 @@ PYBIND11_MODULE(pyfiction, m) pyfiction::occupation_probability_of_excited_states(m); // pyfiction::critical_temperature(m); // pyfiction::time_to_solution(m); + /** + * Networks + */ + pyfiction::logic_network(m); + /** + * Algorithms: Network Transformation + */ + pyfiction::fanout_substitution(m); + pyfiction::network_balancing(m); /** * Algorithms: Path Finding */ @@ -123,6 +115,16 @@ PYBIND11_MODULE(pyfiction, m) pyfiction::a_star(m); pyfiction::yen_k_shortest_paths(m); pyfiction::enumerate_all_paths(m); + /** + * Algorithms: Physical Design + */ + pyfiction::exact(m); + pyfiction::orthogonal(m); + pyfiction::apply_gate_library(m); + pyfiction::color_routing(m); + pyfiction::hexagonalization(m); + pyfiction::post_layout_optimization(m); + // pyfiction::design_sidb_gates(m); /** * Algorithms: Properties */