Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F87781337
planets_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
Mon, Oct 14, 22:22
Size
1 KB
Mime Type
text/x-c
Expires
Wed, Oct 16, 22:22 (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
21542741
Attached To
R7571 SP4E-TB-TL-FR
planets_factory.cc
View Options
#include "planets_factory.hh"
#include "compute_gravity.hh"
#include "compute_verlet_integration.hh"
#include "csv_reader.hh"
#include "csv_writer.hh"
#include "planet.hh"
#include <cmath>
/* -------------------------------------------------------------------------- */
std
::
unique_ptr
<
Particle
>
PlanetsFactory
::
createParticle
()
{
return
std
::
make_unique
<
Planet
>
();
}
/* -------------------------------------------------------------------------- */
SystemEvolution
&
PlanetsFactory
::
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
gravity
=
std
::
make_shared
<
ComputeGravity
>
();
auto
verlet
=
std
::
make_shared
<
ComputeVerletIntegration
>
(
timestep
);
verlet
->
addInteraction
(
gravity
);
this
->
system_evolution
->
addCompute
(
verlet
);
return
*
this
->
system_evolution
;
}
/* -------------------------------------------------------------------------- */
ParticlesFactoryInterface
&
PlanetsFactory
::
getInstance
()
{
if
(
not
ParticlesFactoryInterface
::
factory
)
ParticlesFactoryInterface
::
factory
=
new
PlanetsFactory
;
return
*
factory
;
}
/* -------------------------------------------------------------------------- */
Event Timeline
Log In to Comment