Changeset 488 in PSPA
- Timestamp:
- Feb 7, 2014, 2:00:55 PM (10 years ago)
- Location:
- Interface_Web/trunk/pspaWT
- Files:
-
- 2 added
- 2 deleted
- 34 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/History
r485 r488 5 5 PSPA - Plateforme de simulation en physique des accélérateurs 6 6 ========================================================= 7 8 7 février 2014 : Guy Le Meur 9 - implémentation de la lecture du fichier de sauvegarde AML. 10 7 11 8 12 28 janvier 2014 : Guy Le Meur -
Interface_Web/trunk/pspaWT/cmt/requirements
r467 r488 27 27 ../sources/controler/src/elementSnapshot.cc \ 28 28 ../sources/controler/src/elementMultipole.cc \ 29 ../sources/controler/src/elementQuadrupole.cc \ 30 ../sources/controler/src/elementSextupole.cc \ 29 31 ../sources/controler/src/globalParameters.cc \ 30 32 ../sources/controler/src/abstractElement.cc \ … … 55 57 ../sources/userInterface/src/GWt_elementSnapshot.cc \ 56 58 ../sources/userInterface/src/GWt_elementMpole.cc \ 59 ../sources/userInterface/src/GWt_elementQpole.cc \ 60 ../sources/userInterface/src/GWt_elementSpole.cc \ 57 61 ../sources/userInterface/src/GWt_abstractElement.cc \ 58 62 ../sources/userInterface/src/GWt_console.cc \ -
Interface_Web/trunk/pspaWT/sources/controler/include/abstractElement.h
r469 r488 10 10 11 11 #include "UAP/UAPNode.hpp" 12 #include "AMLtools.h" 13 12 14 using namespace std; 13 15 … … 34 36 void setDefaultValues(); 35 37 void setDefaults(); 36 38 39 40 inline UAPNode* setAMLelementHeader(UAPNode* elementNode) { 41 UAPNode* ele = elementNode->addChild("element"); 42 ele->addAttribute("name",specificName_); 43 UAPNode* node = ele->addChild("description"); 44 node->addAttribute("type",elementName_.getGenericLabel()); 45 return ele; 46 } 47 48 inline bool checkAMLelementGenericName(UAPNode* entree) { 49 if ( !entree ) return false; 50 string nonGenerique; 51 AMLtools::readAMLParameterAttribut(entree, "description", "type", nonGenerique); 52 if ( nonGenerique != elementName_.getGenericLabel() ) { 53 cout << " abstractElement::checkAMLelementGenericName ERREUR d'element : " << nonGenerique << " ? attendu : " << elementName_.getGenericLabel() << endl; 54 return false; 55 } 56 specificName_ = entree->getAttribute("name")->getValue(); 57 return true; 58 } 59 37 60 public : 38 61 … … 56 79 virtual void setParametersString(string* param) = 0; 57 80 virtual string* getParametersString() const = 0; 58 virtual string FileOutputFlow() const = 0;81 // virtual string FileOutputFlow() const = 0; 59 82 virtual vector< pair<string, vector<string> > > parametersToSoftware () const =0; 60 virtual void FileInput(ifstream& ifs) = 0;83 // virtual void FileInput(ifstream& ifs) = 0; 61 84 virtual string print() = 0; 62 85 virtual void InputRep(UAPNode* root) = 0; 86 virtual void FileAMLInput(UAPNode* entree) = 0; 63 87 64 88 }; -
Interface_Web/trunk/pspaWT/sources/controler/include/dataManager.h
r481 r488 54 54 @param filename 55 55 */ 56 void saveConfiguration(string folder, string filename); 57 bool restoreElements(string inputFileName); 58 56 // void saveConfiguration(string folder, string filename); 57 // bool restoreElements(string inputFileName); 58 bool restoreAMLElements(string inputFileName); 59 59 60 void writeToAMLFile(string fileName); 60 61 -
Interface_Web/trunk/pspaWT/sources/controler/include/elementBeam.h
r424 r488 35 35 // virtual string transportOutputFlow() const; 36 36 37 virtual string FileOutputFlow() const;38 virtual void FileInput(ifstream& ifs);37 // virtual string FileOutputFlow() const; 38 // virtual void FileInput(ifstream& ifs); 39 39 virtual void InputRep(UAPNode* root); 40 virtual void FileAMLInput(UAPNode* entree); 40 41 41 42 /** return a string with all parameters and value */ -
Interface_Web/trunk/pspaWT/sources/controler/include/elementBend.h
r424 r488 7 7 #include "mathematicalTools.h" 8 8 //#include "PhysicalConstants.h" 9 9 10 10 11 using namespace std; … … 42 43 // virtual string transportOutputFlow() const; 43 44 44 virtual string FileOutputFlow() const; 45 virtual void FileInput(ifstream& ifs); 45 // virtual string FileOutputFlow() const; 46 // virtual void FileInput(ifstream& ifs); 47 46 48 virtual void InputRep(UAPNode* root); 49 virtual void FileAMLInput(UAPNode* entree); 47 50 48 51 /** return a string with all parameters and value */ -
Interface_Web/trunk/pspaWT/sources/controler/include/elementCell.h
r424 r488 5 5 #include <iostream> 6 6 #include <sstream> 7 7 8 8 9 #include "abstractElement.h" … … 42 43 // virtual string transportOutputFlow() const */ 43 44 44 virtual string FileOutputFlow() const;45 virtual void FileInput(ifstream& ifs);45 // virtual string FileOutputFlow() const; 46 // virtual void FileInput(ifstream& ifs); 46 47 virtual void InputRep(UAPNode* root); 48 virtual void FileAMLInput(UAPNode* entree); 47 49 48 50 /** return a string with all parameters and value */ -
Interface_Web/trunk/pspaWT/sources/controler/include/elementDrift.h
r424 r488 24 24 // virtual string transportOutputFlow() const; 25 25 26 virtual string FileOutputFlow() const; 27 virtual void FileInput(ifstream& ifs); 28 virtual void InputRep(UAPNode* root); 26 // virtual string FileOutputFlow() const; 27 // virtual void FileInput(ifstream& ifs); 28 virtual void InputRep(UAPNode* root); 29 virtual void FileAMLInput(UAPNode* entree); 29 30 30 31 /** return a string with all parameters and value */ -
Interface_Web/trunk/pspaWT/sources/controler/include/elementFit.h
r424 r488 30 30 // virtual string transportOutputFlow() const; 31 31 32 virtual string FileOutputFlow() const;33 virtual void FileInput(ifstream& ifs);32 // virtual string FileOutputFlow() const; 33 // virtual void FileInput(ifstream& ifs); 34 34 virtual void InputRep(UAPNode* root); 35 virtual void FileAMLInput(UAPNode* entree); 35 36 36 37 /** return a string with all parameters and value */ -
Interface_Web/trunk/pspaWT/sources/controler/include/elementMultipole.h
r431 r488 20 20 virtual void setParametersString(string* param); 21 21 virtual vector< pair<string, vector<string> > > parametersToSoftware () const; 22 virtual string FileOutputFlow() const;23 virtual void FileInput(ifstream& ifs);22 // virtual string FileOutputFlow() const; 23 // virtual void FileInput(ifstream& ifs); 24 24 virtual void InputRep(UAPNode* root); 25 virtual void FileAMLInput(UAPNode* entree); 25 26 26 27 /** return a string with all parameters and value */ -
Interface_Web/trunk/pspaWT/sources/controler/include/elementQuadrupole.h
r487 r488 9 9 class elementQuadrupole : public abstractElement 10 10 { 11 double length_;11 // double length_; 12 12 double component_; 13 13 … … 20 20 virtual void setParametersString(string* param); 21 21 virtual vector< pair<string, vector<string> > > parametersToSoftware () const; 22 virtual string FileOutputFlow() const;23 virtual void FileInput(ifstream& ifs);22 // virtual string FileOutputFlow() const; 23 // virtual void FileInput(ifstream& ifs); 24 24 virtual void InputRep(UAPNode* root); 25 virtual void FileAMLInput(UAPNode* entree); 25 26 26 27 /** return a string with all parameters and value */ -
Interface_Web/trunk/pspaWT/sources/controler/include/elementRfgun.h
r424 r488 51 51 // virtual string generatorOutputFlow() const; 52 52 53 virtual string FileOutputFlow() const;54 virtual void FileInput(ifstream& ifs);53 // virtual string FileOutputFlow() const; 54 // virtual void FileInput(ifstream& ifs); 55 55 virtual void InputRep(UAPNode* root); 56 virtual void FileAMLInput(UAPNode* entree); 56 57 57 58 /** return a string with all parameters and value */ -
Interface_Web/trunk/pspaWT/sources/controler/include/elementSextupole.h
r487 r488 9 9 class elementSextupole : public abstractElement 10 10 { 11 double length_;11 // double length_; 12 12 double component_; 13 13 … … 20 20 virtual void setParametersString(string* param); 21 21 virtual vector< pair<string, vector<string> > > parametersToSoftware () const; 22 virtual string FileOutputFlow() const;23 virtual void FileInput(ifstream& ifs);22 // virtual string FileOutputFlow() const; 23 // virtual void FileInput(ifstream& ifs); 24 24 virtual void InputRep(UAPNode* root); 25 virtual void FileAMLInput(UAPNode* entree); 25 26 26 27 /** return a string with all parameters and value */ -
Interface_Web/trunk/pspaWT/sources/controler/include/elementSnapshot.h
r442 r488 25 25 virtual void setParametersString(string* param); 26 26 virtual vector< pair<string, vector<string> > > parametersToSoftware () const; 27 // virtual string parmelaOutputFlow() const;28 // virtual string transportOutputFlow() const;29 27 30 virtual string FileOutputFlow() const;31 virtual void FileInput(ifstream& ifs);28 // virtual string FileOutputFlow() const; 29 // virtual void FileInput(ifstream& ifs); 32 30 virtual void InputRep(UAPNode* root); 31 virtual void FileAMLInput(UAPNode* entree); 33 32 string print(); 34 33 }; -
Interface_Web/trunk/pspaWT/sources/controler/include/elementSoleno.h
r424 r488 27 27 virtual string* getParametersString() const; 28 28 virtual vector< pair<string, vector<string> > > parametersToSoftware () const; 29 // virtual string parmelaOutputFlow() const;30 // virtual string transportOutputFlow() const;31 29 32 virtual string FileOutputFlow() const;33 virtual void FileInput(ifstream& ifs);30 // virtual string FileOutputFlow() const; 31 // virtual void FileInput(ifstream& ifs); 34 32 virtual void InputRep(UAPNode* root); 33 virtual void FileAMLInput(UAPNode* entree); 35 34 36 35 /** return a string with all parameters and value */ -
Interface_Web/trunk/pspaWT/sources/controler/include/globalParameters.h
r424 r488 41 41 } 42 42 43 /* inline bool readAMLParameterAttribut(UAPNode* parametersNode, string parameterName, string attributName, double& resultat) { */ 44 /* if ( !parametersNode ) return false; */ 45 /* UAPNode* parametre = parametersNode->getChildByName(parameterName); */ 46 /* if ( !parametre ) return false; */ 47 /* UAPAttribute* att = parametre->getAttribute(attributName); */ 48 /* if ( att ) { */ 49 /* att->getDouble( resultat); */ 50 /* return true; */ 51 /* } else return false; */ 52 /* } */ 53 54 /* inline bool readAMLParameterAttribut(UAPNode* parametersNode, string parameterName, string attributName, int& resultat) { */ 55 /* if ( !parametersNode ) return false; */ 56 /* UAPNode* parametre = parametersNode->getChildByName(parameterName); */ 57 /* if ( !parametre ) return false; */ 58 /* UAPAttribute* att = parametre->getAttribute(attributName); */ 59 /* if ( att ) { */ 60 /* att->getInt( resultat); */ 61 /* return true; */ 62 /* } else return false; */ 63 /* } */ 64 43 65 public: 44 66 … … 56 78 string* getParametersString() const; 57 79 void setParametersString(string* param); 58 string FileOutputFlow() const; 59 void FileInput(ifstream& ifs); 80 // string FileOutputFlow() const; 81 // void FileInput(ifstream& ifs); 82 void FileAMLInput( UAPNode* entree); 60 83 61 84 void InputRep(UAPNode* root); -
Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc
r485 r488 14 14 #include "UAP/UAPUtilities.hpp" 15 15 #include "AML/AMLReader.hpp" 16 #include "AMLtools.h" 16 17 17 18 #define BAVARD 0 … … 139 140 } 140 141 141 void dataManager::saveConfiguration(string folder, string nameOfFile)142 {143 ofstream outfile;144 //string name = pspa_->getWorkingDir()+ folder + "/" + nameOfFile + ".save";145 cout << " dataManager::saveConfiguration : suppression du folder dans le nom de " << endl;146 cout << " sauvegarde, en attendant que ce soit autre chose que le sessionId" << endl;147 cout << " et qu'on puisse restaurer normalement" << endl;148 149 string name = pspa_->getWorkingDir() + "/" + nameOfFile + ".save";150 // make dir if not exist151 boost::filesystem::create_directories(pspa_->getWorkingDir() + folder + "/");152 153 outfile.open(name.c_str(), ios::out);154 if (!outfile) {155 cerr<<" ERROR opening output file for persistency "<<name<<endl;156 }157 158 outfile << globParam_.FileOutputFlow();159 160 // FIXME Francois: Comment sauver la configuration des section ?161 for (unsigned int a=0; a< jobList_.size(); a++) {162 outfile << jobList_[a]->getSectorParameters().FileOutputFlow();163 }164 // END165 166 abstractElement* elPtr;167 for (unsigned k = 0; k < jobList_.size(); k++) {168 sector* sector = jobList_[k];169 for (unsigned l = 0; l < sector->getSectionsToExecute().size(); l++) {170 sectionToExecute* section = sector->getSectionsToExecute()[l];171 for (unsigned m = 0; m < section->getElements().size(); m++) {172 elPtr = section->getElements()[m];173 outfile << elPtr->FileOutputFlow();174 }175 }176 }177 outfile.close();178 }142 // void dataManager::saveConfiguration(string folder, string nameOfFile) 143 // { 144 // ofstream outfile; 145 // //string name = pspa_->getWorkingDir()+ folder + "/" + nameOfFile + ".save"; 146 // cout << " dataManager::saveConfiguration : suppression du folder dans le nom de " << endl; 147 // cout << " sauvegarde, en attendant que ce soit autre chose que le sessionId" << endl; 148 // cout << " et qu'on puisse restaurer normalement" << endl; 149 150 // string name = pspa_->getWorkingDir() + "/" + nameOfFile + ".save"; 151 // // make dir if not exist 152 // boost::filesystem::create_directories(pspa_->getWorkingDir() + folder + "/"); 153 154 // outfile.open(name.c_str(), ios::out); 155 // if (!outfile) { 156 // cerr<<" ERROR opening output file for persistency "<<name<<endl; 157 // } 158 159 // outfile << globParam_.FileOutputFlow(); 160 161 // // FIXME Francois: Comment sauver la configuration des section ? 162 // for (unsigned int a=0; a< jobList_.size(); a++) { 163 // outfile << jobList_[a]->getSectorParameters().FileOutputFlow(); 164 // } 165 // // END 166 167 // abstractElement* elPtr; 168 // for (unsigned k = 0; k < jobList_.size(); k++) { 169 // sector* sector = jobList_[k]; 170 // for (unsigned l = 0; l < sector->getSectionsToExecute().size(); l++) { 171 // sectionToExecute* section = sector->getSectionsToExecute()[l]; 172 // for (unsigned m = 0; m < section->getElements().size(); m++) { 173 // elPtr = section->getElements()[m]; 174 // outfile << elPtr->FileOutputFlow(); 175 // } 176 // } 177 // } 178 // outfile.close(); 179 // } 179 180 180 181 // ecriture sur fichier AML … … 219 220 } 220 221 221 bool dataManager::restoreElements(string inputFileName) 222 // bool dataManager::restoreElements(string inputFileName) 223 // { 224 // cout << "***********************************" << endl; 225 // cout << " dataManager::restoreElements() fichier :" << inputFileName << endl << endl; 226 227 // ifstream infile; 228 // string name = inputFileName; 229 // infile.open(name.c_str(), ios::in); 230 // if (!infile) { 231 // cerr << " error opening input stream " << name << endl; 232 // return false; 233 // } 234 // else cout << " successful opening input stream : " << name << endl; 235 236 // //NOTE:: je ne sais pas si les "secteurs" seront conservés, aussi pour ne pas trop changer les fichiers je lis les données aprÚs "globals" dans la boucle 237 238 // // Clear the BeamLine 239 // jobList_.clear(); 240 241 // // FIXME : For test purpose !!! 242 // sector* mySect = addNewSector(); 243 244 // nomdElements::typedElement elementType; 245 // string elementLabel; 246 // abstractElement* nouveau = NULL; 247 // while (infile >> elementLabel) { 248 // if (elementLabel == string("globals") ) { 249 // globParam_.raz(); 250 // globParam_.FileInput(infile); 251 // } else if (elementLabel == string("sectors") ) { 252 // // FIXME Francois !!!!!!! 253 // // sectorParam_.raz(); 254 // // sectorParam_.FileInput(infile); 255 // // END 256 // } else { 257 // elementType = nomdElements::getTypeFromLabel(elementLabel); 258 // nouveau = mySect->addElementAfter(elementType,nouveau); 259 // if ( nouveau == NULL ) { 260 // cerr << " dataManager::restoreElements() : restore element " << elementLabel << " failed " << endl; 261 // return false; 262 // } else { 263 // nouveau->FileInput(infile); 264 // } 265 // } 266 // }// while 267 268 // #if BAVARD > 1 269 // /* unsigned k; 270 // for(k = 0; k < getBeamLineSize(); k++) { 271 // abstractElement* ptr = pspa_->getBeamLine_deprecated()->getAbstractElement(k); 272 // cout << "recupere " << ptr->getLabel() << endl; 273 // } 274 // */ 275 // #endif 276 277 // infile.close(); 278 // return true; 279 // } 280 281 bool dataManager::restoreAMLElements(string inputFileName) 222 282 { 223 283 cout << "***********************************" << endl; 224 cout << " dataManager::restore Elements() fichier :" << inputFileName << endl << endl;225 226 ifstream infile;227 string name = inputFileName;228 infile.open(name.c_str(), ios::in);229 if ( !infile) {230 c err << " error opening input stream " << name << endl;284 cout << " dataManager::restoreAMLElements() fichier :" << inputFileName << endl << endl; 285 286 AMLReader reader; 287 UAPNode* uap_root = NULL; 288 uap_root = reader.AMLFileToAMLRep (inputFileName); 289 if ( !uap_root ) { 290 cout << " dataManager::restoreAMLElements ERREUR AML lecture fichier " << inputFileName << endl; 231 291 return false; 232 292 } 233 else cout << " successful opening input stream : " << name << endl; 234 293 294 else cout << " successful opening : " << inputFileName << " UAP_ROOT= " << uap_root->getName() << endl; 295 UAPNode* uap_labname = NULL; 296 297 NodeVec laboratories = uap_root->getSubNodesByName(string("laboratory")); 298 cout << " dataManager::restoreAMLElements nombre de <laboratory> : " << laboratories.size() << endl; 299 300 uap_labname = *laboratories.begin(); 301 302 if ( !uap_labname ) { 303 cout << " dataManager::restoreAMLElements : fichier non conforme, on ne trouve pas <laboratory...> " << endl; 304 } else { 305 cout << " dataManager::restoreAMLElements : GO !" << endl; 306 } 307 308 235 309 //NOTE:: je ne sais pas si les "secteurs" seront conservés, aussi pour ne pas trop changer les fichiers je lis les données aprÚs "globals" dans la boucle 236 310 … … 241 315 sector* mySect = addNewSector(); 242 316 317 318 UAPNode* parametresGlobaux = uap_labname->getChildByName(string("global")); 319 if ( !parametresGlobaux ) { 320 cout << " dataManager::restoreAMLElements GLOBAUX NON TROUVES " << endl; 321 } else { 322 cout << " dataManager::restoreAMLElements GENIAL ! " << endl; 323 } 324 globParam_.raz(); 325 globParam_.FileAMLInput(parametresGlobaux); 326 327 243 328 nomdElements::typedElement elementType; 244 329 string elementLabel; 245 330 abstractElement* nouveau = NULL; 246 while (infile >> elementLabel) { 247 if (elementLabel == string("globals") ) { 248 globParam_.raz(); 249 globParam_.FileInput(infile); 250 } else if (elementLabel == string("sectors") ) { 251 // FIXME Francois !!!!!!! 252 // sectorParam_.raz(); 253 // sectorParam_.FileInput(infile); 254 // END 255 } else { 256 elementType = nomdElements::getTypeFromLabel(elementLabel); 257 nouveau = mySect->addElementAfter(elementType,nouveau); 331 332 333 NodeVec sectorNode = uap_root->getSubNodesByName(string("sector")); 334 335 if ( !sectorNode.size() ) { 336 cout << " dataManager::restoreAMLElements ERREUR lecture fichier : pas de sectors ? " << endl; 337 return false; 338 } 339 340 341 NodeVec& listElem = ( *sectorNode.begin() )->getChildren(); 342 if ( !listElem.size() ) { 343 cout << " dataManager::restoreAMLElements ERREUR lecture fichier : pas d'elements ? " << endl; 344 return false; 345 } else { 346 cout << " dataManager::restoreAMLElements : liste elements non vide : SUCCES " << endl; 347 } 348 349 for (NodeVecIter iter = listElem.begin(); iter != listElem.end(); iter++) { 350 351 string nomNoeud = (*iter)->getName(); 352 if ( nomNoeud != string("element") ) { 353 cout << " le secteur contient un non-element : " << nomNoeud << endl; 354 continue; 355 } 356 357 UAPAttribute* att = NULL; 358 att = (*iter)->getAttribute("name"); 359 360 cout << " dataManager::restoreAMLElements trouve element " << att->getValue(); 361 362 string nomGenerique; 363 AMLtools::readAMLParameterAttribut(*iter, "description", "type", nomGenerique); 364 365 // UAPNode* genericName = (*iter)->getChildByName("description"); 366 // att = genericName->getAttribute("type"); 367 368 cout << " de type " << nomGenerique << endl; 369 370 371 elementType = nomdElements::getTypeFromLabel(nomGenerique); 372 nouveau = mySect->addElementAfter(elementType,nouveau); 373 258 374 if ( nouveau == NULL ) { 259 cerr << " dataManager::restore Elements() : restore element " << elementLabel<< " failed " << endl;375 cerr << " dataManager::restoreAMLElements() : restore element " << att->getValue() << " failed " << endl; 260 376 return false; 261 377 } else { 262 nouveau->File Input(infile);378 nouveau->FileAMLInput(*iter); 263 379 } 264 } 265 }// while 266 267 #if BAVARD > 1 268 /* unsigned k; 269 for(k = 0; k < getBeamLineSize(); k++) { 270 abstractElement* ptr = pspa_->getBeamLine_deprecated()->getAbstractElement(k); 271 cout << "recupere " << ptr->getLabel() << endl; 272 } 273 */ 274 #endif 275 276 infile.close(); 380 } 381 382 277 383 return true; 278 384 } 385 279 386 280 387 particleBeam* dataManager::getDiagnosticBeam(unsigned index) -
Interface_Web/trunk/pspaWT/sources/controler/src/elementBeam.cc
r424 r488 97 97 // } 98 98 99 string elementBeam::FileOutputFlow() const100 {101 ostringstream sortie;102 // sortie << elementName_.getElementType() << endl;103 sortie << elementName_.getGenericLabel() << endl;104 sortie << specificName_ << endl;105 sortie << x_ << " " << xp_ << " " << y_ << " " << yp_ << endl;106 sortie << dl_ << " " << del_ << " " << p0_ << endl;107 cout << " elementBeam::FileOutputFlow, p0 = " << p0_ << endl;108 return sortie.str();109 }99 // string elementBeam::FileOutputFlow() const 100 // { 101 // ostringstream sortie; 102 // // sortie << elementName_.getElementType() << endl; 103 // sortie << elementName_.getGenericLabel() << endl; 104 // sortie << specificName_ << endl; 105 // sortie << x_ << " " << xp_ << " " << y_ << " " << yp_ << endl; 106 // sortie << dl_ << " " << del_ << " " << p0_ << endl; 107 // cout << " elementBeam::FileOutputFlow, p0 = " << p0_ << endl; 108 // return sortie.str(); 109 // } 110 110 111 111 vector< pair<string, vector<string> > > elementBeam::parametersToSoftware () const … … 128 128 } 129 129 130 void elementBeam::elementBeam::FileInput(ifstream& ifs) 131 { 132 ifs >> specificName_; 133 ifs >> x_ >> xp_ >> y_ >> yp_; 134 ifs >> dl_ >> del_ >> p0_; 135 cout << " elementBeam::FileFileInput, p0 = " << p0_ << endl; 130 // void elementBeam::FileInput(ifstream& ifs) 131 // { 132 // ifs >> specificName_; 133 // ifs >> x_ >> xp_ >> y_ >> yp_; 134 // ifs >> dl_ >> del_ >> p0_; 135 // cout << " elementBeam::FileFileInput, p0 = " << p0_ << endl; 136 // lenghtElem_ = getLenghtOfElement(); 137 // cout << " elementBeam::FileInput calcule longueur = " << lenghtElem_ << endl; 138 // } 139 140 void elementBeam::FileAMLInput(UAPNode* entree) 141 { 142 // if ( !entree ) return; 143 // string nonGenerique; 144 // AMLtools::readAMLParameterAttribut(*iter, "description", "type", nonGenerique); 145 // if ( nonGenerique != elementName_.getGenericLabel() ) { 146 // cout << " elementBeam::FileAMLInput ERREUR d'element : " << nonGenerique << " ? attendu : " << elementName_.getGenericLabel() << endl; 147 // return; 148 // } 149 150 if ( !checkAMLelementGenericName(entree) ) return; 151 UAPNode* faisceau = entree->getChildByName("beam"); 152 if ( !faisceau ) { 153 cout << " elementBeam::FileAMLInput ERREUR pas de noeud AML <beam> : " << endl; 154 return; 155 } 156 AMLtools::readAMLParameterAttribut(faisceau, "11", "design", x_); 157 AMLtools::readAMLParameterAttribut(faisceau, "22", "design", xp_); 158 AMLtools::readAMLParameterAttribut(faisceau, "33", "design", y_); 159 AMLtools::readAMLParameterAttribut(faisceau, "44", "design", yp_); 160 AMLtools::readAMLParameterAttribut(faisceau, "55", "design", dl_); 161 AMLtools::readAMLParameterAttribut(faisceau, "66", "design", del_); 162 AMLtools::readAMLParameterAttribut(faisceau, "pc", "design", p0_); 136 163 lenghtElem_ = getLenghtOfElement(); 137 cout << " elementBeam::FileInput calcule longueur = " << lenghtElem_ << endl; 138 } 164 cout << " elementBeam::FileAMLInput calcule longueur = " << lenghtElem_ << endl; 165 } 166 167 139 168 140 169 string elementBeam::print() … … 161 190 void elementBeam::InputRep(UAPNode* root) 162 191 { 163 UAPNode* ele = root->addChild("element"); 164 ele->addAttribute("name",specificName_); 192 // UAPNode* ele = root->addChild("element"); 193 // ele->addAttribute("name",specificName_); 194 UAPNode* ele = setAMLelementHeader(root); 165 195 166 196 UAPNode* node = ele->addChild("beam"); -
Interface_Web/trunk/pspaWT/sources/controler/src/elementBend.cc
r424 r488 106 106 107 107 108 string elementBend::FileOutputFlow() const109 {110 ostringstream sortie;111 // sortie << elementName_.getElementType() << endl;112 sortie << elementName_.getGenericLabel() << endl;113 sortie << specificName_ << endl;114 sortie << angleDeg_ << " " << radius_ << " " << aperture_ << endl;115 sortie << beta1_ << " " << beta2_ << " " << momentum_ << endl;116 return sortie.str();117 }108 // string elementBend::FileOutputFlow() const 109 // { 110 // ostringstream sortie; 111 // // sortie << elementName_.getElementType() << endl; 112 // sortie << elementName_.getGenericLabel() << endl; 113 // sortie << specificName_ << endl; 114 // sortie << angleDeg_ << " " << radius_ << " " << aperture_ << endl; 115 // sortie << beta1_ << " " << beta2_ << " " << momentum_ << endl; 116 // return sortie.str(); 117 // } 118 118 119 119 vector< pair<string, vector<string> > > elementBend::parametersToSoftware () const … … 138 138 } 139 139 140 void elementBend::FileInput(ifstream& ifs)141 {142 ifs >> specificName_;143 ifs >> angleDeg_ >> radius_ >> aperture_;144 ifs >> beta1_ >> beta2_ >> momentum_;145 lenghtElem_ = getLenghtOfElement();146 cout << " elementBend::FileInput calcule longueur = " << lenghtElem_ << endl;147 }140 // void elementBend::FileInput(ifstream& ifs) 141 // { 142 // ifs >> specificName_; 143 // ifs >> angleDeg_ >> radius_ >> aperture_; 144 // ifs >> beta1_ >> beta2_ >> momentum_; 145 // lenghtElem_ = getLenghtOfElement(); 146 // cout << " elementBend::FileInput calcule longueur = " << lenghtElem_ << endl; 147 // } 148 148 149 149 string elementBend::print() … … 167 167 return txt; 168 168 } 169 void elementBend::FileAMLInput(UAPNode* entree) 170 { 171 if ( !checkAMLelementGenericName(entree) ) return; 172 173 AMLtools::readAMLParameterAttribut(entree, "length", "design", lenghtElem_); 174 AMLtools::readAMLParameterAttribut(entree, "momentum", "design", momentum_); 175 176 UAPNode* bend = entree->getChildByName("bend"); 177 if ( !bend ) { 178 cout << " elementBend::FileAMLInput ERREUR pas de noeud AML <bend> " << endl; 179 return; 180 } 181 AMLtools::readAMLParameterAttribut(bend, "g", "design", radius_); 182 // g = 1/r 183 184 if ( radius_ != 0.0 ) { 185 radius_ = 1./radius_; 186 // angle en degres, la longeur est en cm, le rayon en metres : 187 angleDeg_ = 0.01*lenghtElem_/(radius_*DEG_TO_RADIANS); 188 } 189 AMLtools::readAMLParameterAttribut(bend, "e1", "design", beta1_); 190 AMLtools::readAMLParameterAttribut(bend, "e2", "design", beta2_); 191 192 193 UAPNode* ouverture = entree->getChildByName("aperture"); 194 if ( !ouverture ) { 195 cout << " elementBend::FileAMLInput ERREUR pas de noeud AML <aperture> " << endl; 196 return; 197 } 198 AMLtools::readAMLParameterAttribut(ouverture, "xy_limit", "design", aperture_); 199 200 201 202 203 } 204 169 205 170 206 void elementBend::InputRep(UAPNode* root) 171 207 { 172 UAPNode* ele = root->addChild("element"); 173 ele->addAttribute("name",specificName_); 208 // UAPNode* ele = root->addChild("element"); 209 // ele->addAttribute("name",specificName_); 210 UAPNode* ele = setAMLelementHeader(root); 174 211 175 212 string txt = ""; -
Interface_Web/trunk/pspaWT/sources/controler/src/elementCell.cc
r424 r488 102 102 103 103 104 string elementCell::FileOutputFlow() const105 {106 ostringstream sortie;107 // sortie << elementName_.getElementType() << endl;108 sortie << elementName_.getGenericLabel() << endl;109 sortie << specificName_ << endl;110 sortie << lenghtElem_ << " " << aperture_ << endl;111 sortie << initialPhase_ << " " << acceleratingField_ << endl;112 sortie << phaseStepMax_ << endl;113 sortie << acceleratingShapeFile_ << endl;114 sortie << focusingMagFile_ << endl;115 sortie << offsetMag_ << " " << scaleFactor_ << endl;116 return sortie.str();117 }104 // string elementCell::FileOutputFlow() const 105 // { 106 // ostringstream sortie; 107 // // sortie << elementName_.getElementType() << endl; 108 // sortie << elementName_.getGenericLabel() << endl; 109 // sortie << specificName_ << endl; 110 // sortie << lenghtElem_ << " " << aperture_ << endl; 111 // sortie << initialPhase_ << " " << acceleratingField_ << endl; 112 // sortie << phaseStepMax_ << endl; 113 // sortie << acceleratingShapeFile_ << endl; 114 // sortie << focusingMagFile_ << endl; 115 // sortie << offsetMag_ << " " << scaleFactor_ << endl; 116 // return sortie.str(); 117 // } 118 118 119 119 vector< pair<string, vector<string> > > elementCell::parametersToSoftware () const … … 140 140 } 141 141 142 void elementCell::FileInput(ifstream& ifs)143 {144 ifs >> specificName_;145 ifs >> lenghtElem_ >> aperture_;146 ifs >> initialPhase_ >> acceleratingField_;147 ifs >> phaseStepMax_;148 ifs >> acceleratingShapeFile_;149 ifs >> focusingMagFile_;150 ifs >> offsetMag_ >> scaleFactor_;151 }142 // void elementCell::FileInput(ifstream& ifs) 143 // { 144 // ifs >> specificName_; 145 // ifs >> lenghtElem_ >> aperture_; 146 // ifs >> initialPhase_ >> acceleratingField_; 147 // ifs >> phaseStepMax_; 148 // ifs >> acceleratingShapeFile_; 149 // ifs >> focusingMagFile_; 150 // ifs >> offsetMag_ >> scaleFactor_; 151 // } 152 152 153 153 string elementCell::print() … … 178 178 void elementCell::InputRep(UAPNode* root) 179 179 { 180 UAPNode* ele = root->addChild("element"); 181 ele->addAttribute("name",specificName_); 180 // UAPNode* ele = root->addChild("element"); 181 // ele->addAttribute("name",specificName_); 182 183 UAPNode* ele = setAMLelementHeader(root); 184 182 185 183 186 UAPNode* node = ele->addChild("methods"); … … 216 219 } 217 220 } 221 222 223 void elementCell::FileAMLInput(UAPNode* entree) 224 { 225 if ( !checkAMLelementGenericName(entree) ) return; 226 AMLtools::readAMLParameterAttribut(entree, "length", "design", lenghtElem_); 227 228 UAPNode* ouverture = entree->getChildByName("aperture"); 229 if ( !ouverture ) { 230 cout << " elementCell::FileAMLInput ERREUR pas de noeud AML <aperture> " << endl; 231 return; 232 } 233 AMLtools::readAMLParameterAttribut(ouverture, "xy_limit", "design", aperture_); 234 235 UAPNode* cavite = entree->getChildByName("linac_cavity"); 236 if ( !cavite ) { 237 cout << " elementCell::FileAMLInput ERREUR pas de noeud AML <linac_cavity> " << endl; 238 return; 239 } 240 241 AMLtools::readAMLParameterAttribut(cavite, "phase0", "design", initialPhase_); 242 AMLtools::readAMLParameterAttribut(cavite, "gradient", "design", acceleratingField_); 243 244 AMLtools::readAMLParameterAttribut(entree, "phaseStepMax", "value", phaseStepMax_); 245 AMLtools::readAMLParameterAttribut(entree, "acceleratingShapeField", "name", acceleratingShapeFile_); 246 AMLtools::readAMLParameterAttribut(entree, "focusingMagneticField", "name", focusingMagFile_); 247 AMLtools::readAMLParameterAttribut(entree, "z_offset", "value", offsetMag_); 248 AMLtools::readAMLParameterAttribut(entree, "scaling_factor", "value", scaleFactor_); 249 250 } -
Interface_Web/trunk/pspaWT/sources/controler/src/elementDrift.cc
r442 r488 70 70 71 71 72 string elementDrift::FileOutputFlow() const73 {74 ostringstream sortie;75 // sortie << elementName_.getElementType() << endl;76 sortie << elementName_.getGenericLabel() << endl;77 sortie << specificName_ << endl;78 sortie << lenghtElem_ << " " << aperture_ <<endl;79 return sortie.str();80 }72 // string elementDrift::FileOutputFlow() const 73 // { 74 // ostringstream sortie; 75 // // sortie << elementName_.getElementType() << endl; 76 // sortie << elementName_.getGenericLabel() << endl; 77 // sortie << specificName_ << endl; 78 // sortie << lenghtElem_ << " " << aperture_ <<endl; 79 // return sortie.str(); 80 // } 81 81 82 82 vector< pair<string, vector<string> > > elementDrift::parametersToSoftware () const … … 92 92 } 93 93 94 void elementDrift::FileInput(ifstream& ifs)95 {96 ifs >> specificName_;97 ifs >> lenghtElem_ >> aperture_;98 }94 // void elementDrift::FileInput(ifstream& ifs) 95 // { 96 // ifs >> specificName_; 97 // ifs >> lenghtElem_ >> aperture_; 98 // } 99 99 100 100 string elementDrift::print() … … 111 111 void elementDrift::InputRep(UAPNode* root) 112 112 { 113 UAPNode* ele = root->addChild("element"); 114 ele->addAttribute("name",specificName_); 113 // UAPNode* ele = root->addChild("element"); 114 // ele->addAttribute("name",specificName_); 115 UAPNode* ele = setAMLelementHeader(root); 115 116 116 117 string txt = ""; … … 124 125 node->addChild("xy_limit")->addAttribute("design",txt); 125 126 } 127 128 void elementDrift::FileAMLInput(UAPNode* entree) 129 { 130 if ( !checkAMLelementGenericName(entree) ) return; 131 AMLtools::readAMLParameterAttribut(entree, "length", "design", lenghtElem_); 132 133 UAPNode* ouverture = entree->getChildByName("aperture"); 134 if ( !ouverture ) { 135 cout << " elementDrift::FileAMLInput ERREUR pas de noeud AML <aperture> " << endl; 136 return; 137 } 138 AMLtools::readAMLParameterAttribut(ouverture, "xy_limit", "design", aperture_); 139 140 141 } -
Interface_Web/trunk/pspaWT/sources/controler/src/elementFit.cc
r424 r488 81 81 // } 82 82 83 string elementFit::FileOutputFlow() const84 {85 ostringstream sortie;86 // sortie << elementName_.getElementType() << endl;87 sortie << elementName_.getGenericLabel() << endl;88 sortie << specificName_ << endl;89 sortie << variableName_ << " " << variableValue_ << " " << tolerance_ << endl;90 return sortie.str();91 }83 // string elementFit::FileOutputFlow() const 84 // { 85 // ostringstream sortie; 86 // // sortie << elementName_.getElementType() << endl; 87 // sortie << elementName_.getGenericLabel() << endl; 88 // sortie << specificName_ << endl; 89 // sortie << variableName_ << " " << variableValue_ << " " << tolerance_ << endl; 90 // return sortie.str(); 91 // } 92 92 93 93 vector< pair<string, vector<string> > > elementFit::parametersToSoftware () const … … 104 104 } 105 105 106 void elementFit::FileInput(ifstream& ifs)107 {108 ifs >> specificName_;109 ifs >> variableName_ >> variableValue_ >> tolerance_;110 }106 // void elementFit::FileInput(ifstream& ifs) 107 // { 108 // ifs >> specificName_; 109 // ifs >> variableName_ >> variableValue_ >> tolerance_; 110 // } 111 111 112 112 string elementFit::print() … … 119 119 void elementFit::InputRep(UAPNode* root) 120 120 { 121 UAPNode* ele = root->addChild("element"); 122 ele->addAttribute("name",specificName_); 121 // UAPNode* ele = root->addChild("element"); 122 // ele->addAttribute("name",specificName_); 123 UAPNode* ele = setAMLelementHeader(root); 123 124 124 125 UAPNode* node = ele->addChild("fit"); … … 130 131 node->addAttribute("err",txt); 131 132 } 133 134 void elementFit::FileAMLInput(UAPNode* entree) 135 { 136 if ( !checkAMLelementGenericName(entree) ) return; 137 AMLtools::readAMLParameterAttribut(entree, "fit", "attribute", variableName_); 138 AMLtools::readAMLParameterAttribut(entree, "fit", "design", variableValue_); 139 AMLtools::readAMLParameterAttribut(entree, "fit", "err", tolerance_); 140 } -
Interface_Web/trunk/pspaWT/sources/controler/src/elementMultipole.cc
r431 r488 51 51 } 52 52 53 string elementMultipole::FileOutputFlow() const54 {55 ostringstream sortie;56 sortie << elementName_.getGenericLabel() << endl;57 sortie << specificName_ << endl;58 sortie << order_ << " " << component_ <<endl;59 return sortie.str();60 }53 // string elementMultipole::FileOutputFlow() const 54 // { 55 // ostringstream sortie; 56 // sortie << elementName_.getGenericLabel() << endl; 57 // sortie << specificName_ << endl; 58 // sortie << order_ << " " << component_ <<endl; 59 // return sortie.str(); 60 // } 61 61 62 62 vector< pair<string, vector<string> > > elementMultipole::parametersToSoftware () const … … 72 72 } 73 73 74 void elementMultipole::FileInput(ifstream& ifs)75 {76 ifs >> specificName_;77 ifs >> order_ >> component_;78 }74 // void elementMultipole::FileInput(ifstream& ifs) 75 // { 76 // ifs >> specificName_; 77 // ifs >> order_ >> component_; 78 // } 79 79 80 80 string elementMultipole::print() … … 91 91 void elementMultipole::InputRep(UAPNode* root) 92 92 { 93 UAPNode* ele = root->addChild("element"); 94 ele->addAttribute("name",specificName_); 93 // UAPNode* ele = root->addChild("element"); 94 // ele->addAttribute("name",specificName_); 95 UAPNode* ele = setAMLelementHeader(root); 95 96 96 97 string txt = ""; … … 103 104 knl->addAttribute("design",txt); 104 105 } 106 107 void elementMultipole::FileAMLInput(UAPNode* entree) 108 { 109 if ( !checkAMLelementGenericName(entree) ) return; 110 UAPNode* multipNode = entree->getChildByName("multipole"); 111 if ( ! multipNode ) { 112 cout << " elementMultipole::FileAMLInput ERREUR pas de noeud AML <multipole> " << endl; 113 return; 114 } 115 AMLtools::readAMLParameterAttribut(multipNode, "kl", "n", order_); 116 AMLtools::readAMLParameterAttribut(multipNode, "kl", "design", component_); 117 } -
Interface_Web/trunk/pspaWT/sources/controler/src/elementQuadrupole.cc
r487 r488 9 9 defaultSpecificName_ = "qpole"; 10 10 specificName_ = defaultSpecificName_; 11 length_ = 0;11 // length_ = 0; 12 12 component_ = 0.0; 13 13 … … 22 22 parametersString_[++compteur]= mixedTools::intToString(nbParam_); 23 23 parametersString_[++compteur]= specificName_; 24 parametersString_[++compteur]= mixedTools::doubleToString(leng th_);24 parametersString_[++compteur]= mixedTools::doubleToString(lenghtElem_); 25 25 parametersString_[++compteur]= mixedTools::doubleToString(component_); 26 26 if ( compteur != nbParam_ ) { … … 47 47 48 48 specificName_ = param[++compteur]; 49 leng th_ = atof(param[++compteur].c_str());49 lenghtElem_ = atof(param[++compteur].c_str()); 50 50 component_ = atof(param[++compteur].c_str()); 51 51 } 52 52 53 string elementQuadrupole::FileOutputFlow() const54 {55 ostringstream sortie;56 sortie << elementName_.getGenericLabel() << endl;57 sortie << specificName_ << endl;58 sortie << length_ << " " << component_ <<endl;59 return sortie.str();60 }53 // string elementQuadrupole::FileOutputFlow() const 54 // { 55 // ostringstream sortie; 56 // sortie << elementName_.getGenericLabel() << endl; 57 // sortie << specificName_ << endl; 58 // sortie << lenghtElem_ << " " << component_ <<endl; 59 // return sortie.str(); 60 // } 61 61 62 62 vector< pair<string, vector<string> > > elementQuadrupole::parametersToSoftware () const … … 67 67 sortie.back().second.push_back(specificName_); 68 68 sortie.push_back( pair<string, vector<string> >("attributes",vector<string>() ) ); 69 sortie.back().second.push_back(mixedTools::doubleToString(leng th_));69 sortie.back().second.push_back(mixedTools::doubleToString(lenghtElem_)); 70 70 sortie.back().second.push_back(mixedTools::doubleToString(component_)); 71 71 return sortie; 72 72 } 73 73 74 void elementQuadrupole::FileInput(ifstream& ifs)75 {76 ifs >> specificName_;77 ifs >> length_ >> component_;78 }74 // void elementQuadrupole::FileInput(ifstream& ifs) 75 // { 76 // ifs >> specificName_; 77 // ifs >> lenghtElem_ >> component_; 78 // } 79 79 80 80 string elementQuadrupole::print() … … 83 83 txt += specificName_; 84 84 txt += "\nlength (m): "; 85 txt += mixedTools::doubleToString(leng th_);85 txt += mixedTools::doubleToString(lenghtElem_); 86 86 txt += "\ncomponent (m^-2): "; 87 87 txt += mixedTools::doubleToString(component_); … … 91 91 void elementQuadrupole::InputRep(UAPNode* root) 92 92 { 93 UAPNode* ele = root->addChild("element"); 94 ele->addAttribute("name",specificName_); 93 UAPNode* ele = setAMLelementHeader(root); 95 94 96 95 string txt = ""; … … 100 99 knl->addAttribute("design",txt); 101 100 102 txt = mixedTools::doubleToString(leng th_);101 txt = mixedTools::doubleToString(lenghtElem_); 103 102 ele->addChild("length")->addAttribute("design",txt); 104 103 } 104 105 106 void elementQuadrupole::FileAMLInput(UAPNode* entree) 107 { 108 if ( !checkAMLelementGenericName(entree) ) return; 109 110 AMLtools::readAMLParameterAttribut(entree, "length", "design", lenghtElem_); 111 112 113 UAPNode* quadrupole = entree->getChildByName("quadrupole"); 114 if ( ! quadrupole ) { 115 cout << " elementQuadrupole::FileAMLInput ERREUR pas de noeud AML <quadrupole> " << endl; 116 return; 117 } 118 AMLtools::readAMLParameterAttribut(quadrupole, "k", "design", component_); 119 } -
Interface_Web/trunk/pspaWT/sources/controler/src/elementRfgun.cc
r424 r488 126 126 // } 127 127 128 string elementRfgun::FileOutputFlow() const129 {130 ostringstream sortie;131 // on prend les troncatures tmax et rmax à 3 sigmas132 // sortie << elementName_.getElementType() << endl;133 sortie << elementName_.getGenericLabel() << endl;134 sortie << specificName_ << endl;135 sortie << nmacrop_ << " " << sigma_t_ << " " << sigma_r_ << endl;136 sortie << emit_x_ << " " << emit_y_ << endl;137 sortie << E_cin_ << " " << sigma_E_ << endl;138 sortie << phaseStep_ << " " << totalCharge_ << endl;139 return sortie.str();140 }128 // string elementRfgun::FileOutputFlow() const 129 // { 130 // ostringstream sortie; 131 // // on prend les troncatures tmax et rmax à 3 sigmas 132 // // sortie << elementName_.getElementType() << endl; 133 // sortie << elementName_.getGenericLabel() << endl; 134 // sortie << specificName_ << endl; 135 // sortie << nmacrop_ << " " << sigma_t_ << " " << sigma_r_ << endl; 136 // sortie << emit_x_ << " " << emit_y_ << endl; 137 // sortie << E_cin_ << " " << sigma_E_ << endl; 138 // sortie << phaseStep_ << " " << totalCharge_ << endl; 139 // return sortie.str(); 140 // } 141 141 142 142 vector< pair<string, vector<string> > > elementRfgun::parametersToSoftware () const … … 164 164 } 165 165 166 void elementRfgun::FileInput(ifstream& ifs)167 {168 ifs >> specificName_;169 ifs >> nmacrop_ >> sigma_t_ >> sigma_r_;170 ifs >> emit_x_ >> emit_y_;171 ifs >> E_cin_ >> sigma_E_;172 ifs >> phaseStep_ >> totalCharge_;173 }166 // void elementRfgun::FileInput(ifstream& ifs) 167 // { 168 // ifs >> specificName_; 169 // ifs >> nmacrop_ >> sigma_t_ >> sigma_r_; 170 // ifs >> emit_x_ >> emit_y_; 171 // ifs >> E_cin_ >> sigma_E_; 172 // ifs >> phaseStep_ >> totalCharge_; 173 // } 174 174 175 175 string elementRfgun::print() … … 198 198 void elementRfgun::InputRep(UAPNode* root) 199 199 { 200 UAPNode* ele = root->addChild("element"); 201 ele->addAttribute("name",specificName_); 202 200 // UAPNode* ele = root->addChild("element"); 201 // ele->addAttribute("name",specificName_); 202 // UAPNode* node = NULL; 203 // node = ele->addChild("description"); 204 // node->addAttribute("type",elementName_.getGenericLabel()); 205 UAPNode* ele = setAMLelementHeader(root); 203 206 UAPNode* node = ele->addChild("comment"); 204 207 node->addAttribute("type","RFgun"); … … 217 220 node->addChild("emittance_b")->addAttribute("design",txt); 218 221 txt = mixedTools::doubleToString(E_cin_); 219 txt = mixedTools::doubleToString(E_cin_);220 222 node->addChild("total_energy")->addAttribute("design",txt); 221 223 txt = mixedTools::doubleToString(sigma_E_); … … 232 234 } 233 235 236 void elementRfgun::FileAMLInput(UAPNode* entree) 237 { 238 if ( !checkAMLelementGenericName(entree) ) return; 239 UAPNode* beam = entree->getChildByName("beam"); 240 AMLtools::readAMLParameterAttribut(beam, "n_particles", "design", nmacrop_); 241 AMLtools::readAMLParameterAttribut(beam, "sig_t", "design", sigma_t_); 242 AMLtools::readAMLParameterAttribut(beam, "emittance_a", "design", emit_x_); 243 AMLtools::readAMLParameterAttribut(beam, "emittance_b", "design", emit_y_); 244 AMLtools::readAMLParameterAttribut(beam, "total_energy", "design", E_cin_); 245 AMLtools::readAMLParameterAttribut(beam, "sig_e", "design", sigma_E_); 246 AMLtools::readAMLParameterAttribut(beam, "particle_charge", "design", totalCharge_); 247 248 AMLtools::readAMLParameterAttribut(entree, "sigma_r", "value", sigma_r_); 249 AMLtools::readAMLParameterAttribut(entree, "phaseStep", "value", phaseStep_); 250 251 } -
Interface_Web/trunk/pspaWT/sources/controler/src/elementSextupole.cc
r487 r488 9 9 defaultSpecificName_ = "spole"; 10 10 specificName_ = defaultSpecificName_; 11 length_ = 0;11 // length_ = 0; 12 12 component_ = 0.0; 13 13 … … 22 22 parametersString_[++compteur]= mixedTools::intToString(nbParam_); 23 23 parametersString_[++compteur]= specificName_; 24 parametersString_[++compteur]= mixedTools::doubleToString(leng th_);24 parametersString_[++compteur]= mixedTools::doubleToString(lenghtElem_); 25 25 parametersString_[++compteur]= mixedTools::doubleToString(component_); 26 26 if ( compteur != nbParam_ ) { … … 47 47 48 48 specificName_ = param[++compteur]; 49 leng th_ = atof(param[++compteur].c_str());49 lenghtElem_ = atof(param[++compteur].c_str()); 50 50 component_ = atof(param[++compteur].c_str()); 51 51 } 52 52 53 string elementSextupole::FileOutputFlow() const54 {55 ostringstream sortie;56 sortie << elementName_.getGenericLabel() << endl;57 sortie << specificName_ << endl;58 sortie << length_ << " " << component_ <<endl;59 return sortie.str();60 }53 // string elementSextupole::FileOutputFlow() const 54 // { 55 // ostringstream sortie; 56 // sortie << elementName_.getGenericLabel() << endl; 57 // sortie << specificName_ << endl; 58 // sortie << lenghtElem_ << " " << component_ <<endl; 59 // return sortie.str(); 60 // } 61 61 62 62 vector< pair<string, vector<string> > > elementSextupole::parametersToSoftware () const … … 67 67 sortie.back().second.push_back(specificName_); 68 68 sortie.push_back( pair<string, vector<string> >("attributes",vector<string>() ) ); 69 sortie.back().second.push_back(mixedTools::doubleToString(leng th_));69 sortie.back().second.push_back(mixedTools::doubleToString(lenghtElem_)); 70 70 sortie.back().second.push_back(mixedTools::doubleToString(component_)); 71 71 return sortie; 72 72 } 73 73 74 void elementSextupole::FileInput(ifstream& ifs)75 {76 ifs >> specificName_;77 ifs >> length_ >> component_;78 }74 // void elementSextupole::FileInput(ifstream& ifs) 75 // { 76 // ifs >> specificName_; 77 // ifs >> lenghtElem_ >> component_; 78 // } 79 79 80 80 string elementSextupole::print() … … 83 83 txt += specificName_; 84 84 txt += "\nlength (m): "; 85 txt += mixedTools::doubleToString(leng th_);85 txt += mixedTools::doubleToString(lenghtElem_); 86 86 txt += "\ncomponent (m^-3): "; 87 87 txt += mixedTools::doubleToString(component_); … … 91 91 void elementSextupole::InputRep(UAPNode* root) 92 92 { 93 UAPNode* ele = root->addChild("element"); 94 ele->addAttribute("name",specificName_); 93 UAPNode* ele = setAMLelementHeader(root); 95 94 96 95 string txt = ""; … … 100 99 knl->addAttribute("design",txt); 101 100 102 txt = mixedTools::doubleToString(leng th_);101 txt = mixedTools::doubleToString(lenghtElem_); 103 102 ele->addChild("length")->addAttribute("design",txt); 104 103 } 104 105 void elementSextupole::FileAMLInput(UAPNode* entree) 106 { 107 if ( !checkAMLelementGenericName(entree) ) return; 108 109 AMLtools::readAMLParameterAttribut(entree, "length", "design", lenghtElem_); 110 111 112 UAPNode* sextupole = entree->getChildByName("sextupole"); 113 if ( ! sextupole ) { 114 cout << " elementSextupole::FileAMLInput ERREUR pas de noeud AML <sextupole> " << endl; 115 return; 116 } 117 AMLtools::readAMLParameterAttribut(sextupole, "k", "design", component_); 118 } -
Interface_Web/trunk/pspaWT/sources/controler/src/elementSnapshot.cc
r442 r488 82 82 // } 83 83 84 string elementSnapshot::FileOutputFlow() const85 {86 ostringstream sortie;87 sortie << elementName_.getGenericLabel() << endl;88 sortie << specificName_ << endl;89 sortie << programFile_ << endl;90 sortie << inputBeamFile_ << endl;91 sortie << outputBeamFile_ << endl;92 return sortie.str();93 }84 // string elementSnapshot::FileOutputFlow() const 85 // { 86 // ostringstream sortie; 87 // sortie << elementName_.getGenericLabel() << endl; 88 // sortie << specificName_ << endl; 89 // sortie << programFile_ << endl; 90 // sortie << inputBeamFile_ << endl; 91 // sortie << outputBeamFile_ << endl; 92 // return sortie.str(); 93 // } 94 94 95 95 vector< pair<string, vector<string> > > elementSnapshot::parametersToSoftware () const { … … 105 105 } 106 106 107 void elementSnapshot::FileInput(ifstream& ifs)108 {109 ifs >> specificName_;110 ifs >> programFile_;111 ifs >> inputBeamFile_;112 ifs >> outputBeamFile_;;113 }107 // void elementSnapshot::FileInput(ifstream& ifs) 108 // { 109 // ifs >> specificName_; 110 // ifs >> programFile_; 111 // ifs >> inputBeamFile_; 112 // ifs >> outputBeamFile_;; 113 // } 114 114 115 115 string elementSnapshot::print() … … 128 128 void elementSnapshot::InputRep(UAPNode* root) 129 129 { 130 UAPNode* node= root->addChild("snapshot"); 131 node->addAttribute("name",specificName_); 130 // UAPNode* node= root->addChild("snapshot"); 131 // node->addAttribute("name",specificName_); 132 UAPNode* ele = setAMLelementHeader(root); 132 133 133 UAPNode* fichiers = node->addChild("names_of_files");134 UAPNode* fichiers = ele->addChild("names_of_files"); 134 135 fichiers->addAttribute("program",programFile_); 135 136 fichiers->addAttribute("inputf",inputBeamFile_); 136 137 fichiers->addAttribute("outputf",outputBeamFile_); 137 138 } 139 140 void elementSnapshot::FileAMLInput(UAPNode* entree) 141 { 142 if ( !checkAMLelementGenericName(entree) ) return; 143 AMLtools::readAMLParameterAttribut(entree, "names_of_files", "program", programFile_); 144 AMLtools::readAMLParameterAttribut(entree, "names_of_files", "inputf", inputBeamFile_); 145 AMLtools::readAMLParameterAttribut(entree, "names_of_files", "outputf", outputBeamFile_); 146 } -
Interface_Web/trunk/pspaWT/sources/controler/src/elementSoleno.cc
r424 r488 84 84 // } 85 85 86 string elementSoleno::FileOutputFlow() const87 {88 ostringstream sortie;89 // sortie << elementName_.getElementType() << endl;90 sortie << elementName_.getGenericLabel() << endl;91 sortie << specificName_ << endl;92 sortie << lenghtElem_ << " " << aperture_<< " " << B0_ << " " << varyB0_ << endl;93 return sortie.str();94 }86 // string elementSoleno::FileOutputFlow() const 87 // { 88 // ostringstream sortie; 89 // // sortie << elementName_.getElementType() << endl; 90 // sortie << elementName_.getGenericLabel() << endl; 91 // sortie << specificName_ << endl; 92 // sortie << lenghtElem_ << " " << aperture_<< " " << B0_ << " " << varyB0_ << endl; 93 // return sortie.str(); 94 // } 95 95 96 96 … … 110 110 } 111 111 112 void elementSoleno::FileInput(ifstream& ifs)113 {114 ifs >> specificName_;115 ifs >> lenghtElem_ >> aperture_ >> B0_ >> varyB0_ ;116 }112 // void elementSoleno::FileInput(ifstream& ifs) 113 // { 114 // ifs >> specificName_; 115 // ifs >> lenghtElem_ >> aperture_ >> B0_ >> varyB0_ ; 116 // } 117 117 118 118 string elementSoleno::print() … … 133 133 void elementSoleno::InputRep(UAPNode* root) 134 134 { 135 UAPNode* ele = root->addChild("element"); 136 ele->addAttribute("name",specificName_); 135 // UAPNode* ele = root->addChild("element"); 136 // ele->addAttribute("name",specificName_); 137 UAPNode* ele = setAMLelementHeader(root); 137 138 138 139 string txt = ""; … … 158 159 } 159 160 } 161 162 void elementSoleno::FileAMLInput(UAPNode* entree) 163 { 164 if ( !checkAMLelementGenericName(entree) ) return; 165 AMLtools::readAMLParameterAttribut(entree, "length", "design", lenghtElem_); 166 167 UAPNode* ouverture = entree->getChildByName("aperture"); 168 if ( !ouverture ) { 169 cout << " elementSoleno::FileAMLInput ERREUR pas de noeud AML <aperture> " << endl; 170 return; 171 } 172 AMLtools::readAMLParameterAttribut(ouverture, "xy_limit", "design", aperture_); 173 UAPNode* solenoide = entree->getChildByName("solenoid"); 174 if ( !solenoide ) { 175 cout << " elementSoleno::FileAMLInput ERREUR pas de noeud AML <solenoide> " << endl; 176 return; 177 } 178 AMLtools::readAMLParameterAttribut(solenoide, "ksol", "design", B0_); 179 string vrai; 180 AMLtools::readAMLParameterAttribut(solenoide, "vary", "is_on", vrai); 181 if ( vrai == string("true")) varyB0_ = true; 182 else varyB0_ = false; 183 } -
Interface_Web/trunk/pspaWT/sources/controler/src/globalParameters.cc
r436 r488 4 4 #include "globalParameters.h" 5 5 #include "mixedTools.h" 6 #include "AMLtools.h" 6 7 7 8 globalParameters::globalParameters() : parametersString_(NULL) … … 42 43 } 43 44 44 string globalParameters::FileOutputFlow() const 45 // string globalParameters::FileOutputFlow() const 46 // { 47 // ostringstream sortie; 48 // sortie << " globals " << endl; 49 // sortie << frequency_ << " " << integrationStep_ << " " << nstepsMax_ << " " << nsc_ << endl; 50 // return sortie.str(); 51 // } 52 53 // void globalParameters::FileInput(ifstream& ifs) 54 // { 55 // ifs >> frequency_ >> integrationStep_ >> nstepsMax_ >> nsc_; 56 // } 57 58 59 60 void globalParameters::FileAMLInput(UAPNode* entree) 45 61 { 46 ostringstream sortie; 47 sortie << " globals " << endl; 48 sortie << frequency_ << " " << integrationStep_ << " " << nstepsMax_ << " " << nsc_ << endl; 49 return sortie.str(); 62 AMLtools::readAMLParameterAttribut(entree, "ref_freq", "design", frequency_); 63 AMLtools::readAMLParameterAttribut(entree, "integrationStep", "value", integrationStep_); 64 AMLtools::readAMLParameterAttribut(entree, "nSteps", "value", nstepsMax_); 65 AMLtools::readAMLParameterAttribut(entree, "nsc", "value", nsc_); 66 // cout << " PARAMETRES GLOBAUX : " << FileOutputFlow() << endl; 50 67 } 51 68 52 void globalParameters::FileInput(ifstream& ifs) 53 { 54 ifs >> frequency_ >> integrationStep_ >> nstepsMax_ >> nsc_; 55 } 69 70 56 71 57 72 void globalParameters::InputRep(UAPNode* root) -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_abstractElement.h
r437 r488 57 57 58 58 void updateLabelAndToolTipWidget(); 59 void FileInput(ifstream& ifs);59 // void FileInput(ifstream& ifs); 60 60 61 61 WContainerWidget* getWidget(); -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h
r481 r488 76 76 77 77 bool removePathFromConfigName(string& config); 78 bool removeExtensionFromConfigName(string& config );78 bool removeExtensionFromConfigName(string& config, string extension); 79 79 void createAccelerator(); 80 80 -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_abstractElement.cc
r485 r488 122 122 } 123 123 124 void GWt_abstractElement::FileInput(ifstream& ifs)125 {126 getAbstractElement()->FileInput(ifs);127 initilializeDialog();128 updateLabelAndToolTipWidget();124 // void GWt_abstractElement::FileInput(ifstream& ifs) 125 // { 126 // getAbstractElement()->FileInput(ifs); 127 // initilializeDialog(); 128 // updateLabelAndToolTipWidget(); 129 129 130 // update parameters131 GWt_ligneFaisceau* ligneFaisceau = NULL;132 if ( static_cast<GWt_ligneFaisceau*> (wApp->findWidget ("ligneFaisceau"))) {133 ligneFaisceau = static_cast<GWt_ligneFaisceau*> (wApp->findWidget ("ligneFaisceau"));134 ligneFaisceau->update();135 }136 }130 // // update parameters 131 // GWt_ligneFaisceau* ligneFaisceau = NULL; 132 // if ( static_cast<GWt_ligneFaisceau*> (wApp->findWidget ("ligneFaisceau"))) { 133 // ligneFaisceau = static_cast<GWt_ligneFaisceau*> (wApp->findWidget ("ligneFaisceau")); 134 // ligneFaisceau->update(); 135 // } 136 // } 137 137 138 138 abstractElement* GWt_abstractElement::getAbstractElement() { -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc
r485 r488 287 287 //globalParam_->updateGlobals(); 288 288 289 // dtmanage_->saveConfiguration(nameOfCase_); 290 dtmanage_->saveConfiguration(sessionId(),nameOfCase_); 289 // dtmanage_->saveConfiguration(sessionId(),nameOfCase_); 291 290 292 291 // en test: j'ajoute la sauvegarde sur .aml … … 308 307 removePathFromConfigName(nameOfCase_); 309 308 cout << " nom sans path " << nameOfCase_ << endl; 310 removeExtensionFromConfigName(nameOfCase_); 309 removeExtensionFromConfigName(nameOfCase_, string(".aml")); 310 // removeExtensionFromConfigName(nameOfCase_, string(".save")); 311 311 cout << " nom sans extension " << nameOfCase_ << endl; 312 312 if (nameOfCase_ == "") return; … … 314 314 dialogSave_ = NULL; 315 315 316 bool test = dtmanage_->restoreElements(fileName); 316 // bool test = dtmanage_->restoreElements(fileName); 317 bool test = dtmanage_->restoreAMLElements(fileName); 317 318 if ( !test ) { 318 319 GWt_dialog restoreWarning(" element restoring", "failure in restoring elements from file : " + fileName , GWt_dialog::Error, false,true); … … 364 365 string nomDuFichier = (uploadFileSelectorWidget_->clientFileName()).toUTF8(); 365 366 cout << " fichier client : " << nomDuFichier << endl; 366 bool test = removeExtensionFromConfigName(nomDuFichier );367 bool test = removeExtensionFromConfigName(nomDuFichier, string(".aml")); 367 368 cout << " fichier client sans extension : " << nomDuFichier << endl; 368 369 … … 371 372 console_->addConsoleMessage(string("restauration...")); 372 373 373 if ( !dtmanage_->restore Elements(uploadFileSelectorWidget_->spoolFileName()) ) {374 if ( !dtmanage_->restoreAMLElements(uploadFileSelectorWidget_->spoolFileName()) ) { 374 375 GWt_dialog restoreWarning(" element restoring", "failure in restoring elements !", GWt_dialog::Error, false,true); 375 376 restoreWarning.exec(); … … 582 583 } 583 584 584 bool PspaApplication::removeExtensionFromConfigName(string& config )585 bool PspaApplication::removeExtensionFromConfigName(string& config, string extension) 585 586 { 586 587 // string configName; 587 string extension(".save");588 // string extension(".save"); 588 589 bool test = true; 589 590 string::size_type nn = config.rfind('.'); -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_serverFileSelector.cc
r418 r488 59 59 treeFileRoot->setLoadPolicy(Wt::WTreeNode::NextLevelLoading); 60 60 61 buildConfigurationFileTree(treeFileRoot, workingDir_.c_str(), ".save"); 61 // buildConfigurationFileTree(treeFileRoot, workingDir_.c_str(), ".save"); 62 buildConfigurationFileTree(treeFileRoot, workingDir_.c_str(), ".aml"); 62 63 63 64 // Add user files 64 65 Wt::WTreeNode* userTreeFileRoot = new Wt::WTreeNode("MySession", folderIcon); 65 buildConfigurationFileTree(treeFileRoot, (workingDir_+WApplication::instance()->sessionId()).c_str(), ".save"); 66 // buildConfigurationFileTree(treeFileRoot, (workingDir_+WApplication::instance()->sessionId()).c_str(), ".save"); 67 buildConfigurationFileTree(treeFileRoot, (workingDir_+WApplication::instance()->sessionId()).c_str(), ".aml"); 66 68 67 69 treeFileRoot->expand();
Note: See TracChangeset
for help on using the changeset viewer.