Changeset 86 in PSPA for Interface_Web
- Timestamp:
- Nov 19, 2012, 5:47:08 PM (12 years ago)
- Location:
- Interface_Web/trunk/pspaWT
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/include/GWt_pspaApplication.h
r81 r86 70 70 void faireDessin(); 71 71 72 void faireDessinTransport(); 72 73 73 74 -
Interface_Web/trunk/pspaWT/include/particleBeam.h
r84 r86 119 119 void Zrange(double& zmin, double& zmax) const; 120 120 121 121 void donneesDessinEllipseXxp(vector<double>& xcor, vector<double>& ycor); 122 122 123 123 -
Interface_Web/trunk/pspaWT/src/GWt_pspaApplication.cc
r85 r86 417 417 { 418 418 resul = dtmanage_->executeParmela( debut, fin); 419 faireDessin();419 faireDessin(); 420 420 addConsoleMessage(resul); 421 421 } … … 423 423 { 424 424 resul = dtmanage_->executeTransport( debut, fin); 425 faireDessinTransport(); 425 426 addConsoleMessage(resul); 426 427 } … … 521 522 // } 522 523 524 void PspaApplication::faireDessinTransport() 525 { 526 WContainerWidget* toto = leDessin_; 527 toto->clear(); 528 new WText("emittance transport", toto); 529 530 vector<double> xcor; 531 vector<double> ycor; 532 dtmanage_->getCurrentBeam().donneesDessinEllipseXxp(xcor,ycor); 533 int nbpts = xcor.size(); 534 cout << " PspaApplication::faireDessinTransport() nbpts = " << nbpts << endl; 535 WStandardItemModel *model = new WStandardItemModel(nbpts, 2, toto); 536 for (int i = 0; i < nbpts; ++i) { 537 model->setData(i, 0, xcor.at(i)); 538 model->setData(i, 1, ycor.at(i)); 539 } 540 541 WCartesianChart *chart = new WCartesianChart(toto); 542 chart->setModel(model); // set the model 543 chart->setXSeriesColumn(0); // set the column that holds the X data 544 chart->setLegendEnabled(true); // enable the legend 545 546 chart->setType(ScatterPlot); // set type to ScatterPlot 547 548 // Typically, for mathematical functions, you want the axes to cross 549 // at the 0 mark: 550 chart->axis(XAxis).setLocation(ZeroValue); 551 chart->axis(YAxis).setLocation(ZeroValue); 552 553 // Provide space for the X and Y axis and title. 554 chart->setPlotAreaPadding(80, Left); 555 chart->setPlotAreaPadding(40, Top | Bottom); 556 // Add the curves 557 WDataSeries s(1, CurveSeries, Y1Axis); 558 chart->addSeries(s); 559 560 chart->resize(300, 300); // WPaintedWidget must be given explicit size 561 562 } 563 564 565 566 523 567 void PspaApplication::updateSelections() 524 568 { -
Interface_Web/trunk/pspaWT/src/particleBeam.cc
r84 r86 356 356 momentRepresentationOk_ = true; 357 357 } 358 359 void particleBeam::donneesDessinEllipseXxp(vector<double>& xcor, vector<double>& ycor) 360 { 361 if ( !momentRepresentationOk_ ) return; 362 363 xcor.clear(); 364 ycor.clear(); 365 366 double xm = ( rij_transportMoments_.at(0) ).at(0); 367 double ym = ( rij_transportMoments_.at(1) ).at(1); 368 double r = ( rij_transportMoments_.at(1) ).at(0); 369 370 cout << " r= " << r << endl; 371 372 double rac = sqrt(1 - r*r); 373 double alpha = -r / rac; 374 double beta = xm / ( ym * rac); 375 double gamma = ym / ( xm * rac ); 376 double epsil = xm * ym * rac; 377 378 379 int nbintv = 50; 380 double pas = 2.0 * xm / nbintv; 381 double fac1 = -1.0 / ( beta * beta); 382 double fac2 = epsil/beta; 383 double fac3 = -alpha/beta; 384 int k; 385 double x,y; 386 double aux; 387 for ( k=0; k < nbintv; k++) 388 { 389 x = -xm + k*pas; 390 aux = fac1 * x * x + fac2; 391 // cout << " aux2= " << aux << endl; 392 if ( aux <= 0.0 ) 393 { 394 aux = 0.0; 395 } 396 else aux = sqrt(aux); 397 398 // y = fac3*x; 399 y = fac3*x + aux; 400 xcor.push_back(x); 401 ycor.push_back(y); 402 } 403 404 for ( k=0; k < nbintv; k++) 405 { 406 x = xm - k*pas; 407 aux = fac1 * x * x + fac2; 408 if ( aux <= 0.0 ) 409 { 410 aux = 0.0; 411 } 412 else aux = sqrt(aux); 413 // y = fac3*x; 414 y = fac3*x - aux; 415 xcor.push_back(x); 416 ycor.push_back(y); 417 } 418 }
Note: See TracChangeset
for help on using the changeset viewer.