1 #include "AllClassWrappers.h"
10 #include <pybind11/pybind11.h>
11 #include <pybind11/stl.h>
12 #include <pybind11/eigen.h>
16 #include <boost/any.hpp>
29 py::class_<WorkPiece, std::shared_ptr<WorkPiece>> wp(m,
"WorkPiece");
31 .def(
"Evaluate", (std::vector<boost::any>
const& (WorkPiece::*)(std::vector<boost::any>
const&)) &
WorkPiece::Evaluate)
35 py::class_<IdentityPiece, WorkPiece, std::shared_ptr<IdentityPiece>> ip(m,
"IdentityPiece");
38 .def(py::init<int const>())
39 .def(py::init<std::vector<std::string>
const&>())
40 .def(py::init<std::map<unsigned int, std::string>
const&>())
41 .def(py::init<std::map<unsigned int, std::string>
const&,
unsigned int const>());
44 py::class_<ConstantPiece, WorkPiece, std::shared_ptr<ConstantPiece>> cp(m,
"ConstantPiece");
46 .def(py::init<std::vector<boost::any>
const&>())
47 .def(py::init<boost::any const&>());
50 py::class_<WorkGraphPiece, WorkPiece, std::shared_ptr<WorkGraphPiece>> wgp(m,
"WorkGraphPiece");
53 py::class_<WorkGraph> wg(m,
"WorkGraph");
61 .def(
"GetPiece", (std::shared_ptr<WorkPiece> (WorkGraph::*)(std::string
const&)) &
WorkGraph::GetPiece)
62 .def(
"GetName", (std::string (WorkGraph::*)(std::shared_ptr<WorkPiece>
const&)
const) &
WorkGraph::GetName)
void AddNode(std::shared_ptr< WorkPiece > input, std::string const &name)
Add a new node to the graph.
void AddEdge(std::string const &nameFrom, unsigned int const outputDim, std::string const &nameTo, unsigned int const inputDim)
Add a new edge to the graph.
unsigned int NumEdges() const
Get the number of edgess in the graph.
std::shared_ptr< WorkGraph > DependentCut(std::string const &nameOut) const
Create a new graph cutting any of the nodes that do not affect the output node.
virtual std::shared_ptr< WorkGraph > Clone() const
std::shared_ptr< ModGraphPiece > CreateModPiece(std::string const &node, std::vector< std::string > const &inNames=std::vector< std::string >()) const
Create a muq::Modeling::ModPiece whose output matches a given node.
std::shared_ptr< WorkPiece > GetPiece(std::string const &name)
std::string GetName(std::shared_ptr< WorkPiece > piece) const
void Visualize(std::string const &filename) const
Visualize the graph.
std::shared_ptr< WorkGraphPiece > CreateWorkPiece(std::string const &node) const
Create a muq::Modeling::WorkPiece whose output matches a given node.
std::vector< boost::any > const & GetConstantOutputs(std::string const &node) const
Get the output values for a constant node.
unsigned int NumNodes() const
Get the number of nodes in the graph.
bool Constant(std::string const &node) const
Check to see if a node is constant?
bool HasNode(std::string const &name) const
Is the given node in the graph?
std::vector< boost::any > const & Evaluate()
Evaluate this muq::Modeling::WorkPiece in the case that there are no inputs.
void WorkPieceWrapper(pybind11::module &m)