Changeset 442 in PSPA
- Timestamp:
- Dec 11, 2013, 9:33:35 AM (10 years ago)
- Location:
- Interface_Web/trunk/pspaWT
- Files:
-
- 2 added
- 17 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/cmt/requirements
r440 r442 36 36 ../sources/controler/src/softwareTransport.cc \ 37 37 ../sources/controler/src/softwareGenerator.cc \ 38 ../sources/controler/src/softwareUsersprogram.cc \ 38 39 ../sources/controler/src/sectionToExecute.cc \ 39 40 ../sources/controler/src/softwareTest.cc \ -
Interface_Web/trunk/pspaWT/sources/controler/include/elementSnapshot.h
r424 r442 10 10 { 11 11 int incr_; 12 string snapshotFile_; 12 string programFile_; 13 string inputBeamFile_; 14 string outputBeamFile_; 13 15 void setDefaultValues(); 14 16 void setDefaults(); -
Interface_Web/trunk/pspaWT/sources/controler/include/mathematicalTools.h
r257 r442 150 150 inline double getComponent(int index ) const {return vec_[index];} 151 151 152 inline double& component(int index ) {return vec_[index];} 153 152 154 inline void setComponent(int index, double value ) {vec_[index] = value;} 153 155 -
Interface_Web/trunk/pspaWT/sources/controler/include/nomDeLogiciel.h
r431 r442 13 13 enum Logiciel 14 14 { 15 parmela, transport, generator, useraction, test, madx, unknownSoftware15 parmela, transport, generator, test, madx, usersprogram, unknownSoftware 16 16 }; 17 17 -
Interface_Web/trunk/pspaWT/sources/controler/include/particleBeam.h
r417 r442 138 138 virtual string fileOutputFlow() const; 139 139 virtual bool FileInput(ifstream& ifs); 140 virtual void writeToAMLFile(string fileName); 141 virtual bool readFromAMLFile(string fileName); 140 142 141 143 void histogramme(unsigned int index,vector<double>&xcor,vector<int>& hist,vector<string>& legende); -
Interface_Web/trunk/pspaWT/sources/controler/src/abstractSoftware.cc
r431 r442 2 2 #include "dataManager.h" 3 3 #include <algorithm> 4 #include <iostream> 5 4 6 5 7 abstractSoftware::abstractSoftware() … … 52 54 void abstractSoftware::registerElement(nomdElements::typedElement nomdel,trivaluedBool b) 53 55 { 56 // std::cout << " abstractSoftware::registerElement soft : " << nameOfSoftware_.getString() << std::endl; 54 57 if (b == TBoolIgnore) { 58 // std::cout << " abstractSoftware::registerElement j'enregistre element " << nomdel << " ignore " << std::endl; 55 59 ignoredElements_.push_back(nomdel); 56 60 } else if (b == TBoolOk) { 61 // std::cout << " abstractSoftware::registerElement j'enregistre element " << nomdel << " OK " << std::endl; 57 62 acceptedElements_.push_back(nomdel); 58 63 } -
Interface_Web/trunk/pspaWT/sources/controler/src/bareParticle.cc
r312 r442 119 119 120 120 121 122 121 bool bareParticle::FileInput( ifstream& ifs) 123 122 { -
Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc
r436 r442 12 12 #include "softwareTransport.h" 13 13 #include "softwareGenerator.h" 14 #include "softwareGenerator.h" 15 #include "softwareUsersprogram.h" 14 16 #include "softwareTest.h" 15 17 #include "softwareMadx.h" //xx … … 89 91 inputFileName = "generator.in"; 90 92 prog = new softwareGenerator(inputFileName, &globParam_, this); 91 } else if (logiciel == nomDeLogiciel::test) {92 prog = new softwareTest(inputFileName, &globParam_, this);93 93 } else if (logiciel == nomDeLogiciel::madx) { 94 94 inputFileName = "madx.input"; 95 95 prog = new softwareMadx(inputFileName,§orParam_,this); 96 } else if (logiciel == nomDeLogiciel::usersprogram) { 97 inputFileName = "dummy"; 98 prog = new softwareUsersprogram(inputFileName, &globParam_, this); 99 } else if (logiciel == nomDeLogiciel::test) { 100 prog = new softwareTest(inputFileName, &globParam_, this); 96 101 } else { 97 102 prog = new softwareUnknown(); // xx … … 230 235 231 236 } //k 232 237 // if ( currentBeam_ ) { 238 // string aml_file = workingDir + "/" + "faisceau_final" + ".aml"; 239 // currentBeam_->writeToAMLFile(aml_file); 240 // // TESTS 241 // currentBeam_->readFromAMLFile(aml_file); 242 // } 233 243 cout << " dataManager::executeAll() : premier element = " << firstComputedElemNumero_ << " dernier = " << lastComputedElemNumero_ << endl; 234 244 -
Interface_Web/trunk/pspaWT/sources/controler/src/elementDrift.cc
r431 r442 13 13 nbParam_ = elementName_.getElementNbParameters(); 14 14 parametersString_ = new string[nbParam_+1]; 15 // registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk);16 // registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk);17 // registerAcceptableSoftware(nomDeLogiciel::test, TBoolOk);18 15 } 19 16 -
Interface_Web/trunk/pspaWT/sources/controler/src/elementSnapshot.cc
r424 r442 13 13 nbParam_ = elementName_.getElementNbParameters(); 14 14 parametersString_ = new string[nbParam_+1]; 15 // registerAcceptableSoftware(nomDeLogiciel::transport, TBoolIgnore);16 // registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolIgnore);17 // registerAcceptableSoftware(nomDeLogiciel::generator, TBoolIgnore);18 // registerAcceptableSoftware(nomDeLogiciel::useraction,19 // TBoolOk);20 // registerAcceptableSoftware(nomDeLogiciel::test, TBoolIgnore);21 15 } 22 16 … … 30 24 specificName_ = defaultSpecificName_; 31 25 32 if(incr_ < 10) {33 snapshotFile_= string("cliche")+string(".00")+mixedTools::intToString(incr_);34 } else if(incr_ >= 10 && incr_ < 100) {35 snapshotFile_= string("cliche")+string(".0")+mixedTools::intToString(incr_);36 } else {37 snapshotFile_= string("cliche")+string(".")+mixedTools::intToString(incr_);38 }26 // if(incr_ < 10) { 27 // snapshotFile_= string("cliche")+string(".00")+mixedTools::intToString(incr_); 28 // } else if(incr_ >= 10 && incr_ < 100) { 29 // snapshotFile_= string("cliche")+string(".0")+mixedTools::intToString(incr_); 30 // } else { 31 // snapshotFile_= string("cliche")+string(".")+mixedTools::intToString(incr_); 32 // } 39 33 } 40 34 … … 44 38 parametersString_[++compteur] = mixedTools::intToString(nbParam_); 45 39 parametersString_[++compteur] = specificName_; 46 parametersString_[++compteur] = snapshotFile_; 40 parametersString_[++compteur] = programFile_; 41 parametersString_[++compteur] = inputBeamFile_; 42 parametersString_[++compteur] = outputBeamFile_; 47 43 48 44 if ( compteur != nbParam_ ) { … … 64 60 int nbparam = atoi(param[++compteur].c_str()); 65 61 if ( nbparam != nbParam_ ) { 66 cerr << " elementSnaphot:: setParametersString parameters do not match for a DRIFT";62 cerr << " elementSnaphot:: setParametersString parameters do not match for a SNAPSHOT"; 67 63 return; 68 64 } 69 65 70 66 specificName_ = param[++compteur]; 67 programFile_ = param[++compteur]; 68 inputBeamFile_ = param[++compteur]; 69 outputBeamFile_ = param[++compteur]; 71 70 } 72 71 … … 88 87 sortie << elementName_.getGenericLabel() << endl; 89 88 sortie << specificName_ << endl; 90 sortie << snapshotFile_ << endl; 89 sortie << programFile_ << endl; 90 sortie << inputBeamFile_ << endl; 91 sortie << outputBeamFile_ << endl; 91 92 return sortie.str(); 92 93 } … … 97 98 sortie.back().second.push_back(elementName_.getGenericLabel()); 98 99 sortie.back().second.push_back(specificName_); 99 sortie.push_back( pair<string, vector<string> >("snapshotFile", vector<string>() ) ); 100 sortie.back().second.push_back(snapshotFile_); 100 sortie.push_back( pair<string, vector<string> >("nameOfFiles", vector<string>() ) ); 101 sortie.back().second.push_back(programFile_); 102 sortie.back().second.push_back(inputBeamFile_); 103 sortie.back().second.push_back(outputBeamFile_); 101 104 return sortie; 102 105 } … … 105 108 { 106 109 ifs >> specificName_; 107 ifs >> snapshotFile_; 110 ifs >> programFile_; 111 ifs >> inputBeamFile_; 112 ifs >> outputBeamFile_;; 108 113 } 109 114 … … 112 117 string txt = ""; 113 118 txt += specificName_; 114 txt += "\nname of file for snapshot : "; 115 txt += snapshotFile_; 119 txt += "\nname of file for user's program : "; 120 txt += programFile_; 121 txt += "\nname of input beam file for user's program : "; 122 txt += inputBeamFile_; 123 txt += "\nname of output beam file for user's program : "; 124 txt += outputBeamFile_; 116 125 return txt; 117 126 } … … 121 130 UAPNode* node= root->addChild("snapshot"); 122 131 node->addAttribute("name",specificName_); 132 133 UAPNode* fichiers = node->addChild("names_of_files"); 134 fichiers->addAttribute("program",programFile_); 135 fichiers->addAttribute("inputf",inputBeamFile_); 136 fichiers->addAttribute("outputf",outputBeamFile_); 123 137 } -
Interface_Web/trunk/pspaWT/sources/controler/src/nomDeLogiciel.cc
r431 r442 6 6 else if ( s == "transport" ) return transport; 7 7 else if ( s == "generator" ) return generator; 8 else if ( s == "useraction" ) return useraction;9 8 else if ( s == "test" ) return test; 10 9 else if ( s == "madx" ) return madx; 10 else if ( s == "usersprogram" ) return usersprogram; 11 11 return unknownSoftware; 12 12 } … … 19 19 case transport : { return "transport"; } 20 20 case generator : { return "generator"; } 21 case useraction : { return "useraction"; }22 21 case test : { return "test"; } 23 22 case madx : { return "madx"; } 23 case usersprogram : { return "usersprogram"; } 24 24 case unknownSoftware : { return "unknownSoftware"; } 25 25 } … … 37 37 case transport : { return "#c0ea8e"; } 38 38 case generator : { return "#a3c0ed"; } 39 case useraction : { return "#FFFFFF"; }40 39 case test : { return "#ecc38e"; } 41 40 case madx : { return "#ecc38e"; } //{ return "#FFFF00"; } -
Interface_Web/trunk/pspaWT/sources/controler/src/nomdElements.cc
r431 r442 74 74 case soleno : return 5; 75 75 case fit : return 4; 76 case snapshot : return 2;76 case snapshot : return 4; 77 77 case mpole : return 3; 78 78 default : return 0; -
Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc
r435 r442 5 5 #include "mathematicalTools.h" 6 6 #include "mixedTools.h" 7 8 #include "UAP/UAPUtilities.hpp" 9 #include "AML/AMLReader.hpp" 7 10 8 11 #include <stdio.h> … … 203 206 sortie << endl; 204 207 return sortie.str(); 208 } 209 210 211 void particleBeam::writeToAMLFile(string fileName) { 212 UAPNode* uap_root = new UAPNode("UAP_root"); 213 UAPNode* rep = uap_root->addChild("AML_representation"); 214 215 // root node in the hierarchy 216 UAPNode* lab = rep->addChild("laboratory"); 217 lab->addAttribute("name","PSPA lab"); 218 219 220 221 // root node in the hierarchy 222 UAPNode* par = lab->addChild("particles"); 223 par->addAttribute("name","PSPA particles"); 224 225 unsigned int k; 226 if ( particleRepresentationOk_ ) { 227 for ( k = 0 ; k < relativePartic_.size(); k++) 228 { 229 TRIDVECTOR& position = relativePartic_.at(k).getReferenceToPosition(); 230 TRIDVECTOR& betgam = relativePartic_.at(k).getReferenceToBetaGamma(); 231 UAPNode* partic = par->addChild("particle"); 232 string txt; 233 txt = mixedTools::doubleToString(position.getComponent(0)); 234 partic->addAttribute("x",txt); 235 txt = mixedTools::doubleToString(position.getComponent(1)); 236 partic->addAttribute("y",txt); 237 txt = mixedTools::doubleToString(position.getComponent(2)); 238 partic->addAttribute("cdeltat",txt); 239 txt = mixedTools::doubleToString(betgam.getComponent(0)); 240 partic->addAttribute("betagamma_x",txt); 241 txt = mixedTools::doubleToString(betgam.getComponent(1)); 242 partic->addAttribute("betagamma_y",txt); 243 txt = mixedTools::doubleToString(betgam.getComponent(2)); 244 partic->addAttribute("betagamma_z",txt); 245 } 246 247 } else { 248 cout << " particleBeam::writeToAMLFile : representation 'particules' indisponible" << endl; 249 } 250 251 cout << "!Create the AML particle file ---------------------------" << endl; 252 AMLReader reader; 253 reader.AMLRepToAMLFile (uap_root, fileName); 254 255 } 256 257 bool particleBeam::readFromAMLFile(string fileName) { 258 259 cout << "!read the AML particle file ---------------------------" << endl; 260 AMLReader reader; 261 UAPNode* uap_root = NULL; 262 uap_root = reader.AMLFileToAMLRep (fileName); 263 if ( !uap_root ) { 264 cout << " particleBeam::readFromAMLFile ERREUR lecture fichier particules " << endl; 265 return false; 266 } 267 268 269 NodeVec lesParticules = uap_root->getSubNodesByName(string("particles")); 270 271 NodeVec& listPart = (*lesParticules.begin())->getChildren(); 272 273 if ( !listPart.size() ) { 274 cout << " particleBeam::readFromAMLFile ERREUR lecture fichier : pas de particules ? " << endl; 275 return false; 276 } 277 278 vector<bareParticle> vecteurParticules; 279 bareParticle reference; 280 for (NodeVecIter iter = listPart.begin(); iter != listPart.end(); iter++) { 281 TRIDVECTOR position, betagamma; 282 UAPAttribute* att = NULL; 283 att = (*iter)->getAttribute("x"); 284 if ( att ) att->getDouble(position.component(0)); 285 att = (*iter)->getAttribute("y"); 286 if ( att ) att->getDouble(position.component(1)); 287 att = (*iter)->getAttribute("cdeltat"); 288 if ( att ) att->getDouble(position.component(2)); 289 290 att = (*iter)->getAttribute("betagamma_x"); 291 if ( att ) att->getDouble(betagamma.component(0)); 292 att = (*iter)->getAttribute("betagamma_y"); 293 if ( att ) att->getDouble(betagamma.component(1)); 294 att = (*iter)->getAttribute("betagamma_z"); 295 if ( att ) att->getDouble(betagamma.component(2)); 296 297 if ( fabs(position.component(0)) < PETIT && fabs(position.component(1)) < PETIT && fabs(position.component(2)) < PETIT ) { 298 reference = bareParticle(position, betagamma); 299 } 300 vecteurParticules.push_back(bareParticle(position, betagamma)); 301 } 302 vector<double> centroid(6,0.0); 303 setWithParticles(centroid, reference, vecteurParticules); 304 return true; 205 305 } 206 306 -
Interface_Web/trunk/pspaWT/sources/controler/src/softwareGenerator.cc
r434 r442 14 14 softwareGenerator::softwareGenerator(string inputFileName, globalParameters* globals, dataManager* dt) : abstractSoftware(inputFileName, globals, dt) 15 15 { 16 cout << " softwareUsersprogram::softwareGenerator ENREGISTREMENT " << endl; 16 17 nameOfSoftware_ = nomDeLogiciel("generator"); 17 18 registerElement(nomdElements::RFgun,TBoolOk); -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementSnapshot.h
r437 r442 14 14 class GWt_elementSnapshot : public GWt_abstractElement 15 15 { 16 WLineEdit* snapshotFile_; 17 16 WLineEdit* programFile_; 17 WLineEdit* inputBeamFile_; 18 WLineEdit* outputBeamFile_; 19 18 20 public: 19 21 -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementSnapshot.cc
r437 r442 19 19 string* param = beginDialog(); 20 20 21 new WText("name of file for snapshot : ",dialog_->contents()); 22 snapshotFile_ = new WLineEdit(param->c_str(),dialog_->contents()); 21 new WText("name of user's program : ",dialog_->contents()); 22 programFile_ = new WLineEdit(param->c_str(),dialog_->contents()); 23 new WBreak(dialog_->contents()); 24 25 26 new WText("name of input beam file, output from pspa : ",dialog_->contents()); 27 inputBeamFile_ = new WLineEdit( (++param)->c_str(),dialog_->contents()); 28 new WBreak(dialog_->contents()); 29 30 new WText("name of output beam file (input for pspa) : ",dialog_->contents()); 31 outputBeamFile_ = new WLineEdit( (++param)->c_str(),dialog_->contents()); 23 32 new WBreak(dialog_->contents()); 24 33 … … 40 49 envoi[++compteur] = mixedTools::intToString(nbParam); 41 50 envoi[++compteur] = labelEdit_->text().toUTF8(); 42 envoi[++compteur] = snapshotFile_->text().toUTF8(); 51 envoi[++compteur] = programFile_->text().toUTF8(); 52 envoi[++compteur] = inputBeamFile_->text().toUTF8(); 53 envoi[++compteur] = outputBeamFile_->text().toUTF8(); 54 55 43 56 if ( compteur != (int)nbParam ) { 44 57 cerr << " GWt_elementSnapshot::dialogDone() : pb dans le nb de parametres, compteur = " << compteur << " nbParam= " << nbParam << endl; -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_snapshot.cc
r434 r442 19 19 string* param = beginDialog(); 20 20 21 new WText("name of file for snapshot : ",dialog_->contents()); 22 snapshotFile_ = new WLineEdit(param->c_str(),dialog_->contents()); 21 new WText("name of user's program : ",dialog_->contents()); 22 programFile_ = new WLineEdit(param->c_str(),dialog_->contents()); 23 new WBreak(dialog_->contents()); 24 25 26 new WText("name of input beam file, output from pspa : ",dialog_->contents()); 27 inputBeamFile_ = new WLineEdit( (++param)->c_str(),dialog_->contents()); 28 new WBreak(dialog_->contents()); 29 30 new WText("name of output beam file (input for pspa) : ",dialog_->contents()); 31 outputBeamFile_ = new WLineEdit( (++param)->c_str(),dialog_->contents()); 23 32 new WBreak(dialog_->contents()); 24 33 … … 40 49 envoi[++compteur] = mixedTools::intToString(nbParam); 41 50 envoi[++compteur] = labelEdit_->text().toUTF8(); 42 envoi[++compteur] = snapshotFile_->text().toUTF8(); 51 envoi[++compteur] = programFile_->text().toUTF8(); 52 53 envoi[++compteur] = inputBeamFile_->text().toUTF8(); 54 envoi[++compteur] = outputBeamFile_->text().toUTF8(); 55 56 43 57 if ( compteur != (int)nbParam ) { 44 58 cerr << " GWt_snapshot::dialogDone() : pb dans le nb de parametres, compteur = " << compteur << " nbParam= " << nbParam << endl; -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc
r436 r442 279 279 280 280 trivaluedBool tb = softToExec->doAcceptElement(elPtr->getNomdElement().getElementType()); 281 cout << " GWt_softwarePanel::areDataCoherent() el " << elPtr->getLabel() << " tb= " << tb << endl; 281 282 if (tb == TBoolOk ) { 282 283 elPtr->setSoftware(softToExec);
Note: See TracChangeset
for help on using the changeset viewer.