Changeset 417 in PSPA for Interface_Web
- Timestamp:
- Jun 10, 2013, 4:52:52 PM (11 years ago)
- Location:
- Interface_Web/trunk/pspaWT
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/History
r415 r417 5 5 PSPA - Plateforme de simulation en physique des accélérateurs 6 6 ========================================================= 7 8 10 juin 2013 : Guy Le Meur 9 - redefinition du faisceau (particleBeam) comme donné à z = cte 10 - pour PARMELA, quand le faiceau n'est pas donné par rfgun, on recule 11 le faisceau, pour qu'au début du calcul il soit tout entier avant le 12 premier élément. 7 13 8 14 18 avril 2013 : Laurent Garnier -
Interface_Web/trunk/pspaWT/sources/controler/include/particleBeam.h
r414 r417 20 20 double P0Transport_; 21 21 22 // la representation du faisceau de particules sera a preciser ulterieurement 23 // Pour l'instant une particule courante est definie par : 24 // x 25 // y 26 // deltaz = z - z0 (z0 est le z de la particule de reference) 27 // gamma.betax 22 // ce faisceau contient les coordonnees des particules quand elles 23 // passe en un z, qui est celui de la particules de reference ( 24 // (particule donne par l'attribut referenceParticle_ ci-dessous ; 25 // cette particule est abstraite, car elle est dupliquee dans le faisceau 26 // proprement dit, et n'intervient plus, en tant que telle, dans la dynamique) 27 28 // Une particule courante est definie par : 29 // x (cm) 30 // y (cm) 31 // cdeltat = dephasage, donc décalage en z, exprime en c.dt soit, en cm 32 // cdeltat > 0 implique que la particule est en avance sur la particule de ref. 33 // gamma.betax (radians ? a verifier) 28 34 // gamma.betay 29 35 // gamma.betaz 30 vector<bareParticle> goodPartic_;31 36 32 // par ailleurs, la particules de reference est definie par x,y,z,gamma.betax, gamma.betay, gamma.betaz 33 // elle est dupliquee dans le faisceau prorement dit (goodPartic_) avec z = z-z0 et ne doit, par consequent, 34 // pas etre prise en compte dans les calculs de trajectoire. 37 vector<bareParticle> relativePartic_; 38 // La particule de reference (abstraite) est definie par x,y,z,gamma.betax, gamma.betay, gamma.betaz 39 // elle est dupliquee dans le faisceau proprement dit (relativePartic_) avec z = 0; 40 35 41 bareParticle referenceParticle_; 36 42 … … 94 100 } 95 101 102 96 103 public: 97 104 … … 112 119 vector<bareParticle>& getParticleVector(); 113 120 double getXmaxRms(); 114 void getVariance(double& varx, double& vary, double& varz) const;121 // void getVariance(double& varx, double& vary, double& varz) const; 115 122 void set2Moments(beam2Moments& moments); 116 123 void setWithParticles(vector<double>& centroid, bareParticle& referencePart, vector<bareParticle>& particles); 117 124 void printAllXYZ() const; 118 void Zrange (double& zmin, double& zmax) const;125 void ZrangeCdt(double& zmin, double& zmax) const; // extension en phase (cm) 119 126 void donneesDessinEllipse(vector<double>& xcor, vector<double>& ycor, vector<string>& legende, string namex, string namey); 120 127 void particlesPhaseSpaceData(vector<double>& xcor, vector<double>& ycor, vector<string>& legende, string namex, string namey); 121 virtual string FileOutputFlow() const; 128 129 130 // coordonnees d'une particule dans le faisceau deploye ( passage 131 // d'une representation z=cte a une representation t=cte) 132 TRIDVECTOR coordonneesDeployees(unsigned particleIndex, double cdtShift = 0.0); 133 134 inline TRIDVECTOR betaGamma(unsigned particleIndex) { 135 return relativePartic_.at(particleIndex).getBetaGamma(); 136 } 137 138 virtual string fileOutputFlow() const; 122 139 virtual bool FileInput(ifstream& ifs); 123 140 -
Interface_Web/trunk/pspaWT/sources/controler/include/softwareParmela.h
r386 r417 16 16 17 17 vector<int> relativeParmelaElementIndices_; 18 18 19 19 20 bool beamFromParmela(string workingDir,unsigned numeroElement, double referencefrequency, vector<double>& centroid, bareParticle& refPart,vector<bareParticle>& particles ); -
Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc
r414 r417 19 19 20 20 void particleBeam::clear() { 21 goodPartic_.clear();21 relativePartic_.clear(); 22 22 rij_.raz(); 23 23 P0Transport_ = 0.0; … … 27 27 28 28 int particleBeam::getNbParticles() const { 29 return goodPartic_.size();29 return relativePartic_.size(); 30 30 } 31 31 … … 99 99 centroid_ = centroid; 100 100 referenceParticle_ = referencePart; 101 goodPartic_.clear();102 goodPartic_ = particles;103 cout << " particleBeam::setWithParticles taille vect. part. ENREGISTRE " << goodPartic_.size() << endl;101 relativePartic_.clear(); 102 relativePartic_ = particles; 103 cout << " particleBeam::setWithParticles taille vect. part. ENREGISTRE " << relativePartic_.size() << endl; 104 104 particleRepresentationOk_ = true; 105 105 } … … 114 114 void particleBeam::addParticle( bareParticle p) 115 115 { 116 goodPartic_.push_back(p);116 relativePartic_.push_back(p); 117 117 } 118 118 119 119 const vector<bareParticle>& particleBeam::getParticleVector() const 120 120 { 121 return goodPartic_;121 return relativePartic_; 122 122 } 123 123 124 124 vector<bareParticle>& particleBeam::getParticleVector() 125 125 { 126 return goodPartic_;127 } 128 129 void particleBeam::getVariance(double& varx, double& vary, double& varz) const {130 unsigned int k;131 double x,y,z;132 double xav = 0.;133 double yav = 0.;134 double zav = 0.;135 double xavsq = 0.;136 double yavsq = 0.;137 double zavsq = 0.;138 139 TRIDVECTOR pos;140 141 142 for ( k = 0 ; k < goodPartic_.size(); k++) {143 pos = goodPartic_.at(k).getPosition();144 pos.getComponents(x,y,z);145 // partic_[k].getXYZ(x,y,z);146 xav += x;147 xavsq += x*x;148 yav += y;149 yavsq += y*y;150 zav += z;151 zavsq += z*z;152 }153 154 double aginv = double (goodPartic_.size());155 aginv = 1.0/aginv;156 157 varx = aginv * ( xavsq - xav*xav*aginv );158 vary = aginv * ( yavsq - yav*yav*aginv );159 varz = aginv * ( zavsq - zav*zav*aginv );160 }126 return relativePartic_; 127 } 128 129 // void particleBeam::getVariance(double& varx, double& vary, double& varz) const { 130 // unsigned int k; 131 // double x,y,z; 132 // double xav = 0.; 133 // double yav = 0.; 134 // double zav = 0.; 135 // double xavsq = 0.; 136 // double yavsq = 0.; 137 // double zavsq = 0.; 138 139 // TRIDVECTOR pos; 140 141 142 // for ( k = 0 ; k < goodPartic_.size(); k++) { 143 // pos = goodPartic_.at(k).getPosition(); 144 // pos.getComponents(x,y,z); 145 // // partic_[k].getXYZ(x,y,z); 146 // xav += x; 147 // xavsq += x*x; 148 // yav += y; 149 // yavsq += y*y; 150 // zav += z; 151 // zavsq += z*z; 152 // } 153 154 // double aginv = double (goodPartic_.size()); 155 // aginv = 1.0/aginv; 156 157 // varx = aginv * ( xavsq - xav*xav*aginv ); 158 // vary = aginv * ( yavsq - yav*yav*aginv ); 159 // varz = aginv * ( zavsq - zav*zav*aginv ); 160 // } 161 161 162 162 163 163 void particleBeam::printAllXYZ() const { 164 164 cout << " dump du faisceau : " << endl; 165 cout << goodPartic_.size() << " particules " << endl;165 cout << relativePartic_.size() << " particules " << endl; 166 166 unsigned int k; 167 for ( k = 0 ; k < goodPartic_.size(); k++)167 for ( k = 0 ; k < relativePartic_.size(); k++) 168 168 { 169 169 double xx,yy,zz; 170 goodPartic_.at(k).getPosition().getComponents(xx,yy,zz);170 relativePartic_.at(k).getPosition().getComponents(xx,yy,zz); 171 171 double betgamx, betgamy, betgamz; 172 goodPartic_.at(k).getBetaGamma().getComponents(betgamx, betgamy, betgamz);173 cout << " part. numero " << k << " x= " << xx << " y= " << yy << " z= " << zz << " betgamx= " << betgamx << " betgamy= " << betgamy << " betgamz= " << betgamz << endl;174 } 175 } 176 177 178 179 void particleBeam::Zrange (double& zmin, double& zmax) const {172 relativePartic_.at(k).getBetaGamma().getComponents(betgamx, betgamy, betgamz); 173 cout << " part. numero " << k << " x= " << xx << " y= " << yy << " dphas (c.dt, cm) = " << zz << " betgamx= " << betgamx << " betgamy= " << betgamy << " betgamz= " << betgamz << endl; 174 } 175 } 176 177 178 // extension en phase (cm) 179 void particleBeam::ZrangeCdt(double& cdtmin, double& cdtmax) const { 180 180 double z; 181 zmin = GRAND;182 zmax = -zmin;181 cdtmin = GRAND; 182 cdtmax = -cdtmin; 183 183 184 184 unsigned int k; 185 for ( k = 0 ; k < goodPartic_.size(); k++)185 for ( k = 0 ; k < relativePartic_.size(); k++) 186 186 { 187 z = goodPartic_.at(k).getZ();188 if ( z < zmin ) zmin = z;189 else if ( z > zmax) zmax = z;190 } 191 } 192 193 194 195 string particleBeam:: FileOutputFlow() const {187 z = relativePartic_.at(k).getZ(); // ce z est un dephasage, c.dt, en cm 188 if ( z < cdtmin ) cdtmin = z; 189 else if ( z > cdtmax) cdtmax = z; 190 } 191 } 192 193 194 195 string particleBeam::fileOutputFlow() const { 196 196 ostringstream sortie; 197 197 unsigned int k; 198 for ( k = 0 ; k < goodPartic_.size(); k++)198 for ( k = 0 ; k < relativePartic_.size(); k++) 199 199 { 200 sortie << goodPartic_.at(k).FileOutputFlow() << endl;200 sortie << relativePartic_.at(k).FileOutputFlow() << endl; 201 201 } 202 202 sortie << endl; … … 219 219 220 220 void particleBeam::buildMomentRepresentation() { 221 221 // le faisceau cense etre represente en un z donne (reference) sera 222 // ici deploye spatialement (faisceau en un temps donne) 222 223 unsigned k,j,m; 223 224 double auxj, auxm; … … 248 249 double PMeVsc; 249 250 double del; 251 // double xp,yp,dz,cdt; 250 252 vector<double> part(6, 0.0); 251 253 252 254 vector< vector<double> >& matrice = rij_.getMatrix(); 253 255 254 255 for (k=0; k < goodPartic_.size(); k++) { 256 gamma = goodPartic_.at(k).getGamma(); 257 pos = goodPartic_.at(k).getPosition(); 258 begam= goodPartic_.at(k).getBetaGamma(); 256 TRIDVECTOR positionDeployee; 257 258 for (k=0; k < relativePartic_.size(); k++) { 259 260 positionDeployee = coordonneesDeployees(k); 261 gamma = relativePartic_.at(k).getGamma(); 262 263 // pos = relativePartic_.at(k).getPosition(); 264 // cdt = pos.getComponent(2); 265 begam= relativePartic_.at(k).getBetaGamma(); 259 266 begamz = begam.getComponent(2); 260 267 g = gamma -1.0; … … 262 269 del = 100.0 * ( PMeVsc - P_reference_MeV_sur_c ) / P_reference_MeV_sur_c ; // en % 263 270 264 part[0] = pos.getComponent(0); 271 // dz = begamz * cdt / gamma; 272 // xp = begam.getComponent(0)/begamz; 273 // yp = begam.getComponent(1)/begamz; 274 275 part[0] = positionDeployee.getComponent(0); 265 276 part[1] = begam.getComponent(0)/begamz; 266 part[2] = pos .getComponent(1);277 part[2] = positionDeployee.getComponent(1); 267 278 part[3] = begam.getComponent(1)/begamz; 268 part[4] = pos .getComponent(2);279 part[4] = positionDeployee.getComponent(2); 269 280 part[5] = del; 270 281 … … 286 297 287 298 // moyenne 288 double facmoy = 1.0/double( goodPartic_.size() );299 double facmoy = 1.0/double( relativePartic_.size() ); 289 300 for ( j = 0; j < 6; j++) { 290 301 ( matrice.at(j) ).at(j) = sqrt(( matrice.at(j) ).at(j) * facmoy ); … … 359 370 360 371 // renvoie (dans le vecteur coord) la liste des coordonnées d'index 'index' : 361 // index = 0 , 1, 2 -> x,y,z 372 // index = 0 , 1, 2 -> x,y,z (en coordonnees deployees) 362 373 // index = 3,4 -> x' = betax/betaz , y' = betay/betaz 363 374 // index = 5 -> Ec : energie cinetique … … 367 378 368 379 coord.clear(); 369 coord.resize( goodPartic_.size(), 0.0 );380 coord.resize(relativePartic_.size(), 0.0 ); 370 381 cout << " particleBeam::particlesPhaseSpaceComponent index = " << index << endl; 371 382 372 383 if ( index <= 2 ) { 373 for (unsigned i = 0; i < goodPartic_.size(); ++i) { 374 coord.at(i) = 10.*goodPartic_.at(i).getPosition().getComponent(index); // en mm 384 385 for (unsigned i = 0; i < relativePartic_.size(); ++i) { 386 387 coord.at(i) = 10.*coordonneesDeployees(i).getComponent(index); 388 // coord.at(i) = 10.*relativePartic_.at(i).getPosition().getComponent(index); // en mm 375 389 } 376 390 return; … … 378 392 379 393 if ( index > 2 && index < 5 ) { 380 for (unsigned i = 0; i < goodPartic_.size(); ++i) {381 double begamz = goodPartic_.at(i).getBetaGamma().getComponent(2);394 for (unsigned i = 0; i < relativePartic_.size(); ++i) { 395 double begamz = relativePartic_.at(i).getBetaGamma().getComponent(2); 382 396 if ( begamz != 0.0) { 383 coord.at(i) = 1000.* goodPartic_.at(i).getBetaGamma().getComponent(index - 3)/begamz; // milliradians397 coord.at(i) = 1000.*relativePartic_.at(i).getBetaGamma().getComponent(index - 3)/begamz; // milliradians 384 398 } else { 385 399 coord.at(i) = 0.0; … … 392 406 double gamma0 = referenceParticle_.getGamma(); 393 407 if ( gamma0 == 0.0 ) return; 394 for (unsigned i = 0; i < goodPartic_.size(); ++i) {395 coord.at(i) = 100.*( goodPartic_.at(i).getGamma() - gamma0)/gamma0; // en %408 for (unsigned i = 0; i < relativePartic_.size(); ++i) { 409 coord.at(i) = 100.*(relativePartic_.at(i).getGamma() - gamma0)/gamma0; // en % 396 410 } 397 411 return; … … 618 632 double ecatyp= 0.0; 619 633 620 for (unsigned int k = 0; k < goodPartic_.size(); k++) {634 for (unsigned int k = 0; k < relativePartic_.size(); k++) { 621 635 if (vshf[k] < vmin) vmin = vshf[k]; 622 636 else if (vshf[k] > vmax) vmax = vshf[k]; … … 625 639 } 626 640 627 double sum= (float) goodPartic_.size();641 double sum= (float)relativePartic_.size(); 628 642 out[0]= sum; 629 643 vmoy /= sum; … … 654 668 } 655 669 656 for (unsigned int k = 0; k < goodPartic_.size(); k++) {670 for (unsigned int k = 0; k < relativePartic_.size(); k++) { 657 671 vshf[k] -= vmoy; 658 672 } … … 706 720 } 707 721 722 // coordonnees d'une particule dans le faisceau deploye ( passage 723 // d'une representation z=cte a une representation t=cte) 724 TRIDVECTOR particleBeam::coordonneesDeployees(unsigned particleIndex, double cdtShift) { 725 double gamma = relativePartic_.at(particleIndex).getGamma(); 726 // TRIDVECTOR pos = relativePartic_.at(particleIndex).getPosition(); 727 double xx = relativePartic_.at(particleIndex).getReferenceToPosition().getComponent(0); 728 double yy = relativePartic_.at(particleIndex).getReferenceToPosition().getComponent(1); 729 double cdt = relativePartic_.at(particleIndex).getReferenceToPosition().getComponent(2); 730 cdt += cdtShift; 731 // TRIDVECTOR begam= goodPartic_.at(particleIndex).getBetaGamma(); 732 double begamz = relativePartic_.at(particleIndex).getReferenceToBetaGamma().getComponent(2); 733 double dz = begamz * cdt / gamma; 734 double xp = relativePartic_.at(particleIndex).getReferenceToBetaGamma().getComponent(0)/begamz; 735 double yp = relativePartic_.at(particleIndex).getReferenceToBetaGamma().getComponent(1)/begamz; 736 xx += xp * dz; 737 yy += yp * dz; 738 return TRIDVECTOR(xx, yy, dz); 739 } -
Interface_Web/trunk/pspaWT/sources/controler/src/softwareGenerator.cc
r386 r417 182 182 // passiveParticles.resize(nbProbPart, bareParticle()); 183 183 double x,y; 184 double deltaz;185 double deltat;184 // double deltaz; 185 double cdeltat; 186 186 TRIDVECTOR pos; 187 187 TRIDVECTOR betagamma; … … 207 207 double gamma = sqrt(1.0 + betagamma.norm2()); 208 208 209 // decalage temporel par rapport a la reference 210 deltat = faisceau.at(k).clock - timeRef; // nanoseondes 211 double ds = CLIGHT_m_per_ns * deltat /gamma; 212 x += betaGammax * ds; // en metres 213 y += betaGammay * ds; 209 // decalage temporel par rapport a la reference ? 210 // on prend le faisceau sous la forme "a un instant donne" 211 212 // deltat = faisceau.at(k).clock - timeRef; // nanoseondes 213 cdeltat = CLIGHT_m_per_ns * (faisceau.at(k).clock - timeRef); // metres 214 // double ds = CLIGHT_m_per_ns * deltat /gamma; 215 // x += betaGammax * ds; // en metres 216 // y += betaGammay * ds; 214 217 215 218 // ici on neglige la difference entre gamma de la part. et gamma de la ref. 216 deltaz = (pzPartRel/EREST_eV) * CLIGHT_m_per_ns * deltat; // en metres 217 218 pos.setComponents(100.*x,100.*y,100.*deltaz); // en cm 219 // deltaz = (pzPartRel/EREST_eV) * CLIGHT_m_per_ns * deltat; // en metres 220 221 // pos.setComponents(100.*x,100.*y,100.*deltaz); // en cm 222 pos.setComponents(100.*x,100.*y,100.*cdeltat); // en cm 219 223 if ( faisceau.at(k).flag == -1 ) { 220 224 particles.push_back(bareParticle(pos,betagamma)); -
Interface_Web/trunk/pspaWT/sources/controler/src/softwareParmela.cc
r398 r417 22 22 cout << " setRelativeParmelaElementIndices() taille a priori : " << relativeParmelaElementIndices_.size() << endl; 23 23 abstractElement* elPtr = dataManager_->getElementPointerFromNumero(numeroDeb_); 24 24 25 bool there_is_rfgun = ( elPtr->getNomdElement().getElementType() == RFgun ); 25 26 unsigned offsetNumElem; … … 262 263 particles.clear(); 263 264 particles.resize(faisceau.size(), bareParticle()); 264 double x,xp,y,yp; 265 // double x,xp,y,yp; 266 double xp, yp; 265 267 double betagammaz; 266 double betaz;267 double deltaz;268 // double betaz; 269 double cdt; 268 270 double dephas; 269 271 double g; … … 273 275 // sont donnes en radians 274 276 for (unsigned k = 0; k < faisceau.size(); k++) { 275 x= faisceau.at(k).xx;277 // x= faisceau.at(k).xx; 276 278 xp=faisceau.at(k).xxp; 277 y= faisceau.at(k).yy;279 // y= faisceau.at(k).yy; 278 280 yp=faisceau.at(k).yyp; 279 281 // dephasage par rapport a la reference … … 281 283 g = faisceau.at(k).wz/EREST_MeV; 282 284 betagammaz = faisceau.at(k).begamz; 283 betaz = betagammaz/(g+1.0); 284 deltaz = FACTEUR * betaz * dephas / referencefrequency; 285 x += xp * deltaz; 286 y += yp * deltaz; 287 pos.setComponents(x,y,deltaz); 285 // betaz = betagammaz/(g+1.0); 286 // deltaz = FACTEUR * betaz * dephas / referencefrequency; 287 cdt = FACTEUR * dephas / referencefrequency; 288 // x += xp * deltaz; 289 // y += yp * deltaz; 290 pos.setComponents(faisceau.at(k).xx,faisceau.at(k).yy,cdt); 288 291 betagamma.setComponents(xp*betagammaz, yp*betagammaz, betagammaz); 289 292 particles.at(k) = bareParticle(pos,betagamma); … … 311 314 } 312 315 313 const vector<bareParticle>& partic = beam->getParticleVector();316 // const vector<bareParticle>& partic = beam->getParticleVector(); 314 317 double weight = 1.0; 315 318 double xx,yy,zz; 316 319 double begamx, begamy, begamz; 317 for (unsigned k = 0; k < partic.size(); k++) { 318 partic.at(k).getPosition().getComponents(xx,yy,zz); 319 partic.at(k).getBetaGamma().getComponents(begamx,begamy,begamz); 320 // TRIDVECTOR pos, begam; 321 double zmin = GRAND; 322 double zmax = -zmin; 323 double cdtmin, cdtmax; 324 beam->ZrangeCdt(cdtmin, cdtmax); 325 cout << " softwareParmela::beamToParmela cdtmin = " << cdtmin << " cdtmax = " << cdtmax << endl; 326 327 for (unsigned k = 0; k < beam->getNbParticles(); k++) { 328 // partic.at(k).getPosition().getComponents(xx,yy,zz); 329 // partic.at(k).getBetaGamma().getComponents(begamx,begamy,begamz); 330 beam->coordonneesDeployees(k, -cdtmax).getComponents(xx,yy,zz); 331 beam->betaGamma(k).getComponents(begamx,begamy,begamz); 332 if ( zz > zmax) zmax = zz; 333 if ( zz < zmin ) zmin = zz; 320 334 outfile << xx << " " << begamx << " " << yy << " " << begamy << " " << zz << " " << begamz << " " << weight << endl; 321 335 } 322 336 outfile.close(); 337 cout << " softwareParmela::beamToParmela zmn = " << zmin << " zmax = " << zmax << endl; 323 338 return true; 324 339 } -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h
r414 r417 92 92 // void scatterPlot1D(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor); 93 93 94 void chartPlot2vec(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor, bool drawPoints, string title, string legendx, string legendy, int width, int height, bool makeIcon=false);94 // void chartPlot2vec(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor, bool drawPoints, string title, string legendx, string legendy, int width, int height, bool makeIcon=false); 95 95 void chartPlot2vec(WContainerWidget* toto,vector<double>& xcor,vector<double>& ycor,Wt::Chart::SeriesType seriesType,Wt::Chart::FillRangeType fillRange,Wt::Chart::AxisValue value,bool isGridLinesEnables,string title,string legendx,string legendy,int width,int height,bool makeIcon = false); 96 96 -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_console.cc
r411 r417 24 24 Wt::WLabel *label = new Wt::WLabel("Search ", searchContainer); 25 25 searchLineEdit_ = new Wt::WLineEdit("", searchContainer); 26 searchLineEdit_->setToolTip("clic here to search a string in tothe output");26 searchLineEdit_->setToolTip("clic here to search a string in the output"); 27 27 28 28 // le panel -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc
r416 r417 702 702 703 703 704 // parametre drawPoints : true = on trace des points (phase space) ; false = on trace des lignes (enveloppes...)705 void PspaApplication::chartPlot2vec(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor, bool drawPoints,string title,string legendx, string legendy,int width, int height, bool makeIcon)706 {707 int nbpts = xcor.size();708 cout << " PspaApplication::chartPlot2vec nbpts = " << nbpts << endl;709 WStandardItemModel *model = new WStandardItemModel(nbpts, 2, toto);710 for (int i = 0; i < nbpts; ++i) {711 model->setData(i, 0, xcor.at(i));712 model->setData(i, 1, ycor.at(i));713 // cout << " PspaApplication::chartPlot2vec el= " << i+1 << " x= " << xcor.at(i) << " y= " << ycor.at(i) << endl;714 }715 716 WCartesianChart *chart = new WCartesianChart(toto);717 if (!makeIcon) {718 chart->setTitle(title);719 }720 chart->initLayout();721 722 chart->setModel(model); // set the model723 chart->setXSeriesColumn(0); // set the column that holds the X data724 if (!makeIcon) {725 chart->setLegendEnabled(true); // enable the legend726 } else {727 chart->setLegendEnabled(false); // enable the legend728 }729 730 chart->setType(ScatterPlot); // set type to ScatterPlot731 732 // Typically, for mathematical functions, you want the axes to cross733 // at the 0 mark:734 chart->axis(XAxis).setLocation(ZeroValue);735 chart->axis(YAxis).setLocation(ZeroValue);736 737 // Provide space for the X and Y axis and title.738 chart->setPlotAreaPadding(80, Left); // ?739 chart->setPlotAreaPadding(40, Bottom);740 chart->setPlotAreaPadding(60, Top);741 if ( drawPoints ) {742 WDataSeries s(1, PointSeries, Y1Axis);743 chart->addSeries(s);744 } else {745 WDataSeries s(1, LineSeries, Y1Axis);746 chart->addSeries(s);747 }748 chart->resize(width, height); // WPaintedWidget must be given explicit size749 750 751 WAxis& axis = chart->axis(XAxis);752 axis.setLabelFormat("%.3f");753 // axis.setGridLinesEnabled(true);754 axis.setTitle(legendx);755 756 WAxis& axey = chart->axis(YAxis);757 axey.setTitle(legendy);758 // axis = chart->axis(YAxis);759 // axis.setLabelFormat("%.3f");760 // axis.setGridLinesEnabled(true);761 // axis.setTitle(legendy);762 763 if (makeIcon) {764 chart->setPlotAreaPadding(0);765 chart->setAxisPadding(0);766 WFont xAxisFont = chart->axis(XAxis).labelFont();767 xAxisFont.setSize(8);768 WFont yAxisFont = chart->axis(YAxis).labelFont();769 yAxisFont.setSize(8);770 chart->axis(XAxis).setLabelFont(xAxisFont);771 chart->axis(YAxis).setLabelFont(yAxisFont);772 }773 774 #ifdef HAS_IMAGEMAGIC775 / * Wt::WRasterImage pngImage("png", 600, 600);776 Wt::WPainter p(&pngImage);777 chart->paint(p);778 std::string name;779 name = workingDir_ + "/chart-"+sessionId ()+".png";780 std::ofstream f(name.c_str(), std::ios::out |std::ios::trunc | std::ios::binary);781 pngImage.write(f);782 new WText("<a href='workingArea/chart-"+sessionId ()+".png' target='_blank'>Afficher l'image</a>",toto);783 784 Wt::WPdfImage pdfImage("30cm", "30cm");785 Wt::WPainter p1(&pdfImage);786 pdfImage.init();787 chart->paint(p1);788 name = workingDir_ + "/chart-"+sessionId ()+".pdf";789 std::ofstream f1(name.c_str(), std::ios::out |std::ios::trunc | std::ios::binary);790 pdfImage.write(f1);791 */792 #endif793 }704 // // parametre drawPoints : true = on trace des points (phase space) ; false = on trace des lignes (enveloppes...) 705 // void PspaApplication::chartPlot2vec(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor, bool drawPoints,string title,string legendx, string legendy,int width, int height, bool makeIcon) 706 // { 707 // int nbpts = xcor.size(); 708 // cout << " PspaApplication::chartPlot2vec nbpts = " << nbpts << endl; 709 // WStandardItemModel *model = new WStandardItemModel(nbpts, 2, toto); 710 // for (int i = 0; i < nbpts; ++i) { 711 // model->setData(i, 0, xcor.at(i)); 712 // model->setData(i, 1, ycor.at(i)); 713 // // cout << " PspaApplication::chartPlot2vec el= " << i+1 << " x= " << xcor.at(i) << " y= " << ycor.at(i) << endl; 714 // } 715 716 // WCartesianChart *chart = new WCartesianChart(toto); 717 // if (!makeIcon) { 718 // chart->setTitle(title); 719 // } 720 // chart->initLayout(); 721 722 // chart->setModel(model); // set the model 723 // chart->setXSeriesColumn(0); // set the column that holds the X data 724 // if (!makeIcon) { 725 // chart->setLegendEnabled(true); // enable the legend 726 // } else { 727 // chart->setLegendEnabled(false); // enable the legend 728 // } 729 730 // chart->setType(ScatterPlot); // set type to ScatterPlot 731 732 // // Typically, for mathematical functions, you want the axes to cross 733 // // at the 0 mark: 734 // chart->axis(XAxis).setLocation(ZeroValue); 735 // chart->axis(YAxis).setLocation(ZeroValue); 736 737 // // Provide space for the X and Y axis and title. 738 // chart->setPlotAreaPadding(80, Left); // ? 739 // chart->setPlotAreaPadding(40, Bottom); 740 // chart->setPlotAreaPadding(60, Top); 741 // if ( drawPoints ) { 742 // WDataSeries s(1, PointSeries, Y1Axis); 743 // chart->addSeries(s); 744 // } else { 745 // WDataSeries s(1, LineSeries, Y1Axis); 746 // chart->addSeries(s); 747 // } 748 // chart->resize(width, height); // WPaintedWidget must be given explicit size 749 750 751 // WAxis& axis = chart->axis(XAxis); 752 // axis.setLabelFormat("%.3f"); 753 // // axis.setGridLinesEnabled(true); 754 // axis.setTitle(legendx); 755 756 // WAxis& axey = chart->axis(YAxis); 757 // axey.setTitle(legendy); 758 // // axis = chart->axis(YAxis); 759 // // axis.setLabelFormat("%.3f"); 760 // // axis.setGridLinesEnabled(true); 761 // // axis.setTitle(legendy); 762 763 // if (makeIcon) { 764 // chart->setPlotAreaPadding(0); 765 // chart->setAxisPadding(0); 766 // WFont xAxisFont = chart->axis(XAxis).labelFont(); 767 // xAxisFont.setSize(8); 768 // WFont yAxisFont = chart->axis(YAxis).labelFont(); 769 // yAxisFont.setSize(8); 770 // chart->axis(XAxis).setLabelFont(xAxisFont); 771 // chart->axis(YAxis).setLabelFont(yAxisFont); 772 // } 773 774 // #ifdef HAS_IMAGEMAGIC 775 // /* Wt::WRasterImage pngImage("png", 600, 600); 776 // Wt::WPainter p(&pngImage); 777 // chart->paint(p); 778 // std::string name; 779 // name = workingDir_ + "/chart-"+sessionId ()+".png"; 780 // std::ofstream f(name.c_str(), std::ios::out |std::ios::trunc | std::ios::binary); 781 // pngImage.write(f); 782 // new WText("<a href='workingArea/chart-"+sessionId ()+".png' target='_blank'>Afficher l'image</a>",toto); 783 784 // Wt::WPdfImage pdfImage("30cm", "30cm"); 785 // Wt::WPainter p1(&pdfImage); 786 // pdfImage.init(); 787 // chart->paint(p1); 788 // name = workingDir_ + "/chart-"+sessionId ()+".pdf"; 789 // std::ofstream f1(name.c_str(), std::ios::out |std::ios::trunc | std::ios::binary); 790 // pdfImage.write(f1); 791 // */ 792 // #endif 793 // } 794 794 795 795 … … 950 950 */ 951 951 952 Wt::WPdfImage pdfImage("1000", "600"); 952 // Wt::WPdfImage pdfImage("1000", "600"); 953 WPdfImage pdfImage("1000", "600"); 953 954 { 954 955 Wt::WPainter p1(&pdfImage); -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_serverFileSelector.cc
r401 r417 11 11 #include <Wt/WIconPair> 12 12 #include <Wt/WApplication> 13 13 14 14 15 #include <boost/algorithm/string.hpp>
Note: See TracChangeset
for help on using the changeset viewer.