4 #include "multiqueue.h"
44 Algorithm(
double xIn,
double yIn,
double zIn);
59 Algorithm(
double xIn,
double yIn,
double zIn,
double centerMass);
184 void respawnParticle(
Particle* particle);
227 std::vector<Particle*> particles;
229 std::queue<Collision*> collisionQueue;
230 std::mutex collisionMutex;
244 Particle* generateParticleIn2D(
int i);
245 Particle* generateParticleIn3D(
int i);
246 Particle* generateParticleInOrbit(
int i);
247 void regenerateParticleInOrbit(
Particle* p);
250 virtual void calculateNextTimestep() = 0;
252 void enqueuePositions();
254 void updateSystemKE();
255 void updateSystemPE();
256 void rescaleVelocities();
258 void checkTimestep();
261 #endif // ALGORITHM_H
The Algorithm class is a parent to all the specific Algorithms we test.
Definition: algorithm.h:16
void runOneTimestep()
Calculates the next timestep.
Definition: algorithm.cpp:343
void createParticlesOrbit(int numParticles)
Sets the number of Particles, then generates that many to track.
Definition: algorithm.cpp:233
Physics * getPhysics()
Returns the Physics object working for this Algorithm.
Definition: algorithm.cpp:298
void setNumParts(int numParticles)
Sets the number of Particles the Algorithm is tracking.
Definition: algorithm.cpp:302
double getSystemPE()
Returns system potential energy which is updated each timestep.
Definition: algorithm.cpp:294
int getTimestep()
Returns the timestep the Algorithm is currently calculating.
Definition: algorithm.cpp:276
void createParticles2D(int numParticles)
Sets the number of Particles, then generates that many to track.
Definition: algorithm.cpp:201
Definition: multiqueue.h:8
void enqueueCollisions(std::vector< Collision * > collisions)
Pushes Collisions from the most recent timestep onto the queue of upcoming Collision$s.
Definition: algorithm.cpp:332
The Physics class.
Definition: physics.h:15
int getNumParts()
Returns the number of Particles the Algorithm is tracking.
Definition: algorithm.cpp:271
void stepTime()
Calculates the next timestep and sets running to true.
Definition: algorithm.cpp:389
MultiQueue * getPositionQueue()
Returns the MultiQueue that contains upcoming Positions for each Particle.
Definition: algorithm.cpp:281
Definition: particle.h:12
std::mutex * getCollisionMutex()
Returns the Mutex locking the Collision queue.
Definition: algorithm.cpp:286
std::vector< Particle * > getParticles()
Returns the vector of Particles that the algorithm is tracking.
Definition: algorithm.cpp:263
void createParticles3D(int numParticles)
Sets the number of Particles, then generates that many to track.
Definition: algorithm.cpp:217
std::queue< Collision * > * getCollisions()
Returns the queue of Collisions that we haven't entered the warning window yet.
Definition: algorithm.cpp:267
double getSystemKE()
Returns the system kinetic energy which is updated each timestep.
Definition: algorithm.cpp:290
Particle * getCenterOfGravity()
Returns the massive Particle in the center responsible for Gravitation.
Definition: algorithm.cpp:61
Algorithm(double xIn, double yIn)
Constructs a 2 dimensional Algorithm.
Definition: algorithm.cpp:7