Changeset 166 in PSPA for Interface_Web/trunk/pspaWT/include
- Timestamp:
- Dec 10, 2012, 7:06:24 PM (12 years ago)
- Location:
- Interface_Web/trunk/pspaWT/include
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/include/bareParticle.h
r56 r166 34 34 ~bareParticle() {;} 35 35 36 inline bareParticle& operator = (const bareParticle& bp)37 {38 position_ = bp.position_;39 betagamma_ = bp.betagamma_;40 gamma_ = bp.gamma_;41 return *this;42 }43 36 44 bareParticle(const TRIDVECTOR& pos , const TRIDVECTOR& bg) 45 { 46 position_ = pos; 47 betagamma_ = bg; 48 gamma_ = sqrt( 1.0 + betagamma_.norm2() ); 49 } 37 bareParticle(const TRIDVECTOR& pos , const TRIDVECTOR& bg); 50 38 51 inline void resetDynamics(const bareParticle& bp) 52 { 53 position_ = bp.position_; 54 betagamma_ = bp.betagamma_; 55 gamma_ = bp.gamma_; 39 bareParticle(bareParticle& bp); 56 40 57 } 41 bareParticle(const bareParticle& bp); 42 43 void resetDynamics(const bareParticle& bp); 44 45 bareParticle& operator = (const bareParticle& bp); 58 46 59 47 48 const TRIDVECTOR& getReferenceToPosition() const; 60 49 61 inline const TRIDVECTOR& getReferenceToPosition() const 62 { 63 return position_; 64 } 50 TRIDVECTOR getPosition() const; 65 51 66 inline TRIDVECTOR getPosition() const 67 { 68 return position_; 69 } 52 TRIDVECTOR& getReferenceToPosition(); 70 53 71 inline TRIDVECTOR& getReferenceToPosition() 72 { 73 return position_; 74 } 75 76 inline double getZ() const 77 { 78 return position_.getComponent(2); 79 } 54 double getZ() const; 80 55 81 56 82 inline void setZ(double z) 83 { 84 position_.setComponent(2, z); 85 } 57 void setZ(double z); 86 58 87 inline void incrementZ( double dz) 88 { 89 position_.incrementComponent(2, dz); 90 } 59 void incrementZ( double dz); 91 60 92 inline void setX(double x) 93 { 94 position_.setComponent(0, x); 95 } 61 void setX(double x); 96 62 97 63 98 inline double getRadius() const 99 { 100 double auxx = position_.getComponent(0); 101 double auxy = position_.getComponent(1); 102 103 return sqrt(auxx * auxx + auxy * auxy); 104 } 64 double getRadius() const; 105 65 106 66 107 inline TRIDVECTOR getBetaGamma() const 108 { 109 return betagamma_; 110 } 67 TRIDVECTOR getBetaGamma() const; 111 68 112 69 113 inline TRIDVECTOR& getReferenceToBetaGamma() 114 { 115 return betagamma_; 116 } 70 TRIDVECTOR& getReferenceToBetaGamma(); 117 71 118 inline void setBetaGamma(const TRIDVECTOR& btg) 119 { 120 betagamma_ = btg; 121 gamma_ = sqrt( 1.0 + betagamma_.norm2() ); 122 } 72 void setBetaGamma(const TRIDVECTOR& btg); 123 73 124 inline double getBetaz() const 125 { 126 return betagamma_.getComponent(2)/gamma_; 127 } 74 double getBetaz() const; 128 75 129 76 130 inline double getGamma() const 131 { 132 return gamma_; 133 } 77 double getGamma() const; 134 78 135 79 … … 137 81 138 82 139 inline string FileOutputFlow() const 140 { 141 ostringstream sortie; 142 sortie << position_.output_flow() << betagamma_.output_flow() << " " << gamma_; 143 return sortie.str(); 144 } 83 string FileOutputFlow() const; 145 84 146 virtual inline bool FileInput( ifstream& ifs) 147 { 148 bool test = false; 149 if ( position_.input_flow(ifs) && betagamma_.input_flow(ifs) ) 150 { 151 if ( ifs >> gamma_ ) 152 { 153 test = true; 154 } 155 } 156 return test; 157 } 85 virtual bool FileInput( ifstream& ifs); 158 86 159 87 -
Interface_Web/trunk/pspaWT/include/mathematicalTools.h
r52 r166 91 91 inline const double& operator() (int index) const { return vec_[index]; } 92 92 93 inline void operator = (const TRIDVECTOR& triv) 94 { 95 setComponents( triv.vec_[0],triv.vec_[1], triv.vec_[2]); 93 inline TRIDVECTOR& operator= (const TRIDVECTOR& triv) 94 { 95 setComponents( triv.vec_[0],triv.vec_[1], triv.vec_[2]); 96 return *this; 96 97 } 97 98 -
Interface_Web/trunk/pspaWT/include/particleBeam.h
r153 r166 11 11 #include "bareParticle.h" 12 12 #include "mathematicalTools.h" 13 #include "mathematicalConstants.h"14 #include "PhysicalConstants.h"15 13 #include "nomdElements.h" 16 14 17 15 using namespace std; 18 16 19 struct particle 17 typedef struct 20 18 { 21 19 float xx, xxp, begamx,yy,yyp,begamy,z, begamz,phi,wz; … … 31 29 printf( " %e %e %e %e %e %e %e %e %e %e %d %d %d, %d %e %e %e %e \n", xx, xxp, begamx,yy,yyp,begamy,z, begamz,phi,wz,ne,np,ngood,npart,phi0, ksi1,ksi2,ksi3); 32 30 } 33 } ;31 } parmelaParticle; 34 32 35 33 … … 45 43 vector<bareParticle> goodPartic_; 46 44 47 48 49 45 vector< vector<double> > rij_transportMoments_; 46 vector<double> centroid_; 47 double P0Transport_; 50 48 51 49 52 50 void readTransportMoments(ifstream& inp); 53 51 54 void impressionDesMoments() const; 52 void impressionDesMoments() const; 53 void razDesMoments(); 55 54 56 55 57 56 public: 58 57 59 particleBeam() 60 { 61 rij_transportMoments_.resize(6); 62 unsigned dim=0; 63 unsigned k; 64 for ( k=0; k < 6; k++) 65 { 66 rij_transportMoments_.at(k).resize(++dim); 67 } 68 P0Transport_ = 0.0; 69 particleRepresentationOk_ = false; 70 momentRepresentationOk_ = false; 71 72 } 58 particleBeam(); 73 59 74 60 ~particleBeam() {;} 75 61 76 62 bool setFromParmela(unsigned numeroElement,double referencefrequency); 77 63 void buildMomentRepresentation(); 78 64 79 // bool setFromTransport(ifstream& inp, unsigned nblignes); 80 bool setFromTransport(string elementLabel, const nomdElements elem); 65 bool setFromTransport(string elementLabel, const nomdElements elem); 81 66 82 inline void clear() 83 { 84 goodPartic_.clear(); 85 P0Transport_ = 0.0; 86 particleRepresentationOk_ = false; 87 momentRepresentationOk_ = false; 88 } 67 void clear(); 89 68 90 inline int getNbParticles() const 91 { 92 return goodPartic_.size(); 93 } 69 int getNbParticles() const; 94 70 95 inline const vector< vector<double> >& getTransportMoments() const { return rij_transportMoments_;}96 inline double getP0Transport() const { return P0Transport_;}97 inline bool particleRepresentationOk() const {return particleRepresentationOk_;}98 inline bool momentRepresentationOk() const {return momentRepresentationOk_;}71 const vector< vector<double> >& getTransportMoments() const; 72 double getP0Transport() const; 73 bool particleRepresentationOk() const; 74 bool momentRepresentationOk() const; 99 75 100 76 101 inline void addParticle( bareParticle p) 102 { 103 goodPartic_.push_back(p); 104 } 77 void addParticle( bareParticle p); 105 78 106 79 107 80 108 inline const vector<bareParticle>& getParticleVector() const 109 { 110 return goodPartic_; 111 } 81 const vector<bareParticle>& getParticleVector() const; 112 82 113 inline vector<bareParticle>& getParticleVector() 114 { 115 return goodPartic_; 116 } 83 vector<bareParticle>& getParticleVector(); 117 84 118 double getXmaxRms();85 double getXmaxRms(); 119 86 120 void getVariance(double& varx, double& vary, double& varz) const;87 void getVariance(double& varx, double& vary, double& varz) const; 121 88 122 89 123 void printAllXYZ() const;90 void printAllXYZ() const; 124 91 125 92 126 void Zrange(double& zmin, double& zmax) const;93 void Zrange(double& zmin, double& zmax) const; 127 94 128 void donneesDessinEllipseXxp(vector<double>& xcor, vector<double>& ycor);95 void donneesDessinEllipseXxp(vector<double>& xcor, vector<double>& ycor); 129 96 130 97 131 virtual string FileOutputFlow() const;98 virtual string FileOutputFlow() const; 132 99 133 100 134 virtual bool FileInput(ifstream& ifs);101 virtual bool FileInput(ifstream& ifs); 135 102 136 103
Note: See TracChangeset
for help on using the changeset viewer.