An Algorithm that implements Octrees . More...
#include <octreealgorithm.h>
Public Member Functions | |
OctreeAlgorithm (int xIn, int yIn, int zIn, int numParticlesIn) | |
Constructs a OctreeAlgorithm object. More... | |
OctreeAlgorithm (int xIn, int yIn, int zIn, double centerMassIn, int numParticlesIn) | |
Constructs a OctreeAlgorithm object. More... | |
Public Member Functions inherited from Algorithm | |
Algorithm (double xIn, double yIn) | |
Constructs a 2 dimensional Algorithm. More... | |
Algorithm (double xIn, double yIn, double zIn) | |
Constructs a 3 dimensional Algorithm. More... | |
Algorithm (double xIn, double yIn, double zIn, double centerMass) | |
Constructs a 3 dimensional Algorithm with orbital Physics. More... | |
std::vector< Particle * > | getParticles () |
Returns the vector of Particles that the algorithm is tracking. More... | |
std::queue< Collision * > * | getCollisions () |
Returns the queue of Collisions that we haven't entered the warning window yet. More... | |
MultiQueue * | getPositionQueue () |
Returns the MultiQueue that contains upcoming Positions for each Particle. More... | |
std::mutex * | getCollisionMutex () |
Returns the Mutex locking the Collision queue. More... | |
Particle * | getCenterOfGravity () |
Returns the massive Particle in the center responsible for Gravitation. More... | |
int | getNumParts () |
Returns the number of Particles the Algorithm is tracking. More... | |
int | getTimestep () |
Returns the timestep the Algorithm is currently calculating. More... | |
double | getSystemKE () |
Returns the system kinetic energy which is updated each timestep. More... | |
double | getSystemPE () |
Returns system potential energy which is updated each timestep. More... | |
Physics * | getPhysics () |
Returns the Physics object working for this Algorithm. More... | |
void | setNumParts (int numParticles) |
Sets the number of Particles the Algorithm is tracking. More... | |
void | createParticles2D (int numParticles) |
Sets the number of Particles, then generates that many to track. More... | |
void | createParticles3D (int numParticles) |
Sets the number of Particles, then generates that many to track. More... | |
void | createParticlesOrbit (int numParticles) |
Sets the number of Particles, then generates that many to track. More... | |
void | respawnParticle (Particle *particle) |
void | enqueueCollisions (std::vector< Collision * > collisions) |
Pushes Collisions from the most recent timestep onto the queue of upcoming Collision$s. More... | |
void | runOneTimestep () |
Calculates the next timestep. More... | |
void | run () |
void | stop () |
void | stepTime () |
Calculates the next timestep and sets running to true. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Algorithm | |
Particle * | generateParticleIn2D (int i) |
Particle * | generateParticleIn3D (int i) |
Particle * | generateParticleInOrbit (int i) |
void | regenerateParticleInOrbit (Particle *p) |
bool | checkForOverlap (Particle *p) |
void | enqueuePositions () |
void | updateSystemKE () |
void | updateSystemPE () |
void | rescaleVelocities () |
void | checkTimestep () |
Protected Attributes inherited from Algorithm | |
std::vector< Particle * > | particles |
std::queue< Collision * > | collisionQueue |
std::mutex | collisionMutex |
MultiQueue * | positionQueue |
Physics * | physics |
bool | running |
int | numParts |
int | timestep |
double | xWinSize |
double | yWinSize |
double | zWinSize |
double | systemKE |
double | systemPE |
An Algorithm that implements Octrees .
An Algorithm that implements Octrees as a way to limit the number of collision checks.
OctreeAlgorithm::OctreeAlgorithm | ( | int | xIn, |
int | yIn, | ||
int | zIn, | ||
int | numParticlesIn | ||
) |
Constructs a OctreeAlgorithm object.
Constructs a OctreeAlgorithm object based on the given parameters.
xIn | the X dimension of the space in which Particles will exist. |
yIn | the Y dimension of the space in which Particles will exist. |
zIn | the Z dimension of the space in which Particles will exist. |
numParticlesIn | the number of Particles. |
OctreeAlgorithm::OctreeAlgorithm | ( | int | xIn, |
int | yIn, | ||
int | zIn, | ||
double | centerMassIn, | ||
int | numParticlesIn | ||
) |
Constructs a OctreeAlgorithm object.
Constructs a OctreeAlgorithm object based on the given parameters.
xIn | the X dimension of the space in which Particles will exist. |
yIn | the Y dimension of the space in which Particles will exist. |
zIn | the Z dimension of the space in which Particles will exist. |
centerMassIn | the mass of the Particle that represents the center of gravity. |
numParticlesIn | the number of Particles . |