Skip to content

Commit

Permalink
Add FastADC python bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
ol-imorozko committed Jan 14, 2025
1 parent 11aedfe commit 88a7b1f
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/core/algorithms/dc/FastADC/fastadc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "descriptions.h"
#include "names.h"

namespace algos::fastadc {
namespace algos::dc {

FastADC::FastADC() : Algorithm({}) {
RegisterOptions();
Expand Down Expand Up @@ -139,8 +139,9 @@ unsigned long long FastADC::ExecuteInternal() {
return elapsed_milliseconds.count();
}

// TODO: mb make this a list?
std::vector<DenialConstraint> const& FastADC::GetDCs() const {
return dcs_.GetResult();
}

} // namespace algos::fastadc
} // namespace algos::dc
7 changes: 4 additions & 3 deletions src/core/algorithms/dc/FastADC/fastadc.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
#include "table/column_layout_typed_relation_data.h"
#include "tabular_data/input_table_type.h"

namespace algos::fastadc {
namespace algos::dc {

/* using namespace fastadc; */
using namespace fastadc;

class FastADC : public Algorithm {
private:
Expand Down Expand Up @@ -47,6 +47,7 @@ class FastADC : public Algorithm {
string_prov_.Clear();
dcs_.Clear();
}

unsigned long long ExecuteInternal() final;

void RegisterOptions();
Expand All @@ -57,4 +58,4 @@ class FastADC : public Algorithm {
std::vector<DenialConstraint> const& GetDCs() const;
};

} // namespace algos::fastadc
} // namespace algos::dc
4 changes: 3 additions & 1 deletion src/python_bindings/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "cfd/bind_cfd.h"
#include "data/bind_data_types.h"
#include "dc/bind_dc_verification.h"
#include "dc/bind_fastadc.h"
#include "dd/bind_split.h"
#include "dynamic/bind_dynamic_fd_verification.h"
#include "fd/bind_fd.h"
Expand Down Expand Up @@ -65,7 +66,8 @@ PYBIND11_MODULE(desbordante, module, pybind11::mod_gil_not_used()) {
BindSFD,
BindMd,
BindDCVerification,
BindPfdVerification}) {
BindPfdVerification,
BindFastADC}) {
bind_func(module);
}
}
Expand Down
23 changes: 23 additions & 0 deletions src/python_bindings/dc/bind_fastadc.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "bind_fastadc.h"

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

#include "algorithms/dc/FastADC/fastadc.h"
#include "py_util/bind_primitive.h"

namespace {
namespace py = pybind11;
} // namespace

namespace python_bindings {
void BindFastADC(py::module_& main_module) {
using namespace algos;
using DC = algos::fastadc::DenialConstraint;

auto dc_module = main_module.def_submodule("dc");
py::class_<DC>(dc_module, "DC").def("__str__", &DC::ToString).def("__repr__", &DC::ToString);

BindPrimitiveNoBase<dc::FastADC>(dc_module, "FastADC").def("get_dcs", &dc::FastADC::GetDCs);
}
} // namespace python_bindings
7 changes: 7 additions & 0 deletions src/python_bindings/dc/bind_fastadc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <pybind11/pybind11.h>

namespace python_bindings {
void BindFastADC(pybind11::module_& main_module);
} // namespace python_bindings

0 comments on commit 88a7b1f

Please sign in to comment.