Changeset 236 in PSPA


Ignore:
Timestamp:
Jan 17, 2013, 11:18:56 AM (12 years ago)
Author:
lemeur
Message:

epuration particleBeam

Location:
Interface_Web/trunk/pspaWT
Files:
2 added
2 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/trunk/pspaWT/cmt/requirements

    r226 r236  
    2727
    2828#macro PSPSLib_linkopts     " -L${PSPAWTROOT}/$(Platform_bin) -lPSPSLib "
    29 application pspaWT bareParticle.cc particleBeam.cc GWt_cell.cc GWt_rfgun.cc GWt_soleno.cc GWt_bend.cc GWt_beam.cc GWt_globalParameters.cc GWt_drift.cc GWt_fit.cc GWt_abstractElement.cc dataManager.cc elementsCollection.cc elementDrift.cc elementCell.cc elementRfgun.cc elementSoleno.cc elementBend.cc elementBeam.cc elementFit.cc globalParameters.cc abstractElement.cc GWt_tools.cc GWt_LigneFaisceau.cc GWt_pspaApplication.cc GWt_dropZoneLigneFaiseau.cc GWt_draggableImage.cc GWt_dialog.cc nomdElements.cc nomDeLogiciel.cc transportMoments.cc main.cc use_cppflags='" ${lib_PSPSLib_cppflags}"'
     29application pspaWT bareParticle.cc particleBeam.cc GWt_cell.cc GWt_rfgun.cc GWt_soleno.cc GWt_bend.cc GWt_beam.cc GWt_globalParameters.cc GWt_drift.cc GWt_fit.cc GWt_abstractElement.cc dataManager.cc elementsCollection.cc elementDrift.cc elementCell.cc elementRfgun.cc elementSoleno.cc elementBend.cc elementBeam.cc elementFit.cc globalParameters.cc abstractElement.cc GWt_tools.cc GWt_LigneFaisceau.cc GWt_pspaApplication.cc GWt_dropZoneLigneFaiseau.cc GWt_draggableImage.cc GWt_dialog.cc nomdElements.cc nomDeLogiciel.cc beam2Moments.cc main.cc use_cppflags='" ${lib_PSPSLib_cppflags}"'
    3030
    3131macro DrawWt_linkopts " ${PSPSLib_linkopts} ${Wt_linkopts} ${boost_linkopts} ${dld_linkopts}"
  • Interface_Web/trunk/pspaWT/include/dataManager.h

    r230 r236  
    1010#include "nomDeLogiciel.h"
    1111#include "trivaluedBool.h"
     12#include "beam2Moments.h"
     13
     14
     15
     16
    1217class dataManager
    1318{
     
    2530  void removeFile(string nameOfFile);
    2631  void clearSectionToExecute();
     32  bool  moments2FromTransport(string workingDir, string elLab, const nomdElements elem, beam2Moments& moments) const;
    2733
    2834 public:
     
    5662  bool restoreElements(string workingDir, string inputFileName);
    5763  void donneesRmsEnveloppe( string type, unsigned int numeroDeb, unsigned int numeroFin, vector<double>& xcor, vector<double>& ycor);
     64
     65
    5866};
    5967#endif
  • Interface_Web/trunk/pspaWT/include/particleBeam.h

    r229 r236  
    1212#include "mathematicalTools.h"
    1313#include "nomdElements.h"
    14 #include "transportMoments.h"
     14#include "beam2Moments.h"
    1515
    1616using namespace std;
     
    4444  vector<bareParticle> goodPartic_;
    4545
    46   transportMoments rij_;
     46  beam2Moments rij_;
    4747
    48   //  vector< vector<double> > rij_transportMoments_;
     48
    4949  vector<double> centroid_;
    5050  double P0Transport_;
    5151
    5252
    53   //  void readTransportMoments(ifstream& inp);
    54   void readTransportMoments(stringstream& inp);
     53
    5554
    5655  void impressionDesMoments() const;
     
    6766  void buildMomentRepresentation();
    6867
    69   bool  setFromTransport(string workingDir, string elementLabel, const nomdElements elem);
    70 
    71   //  void setFromBeamParameters(double x, double xp, double y, double yp, double dl, double del, double P0);
    72 
    73 
    7468
    7569  void clear();
     
    7771  int getNbParticles() const;
    7872
    79   const transportMoments&  getTransportMoments() const;
     73  const beam2Moments&  getTransportMoments() const;
    8074  double getSigmaTransportij(unsigned i, unsigned j);
    8175  double getUnnormalizedEmittanceX();
     
    9791  void getVariance(double& varx, double& vary, double& varz) const;
    9892 
     93  void set2Moments(beam2Moments& moments);
    9994
    10095  void printAllXYZ() const;
  • Interface_Web/trunk/pspaWT/src/dataManager.cc

    r230 r236  
    11#include "dataManager.h"
    2 //#include "environmentVariables.h"
    3 #include "transportMoments.h"
    42
    53#include <stdio.h>
     
    157155            string elemLabel = getLabelFromElementNumero (k);
    158156            abstractElement* ptr = elementsGallery_.getElementPointerFromNumero(k);
    159             if (!diagnosticBeam_.back().setFromTransport(workingDir, elemLabel, ptr->getNomdElement() )  )
     157
     158
     159            beam2Moments transpMoments;
     160
     161            if (!moments2FromTransport(workingDir, elemLabel, ptr->getNomdElement(),transpMoments )  )
     162              //            if (!diagnosticBeam_.back().setFromTransport(workingDir, elemLabel, ptr->getNomdElement() )  )
    160163              {
    161164                sortie << " reading transport output  failed " << endl;
     
    163166                break;
    164167              }
     168            diagnosticBeam_.back().set2Moments(transpMoments);
    165169          }
    166170        if ( ExecuteStatus ) currentBeam_ = &diagnosticBeam_.back();
     
    300304      // ici, en principe, on a un faisceau correct
    301305      // on ecrit sur le fichier input
    302       const transportMoments& moments = currentBeam_->getTransportMoments();
     306      const beam2Moments& moments = currentBeam_->getTransportMoments();
    303307      double P0 = currentBeam_->getP0Transport();
    304308      outfile << moments.writeToTransportInput(P0);
     
    544548    }
    545549}
     550
     551bool  dataManager::moments2FromTransport(string workingDir, string elLab, const nomdElements elem, beam2Moments& moments) const {
     552
     553  string elementLabel = elLab;
     554  // transformer le label en majuscules ; je ne suis pas sur que ca
     555  // marchera a tous les coups (glm)
     556  std::transform(elementLabel.begin(), elementLabel.end(), elementLabel.begin(), (int (*)(int))std::toupper);
     557
     558  cout << " dataManager::moments2FromTransport on cherche element " << elementLabel << endl;
     559  ifstream infile;
     560  string nameIn = workingDir + "transport.output";
     561  infile.open(nameIn.c_str(), ios::in);
     562  if (!infile) {
     563    cerr << " dataManager::moments2FromTransport : error re-opening transport output stream " << nameIn << endl;
     564    return false;
     565  }
     566  //  else cout << " particleBeam::setFromTransport() : ouverture du fichier " << nameIn << endl;
     567
     568  string::size_type nn = string::npos;
     569  string  fichier;
     570  string buf;
     571  unsigned compteur = 0;
     572  while ( getline(infile, buf) ) {
     573      fichier += buf+"\n";
     574    nn = buf.find(elementLabel);
     575    if ( nn != string::npos ) {
     576      compteur++;
     577      //      break;
     578    }
     579  }
     580  infile.close();
     581  cout << " compteur= " << compteur << endl;
     582  if ( compteur == 0 ) {
     583    cerr << " dataManager::moments2FromTransport : element " << elementLabel << " non trouve dans le fichier  " << nameIn << endl;
     584    return false;
     585  }
     586
     587
     588  stringstream fichierStream(fichier);
     589  buf.clear();
     590  unsigned relu = 0;
     591  while ( std::getline(fichierStream, buf) ) {
     592    //    cout << " relecture buffer : " << buf << endl;
     593    nn = buf.find(elementLabel);
     594    if ( nn != string::npos ) {
     595      relu++;
     596      if ( relu == compteur ) {
     597        cout << " TROUVE !" << endl;
     598        break;
     599      }
     600    }
     601  }
     602  moments.readFromTransportOutput(fichierStream);
     603  //  impressionDesMoments();
     604  return true;
     605
     606}
  • Interface_Web/trunk/pspaWT/src/elementBeam.cc

    r225 r236  
    11#include "elementBeam.h"
    2 #include "transportMoments.h"
     2#include "beam2Moments.h"
    33#include "mixedTools.h"
    44
     
    8787string elementBeam::transportOutputFlow() const {
    8888  ostringstream sortie;
    89   transportMoments moments(x_, xp_, y_, yp_, dl_, del_);
     89  beam2Moments moments(x_, xp_, y_, yp_, dl_, del_);
    9090  cout << " elementBeam::transportOutputFlow(), p0 = " << p0_ << endl;
    9191  sortie << label_ << ":" << moments.writeToTransportInput(p0_);
  • Interface_Web/trunk/pspaWT/src/particleBeam.cc

    r232 r236  
    3535}
    3636
    37 const transportMoments&   particleBeam::getTransportMoments() const  {
     37const beam2Moments&   particleBeam::getTransportMoments() const  {
    3838    return rij_;
    3939}
     
    7373  return P0Transport_;
    7474}
     75
     76void particleBeam::set2Moments(beam2Moments& moments) {
     77  rij_ = moments;
     78  momentRepresentationOk_ = true;
     79}
     80
     81
     82
    7583bool particleBeam::particleRepresentationOk() const {
    7684  return particleRepresentationOk_;
     
    140148// }
    141149
    142 bool  particleBeam::setFromTransport(string workingDir, string elLab, const nomdElements elem)
    143 {
    144   string elementLabel = elLab;
    145   // transformer le label en majuscules ; je ne suis pas sur que ca
    146   // marchera a tous les coups (glm)
    147   std::transform(elementLabel.begin(), elementLabel.end(), elementLabel.begin(), (int (*)(int))std::toupper);
    148 
    149   cout << " particleBeam::setFromTransport on cherche element " << elementLabel << endl;
    150   ifstream infile;
    151   //  string nameIn = WORKINGAREA + "transport.output";
    152   string nameIn = workingDir + "transport.output";
    153   infile.open(nameIn.c_str(), ios::in);
    154   if (!infile) {
    155     cerr << " particleBeam::setFromTransport : error re-opening transport output stream " << nameIn << endl;
    156     return false;
    157   }
    158   //  else cout << " particleBeam::setFromTransport() : ouverture du fichier " << nameIn << endl;
    159 
    160   string::size_type nn = string::npos;
    161   string  fichier;
    162   string buf;
    163   unsigned compteur = 0;
    164   while ( getline(infile, buf) ) {
    165       fichier += buf+"\n";
    166     nn = buf.find(elementLabel);
    167     if ( nn != string::npos ) {
    168       compteur++;
    169       //      break;
    170     }
    171   }
    172   infile.close();
    173   cout << " compteur= " << compteur << endl;
    174   if ( compteur == 0 ) {
    175     cerr << " particleBeam::setFromTransport : element " << elementLabel << " non trouve dans le fichier  " << nameIn << endl;
    176     return false;
    177   }
    178 
    179 
    180   stringstream fichierStream(fichier);
    181   buf.clear();
    182   unsigned relu = 0;
    183   while ( std::getline(fichierStream, buf) ) {
    184     //    cout << " relecture buffer : " << buf << endl;
    185     nn = buf.find(elementLabel);
    186     if ( nn != string::npos ) {
    187       relu++;
    188       if ( relu == compteur ) {
    189         cout << " TROUVE !" << endl;
    190         break;
    191       }
    192     }
    193   }
    194 
    195   readTransportMoments(fichierStream);
    196   //  impressionDesMoments();
    197   momentRepresentationOk_ = true;
    198   return true;
    199 }
     150// bool  particleBeam::setFromTransport(string workingDir, string elLab, const nomdElements elem)
     151// {
     152//   string elementLabel = elLab;
     153//   // transformer le label en majuscules ; je ne suis pas sur que ca
     154//   // marchera a tous les coups (glm)
     155//   std::transform(elementLabel.begin(), elementLabel.end(), elementLabel.begin(), (int (*)(int))std::toupper);
     156
     157//   cout << " particleBeam::setFromTransport on cherche element " << elementLabel << endl;
     158//   ifstream infile;
     159//   //  string nameIn = WORKINGAREA + "transport.output";
     160//   string nameIn = workingDir + "transport.output";
     161//   infile.open(nameIn.c_str(), ios::in);
     162//   if (!infile) {
     163//     cerr << " particleBeam::setFromTransport : error re-opening transport output stream " << nameIn << endl;
     164//     return false;
     165//   }
     166//   //  else cout << " particleBeam::setFromTransport() : ouverture du fichier " << nameIn << endl;
     167
     168//   string::size_type nn = string::npos;
     169//   string  fichier;
     170//   string buf;
     171//   unsigned compteur = 0;
     172//   while ( getline(infile, buf) ) {
     173//       fichier += buf+"\n";
     174//     nn = buf.find(elementLabel);
     175//     if ( nn != string::npos ) {
     176//       compteur++;
     177//       //      break;
     178//     }
     179//   }
     180//   infile.close();
     181//   cout << " compteur= " << compteur << endl;
     182//   if ( compteur == 0 ) {
     183//     cerr << " particleBeam::setFromTransport : element " << elementLabel << " non trouve dans le fichier  " << nameIn << endl;
     184//     return false;
     185//   }
     186
     187
     188//   stringstream fichierStream(fichier);
     189//   buf.clear();
     190//   unsigned relu = 0;
     191//   while ( std::getline(fichierStream, buf) ) {
     192//     //    cout << " relecture buffer : " << buf << endl;
     193//     nn = buf.find(elementLabel);
     194//     if ( nn != string::npos ) {
     195//       relu++;
     196//       if ( relu == compteur ) {
     197//      cout << " TROUVE !" << endl;
     198//      break;
     199//       }
     200//     }
     201//   }
     202//
     203//   readTransportMoments(fichierStream);
     204//   //  impressionDesMoments();
     205//   momentRepresentationOk_ = true;
     206//   return true;
     207// }
    200208
    201209
     
    501509// }
    502510
    503 void particleBeam::readTransportMoments(stringstream& inp) {
    504 rij_.readFromTransportOutput(inp);
    505 }
     511// void particleBeam::readTransportMoments(stringstream& inp) {
     512// rij_.readFromTransportOutput(inp);
     513// }
    506514
    507515double particleBeam::getXmaxRms() {
Note: See TracChangeset for help on using the changeset viewer.