summaryrefslogtreecommitdiff
path: root/src/main/Dipole.cc
diff options
context:
space:
mode:
authorJakob Odersky <jodersky@gmail.com>2011-04-17 20:05:38 +0000
committerJakob Odersky <jodersky@gmail.com>2011-04-17 20:05:38 +0000
commit964f0f8a7c88c1128c2edbef1fb36a86ed9864cf (patch)
tree38ef5ce1e578e7a40f3b08d30cee8666f0bea2e4 /src/main/Dipole.cc
parent064e27d5e7bf451542cc89ee0a05a06447acdc88 (diff)
downloadvhc-964f0f8a7c88c1128c2edbef1fb36a86ed9864cf.tar.gz
vhc-964f0f8a7c88c1128c2edbef1fb36a86ed9864cf.tar.bz2
vhc-964f0f8a7c88c1128c2edbef1fb36a86ed9864cf.zip
Migration de tous les implementations dans les fichier .h vers les fichiers .cc
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