Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F80257800
ping_pong_balls_factory.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, Aug 30, 18:18
Size
1 KB
Mime Type
text/x-c
Expires
Sun, Sep 1, 18:18 (2 d)
Engine
blob
Format
Raw Data
Handle
20329890
Attached To
R7571 SP4E-TB-TL-FR
ping_pong_balls_factory.cc
View Options
#include "ping_pong_balls_factory.hh"
#include "compute_contact.hh"
#include "compute_verlet_integration.hh"
#include "csv_reader.hh"
#include "csv_writer.hh"
#include "ping_pong_ball.hh"
#include <cmath>
#include <iostream>
/* -------------------------------------------------------------------------- */
std
::
unique_ptr
<
Particle
>
PingPongBallsFactory
::
createParticle
()
{
return
std
::
make_unique
<
PingPongBall
>
();
}
/* -------------------------------------------------------------------------- */
SystemEvolution
&
PingPongBallsFactory
::
createSimulation
(
const
std
::
string
&
fname
,
Real
timestep
)
{
this
->
system_evolution
=
std
::
make_unique
<
SystemEvolution
>
(
std
::
make_unique
<
System
>
());
CsvReader
reader
(
fname
);
reader
.
read
(
this
->
system_evolution
->
getSystem
());
auto
contact
=
std
::
make_shared
<
ComputeContact
>
();
auto
verlet
=
std
::
make_shared
<
ComputeVerletIntegration
>
(
timestep
);
verlet
->
addInteraction
(
contact
);
this
->
system_evolution
->
addCompute
(
verlet
);
return
*
this
->
system_evolution
;
}
/* -------------------------------------------------------------------------- */
ParticlesFactoryInterface
&
PingPongBallsFactory
::
getInstance
()
{
if
(
not
ParticlesFactoryInterface
::
factory
)
ParticlesFactoryInterface
::
factory
=
new
PingPongBallsFactory
;
return
*
factory
;
}
/* -------------------------------------------------------------------------- */
Event Timeline
Log In to Comment