diff --git a/Homework4/src/pypart.cc b/Homework4/src/pypart.cc index b56c6d0..ddfa803 100644 --- a/Homework4/src/pypart.cc +++ b/Homework4/src/pypart.cc @@ -1,52 +1,68 @@ #include #include #include #include "system_evolution.hh" #include "particles_factory_interface.hh" #include "csv_writer.hh" #include "compute.hh" #include "compute_temperature.hh" #include "material_points_factory.hh" #include "ping_pong_balls_factory.hh" #include "planets_factory.hh" namespace py = pybind11; PYBIND11_MODULE(pypart, m) { m.doc() = "Python binding for the particles code."; + // Class System py::class_(m, "System"); + // Class SystemEvolution py::class_>(m, "SystemEvolution", py::dynamic_attr()) .def(py::init([](std::unique_ptr()){return std::unique_ptr();}), py::return_value_policy::move) .def("evolve", &SystemEvolution::evolve) .def("addCompute", &SystemEvolution::addCompute) .def("getSystem", &SystemEvolution::getSystem, py::return_value_policy::reference) .def("setNSteps", &SystemEvolution::setNSteps) .def("setDumpFreq", &SystemEvolution::setDumpFreq); + // Class ParticlesFactoryInterface py::class_(m, "ParticlesFactoryInterface", py::dynamic_attr()) .def_static("getInstance", &ParticlesFactoryInterface::getInstance, py::return_value_policy::reference) .def("getSystemEvolution", &ParticlesFactoryInterface::getSystemEvolution, py::return_value_policy::reference) .def_property_readonly("system_evolution",&ParticlesFactoryInterface::getSystemEvolution); + // Class MaterialPointsFactory py::class_>(m, "MaterialPointsFactory") .def("getInstance", &MaterialPointsFactory::getInstance, py::return_value_policy::reference) .def("createSimulation", py::overload_cast( &MaterialPointsFactory::createSimulation), py::return_value_policy::reference); + + + // Class PlanetsFactory + py::class_>(m, "PlanetsFactory") + + .def("getInstance", &PlanetsFactory::getInstance, + py::return_value_policy::reference) + .def("createSimulation", + py::overload_cast( + &ParticlesFactoryInterface::createSimulation), + py::return_value_policy::reference); }