Molecular Dynamics Simulation  1.0
ParticleContainer.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 #include <vector>
5 
6 #include "particles/Particle.h"
10 
18  public:
22  virtual ~ParticleContainer() = default;
23 
31  virtual void addParticle(const Particle& p) = 0;
32 
40  virtual void addParticle(Particle&& p) = 0;
41 
45  virtual void prepareForceCalculation() = 0;
46 
54  virtual void applySimpleForces(const std::vector<std::shared_ptr<SimpleForceSource>>& simple_force_sources) = 0;
55 
64  virtual void applyPairwiseForces(const std::vector<std::shared_ptr<PairwiseForceSource>>& pairwise_force_sources) = 0;
65 
74  virtual void applyTargettedForces(const std::vector<std::shared_ptr<TargettedForceSource>>& targetted_force_sources,
75  double curr_simulation_time) = 0;
76 
82  virtual void reserve(size_t n) = 0;
83 
89  [[nodiscard]] virtual size_t size() const = 0;
90 
97  virtual Particle& operator[](int i) = 0;
98 
104  [[nodiscard]] virtual std::vector<Particle>::iterator begin() = 0;
105 
111  [[nodiscard]] virtual std::vector<Particle>::iterator end() = 0;
112 
118  [[nodiscard]] virtual std::vector<Particle>::const_iterator begin() const = 0;
119 
125  [[nodiscard]] virtual std::vector<Particle>::const_iterator end() const = 0;
126 
131  [[nodiscard]] virtual const std::vector<Particle>& getParticles() const = 0;
132 };
Interface for particle containers.
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.
virtual size_t size() const =0
Returns the number of particles in the container.
virtual void applyPairwiseForces(const std::vector< std::shared_ptr< PairwiseForceSource >> &pairwise_force_sources)=0
Applies the given pairwise force sources to the particles.
virtual void prepareForceCalculation()=0
Prepares everything for the force calculations (must be called before applySimpleForces and applyPair...
virtual const std::vector< Particle > & getParticles() const =0
Returns a vector of all particles in the container.
virtual std::vector< Particle >::const_iterator end() const =0
The end const iterator for the internal data structure.
virtual Particle & operator[](int i)=0
Overload of the [] operator to access the particles in the container.
virtual std::vector< Particle >::iterator end()=0
The end iterator for the internal data structure.
virtual void applySimpleForces(const std::vector< std::shared_ptr< SimpleForceSource >> &simple_force_sources)=0
Applies the given simple force sources to the particles.
virtual std::vector< Particle >::const_iterator begin() const =0
The begin const iterator for the internal data structure.
virtual ~ParticleContainer()=default
Virtual destructor for correct deconstruction of inheriting classes.
virtual void reserve(size_t n)=0
Reserves space for n particles.
virtual std::vector< Particle >::iterator begin()=0
The begin iterator for the internal data structure.
virtual void addParticle(Particle &&p)=0
Adds a particle to the container.
virtual void addParticle(const Particle &p)=0
Adds a particle to the container.
Class to represent a particle.
Definition: Particle.h:26