Changeset 138 in PSPA for Interface_Web/trunk/pspaWT/src


Ignore:
Timestamp:
Dec 4, 2012, 7:46:42 PM (12 years ago)
Author:
lemeur
Message:

dessins

Location:
Interface_Web/trunk/pspaWT/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/trunk/pspaWT/src/GWt_pspaApplication.cc

    r132 r138  
    1919#include "GWt_LigneFaisceau.h"
    2020#include "GWt_globalParameters.h"
     21#include "particleBeam.h"
    2122#include "bareParticle.h"
    2223#include "nomDeLogiciel.h"
     
    187188  probleme_->setHidden(true);
    188189
     190  // signal de calcul en cours
     191  encours_ = new WText();
     192  encours_->decorationStyle().setBackgroundColor (WColor("green"));
     193  encours_->setHidden(true);
     194
    189195  // le panel
    190196  WPanel *panelLogiciels = new WPanel(executeW);
     
    197203  contenuSections_->addWidget(exec_go_);
    198204  contenuSections_->addWidget(probleme_);
     205  contenuSections_->addWidget(encours_);
    199206  contenuSections_->addWidget(new WBreak());
    200207  contenuSections_->addWidget(new WBreak());
     
    206213
    207214
    208 WWidget* PspaApplication::createDrawingWidget()
     215WContainerWidget* PspaApplication::createDrawingWidget()
    209216{
    210217  WContainerWidget* dessin = new WContainerWidget();
    211218
     219  dessin->addWidget(new WText(" graphic analysis :  "));
     220  dessin->addWidget(new WBreak());
    212221  dessin->addWidget(new WText(" drawing after element :  "));
     222
     223
     224  choixElementDessin_ = new WComboBox();
     225  dessin->addWidget(choixElementDessin_);
     226  WPushButton* caroule = new WPushButton("dessiner");
     227 dessin->addWidget(caroule);
     228 caroule->clicked().connect(this, &PspaApplication::dessiner);
     229
     230  dessin->addWidget(new WBreak());
     231
     232  toto_ = new WContainerWidget();
     233  dessin->addWidget(toto_);
    213234  return dessin;
    214235}
     
    378399  addConsoleMessage(string("on va peut etre y arriver"));
    379400  static_cast<GWt_globalParameters*>(globalParam_)->updateGlobals();
    380 
     401  encours_->decorationStyle().setBackgroundColor (WColor("green"));
     402  encours_->setText("calcul en cours");
     403  encours_->setHidden(false);
    381404  string resultat;
    382405  if ( !dtmanage_->executeAll(resultat)) probleme_->setHidden(false);
     
    384407  addConsoleMessage(resultat);
    385408  //  cout << " PspaApplication : affichage console termine  " << endl;
     409
     410  encours_->setText("c'est fini");
     411  encours_->decorationStyle().setBackgroundColor (WColor("orange"));
     412
    386413  faireDessin();
    387414}
     
    414441void PspaApplication::faireDessin()
    415442{
    416 
    417   //  leDessin_.clear();
    418 
    419 
    420   if ( dtmanage_->getCurrentBeam()->momentRepresentationOk() ) faireDessinTransport();
    421   else if ( dtmanage_->getCurrentBeam()->particleRepresentationOk() ) faireDessinParmela();
     443  choixElementDessin_->clear();
     444  int nombre = dtmanage_->beamLineSize();
     445  for ( int numero =1; numero <= nombre; numero++)
     446    {
     447      choixElementDessin_->addItem(dtmanage_->getLabelFromElementNumero(numero));
     448    }
     449
     450}
     451
     452void PspaApplication::dessiner()
     453{
     454 
     455  toto_->clear();
     456
     457  int index = choixElementDessin_->currentIndex();
     458  particleBeam* beam = dtmanage_->getDiagnosticBeam(index);
     459
     460  if ( beam->momentRepresentationOk() ) faireDessinTransport(toto_, beam);
     461  else if ( beam->particleRepresentationOk() ) faireDessinParmela(toto_, beam);
    422462  else addConsoleMessage("the beam state does not allow providing a drawing");
    423 }
    424 
    425 void PspaApplication::faireDessinParmela()
    426 {
    427   WContainerWidget* toto = static_cast<WContainerWidget*>(leDessin_);
    428   //  toto->clear();
    429        new WText("emittance", toto);
    430   vector<bareParticle>& partic = dtmanage_->getCurrentBeam()->getParticleVector();
    431 
    432 
     463  //////////////////////////////////////////
     464}
     465
     466
     467void PspaApplication::faireDessinParmela(WContainerWidget* toto, particleBeam* beam)
     468{
     469  // WContainerWidget* toto = static_cast<WContainerWidget*>(leDessin_);
     470  // //  toto->clear();
     471  //      new WText("emittance", toto);
     472  // vector<bareParticle>& partic = dtmanage_->getCurrentBeam()->getParticleVector();
     473       new WText("emittance parmela", toto);
     474  vector<bareParticle>& partic = beam->getParticleVector();
    433475  WStandardItemModel *model = new WStandardItemModel(partic.size(), 3, toto);
    434476  //    model->setHeaderData(0, WString("X"));
     
    481523// }
    482524
    483 void PspaApplication::faireDessinTransport()
    484 {
    485   //  WContainerWidget* toto = leDessin_;
    486   WContainerWidget* toto = static_cast<WContainerWidget*>(leDessin_);
     525void PspaApplication::faireDessinTransport(WContainerWidget* toto, particleBeam* beam)
     526{
     527  //  WContainerWidget* toto = static_cast<WContainerWidget*>(leDessin_);
    487528  //  toto->clear();
    488529  new WText("emittance transport", toto);
     
    490531  vector<double> xcor;
    491532  vector<double> ycor;
    492   dtmanage_->getCurrentBeam()->donneesDessinEllipseXxp(xcor,ycor);
     533  //  dtmanage_->getCurrentBeam()->donneesDessinEllipseXxp(xcor,ycor);
     534  beam->donneesDessinEllipseXxp(xcor,ycor);
    493535  int nbpts = xcor.size();
    494536  cout << " PspaApplication::faireDessinTransport() nbpts = " << nbpts << endl;
  • Interface_Web/trunk/pspaWT/src/GWt_soleno.cc

    r112 r138  
    2222  dialog_ = new WDialog("element SOLENOID");
    2323
    24   new WText("length : ",dialog_->contents());
     24  new WText("length (cm) : ",dialog_->contents());
    2525  xlengthEdit_ = new WLineEdit(param[1].c_str(), dialog_->contents());
    2626  new WBreak(dialog_->contents());
    27   new WText("aperture : ",dialog_->contents());
     27  new WText("aperture (cm) : ",dialog_->contents());
    2828  apertureEdit_ = new WLineEdit(param[2].c_str(), dialog_->contents());
    2929  new WBreak(dialog_->contents());
  • Interface_Web/trunk/pspaWT/src/dataManager.cc

    r128 r138  
    467467}
    468468
     469  particleBeam* dataManager::getDiagnosticBeam(int index)
     470  {
     471    cout << " particleBeam* dataManager je vais dessiner " << getLabelFromElementNumero(index+1) << endl;
     472    return &diagnosticBeam_.at(index);
     473  }
  • Interface_Web/trunk/pspaWT/src/elementSoleno.cc

    r128 r138  
    6868  {
    6969    ostringstream sortie;
    70     sortie << label_ << ":" << "  SOLENOID, L=" << lenghtElem_ << ", B=" << B0_ << ";";
     70    // on passe la longueur en metres
     71    sortie << label_ << ":" << "  SOLENOID, L=" << 0.01*lenghtElem_ << ", B=" << B0_ << ";";
    7172    return sortie.str();
    7273  }
  • Interface_Web/trunk/pspaWT/src/particleBeam.cc

    r129 r138  
    446446void particleBeam::donneesDessinEllipseXxp(vector<double>& xcor, vector<double>& ycor)
    447447{
     448      int k;
     449      double x,y;
     450
    448451  if ( !momentRepresentationOk_ ) return;
    449452
     
    455458  double r  = ( rij_transportMoments_.at(1) ).at(0);
    456459
     460  int nbintv = 50;
     461  if ( xm == 0.0 ) return;
     462  double pas = 2.0 * xm / nbintv;
     463
    457464  //  cout << " r= " << r << endl;
    458 
    459   double rac = sqrt(1 - r*r);
    460   double alpha = -r / rac;
    461   double beta = xm / ( ym * rac);
    462   //  double gamma = ym / ( xm * rac );
    463   double epsil = xm * ym * rac;
    464 
    465 
    466   int nbintv = 50;
    467   double pas = 2.0 * xm / nbintv;
    468   double fac1 = -1.0 / ( beta * beta);
    469   double fac2 = epsil/beta;
    470   double fac3 = -alpha/beta;
    471   int k;
    472   double x,y;
    473   double aux;
    474   for ( k=0; k < nbintv; k++)
    475     {
    476       x = -xm + k*pas;
    477       aux = fac1 * x * x + fac2;
    478       //     cout << " aux2= " << aux << endl;
    479       if ( aux <= 0.0 )
    480         {
    481           aux = 0.0;
    482         }
    483       else aux = sqrt(aux);
     465  double rac = (1 - r*r);
     466  if ( rac > 0.0 )
     467    {
     468      rac = sqrt(1 - r*r);
     469      double alpha = -r / rac;
     470      double beta = xm / ( ym * rac);
     471      //  double gamma = ym / ( xm * rac );
     472      double epsil = xm * ym * rac;
     473      double fac1 = -1.0 / ( beta * beta);
     474      double fac2 = epsil/beta;
     475      double fac3 = -alpha/beta;
     476      double aux;
     477      for ( k=0; k < nbintv; k++)
     478        {
     479          x = -xm + k*pas;
     480          aux = fac1 * x * x + fac2;
     481          //     cout << " aux2= " << aux << endl;
     482          if ( aux <= 0.0 )
     483            {
     484              aux = 0.0;
     485            }
     486          else aux = sqrt(aux);
    484487     
    485       //        y = fac3*x;
    486             y = fac3*x + aux;
    487       xcor.push_back(x);
    488       ycor.push_back(y);
    489     }
    490 
    491   for ( k=0; k <= nbintv; k++)
    492     {
    493       x = xm - k*pas;
    494       aux =  fac1 * x * x + fac2;
    495       if ( aux <= 0.0 )
    496         {
    497           aux = 0.0;
    498         }
    499       else aux = sqrt(aux);
    500       //   y = fac3*x;
    501             y = fac3*x - aux;
    502       xcor.push_back(x);
    503       ycor.push_back(y);
    504     }
    505 }
     488          //        y = fac3*x;
     489          y = fac3*x + aux;
     490          xcor.push_back(x);
     491          ycor.push_back(y);
     492        }
     493
     494      for ( k=0; k <= nbintv; k++)
     495        {
     496          x = xm - k*pas;
     497          aux =  fac1 * x * x + fac2;
     498          if ( aux <= 0.0 )
     499            {
     500              aux = 0.0;
     501            }
     502          else aux = sqrt(aux);
     503          //   y = fac3*x;
     504          y = fac3*x - aux;
     505          xcor.push_back(x);
     506          ycor.push_back(y);
     507        }
     508    }
     509  else
     510    // cas degenere
     511    {
     512      double fac = -ym/xm;
     513      for ( k=0; k < nbintv; k++)
     514        {
     515          x = -xm + k*pas;
     516          y = fac*x;
     517          xcor.push_back(x);
     518          ycor.push_back(y);
     519        }
     520       
     521    }
     522}
Note: See TracChangeset for help on using the changeset viewer.