Changeset 304 in PSPA


Ignore:
Timestamp:
Jan 31, 2013, 8:42:59 PM (11 years ago)
Author:
lemeur
Message:

introduction du logiciel 'generator' (debut)

Location:
Interface_Web/trunk/pspaWT
Files:
2 added
18 edited

Legend:

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

    r302 r304  
    3232 ../sources/controler/src/softwareParmela.cc \
    3333 ../sources/controler/src/softwareTransport.cc \
     34 ../sources/controler/src/softwareGenerator.cc \
    3435 ../sources/userInterface/src/GWt_cell.cc \
    3536 ../sources/userInterface/src/GWt_rfgun.cc \
  • Interface_Web/trunk/pspaWT/sources/controler/include/PhysicalConstants.h

    r257 r304  
    66                     // prendre en compte la charge image, dans la charge d'espace               
    77#define ELECTRONCHARGE 1.60217653e-19
     8#define ELECTRONANOCOULOMB 1.60217653e-10
    89#define ELECTRONRADIUS 2.817940325e-13  // cm!
    910#define ERESTMeV 0.510998918
  • Interface_Web/trunk/pspaWT/sources/controler/include/abstractElement.h

    r287 r304  
    5454    double getLenghtOfElement() const;
    5555    int getNbParams() const;
    56     /* bool is_parmela_ignored() const; */
    57     /* bool is_parmela_element() const; */
    58     /* bool is_transport_element() const; */
    5956    virtual trivaluedBool is_accepted_by_software(nomDeLogiciel soft) const;
    6057    virtual void setPhaseStep(double);
     
    6562    virtual string parmelaOutputFlow() const = 0;
    6663    virtual string transportOutputFlow() const = 0;
     64    virtual string generatorOutputFlow() const;
    6765    virtual string FileOutputFlow() const = 0;
    6866    virtual void FileInput(ifstream& ifs) = 0;
  • Interface_Web/trunk/pspaWT/sources/controler/include/abstractSoftware.h

    r298 r304  
    2929  ~abstractSoftware() {;}
    3030
    31   virtual bool createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir) = 0;
     31  virtual bool createInputFile(string inputFileName, particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir) = 0;
    3232
    3333
  • Interface_Web/trunk/pspaWT/sources/controler/include/elementRfgun.h

    r287 r304  
    2020    double defaultSigma_t_;
    2121    double defaultSigma_r_;
     22    double defaultEmit_x_;
     23    double defaultEmit_y_;
    2224    double defaultE_cin_;
    2325    double defaultSigma_E_;
    24     double defaultNb_true_particles_;
     26    double defaultTotalCharge_;
    2527   
    2628    double phaseStep_; // a recuperer dans les parametres globaux (methode setPhaseStep)
     
    2830    double sigma_t_; // picoseconds
    2931    double sigma_r_; // cm
     32    double emit_x_; // pi.mm.mrad
     33    double emit_y_; // pi.mm.mrad
    3034    double E_cin_;   // MeV
    3135    double sigma_E_; // MeV
    32     double nb_true_particles_;
     36    double totalCharge_;  // nC
    3337   
    3438    void setDefaultValues();
     
    6266    }
    6367   
     68    virtual string generatorOutputFlow() const;
     69
    6470    virtual string FileOutputFlow() const;
    6571   
  • Interface_Web/trunk/pspaWT/sources/controler/include/nomDeLogiciel.h

    r257 r304  
    1414  enum Logiciel
    1515  {
    16     parmela, transport, unknownSoftware
     16    parmela, transport, generator, unknownSoftware
    1717  }; 
    1818
  • Interface_Web/trunk/pspaWT/sources/controler/include/softwareParmela.h

    r298 r304  
    1919
    2020
    21   virtual bool createInputFile(particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir);
     21  virtual bool createInputFile(string inputFileName, particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir);
    2222
    2323  virtual bool  execute(unsigned int numeroDeb,unsigned int numeroFin,string workingDir,string& resul);
  • Interface_Web/trunk/pspaWT/sources/controler/include/softwareTransport.h

    r298 r304  
    1717
    1818  virtual ~softwareTransport() {;}
    19   virtual bool createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir);
     19  virtual bool createInputFile(string inputFileName, particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir);
    2020
    2121  virtual bool  execute(unsigned int numeroDeb,unsigned int numeroFin,string workingDir,string& resul);
  • Interface_Web/trunk/pspaWT/sources/controler/src/abstractElement.cc

    r271 r304  
    6060}
    6161
    62 // typedElement abstractElement::getName() const
    63 // {
    64 //   return elementName_;
    65 // }
    6662
    6763nomdElements abstractElement::getNomdElement() const
     
    6965  return elementName_;
    7066}
    71 
    72 // string abstractElement::getElementImage() const
    73 // {
    74 //   return elementName_.getElementImage();
    75 // }
    76 
    77 
    78 
    79 // string abstractElement::getElementImage() const
    80 // {
    81 //   return elementName_.getElementImage();
    82 // }
    83 
    84 
    85 
    86 // string abstractElement::getElementName() const
    87 // {
    88 //   return elementName_.getElementName();
    89 // }
    9067
    9168
     
    10077
    10178trivaluedBool abstractElement::is_accepted_by_software(nomDeLogiciel soft) const {
    102     cout << " abstractElement :  is_accepted_by_software suspect  " << endl;
    103 
     79    cout << " abstractElement : generic method is_accepted_by_software()  " << endl;
    10480  return error;
    10581}
     
    10985  return 0.0;
    11086}
     87
     88
     89string abstractElement::generatorOutputFlow() const {
     90  return "";
     91}
  • Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc

    r302 r304  
    44#include "softwareParmela.h"
    55#include "softwareTransport.h"
     6#include "softwareGenerator.h"
    67
    78#include <stdio.h>
     
    5758    indexDeb = jobList_[k]->firstElement;
    5859    indexFin = jobList_[k]->lastElement;
    59     if ( indexFin  <= indexDeb )
     60    if ( indexFin  < indexDeb )
    6061      {
    61         diagnostic += " first and last elements are the same for job " + (jobList_[k]->software).getString() + " \n";
     62        diagnostic += " last element before first for job " + (jobList_[k]->software).getString() + " \n";
    6263        resul = error;
    6364        break;
     
    138139      cout << " dataManager::executeAll je m'apprete a executer : " << (jobList_[k]->software).getString() << endl;
    139140
     141      string inputFileName;
    140142      if(jobList_[k]->software == nomDeLogiciel::parmela) {
    141143        softw = new softwareParmela(&globParam_, &elementsGallery_);
     144        inputFileName = "parmin";
    142145      } else if (jobList_[k]->software == nomDeLogiciel::transport) {
    143146        softw = new softwareTransport(&globParam_, &elementsGallery_);
     147        inputFileName = "transport.input";
     148      } else if (jobList_[k]->software == nomDeLogiciel::generator) {
     149        softw = new softwareGenerator(&globParam_, &elementsGallery_);
     150        inputFileName = "generator.in";
    144151      } else {
    145152        success = false;
     
    148155      }
    149156
    150       success = softw->createInputFile(currentBeam_, debut, fin, workingDir_);
     157      success = softw->createInputFile(inputFileName,currentBeam_, debut, fin, workingDir_);
    151158      if ( !success ) {
    152159        resultatPartiel += " error creating input file \n";
  • Interface_Web/trunk/pspaWT/sources/controler/src/elementRfgun.cc

    r288 r304  
    33
    44#include "mathematicalTools.h"
     5#include "PhysicalConstants.h"
    56#include "mixedTools.h"
    67
     
    2324    defaultSigma_t_ = 0.0;
    2425    defaultSigma_r_ = 0.0;
     26    defaultEmit_x_ = 0.0;
     27    defaultEmit_y_ = 0.0;
    2528    defaultE_cin_ = 0.0;
    2629    defaultSigma_E_ = 0.0;
    27     defaultNb_true_particles_ = 1.0;
     30    //    defaultNb_true_particles_ = 1.0;
     31    defaultTotalCharge_ = 0.0;
    2832  }
    2933
     
    3539    sigma_t_ = defaultSigma_t_;
    3640    sigma_r_ = defaultSigma_r_ ;
     41    emit_x_ = defaultEmit_x_;
     42    emit_y_ = defaultEmit_y_;
    3743    E_cin_ = defaultE_cin_;
    3844    sigma_E_ = defaultSigma_E_;
    39     nb_true_particles_ = defaultNb_true_particles_ ;
     45    //    nb_true_particles_ = defaultNb_true_particles_ ;
     46    totalCharge_ = defaultTotalCharge_;
    4047  }
    4148
     
    4350  cout << " elementRfgun : c'est le bon is_accepted_by_software " << endl;
    4451  if ( soft == nomDeLogiciel::parmela ) return ok;
     52  else if ( soft == nomDeLogiciel::generator ) return ok;
    4553  else return error;
    4654}
     
    5462    parametersString_[++compteur] = mixedTools::doubleToString(sigma_t_);
    5563    parametersString_[++compteur] = mixedTools::doubleToString(sigma_r_);
     64    parametersString_[++compteur] = mixedTools::doubleToString(emit_x_);
     65    parametersString_[++compteur] = mixedTools::doubleToString(emit_y_);
    5666    parametersString_[++compteur] = mixedTools::doubleToString(E_cin_);
    5767    parametersString_[++compteur] = mixedTools::doubleToString(sigma_E_);
    58     parametersString_[++compteur] = mixedTools::doubleToString(nb_true_particles_);
     68    parametersString_[++compteur] = mixedTools::doubleToString(totalCharge_);
    5969    return parametersString_;
    6070  }
     
    7989    sigma_t_ = atof(param[++compteur].c_str());
    8090    sigma_r_ = atof(param[++compteur].c_str());
     91    emit_x_ = atof(param[++compteur].c_str());
     92    emit_y_ = atof(param[++compteur].c_str());
    8193    E_cin_ = atof(param[++compteur].c_str());
    8294    sigma_E_ = atof(param[++compteur].c_str());
    83     nb_true_particles_ = atof(param[++compteur].c_str());
     95    totalCharge_ = atof(param[++compteur].c_str());
    8496
    8597  }
     
    94106    sortie << " /dwt=" << phaseStep_ << " /ran=2" << endl;
    95107
    96     sortie << "SCHEFF /beami=" << -nb_true_particles_ << " /nprog=2 /point=-1.7";
     108    // on doit entrer le nb vrai de part. (avec signe moins)
     109   
     110
     111    sortie << "SCHEFF /beami=" << -fabs(totalCharge_)/ELECTRONANOCOULOMB << " /nprog=2 /point=-1.7";
    97112 
    98113    return sortie.str();
    99114  }
     115
     116string elementRfgun::generatorOutputFlow() const {
     117    ostringstream sortie;
     118    sortie << "Ipart=" << nmacrop_ << endl;
     119
     120    sortie << "Probe=.True." << endl;
     121    sortie << "Noise_reduc=.T" << endl;
     122    sortie << "Cathode=.T." << endl;
     123    sortie << "Q_total=" << totalCharge_ << endl;
     124    sortie << "Ref_zpos=0.0" << endl;
     125    sortie << "Ref_clock=0.0" << endl;
     126    sortie << "Ref_Ekin=" << E_cin_ << endl; // tjs en MeV
     127    sortie << "Dist_z='g'" << endl;
     128    sortie << "sig_clock=" << 1.0e-3*sigma_t_ << endl; // passage de ps en ns
     129    sortie <<  "Dist_pz='g', sig_Ekin=" << 1000.*sigma_E_ << ",  emit_z=0.0 ,    cor_Ekin=0.0 " << endl;  // passage en keV
     130    sortie << "Dist_x='gauss',  sig_x=" <<  10.*sigma_r_ << endl;    // passage en mm
     131    sortie << "Dist_px='g', Nemit_x=" << emit_x_ << ",   cor_px=0.0" << endl;
     132    sortie << "Dist_y='gauss',  sig_y=" <<  10.*sigma_r_ << endl;    // passage en mm
     133    sortie << "Dist_py='g', Nemit_y=" << emit_y_ << ",   cor_py=0.0" << endl;
     134    return sortie.str();
     135}
     136
     137
    100138
    101139string elementRfgun::FileOutputFlow() const
     
    107145    sortie  << label_ << endl;
    108146    sortie <<  nmacrop_ << "  " << sigma_t_ << "  " << sigma_r_ << endl;
     147    sortie << emit_x_ << "  " << emit_y_ << endl;
    109148    sortie << E_cin_ << " " << sigma_E_ << endl;
    110     sortie << phaseStep_ << "  "  << nb_true_particles_ << endl;
     149    sortie << phaseStep_ << "  "  << totalCharge_ << endl;
    111150    return sortie.str();
    112151  }
     
    116155  ifs >> label_;
    117156  ifs >> nmacrop_ >> sigma_t_ >> sigma_r_;
     157  ifs >> emit_x_  >>  emit_y_;
    118158  ifs >> E_cin_ >> sigma_E_;
    119   ifs >> phaseStep_ >> nb_true_particles_;
     159  ifs >> phaseStep_ >> totalCharge_;
    120160}
    121161
     
    125165   
    126166    txt += label_;
    127     txt += "\nnr of macroparticles : ";
    128     txt += mixedTools::doubleToString(nb_true_particles_);
     167    txt += "\ntotal charge : ";
     168    txt += mixedTools::doubleToString(totalCharge_);
    129169    txt += "\nsigma_t (ps) : ";
    130170    txt += mixedTools::doubleToString(sigma_t_);
    131171    txt += "\nsigma_r (cm) : ";
    132172    txt += mixedTools::doubleToString(sigma_r_);
     173    txt += "\nemittance x (pi.mm.mrad) : ";
     174    txt += mixedTools::doubleToString(emit_x_);
     175    txt += "\nemittance y (pi.mm.mrad) : ";
     176    txt += mixedTools::doubleToString(emit_y_);
    133177    txt += "\ninitial kinetic energy (MeV) : ";
    134178    txt += mixedTools::doubleToString(E_cin_);
  • Interface_Web/trunk/pspaWT/sources/controler/src/nomDeLogiciel.cc

    r257 r304  
    66    if (s == "parmela" ) return parmela;
    77    else if ( s == "transport" ) return transport;
     8    else if ( s == "generator" ) return generator;
    89    return unknownSoftware;
    910  }
     
    1516      case parmela : { return "parmela"; }
    1617      case transport : { return "transport"; }
     18      case generator : { return "generator"; }
    1719      case unknownSoftware : { return "unknownSoftware"; }
    1820      }
     
    2628      case 0 : { return parmela; }
    2729      case 1 : { return transport; }
     30      case 2 : { return generator; }
    2831      }
    2932    return unknownSoftware;
     
    3639      case parmela : { return 0; }
    3740      case transport : { return 1; }
    38       case unknownSoftware :  { return 2; }
     41      case generator : { return 2; }
     42      case unknownSoftware :  { return 3; }
    3943      }
    4044    return -1;
  • Interface_Web/trunk/pspaWT/sources/controler/src/nomdElements.cc

    r271 r304  
    6363  switch(eType) {
    6464  case beam : return 8;
    65   case RFgun : return 7;
     65  case RFgun : return 9;
    6666  case drift :  return 3;
    6767  case cell :  return 10;
  • Interface_Web/trunk/pspaWT/sources/controler/src/softwareParmela.cc

    r298 r304  
    1616}
    1717
    18 bool softwareParmela::createInputFile(particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
     18bool softwareParmela::createInputFile(string inputFileName, particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
    1919{
    2020  unsigned int k;
     
    3030
    3131  ofstream outfile;
    32   string name = workingDir + "parmin";
     32  string name = workingDir + inputFileName;
    3333  outfile.open(name.c_str(), ios::out);
    3434  if (!outfile) {
     
    174174
    175175  int testNombrePartRef =0;
    176   double phaseRef;
     176  double phaseRef = 0.0;
    177177
    178178  while( partic.readFromParmelaFile(filefais) > 0 ) {
     
    193193          testNombrePartRef++;
    194194          if ( testNombrePartRef != 1 ) {
    195             cerr << " TROP DE PART. DE REF : " << testNombrePartRef << " !! " << endl;
     195            cerr << " nombre de part. de ref different de 1 : " << testNombrePartRef << " !! " << endl;
    196196            return false;
    197197          }
  • Interface_Web/trunk/pspaWT/sources/controler/src/softwareTransport.cc

    r298 r304  
    55#include <algorithm>
    66
    7 
    87softwareTransport::softwareTransport() : abstractSoftware()
    98{
     
    1716
    1817
    19 bool softwareTransport::createInputFile(particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
     18bool softwareTransport::createInputFile(string inputFileName, particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
    2019{
    2120  unsigned int k;
     
    3938
    4039  ofstream outfile;
    41   string name = workingDir + "transport.input";
     40  string name = workingDir + inputFileName;
    4241  outfile.open(name.c_str(), ios::out);
    4342  if (!outfile)
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_rfgun.h

    r293 r304  
    1818    WLineEdit* sigma_tEdit_; // picoseconds
    1919    WLineEdit* sigma_rEdit_; // cm
     20    WLineEdit* emit_xEdit_; // pi.mm.mrad
     21    WLineEdit* emit_yEdit_; // pi.mm.mrad
    2022    WLineEdit* E_cinEdit_;   // MeV
    2123    WLineEdit* sigma_EEdit_; // MeV
    22     WLineEdit* nb_true_particlesEdit_;
     24    WLineEdit* totalChargeEdit_;
    2325   
    2426   
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_rfgun.cc

    r294 r304  
    2727    new WBreak(dialog_->contents());
    2828   
     29
     30    new WText("emittance x (pi.mm.mrad) : ",dialog_->contents());
     31    emit_xEdit_ = new WLineEdit( (++param)->c_str(), dialog_->contents());
     32    new WText("emittance y (pi.mm.mrad) : ",dialog_->contents());
     33    emit_yEdit_ = new WLineEdit( (++param)->c_str(), dialog_->contents());
     34    new WBreak(dialog_->contents());
     35
    2936    new WText("initial kinetic energy (MeV) : ",dialog_->contents());
    3037    E_cinEdit_ = new WLineEdit( (++param)->c_str(), dialog_->contents());
     
    3542    new WBreak(dialog_->contents());
    3643   
    37     new WText("true number of part. in beam : ",dialog_->contents());
    38     nb_true_particlesEdit_ = new WLineEdit( (++param)->c_str(), dialog_->contents());
     44    new WText("total charge in beam (nC) : ",dialog_->contents());
     45    totalChargeEdit_ = new WLineEdit( (++param)->c_str(), dialog_->contents());
    3946    new WBreak(dialog_->contents());
    4047   
     
    5764    envoi[++compteur] = sigma_tEdit_->text().toUTF8();
    5865    envoi[++compteur] = sigma_rEdit_->text().toUTF8();
     66
     67    envoi[++compteur] = emit_xEdit_->text().toUTF8();
     68    envoi[++compteur] = emit_yEdit_->text().toUTF8();
     69
    5970    envoi[++compteur] = E_cinEdit_->text().toUTF8();
    6071    envoi[++compteur] = sigma_EEdit_->text().toUTF8();
    61     envoi[++compteur] = nb_true_particlesEdit_->text().toUTF8();
     72    envoi[++compteur] = totalChargeEdit_->text().toUTF8();
    6273    if ( compteur !=  (int)nbParam ) {
    6374        cerr << " GWt_rfgun::dialogDone() pb nb de parametres, compteur = " << compteur << " nbParam= " << nbParam << endl;
  • Interface_Web/trunk/pspaWT/workingArea/pspa.save

    r229 r304  
    44rfgun01
    55500  3.6  0.02
     60  0
    671e-06 1e-06
    7 3.1211e+09
     80.5
    89cell
    910cell01
Note: See TracChangeset for help on using the changeset viewer.