36 lines
1.3 KiB
C++
Executable File
36 lines
1.3 KiB
C++
Executable File
#include "simulation/electromagnetic_field.h"
|
|
|
|
ElectricField::ElectricField(std::shared_ptr<VectorField> background,
|
|
std::shared_ptr<VectorField> dynamic)
|
|
: background_(background), dynamic_(dynamic) {}
|
|
|
|
CylinderVector ElectricField::value(const Coordinate& position) const {
|
|
return background_->value(position) + dynamic_->value(position);
|
|
}
|
|
|
|
void ElectricField::updateDynamicField(std::shared_ptr<VectorField> field) {
|
|
dynamic_ = field;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
MagneticField::MagneticField(std::shared_ptr<VectorField> field)
|
|
: field_(field) {}
|
|
|
|
CylinderVector MagneticField::value(const Coordinate& position) const {
|
|
return field_->value(position);
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
GravityField::GravityField(std::shared_ptr<VectorField> field):
|
|
field_(field) {}
|
|
|
|
CylinderVector GravityField::value(const Coordinate& position) const {
|
|
return field_->value(position);
|
|
}
|