summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorJakob Odersky <jodersky@gmail.com>2011-05-19 08:33:16 +0000
committerJakob Odersky <jodersky@gmail.com>2011-05-19 08:33:16 +0000
commit2c8bb59d4ccca47c5342ee030f31e13c0cb2674b (patch)
treedb127642457cd6bccf32f0d8a5dea3c83f8d67db /src/gui
parentb88deff7c45593bb6ad0780b70ce929346056aae (diff)
downloadvhc-2c8bb59d4ccca47c5342ee030f31e13c0cb2674b.tar.gz
vhc-2c8bb59d4ccca47c5342ee030f31e13c0cb2674b.tar.bz2
vhc-2c8bb59d4ccca47c5342ee030f31e13c0cb2674b.zip
Migration des particules vers les faisceau.
Il reste une subtilite a gerer: pour des raisons de compatibilite, un accelerateur contient toujours une methode getParticles(). Celle-ci renvoi une concatenation de tous les particules de tous les faisceaux de l'accelerateur. Or il y a un probleme d'allocation de la memoire avec cette methode (temporairement repare dans cette revision mais degeu!). Je vois deux solutions: 1) changer tous les test qui appellent la methode getParticles() 2) essayer de reparer le probleme d'allocation (difficile et je ne sais pas si c'est possible)
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/Main.cc4
-rw-r--r--src/gui/Stage.cc7
-rw-r--r--src/gui/gui.pro4
3 files changed, 9 insertions, 6 deletions
diff --git a/src/gui/Main.cc b/src/gui/Main.cc
index 28ba09f..94f68ee 100644
--- a/src/gui/Main.cc
+++ b/src/gui/Main.cc
@@ -21,6 +21,7 @@
#include "Vector3D.h"
#include "constants.h"
#include <vector>
+#include "CircularBeam.h"
using namespace std;
using namespace vhc;
@@ -129,7 +130,6 @@ Une particule :
//acc->add(e7);
acc->add(e8);
- acc->close();
//proton
Particle p1 = Particle(Vector3D(3.01, 0, 0), constants::PROTON_MASS, constants::E, 2 * constants::GeV, -Vector3D::j);
@@ -143,7 +143,9 @@ Une particule :
acc->add(ap1);
acc->add(ap2);
+ acc->add(CircularBeam(p1, 10, 1));
+ acc->close();
/*std::vector< Particle > ps = createParticles(e1.getEntryPosition(), 1000);
diff --git a/src/gui/Stage.cc b/src/gui/Stage.cc
index 81c405d..020f31a 100644
--- a/src/gui/Stage.cc
+++ b/src/gui/Stage.cc
@@ -118,7 +118,7 @@ void Stage::paintGL() {
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glEnable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
- for (list<Element*>::const_iterator i = accelerator->getElements().begin(); i != accelerator->getElements().end(); ++i) {
+ for (Accelerator::ElementCollection::const_iterator i = accelerator->getElements().begin(); i != accelerator->getElements().end(); ++i) {
elementRenderer.render(**i);
}
@@ -127,7 +127,8 @@ void Stage::paintGL() {
glColor3d(0, 0, 1);
- for (list<Particle*>::const_iterator i = accelerator->getParticles().begin(); i != accelerator->getParticles().end(); ++i) {
+ Accelerator::ParticleCollection particles = accelerator->getParticles();
+ for (Accelerator::ParticleCollection::const_iterator i = particles.begin(); i != particles.end(); ++i) {
particleRenderer.render(**i);
}
}
@@ -144,7 +145,7 @@ void Stage::paintGL() {
camera.move(mv);
- if (!paused) accelerator->step(h);
+ if (!paused) for (int i = 0; i < 10; ++i) accelerator->step(h);
glColor3d(1,1,0);
util::crosshair();
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index 74c6a72..03b954b 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -10,8 +10,8 @@ LIBS += -L$(BINDIR)/main -lvhc
QT += opengl
#CONFIG += DEBUG
-#QMAKE_CXXFLAGS_DEBUG += -pg
-#QMAKE_LFLAGS_DEBUG += -pg
+#QMAKE_CXXFLAGS_DEBUG += -g
+#QMAKE_LFLAGS_DEBUG += -g
# Input