Changeset 304 in PSPA
- Timestamp:
- Jan 31, 2013, 8:42:59 PM (11 years ago)
- Location:
- Interface_Web/trunk/pspaWT
- Files:
-
- 2 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/cmt/requirements
r302 r304 32 32 ../sources/controler/src/softwareParmela.cc \ 33 33 ../sources/controler/src/softwareTransport.cc \ 34 ../sources/controler/src/softwareGenerator.cc \ 34 35 ../sources/userInterface/src/GWt_cell.cc \ 35 36 ../sources/userInterface/src/GWt_rfgun.cc \ -
Interface_Web/trunk/pspaWT/sources/controler/include/PhysicalConstants.h
r257 r304 6 6 // prendre en compte la charge image, dans la charge d'espace 7 7 #define ELECTRONCHARGE 1.60217653e-19 8 #define ELECTRONANOCOULOMB 1.60217653e-10 8 9 #define ELECTRONRADIUS 2.817940325e-13 // cm! 9 10 #define ERESTMeV 0.510998918 -
Interface_Web/trunk/pspaWT/sources/controler/include/abstractElement.h
r287 r304 54 54 double getLenghtOfElement() const; 55 55 int getNbParams() const; 56 /* bool is_parmela_ignored() const; */57 /* bool is_parmela_element() const; */58 /* bool is_transport_element() const; */59 56 virtual trivaluedBool is_accepted_by_software(nomDeLogiciel soft) const; 60 57 virtual void setPhaseStep(double); … … 65 62 virtual string parmelaOutputFlow() const = 0; 66 63 virtual string transportOutputFlow() const = 0; 64 virtual string generatorOutputFlow() const; 67 65 virtual string FileOutputFlow() const = 0; 68 66 virtual void FileInput(ifstream& ifs) = 0; -
Interface_Web/trunk/pspaWT/sources/controler/include/abstractSoftware.h
r298 r304 29 29 ~abstractSoftware() {;} 30 30 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; 32 32 33 33 -
Interface_Web/trunk/pspaWT/sources/controler/include/elementRfgun.h
r287 r304 20 20 double defaultSigma_t_; 21 21 double defaultSigma_r_; 22 double defaultEmit_x_; 23 double defaultEmit_y_; 22 24 double defaultE_cin_; 23 25 double defaultSigma_E_; 24 double default Nb_true_particles_;26 double defaultTotalCharge_; 25 27 26 28 double phaseStep_; // a recuperer dans les parametres globaux (methode setPhaseStep) … … 28 30 double sigma_t_; // picoseconds 29 31 double sigma_r_; // cm 32 double emit_x_; // pi.mm.mrad 33 double emit_y_; // pi.mm.mrad 30 34 double E_cin_; // MeV 31 35 double sigma_E_; // MeV 32 double nb_true_particles_;36 double totalCharge_; // nC 33 37 34 38 void setDefaultValues(); … … 62 66 } 63 67 68 virtual string generatorOutputFlow() const; 69 64 70 virtual string FileOutputFlow() const; 65 71 -
Interface_Web/trunk/pspaWT/sources/controler/include/nomDeLogiciel.h
r257 r304 14 14 enum Logiciel 15 15 { 16 parmela, transport, unknownSoftware16 parmela, transport, generator, unknownSoftware 17 17 }; 18 18 -
Interface_Web/trunk/pspaWT/sources/controler/include/softwareParmela.h
r298 r304 19 19 20 20 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); 22 22 23 23 virtual bool execute(unsigned int numeroDeb,unsigned int numeroFin,string workingDir,string& resul); -
Interface_Web/trunk/pspaWT/sources/controler/include/softwareTransport.h
r298 r304 17 17 18 18 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); 20 20 21 21 virtual bool execute(unsigned int numeroDeb,unsigned int numeroFin,string workingDir,string& resul); -
Interface_Web/trunk/pspaWT/sources/controler/src/abstractElement.cc
r271 r304 60 60 } 61 61 62 // typedElement abstractElement::getName() const63 // {64 // return elementName_;65 // }66 62 67 63 nomdElements abstractElement::getNomdElement() const … … 69 65 return elementName_; 70 66 } 71 72 // string abstractElement::getElementImage() const73 // {74 // return elementName_.getElementImage();75 // }76 77 78 79 // string abstractElement::getElementImage() const80 // {81 // return elementName_.getElementImage();82 // }83 84 85 86 // string abstractElement::getElementName() const87 // {88 // return elementName_.getElementName();89 // }90 67 91 68 … … 100 77 101 78 trivaluedBool 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; 104 80 return error; 105 81 } … … 109 85 return 0.0; 110 86 } 87 88 89 string abstractElement::generatorOutputFlow() const { 90 return ""; 91 } -
Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc
r302 r304 4 4 #include "softwareParmela.h" 5 5 #include "softwareTransport.h" 6 #include "softwareGenerator.h" 6 7 7 8 #include <stdio.h> … … 57 58 indexDeb = jobList_[k]->firstElement; 58 59 indexFin = jobList_[k]->lastElement; 59 if ( indexFin < =indexDeb )60 if ( indexFin < indexDeb ) 60 61 { 61 diagnostic += " first and last elements are the samefor job " + (jobList_[k]->software).getString() + " \n";62 diagnostic += " last element before first for job " + (jobList_[k]->software).getString() + " \n"; 62 63 resul = error; 63 64 break; … … 138 139 cout << " dataManager::executeAll je m'apprete a executer : " << (jobList_[k]->software).getString() << endl; 139 140 141 string inputFileName; 140 142 if(jobList_[k]->software == nomDeLogiciel::parmela) { 141 143 softw = new softwareParmela(&globParam_, &elementsGallery_); 144 inputFileName = "parmin"; 142 145 } else if (jobList_[k]->software == nomDeLogiciel::transport) { 143 146 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"; 144 151 } else { 145 152 success = false; … … 148 155 } 149 156 150 success = softw->createInputFile( currentBeam_, debut, fin, workingDir_);157 success = softw->createInputFile(inputFileName,currentBeam_, debut, fin, workingDir_); 151 158 if ( !success ) { 152 159 resultatPartiel += " error creating input file \n"; -
Interface_Web/trunk/pspaWT/sources/controler/src/elementRfgun.cc
r288 r304 3 3 4 4 #include "mathematicalTools.h" 5 #include "PhysicalConstants.h" 5 6 #include "mixedTools.h" 6 7 … … 23 24 defaultSigma_t_ = 0.0; 24 25 defaultSigma_r_ = 0.0; 26 defaultEmit_x_ = 0.0; 27 defaultEmit_y_ = 0.0; 25 28 defaultE_cin_ = 0.0; 26 29 defaultSigma_E_ = 0.0; 27 defaultNb_true_particles_ = 1.0; 30 // defaultNb_true_particles_ = 1.0; 31 defaultTotalCharge_ = 0.0; 28 32 } 29 33 … … 35 39 sigma_t_ = defaultSigma_t_; 36 40 sigma_r_ = defaultSigma_r_ ; 41 emit_x_ = defaultEmit_x_; 42 emit_y_ = defaultEmit_y_; 37 43 E_cin_ = defaultE_cin_; 38 44 sigma_E_ = defaultSigma_E_; 39 nb_true_particles_ = defaultNb_true_particles_ ; 45 // nb_true_particles_ = defaultNb_true_particles_ ; 46 totalCharge_ = defaultTotalCharge_; 40 47 } 41 48 … … 43 50 cout << " elementRfgun : c'est le bon is_accepted_by_software " << endl; 44 51 if ( soft == nomDeLogiciel::parmela ) return ok; 52 else if ( soft == nomDeLogiciel::generator ) return ok; 45 53 else return error; 46 54 } … … 54 62 parametersString_[++compteur] = mixedTools::doubleToString(sigma_t_); 55 63 parametersString_[++compteur] = mixedTools::doubleToString(sigma_r_); 64 parametersString_[++compteur] = mixedTools::doubleToString(emit_x_); 65 parametersString_[++compteur] = mixedTools::doubleToString(emit_y_); 56 66 parametersString_[++compteur] = mixedTools::doubleToString(E_cin_); 57 67 parametersString_[++compteur] = mixedTools::doubleToString(sigma_E_); 58 parametersString_[++compteur] = mixedTools::doubleToString( nb_true_particles_);68 parametersString_[++compteur] = mixedTools::doubleToString(totalCharge_); 59 69 return parametersString_; 60 70 } … … 79 89 sigma_t_ = atof(param[++compteur].c_str()); 80 90 sigma_r_ = atof(param[++compteur].c_str()); 91 emit_x_ = atof(param[++compteur].c_str()); 92 emit_y_ = atof(param[++compteur].c_str()); 81 93 E_cin_ = atof(param[++compteur].c_str()); 82 94 sigma_E_ = atof(param[++compteur].c_str()); 83 nb_true_particles_ = atof(param[++compteur].c_str());95 totalCharge_ = atof(param[++compteur].c_str()); 84 96 85 97 } … … 94 106 sortie << " /dwt=" << phaseStep_ << " /ran=2" << endl; 95 107 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"; 97 112 98 113 return sortie.str(); 99 114 } 115 116 string 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 100 138 101 139 string elementRfgun::FileOutputFlow() const … … 107 145 sortie << label_ << endl; 108 146 sortie << nmacrop_ << " " << sigma_t_ << " " << sigma_r_ << endl; 147 sortie << emit_x_ << " " << emit_y_ << endl; 109 148 sortie << E_cin_ << " " << sigma_E_ << endl; 110 sortie << phaseStep_ << " " << nb_true_particles_ << endl;149 sortie << phaseStep_ << " " << totalCharge_ << endl; 111 150 return sortie.str(); 112 151 } … … 116 155 ifs >> label_; 117 156 ifs >> nmacrop_ >> sigma_t_ >> sigma_r_; 157 ifs >> emit_x_ >> emit_y_; 118 158 ifs >> E_cin_ >> sigma_E_; 119 ifs >> phaseStep_ >> nb_true_particles_;159 ifs >> phaseStep_ >> totalCharge_; 120 160 } 121 161 … … 125 165 126 166 txt += label_; 127 txt += "\n nr of macroparticles: ";128 txt += mixedTools::doubleToString( nb_true_particles_);167 txt += "\ntotal charge : "; 168 txt += mixedTools::doubleToString(totalCharge_); 129 169 txt += "\nsigma_t (ps) : "; 130 170 txt += mixedTools::doubleToString(sigma_t_); 131 171 txt += "\nsigma_r (cm) : "; 132 172 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_); 133 177 txt += "\ninitial kinetic energy (MeV) : "; 134 178 txt += mixedTools::doubleToString(E_cin_); -
Interface_Web/trunk/pspaWT/sources/controler/src/nomDeLogiciel.cc
r257 r304 6 6 if (s == "parmela" ) return parmela; 7 7 else if ( s == "transport" ) return transport; 8 else if ( s == "generator" ) return generator; 8 9 return unknownSoftware; 9 10 } … … 15 16 case parmela : { return "parmela"; } 16 17 case transport : { return "transport"; } 18 case generator : { return "generator"; } 17 19 case unknownSoftware : { return "unknownSoftware"; } 18 20 } … … 26 28 case 0 : { return parmela; } 27 29 case 1 : { return transport; } 30 case 2 : { return generator; } 28 31 } 29 32 return unknownSoftware; … … 36 39 case parmela : { return 0; } 37 40 case transport : { return 1; } 38 case unknownSoftware : { return 2; } 41 case generator : { return 2; } 42 case unknownSoftware : { return 3; } 39 43 } 40 44 return -1; -
Interface_Web/trunk/pspaWT/sources/controler/src/nomdElements.cc
r271 r304 63 63 switch(eType) { 64 64 case beam : return 8; 65 case RFgun : return 7;65 case RFgun : return 9; 66 66 case drift : return 3; 67 67 case cell : return 10; -
Interface_Web/trunk/pspaWT/sources/controler/src/softwareParmela.cc
r298 r304 16 16 } 17 17 18 bool softwareParmela::createInputFile( particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir)18 bool softwareParmela::createInputFile(string inputFileName, particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir) 19 19 { 20 20 unsigned int k; … … 30 30 31 31 ofstream outfile; 32 string name = workingDir + "parmin";32 string name = workingDir + inputFileName; 33 33 outfile.open(name.c_str(), ios::out); 34 34 if (!outfile) { … … 174 174 175 175 int testNombrePartRef =0; 176 double phaseRef ;176 double phaseRef = 0.0; 177 177 178 178 while( partic.readFromParmelaFile(filefais) > 0 ) { … … 193 193 testNombrePartRef++; 194 194 if ( testNombrePartRef != 1 ) { 195 cerr << " TROP DE PART. DE REF: " << testNombrePartRef << " !! " << endl;195 cerr << " nombre de part. de ref different de 1 : " << testNombrePartRef << " !! " << endl; 196 196 return false; 197 197 } -
Interface_Web/trunk/pspaWT/sources/controler/src/softwareTransport.cc
r298 r304 5 5 #include <algorithm> 6 6 7 8 7 softwareTransport::softwareTransport() : abstractSoftware() 9 8 { … … 17 16 18 17 19 bool softwareTransport::createInputFile( particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir)18 bool softwareTransport::createInputFile(string inputFileName, particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir) 20 19 { 21 20 unsigned int k; … … 39 38 40 39 ofstream outfile; 41 string name = workingDir + "transport.input";40 string name = workingDir + inputFileName; 42 41 outfile.open(name.c_str(), ios::out); 43 42 if (!outfile) -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_rfgun.h
r293 r304 18 18 WLineEdit* sigma_tEdit_; // picoseconds 19 19 WLineEdit* sigma_rEdit_; // cm 20 WLineEdit* emit_xEdit_; // pi.mm.mrad 21 WLineEdit* emit_yEdit_; // pi.mm.mrad 20 22 WLineEdit* E_cinEdit_; // MeV 21 23 WLineEdit* sigma_EEdit_; // MeV 22 WLineEdit* nb_true_particlesEdit_;24 WLineEdit* totalChargeEdit_; 23 25 24 26 -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_rfgun.cc
r294 r304 27 27 new WBreak(dialog_->contents()); 28 28 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 29 36 new WText("initial kinetic energy (MeV) : ",dialog_->contents()); 30 37 E_cinEdit_ = new WLineEdit( (++param)->c_str(), dialog_->contents()); … … 35 42 new WBreak(dialog_->contents()); 36 43 37 new WText("t rue 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()); 39 46 new WBreak(dialog_->contents()); 40 47 … … 57 64 envoi[++compteur] = sigma_tEdit_->text().toUTF8(); 58 65 envoi[++compteur] = sigma_rEdit_->text().toUTF8(); 66 67 envoi[++compteur] = emit_xEdit_->text().toUTF8(); 68 envoi[++compteur] = emit_yEdit_->text().toUTF8(); 69 59 70 envoi[++compteur] = E_cinEdit_->text().toUTF8(); 60 71 envoi[++compteur] = sigma_EEdit_->text().toUTF8(); 61 envoi[++compteur] = nb_true_particlesEdit_->text().toUTF8();72 envoi[++compteur] = totalChargeEdit_->text().toUTF8(); 62 73 if ( compteur != (int)nbParam ) { 63 74 cerr << " GWt_rfgun::dialogDone() pb nb de parametres, compteur = " << compteur << " nbParam= " << nbParam << endl; -
Interface_Web/trunk/pspaWT/workingArea/pspa.save
r229 r304 4 4 rfgun01 5 5 500 3.6 0.02 6 0 0 6 7 1e-06 1e-06 7 1 3.1211e+098 1 0.5 8 9 cell 9 10 cell01
Note: See TracChangeset
for help on using the changeset viewer.