diff options
author | Jakob Odersky <jodersky@gmail.com> | 2011-05-11 14:59:00 +0000 |
---|---|---|
committer | Jakob Odersky <jodersky@gmail.com> | 2011-05-11 14:59:00 +0000 |
commit | 64d6cd8a7ed46be4a34b4818705186f8e0998ab1 (patch) | |
tree | 0a889a5ff9bdb7a010bb9e028a5dc2ca0d05be65 | |
parent | ff64cec5fdf5b18e6aee31e8b3148a0305e1d1de (diff) | |
download | vhc-64d6cd8a7ed46be4a34b4818705186f8e0998ab1.tar.gz vhc-64d6cd8a7ed46be4a34b4818705186f8e0998ab1.tar.bz2 vhc-64d6cd8a7ed46be4a34b4818705186f8e0998ab1.zip |
Rajoute getHorizontalAt() pour tous les elements, en vue des faisceaux
-rw-r--r-- | src/gui/Main.cc | 134 | ||||
-rw-r--r-- | src/gui/ParticleRenderer.h | 3 | ||||
-rw-r--r-- | src/gui/Renderer.h | 12 | ||||
-rw-r--r-- | src/gui/Stage.cc | 10 | ||||
-rw-r--r-- | src/gui/Stage.h | 16 | ||||
-rw-r--r-- | src/gui/util.h | 9 | ||||
-rw-r--r-- | src/main/Accelerator.cc | 4 | ||||
-rw-r--r-- | src/main/CompositeElement.cc | 6 | ||||
-rw-r--r-- | src/main/CompositeElement.h | 2 | ||||
-rw-r--r-- | src/main/CurvedElement.cc | 5 | ||||
-rw-r--r-- | src/main/CurvedElement.h | 2 | ||||
-rw-r--r-- | src/main/Element.h | 2 | ||||
-rw-r--r-- | src/main/Makefile | 2 | ||||
-rw-r--r-- | src/main/Particle.cc | 3 | ||||
-rw-r--r-- | src/main/Printable.h | 3 | ||||
-rw-r--r-- | src/main/StraightElement.cc | 12 | ||||
-rw-r--r-- | src/main/StraightElement.h | 2 | ||||
-rw-r--r-- | src/main/Vector3D.cc | 2 | ||||
-rw-r--r-- | src/main/constants.h | 2 | ||||
-rw-r--r-- | src/test/ElementsSimulationTest.cc | 4 |
20 files changed, 119 insertions, 116 deletions
diff --git a/src/gui/Main.cc b/src/gui/Main.cc index 6ae9c67..28ba09f 100644 --- a/src/gui/Main.cc +++ b/src/gui/Main.cc @@ -15,7 +15,9 @@ #include "StraightElement.h" #include "Dipole.h" #include "Particle.h" -#include "FODO.h" +//#include "FODO.h" +#include "Quadrupole.h" +#include "Element.h" #include "Vector3D.h" #include "constants.h" #include <vector> @@ -38,6 +40,21 @@ std::vector< Particle > createParticles(const Vector3D& position, int n, double return v; } +Element** FODO(Vector3D entry, Vector3D exit, double Rs, double L, double b) { + double l = (entry - exit).norm() / 2.0 - 1; + Vector3D d = (exit - entry).unit(); + Quadrupole* fq = new Quadrupole(entry, entry + d * l, Rs, b); + StraightElement* s1 = new StraightElement(fq->getExitPosition(), fq->getExitPosition() + d * L, Rs); + Quadrupole* dq = new Quadrupole(s1->getExitPosition(), s1->getExitPosition() + d * l, Rs, -b); + StraightElement* s2 = new StraightElement(dq->getExitPosition(), exit, Rs); + Element** fodo = new Element*[4]; + (fodo)[0] = fq; + (fodo)[1] = s1; + (fodo)[2] = dq; + (fodo)[3] = s2; + + return fodo; +} Accelerator* standard() { /* @@ -87,34 +104,41 @@ Une particule : double B = 5.8915820038873; double b = 1.2; - FODO e1 = FODO(Vector3D(3, 2, 0), Vector3D(3, -2, 0), 0.1, 1.0, b); - Dipole e2 = Dipole(e1.getExitPosition(), Vector3D(2, -3, 0), 0.1, 1, Vector3D(0, 0, B)); - FODO e3 = FODO(e2.getExitPosition(), Vector3D(-2, -3, 0), 0.1, 1, b); - Dipole e4 = Dipole(e3.getExitPosition(), Vector3D(-3, -2, 0), 0.1, 1, Vector3D(0, 0, B)); - FODO e5 = FODO(e4.getExitPosition(), Vector3D(-3, 2, 0), 0.1, 1.0, b); - Dipole e6 = Dipole(e5.getExitPosition(), Vector3D(-2, 3, 0), 0.1, 1, Vector3D(0, 0, B)); - FODO e7 = FODO(e6.getExitPosition(), Vector3D(2, 3, 0), 0.1, 1.0, b); - Dipole e8 = Dipole(e7.getExitPosition(), e1.getEntryPosition(), 0.1, 1, Vector3D(0, 0, B)); + Element** e1 = FODO(Vector3D(3, 2, 0), Vector3D(3, -2, 0), 0.1, 1.0, b); + + //FODO e1 = FODO(Vector3D(3, 2, 0), Vector3D(3, -2, 0), 0.1, 1.0, b); + Dipole e2 = Dipole(Vector3D(3, -2, 0), Vector3D(2, -3, 0), 0.1, 1, Vector3D(0, 0, B)); + + Element** e3 = FODO(e2.getExitPosition(), Vector3D(-2, -3, 0), 0.1, 1, b); + Dipole e4 = Dipole(Vector3D(-2, -3, 0), Vector3D(-3, -2, 0), 0.1, 1, Vector3D(0, 0, B)); + Element** e5 = FODO(e4.getExitPosition(), Vector3D(-3, 2, 0), 0.1, 1.0, b); + Dipole e6 = Dipole(Vector3D(-3, 2, 0), Vector3D(-2, 3, 0), 0.1, 1, Vector3D(0, 0, B)); + Element** e7 = FODO(e6.getExitPosition(), Vector3D(2, 3, 0), 0.1, 1.0, b); + Dipole e8 = Dipole(Vector3D(2, 3, 0), Vector3D(3, 2, 0), 0.1, 1, Vector3D(0, 0, B)); Accelerator* acc = new Accelerator(); - acc->add(e1); + //acc->add(e1); + for (int i = 0; i < 4; ++i) acc->add(e1[i][0]); acc->add(e2); - acc->add(e3); + for (int i = 0; i < 4; ++i) acc->add(e3[i][0]); + //acc->add(e3); acc->add(e4); - acc->add(e5); + for (int i = 0; i < 4; ++i) acc->add(e5[i][0]); + //acc->add(e5); acc->add(e6); - acc->add(e7); + for (int i = 0; i < 4; ++i) acc->add(e7[i][0]); + //acc->add(e7); acc->add(e8); acc->close(); //proton - Particle p1 = Particle(Vector3D(3.00, 0, 0), constants::PROTON_MASS, constants::E, 2 * constants::GeV, -Vector3D::j); + Particle p1 = Particle(Vector3D(3.01, 0, 0), constants::PROTON_MASS, constants::E, 2 * constants::GeV, -Vector3D::j); Particle p2 = Particle(Vector3D(2.99, 0, 0), constants::PROTON_MASS, constants::E, 2 * constants::GeV, -Vector3D::j); acc->add(p1); acc->add(p2); //anti-proton - Particle ap1 = Particle(Vector3D(3.00, 0, 0), constants::PROTON_MASS, -constants::E, 2 * constants::GeV, Vector3D::j); + Particle ap1 = Particle(Vector3D(3.01, 0, 0), constants::PROTON_MASS, -constants::E, 2 * constants::GeV, Vector3D::j); Particle ap2 = Particle(Vector3D(2.99, 0, 0), constants::PROTON_MASS, -constants::E, 2 * constants::GeV, Vector3D::j); acc->add(ap1); acc->add(ap2); @@ -131,84 +155,6 @@ Une particule : return acc; } -Accelerator* standardAccelerator() { - FODO e1 = FODO(Vector3D(3, 2, 0), Vector3D(3, -2, 0), 0.2, 1.0, 5.0); - Dipole e2 = Dipole(e1.getExitPosition(), Vector3D(2, -3, 0), 0.2, 1); - FODO e3 = FODO(e2.getExitPosition(), Vector3D(-2, -3, 0), 0.2, 1, 5.0); - Dipole e4 = Dipole(e3.getExitPosition(), Vector3D(-3, -2, 0), 0.2, 1); - FODO e5 = FODO(e4.getExitPosition(), Vector3D(-3, 2, 0), 0.2, 1.0, 5.0); - Dipole e6 = Dipole(e5.getExitPosition(), Vector3D(-2, 3, 0), 0.2, 1); - FODO e7 = FODO(e6.getExitPosition(), Vector3D(2, 3, 0), 0.2, 1.0, 5.0); - Dipole e8 = Dipole(e7.getExitPosition(), e1.getEntryPosition(), 0.2, 1); - Accelerator* acc = new Accelerator(); - acc->add(e1); - acc->add(e2); - acc->add(e3); - acc->add(e4); - acc->add(e5); - acc->add(e6); - acc->add(e7); - acc->add(e8); - - std::vector< Particle > ps = createParticles(e1.getEntryPosition(), 100000); - - for (int i = 0; i < ps.size(); ++i) { - acc->add(ps[i]); - } - - acc->close(); - - return acc; -} - -Accelerator* linear() { - Accelerator* acc = new Accelerator(); - - for(int i = 0; i < 10; ++i) { - FODO e = FODO(Vector3D(4, 0, 0) * i, Vector3D(4, 0, 0) * (i + 1), 0.1, 1, 1.2); - acc->add(e); - } - - Particle e(Vector3D(0, 0.05, 0.01), constants::PROTON_MASS, constants::E, 2 * constants::GeV, Vector3D::i); - acc->add(e); - acc->close(); - - return acc; -} -/* -Accelerator* singleDipole() { - Vector3D entry = Vector3D(0, 2, 0); - Vector3D exit = Vector3D(2, 0, 0); - double sectionRadius = 0.2; - double curvature = 0.5; - Vector3D direction = entry.cross(Vector3D::k); - - double mass = constants::ELECTRON_MASS; - double charge = constants::E; - double energy = 1 * 1E9 * constants::E; - - - Particle particle = Particle(entry, mass, charge, energy, direction); - double Bz = particle.getGamma() * particle.getMass() * curvature * particle.getVelocity().norm() / particle.getCharge(); - std::cout << "|B:|" << Bz << std::endl; - Dipole element = Dipole(entry, exit, sectionRadius, curvature, Vector3D::k * Bz); - - Accelerator* acc = new Accelerator(); - - Element*\ celement = acc->add(element); - - std::vector< Particle > ps = createParticles(element.getEntryPosition(), 10, constants::ELECTRON_MASS, constants::E, energy, direction); - - for (int i = 0; i < ps.size(); ++i) { - Particle* cparticle = acc->add(ps[i]); - cparticle->setElement(celement); - } - - Particle* cparticle = acc->add(particle); - cparticle->setElement(celement); - return acc; -}*/ - int main(int argc, char *argv[]) { @@ -225,7 +171,7 @@ int main(int argc, char *argv[]) window.show(); - //window.showFullScreen(); + window.showFullScreen(); //app.setActiveWindow(&window); return app.exec(); diff --git a/src/gui/ParticleRenderer.h b/src/gui/ParticleRenderer.h index 216c869..458cf5c 100644 --- a/src/gui/ParticleRenderer.h +++ b/src/gui/ParticleRenderer.h @@ -23,7 +23,8 @@ public: ParticleRenderer(); virtual ~ParticleRenderer(); - void render(const Particle& particle) const; + + virtual void render(const Particle& particle) const; void enableDrawSpheres(bool value); diff --git a/src/gui/Renderer.h b/src/gui/Renderer.h index a673957..6be4373 100644 --- a/src/gui/Renderer.h +++ b/src/gui/Renderer.h @@ -16,7 +16,19 @@ public: Renderer() {}; virtual ~Renderer() {}; + /** Methode qui doit etre appelee avant de dessiner une collection d'objets par <code>render</code>. + * Cette methode gere des <code>glBegin()</code> en arriere-plan. */ + //virtual void begin() = 0; + + /** Dessine un objet. */ virtual void render(const T& item) const = 0; + + //template <typename Container> + //virtual void render(std::forward_iterator) const; + + /** Methode qui doit etre appelee avant de dessiner une collection d'objets par <code>render</code>. + * Cette methode gere des <code>glBegin()</code> en arriere-plan. */ + //virtual void end() = 0; }; } diff --git a/src/gui/Stage.cc b/src/gui/Stage.cc index 4b9e5e7..81c405d 100644 --- a/src/gui/Stage.cc +++ b/src/gui/Stage.cc @@ -31,8 +31,8 @@ Stage::Stage(QWidget* parent): timer = new QTimer(this); - connect(timer, SIGNAL(timeout()), this, SLOT(update())); - timer->start(1000.0/100); + connect(timer, SIGNAL(timeout()), this, SLOT(updateGL())); + timer->start(1); setMouseTracking(true); } @@ -80,9 +80,10 @@ void Stage::paintGL() { QString("pitch: ") + QString::number(camera.getPitch()), QString("-----accelerator-----"), QString("Elements: ") + QString::number(accelerator->getElements().size()), - QString("Particles: ") + QString::number(accelerator->getParticles().size()) + QString("Particles: ") + QString::number(accelerator->getParticles().size()), + QString("") + accelerator->getParticles().front()->toString().c_str() }; - displayText(text, 10); + displayText(text, 11); //renderText(0,60,QString("") + accelerator->getParticle(0)->getElement()->magneticFieldAt(accelerator->getParticle(0)->getPosition()).toString().c_str()); //renderText(0,72,QString("") + accelerator->getParticle(0)->toString().c_str()); axes(); @@ -125,6 +126,7 @@ void Stage::paintGL() { glDisable(GL_BLEND); glColor3d(0, 0, 1); + for (list<Particle*>::const_iterator i = accelerator->getParticles().begin(); i != accelerator->getParticles().end(); ++i) { particleRenderer.render(**i); } diff --git a/src/gui/Stage.h b/src/gui/Stage.h index 04cb1da..b3afdb9 100644 --- a/src/gui/Stage.h +++ b/src/gui/Stage.h @@ -61,22 +61,26 @@ protected: void mouseMoveEvent(QMouseEvent* event); private: - Camera camera; + //io KeyManager keyManager; + //graphics + Camera camera; + ElementRenderer elementRenderer; + ParticleRenderer particleRenderer; + QPoint center; + util::DisplayMode displayMode; + + //simulation QTimer* timer; QTime time; int frameTime; //ms - double h; bool paused; - ElementRenderer elementRenderer; - ParticleRenderer particleRenderer; - util::DisplayMode displayMode; - QPoint center; + }; diff --git a/src/gui/util.h b/src/gui/util.h index 9cfded6..075c2d0 100644 --- a/src/gui/util.h +++ b/src/gui/util.h @@ -19,6 +19,15 @@ enum DisplayMode { POINTS = 2 }; +/** Classe utilitaire pour verifier une relation d'heritage. + * Cette classe ne compile que si A est une sous-classe de B + * voir http://www2.research.att.com/~bs/bs_faq2.html#constraints pour plus d'informations. */ +template<class A, class B> +struct DerivedFrom { + static void constraints(A* p) { A* pb = p; } + DerivedFrom() { void(*p)(A*) = constraints; } +}; + /** Dessine un tore autour de l'origine, sur le plan xy. * @param R rayon du tore * @param r rayon du "cylindre" du tore diff --git a/src/main/Accelerator.cc b/src/main/Accelerator.cc index 37f8dbb..ca5de8a 100644 --- a/src/main/Accelerator.cc +++ b/src/main/Accelerator.cc @@ -144,13 +144,15 @@ void Accelerator::step(double dt) { for (ParticleIterator i = particleCollec.begin(); i != particleCollec.end(); ++i) { Particle& particle = **i; + particle.setForce(Vector3D::Null); + particle.applyMagneticForce(particle.getElement()->magneticFieldAt(particle.getPosition()), dt); Vector3D a = particle.getForce() / (particle.getGamma() * particle.getMass()); particle.setVelocity(particle.getVelocity() + a * dt); particle.translate(particle.getVelocity() * dt); - particle.setForce(Vector3D::Null); + } diff --git a/src/main/CompositeElement.cc b/src/main/CompositeElement.cc index 3e4a216..48e5757 100644 --- a/src/main/CompositeElement.cc +++ b/src/main/CompositeElement.cc @@ -48,6 +48,12 @@ Vector3D CompositeElement::electricFieldAt(const Vector3D& position) const { return e; } +Vector3D CompositeElement::getHorizontalAt(const Vector3D& position) const { + for (int i(0); i < elements.size(); i++) { + if (elements[i]->contains(position)) return elements[i]->getHorizontalAt(position); + } +} + void CompositeElement::accept(const ElementVisitor& v) const { for (int i(0); i < elements.size(); ++i) { elements[i]->accept(v); diff --git a/src/main/CompositeElement.h b/src/main/CompositeElement.h index c8d2286..60e0a44 100644 --- a/src/main/CompositeElement.h +++ b/src/main/CompositeElement.h @@ -42,6 +42,8 @@ public: virtual Vector3D electricFieldAt(const Vector3D& position) const; + virtual Vector3D getHorizontalAt(const Vector3D& position) const; + virtual void accept(const ElementVisitor& v) const; virtual std::string getType() const; diff --git a/src/main/CurvedElement.cc b/src/main/CurvedElement.cc index 4368913..d30bff4 100644 --- a/src/main/CurvedElement.cc +++ b/src/main/CurvedElement.cc @@ -59,6 +59,11 @@ bool CurvedElement::isAfter(const Vector3D& position) const { return (position - exitPosition).dot(out) > 0; } +Vector3D CurvedElement::getHorizontalAt(const Vector3D& position) const { + Vector3D X(position - curvatureCenter); + return (X - position.getZ() * Vector3D::k).unit(); +} + std::string CurvedElement::getType() const {return "Curved Element";} std::string CurvedElement::toString() const { std::stringstream s; diff --git a/src/main/CurvedElement.h b/src/main/CurvedElement.h index ac81746..846f279 100644 --- a/src/main/CurvedElement.h +++ b/src/main/CurvedElement.h @@ -54,6 +54,8 @@ public: virtual bool isAfter(const Vector3D& position) const; + virtual Vector3D getHorizontalAt(const Vector3D& position) const; + /** Retourne la courbure. */ double getCurvature() const; diff --git a/src/main/Element.h b/src/main/Element.h index 1f0afd2..3722be2 100644 --- a/src/main/Element.h +++ b/src/main/Element.h @@ -74,6 +74,8 @@ public: bool contains(const Vector3D& position) const; bool contains(const Particle& particle) const; + virtual Vector3D getHorizontalAt(const Vector3D& position) const = 0; + /** Retourne le champ magnetique, a l'interieur de cet element a la position donnee. */ virtual Vector3D magneticFieldAt(const Vector3D& position) const; diff --git a/src/main/Makefile b/src/main/Makefile index 9caa7f1..83385fd 100644 --- a/src/main/Makefile +++ b/src/main/Makefile @@ -14,7 +14,7 @@ LOCALDIR = main # Si un objet nécessite une compilation non-standard (i.e. pas de règle du style Foo.o : Foo.cc Foo.h), rajouter # cette règle. LOCALOBJS = Vector3D.o Particle.o Printable.o Element.o CurvedElement.o StraightElement.o \ - CompositeElement.o Dipole.o Quadrupole.o FODO.o ElementVisitor.o Cloneable.o Accelerator.o exceptions.o Stepper.o + CompositeElement.o Dipole.o Quadrupole.o FODO.o ElementVisitor.o Cloneable.o Accelerator.o exceptions.o Stepper.o Beam.o OBJS=$(addprefix $(BINDIR)/$(LOCALDIR)/,$(LOCALOBJS)) .PHONY = all checkdirs lib diff --git a/src/main/Particle.cc b/src/main/Particle.cc index 5784625..6e5eb0b 100644 --- a/src/main/Particle.cc +++ b/src/main/Particle.cc @@ -44,7 +44,7 @@ void Particle::applyForce(const Vector3D& f) {force += f;} void Particle::applyMagneticForce(const Vector3D& b, double dt) { if (dt != 0 && b != Vector3D::Null) { Vector3D f = charge * velocity.cross(b); - applyForce(f.rotate(velocity.cross(f), asin((dt * f.norm()) / (2 * gamma * mass * velocity.norm())))); + applyForce(f.rotate(velocity.cross(f), asin(1.0 * (dt * f.norm()) / (2 * gamma * mass * velocity.norm())))); } } @@ -70,6 +70,7 @@ std::string Particle::toString() const { s << "\tposition: " << position << "\n"; s << "\tvelocity: " << velocity; s << "\tnorm: " << velocity.norm() << "\n"; + s << "\tenergy: " << getEnergy() << "\n"; s << "\tforce: " << force << "\n"; s << "\tgamma: " << gamma << "\n"; s << "\tmass: " << mass << "\n"; diff --git a/src/main/Printable.h b/src/main/Printable.h index c14aec8..6d2129f 100644 --- a/src/main/Printable.h +++ b/src/main/Printable.h @@ -8,6 +8,7 @@ #ifndef PRINTABLE_H_ #define PRINTABLE_H_ +#include <sstream> #include <string> namespace vhc { @@ -22,6 +23,8 @@ public: /** Retourne une représentation en chaîne de caractères de cet objet imprimable. */ virtual std::string toString() const = 0; + //virtual std::stringstream toStream(std::stringstream s) const = 0; + }; /** Ajoute la représentation en chaîne de <code>p</code> à <code>output</code>. */ diff --git a/src/main/StraightElement.cc b/src/main/StraightElement.cc index 420e047..05e88c6 100644 --- a/src/main/StraightElement.cc +++ b/src/main/StraightElement.cc @@ -16,8 +16,8 @@ StraightElement::StraightElement(const Vector3D& entry, const Vector3D& exit, do StraightElement::~StraightElement() {}; bool StraightElement::isBefore(const Vector3D& position) const { - const Vector3D v(position - exitPosition); - return (-getDiagonal()).dot(v) > getDiagonal().normSquare(); + const Vector3D v(position - entryPosition); + return (-getDiagonal()).dot(v) > 0;//getDiagonal().normSquare(); } bool StraightElement::isBeside(const Vector3D& position) const { @@ -27,8 +27,12 @@ bool StraightElement::isBeside(const Vector3D& position) const { }; bool StraightElement::isAfter(const Vector3D& position) const { - const Vector3D v(position - entryPosition); - return getDiagonal().dot(v) > getDiagonal().normSquare(); + const Vector3D v(position - exitPosition); + return getDiagonal().dot(v) > 0; +} + +Vector3D StraightElement::getHorizontalAt(const Vector3D& position) const { + return Vector3D::k.cross(getDiagonal()); } std::string StraightElement::getType() const {return "Straight Element";} diff --git a/src/main/StraightElement.h b/src/main/StraightElement.h index 9a3a366..14d21aa 100644 --- a/src/main/StraightElement.h +++ b/src/main/StraightElement.h @@ -35,6 +35,8 @@ public: virtual void accept(const ElementVisitor& v) const; + virtual Vector3D getHorizontalAt(const Vector3D& position) const; + virtual StraightElement* clone() const; }; diff --git a/src/main/Vector3D.cc b/src/main/Vector3D.cc index fc7fc2b..9328edf 100644 --- a/src/main/Vector3D.cc +++ b/src/main/Vector3D.cc @@ -69,7 +69,7 @@ double Vector3D::tripleProduct(const Vector3D& v, const Vector3D& w) const { ret Vector3D Vector3D::rotate(const Vector3D& axis, double t) const { const Vector3D& x = *this; const Vector3D& a = ~axis; - return x * cos(t) + a * x.dot(a) * (1-cos(t)) + a.cross(x) * sin(t); + return cos(t) * x + (1-cos(t)) * x.dot(a) * a + sin(t) * a.cross(x); } bool Vector3D::ae(const Vector3D& u, const Vector3D& v, double epsilon) {return (u - v).norm() <= epsilon;} diff --git a/src/main/constants.h b/src/main/constants.h index 5753279..8e0331d 100644 --- a/src/main/constants.h +++ b/src/main/constants.h @@ -14,7 +14,7 @@ namespace vhc { namespace constants { /** Vitesse de la lumière dans le vide [m/s]. */ -const double C = 299792458; +const double C = 299792458.0; /** Vitesse de la lumière dans le vide au carré [m/s]. */ const double C2 = C * C; diff --git a/src/test/ElementsSimulationTest.cc b/src/test/ElementsSimulationTest.cc index 470b4c1..6c121ca 100644 --- a/src/test/ElementsSimulationTest.cc +++ b/src/test/ElementsSimulationTest.cc @@ -28,7 +28,7 @@ Particle* standpart(Accelerator* acc){ constants::PROTON_MASS,//mass constants::E,//charge 2*constants::GeV,//energy - Vector3D(-1,-1,0));//direction + Vector3D(1, 0,0));//direction return sp; }; @@ -36,7 +36,7 @@ Particle* standpart(Accelerator* acc){ // Ce fichier teste les simulations de chaque type différent d'Element existant. int main() { - Dipole* d = new Dipole(Vector3D(0,0,0), Vector3D(1,2,0), 0.2, 0.2, Vector3D::Null, NULL); + Dipole* d = new Dipole(Vector3D(0,0,0), Vector3D(1,0,0), 0.2, 0.2, Vector3D::Null, NULL); Accelerator* a1 = new Accelerator(); a1->add(*d); |