Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F60868029
pypart.cc
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, May 3, 01:17
Size
2 KB
Mime Type
text/x-c
Expires
Sun, May 5, 01:17 (2 d)
Engine
blob
Format
Raw Data
Handle
17432414
Attached To
R9484 sp4e-homework-lars-bertil
pypart.cc
View Options
#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"
);
// DOES NOT COMPILE:
//.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
Log In to Comment