summaryrefslogtreecommitdiff
path: root/src/main/Dipole.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/Dipole.cc')
-rw-r--r--src/main/Dipole.cc30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/main/Dipole.cc b/src/main/Dipole.cc
index a2305bc..a313d12 100644
--- a/src/main/Dipole.cc
+++ b/src/main/Dipole.cc
@@ -5,17 +5,39 @@
* Author: jakob
*/
+#include <sstream>
#include "Dipole.h"
namespace vhc {
-/*Dipole::Dipole() {
-
+Dipole::Dipole(const Vector3D& entry, const Vector3D& exit, double sectionRadius, double curvature, const Vector3D& magneticField, Element* next):
+ CurvedElement(entry, exit, sectionRadius, curvature, next),
+ _magneticField(magneticField) {
}
-Dipole::~Dipole() {
+Dipole::~Dipole() {}
+
+Vector3D Dipole::getMagneticField() const {return _magneticField;}
+
+void Dipole::setMagneticField(const Vector3D& field) {_magneticField = field;}
+
+Vector3D Dipole::magneticFieldAt(const Vector3D& position) const {return _magneticField;}
-}*/
+std::string Dipole::getType() const {return "Dipole";}
+std::string Dipole::toString() const {
+ std::stringstream s;
+ s << CurvedElement::toString() << "\n";
+ s << "\tB: " << getMagneticField();
+ s << "\t|B|: " << getMagneticField().norm();
+ return s.str();
}
+
+void Dipole::accept(const ElementVisitor& v) const {v.visit(this);}
+
+Dipole* Dipole::clone() const {
+ return new Dipole(getEntryPosition(), getExitPosition(), getSectionRadius(), getCurvature(), _magneticField);
+}
+
+} //vhc