diff options
author | Jakob Odersky <jodersky@gmail.com> | 2011-03-23 14:46:29 +0000 |
---|---|---|
committer | Jakob Odersky <jodersky@gmail.com> | 2011-03-23 14:46:29 +0000 |
commit | 41f53a65c75e5b68973848425394b4633c9b1f44 (patch) | |
tree | 6e8932016c34411fbf5be06b00beef7fb4556cf1 | |
parent | 83f8d6b266b211cebecc9d0f16a06ea5a0feb508 (diff) | |
download | vhc-41f53a65c75e5b68973848425394b4633c9b1f44.tar.gz vhc-41f53a65c75e5b68973848425394b4633c9b1f44.tar.bz2 vhc-41f53a65c75e5b68973848425394b4633c9b1f44.zip |
Mofifie Straight et Curved en StraightElement et CurvedElement.
-rw-r--r-- | reponses.lyx | 24 | ||||
-rw-r--r-- | src/main/CurvedElement.cc (renamed from src/main/Curved.cc) | 6 | ||||
-rw-r--r-- | src/main/CurvedElement.h (renamed from src/main/Curved.h) | 12 | ||||
-rw-r--r-- | src/main/Element.h | 3 | ||||
-rw-r--r-- | src/main/Makefile | 2 | ||||
-rw-r--r-- | src/main/StraightElement.cc (renamed from src/main/Straight.cc) | 4 | ||||
-rw-r--r-- | src/main/StraightElement.h (renamed from src/main/Straight.h) | 12 | ||||
-rw-r--r-- | src/test/BasicTest.cc | 8 |
8 files changed, 36 insertions, 35 deletions
diff --git a/reponses.lyx b/reponses.lyx index 37651ff..dff95eb 100644 --- a/reponses.lyx +++ b/reponses.lyx @@ -336,13 +336,13 @@ Element s \family typewriter \size small -[Magnetic (Straight +[Magnetic (StraightElement \family default \size default et \family typewriter \size small -Curved) +CurvedElement) \family default \size default et @@ -361,13 +361,13 @@ Element est la classe grand-mère, les trois classes filles sont les classes \family typewriter \size small - Straight + StraightElement \family default \size default , \family typewriter \size small -Curved +CurvedElement \family default \size default et @@ -380,13 +380,13 @@ Magnetic Les trois classes petites-filles sont \family typewriter \size small -MagneticStraight +MagneticStraightElement \family default \size default , \family typewriter \size small -MagneticCurved +MagneticCurvedElement \family default \size default et @@ -398,7 +398,7 @@ Electric , où \family typewriter \size small -MagneticStraight +MagneticStraightElement \family default \size default hérite à la fois de @@ -410,13 +410,13 @@ Magnetic et de \family typewriter \size small -Straight +StraightElement \family default \size default , et où \family typewriter \size small -MagneticCurved +MagneticCurvedElement \family default \size default hérite de @@ -428,7 +428,7 @@ Magnetic et de \family typewriter \size small -Curved +CurvedElement \family default \size default . @@ -441,7 +441,7 @@ Electric n'hérite 'que' de \family typewriter \size small -Straight +StraightElement \family default \size default . @@ -544,7 +544,7 @@ curved dans \family typewriter \size small -Curved.cc +CurvedElement.cc \family default \size default ). diff --git a/src/main/Curved.cc b/src/main/CurvedElement.cc index f96ad6e..188d042 100644 --- a/src/main/Curved.cc +++ b/src/main/CurvedElement.cc @@ -1,16 +1,16 @@ /* - * Curved.cc + * CurvedElement.cc * * Created on: Mar 22, 2011 * Author: jakob */ #include <math.h> -#include "Curved.h" +#include "CurvedElement.h" namespace vhc { -Curved::Curved(const Vector3D& entry, const Vector3D& exit, double sectionRadius, double curvature, Element* next): +CurvedElement::CurvedElement(const Vector3D& entry, const Vector3D& exit, double sectionRadius, double curvature, Element* next): Element(entry, exit, sectionRadius, next), curvature(curvature), curvatureCenter(Vector3D::Null){} /*{ diff --git a/src/main/Curved.h b/src/main/CurvedElement.h index 8944864..88f33b6 100644 --- a/src/main/Curved.h +++ b/src/main/CurvedElement.h @@ -1,12 +1,12 @@ /* - * Curved.h + * CurvedElement.h * * Created on: Mar 22, 2011 * Author: jakob */ -#ifndef CURVED_H_ -#define CURVED_H_ +#ifndef CURVEDELEMENT_H_ +#define CURVEDELEMENT_H_ #include <math.h> //#include <cmath.h> @@ -17,7 +17,7 @@ namespace vhc { //TODO implement abstract methods of Element -class Curved: public Element { +class CurvedElement: public Element { protected: @@ -26,7 +26,7 @@ protected: public: - Curved(const Vector3D& entry, const Vector3D& exit, double sectionRadius, double curvature, Element* next = NULL); + CurvedElement(const Vector3D& entry, const Vector3D& exit, double sectionRadius, double curvature, Element* next = NULL); virtual bool isOutside(const Particle& particle) const { Vector3D x(particle.getPosition() - entryPosition); @@ -42,4 +42,4 @@ public: } -#endif /* CURVED_H_ */ +#endif /* CURVEDELEMENT_H_ */ diff --git a/src/main/Element.h b/src/main/Element.h index 9dfd12f..2dec462 100644 --- a/src/main/Element.h +++ b/src/main/Element.h @@ -17,6 +17,7 @@ namespace vhc { class Element { private: + /** Empêche la copie d'éléments et facilite ainsi la gestion de pointeurs. * Pourquoi aurait-on besoin de copier un élément? */ Element(const Element& e); @@ -85,7 +86,7 @@ public: /** Assigne un pointeur sur l'element suivant. */ //TODO use pointer? - void setNext(Element& n) {next = &n;} + void setNext(Element* n) {next = n;} }; diff --git a/src/main/Makefile b/src/main/Makefile index f488218..e9355bc 100644 --- a/src/main/Makefile +++ b/src/main/Makefile @@ -13,7 +13,7 @@ LOCALDIR = main # ==> Ajouter ici les objets à compiler # 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 Curved.o Straight.o +LOCALOBJS = Vector3D.o Particle.o Printable.o Element.o CurvedElement.o StraightElement.o OBJS=$(addprefix $(BINDIR)/$(LOCALDIR)/,$(LOCALOBJS)) .PHONY = lib diff --git a/src/main/Straight.cc b/src/main/StraightElement.cc index 3a36c06..d1540ec 100644 --- a/src/main/Straight.cc +++ b/src/main/StraightElement.cc @@ -1,11 +1,11 @@ /* - * Straight.cc + * StraightElement.cc * * Created on: Mar 22, 2011 * Author: jakob */ -#include "Straight.h" +#include "StraightElement.h" namespace vhc { diff --git a/src/main/Straight.h b/src/main/StraightElement.h index a842b2f..5a1d944 100644 --- a/src/main/Straight.h +++ b/src/main/StraightElement.h @@ -1,12 +1,12 @@ /* - * Straight.h + * StraightElement.h * * Created on: Mar 22, 2011 * Author: jakob */ -#ifndef STRAIGHT_H_ -#define STRAIGHT_H_ +#ifndef STRAIGHTELEMENT_H_ +#define STRAIGHTELEMENT_H_ #include "Vector3D.h" #include "Element.h" @@ -15,11 +15,11 @@ namespace vhc { -class Straight: public Element { +class StraightElement: public Element { public: - Straight(const Vector3D& entry, const Vector3D& exit, double sectionRadius, Element* next = NULL): + StraightElement(const Vector3D& entry, const Vector3D& exit, double sectionRadius, Element* next = NULL): Element(entry, exit, sectionRadius, next) {}; @@ -39,4 +39,4 @@ public: } -#endif /* STRAIGHT_H_ */ +#endif /* STRAIGHTELEMENT_H_ */ diff --git a/src/test/BasicTest.cc b/src/test/BasicTest.cc index 7258b1c..6731675 100644 --- a/src/test/BasicTest.cc +++ b/src/test/BasicTest.cc @@ -6,17 +6,17 @@ */ #include "Element.h" -#include "Curved.h" -#include "Straight.h" +#include "CurvedElement.h" +#include "StraightElement.h" #include "Vector3D.h" using namespace vhc; int main() { - //Straight(Vector3D(0,0,0), Vector3D(1,2,0), 0.2); + //StraightElement(Vector3D(0,0,0), Vector3D(1,2,0), 0.2); - Curved(Vector3D(0,0,0), Vector3D(1,2,0), 2, 0.2); + CurvedElement(Vector3D(0,0,0), Vector3D(1,2,0), 2, 0.2); return 0; } |