-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Added detect_bdl_pairs to pyfiction
- Loading branch information
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
62 changes: 62 additions & 0 deletions
62
bindings/pyfiction/include/pyfiction/algorithms/simulation/sidb/detect_bdl_pairs.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// | ||
// Created by marcel on 21.11.23. | ||
// | ||
|
||
#ifndef PYFICTION_DETECT_BDL_PAIRS_HPP | ||
#define PYFICTION_DETECT_BDL_PAIRS_HPP | ||
|
||
#include "pyfiction/documentation.hpp" | ||
#include "pyfiction/types.hpp" | ||
|
||
#include <fiction/algorithms/simulation/sidb/detect_bdl_pairs.hpp> | ||
|
||
#include <pybind11/pybind11.h> | ||
#include <pybind11/stl.h> | ||
|
||
namespace pyfiction | ||
{ | ||
|
||
namespace detail | ||
{ | ||
|
||
template <typename Lyt> | ||
void detect_bdl_pairs(pybind11::module& m) | ||
{ | ||
namespace py = pybind11; | ||
using namespace pybind11::literals; | ||
|
||
py::class_<fiction::bdl_pair<Lyt>>(m, "bdl_pair", DOC(fiction_bdl_pair)) | ||
.def(py::init<>(), DOC(fiction_bdl_pair_bdl_pair)) | ||
.def(py::init<fiction::sidb_technology::cell_type, fiction::cell<Lyt>, fiction::cell<Lyt>>(), "t"_a, "u"_a, | ||
"l"_a, DOC(fiction_bdl_pair_bdl_pair_2)) | ||
.def_readonly("type", &fiction::bdl_pair<Lyt>::type, DOC(fiction_bdl_pair_type)) | ||
.def_readonly("upper", &fiction::bdl_pair<Lyt>::upper, DOC(fiction_bdl_pair_upper)) | ||
.def_readonly("lower", &fiction::bdl_pair<Lyt>::lower, DOC(fiction_bdl_pair_lower)) | ||
|
||
; | ||
|
||
m.def("detect_bdl_pairs", &fiction::detect_bdl_pairs<Lyt>, "lyt"_a, "type"_a, | ||
"params"_a = fiction::detect_bdl_pairs_params{}, DOC(fiction_detect_bdl_pairs)); | ||
} | ||
|
||
} // namespace detail | ||
|
||
inline void detect_bdl_pairs(pybind11::module& m) | ||
{ | ||
namespace py = pybind11; | ||
|
||
py::class_<fiction::detect_bdl_pairs_params>(m, "detect_bdl_pairs_params", DOC(fiction_detect_bdl_pairs_params)) | ||
.def(py::init<>()) | ||
.def_readwrite("minimum_distance", &fiction::detect_bdl_pairs_params::minimum_distance, | ||
DOC(fiction_detect_bdl_pairs_params_minimum_distance)) | ||
.def_readwrite("maximum_distance", &fiction::detect_bdl_pairs_params::maximum_distance, | ||
DOC(fiction_detect_bdl_pairs_params_maximum_distance)); | ||
|
||
// NOTE be careful with the order of the following calls! Python will resolve the first matching overload! | ||
|
||
detail::detect_bdl_pairs<py_charge_distribution_surface>(m); | ||
} | ||
|
||
} // namespace pyfiction | ||
|
||
#endif // PYFICTION_DETECT_BDL_PAIRS_HPP |