Ignore:
Timestamp:
Jun 21, 2013, 10:16:56 AM (11 years ago)
Author:
lemeur
Message:

definition des compatibilites des elements dans les software

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/trunk/pspaWT/sources/controler/src/softwareGenerator.cc

    r417 r418  
    1515{
    1616  nameOfSoftware_ = nomDeLogiciel("generator");
     17  registerElement(nomdElements::beam,TBoolOk);
    1718}
    1819
     
    2627  elPtr = dataManager_->getElementPointerFromNumero(numeroDeb_);
    2728
    28   if ( elPtr->getNomdElement().getElementType() != RFgun ) {
     29  if ( elPtr->getNomdElement().getElementType() != nomdElements::RFgun ) {
    2930    dataManager_->consoleMessage(" softwareGenerator::createInputFile : the element must be rfgun " );
    3031    cerr << " softwareGenerator::createInputFile : the element must be rfgun" << endl;
     
    4546  outfile << " Add=FALSE, N_add=0" << endl;
    4647  outfile << " Species='electrons'" << endl;
    47   outfile << elPtr->generatorOutputFlow() << endl;
     48  //  outfile << elPtr->generatorOutputFlow() << endl;
     49
     50  outfile << elementsData(elPtr->parametersToSoftware()) << endl;
     51
    4852  outfile << "/" << endl;
    4953  outfile.close();
     
    231235  return true;
    232236}
     237
     238
     239string softwareGenerator::elementsData(const vector< pair<string, vector<string> > >& donnees) const {
     240  unsigned k;
     241  cout << " PASSAGE softwareGenerator::elementsData " << endl;
     242  if ( donnees.at(0).first != "labelsGenericSpecific" ) {
     243    cout << " softwareGenerator::elementsData ERROR : element badly defined " << endl;
     244    return string();
     245  }
     246  string genericName = donnees.at(0).second.at(0);
     247  if ( genericName == "rfgun" ) return rfgunData(donnees);
     248  return string();
     249}
     250
     251string softwareGenerator::rfgunData(const vector< pair<string, vector<string> > >& donnees) const {
     252
     253  cout << " PASSAGE softwareGenerator::rfgunData " << endl;
     254  string nmacrop = "0";
     255  string sigma_t = "0.0";
     256  string sigma_r = "0.0";
     257  string emit_x = "0.0";
     258  string emit_y = "0.0";
     259  string E_cin = "0.0";
     260  string sigma_E = "0.0";
     261  string phaseStep = "0.0";
     262  string totalCharge = "0.0";
     263
     264  unsigned k;
     265  for ( k=1; k < donnees.size(); k++) {
     266    if ( donnees.at(k).first == "nbMacroparticles" ) {
     267      nmacrop = donnees.at(k).second.at(0);
     268    } else if ( donnees.at(k).first == "sigmasTR" ) {
     269      sigma_t = donnees.at(k).second.at(0);
     270      sigma_r = donnees.at(k).second.at(1);
     271    } else if ( donnees.at(k).first == "emittancesXY" ) {
     272      emit_x = donnees.at(k).second.at(0);
     273      emit_y = donnees.at(k).second.at(1);
     274    } else if ( donnees.at(k).first == "kineticE" ) {
     275      E_cin = donnees.at(k).second.at(0);
     276      sigma_E = donnees.at(k).second.at(1);
     277    } else if ( donnees.at(k).first == "phaseStep" ) {
     278      phaseStep = donnees.at(k).second.at(0);
     279    } else if ( donnees.at(k).first == "totalCharge" ) {
     280      totalCharge = donnees.at(k).second.at(0);
     281    }
     282  }
     283  ostringstream sortie;
     284
     285
     286    sortie << "Ipart=" << nmacrop << endl;
     287
     288    sortie << "Probe=.True." << endl;
     289    sortie << "Noise_reduc=.T" << endl;
     290    sortie << "Cathode=.T." << endl;
     291    sortie << "Q_total=" << totalCharge << endl;
     292    sortie << "Ref_zpos=0.0" << endl;
     293    sortie << "Ref_clock=0.0" << endl;
     294    sortie << "Ref_Ekin=" << E_cin << endl; // tjs en MeV
     295    sortie << "Dist_z='g'" << endl;
     296    sortie << "sig_clock=" << 1.0e-3*atof(sigma_t.c_str()) << endl; // passage de ps en ns
     297    sortie <<  "Dist_pz='g', sig_Ekin=" << 1000.*atof(sigma_E.c_str()) << ",  emit_z=0.0 ,    cor_Ekin=0.0 " << endl;  // passage en keV
     298    sortie << "Dist_x='gauss',  sig_x=" <<  10.*atof(sigma_r.c_str()) << endl;    // passage en mm
     299    sortie << "Dist_px='g', Nemit_x=" << emit_x << ",   cor_px=0.0" << endl;
     300    sortie << "Dist_y='gauss',  sig_y=" <<  10.*atof(sigma_r.c_str()) << endl;    // passage en mm
     301    sortie << "Dist_py='g', Nemit_y=" << emit_y << ",   cor_py=0.0" << endl;
     302 
     303  return sortie.str();
     304}
Note: See TracChangeset for help on using the changeset viewer.