Molecular Dynamics Simulation
1.0
|
Wrapper class for a set of particles. More...
#include <DirectSumContainer.h>
Public Member Functions | |
DirectSumContainer ()=default | |
Default constructor. More... | |
DirectSumContainer (int n) | |
Constructor with amount of particles. More... | |
void | reserve (size_t n) override |
Reserves memory for particles. More... | |
std::size_t | size () const override |
Returns the amount of particles. More... | |
std::size_t | capacity () const |
Returns the capacity of the container. More... | |
void | addParticle (const Particle &p) override |
Adds a particle to the container. More... | |
void | addParticle (Particle &&p) override |
Adds a particle to the container. More... | |
Particle & | operator[] (int i) override |
Returns a particle. More... | |
std::vector< Particle >::iterator | begin () override |
Returns an iterator to the first particle. More... | |
std::vector< Particle >::iterator | end () override |
Returns an end iterator for this container. More... | |
std::vector< Particle >::const_iterator | begin () const override |
Returns a const iterator to the first particle. More... | |
std::vector< Particle >::const_iterator | end () const override |
Returns a const end iterator for this container. More... | |
const std::vector< Particle > & | getParticles () const override |
Returns a vector of all particles in the container. More... | |
void | prepareForceCalculation () override |
Prepares everything for the force calculations (must be called before applySimpleForces and applyPairwiseForces) More... | |
void | applySimpleForces (const std::vector< std::shared_ptr< SimpleForceSource >> &simple_force_sources) override |
Applies the given simple force sources to the particles. More... | |
void | applyPairwiseForces (const std::vector< std::shared_ptr< PairwiseForceSource >> &pairwise_force_sources) override |
Applies the given force sources to the particles. More... | |
void | applyTargettedForces (const std::vector< std::shared_ptr< TargettedForceSource >> &targetted_force_sources, double curr_simulation_time) override |
Applies the given targetted force sources to the particles. More... | |
Public Member Functions inherited from ParticleContainer | |
virtual | ~ParticleContainer ()=default |
Virtual destructor for correct deconstruction of inheriting classes. More... | |
Private Attributes | |
std::vector< Particle > | particles |
Internal data structure for the particles. More... | |
Wrapper class for a set of particles.
Container class for particles, which provides some convenience methods.
Definition at line 13 of file DirectSumContainer.h.
|
default |
Default constructor.
Generates an empty DirectSumContainer object. If the amount of particles is known, it is recommended to use the constructor with the amount of particles as parameter.
|
explicit |
Constructor with amount of particles.
n | Amount of particles |
Generates an empty DirectSumContainer object and reserves memory for the given amount of particles.
Definition at line 7 of file DirectSumContainer.cpp.
|
overridevirtual |
Adds a particle to the container.
p | Particle to be added |
Adds a particle to the container.
Implements ParticleContainer.
Definition at line 15 of file DirectSumContainer.cpp.
|
overridevirtual |
Adds a particle to the container.
p | Particle to be added |
Adds a particle to the container.
Implements ParticleContainer.
Definition at line 17 of file DirectSumContainer.cpp.
|
overridevirtual |
Applies the given force sources to the particles.
pairwise_force_sources | Vector of force sources to be applied |
Applies the given force sources to the particles in the container. Uses newton's third law to calculate the forces between the particles in a more optimized way.
Implements ParticleContainer.
Definition at line 42 of file DirectSumContainer.cpp.
|
overridevirtual |
Applies the given simple force sources to the particles.
simple_force_sources | List of simple force sources to be applied |
Applies the given simple force sources to the particles in the container.
Implements ParticleContainer.
Definition at line 33 of file DirectSumContainer.cpp.
|
overridevirtual |
Applies the given targetted force sources to the particles.
targetted_force_sources | List of targetted force sources to be applied |
curr_simulation_time | Current simulation time |
Applies the given targetted force sources to the particles in the container.
Implements ParticleContainer.
Definition at line 60 of file DirectSumContainer.cpp.
|
overridevirtual |
Returns a const iterator to the first particle.
Returns the begin const iterator for the internal data structure.
Implements ParticleContainer.
Definition at line 25 of file DirectSumContainer.cpp.
|
overridevirtual |
Returns an iterator to the first particle.
Returns the begin iterator for the internal data structure.
Implements ParticleContainer.
Definition at line 21 of file DirectSumContainer.cpp.
std::size_t DirectSumContainer::capacity | ( | ) | const |
Returns the capacity of the container.
Returns the capacity of the container.
Definition at line 13 of file DirectSumContainer.cpp.
|
overridevirtual |
Returns a const end iterator for this container.
Returns the end const iterator for the internal data structure.
Implements ParticleContainer.
Definition at line 27 of file DirectSumContainer.cpp.
|
overridevirtual |
Returns an end iterator for this container.
Returns the end iterator for the internal data structure.
Implements ParticleContainer.
Definition at line 23 of file DirectSumContainer.cpp.
|
overridevirtual |
Returns a vector of all particles in the container.
Implements ParticleContainer.
Definition at line 29 of file DirectSumContainer.cpp.
|
overridevirtual |
Returns a particle.
i | Index of the particle |
Returns the particle at the given index in the internal data structure.
Implements ParticleContainer.
Definition at line 19 of file DirectSumContainer.cpp.
|
overridevirtual |
Prepares everything for the force calculations (must be called before applySimpleForces and applyPairwiseForces)
Implements ParticleContainer.
Definition at line 31 of file DirectSumContainer.cpp.
|
overridevirtual |
Reserves memory for particles.
n | Amount of particles |
Reserves memory for the given amount of particles.
Implements ParticleContainer.
Definition at line 9 of file DirectSumContainer.cpp.
|
overridevirtual |
Returns the amount of particles.
Returns the amount of particles in the container.
Implements ParticleContainer.
Definition at line 11 of file DirectSumContainer.cpp.
|
private |
Internal data structure for the particles.
Definition at line 17 of file DirectSumContainer.h.