Molecular Dynamics Simulation
1.0
src
physics
simpleforces
SimpleForceSource.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <iostream>
4
5
#include "
particles/Particle.h
"
6
16
class
SimpleForceSource
{
17
public
:
23
virtual
~SimpleForceSource
() =
default
;
24
33
virtual
std::array<double, 3UL>
calculateForce
(
Particle
& p)
const
= 0;
34
38
virtual
explicit
operator
std::string()
const
= 0;
39
};
40
41
// overload the << operator for the ForceSource class to allow easier printing
42
inline
std::ostream&
operator<<
(std::ostream& os,
const
SimpleForceSource
& forceSource) {
43
os << static_cast<std::string>(forceSource);
44
return
os;
45
}
Particle.h
operator<<
std::ostream & operator<<(std::ostream &os, const SimpleForceSource &forceSource)
Definition:
SimpleForceSource.h:42
Particle
Class to represent a particle.
Definition:
Particle.h:26
SimpleForceSource
Interface for simple force source classes.
Definition:
SimpleForceSource.h:16
SimpleForceSource::calculateForce
virtual std::array< double, 3UL > calculateForce(Particle &p) const =0
Calculates the force a particle q exerts on another particle p.
SimpleForceSource::~SimpleForceSource
virtual ~SimpleForceSource()=default
Virtual destructor for correct cleanup of derived classes.
Generated by
1.9.1