Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F81406518
compute_verlet_integration.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
Thu, Sep 5, 21:30
Size
1 KB
Mime Type
text/x-c
Expires
Sat, Sep 7, 21:30 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
20560991
Attached To
R7571 SP4E-TB-TL-FR
compute_verlet_integration.cc
View Options
#include "compute_verlet_integration.hh"
ComputeVerletIntegration
::
ComputeVerletIntegration
(
Real
dt
)
:
dt
(
dt
)
{}
/* -------------------------------------------------------------------------- */
void
ComputeVerletIntegration
::
setDeltaT
(
Real
dt
)
{
this
->
dt
=
dt
;
}
/* -------------------------------------------------------------------------- */
void
ComputeVerletIntegration
::
compute
(
System
&
system
)
{
// Perfom Verlet integration for all the particles
for
(
UInt
i
=
0
;
i
<
system
.
getNbParticles
();
i
++
){
// Get particle
Particle
&
ptc
=
system
.
getParticle
(
i
);
// Update values
ptc
.
getVelocity
()
+=
this
->
dt
*
ptc
.
getForce
()
/
(
2.
*
ptc
.
getMass
());
ptc
.
getPosition
()
+=
this
->
dt
*
ptc
.
getVelocity
();
// Compute forces TO IMPLEMENT
ptc
.
getVelocity
()
+=
this
->
dt
*
ptc
.
getForce
()
/
(
2.
*
ptc
.
getMass
());
}
// Set first particle to position and velocity = {0,0,0} to simulate the sun
system
.
getParticle
(
0
).
getVelocity
()
=
0.0
;
system
.
getParticle
(
0
).
getPosition
()
=
0.0
;
}
/* -------------------------------------------------------------------------- */
void
ComputeVerletIntegration
::
addInteraction
(
std
::
shared_ptr
<
ComputeInteraction
>
interaction
)
{
}
Event Timeline
Log In to Comment