Changeset 355 in PSPA for Interface_Web


Ignore:
Timestamp:
Mar 1, 2013, 9:10:43 PM (11 years ago)
Author:
lemeur
Message:

correction de correction de bug (beam2Moments::readFromTransportOutput)

Location:
Interface_Web/trunk/pspaWT/sources
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/trunk/pspaWT/sources/controler/include/dataManager.h

    r347 r355  
    5252  trivaluedBool checkElementsForExec(nomDeLogiciel logiciel, unsigned indexDeb, unsigned indexFin, string& diagnostic);
    5353  bool executeAll();
    54   void donneesRmsEnveloppe(string type,unsigned int lineSize,vector<double>& xcor,vector<double>& ycor);
    5554 
     55   void donneesRmsEnveloppe(string type,vector<double>& xcor,vector<double>& ycor);
     56
    5657  /**
    5758   Save a configuration file on the server
     
    6263   
    6364    bool restoreElements(string inputFileName);
     65
     66
    6467   
    6568    private :
    6669   
    6770
    68     void donneesRmsEnveloppe( string type, unsigned int numeroDeb, unsigned int numeroFin, vector<double>& xcor, vector<double>& ycor);
     71    //    void donneesRmsEnveloppe( string type, unsigned int numeroDeb, unsigned int numeroFin, vector<double>& xcor, vector<double>& ycor);
    6972    /* inline void setWorkingDir(string wd) { */
    7073    /*     workingDir_ = wd; */
     
    7477    globalParameters globParam_;
    7578    particleBeam* currentBeam_;
     79  PspaApplication* pspa_;
    7680   
    7781    vector<particleBeam> diagnosticBeam_;
     
    8185    void removeFile(string nameOfFile);
    8286    void clearSectionToExecute();
    83 
    84   PspaApplication* pspa_;
     87 
    8588  };
    8689#endif
  • Interface_Web/trunk/pspaWT/sources/controler/src/beam2Moments.cc

    r348 r355  
    7979// suppose qu'on est bien positionné dans le stream (a revoir)
    8080void beam2Moments::readFromTransportOutput(stringstream& inp) {
    81     string  bidString;
    82     double bidon;
     81  string bidString, bidString1, bidString2;
     82  double bidon, bidon1, bidon2;
    8383   
    84     // initialisation des moments
    85     raz();
    86     bool test = false;
    87     string buf;
    88     // sauter les eventuels 'VARY'
    89     while ( !test ) {
    90         getline(inp, buf);
    91         stringstream str(buf);
    92        
    93         if (!(str >> bidon >>  bidString >>  bidon >>  ( rij_secondOrderMoments_.at(0) ).at(0) >> bidString)) {
    94             test = true;
    95         }
    96        
    97         cout << " beam2Moments::readFromTransportOutput TEST= " << test << endl;
     84  // initialisation des moments
     85  raz();
     86  bool notFound = true;
     87  string buf;
     88  // sauter les eventuels 'VARY'
     89  while ( notFound ) {
     90    getline(inp, buf);
     91    stringstream str(buf);       
     92    if ( str >> bidon1 >>  bidString1 >>  bidon2 >>  ( rij_secondOrderMoments_.at(0) ).at(0) >> bidString2 )  {
     93       notFound = false;
    9894    }
    99     //    test = inp >> bidon >>  bidString >>  bidon >>  ( rij_secondOrderMoments_.at(0) ).at(0) >> bidString;
    100     // }
    101     inp >> bidon >> ( rij_secondOrderMoments_.at(1) ).at(1) >>  bidString >> ( rij_secondOrderMoments_.at(1) ).at(0);
    102     inp >> bidon >> ( rij_secondOrderMoments_.at(2) ).at(2) >>  bidString >> ( rij_secondOrderMoments_.at(2) ).at(0)  >> ( rij_secondOrderMoments_.at(2) ).at(1);
    103     inp >> bidon >> ( rij_secondOrderMoments_.at(3) ).at(3) >>  bidString >> ( rij_secondOrderMoments_.at(3) ).at(0)  >> ( rij_secondOrderMoments_.at(3) ).at(1) >> ( rij_secondOrderMoments_.at(3) ).at(2);
     95  }
     96  //     test = inp >> bidon >>  bidString >>  bidon >>  ( rij_secondOrderMoments_.at(0) ).at(0) >> bidString;
     97  //   cout << " beam2Moments::readFromTransportOutput TEST= " << test << endl;
     98  //  }
     99  inp >> bidon >> ( rij_secondOrderMoments_.at(1) ).at(1) >>  bidString >> ( rij_secondOrderMoments_.at(1) ).at(0);
     100  inp >> bidon >> ( rij_secondOrderMoments_.at(2) ).at(2) >>  bidString >> ( rij_secondOrderMoments_.at(2) ).at(0)  >> ( rij_secondOrderMoments_.at(2) ).at(1);
     101  inp >> bidon >> ( rij_secondOrderMoments_.at(3) ).at(3) >>  bidString >> ( rij_secondOrderMoments_.at(3) ).at(0)  >> ( rij_secondOrderMoments_.at(3) ).at(1) >> ( rij_secondOrderMoments_.at(3) ).at(2);
    104102   
    105     inp >> bidon >> ( rij_secondOrderMoments_.at(4) ).at(4) >>  bidString >> ( rij_secondOrderMoments_.at(4) ).at(0)  >> ( rij_secondOrderMoments_.at(4) ).at(1) >> ( rij_secondOrderMoments_.at(4) ).at(2) >> ( rij_secondOrderMoments_.at(4) ).at(3);
     103  inp >> bidon >> ( rij_secondOrderMoments_.at(4) ).at(4) >>  bidString >> ( rij_secondOrderMoments_.at(4) ).at(0)  >> ( rij_secondOrderMoments_.at(4) ).at(1) >> ( rij_secondOrderMoments_.at(4) ).at(2) >> ( rij_secondOrderMoments_.at(4) ).at(3);
    106104   
    107     inp >> bidon >> ( rij_secondOrderMoments_.at(5) ).at(5) >>  bidString >> ( rij_secondOrderMoments_.at(5) ).at(0)  >> ( rij_secondOrderMoments_.at(5) ).at(1) >> ( rij_secondOrderMoments_.at(5) ).at(2) >> ( rij_secondOrderMoments_.at(5) ).at(3) >> ( rij_secondOrderMoments_.at(5) ).at(4);
     105  inp >> bidon >> ( rij_secondOrderMoments_.at(5) ).at(5) >>  bidString >> ( rij_secondOrderMoments_.at(5) ).at(0)  >> ( rij_secondOrderMoments_.at(5) ).at(1) >> ( rij_secondOrderMoments_.at(5) ).at(2) >> ( rij_secondOrderMoments_.at(5) ).at(3) >> ( rij_secondOrderMoments_.at(5) ).at(4);
    108106   
    109107}
  • Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc

    r349 r355  
    298298}
    299299
    300 void dataManager::donneesRmsEnveloppe(string type,unsigned int numeroDeb,unsigned int numeroFin, vector<double>& xcor,vector<double>& ycor)
    301 {
    302   unsigned k;
    303   if ( numeroDeb < 1 ) numeroDeb = 1;
    304   if ( numeroFin > diagnosticBeam_.size() ) numeroFin = diagnosticBeam_.size();
     300// void dataManager::donneesRmsEnveloppe(string type,unsigned int numeroDeb,unsigned int numeroFin, vector<double>& xcor,vector<double>& ycor)
     301// {
     302//   unsigned k;
     303//   if ( numeroDeb < 1 ) numeroDeb = 1;
     304//   if ( numeroFin > diagnosticBeam_.size() ) numeroFin = diagnosticBeam_.size();
    305305       
     306//   double longueur = 0.0;
     307//   double valeur = 0.0;
     308//   xcor.clear();
     309//   ycor.clear();
     310//   if ( type == "x" )
     311//     {
     312//       for (k= numeroDeb; k <= numeroFin; k++)
     313//         {
     314//        if ( !diagnosticBeam_.at(k-1).momentRepresentationOk() ) diagnosticBeam_.at(k-1).buildMomentRepresentation();
     315//        longueur += pspa_->getBeamLine()->getAbstractElement(k-1)->getLenghtOfElement();
     316//        valeur = diagnosticBeam_.at(k-1).getXmaxRms();
     317//        cout << " dataManager::donneesRmsEnveloppe longueur = " << longueur << " enveleloppe : " << valeur << endl;
     318//        xcor.push_back(longueur);
     319//        ycor.push_back(valeur);
     320//         }
     321//     }
     322//   else
     323//     {
     324//       cerr << " dataManager::donneesRmsEnveloppe type " << type << " not programmed " << endl;
     325//       return;
     326//     }
     327// }
     328
     329// on ne tient pas compte des elements "snapshot" presents dans la beamLine
     330void dataManager::donneesRmsEnveloppe(string type,vector<double>& xcor,vector<double>& ycor)
     331{
    306332  double longueur = 0.0;
    307333  double valeur = 0.0;
    308334  xcor.clear();
    309335  ycor.clear();
    310   if ( type == "x" )
    311     {
    312       for (k= numeroDeb; k <= numeroFin; k++)
    313         {
    314           if ( !diagnosticBeam_.at(k-1).momentRepresentationOk() ) diagnosticBeam_.at(k-1).buildMomentRepresentation();
    315           longueur += pspa_->getBeamLine()->getAbstractElement(k-1)->getLenghtOfElement();
    316           valeur = diagnosticBeam_.at(k-1).getXmaxRms();
    317           xcor.push_back(longueur);
    318           ycor.push_back(valeur);
    319         }
    320     }
    321   else
    322     {
    323       cerr << " dataManager::donneesRmsEnveloppe type " << type << " not programmed " << endl;
    324       return;
    325     }
    326 }
    327 
    328 // on ne tient pas compte des elements "snapshot" presents dans la beamLine
    329 void dataManager::donneesRmsEnveloppe(string type,unsigned int lineSize,vector<double>& xcor,vector<double>& ycor)
    330 {
    331   double longueur = 0.0;
    332   double valeur = 0.0;
    333   xcor.clear();
    334   ycor.clear();
    335336
    336337  if ( type == "x" ) {
    337338    unsigned i = 0;
    338     for (unsigned k = 0; k < lineSize; k++) {
     339    cout << " dataManager::donneesRmsEnveloppe BeamLineSize = " << getBeamLineSize() << endl;
     340    for (unsigned k = 0; k < getBeamLineSize(); k++) {
    339341      abstractElement* elPtr = pspa_->getBeamLine()->getAbstractElement(k);
    340342      if(elPtr->getNomdElement().getElementType() == snapshot) continue;
     
    347349      longueur += elPtr->getLenghtOfElement();
    348350      valeur = diagnosticBeam_.at(i).getXmaxRms();
     351      cout << " dataManager::donneesRmsEnveloppe index = " << k <<  " longueur = " << longueur << " enveleloppe : " << valeur << endl;
    349352      xcor.push_back(longueur);
    350353      ycor.push_back(valeur);
  • Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc

    r354 r355  
    333333}
    334334
    335 // void particleBeam::donneesDessinEllipseXxp(vector<double>& xcor, vector<double>& ycor) {
    336 //   int k;
    337 //   double x,y;
    338 
    339 //   if ( !momentRepresentationOk_ ) return;
    340 
    341 //   xcor.clear();
    342 //   ycor.clear();
    343 
    344 //   double xm = ( rij_.getMatrix().at(0) ).at(0);
    345 //   double ym = ( rij_.getMatrix().at(1) ).at(1);
    346 //   double r  = ( rij_.getMatrix().at(1) ).at(0);
    347 
    348 //   cout <<  " racs11= " << xm << " racs22= " << ym << " r12= " << r << endl;
    349 
    350 
    351 //   int nbintv = 50;
    352 //   if ( xm == 0.0 ) return;
    353 //   double pas = 2.0 * xm / nbintv;
    354 
    355 //   //  cout << " r= " << r << endl;
    356 //   double rac = (1 - r*r);
    357 //   if ( rac > 0.0 )
    358 //     {
    359 //       cout << " cas rac > " << endl;
    360 //       rac = sqrt(1 - r*r);
    361 //       double alpha = -r / rac;
    362 //       double beta = xm / ( ym * rac);
    363 //       //  double gamma = ym / ( xm * rac );
    364 //       double epsil = xm * ym * rac;
    365 //       double fac1 = -1.0 / ( beta * beta);
    366 //       double fac2 = epsil/beta;
    367 //       double fac3 = -alpha/beta;
    368 //       double aux;
    369 //       for ( k=0; k < nbintv; k++)
    370 //      {
    371 //        x = -xm + k*pas;
    372 //        aux = fac1 * x * x + fac2;
    373 //        //     cout << " aux2= " << aux << endl;
    374 //        if ( aux <= 0.0 )
    375 //          {
    376 //            aux = 0.0;
    377 //          }
    378 //        else aux = sqrt(aux);
    379      
    380 //        //        y = fac3*x;
    381 //        y = fac3*x + aux;
    382 //        xcor.push_back(x);
    383 //        ycor.push_back(y);
    384 //      }
    385 
    386 //       for ( k=0; k <= nbintv; k++)
    387 //      {
    388 //        x = xm - k*pas;
    389 //        aux =  fac1 * x * x + fac2;
    390 //        if ( aux <= 0.0 )
    391 //          {
    392 //            aux = 0.0;
    393 //          }
    394 //        else aux = sqrt(aux);
    395 //        //   y = fac3*x;
    396 //        y = fac3*x - aux;
    397 //        xcor.push_back(x);
    398 //        ycor.push_back(y);
    399 //      }
    400 //     }
    401 //   else
    402 //     // cas degenere
    403 //     {
    404 //       cout << " cas degenere " << endl;
    405 //       double fac = ym/xm;
    406 //       for ( k=0; k < nbintv; k++)
    407 //      {
    408 //        x = -xm + k*pas;
    409 //        y = fac*x;
    410 //        xcor.push_back(x);
    411 //        ycor.push_back(y);
    412 //      }
    413        
    414 //     }
    415 // }
    416335
    417336void particleBeam::particlesPhaseSpaceData(vector<double>& xcor, vector<double>& ycor, unsigned indexAbs, unsigned indexOrd) {
  • Interface_Web/trunk/pspaWT/sources/controler/src/softwareParmela.cc

    r354 r355  
    135135      // sinon c'est un element de parmela d'index id
    136136      beams.push_back(particleBeam());
     137      cout << " creation diagn. no " << beams.size() << " par PARMELA " << endl;
    137138      vector<double> centroid;
    138139      bareParticle refPart;
  • Interface_Web/trunk/pspaWT/sources/controler/src/softwareTransport.cc

    r353 r355  
    157157
    158158      beams.push_back(particleBeam());
     159      cout << " creation diagn. no " << beams.size() << " par TRANSPORT " << endl;
    159160      string elemLabel = ptr->getLabel();
    160161      beam2Moments transpMoments;
     
    166167          result = false;
    167168          break;
    168         }
     169        } 
    169170      beams.back().set2Moments(transpMoments);
    170171    }
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc

    r354 r355  
    542542  envDialog->show();
    543543     
    544   unsigned nbel = dtmanage_->getBeamLineSize();
     544  //  unsigned nbel = dtmanage_->getBeamLineSize();
    545545  vector<double> xcor;
    546546  vector<double> ycor;
    547   //dtmanage_->donneesRmsEnveloppe(type,1, nbel, xcor,ycor);
    548   dtmanage_->donneesRmsEnveloppe(type,nbel,xcor,ycor);
    549   //    scatterPlot1D(envDialog->contents(),xcor,ycor); 
     547  // dtmanage_->donneesRmsEnveloppe(type,1, nbel, xcor,ycor);
     548    dtmanage_->donneesRmsEnveloppe(type,xcor,ycor);
    550549chartPlot2vec(envDialog->contents(), xcor, ycor, false);
    551550}
    552 
    553 // void PspaApplication::setModelComponentForPhaseSpace(WStandardItemModel* model, vector<bareParticle>& partic, unsigned indexParticleComponent, unsigned modelComponent) {
    554 //   double valeur;
    555 //   if ( indexParticleComponent > 5  ) return;
    556 
    557 //   if ( indexParticleComponent <= 2 ) {
    558 //     for (unsigned i = 0; i < partic.size(); ++i) {
    559 //       valeur = partic.at(i).getPosition().getComponent(indexParticleComponent);
    560 //       model->setData(i, modelComponent, valeur);
    561 //     }
    562 //   } else {
    563 //     if ( indexParticleComponent == 5 ) {
    564 //       cout << " PspaApplication::faireDessinParmela : deltap non programme " << endl;
    565 //       return;
    566 //     } else {
    567 //       for (unsigned i = 0; i < partic.size(); ++i) {
    568 //      double begamz = partic.at(i).getBetaGamma().getComponent(2);
    569 //      if ( begamz != 0.0) {
    570 //        valeur = 1.e3*partic.at(i).getBetaGamma().getComponent(indexParticleComponent-3)/begamz;
    571 //      } else {
    572 //        valeur = 0.0;
    573 //      }
    574 //      model->setData(i, modelComponent, valeur);
    575 //       }
    576 //     }
    577 //   }
    578 // }
    579551
    580552void PspaApplication::faireDessinParmela(WContainerWidget* toto, particleBeam* beam, unsigned indexAbs, unsigned indexOrd, string namex, string namey )
Note: See TracChangeset for help on using the changeset viewer.