Changeset 341 in PSPA


Ignore:
Timestamp:
Feb 22, 2013, 10:07:46 AM (11 years ago)
Author:
lemeur
Message:

fin dessins esp. phase + noms de fichiers

Location:
Interface_Web/trunk/pspaWT
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/trunk/pspaWT/History

    r336 r341  
    55     PSPA - Plateforme de simulation en physique des accélérateurs
    66     =========================================================
     7
     822 février 2013 Guy Le Meur
     9- complété le tracé des espaces de phases pour le généraliser aux couples (y,yp), (x,y) etc.
     10_ corrigé un bug concernant la sauvegarde de la configuration : l'attribut nameOfCase_ de la classe PspaApplication contient le 'nom du cas de calcul' sans extension ni chemin. Donc, pour le cas test, nameOfCase_ vaut 'pspa'.
    711
    81220 Février 2013 Laurent Garnier
  • Interface_Web/trunk/pspaWT/sources/controler/include/dataManager.h

    r316 r341  
    5151    trivaluedBool checkElementsForExec(nomDeLogiciel logiciel, unsigned indexDeb, unsigned indexFin, string& diagnostic);
    5252    bool executeAll();
    53     void saveConfiguration(string nameOfFile);
     53    void saveConfiguration(string nameOfCase);
    5454    bool restoreElements(string inputFileName);
    5555    void donneesRmsEnveloppe( string type, unsigned int numeroDeb, unsigned int numeroFin, vector<double>& xcor, vector<double>& ycor);
    56     inline void setWorkingDir(string wd) {
    57         workingDir_ = wd;
    58     }
     56    /* inline void setWorkingDir(string wd) { */
     57    /*     workingDir_ = wd; */
     58    /* } */
    5959   
    6060private:
     
    6969    void clearSectionToExecute();
    7070
    71     string workingDir_;
     71    //   string workingDir_;
    7272    PspaApplication* pspa_;
    7373};
  • Interface_Web/trunk/pspaWT/sources/controler/include/particleBeam.h

    r324 r341  
    8181
    8282  void donneesDessinEllipseXxp(vector<double>& xcor, vector<double>& ycor);
    83 
     83  void donneesDessinEllipse(vector<double>& xcor, vector<double>& ycor, unsigned indexAbs, unsigned indexOrd);
    8484
    8585  virtual string FileOutputFlow() const;
  • Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc

    r336 r341  
    1616dataManager::dataManager(PspaApplication* pspa) :
    1717currentBeam_(NULL)
    18 ,workingDir_("")
    1918,pspa_ ( pspa)
    2019{
     20  //  workingDir_ = pspa_->getWorkingDir();
    2121}
    2222
     
    145145void dataManager::initializeExecution()
    146146{
    147     if (workingDir_ == "") {
     147  string workingDir = pspa_->getWorkingDir();
     148    if (workingDir == "") {
    148149        return;
    149150    }
    150     removeFile(workingDir_ + "parmdesz");
    151     removeFile(workingDir_ + "parmin");
    152     removeFile(workingDir_ + "parin.input0");
    153     removeFile(workingDir_ + "transport.input");
    154     removeFile(workingDir_ + "transport.output");
    155     removeFile(workingDir_ + "generator.in");
    156     removeFile(workingDir_ + "faisceau.ini");
    157     removeFile(workingDir_ + "generator.output");
     151    removeFile(workingDir + "parmdesz");
     152    removeFile(workingDir + "parmin");
     153    removeFile(workingDir + "parin.input0");
     154    removeFile(workingDir + "transport.input");
     155    removeFile(workingDir + "transport.output");
     156    removeFile(workingDir + "generator.in");
     157    removeFile(workingDir + "faisceau.ini");
     158    removeFile(workingDir + "generator.output");
    158159    diagnosticBeam_.clear();
    159160    currentBeam_ = NULL;
     
    178179    unsigned k;
    179180    abstractSoftware* softw =NULL;
    180    
     181    string workingDir = pspa_->getWorkingDir();
    181182    for(k = 0; k < jobList_.size(); k++)
    182183    {
     
    194195      }
    195196
    196       success = softw->createInputFile(currentBeam_, debut, fin, workingDir_);
     197      success = softw->createInputFile(currentBeam_, debut, fin, workingDir);
    197198      if ( success ) {
    198         success = softw->execute(debut,fin,workingDir_);
     199        success = softw->execute(debut,fin,workingDir);
    199200        if ( success ) {
    200           success = softw->buildBeamAfterElements(debut, fin, diagnosticBeam_, workingDir_);
     201          success = softw->buildBeamAfterElements(debut, fin, diagnosticBeam_, workingDir);
    201202        }
    202203      }
     
    215216
    216217
    217 void dataManager::saveConfiguration( string nameOfFile)
     218void dataManager::saveConfiguration( string nameOfCase)
    218219{
    219220    ofstream outfile;
    220     string name = workingDir_ + nameOfFile + ".save";
     221    string name = pspa_->getWorkingDir() + nameOfCase + ".save";
    221222    outfile.open(name.c_str(), ios::out);
    222223    if (!outfile) {
  • Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc

    r336 r341  
    426426}
    427427
     428
     429
     430void particleBeam::donneesDessinEllipse(vector<double>& xcor, vector<double>& ycor, unsigned indexAbs, unsigned indexOrd) {
     431  int k;
     432  double x,y;
     433
     434  if ( !momentRepresentationOk_ ) return;
     435
     436  if ( indexAbs > 5 || indexOrd > 5 ) return;
     437
     438  xcor.clear();
     439  ycor.clear();
     440  // les index sont dans l'ordre x,y,z,xp,yp, de/E
     441  // on traduit en TRANSPORT
     442  if ( indexAbs == 1 ) indexAbs = 2;  // y
     443  if ( indexAbs == 2 ) indexAbs = 4;  // z -> l
     444  if ( indexAbs == 3 ) indexAbs = 1;  // xp
     445  if ( indexAbs == 4 ) indexAbs = 3;  // yp
     446
     447  if ( indexOrd == 1 ) indexOrd = 2;  // y
     448  if ( indexOrd == 2 ) indexOrd = 4;  // z -> l
     449  if ( indexOrd == 3 ) indexOrd = 1;  // xp
     450  if ( indexOrd == 4 ) indexOrd = 3;  // yp
     451
     452  cout << " index x" << indexAbs << " index y " << indexOrd << endl;
     453
     454  double xm = ( rij_.getMatrix().at(indexAbs) ).at(indexAbs);
     455  double ym = ( rij_.getMatrix().at(indexOrd) ).at(indexOrd);
     456  double r;
     457  if ( indexOrd > indexAbs ) {
     458    r  = ( rij_.getMatrix().at(indexOrd) ).at(indexAbs);
     459  } else {
     460    r  = ( rij_.getMatrix().at(indexAbs) ).at(indexOrd);
     461  }
     462
     463  cout <<  " racs11= " << xm << " racs22= " << ym << " r12= " << r << endl;
     464
     465
     466  int nbintv = 50;
     467  if ( xm == 0.0 ) return;
     468  double pas = 2.0 * xm / nbintv;
     469
     470  //  cout << " r= " << r << endl;
     471  double rac = (1 - r*r);
     472  if ( rac > 0.0 )
     473    {
     474      cout << " cas rac > " << endl;
     475      rac = sqrt(1 - r*r);
     476      double alpha = -r / rac;
     477      double beta = xm / ( ym * rac);
     478      //  double gamma = ym / ( xm * rac );
     479      double epsil = xm * ym * rac;
     480      double fac1 = -1.0 / ( beta * beta);
     481      double fac2 = epsil/beta;
     482      double fac3 = -alpha/beta;
     483      double aux;
     484      for ( k=0; k < nbintv; k++)
     485        {
     486          x = -xm + k*pas;
     487          aux = fac1 * x * x + fac2;
     488          //     cout << " aux2= " << aux << endl;
     489          if ( aux <= 0.0 )
     490            {
     491              aux = 0.0;
     492            }
     493          else aux = sqrt(aux);
     494     
     495          //        y = fac3*x;
     496          y = fac3*x + aux;
     497          xcor.push_back(x);
     498          ycor.push_back(y);
     499        }
     500
     501      for ( k=0; k <= nbintv; k++)
     502        {
     503          x = xm - k*pas;
     504          aux =  fac1 * x * x + fac2;
     505          if ( aux <= 0.0 )
     506            {
     507              aux = 0.0;
     508            }
     509          else aux = sqrt(aux);
     510          //   y = fac3*x;
     511          y = fac3*x - aux;
     512          xcor.push_back(x);
     513          ycor.push_back(y);
     514        }
     515    }
     516  else
     517    // cas degenere
     518    {
     519      cout << " cas degenere " << endl;
     520      double fac = ym/xm;
     521      for ( k=0; k < nbintv; k++)
     522        {
     523          x = -xm + k*pas;
     524          y = fac*x;
     525          xcor.push_back(x);
     526          ycor.push_back(y);
     527        }
     528       
     529    }
     530}
     531
    428532void particleBeam::histogramme(vector<double>&xcor,vector<int>& hist,int& cnts,double out[3])
    429533{
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h

    r340 r341  
    7878 
    7979  void dialogOnGraphics();
    80   void faireDessinParmela(WContainerWidget* toto, particleBeam* beam, unsigned indexAbs, unsigned indexOrd );
    81   void faireDessinTransport(WContainerWidget* toto, particleBeam* beam);
     80  void setModelComponentForPhaseSpace(WStandardItemModel* model, vector<bareParticle>& partic, unsigned indexParticleComponent, unsigned modelComponent);
     81void faireDessinParmela(WContainerWidget* toto, particleBeam* beam, unsigned indexAbs, unsigned indexOrd, string namex, string namey  );
     82  void faireDessinTransport(WContainerWidget* toto, particleBeam* beam, unsigned indexAbs, unsigned indexOrd, string namex, string namey);
    8283  void faireDessinEnveloppe(WContainerWidget* toto, string type);
    8384  void scatterPlot1D(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor);
    8485   
     86  bool removePathFromConfigName(string& config);
    8587  bool removeExtensionFromConfigName(string& config);
    8688 
     
    116118    return abstractElementFactory_;
    117119  }
     120
     121    inline string getWorkingDir() const {
     122        return workingDir_;
     123    }
     124
    118125};
    119126#endif
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc

    r340 r341  
    7070    useStyleSheet       ("htdocs/pspa.css");
    7171    dtmanage_ = new dataManager(this);
    72     dtmanage_->setWorkingDir(workingDir_);
     72    //    dtmanage_->setWorkingDir(workingDir_);
    7373    /*
    7474     * The main layout is a 3x2 grid layout.
     
    346346  else { console_->addConsoleMessage("sauvegarde sur repertoire : " + workingDir_);}
    347347  nameOfCase_ = saveNameEdit_->text().toUTF8();
    348   cout << " PspaApplication::dialogSaveDone() nameOfCase_= " << nameOfCase_ << endl;
     348  cout << " PspaApplication::dialogSaveDone() sur fichier = " << nameOfCase_ << endl;
    349349  delete dialogSave_;
    350350  dialogSave_ = NULL;
     
    359359{
    360360    GWt_serverFileSelector * fs = new GWt_serverFileSelector("Select a configuration file",workingDir_);
    361     nameOfCase_ = fs->exec();
    362    
     361    string fileName = fs->exec();
     362     nameOfCase_ = fileName;
     363   
     364    removePathFromConfigName(nameOfCase_ );
     365    cout << " nom sans path " << nameOfCase_ << endl;
     366    removeExtensionFromConfigName(nameOfCase_);
     367    cout << " nom sans extension " << nameOfCase_ << endl;
    363368    if (nameOfCase_ == "")
    364369        return;
    365    
     370    cout << " je restaure le fichier " << fileName << endl;
    366371    dialogSave_ = NULL;
    367372   
    368     bool test = dtmanage_->restoreElements(nameOfCase_);
     373    bool test = dtmanage_->restoreElements(fileName);
    369374    if ( !test ) {
    370         GWt_dialog restoreWarning(" element restoring", "failure in restoring elements !", GWt_dialog::Error, false,true);
     375        GWt_dialog restoreWarning(" element restoring", "failure in restoring elements from file : " + fileName , GWt_dialog::Error, false,true);
    371376        restoreWarning.exec();
    372377    }
     
    466471void PspaApplication::dessinerPhaseSpace()
    467472{   
    468   toto_->clear();
    469473   
    470474  int typeFaisceau = choixTypeDessinFaisceau_->currentIndex();
     
    472476  unsigned xabs = choixAbsPhase_->currentIndex();
    473477  unsigned yord = choixOrdPhase_->currentIndex();
    474        
     478  if ( xabs == yord ) {
     479        GWt_dialog phaseSpaceError(" graphical analysis", "the beam coordinates must be different !", GWt_dialog::Error, false,true);
     480        phaseSpaceError.exec();
     481        return;
     482  }
     483  string nameAbs = choixAbsPhase_->currentText().toUTF8();
     484  string nameOrd = choixOrdPhase_->currentText().toUTF8();
     485
    475486  particleBeam* beam = dtmanage_->getDiagnosticBeam(index);
    476487   
     
    481492  }
    482493   
    483    
     494    toto_->clear();
     495 
    484496  if ( typeFaisceau == 0 )
    485497    {
    486498      if ( !beam->momentRepresentationOk() ) beam->buildMomentRepresentation();
    487       faireDessinTransport(toto_, beam);
     499      faireDessinTransport(toto_, beam, xabs, yord, nameAbs, nameOrd );
    488500    }
    489501  else if ( typeFaisceau == 1 )
    490502    {
    491       if ( beam->particleRepresentationOk() ) faireDessinParmela(toto_, beam, xabs, yord);
     503      if ( beam->particleRepresentationOk() ) faireDessinParmela(toto_, beam, xabs, yord, nameAbs, nameOrd );
    492504      else {
    493505        GWt_dialog warningBeamState(" graphical analysis", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true);
     
    533545}
    534546
    535 
    536 void PspaApplication::faireDessinParmela(WContainerWidget* toto, particleBeam* beam, unsigned indexAbs, unsigned indexOrd )
     547void PspaApplication::setModelComponentForPhaseSpace(WStandardItemModel* model, vector<bareParticle>& partic, unsigned indexParticleComponent, unsigned modelComponent) {
     548  double valeur;
     549  if ( indexParticleComponent > 5  ) return;
     550
     551  if ( indexParticleComponent <= 2 ) {
     552    for (unsigned i = 0; i < partic.size(); ++i) {
     553      valeur = partic.at(i).getPosition().getComponent(indexParticleComponent);
     554      model->setData(i, modelComponent, valeur);
     555    }
     556  } else {
     557    if ( indexParticleComponent == 5 ) {
     558      cout << " PspaApplication::faireDessinParmela : deltap non programme " << endl;
     559      return;
     560    } else {
     561      for (unsigned i = 0; i < partic.size(); ++i) {
     562        double begamz = partic.at(i).getBetaGamma().getComponent(2);
     563        if ( begamz != 0.0) {
     564          valeur = 1.e3*partic.at(i).getBetaGamma().getComponent(indexParticleComponent-3)/begamz;
     565        } else {
     566          valeur = 0.0;
     567        }
     568        model->setData(i, modelComponent, valeur);
     569      }
     570    }
     571  }
     572}
     573
     574void PspaApplication::faireDessinParmela(WContainerWidget* toto, particleBeam* beam, unsigned indexAbs, unsigned indexOrd, string namex, string namey )
    537575{
    538576  cout << " faireDessinParmela " << endl;
     
    542580  pointsDialog->setClosable(true);
    543581  // pointsDialog->show();
    544  
    545    
    546    
    547     vector<bareParticle>& partic = beam->getParticleVector();
    548     new WText(nameOfCase_ + " : espace de phase x,x' "+ " nb partic. "+ mixedTools::intToString(partic.size()), pointsDialog->contents());
    549     WStandardItemModel *model = new WStandardItemModel(partic.size(), 2, pointsDialog->contents());
    550     //    model->setHeaderData(0, WString("X"));
    551     //   model->setHeaderData(1, WString("Y = sin(X)"));
    552    
    553     if ( indexAbs > 5 || indexOrd > 5 ) return;
    554 
    555     for (unsigned i = 0; i < partic.size(); ++i) {
    556       double valAbs, valOrd;
    557       double begamz = partic.at(i).getBetaGamma().getComponent(2);
    558       if ( indexAbs <= 2 ) {
    559         valAbs = partic.at(i).getPosition().getComponent(indexAbs);
    560         cout << " i= " << i << " valabs = " << valAbs << endl;
    561       } else {
    562         if ( indexAbs == 5 ) {
    563           cout << " PspaApplication::faireDessinParmela : deltap non programme " << endl;
    564           return;
    565         } else {
    566           if ( begamz != 0.0) {
    567             valAbs = 1.e3*partic.at(i).getBetaGamma().getComponent(indexAbs-3)/begamz;
    568           } else {
    569             valAbs = 0.0;
    570           }
    571         }
    572       }
    573 
    574       if ( indexOrd <= 2 ) {
    575         valOrd = partic.at(i).getPosition().getComponent(indexOrd);
    576       } else {
    577         if ( indexOrd == 5 ) {
    578           cout << " PspaApplication::faireDessinParmela : deltap non programme " << endl;
    579           return;
    580         } else {
    581 
    582 
    583           if ( begamz != 0.0) {
    584             valOrd = 1.e3*partic.at(i).getBetaGamma().getComponent(indexOrd-3)/begamz;
    585           } else {
    586             valOrd = 0.0;
    587           }
    588         cout << " i= " << i << " valord = " << valOrd << endl;
    589         }
    590       }
    591582     
    592 
    593         // double x= partic.at(i).getPosition().getComponent(0);
    594         // double begamz = partic.at(i).getBetaGamma().getComponent(2);
    595         // double xp;
    596         // if ( begamz != 0.0) {
    597         //   xp = partic.at(i).getBetaGamma().getComponent(0)/begamz;
    598         // } else {
    599         //   xp = 0.0;
    600         // }
    601         // //    cout << "x = " << x << " xp= " << xp << endl;
    602         // model->setData(i, 0, x);
    603         // model->setData(i, 1,1.e3*xp);
    604         // model->setData(i, 2,2.e3*xp);
    605         model->setData(i, 0, valAbs);
    606         model->setData(i, 1,  valOrd);
    607     }
    608       cout << " faireDessinParmela : FAISCEAU VU  " << endl;
    609 
    610     WCartesianChart *chart = new WCartesianChart(pointsDialog->contents());
    611     chart->setModel(model);        // set the model
    612     chart->setXSeriesColumn(0);    // set the column that holds the X data
    613     chart->setLegendEnabled(true); // enable the legend
    614    
    615     chart->setType(ScatterPlot);   // set type to ScatterPlot
    616    
    617     // Typically, for mathematical functions, you want the axes to cross
    618     // at the 0 mark:
    619     chart->axis(XAxis).setLocation(ZeroValue);
    620     chart->axis(YAxis).setLocation(ZeroValue);
    621    
    622     // Provide space for the X and Y axis and title.
    623     chart->setPlotAreaPadding(80, Left);
    624     chart->setPlotAreaPadding(40, Top | Bottom);
    625     // Add the curves
    626     WDataSeries s(1, PointSeries, Y1Axis);
    627     //  s.setShadow(WShadow(3, 3, WColor(0, 0, 0, 127), 3));
    628     //    s.setMarker(SquareMarker);
    629     //  s.setMarkerSize(600.);
    630     //  cout << "le marker est : " << s.marker() << endl;
    631     chart->addSeries(s);
    632    
    633     chart->resize(400, 400); // WPaintedWidget must be given explicit size
     583  vector<bareParticle>& partic = beam->getParticleVector();
     584  new WText(nameOfCase_ + " : phase space " + namex + " ," + namey + " ; particle number : "+ mixedTools::intToString(partic.size()), pointsDialog->contents());
     585
     586  WStandardItemModel *model = new WStandardItemModel(partic.size(), 2, pointsDialog->contents());
     587
     588
     589  setModelComponentForPhaseSpace(model, partic, indexAbs, 0);
     590  setModelComponentForPhaseSpace(model, partic, indexOrd, 1);
     591
     592  cout << " faireDessinParmela : FAISCEAU VU  " << endl;
     593
     594  WCartesianChart *chart = new WCartesianChart(pointsDialog->contents());
     595  chart->setModel(model);        // set the model
     596  chart->setXSeriesColumn(0);    // set the column that holds the X data
     597  chart->setLegendEnabled(true); // enable the legend
     598   
     599  chart->setType(ScatterPlot);   // set type to ScatterPlot
     600   
     601  // Typically, for mathematical functions, you want the axes to cross
     602  // at the 0 mark:
     603  chart->axis(XAxis).setLocation(ZeroValue);
     604  chart->axis(YAxis).setLocation(ZeroValue);
     605   
     606  // Provide space for the X and Y axis and title.
     607  chart->setPlotAreaPadding(80, Left);
     608  chart->setPlotAreaPadding(40, Top | Bottom);
     609  // Add the curves
     610  WDataSeries s(1, PointSeries, Y1Axis);
     611  //  s.setShadow(WShadow(3, 3, WColor(0, 0, 0, 127), 3));
     612  //    s.setMarker(SquareMarker);
     613  //  s.setMarkerSize(600.);
     614  //  cout << "le marker est : " << s.marker() << endl;
     615  chart->addSeries(s);
     616   
     617  chart->resize(400, 400); // WPaintedWidget must be given explicit size
    634618   
    635619   
    636620#ifdef HAS_IMAGEMAGIC
    637     Wt::WRasterImage pngImage("png", 600, 600);
    638     Wt::WPainter p(&pngImage);
    639     chart->paint(p);
    640     std::string name;
    641     name = workingDir_ + "/chart-"+sessionId ()+".png";
    642     std::ofstream f(name.c_str(), std::ios::out |std::ios::trunc | std::ios::binary);
    643     pngImage.write(f);
    644     new WText("<a href='workingArea/chart-"+sessionId ()+".png' target='_blank'>Afficher l'image</a>",toto);
     621  Wt::WRasterImage pngImage("png", 600, 600);
     622  Wt::WPainter p(&pngImage);
     623  chart->paint(p);
     624  std::string name;
     625  name = workingDir_ + "/chart-"+sessionId ()+".png";
     626  std::ofstream f(name.c_str(), std::ios::out |std::ios::trunc | std::ios::binary);
     627  pngImage.write(f);
     628  new WText("<a href='workingArea/chart-"+sessionId ()+".png' target='_blank'>Afficher l'image</a>",toto);
    645629#endif
    646630   
    647     pointsDialog->show();
    648    
    649     //  chart->setMargin(10, Top | Bottom);            // add margin vertically
    650     //  chart->setMargin(WLength::Auto, Left | Right); // center horizontally
    651 }
    652 
    653 void PspaApplication::faireDessinTransport(WContainerWidget* toto, particleBeam* beam)
     631  pointsDialog->show();
     632   
     633  //  chart->setMargin(10, Top | Bottom);            // add margin vertically
     634  //  chart->setMargin(WLength::Auto, Left | Right); // center horizontally
     635}
     636
     637void PspaApplication::faireDessinTransport(WContainerWidget* toto, particleBeam* beam, unsigned indexAbs, unsigned indexOrd, string namex, string namey)
    654638{
    655639  GWt_dialog* ellipseDialog = new GWt_dialog("ellipse",toto,false);
     
    659643  ellipseDialog->show();
    660644   
    661   new WText(nameOfCase_ + " : emittance x,x' " + mixedTools::doubleToString(beam->getUnnormalizedEmittanceX()) + " pi.mm.mrad" , ellipseDialog->contents());
     645  new WText(nameOfCase_ + " : emittance " + namex + " , " + namey + " : " + mixedTools::doubleToString(beam->getUnnormalizedEmittanceX()) + " pi.mm.mrad" , ellipseDialog->contents());
    662646  new WBreak(ellipseDialog->contents());
    663647  new WText(" xmax = " + mixedTools::doubleToString(beam->getSigmaTransportij(1,1)) + " cm ", ellipseDialog->contents());
     
    669653  vector<double> xcor;
    670654  vector<double> ycor;
    671   //  dtmanage_->getCurrentBeam()->donneesDessinEllipseXxp(xcor,ycor);
    672   beam->donneesDessinEllipseXxp(xcor,ycor);
     655  beam->donneesDessinEllipse(xcor,ycor,indexAbs, indexOrd);
     656  //  beam->donneesDessinEllipseXxp(xcor,ycor);
    673657  scatterPlot1D(ellipseDialog->contents(),xcor,ycor); 
    674658}
    675659
    676 // void PspaApplication::scatterPlot1D(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor)
    677 // {
    678 //   int nbpts = xcor.size();
    679 //   cout << " PspaApplication::scatterPlot1D nbpts = " << nbpts << endl;
    680 //   WStandardItemModel *model = new WStandardItemModel(nbpts, 2, toto);
    681 //   for (int i = 0; i < nbpts; ++i) {
    682 //     model->setData(i, 0, xcor.at(i));
    683 //     model->setData(i, 1, ycor.at(i));
    684 //     //    cout << " PspaApplication::scatterPlot1D el= " << i+1 << " x= " << xcor.at(i) << " y= " << ycor.at(i) << endl;
    685 //   }
    686 
    687 //   WCartesianChart *chart = new WCartesianChart(toto);
    688 
    689 //   chart->initLayout();
    690 
    691 //   chart->setModel(model);        // set the model
    692 //   chart->setXSeriesColumn(0);    // set the column that holds the X data
    693 //   chart->setLegendEnabled(true); // enable the legend
    694 
    695 //   chart->setType(ScatterPlot);   // set type to ScatterPlot
    696 
    697 //   // Typically, for mathematical functions, you want the axes to cross
    698 //   // at the 0 mark:
    699 //    chart->axis(XAxis).setLocation(ZeroValue);
    700 //    chart->axis(YAxis).setLocation(ZeroValue);
    701 
    702 //   // Provide space for the X and Y axis and title.
    703 // //   chart->setPlotAreaPadding(80, Left);
    704 // //   chart->setPlotAreaPadding(40, Top | Bottom);
    705 //   // Add the curves
    706 //   WDataSeries s(1, CurveSeries, Y1Axis);
    707 //   chart->addSeries(s);
    708 
    709 //   // chart->setBackground (WBrush(WColor("blue")));
    710 //   chart->resize(300, 300); // WPaintedWidget must be given explicit size
    711 
    712 // #ifdef HAS_IMAGEMAGIC
    713 //  Wt::WRasterImage pngImage("png", 600, 600);
    714 //  Wt::WPainter p(&pngImage);
    715 
    716 //  chart->paint(p);
    717 //  std::string name;
    718 //  name = workingDir_ + "/chart-"+sessionId ()+".png";
    719 //  std::ofstream f(name.c_str(), std::ios::out |std::ios::trunc | std::ios::binary);
    720 //  pngImage.write(f);
    721 
    722 //  new WText("<a href='workingArea/chart-"+sessionId ()+".png' target='_blank'>Afficher l'image</a>",toto);
    723 
    724 //  /*
    725 //  Wt::WPdfImage pdfImage("30cm", "30cm");
    726 //  Wt::WPainter p1(&pdfImage);
    727 //  chart->paint(p1);
    728 //  std::ofstream f1("chart.pdf", std::ios::out | std::ios::binary);
    729 //  pdfImage.write(f1);
    730 //  */
    731 // #endif
    732 // }
    733660
    734661
     
    818745
    819746// }
     747
     748bool PspaApplication::removePathFromConfigName(string& config) {
     749  string toExtract = workingDir_ + "/";
     750  string::size_type nn = config.find(toExtract);
     751  if ( nn == string::npos ) {
     752        GWt_dialog checkremovePath(" checking config file name", " failed to recognize path name for file  " + config, GWt_dialog::Error,true,true);
     753        checkremovePath.exec();
     754    return false;
     755  }
     756  config.replace(nn, toExtract.size(), "");
     757  return true;
     758}
    820759
    821760bool PspaApplication::removeExtensionFromConfigName(string& config)
Note: See TracChangeset for help on using the changeset viewer.