Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F65458156
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
Mon, Jun 3, 22:56
Size
1 KB
Mime Type
text/x-c
Expires
Wed, Jun 5, 22:56 (2 d)
Engine
blob
Format
Raw Data
Handle
18075171
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
// std::cout << "Velocity: " << ptc.getVelocity() << std::endl;
// std::cout << "Mass: " << ptc.getMass() << std::endl;
ptc
.
getVelocity
()
+=
this
->
dt
*
ptc
.
getForce
()
/
ptc
.
getMass
();
// std::cout << "New velocity: " << ptc.getVelocity() << std::endl;
ptc
.
getPosition
()
+=
this
->
dt
*
ptc
.
getVelocity
();
// Compute forces TO IMPLEMENT
ptc
.
getVelocity
()
+=
this
->
dt
*
ptc
.
getForce
()
/
ptc
.
getMass
();
}
}
/* -------------------------------------------------------------------------- */
void
ComputeVerletIntegration
::
addInteraction
(
std
::
shared_ptr
<
ComputeInteraction
>
interaction
)
{
}
Event Timeline
Log In to Comment