Changeset 236 in PSPA
- Timestamp:
- Jan 17, 2013, 11:18:56 AM (12 years ago)
- Location:
- Interface_Web/trunk/pspaWT
- Files:
-
- 2 added
- 2 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/cmt/requirements
r226 r236 27 27 28 28 #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}"'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 beam2Moments.cc main.cc use_cppflags='" ${lib_PSPSLib_cppflags}"' 30 30 31 31 macro DrawWt_linkopts " ${PSPSLib_linkopts} ${Wt_linkopts} ${boost_linkopts} ${dld_linkopts}" -
Interface_Web/trunk/pspaWT/include/dataManager.h
r230 r236 10 10 #include "nomDeLogiciel.h" 11 11 #include "trivaluedBool.h" 12 #include "beam2Moments.h" 13 14 15 16 12 17 class dataManager 13 18 { … … 25 30 void removeFile(string nameOfFile); 26 31 void clearSectionToExecute(); 32 bool moments2FromTransport(string workingDir, string elLab, const nomdElements elem, beam2Moments& moments) const; 27 33 28 34 public: … … 56 62 bool restoreElements(string workingDir, string inputFileName); 57 63 void donneesRmsEnveloppe( string type, unsigned int numeroDeb, unsigned int numeroFin, vector<double>& xcor, vector<double>& ycor); 64 65 58 66 }; 59 67 #endif -
Interface_Web/trunk/pspaWT/include/particleBeam.h
r229 r236 12 12 #include "mathematicalTools.h" 13 13 #include "nomdElements.h" 14 #include " transportMoments.h"14 #include "beam2Moments.h" 15 15 16 16 using namespace std; … … 44 44 vector<bareParticle> goodPartic_; 45 45 46 transportMoments rij_;46 beam2Moments rij_; 47 47 48 // vector< vector<double> > rij_transportMoments_; 48 49 49 vector<double> centroid_; 50 50 double P0Transport_; 51 51 52 52 53 // void readTransportMoments(ifstream& inp); 54 void readTransportMoments(stringstream& inp); 53 55 54 56 55 void impressionDesMoments() const; … … 67 66 void buildMomentRepresentation(); 68 67 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 74 68 75 69 void clear(); … … 77 71 int getNbParticles() const; 78 72 79 const transportMoments& getTransportMoments() const;73 const beam2Moments& getTransportMoments() const; 80 74 double getSigmaTransportij(unsigned i, unsigned j); 81 75 double getUnnormalizedEmittanceX(); … … 97 91 void getVariance(double& varx, double& vary, double& varz) const; 98 92 93 void set2Moments(beam2Moments& moments); 99 94 100 95 void printAllXYZ() const; -
Interface_Web/trunk/pspaWT/src/dataManager.cc
r230 r236 1 1 #include "dataManager.h" 2 //#include "environmentVariables.h"3 #include "transportMoments.h"4 2 5 3 #include <stdio.h> … … 157 155 string elemLabel = getLabelFromElementNumero (k); 158 156 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() ) ) 160 163 { 161 164 sortie << " reading transport output failed " << endl; … … 163 166 break; 164 167 } 168 diagnosticBeam_.back().set2Moments(transpMoments); 165 169 } 166 170 if ( ExecuteStatus ) currentBeam_ = &diagnosticBeam_.back(); … … 300 304 // ici, en principe, on a un faisceau correct 301 305 // on ecrit sur le fichier input 302 const transportMoments& moments = currentBeam_->getTransportMoments();306 const beam2Moments& moments = currentBeam_->getTransportMoments(); 303 307 double P0 = currentBeam_->getP0Transport(); 304 308 outfile << moments.writeToTransportInput(P0); … … 544 548 } 545 549 } 550 551 bool 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 1 1 #include "elementBeam.h" 2 #include " transportMoments.h"2 #include "beam2Moments.h" 3 3 #include "mixedTools.h" 4 4 … … 87 87 string elementBeam::transportOutputFlow() const { 88 88 ostringstream sortie; 89 transportMoments moments(x_, xp_, y_, yp_, dl_, del_);89 beam2Moments moments(x_, xp_, y_, yp_, dl_, del_); 90 90 cout << " elementBeam::transportOutputFlow(), p0 = " << p0_ << endl; 91 91 sortie << label_ << ":" << moments.writeToTransportInput(p0_); -
Interface_Web/trunk/pspaWT/src/particleBeam.cc
r232 r236 35 35 } 36 36 37 const transportMoments& particleBeam::getTransportMoments() const {37 const beam2Moments& particleBeam::getTransportMoments() const { 38 38 return rij_; 39 39 } … … 73 73 return P0Transport_; 74 74 } 75 76 void particleBeam::set2Moments(beam2Moments& moments) { 77 rij_ = moments; 78 momentRepresentationOk_ = true; 79 } 80 81 82 75 83 bool particleBeam::particleRepresentationOk() const { 76 84 return particleRepresentationOk_; … … 140 148 // } 141 149 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 ca146 // 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 // } 200 208 201 209 … … 501 509 // } 502 510 503 void particleBeam::readTransportMoments(stringstream& inp) {504 rij_.readFromTransportOutput(inp);505 }511 // void particleBeam::readTransportMoments(stringstream& inp) { 512 // rij_.readFromTransportOutput(inp); 513 // } 506 514 507 515 double particleBeam::getXmaxRms() {
Note: See TracChangeset
for help on using the changeset viewer.