summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Odersky <jodersky@gmail.com>2011-04-12 21:07:01 +0000
committerJakob Odersky <jodersky@gmail.com>2011-04-12 21:07:01 +0000
commiteec0022a0de769336d1b1f984498427f71136508 (patch)
tree26328a7c0e07510de9eaa345a12bd64845ac16b2
parent7e3f864123c021d85abbf80fc102e1d319733bc4 (diff)
downloadvhc-eec0022a0de769336d1b1f984498427f71136508.tar.gz
vhc-eec0022a0de769336d1b1f984498427f71136508.tar.bz2
vhc-eec0022a0de769336d1b1f984498427f71136508.zip
Ajout de la methode 'copy()' pour chaque element.
-rw-r--r--src/gui/Makefile2
-rw-r--r--src/main/Dipole.h4
-rw-r--r--src/main/Element.h2
-rw-r--r--src/main/FODO.cc6
-rw-r--r--src/main/FODO.h6
-rw-r--r--src/main/Quadrupole.h2
-rw-r--r--src/main/StraightElement.h2
7 files changed, 22 insertions, 2 deletions
diff --git a/src/gui/Makefile b/src/gui/Makefile
index dca1daf..05fc929 100644
--- a/src/gui/Makefile
+++ b/src/gui/Makefile
@@ -1,6 +1,6 @@
#############################################################################
# Makefile for building: $(BINDIR)/gui/gui
-# Generated by qmake (2.01a) (Qt 4.7.0) on: Tue Apr 12 19:57:02 2011
+# Generated by qmake (2.01a) (Qt 4.7.0) on: Tue Apr 12 22:34:18 2011
# Project: gui.pro
# Template: app
# Command: /usr/bin/qmake -o Makefile gui.pro
diff --git a/src/main/Dipole.h b/src/main/Dipole.h
index 10d8062..c4f7bc0 100644
--- a/src/main/Dipole.h
+++ b/src/main/Dipole.h
@@ -67,6 +67,10 @@ public:
virtual void accept(ElementVisitor& v) {v.visit(this);}
+ virtual Dipole* copy() const {
+ return new Dipole(getEntryPosition(), getExitPosition(), getSectionRadius(), getCurvature(), _magneticField);
+ }
+
};
diff --git a/src/main/Element.h b/src/main/Element.h
index 8e491ad..3a32e3c 100644
--- a/src/main/Element.h
+++ b/src/main/Element.h
@@ -69,7 +69,7 @@ public:
/** Copie l'element sur le heap et renvoye un pointeur sur la copie.
* En copiant un element, le pointeur sur l'element suivant est remis a zero.
* ATTENTION: La delocation de memoire est sous la responsabilite de l'appelant. */
- //virtual Element* copy() const = 0;
+ virtual Element* copy() const = 0;
/** Determine si la particule donnee a heurte le bord de cet element. */
virtual bool isOutside(const Particle& particle) const = 0;
diff --git a/src/main/FODO.cc b/src/main/FODO.cc
index c87324c..9ed5308 100644
--- a/src/main/FODO.cc
+++ b/src/main/FODO.cc
@@ -16,6 +16,8 @@ namespace vhc {
FODO::FODO(const Vector3D& entry, const Vector3D& exit, double sectionRadius, double straightLength, double focalisingCoefficient, Element* next):
CompositeElement(entry, exit, sectionRadius, next),
+ straightLength(straightLength),
+ focalisingCoefficient(focalisingCoefficient),
focalisingQuadrupole(NULL),
defocalisingQuadrupole(NULL),
straightElement1(NULL),
@@ -49,4 +51,8 @@ FODO::~FODO() {
}
}
+FODO* FODO::copy() const {
+ return new FODO(getEntryPosition(), getExitPosition(), getSectionRadius(), straightLength, focalisingCoefficient);
+}
+
}
diff --git a/src/main/FODO.h b/src/main/FODO.h
index 99241a6..31b5bb9 100644
--- a/src/main/FODO.h
+++ b/src/main/FODO.h
@@ -15,6 +15,10 @@
namespace vhc {
class FODO: public CompositeElement {
+
+private:
+ double straightLength;
+ double focalisingCoefficient;
Quadrupole* focalisingQuadrupole;
Quadrupole* defocalisingQuadrupole;
StraightElement* straightElement1;
@@ -24,6 +28,8 @@ public:
FODO(const Vector3D& entry, const Vector3D& exit, double sectionRadius, double straightLength, double focalisingCoefficient, Element* next = NULL);
virtual ~FODO();
+
+ virtual FODO* copy() const;
};
}
diff --git a/src/main/Quadrupole.h b/src/main/Quadrupole.h
index c2ee6a5..6179b71 100644
--- a/src/main/Quadrupole.h
+++ b/src/main/Quadrupole.h
@@ -47,6 +47,8 @@ public:
virtual std::string getType() const {return "Quadrupole";}
virtual void accept(ElementVisitor& v) {v.visit(this);}
+
+ virtual Quadrupole* copy() const {return new Quadrupole(getEntryPosition(), getExitPosition(), getSectionRadius(), focusingCoefficient);}
};
}
diff --git a/src/main/StraightElement.h b/src/main/StraightElement.h
index eb493d0..1f61635 100644
--- a/src/main/StraightElement.h
+++ b/src/main/StraightElement.h
@@ -48,6 +48,8 @@ public:
virtual void accept(ElementVisitor& v) {v.visit(this);}
+ virtual StraightElement* copy() const {return new StraightElement(getEntryPosition(), getExitPosition(), getSectionRadius());}
+
};
}