Page MenuHomec4science

pypart.cc
No OneTemporary

File Metadata

Created
Sat, Apr 20, 03:38

pypart.cc

#include <functional>
#include <iostream>
#include <pybind11/pybind11.h>
#include "material_points_factory.hh"
#include "ping_pong_balls_factory.hh"
#include "planets_factory.hh"
#include "csv_writer.hh"
#include "compute_temperature.hh"
#include "compute_gravity.hh"
#include "compute_verlet_integration.hh"
#include "compute_interaction.hh"
namespace py = pybind11;
PYBIND11_MODULE(pypart, m) {
m.doc() = "pybind pypart plugin"; // optional docstring
// TODO:
// The member functions of the various classes (used in main.py) must be exposed to pybind
// Exercise 1 - Question 1, 2, 3
py::class_<ParticlesFactoryInterface>(m, "ParticlesFactoryInterface")
.def("createSimulation", py::overload_cast<const std::string, Real>(&ParticlesFactoryInterface::createSimulation), "create simulation without functor")
.def("createSimulation", py::overload_cast<const std::string, Real, Func>(&ParticlesFactoryInterface::createSimulation), "create simulation with function");
py::class_<MaterialPointsFactory>(m, "MaterialPointsFactory" ); // inherits from ParticlesFactoryInterface
py::class_<PingPongBallsFactory>(m, "PingPongBallsFactory" ); // inherits from ParticlesFactoryInterface
py::class_<PlanetsFactory>(m, "PlanetsFactory" ); // inherits from ParticlesFactoryInterface
// Exercise 2 - Question 1
py::class_<Compute>(m, "Compute" );
py::class_<CsvWriter>(m, "CsvWriter" ); // inherits from Compute
py::class_<ComputeTemperature>(m, "ComputeTemperature" ); // inherits from Compute
py::class_<ComputeGravity>(m, "ComputeGravity" ); // inherits from Compute
py::class_<ComputeVerletIntegration>(m, "ComputeVerletIntegration"); // inherits from Compute
py::class_<ComputeInteraction>(m, "ComputeInteraction" ); // inherits from Compute
// Should we use the inheritance class in pybind??? Like below?
//py::class_<PingPongBallsFactory, ParticlesFactoryInterface>(m, "PingPongBallsFactory");
}

Event Timeline