Page MenuHomec4science

compute_verlet_integration.cc
No OneTemporary

File Metadata

Created
Mon, Jun 3, 22:56

compute_verlet_integration.cc

#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