Skip to content

Commit

Permalink
✨ Added a stub for design_sidb_gates in pyfiction to be enabled onc…
Browse files Browse the repository at this point in the history
…e CDS works for that function as an input type
  • Loading branch information
marcelwa committed Nov 15, 2023
1 parent a91f177 commit 4edd1e8
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -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 <fiction/algorithms/physical_design/design_sidb_gates.hpp>
#include <fiction/traits.hpp>
#include <fiction/utils/routing_utils.hpp>

#include <pybind11/pybind11.h>
#include <pybind11/stl.h>

namespace pyfiction
{

namespace detail
{

template <typename Lyt>
void design_sidb_gates(pybind11::module& m)
{
using namespace pybind11::literals;

m.def("design_sidb_gates", &fiction::design_sidb_gates<Lyt, py_tt>, "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_<fiction::design_sidb_gates_params::design_sidb_gates_mode>(
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_<fiction::design_sidb_gates_params>(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<py_charge_distribution_surface>(m);
}

} // namespace pyfiction

#endif // PYFICTION_DESIGN_SIDB_GATES_HPP
38 changes: 20 additions & 18 deletions bindings/pyfiction/pyfiction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
*/
Expand All @@ -116,13 +99,32 @@ 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
*/
pyfiction::distance(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
*/
Expand Down

0 comments on commit 4edd1e8

Please sign in to comment.