Molecular Dynamics Simulation
1.0
src
physics
simpleforces
GlobalDownwardsGravity.cpp
Go to the documentation of this file.
1
#include "
GlobalDownwardsGravity.h
"
2
3
GlobalDownwardsGravity::GlobalDownwardsGravity
(
double
g) : g(g) {}
4
5
std::array<double, 3UL>
GlobalDownwardsGravity::calculateForce
(
Particle
& p)
const
{
return
{0.0, -p.
getM
() *
g
, 0.0}; }
6
7
GlobalDownwardsGravity::operator std::string()
const
{
return
"GlobalDownwardsGravity: g="
+
std::to_string
(g); }
8
9
void
GlobalDownwardsGravity::setGravitationalAcceleration
(
double
g) { this->g =
g
; }
GlobalDownwardsGravity.h
GlobalDownwardsGravity::g
double g
Definition:
GlobalDownwardsGravity.h:10
GlobalDownwardsGravity::setGravitationalAcceleration
void setGravitationalAcceleration(double g)
Sets the gravitational acceleration.
Definition:
GlobalDownwardsGravity.cpp:9
GlobalDownwardsGravity::calculateForce
std::array< double, 3UL > calculateForce(Particle &p) const override
Calculates the downwards gravity force on a particle using the given gravitational acceleration.
Definition:
GlobalDownwardsGravity.cpp:5
GlobalDownwardsGravity::GlobalDownwardsGravity
GlobalDownwardsGravity(double g)
Constructor for the GlobalDownwardsGravity class.
Definition:
GlobalDownwardsGravity.cpp:3
Particle
Class to represent a particle.
Definition:
Particle.h:26
Particle::getM
double getM() const
Gets the mass of the particle.
Definition:
Particle.h:177
ArrayUtils::to_string
std::string to_string(const Container &container, const std::string &delimiter=", ", const std::array< std::string, 2 > &surround={"[", "]"})
Definition:
ArrayUtils.h:97
Generated by
1.9.1