Molecular Dynamics Simulation  1.0
Public Member Functions | List of all members
ParticleContainer Class Referenceabstract

Interface for particle containers. More...

#include <ParticleContainer.h>

Inheritance diagram for ParticleContainer:
Inheritance graph
Collaboration diagram for ParticleContainer:
Collaboration graph

Public Member Functions

virtual ~ParticleContainer ()=default
 Virtual destructor for correct deconstruction of inheriting classes. More...
 
virtual void addParticle (const Particle &p)=0
 Adds a particle to the container. More...
 
virtual void addParticle (Particle &&p)=0
 Adds a particle to the container. More...
 
virtual void prepareForceCalculation ()=0
 Prepares everything for the force calculations (must be called before applySimpleForces and applyPairwiseForces) More...
 
virtual void applySimpleForces (const std::vector< std::shared_ptr< SimpleForceSource >> &simple_force_sources)=0
 Applies the given simple force sources to the particles. More...
 
virtual void applyPairwiseForces (const std::vector< std::shared_ptr< PairwiseForceSource >> &pairwise_force_sources)=0
 Applies the given pairwise force sources to the particles. More...
 
virtual void applyTargettedForces (const std::vector< std::shared_ptr< TargettedForceSource >> &targetted_force_sources, double curr_simulation_time)=0
 Applies the given targetted force sources to the particles. More...
 
virtual void reserve (size_t n)=0
 Reserves space for n particles. More...
 
virtual size_t size () const =0
 Returns the number of particles in the container. More...
 
virtual Particleoperator[] (int i)=0
 Overload of the [] operator to access the particles in the container. More...
 
virtual std::vector< Particle >::iterator begin ()=0
 The begin iterator for the internal data structure. More...
 
virtual std::vector< Particle >::iterator end ()=0
 The end iterator for the internal data structure. More...
 
virtual std::vector< Particle >::const_iterator begin () const =0
 The begin const iterator for the internal data structure. More...
 
virtual std::vector< Particle >::const_iterator end () const =0
 The end const iterator for the internal data structure. More...
 
virtual const std::vector< Particle > & getParticles () const =0
 Returns a vector of all particles in the container. More...
 

Detailed Description

Interface for particle containers.

This class defines the interface for particle containers. Further information about the implementation can be found in Particle Containers

Definition at line 17 of file ParticleContainer.h.

Constructor & Destructor Documentation

◆ ~ParticleContainer()

virtual ParticleContainer::~ParticleContainer ( )
virtualdefault

Virtual destructor for correct deconstruction of inheriting classes.

Member Function Documentation

◆ addParticle() [1/2]

virtual void ParticleContainer::addParticle ( const Particle p)
pure virtual

Adds a particle to the container.

Parameters
pParticle to be added

Adds a particle to the container.

Implemented in LinkedCellsContainer, and DirectSumContainer.

◆ addParticle() [2/2]

virtual void ParticleContainer::addParticle ( Particle &&  p)
pure virtual

Adds a particle to the container.

Parameters
pParticle to be added

Adds a particle to the container.

Implemented in LinkedCellsContainer, and DirectSumContainer.

◆ applyPairwiseForces()

virtual void ParticleContainer::applyPairwiseForces ( const std::vector< std::shared_ptr< PairwiseForceSource >> &  pairwise_force_sources)
pure virtual

Applies the given pairwise force sources to the particles.

Parameters
pairwise_force_sourcesList of pairwise force sources to be applied

Applies the given pairwise force sources to the particles in the container. Uses newton's third law to calculate the forces between the particles in an optimized way.

Implemented in DirectSumContainer, and LinkedCellsContainer.

◆ applySimpleForces()

virtual void ParticleContainer::applySimpleForces ( const std::vector< std::shared_ptr< SimpleForceSource >> &  simple_force_sources)
pure virtual

Applies the given simple force sources to the particles.

Parameters
simple_force_sourcesList of simple force sources to be applied

Applies the given simple force sources to the particles in the container.

Implemented in LinkedCellsContainer, and DirectSumContainer.

◆ applyTargettedForces()

virtual void ParticleContainer::applyTargettedForces ( const std::vector< std::shared_ptr< TargettedForceSource >> &  targetted_force_sources,
double  curr_simulation_time 
)
pure virtual

Applies the given targetted force sources to the particles.

Parameters
targetted_force_sourcesList of targetted force sources to be applied
curr_simulation_timeCurrent simulation time

Applies the given targetted force sources to the particles in the container.

Implemented in LinkedCellsContainer, and DirectSumContainer.

◆ begin() [1/2]

virtual std::vector<Particle>::const_iterator ParticleContainer::begin ( ) const
pure virtual

The begin const iterator for the internal data structure.

Returns
Const iterator to the first particle

Implemented in LinkedCellsContainer, and DirectSumContainer.

◆ begin() [2/2]

virtual std::vector<Particle>::iterator ParticleContainer::begin ( )
pure virtual

The begin iterator for the internal data structure.

Returns
Iterator to the first particle

Implemented in LinkedCellsContainer, and DirectSumContainer.

◆ end() [1/2]

virtual std::vector<Particle>::const_iterator ParticleContainer::end ( ) const
pure virtual

The end const iterator for the internal data structure.

Returns
Const iterator to the end of the container

Implemented in LinkedCellsContainer, and DirectSumContainer.

◆ end() [2/2]

virtual std::vector<Particle>::iterator ParticleContainer::end ( )
pure virtual

The end iterator for the internal data structure.

Returns
Iterator to the end of the container

Implemented in LinkedCellsContainer, and DirectSumContainer.

◆ getParticles()

virtual const std::vector<Particle>& ParticleContainer::getParticles ( ) const
pure virtual

Returns a vector of all particles in the container.

Returns
Vector of all particles in the container

Implemented in LinkedCellsContainer, and DirectSumContainer.

◆ operator[]()

virtual Particle& ParticleContainer::operator[] ( int  i)
pure virtual

Overload of the [] operator to access the particles in the container.

Parameters
i
Returns
Particle lvalue reference to the particle at index i in the internal data structure

Implemented in LinkedCellsContainer, and DirectSumContainer.

◆ prepareForceCalculation()

virtual void ParticleContainer::prepareForceCalculation ( )
pure virtual

Prepares everything for the force calculations (must be called before applySimpleForces and applyPairwiseForces)

Implemented in LinkedCellsContainer, and DirectSumContainer.

◆ reserve()

virtual void ParticleContainer::reserve ( size_t  n)
pure virtual

Reserves space for n particles.

Parameters
nAmount of particles to store in the container

Implemented in LinkedCellsContainer, and DirectSumContainer.

◆ size()

virtual size_t ParticleContainer::size ( ) const
pure virtual

Returns the number of particles in the container.

Returns
Number of particles in the container

Implemented in LinkedCellsContainer, and DirectSumContainer.


The documentation for this class was generated from the following file: