Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F74939250
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
Tue, Jul 30, 12:19
Size
1 KB
Mime Type
text/x-c
Expires
Thu, Aug 1, 12:19 (2 d)
Engine
blob
Format
Raw Data
Handle
19459122
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