Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F63768136
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
Wed, May 22, 08:51
Size
2 KB
Mime Type
text/x-c
Expires
Fri, May 24, 08:51 (2 d)
Engine
blob
Format
Raw Data
Handle
17816705
Attached To
R9482 SP4E_Homework_Ashtari_Sieber
pypart.cc
View Options
#include <functional>
#include <iostream>
#include <pybind11/pybind11.h>
#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_
<
System
>
(
m
,
"System"
);
// Class SystemEvolution
py
::
class_
<
SystemEvolution
,
std
::
unique_ptr
<
SystemEvolution
>>
(
m
,
"SystemEvolution"
,
py
::
dynamic_attr
())
.
def
(
py
::
init
([](
std
::
unique_ptr
<
System
>
()){
return
std
::
unique_ptr
<
SystemEvolution
>
();}),
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_
<
ParticlesFactoryInterface
>
(
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_
<
MaterialPointsFactory
,
ParticlesFactoryInterface
,
std
::
shared_ptr
<
MaterialPointsFactory
>>
(
m
,
"MaterialPointsFactory"
)
.
def
(
"getInstance"
,
&
MaterialPointsFactory
::
getInstance
,
py
::
return_value_policy
::
reference
)
.
def
(
"createSimulation"
,
py
::
overload_cast
<
const
std
::
string
&
,
Real
,
py
::
function
>
(
&
MaterialPointsFactory
::
createSimulation
<
py
::
function
>
),
py
::
return_value_policy
::
reference
);
// Class PlanetsFactory
py
::
class_
<
PlanetsFactory
,
ParticlesFactoryInterface
,
std
::
shared_ptr
<
PlanetsFactory
>>
(
m
,
"PlanetsFactory"
)
.
def
(
"getInstance"
,
&
PlanetsFactory
::
getInstance
,
py
::
return_value_policy
::
reference
)
.
def
(
"createSimulation"
,
py
::
overload_cast
<
const
std
::
string
&
,
Real
,
bool
>
(
&
ParticlesFactoryInterface
::
createSimulation
),
py
::
return_value_policy
::
reference
);
}
Event Timeline
Log In to Comment