Files
karl/include/simulation/velocity_distribution.h
T
2024-12-04 17:15:04 +01:00

40 lines
1.3 KiB
C++
Executable File

#ifndef VELOCITY_DISTRIBUTION_H
#define VELOCITY_DISTRIBUTION_H
#include <memory>
#include <random>
#include "simulation/coordinates.h"
// defined in "velocity_distribution_function.h"
class VelocityDistributionFunction;
// class to define the minimum requirements of a velocity distribution function
// (in the frame center of mass frame)
class VelocityDistribution {
public:
// draw a randomly oriented Cartesian velocity vector at the Coordinate position
// using the random engine
virtual CartesianVector rollVelocity(const Coordinate& position,
std::mt19937* engine) = 0;
};
// class that defines a velocity distribution by the usage of a VelocityDistributionFunction
// object
class VelocityDistributionFromFunction : public VelocityDistribution {
public:
// Constructor: takes a shared_ptr to the VelocityDistributionFunction, that defines the
// distribution to be drawn from
VelocityDistributionFromFunction(
std::shared_ptr<VelocityDistributionFunction> fv);
// returns a radnomly oriented CartesianVector drawn from the VelocityDistribution
// given at creation of the object
CartesianVector rollVelocity(const Coordinate& position,
std::mt19937* engine);
private:
std::shared_ptr<VelocityDistributionFunction> fv_;
};
#endif /* VELOCITY_DISTRIBUTION_H */