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

45 lines
1.5 KiB
C++
Executable File

#ifndef ELECTROMAGNETIC_FIELD_H
#define ELECTROMAGNETIC_FIELD_H
#include <memory>
#include "simulation/coordinates.h"
#include "simulation/scalar_field.h"
#include "simulation/vector_field.h"
// class for an electric field; consists of two VectorField objects
// one for the dynamic electric field, i.e. calculated during the simulation (not yet implemented, right now behaves the same as the background field)
// one for the background field, i.e. a field read in from an input file
class ElectricField {
public:
// Constructor: setting the background and dynamic field to the provided VectorFields
ElectricField(std::shared_ptr<VectorField> background,
std::shared_ptr<VectorField> dynamic);
// return the value of the electric field at the Coordinate position (sum of the background and dynamic field values)
// as a CylinderVector
CylinderVector value(const Coordinate& position) const;
// set the dynamic field to the provided field
void updateDynamicField(std::shared_ptr<VectorField> field);
private:
std::shared_ptr<VectorField> background_;
std::shared_ptr<VectorField> dynamic_;
};
// class for a magnetic field
class MagneticField {
public:
// Constructor: takes the VectorField describing the magnetic field
MagneticField(std::shared_ptr<VectorField> field);
// return the value of the magnetic field at Coordinate position as a CylinderVector
CylinderVector value(const Coordinate& position) const;
private:
std::shared_ptr<VectorField> field_;
};
#endif /* ELECTROMAGNETIC_FIELD_H */