From 5284feda5cca5bacf3ebac3680aa4b5a9ac525ba Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Tue, 21 Nov 2023 18:43:25 +0100 Subject: [PATCH] :sparkles: Finalized technology package in pyfiction --- .../sidb => technology}/sidb_charge_state.hpp | 0 .../pyfiction/technology/sidb_defects.hpp | 21 +++++----- .../pyfiction/technology/sidb_nm_position.hpp | 39 +++++++++++++++++++ bindings/pyfiction/pyfiction.cpp | 4 +- .../fiction/technology/sidb_nm_position.hpp | 1 + 5 files changed, 53 insertions(+), 12 deletions(-) rename bindings/pyfiction/include/pyfiction/{algorithms/simulation/sidb => technology}/sidb_charge_state.hpp (100%) create mode 100644 bindings/pyfiction/include/pyfiction/technology/sidb_nm_position.hpp diff --git a/bindings/pyfiction/include/pyfiction/algorithms/simulation/sidb/sidb_charge_state.hpp b/bindings/pyfiction/include/pyfiction/technology/sidb_charge_state.hpp similarity index 100% rename from bindings/pyfiction/include/pyfiction/algorithms/simulation/sidb/sidb_charge_state.hpp rename to bindings/pyfiction/include/pyfiction/technology/sidb_charge_state.hpp diff --git a/bindings/pyfiction/include/pyfiction/technology/sidb_defects.hpp b/bindings/pyfiction/include/pyfiction/technology/sidb_defects.hpp index b1ccaf4e7..3c0dbff09 100644 --- a/bindings/pyfiction/include/pyfiction/technology/sidb_defects.hpp +++ b/bindings/pyfiction/include/pyfiction/technology/sidb_defects.hpp @@ -9,6 +9,7 @@ #include +#include #include namespace pyfiction @@ -17,7 +18,7 @@ namespace pyfiction inline void sidb_defects(pybind11::module& m) { namespace py = pybind11; - using namespace pybind11::literals; + using namespace py::literals; py::enum_(m, "sidb_defect_type", DOC(fiction_sidb_defect_type)) .value("NONE", fiction::sidb_defect_type::NONE, DOC(fiction_sidb_defect_type_NONE)) @@ -49,20 +50,18 @@ inline void sidb_defects(pybind11::module& m) .def_readonly("epsilon_r", &fiction::sidb_defect::epsilon_r, DOC(fiction_sidb_defect_epsilon_r)) .def_readonly("lambda_tf", &fiction::sidb_defect::lambda_tf, DOC(fiction_sidb_defect_lambda_tf)) - .def(py::self == py::self, "rhs"_a) - //, DOC(fiction_sidb_defect_operator_eq)) - .def(py::self != py::self, "rhs"_a) - //, DOC(fiction_sidb_defect_operator_ne)) + .def(py::self == py::self, "rhs"_a, DOC(fiction_sidb_defect_operator_eq)) + .def(py::self != py::self, "rhs"_a, DOC(fiction_sidb_defect_operator_ne)) ; m.def("is_charged_defect", &fiction::is_charged_defect, "defect"_a, DOC(fiction_is_charged_defect)); - m.def("is_positively_charged_defect", &fiction::is_positively_charged_defect, "defect"_a); - //, DOC(fiction_is_positively_charged_defect)); - m.def("is_negatively_charged_defect", &fiction::is_negatively_charged_defect, "defect"_a); - //, DOC(fiction_is_negatively_charged_defect)); - m.def("is_neutrally_charged_defect", &fiction::is_neutrally_charged_defect, "defect"_a); - // ,DOC(fiction_is_neutrally_charged_defect)); + m.def("is_positively_charged_defect", &fiction::is_positively_charged_defect, "defect"_a, + DOC(fiction_is_positively_charged_defect)); + m.def("is_negatively_charged_defect", &fiction::is_negatively_charged_defect, "defect"_a, + DOC(fiction_is_negatively_charged_defect)); + m.def("is_neutrally_charged_defect", &fiction::is_neutrally_charged_defect, "defect"_a, + DOC(fiction_is_neutrally_charged_defect)); m.def("defect_extent", &fiction::defect_extent, "defect"_a, DOC(fiction_defect_extent)); } diff --git a/bindings/pyfiction/include/pyfiction/technology/sidb_nm_position.hpp b/bindings/pyfiction/include/pyfiction/technology/sidb_nm_position.hpp new file mode 100644 index 000000000..3244b76e8 --- /dev/null +++ b/bindings/pyfiction/include/pyfiction/technology/sidb_nm_position.hpp @@ -0,0 +1,39 @@ +// +// Created by marcel on 21.11.23. +// + +#ifndef PYFICTION_SIDB_NM_POSITION_HPP +#define PYFICTION_SIDB_NM_POSITION_HPP + +#include "pyfiction/documentation.hpp" +#include "pyfiction/types.hpp" + +#include + +#include +#include + +namespace pyfiction +{ + +namespace detail +{ + +template +void sidb_nm_position(pybind11::module& m) +{ + using namespace pybind11::literals; + + m.def("sidb_nm_position", &fiction::sidb_nm_position, "sp"_a, "c"_a, DOC(fiction_sidb_nm_position)); +} + +} // namespace detail + +inline void sidb_nm_position(pybind11::module& m) +{ + detail::sidb_nm_position(m); +} + +} // namespace pyfiction + +#endif // PYFICTION_SIDB_NM_POSITION_HPP diff --git a/bindings/pyfiction/pyfiction.cpp b/bindings/pyfiction/pyfiction.cpp index a383943e7..9a86c86a0 100644 --- a/bindings/pyfiction/pyfiction.cpp +++ b/bindings/pyfiction/pyfiction.cpp @@ -36,7 +36,6 @@ // #include "pyfiction/algorithms/simulation/sidb/random_sidb_layout_generator.hpp" #include "pyfiction/algorithms/simulation/sidb/assess_physical_population_stability.hpp" #include "pyfiction/algorithms/simulation/sidb/convert_potential_to_distance.hpp" -#include "pyfiction/algorithms/simulation/sidb/sidb_charge_state.hpp" #include "pyfiction/algorithms/simulation/sidb/sidb_simulation_engine.hpp" #include "pyfiction/algorithms/simulation/sidb/sidb_simulation_parameters.hpp" #include "pyfiction/algorithms/simulation/sidb/sidb_simulation_result.hpp" @@ -69,7 +68,9 @@ #include "pyfiction/networks/truth_tables.hpp" #include "pyfiction/technology/area.hpp" #include "pyfiction/technology/charge_distribution_surface.hpp" +#include "pyfiction/technology/sidb_charge_state.hpp" #include "pyfiction/technology/sidb_defects.hpp" +#include "pyfiction/technology/sidb_nm_position.hpp" #include "pyfiction/utils/routing_utils.hpp" #include "pyfiction/utils/truth_table_utils.hpp" @@ -164,6 +165,7 @@ PYBIND11_MODULE(pyfiction, m) pyfiction::area(m); pyfiction::sidb_defects(m); pyfiction::sidb_charge_state(m); + pyfiction::sidb_nm_position(m); pyfiction::charge_distribution_surface(m); /** * Input/Output diff --git a/include/fiction/technology/sidb_nm_position.hpp b/include/fiction/technology/sidb_nm_position.hpp index 076197358..d0842f197 100644 --- a/include/fiction/technology/sidb_nm_position.hpp +++ b/include/fiction/technology/sidb_nm_position.hpp @@ -35,6 +35,7 @@ template return std::make_pair(x, y); } + } // namespace fiction #endif // FICTION_NM_POSITION_HPP