Changeset 86 in PSPA for Interface_Web


Ignore:
Timestamp:
Nov 19, 2012, 5:47:08 PM (12 years ago)
Author:
lemeur
Message:

dessin ellipse transport

Location:
Interface_Web/trunk/pspaWT
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/trunk/pspaWT/include/GWt_pspaApplication.h

    r81 r86  
    7070  void faireDessin();
    7171
     72  void faireDessinTransport();
    7273
    7374
  • Interface_Web/trunk/pspaWT/include/particleBeam.h

    r84 r86  
    119119 void Zrange(double& zmin, double& zmax) const;
    120120
    121 
     121 void donneesDessinEllipseXxp(vector<double>& xcor, vector<double>& ycor);
    122122
    123123
  • Interface_Web/trunk/pspaWT/src/GWt_pspaApplication.cc

    r85 r86  
    417417          {
    418418            resul = dtmanage_->executeParmela( debut, fin);
    419             faireDessin();
     419                    faireDessin();
    420420            addConsoleMessage(resul);
    421421          }
     
    423423          {
    424424            resul = dtmanage_->executeTransport( debut, fin);
     425            faireDessinTransport();
    425426            addConsoleMessage(resul);
    426427          }
     
    521522// }
    522523
     524void 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
    523567void PspaApplication::updateSelections()
    524568{
  • Interface_Web/trunk/pspaWT/src/particleBeam.cc

    r84 r86  
    356356     momentRepresentationOk_ = true;
    357357  }
     358
     359void 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.