2025-07-23 16:26:30 -04:00
|
|
|
#include "gridfire/solver/solver.h"
|
|
|
|
|
|
|
|
|
|
#include <pybind11/pybind11.h>
|
|
|
|
|
#include <pybind11/stl.h>
|
|
|
|
|
|
|
|
|
|
#include <vector>
|
2025-07-31 15:04:57 -04:00
|
|
|
#include <tuple>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <any>
|
2025-07-23 16:26:30 -04:00
|
|
|
|
|
|
|
|
#include "py_solver.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace py = pybind11;
|
|
|
|
|
|
|
|
|
|
gridfire::NetOut PyDynamicNetworkSolverStrategy::evaluate(const gridfire::NetIn &netIn) {
|
|
|
|
|
PYBIND11_OVERRIDE_PURE(
|
|
|
|
|
gridfire::NetOut, // Return type
|
|
|
|
|
gridfire::solver::DynamicNetworkSolverStrategy, // Base class
|
|
|
|
|
evaluate, // Method name
|
|
|
|
|
netIn // Arguments
|
|
|
|
|
);
|
|
|
|
|
}
|
2025-07-31 15:04:57 -04:00
|
|
|
|
|
|
|
|
void PyDynamicNetworkSolverStrategy::set_callback(const std::any &callback) {
|
|
|
|
|
PYBIND11_OVERRIDE_PURE(
|
|
|
|
|
void,
|
|
|
|
|
gridfire::solver::DynamicNetworkSolverStrategy, // Base class
|
|
|
|
|
set_callback, // Method name
|
|
|
|
|
callback // Arguments
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::vector<std::tuple<std::string, std::string>> PyDynamicNetworkSolverStrategy::describe_callback_context() const {
|
|
|
|
|
using DescriptionVector = std::vector<std::tuple<std::string, std::string>>;
|
|
|
|
|
PYBIND11_OVERRIDE_PURE(
|
|
|
|
|
DescriptionVector, // Return type
|
|
|
|
|
gridfire::solver::DynamicNetworkSolverStrategy, // Base class
|
|
|
|
|
describe_callback_context // Method name
|
|
|
|
|
);
|
|
|
|
|
}
|
2025-10-30 15:05:08 -04:00
|
|
|
|
|
|
|
|
std::vector<std::tuple<std::string, std::string>> PySolverContextBase::describe() const {
|
|
|
|
|
using DescriptionVector = std::vector<std::tuple<std::string, std::string>>;
|
|
|
|
|
PYBIND11_OVERRIDE_PURE(
|
|
|
|
|
DescriptionVector,
|
|
|
|
|
gridfire::solver::SolverContextBase,
|
|
|
|
|
describe
|
|
|
|
|
);
|
|
|
|
|
}
|