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

32 lines
920 B
C++
Executable File

#ifndef SCALAR_FIELD_H
#define SCALAR_FIELD_H
#include <functional>
#include "blitz/array.h"
#include "simulation/coordinates.h"
// class for a scalar field
class ScalarField {
public:
// returns the value of the scalar field at the Coordinate coordinate
virtual double value(const Coordinate& coordinate) const = 0;
};
// class for a scalar field that has an arbitrary form in longitudinal direction
// and is constant in radial in azimuthal directoin
class ScalarFieldFunctionInZ : public ScalarField {
public:
// Constructor: gets the function F_z defining the form of the scalar field
// in longitudinal direction
ScalarFieldFunctionInZ(std::function<double(double, double, double)> F_z);
// return the value of the scalar field at Coordinate coordinate
double value(const Coordinate& coordinate) const;
private:
std::function<double(double, double, double)> F_z_;
};
#endif /* SCALAR_FIELD_H */