Skip to content

Commit

Permalink
🚨 Fixed a bunch more warnings and errors (still a long way to go)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelwa committed Dec 12, 2024
1 parent b500068 commit e670dc3
Show file tree
Hide file tree
Showing 10 changed files with 175 additions and 215 deletions.
52 changes: 10 additions & 42 deletions bindings/mnt/pyfiction/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,17 @@
__version__,
a_star,
a_star_distance,
## path_finding
a_star_params,
all_standard_2_input_functions,
all_standard_3_input_functions,
all_supported_standard_functions,
and_or_not,
and_or_not_maj,
apply_bestagon_library,
## physical_design
apply_qca_one_library,
apply_topolinano_library,
area,
assess_physical_population_stability_100,
assess_physical_population_stability_111,
# Technology
assess_physical_population_stability,
assess_physical_population_stability_params,
automatic_base_number_detection,
bdl_input_iterator_100,
Expand All @@ -51,7 +47,6 @@
calculate_energy_and_state_type_with_kinks_rejected,
can_positive_charges_occur,
cartesian_gate_layout,
# Layouts
cartesian_layout,
cartesian_obstruction_layout,
charge_configuration_to_string,
Expand Down Expand Up @@ -99,7 +94,6 @@
create_xor3_tt,
create_xor_and_tt,
create_xor_tt,
## properties
critical_path_length_and_throughput,
critical_temperature_gate_based,
critical_temperature_non_gate_based,
Expand Down Expand Up @@ -145,9 +139,7 @@
extract_routing_objectives,
fanout_substitution,
fanout_substitution_params,
# Inout
fgl_parsing_error,
## verfication
gate_level_drv_params,
gate_level_drvs,
get_name,
Expand All @@ -162,11 +154,10 @@
hexagonal_layout,
hexagonal_obstruction_layout,
hexagonalization,
hexagonalization_stats,
high_degree_fanin_exception,
inml_layout,
inml_technology,
# Algorithms
## iter
input_bdl_configuration,
is_balanced,
is_charged_defect_type,
Expand All @@ -188,7 +179,6 @@
network_balancing,
network_balancing_params,
normalize_layout_coordinates,
# Utils
num_adjacent_coordinates,
occupation_probability_gate_based,
occupation_probability_non_gate_based,
Expand Down Expand Up @@ -244,28 +234,24 @@
sidb_defect_type,
sidb_lattice_mode,
sidb_layout,
sidb_nm_distance_100,
sidb_nm_distance_111,
sidb_nm_distance,
sidb_nm_position,
sidb_simulation_engine,
sidb_simulation_parameters,
sidb_simulation_result_100,
sidb_simulation_result_111,
sidb_technology,
sign_to_charge_state,
### logic
simulate,
siqad_coordinate,
sqd_parsing_error,
squared_euclidean_distance,
## network_transformation
substitution_strategy,
sweep_parameter,
technology_constraints,
technology_mapping,
technology_mapping_params,
technology_mapping_stats,
# Networks
technology_network,
time_to_solution,
time_to_solution_for_given_simulation_results,
Expand All @@ -274,8 +260,6 @@
to_cube_coord,
to_offset_coord,
to_siqad_coord,
## simulation
### sidb
transition_type,
twoddwave_distance,
undefined_cell_label_exception,
Expand Down Expand Up @@ -314,21 +298,18 @@
"__version__",
"a_star",
"a_star_distance",
## path_finding
"a_star_params",
"all_standard_2_input_functions",
"all_standard_3_input_functions",
"all_supported_standard_functions",
"and_or_not",
"and_or_not_maj",
"apply_bestagon_library",
## physical_design
"apply_qca_one_library",
"apply_topolinano_library",
# Technology
"area",
"assess_physical_population_stability_100",
"assess_physical_population_stability_111",
"area",
"assess_physical_population_stability",
"assess_physical_population_stability_params",
"automatic_base_number_detection",
"bdl_input_iterator_100",
Expand All @@ -342,7 +323,6 @@
"calculate_energy_and_state_type_with_kinks_rejected",
"can_positive_charges_occur",
"cartesian_gate_layout",
# Layouts
"cartesian_layout",
"cartesian_obstruction_layout",
"charge_configuration_to_string",
Expand Down Expand Up @@ -390,7 +370,6 @@
"create_xor3_tt",
"create_xor_and_tt",
"create_xor_tt",
## properties
"critical_path_length_and_throughput",
"critical_temperature_gate_based",
"critical_temperature_non_gate_based",
Expand Down Expand Up @@ -436,9 +415,7 @@
"extract_routing_objectives",
"fanout_substitution",
"fanout_substitution_params",
# Inout
"fgl_parsing_error",
## verfication
"gate_level_drv_params",
"gate_level_drvs",
"get_name",
Expand All @@ -453,17 +430,15 @@
"hexagonal_layout",
"hexagonal_obstruction_layout",
"hexagonalization",
"hexagonalization_stats",
"high_degree_fanin_exception",
"inml_layout",
"inml_technology",
# Algorithms
## iter
"input_bdl_configuration",
"is_balanced",
"is_charged_defect_type",
"is_crossable_wire",
"is_fanout_substituted",
set_name,
"is_ground_state",
"is_kink_induced_non_operational",
"is_negatively_charged_defect",
Expand All @@ -480,7 +455,6 @@
"network_balancing",
"network_balancing_params",
"normalize_layout_coordinates",
# Utils
"num_adjacent_coordinates",
"occupation_probability_gate_based",
"occupation_probability_non_gate_based",
Expand Down Expand Up @@ -525,6 +499,7 @@
"route_path",
# "write_location_and_ground_state",
"sample_writing_mode",
"set_name",
"shifted_cartesian_gate_layout",
"shifted_cartesian_layout",
"shifted_cartesian_obstruction_layout",
Expand All @@ -533,31 +508,26 @@
"sidb_charge_state",
"sidb_defect",
"sidb_defect_type",
"sidb_lattice_mode",
"sidb_layout",
"sidb_nm_distance_100",
"sidb_nm_distance_111",
"sidb_nm_distance",
"sidb_nm_position",
"sidb_simulation_engine",
"sidb_simulation_parameters",
"sidb_simulation_result_100",
"sidb_simulation_result_111",
"sidb_technology",
"sign_to_charge_state",
### logic
"simulate",
"area",
"siqad_coordinate",
"volume",
"sqd_parsing_error",
"squared_euclidean_distance",
## network_transformation
"substitution_strategy",
"sweep_parameter",
"technology_constraints",
"technology_mapping",
"technology_mapping_params",
"technology_mapping_stats",
# Networks
"technology_network",
"time_to_solution",
"time_to_solution_for_given_simulation_results",
Expand All @@ -566,13 +536,12 @@
"to_cube_coord",
"to_offset_coord",
"to_siqad_coord",
## simulation
### sidb
"transition_type",
"twoddwave_distance",
"undefined_cell_label_exception",
"unrecognized_cell_definition_exception",
"unsupported_character_exception",
"volume",
"wiring_reduction",
"wiring_reduction_params",
"wiring_reduction_stats",
Expand All @@ -596,5 +565,4 @@
"write_sqd_sim_result",
"yen_k_shortest_paths",
"yen_k_shortest_paths_params",
"sidb_lattice_mode",
]
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,29 @@ void bdl_input_iterator(pybind11::module& m, const std::string& lattice)
},
DOC(fiction_bdl_input_iterator_operator_mul))
.def(
"__eq__", [](const fiction::bdl_input_iterator<Lyt>& self, const uint64_t n) -> bool { return self == n; },
"__eq__",
[](const fiction::bdl_input_iterator<Lyt>& self, const py::object& other) -> bool
{
if (!py::isinstance<uint64_t>(other))
{
return false;
}

return self == other.cast<const uint64_t>();
},

py::arg("m"), DOC(fiction_bdl_input_iterator_operator_eq))
.def(
"__ne__", [](const fiction::bdl_input_iterator<Lyt>& self, const uint64_t n) -> bool { return self != n; },
"__ne__",
[](const fiction::bdl_input_iterator<Lyt>& self, const py::object& other) -> bool
{
if (!py::isinstance<uint64_t>(other))
{
return false;
}

return self != other.cast<const uint64_t>();
},
py::arg("m"), DOC(fiction_bdl_input_iterator_operator_ne))
.def(
"__lt__", [](const fiction::bdl_input_iterator<Lyt>& self, const uint64_t n) -> bool { return self < n; },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,31 +212,6 @@ void charge_distribution_surface_layout(pybind11::module& m, const std::string&
.def("get_sidb_order", &py_cds::get_sidb_order)
.def("add_sidb", &py_cds::add_sidb, py::arg("cell"), py::arg("charge"))

.def("cells",
[](const py_cds& lyt)
{
std::vector<fiction::coordinate<py_cds>> cells{};
cells.reserve(lyt.num_cells());
lyt.foreach_cell([&cells](const auto& c) { cells.push_back(c); });
return cells;
})
.def("pis",
[](const py_cds& lyt)
{
std::vector<fiction::coordinate<py_cds>> pis{};
pis.reserve(lyt.num_pis());
lyt.foreach_pi([&pis](const auto& c) { pis.push_back(c); });
return pis;
})
.def("pos",
[](const py_cds& lyt)
{
std::vector<fiction::coordinate<py_cds>> pos{};
pos.reserve(lyt.num_pos());
lyt.foreach_po([&pos](const auto& c) { pos.push_back(c); });
return pos;
})

.def(
"is_within_bounds", [](const py_cds& lyt, const fiction::coordinate<py_cds>& c)
{ return lyt.is_within_bounds(c); }, py::arg("c"), DOC(fiction_cartesian_layout_is_within_bounds))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "pyfiction/documentation.hpp"
#include "pyfiction/types.hpp"

#include <fiction/io/print_layout.hpp>
#include <fiction/technology/sidb_lattice.hpp>
#include <fiction/technology/sidb_lattice_orientations.hpp>
#include <fiction/traits.hpp>
Expand All @@ -18,9 +17,7 @@

#include <algorithm>
#include <cctype>
#include <cstdint>
#include <string>
#include <vector>

namespace pyfiction
{
Expand All @@ -45,8 +42,9 @@ void sidb_lattice_cell_level_layout(pybind11::module& m)
py::class_<py_sidb_lattice, py_sidb_layout>(m, fmt::format("sidb_{}_lattice", orientation).c_str(),
DOC(fiction_cell_level_layout), py::module_local())
.def(py::init<>())
.def(py::init<const fiction::aspect_ratio<py_sidb_layout>&, const std::string&>(), py::arg("dimension"),
py::arg("name") = "", DOC(fiction_sidb_lattice))
.def(py::init<const fiction::aspect_ratio<py_sidb_layout>&, const std::string&>(),
py::arg("dimension") = fiction::aspect_ratio<py_sidb_layout>{}, py::arg("name") = "",
DOC(fiction_sidb_lattice))

;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ namespace detail
{

template <typename Lyt>
void nanometer_distance(pybind11::module& m, const std::string& lattice = "")
void nanometer_distance(pybind11::module& m)
{
namespace py = pybind11;

m.def(fmt::format("sidb_nm_distance{}", lattice).c_str(), &fiction::sidb_nm_distance<Lyt>, py::arg("lyt"),
py::arg("source"), py::arg("target"), DOC(fiction_sidb_nm_distance));
m.def(fmt::format("sidb_nm_distance").c_str(), &fiction::sidb_nm_distance<Lyt>, py::arg("lyt"), py::arg("source"),
py::arg("target"), DOC(fiction_sidb_nm_distance));
}

} // namespace detail

inline void sidb_nm_distance(pybind11::module& m)
{
detail::nanometer_distance<py_sidb_100_lattice>(m, "_100");
detail::nanometer_distance<py_sidb_111_lattice>(m, "_111");
detail::nanometer_distance<py_sidb_100_lattice>(m);
detail::nanometer_distance<py_sidb_111_lattice>(m);
}

} // namespace pyfiction
Expand Down
Loading

0 comments on commit e670dc3

Please sign in to comment.