Molecular Dynamics  v0.4
Project for the Practical hosted by the Scientific Computing Chair
Public Member Functions | List of all members
ParticleContainer Class Referenceabstract

#include <ParticleContainer.h>

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

Public Member Functions

virtual void add (Particle &p)=0
 Add one particle to this container. More...
 
virtual size_t size () const =0
 Get the number of particles stored in this container. More...
 
virtual void applyToEachParticle (const std::function< void(Particle &)> &function)=0
 Iterate over all particles in this container and apply a lambda function to them. More...
 
virtual void applyToEachParticleInDomain (const std::function< void(Particle &)> &function)=0
 Iterate over all particles that are part of the domain and apply a lambda function to them. More...
 
virtual void applyToAllUniquePairsInDomain (const std::function< void(Particle &, Particle &)> &function)=0
 Iterate over all unique pairs of particles being part of the simulation domain and apply a lambda function to them. More...
 
virtual ~ParticleContainer ()=default
 Virtual default constructor to guarantee appropriate memory clean up. More...
 

Detailed Description

Abstract base class for a particle container. Each type of a particle container should extend this class.

Constructor & Destructor Documentation

◆ ~ParticleContainer()

virtual ParticleContainer::~ParticleContainer ( )
virtualdefault

Virtual default constructor to guarantee appropriate memory clean up.

Member Function Documentation

◆ add()

virtual void ParticleContainer::add ( Particle p)
pure virtual

Add one particle to this container.

Parameters
pParticle to be added to this container.

Add one particle to this container. It will be appended.

Implemented in LinkedCellsContainer, and DefaultParticleContainer.

Here is the caller graph for this function:

◆ applyToAllUniquePairsInDomain()

virtual void ParticleContainer::applyToAllUniquePairsInDomain ( const std::function< void(Particle &, Particle &)> &  function)
pure virtual

Iterate over all unique pairs of particles being part of the simulation domain and apply a lambda function to them.

Parameters
functionLambda function that is applied to each unique pair of particles.

The purpose of this function is provide an easy way of calculating the force between all particles by using Newton's third law of motion.

Implemented in LinkedCellsContainer, and DefaultParticleContainer.

Here is the caller graph for this function:

◆ applyToEachParticle()

virtual void ParticleContainer::applyToEachParticle ( const std::function< void(Particle &)> &  function)
pure virtual

Iterate over all particles in this container and apply a lambda function to them.

Parameters
functionLambda function that is applied to each particle.

Implemented in LinkedCellsContainer, and DefaultParticleContainer.

Here is the caller graph for this function:

◆ applyToEachParticleInDomain()

virtual void ParticleContainer::applyToEachParticleInDomain ( const std::function< void(Particle &)> &  function)
pure virtual

Iterate over all particles that are part of the domain and apply a lambda function to them.

Parameters
functionLambda function that is applied to each particle.

Implemented in LinkedCellsContainer, and DefaultParticleContainer.

Here is the caller graph for this function:

◆ size()

virtual size_t ParticleContainer::size ( ) const
pure virtual

Get the number of particles stored in this container.

Returns
Number of particles stored in this container.

Implemented in LinkedCellsContainer, and DefaultParticleContainer.

Here is the caller graph for this function:

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