Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90970008
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
Wed, Nov 6, 12:41
Size
1 KB
Mime Type
text/x-c
Expires
Fri, Nov 8, 12:41 (2 d)
Engine
blob
Format
Raw Data
Handle
22163940
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
)
{
UInt
size
=
system
.
getNbParticles
();
for
(
auto
&
par
:
system
)
{
par
.
getVelocity
()
+=
.5
*
dt
*
par
.
getForce
()
/
par
.
getMass
();
par
.
getPosition
()
+=
dt
*
par
.
getVelocity
();
}
auto
&
sun
=
system
.
getParticle
(
0
);
sun
.
getPosition
()
=
0
;
for
(
auto
&
interaction
:
interactions
)
interaction
->
compute
(
system
);
for
(
auto
&
par
:
system
)
{
par
.
getVelocity
()
+=
.5
*
dt
*
par
.
getForce
()
/
par
.
getMass
();
}
}
/* -------------------------------------------------------------------------- */
void
ComputeVerletIntegration
::
addInteraction
(
std
::
shared_ptr
<
ComputeInteraction
>
interaction
)
{
interactions
.
push_back
(
interaction
);
}
Event Timeline
Log In to Comment