Particle Simulation Documentation
|
#include <universe.h>
Public Member Functions | |
Universe (const Config &config) | |
Initialize universe. | |
void | makeStep () |
Makes a simulation step. | |
void | saveStep (std::ofstream &file) |
Saves all particle positions in file. | |
void | addParticle (const Particle &particle) |
Adds a particle. | |
void | applyAccelerationToParticles (const std::array< double, 3 > &accelerationContribution) |
Sum an acceleration contribution to the actual acceleration of all particles. | |
void | computeGravitationalForces () |
Computes and applies gravitational forces between all particles. | |
void | computeParticleCollisions () |
Computes and resolve particle collisions between all particles. | |
void | computeBoxesCollision (Particle &particle) |
Compute and resolve particle collisions between all boxes. | |
std::vector< Particle > & | getParticles () |
Return the vector containing all particles. | |
void | toggleGravity () |
Toggle the gravitational forces. | |
bool | getIsGravity () |
Return the gravitational forces state. | |
Public Attributes | |
double | m_simuationTime = 0 |
Current time in the universe. | |
bool | m_isRunning = false |
Universe running state. | |
Private Attributes | |
const Config | m_config |
Configuration of the universe. | |
std::vector< Particle > | m_particles |
Vector containing all particles. | |
std::vector< Box > | m_boxes |
Vector containing all boxes. | |
bool | m_applyGravity |
Vector containing all boxes. | |
std::array< double, 3 > | m_globalAcceleration |
Acceleration force apply on all universe. | |
const double | m_G = 6.67430e-11 |
Gravitational constant. | |
Universe::Universe | ( | const Config & | config | ) |
Initialize universe.
[in] | config | The simulation configuration |
void Universe::addParticle | ( | const Particle & | particle | ) |
Adds a particle.
[in] | particle | The particle |
void Universe::applyAccelerationToParticles | ( | const std::array< double, 3 > & | accelerationContribution | ) |
Sum an acceleration contribution to the actual acceleration of all particles.
[in] | accelerationContribution | The acceleration contribution |
void Universe::computeBoxesCollision | ( | Particle & | particle | ) |
Compute and resolve particle collisions between all boxes.
particle | The particle |
void Universe::computeGravitationalForces | ( | ) |
Computes and applies gravitational forces between all particles.
void Universe::computeParticleCollisions | ( | ) |
Computes and resolve particle collisions between all particles.
bool Universe::getIsGravity | ( | ) |
Return the gravitational forces state.
std::vector< Particle > & Universe::getParticles | ( | ) |
Return the vector containing all particles.
void Universe::makeStep | ( | ) |
Makes a simulation step.
void Universe::saveStep | ( | std::ofstream & | file | ) |
Saves all particle positions in file.
file | The file where to save all positions |
void Universe::toggleGravity | ( | ) |
Toggle the gravitational forces.
|
private |
Vector containing all boxes.
|
private |
Vector containing all boxes.
|
private |
Configuration of the universe.
|
private |
Gravitational constant.
|
private |
Acceleration force apply on all universe.
bool Universe::m_isRunning = false |
Universe running state.
|
private |
Vector containing all particles.
double Universe::m_simuationTime = 0 |
Current time in the universe.