Changeset 493 in PSPA
- Timestamp:
- Mar 11, 2014, 11:21:43 AM (10 years ago)
- Location:
- Interface_Web/trunk/pspaWT
- Files:
-
- 8 added
- 31 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/cmt/requirements
r488 r493 39 39 ../sources/controler/src/softwareGenerator.cc \ 40 40 ../sources/controler/src/softwareUsersprogram.cc \ 41 ../sources/controler/src/sectionToExecute.cc \42 41 ../sources/controler/src/softwareTest.cc \ 43 42 ../sources/controler/src/softwareMadx.cc \ … … 45 44 ../sources/controler/src/sectorParameters.cc \ 46 45 ../sources/controler/src/sector.cc \ 46 ../sources/controler/src/expandedMachine.cc \ 47 ../sources/controler/src/computingBlock.cc \ 47 48 ../sources/userInterface/src/GWt_elementCell.cc \ 48 49 ../sources/userInterface/src/GWt_elementRfgun.cc \ … … 70 71 ../sources/userInterface/src/GWt_serverFileSelector.cc \ 71 72 ../sources/userInterface/src/GWt_sector.cc \ 73 ../sources/userInterface/src/GWt_machine.cc \ 72 74 ../sources/userInterface/src/GWt_accelerator.cc \ 73 ../sources/userInterface/src/GWt_ sectionToExecute.cc75 ../sources/userInterface/src/GWt_computingBlock.cc 74 76 75 77 ####################################################################### -
Interface_Web/trunk/pspaWT/sources/controler/include/abstractSoftware.h
r485 r493 16 16 class dataManager; 17 17 class sectionToExecute; 18 18 class computingBlock; 19 19 class abstractSoftware 20 20 { … … 42 42 // void registerElement(nomdElements::typedElement nomdel,trivaluedBool b); 43 43 44 sectionToExecute* getSectionToExecute() { 45 return sectionToExecute_; 44 /* sectionToExecute* getSectionToExecute() { */ 45 /* return sectionToExecute_; */ 46 /* } */ 47 48 computingBlock* getComputingBlock() { 49 return compBlock_;; 46 50 } 47 51 48 52 public : 49 53 50 abstractSoftware(string, sectionToExecute*, dataManager* ); 54 // abstractSoftware(string, sectionToExecute*, dataManager* ); 55 abstractSoftware(string, computingBlock*, dataManager* ); 56 51 57 ~abstractSoftware() { 52 58 delete nameOfSoftware_; … … 74 80 } 75 81 private : 76 sectionToExecute* sectionToExecute_;77 82 // sectionToExecute* sectionToExecute_; 83 computingBlock* compBlock_; 78 84 }; 79 85 #endif -
Interface_Web/trunk/pspaWT/sources/controler/include/dataManager.h
r488 r493 14 14 #include "nomDeLogiciel.h" 15 15 #include "sector.h" 16 #include "expandedMachine.h" 17 #include "computingBlock.h" 16 18 17 19 #include "sectorParameters.h" //xx … … 24 26 public: 25 27 26 dataManager() {;} 28 dataManager() : 29 pspa_ (NULL), 30 currentMachine_(NULL) 31 {;} 27 32 dataManager(PspaApplication*); 28 33 virtual ~dataManager(); … … 33 38 particleBeam* getDiagnosticBeam_deprecated(string elementLabel); 34 39 40 41 //provisoire 42 inline expandedMachine* getCurrentMachine() {return currentMachine_;} 43 44 inline expandedMachine* expandMachine() { 45 if ( !currentMachine_ ) currentMachine_ = new expandedMachine(this); 46 currentMachine_->fromSectors( sectors_, this ); 47 return currentMachine_; 48 } 49 50 bool areDataCoherent() { 51 bool resultat = false; 52 if ( !currentMachine_ ) return false; 53 resultat = currentMachine_->areDataCoherent(); 54 return resultat; 55 } 56 57 35 58 /** Add a new sector 36 59 */ … … 39 62 /** return all sectors 40 63 */ 41 inline std::vector <sector*> getSectors() {return jobList_;};64 inline std::vector <sector*> getSectors() {return sectors_;}; 42 65 43 66 … … 60 83 void writeToAMLFile(string fileName); 61 84 62 /** return the jobListsize85 /** return the sectors size 63 86 */ 64 inline unsigned long getJobListSize() const {65 return jobList_.size();66 }87 // inline unsigned long getSectorsSize() const { 88 // return sectors_.size(); 89 // } 67 90 68 91 // si newBeam = true, on cree un nouveau diag … … 84 107 }; 85 108 86 109 abstractElement* getElementInSectorsByLabel(string etiq); 110 111 112 void messageEcran(string niveau, string msg) const; 113 114 115 87 116 private: 88 117 … … 92 121 vector<particleBeam> diagnosticBeam_; 93 122 vector<unsigned> indexElementToIndexDiag_; 94 vector <sector*> jobList_; 123 // vector <sector*> jobList_; 124 vector <sector*> sectors_; 125 expandedMachine* currentMachine_; 95 126 void removeFile(string nameOfFile); 96 127 }; -
Interface_Web/trunk/pspaWT/sources/controler/include/nomDeLogiciel.h
r486 r493 63 63 } 64 64 65 trivaluedBool doAcceptElement(nomdElements::typedElement typdel) ;65 trivaluedBool doAcceptElement(nomdElements::typedElement typdel) const; 66 66 67 67 -
Interface_Web/trunk/pspaWT/sources/controler/include/sector.h
r483 r493 10 10 11 11 12 class sectionToExecute;12 //class sectionToExecute; 13 13 class abstractElement; 14 14 class dataManager; … … 60 60 Return the vector of sectionToExecute of this 61 61 */ 62 inline std::vector <sectionToExecute*> getSectionsToExecute() { return sectionToExecute_;};63 62 // inline std::vector <sectionToExecute*> getSectionsToExecute() { return sectionToExecute_;}; 63 inline std::vector <abstractElement*>& getElements() { return elements_;}; 64 64 /** 65 65 Add a sectionToExecute 66 66 */ 67 inline void addSectionToExecute(sectionToExecute* s) {68 if (s) sectionToExecute_.push_back(s);69 };67 // inline void addSectionToExecute(sectionToExecute* s) { 68 // if (s) sectionToExecute_.push_back(s); 69 // }; 70 70 71 71 /** Add an element after another one. Will put it in the same sectionToExecuteList. If the element after is NULL … … 85 85 set the specific software for the given sectionToExecute number 86 86 */ 87 bool setSoftware(nomDeLogiciel, unsigned int sectionToExecuteNumber);87 // bool setSoftware(nomDeLogiciel, unsigned int sectionToExecuteNumber); 88 88 89 void clearSectionToExecute();89 // void clearSectionToExecute(); 90 90 /** Clear a specific jobList */ 91 void clearSectionToExecute(int a);91 //void clearSectionToExecute(int a); 92 92 93 93 void removeElement(abstractElement* currentElement); … … 105 105 } 106 106 107 108 bool isInside(abstractElement* previousElement); 109 107 110 private: 108 111 109 std::vector <sectionToExecute*> sectionToExecute_; 112 bool insertAfter(abstractElement* previousElement,abstractElement* currentElement); 113 114 115 116 117 std::vector<abstractElement*> elements_; 118 // std::vector <sectionToExecute*> sectionToExecute_; 119 110 120 particleBeam* currentBeam_; 111 121 -
Interface_Web/trunk/pspaWT/sources/controler/include/softwareGenerator.h
r472 r493 18 18 19 19 softwareGenerator(); 20 softwareGenerator(string inputFileName, sectionToExecute*, dataManager*); 20 // softwareGenerator(string inputFileName, sectionToExecute*, dataManager*); 21 softwareGenerator(string inputFileName, computingBlock*, dataManager*); 21 22 22 23 virtual ~softwareGenerator() {;} -
Interface_Web/trunk/pspaWT/sources/controler/include/softwareMadx.h
r484 r493 17 17 18 18 softwareMadx(); 19 softwareMadx(string,sectionToExecute*,dataManager*); 19 // softwareMadx(string,sectionToExecute*,dataManager*); 20 softwareMadx(string,computingBlock* ,dataManager*); 20 21 virtual ~softwareMadx() {;} 21 22 -
Interface_Web/trunk/pspaWT/sources/controler/include/softwareParmela.h
r481 r493 9 9 protected : 10 10 11 vector<int> relativeParmelaElementIndices_; 12 11 13 12 14 bool beamFromParmela(string workingDir,unsigned numeroElement, double referencefrequency, vector<double>& centroid, bareParticle& refPart,vector<bareParticle>& particles ); … … 14 16 bool beamToParmela(string workingDir, particleBeam* partic ); 15 17 18 void setRelativeParmelaElementIndices(); 16 19 17 20 string elementsData(const vector< pair<string, vector<string> > >& donnees) const ; … … 27 30 softwareParmela(); 28 31 29 softwareParmela(string inputFileName, sectionToExecute*, dataManager*); 32 // softwareParmela(string inputFileName, sectionToExecute*, dataManager*); 33 softwareParmela(string inputFileName, computingBlock*, dataManager*); 30 34 31 35 virtual ~softwareParmela() {;} -
Interface_Web/trunk/pspaWT/sources/controler/include/softwareTest.h
r472 r493 18 18 softwareTest(); 19 19 20 softwareTest(string inputFileName, sectionToExecute*, dataManager*); 20 // softwareTest(string inputFileName, sectionToExecute*, dataManager*); 21 softwareTest(string inputFileName, computingBlock*, dataManager*); 21 22 22 23 virtual ~softwareTest() {;} -
Interface_Web/trunk/pspaWT/sources/controler/include/softwareTransport.h
r472 r493 20 20 public : 21 21 softwareTransport(); 22 softwareTransport(string inputFileName, sectionToExecute*, dataManager*); 22 // softwareTransport(string inputFileName, sectionToExecute*, dataManager*); 23 softwareTransport(string inputFileName, computingBlock*, dataManager*); 23 24 24 25 virtual ~softwareTransport() {;} -
Interface_Web/trunk/pspaWT/sources/controler/include/softwareUsersprogram.h
r472 r493 13 13 public : 14 14 softwareUsersprogram(); 15 softwareUsersprogram(string inputFileName, sectionToExecute*, dataManager*); 15 // softwareUsersprogram(string inputFileName, sectionToExecute*, dataManager*); 16 softwareUsersprogram(string inputFileName, computingBlock*, dataManager*); 16 17 17 18 virtual ~softwareUsersprogram() {;} -
Interface_Web/trunk/pspaWT/sources/controler/src/abstractSoftware.cc
r485 r493 10 10 } 11 11 12 abstractSoftware::abstractSoftware(string inputFileName, sectionToExecute* sect, dataManager* data) 12 // abstractSoftware::abstractSoftware(string inputFileName, sectionToExecute* sect, dataManager* data) 13 // { 14 // inputFileName_ = inputFileName; 15 // // sectionToExecute_ = sect; 16 // compBlock_ = NULL; 17 // dataManager_ = data; 18 // nameOfSoftware_ = new nomDeLogiciel("unknownSoftware"); 19 // } 20 21 abstractSoftware::abstractSoftware(string inputFileName, computingBlock* cmpb, dataManager* data) 13 22 { 14 23 inputFileName_ = inputFileName; 15 sectionToExecute_ = sect;24 compBlock_ = cmpb; 16 25 dataManager_ = data; 26 cout << " abstractSoftware::abstractSoftware adresse manager " << dataManager_ << endl; 17 27 nameOfSoftware_ = new nomDeLogiciel("unknownSoftware"); 18 28 } 19 29 20 30 21 // void abstractSoftware::registerElement(nomdElements::typedElement nomdel,trivaluedBool b)22 // {23 // // std::cout << " abstractSoftware::registerElement soft : " << nameOfSoftware_.getString() << std::endl;24 // if (b == TBoolIgnore) {25 // // std::cout << " abstractSoftware::registerElement j'enregistre element " << nomdel << " ignore " << std::endl;26 // ignoredElements_.push_back(nomdel);27 // } else if (b == TBoolOk) {28 // // std::cout << " abstractSoftware::registerElement j'enregistre element " << nomdel << " OK " << std::endl;29 // acceptedElements_.push_back(nomdel);30 // }31 // }32 33 // trivaluedBool abstractSoftware::doAcceptElement(nomdElements::typedElement typdel)34 // {35 36 // //xx37 // if (acceptedElements_.size() == 0 && nameOfSoftware_ != nomDeLogiciel::unknownSoftware) {38 // return TBoolError;39 // }40 41 // if (std::find(acceptedElements_.begin(),acceptedElements_.end(),typdel) != acceptedElements_.end()) {42 // return TBoolOk;43 // }44 45 // if (ignoredElements_.size() == 0) {46 // return TBoolError;47 // }48 49 // if (std::find(ignoredElements_.begin(),ignoredElements_.end(),typdel) != ignoredElements_.end()) {50 // return TBoolIgnore;51 // }52 53 // return TBoolOk;54 // }55 31 56 32 bool abstractSoftware::launchJob(string commandLine, string& resul) -
Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc
r488 r493 5 5 #include "mathematicalConstants.h" 6 6 #include "PhysicalConstants.h" 7 #include "softwareUnknown.h" 7 8 8 9 #include "GWt_pspaApplication.h" … … 16 17 #include "AMLtools.h" 17 18 18 #define BAVARD 019 #define BAVARD 1 19 20 20 21 dataManager::dataManager(PspaApplication* pspa) : 21 pspa_ (pspa) 22 pspa_ (pspa), 23 currentMachine_(NULL) 22 24 {} 23 25 … … 25 27 { 26 28 unsigned k; 27 for (k=0; k < jobList_.size();k++) { 28 if ( jobList_[k] != NULL ) delete jobList_[k]; 29 } 29 for (k=0; k < sectors_.size();k++) { 30 if ( sectors_[k] != NULL ) delete sectors_[k]; 31 } 32 if ( currentMachine_ ) delete currentMachine_; 30 33 } 31 34 32 35 void dataManager::consoleMessage(string message) 33 36 { 37 cout << " passage console message : " << endl; 38 cout << message << endl; 34 39 GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console")); 35 40 if (console) console->addConsoleMessage(message + "\n"); 36 41 pspa_->processEvents(); 37 42 } 38 43 39 44 40 45 void dataManager::initializeExecution() … … 54 59 diagnosticBeam_.clear(); 55 60 indexElementToIndexDiag_.clear(); 56 for (unsigned int a=0; a< jobList_.size(); a++) {57 jobList_[a]->clearSectionToExecute();58 }61 // for (unsigned int a=0; a< jobList_.size(); a++) { 62 // jobList_[a]->clearSectionToExecute(); 63 // } 59 64 } 60 65 … … 80 85 81 86 // Main loop ! 82 cout << " dataManager::executeAll #jobList_= " << jobList_.size() << endl; 83 for(unsigned k = 0; k < jobList_.size(); k++) 84 { 85 sector* sector = jobList_[k]; 86 cout << " dataManager::executeAll sector name= " << sector->getName() << endl; 87 cout << " dataManager::executeAll #sectionsToExecute= " << sector->getSectionsToExecute().size() << endl; 87 cout << " dataManager::executeAll #sectors_= " << sectors_.size() << endl; 88 // expandedMachine machine; 89 // machine.fromJoblist(jobList_); 90 91 // vecteur de blocs de calcul 92 vector<computingBlock*> compblock = getCurrentMachine()->getComputingBlocks(); 93 cout << " dataManager::executeAll() : nb blocs de calcul : " << compblock.size() << endl; 94 95 particleBeam* computedBeam = sectors_[0]->getParticleBeam(); 96 97 98 // for(unsigned k = 0; k < jobList_.size(); k++) 99 // { 100 // sector* sector = jobList_[k]; 101 // cout << " dataManager::executeAll sector name= " << sector->getName() << endl; 102 // cout << " dataManager::executeAll #sectionsToExecute= " << sector->getSectionsToExecute().size() << endl; 88 103 89 104 // for the moment, we put everything in one line without loops 90 for(unsigned int l = 0; l < sector->getSectionsToExecute().size(); l++) 105 // for(unsigned int l = 0; l < sector->getSectionsToExecute().size(); l++) 106 for (unsigned int l = 0; l < compblock.size(); l++) 91 107 { 92 sectionToExecute* section = sector->getSectionsToExecute()[l]; 93 abstractSoftware* softw = section->getSoftware(); 94 108 abstractSoftware* softw = compblock.at(l)->getSoftware(); 95 109 cout << " execution du SOFWARE " << softw->getName() << endl; 96 cout << " adresse section " << section << endl;97 cout << " adresse faisceau " << sector->getParticleBeam() << endl;98 110 if (softw == NULL) { 99 111 success = false; … … 102 114 } 103 115 104 success = softw->createInputFile(sector->getParticleBeam(),workingDir); 116 // success = softw->createInputFile(sector->getParticleBeam(),workingDir); 117 cout << " dataManager::executeAll() APPEL softw->createInputFile " << endl; 118 success = softw->createInputFile(computedBeam,workingDir); 105 119 if ( success ) { 106 120 success = softw->execute(workingDir); … … 111 125 cout << " dataManager::executeAll success = " << success << " y-a-ty du faisceau : " << diagnosticBeam_.size() << endl; 112 126 if ( success && (diagnosticBeam_.size() > 0)) { 113 sector->setParticleBeam(&diagnosticBeam_.at(indexElementToIndexDiag_.back())); 127 // sector->setParticleBeam(&diagnosticBeam_.at(indexElementToIndexDiag_.back())); 128 computedBeam = &diagnosticBeam_.at(indexElementToIndexDiag_.back()); 114 129 cout << " dataManager::executeAll termine avec succes " << endl; 115 130 } else { 116 sector->setParticleBeam(NULL); 131 // sector->setParticleBeam(NULL); 132 computedBeam = NULL; 117 133 cout << " dataManager::executeAll termine en ECHEC " << endl; 118 134 } … … 121 137 #if BAVARD > 0 122 138 cout << "dataManager::executeAll #diagnosticBeam= " << diagnosticBeam_.size() << endl; 123 cout << "dataManager::executeAll #getBeamLineSize()= " << getBeamLineSize() << endl; 124 std::vector< abstractElement* > elements = section->getElements(); 125 for (unsigned j = 0; j < elements.size(); j++) { 126 cout << "[" << j << "] " << elements[j]->getNomdElement().getExpandedName() << endl; 139 // cout << "dataManager::executeAll #getBeamLineSize()= " << getBeamLineSize() << endl; 140 // std::vector< abstractElement* > elements = section->getElements(); 141 // std::vector< abstractElement* > elements = compblock.at(l)->getElements(); 142 for (unsigned j = 0; j < compblock.at(l)->getNumberOfElements(); j++) { 143 cout << "[" << j << "] " << compblock.at(l)->getElement(j)->getNomdElement().getExpandedName() << endl; 127 144 } 128 145 #endif 129 146 } //l 130 } //k147 // } //k 131 148 132 149 // if ( currentBeam_deprecated_ ) { … … 179 196 // } 180 197 198 199 200 201 202 181 203 // ecriture sur fichier AML 182 204 void dataManager::writeToAMLFile(string fileName) … … 199 221 //sectorParam_.InputRep(lab); 200 222 201 // sequence of elements 202 UAPNode* sect = lab->addChild("sector"); 203 sect->addAttribute("name","a_sect"); 204 205 abstractElement* elPtr; 206 for (unsigned k = 0; k < jobList_.size(); k++) { 207 sector* sector = jobList_[k]; 208 for (unsigned l = 0; l < sector->getSectionsToExecute().size(); l++) { 209 sectionToExecute* section = sector->getSectionsToExecute()[l]; 210 for (unsigned m = 0; m < section->getElements().size(); m++) { 211 elPtr = section->getElements()[m]; 212 elPtr->InputRep(sect); 213 } 214 } 215 } 223 // sequence of sectors with elements 224 225 for ( unsigned k=0; k < sectors_.size(); k++) { 226 sector* secteur = sectors_.at(k); 227 UAPNode* sect = lab->addChild("sector"); 228 sect->addAttribute("name",secteur->getName()); 229 abstractElement* elPtr; 230 for ( unsigned j=0; j < secteur->getElements().size(); j++) { 231 elPtr = secteur->getElements().at(j); 232 elPtr->InputRep(sect); 233 } 234 } 235 236 if ( currentMachine_ ) currentMachine_->FileAMLOutput(lab); 216 237 cout << "!Create the AML file ---------------------------" << endl; 217 238 AMLReader reader; … … 220 241 } 221 242 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 boucle237 238 // // Clear the BeamLine239 // 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 // // END256 // } 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 // }// while267 268 // #if BAVARD > 1269 // /* 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 // #endif276 277 // infile.close();278 // return true;279 // }280 243 281 244 bool dataManager::restoreAMLElements(string inputFileName) … … 296 259 297 260 NodeVec laboratories = uap_root->getSubNodesByName(string("laboratory")); 298 cout << " dataManager::restoreAMLElements nombre de <laboratory> : " << laboratories.size() << endl;261 // cout << " dataManager::restoreAMLElements nombre de <laboratory> : " << laboratories.size() << endl; 299 262 300 263 uap_labname = *laboratories.begin(); … … 302 265 if ( !uap_labname ) { 303 266 cout << " dataManager::restoreAMLElements : fichier non conforme, on ne trouve pas <laboratory...> " << endl; 304 } else {305 cout << " dataManager::restoreAMLElements : GO !" << endl;267 // } else { 268 // cout << " dataManager::restoreAMLElements : GO !" << endl; 306 269 } 307 270 … … 310 273 311 274 // Clear the BeamLine 312 jobList_.clear();275 sectors_.clear(); 313 276 314 277 // FIXME : For test purpose !!! 315 sector* mySect = addNewSector(); 316 278 // sector* mySect = addNewSector(); 279 // if ( currentMachine_ ) delete currentMachine_; 280 // currentMachine_ = new expandedMachine(); 317 281 318 282 UAPNode* parametresGlobaux = uap_labname->getChildByName(string("global")); 319 283 if ( !parametresGlobaux ) { 320 284 cout << " dataManager::restoreAMLElements GLOBAUX NON TROUVES " << endl; 321 } else {322 cout << " dataManager::restoreAMLElements GENIAL ! " << endl;285 // } else { 286 // cout << " dataManager::restoreAMLElements GENIAL ! " << endl; 323 287 } 324 288 globParam_.raz(); … … 326 290 327 291 292 328 293 nomdElements::typedElement elementType; 329 294 string elementLabel; 330 abstractElement* nouveau = NULL;331 295 332 296 … … 337 301 return false; 338 302 } 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 303 for (NodeVecIter iterSect = sectorNode.begin(); iterSect != sectorNode.end(); iterSect++) { 304 UAPAttribute* att = (*iterSect)->getAttribute("name"); 305 if ( !att ) continue; 306 sectors_.push_back( new sector(this, att->getValue()) ); 307 NodeVec& listElem = (*iterSect)->getChildren(); 308 if ( !listElem.size() ) { 309 cout << " dataManager::restoreAMLElements WARNING lecture fichier secteur " << att->getValue() << " : pas d'elements ? " << endl; 310 } 311 abstractElement* nouveau = NULL; 312 for (NodeVecIter iterelem = listElem.begin(); iterelem != listElem.end(); iterelem++) { 313 314 string nomNoeud = (*iterelem)->getName(); 315 if ( nomNoeud != string("element") ) { 316 cout << " le secteur contient un non-element : " << nomNoeud << endl; 317 continue; 318 } 319 320 att = NULL; 321 att = (*iterelem)->getAttribute("name"); 322 323 324 string nomGenerique; 325 AMLtools::readAMLParameterAttribut(*iterelem, "description", "type", nomGenerique); 326 elementType = nomdElements::getTypeFromLabel(nomGenerique); 327 nouveau = sectors_.back()->addElementAfter(elementType,nouveau); 374 328 if ( nouveau == NULL ) { 375 329 cerr << " dataManager::restoreAMLElements() : restore element " << att->getValue() << " failed " << endl; 376 330 return false; 377 331 } else { 378 nouveau->FileAMLInput(*iter );332 nouveau->FileAMLInput(*iterelem); 379 333 } 380 } 381 382 334 } // iterelem 335 } // itersect 336 337 338 // cout << " dataManager::restoreAMLElements BILAN DES SECTEURS " << endl; 339 // for ( unsigned m=0; m < sectors_.size(); m++ ) { 340 // cout << " secteur " << m+1 << " nom : " << sectors_.at(m)->getName() << endl; 341 // for ( unsigned j=0; j<sectors_.at(m)->getElements().size(); j++) { 342 // cout << " el. : " << sectors_.at(m)->getElements().at(j)->getLabel() << endl; 343 // } 344 // } 345 346 NodeVec machine = uap_root->getSubNodesByName(string("machine")); 347 if ( !machine.size() ) { 348 cout << " dataManager::restoreAMLElements ne trouve pas de machine " << endl; 349 } else { 350 if ( machine.size() > 1 ) { 351 cout << " dataManager::restoreAMLElements PLUSIEURS MACHINES : cas non prevu " << endl; 352 } 353 // cout << " dataManager::restoreAMLElements il y a une machine a lire dans " << endl; 354 // cout << currentMachine_ << endl; 355 if ( !currentMachine_ ) currentMachine_ = new expandedMachine(this); 356 currentMachine_->FileAMLInput(machine.at(0)); 357 } 358 359 360 383 361 return true; 384 362 } … … 397 375 particleBeam* dataManager::getDiagnosticBeam_deprecated(string elementLabel) 398 376 { 377 if ( !currentMachine_ ) return NULL; 378 399 379 // FIXME : Devra etre changé par une récupération par "abstractElement" et non pas par label 400 380 unsigned int number = 0; 401 381 abstractElement* elPtr; 402 for (unsigned k = 0; k < jobList_.size(); k++) { 403 sector* sector = jobList_[k]; 404 for (unsigned l = 0; l < sector->getSectionsToExecute().size(); l++) { 405 sectionToExecute* section = sector->getSectionsToExecute()[l]; 406 for (unsigned m = 0; m < section->getElements().size(); m++) { 407 elPtr = section->getElements()[m]; 408 if (elPtr->getLabel() == elementLabel) { 409 return getDiagnosticBeam(number); 410 } 411 number ++; 382 383 for (unsigned k = 0; k < currentMachine_->getComputingBlocks().size(); k++) { 384 computingBlock* block = currentMachine_->getComputingBlocks().at(k); 385 for (unsigned m = 0; m < block->getNumberOfElements(); m++) { 386 elPtr = block->getElement(m); 387 if (elPtr->getLabel() == elementLabel) { 388 return getDiagnosticBeam(number); 412 389 } 413 } 414 } 390 number ++; 391 } 392 } 393 394 415 395 return NULL; 416 396 } 417 397 418 398 419 // on ne tient pas compte des elements "snapshot" presents dans la beamLine420 399 void dataManager::donneesRmsEnveloppe(string type,vector<double>& xcor,vector<double>& ycor, string& titre, string& legendx, string& legendy) 421 400 { … … 431 410 unsigned i = 0; 432 411 cout << " dataManager::donneesRmsEnveloppe " << endl; 433 // for (unsigned k = 0; k < getBeamLineSize(); k++) { 434 for (unsigned k = 0; k < jobList_.size(); k++) { 435 sector* sector = jobList_[k]; 436 for (unsigned l = 0; l < sector->getSectionsToExecute().size(); l++) { 437 sectionToExecute* section = sector->getSectionsToExecute()[l]; 438 for (unsigned m = 0; m < section->getElements().size(); m++) { 439 abstractElement* elPtr = section->getElements()[m]; 440 // if(elPtr->getNomdElement().getElementType() == snapshot) continue; 441 // if(elPtr->getNomdElement().getElementType() == fit) continue; 442 particleBeam* beamToDraw = getDiagnosticBeam(i); 443 if ( !beamToDraw->momentRepresentationOk() ) { 444 beamToDraw->buildMomentRepresentation(); 445 } 412 413 if ( !currentMachine_ ) { 414 cout << " dataManager::donneesRmsEnveloppe PAS DE MACHINE " << endl; 415 return; 416 } 417 418 for (unsigned k = 0; k < currentMachine_->getComputingBlocks().size(); k++) { 419 computingBlock* block = currentMachine_->getComputingBlocks().at(k); 420 for (unsigned m = 0; m < block->getNumberOfElements(); m++) { 421 abstractElement* elPtr = block->getElement(m); 422 particleBeam* beamToDraw = getDiagnosticBeam(i); 423 if ( !beamToDraw->momentRepresentationOk() ) { 424 beamToDraw->buildMomentRepresentation(); 425 } 446 426 447 longueur += elPtr->getLenghtOfElement(); 448 valeur = beamToDraw->getXmaxRms(); 449 cout << " dataManager::donneesRmsEnveloppe index = " << k << " longueur = " << longueur << " enveloppe : " << valeur << endl; 450 xcor.push_back(0.01*longueur); // on passe en metres 451 ycor.push_back(valeur); 452 i++; 453 } 454 } 455 } 427 longueur += elPtr->getLenghtOfElement(); 428 valeur = beamToDraw->getXmaxRms(); 429 cout << " dataManager::donneesRmsEnveloppe index = " << k << " longueur = " << longueur << " enveloppe : " << valeur << endl; 430 xcor.push_back(0.01*longueur); // on passe en metres 431 ycor.push_back(valeur); 432 i++; 433 } 434 } 435 436 437 438 439 // for (unsigned k = 0; k < jobList_.size(); k++) { 440 // sector* sector = jobList_[k]; 441 // for (unsigned l = 0; l < sector->getSectionsToExecute().size(); l++) { 442 // sectionToExecute* section = sector->getSectionsToExecute()[l]; 443 // for (unsigned m = 0; m < section->getElements().size(); m++) { 444 // abstractElement* elPtr = section->getElements()[m]; 445 // // if(elPtr->getNomdElement().getElementType() == snapshot) continue; 446 // // if(elPtr->getNomdElement().getElementType() == fit) continue; 447 // particleBeam* beamToDraw = getDiagnosticBeam(i); 448 // if ( !beamToDraw->momentRepresentationOk() ) { 449 // beamToDraw->buildMomentRepresentation(); 450 // } 451 452 // longueur += elPtr->getLenghtOfElement(); 453 // valeur = beamToDraw->getXmaxRms(); 454 // cout << " dataManager::donneesRmsEnveloppe index = " << k << " longueur = " << longueur << " enveloppe : " << valeur << endl; 455 // xcor.push_back(0.01*longueur); // on passe en metres 456 // ycor.push_back(valeur); 457 // i++; 458 // } 459 // } 460 // } 461 456 462 legendy.clear(); 457 463 legendy = " x (cm) "; … … 468 474 469 475 sector* sect = new sector(this, std::string("sector ") + result); 470 jobList_.push_back(sect);476 sectors_.push_back(sect); 471 477 return sect; 472 478 } 473 479 480 abstractElement* dataManager::getElementInSectorsByLabel(string etiq) { 481 for ( unsigned k=0; k < sectors_.size(); k++) { 482 for ( unsigned j=0; j < sectors_.at(k)->getElements().size(); j++) { 483 if ( etiq == sectors_.at(k)->getElements().at(j)->getLabel() ) return sectors_.at(k)->getElements().at(j); 484 } 485 } 486 return NULL; 487 } 488 489 490 void dataManager::messageEcran(string niveau, string msg) const { 491 GWt_dialog::iconType icon; 492 if ( niveau == "ERROR" ) { 493 icon = GWt_dialog::Error; 494 } else if ( niveau == "WARNING" ) { 495 icon = GWt_dialog::Warning; 496 } else if ( niveau == "INFO" ) { 497 icon = GWt_dialog::Info; 498 } else { 499 icon = GWt_dialog::NoIcon; 500 } 501 GWt_dialog checkConfigNameDialog(niveau, msg, icon,true,true); 502 checkConfigNameDialog.exec(); 503 } -
Interface_Web/trunk/pspaWT/sources/controler/src/elementSoleno.cc
r488 r493 5 5 elementSoleno::elementSoleno() : abstractElement() 6 6 { 7 cout << " passage constructeur elementSoleno " << endl;8 7 setDefaultValues(); 9 8 setDefaults(); -
Interface_Web/trunk/pspaWT/sources/controler/src/nomDeLogiciel.cc
r489 r493 81 81 void nomDeLogiciel::setCompatiblesElements() 82 82 { 83 //cout << " nomDeLogiciel::setCompatiblesElements() " << program_ << endl;84 83 switch (program_) 85 84 { … … 134 133 } 135 134 136 trivaluedBool nomDeLogiciel::doAcceptElement(nomdElements::typedElement typdel) 135 trivaluedBool nomDeLogiciel::doAcceptElement(nomdElements::typedElement typdel) const 137 136 { 138 //xx139 140 //cout << " nomDeLogiciel::doAcceptElement type : " << typdel << endl;141 //cout << " nomDeLogiciel::doAcceptElement nb el/ acc. " << acceptedElements_.size() << endl;142 137 if (acceptedElements_.size() == 0 ) { 143 138 return TBoolError; … … 156 151 } 157 152 158 return TBool Ok;153 return TBoolError; 159 154 } 160 155 -
Interface_Web/trunk/pspaWT/sources/controler/src/sector.cc
r487 r493 9 9 #include "sector.h" 10 10 11 #include "sectionToExecute.h"11 //#include "sectionToExecute.h" 12 12 #include "dataManager.h" 13 13 #include "elementDrift.h" … … 100 100 101 101 if (previousElement == NULL) { 102 if (sectionToExecute_.size() == 0) { 103 sectionToExecute_.push_back(new sectionToExecute(currentElement,NULL,dataManager_,this)); 104 } else { 105 sectionToExecute* section = sectionToExecute_.front(); 106 section->insertAtFirst(currentElement); 107 } 102 elements_.insert ( elements_.begin() ,currentElement); 103 // if (sectionToExecute_.size() == 0) { 104 // sectionToExecute_.push_back(new sectionToExecute(currentElement,NULL,dataManager_,this)); 105 // } else { 106 // sectionToExecute* section = sectionToExecute_.front(); 107 // section->insertAtFirst(currentElement); 108 // } 108 109 } else { 109 110 for (unsigned int i=0; i<sectionToExecute_.size(); i++) { 111 sectionToExecute* section = sectionToExecute_[i]; 112 if (section->insertAfter(previousElement,currentElement)) { 113 return; 114 } 115 } 116 } 117 } 118 119 void sector::removeElement(abstractElement* currentElement) { 120 if (currentElement == NULL) return; 121 122 for (unsigned int i=0; i<sectionToExecute_.size(); i++) { 123 sectionToExecute* section = sectionToExecute_[i]; 124 125 if (section->isInside(currentElement)) { 126 section->removeElement(currentElement); 127 } 110 insertAfter(previousElement,currentElement); 111 // for (unsigned int i=0; i<sectionToExecute_.size(); i++) { 112 // sectionToExecute* section = sectionToExecute_[i]; 113 // if (section->insertAfter(previousElement,currentElement)) { 114 // return; 115 // } 116 // } 128 117 } 129 118 } 130 119 131 120 132 void sector::clearSectionToExecute() 133 { 134 unsigned k; 135 for(k = 0; k < sectionToExecute_.size(); k++) 136 { 137 if ( sectionToExecute_[k] != NULL ) clearSectionToExecute(k); 121 bool sector::insertAfter(abstractElement* previousElement,abstractElement* currentElement) { 122 123 std::vector<abstractElement*>::iterator it; 124 for (it = elements_.begin(); it < elements_.end(); it++) { 125 if (*it == previousElement ) { 126 elements_.insert (it+1,currentElement); 127 return true; 128 } 138 129 } 139 sectionToExecute_.clear();130 return false; 140 131 } 141 132 142 void sector::clearSectionToExecute(int a) 143 { 144 cout << " dataManager::clearSectionToExecute : effacement de la section d'index = " << a << endl; 145 if (a < 0) return; 146 if (a >= (int)sectionToExecute_.size()) return; 133 bool sector::isInside(abstractElement* previousElement) { 134 for (unsigned int a=0; a< elements_.size(); a++) { 135 if (elements_[a] == previousElement ) { 136 return true; 137 } 138 } 139 return false; 140 } 141 142 143 144 void sector::removeElement(abstractElement* currentElement) { 145 if (currentElement == NULL) return; 146 std::vector<abstractElement*>::iterator it; 147 for (it = elements_.begin(); it < elements_.end(); it++) { 148 if (*it == currentElement ) { 149 elements_.erase(it); 150 return; 151 } 152 } 153 // for (unsigned int i=0; i<sectionToExecute_.size(); i++) { 154 // sectionToExecute* section = sectionToExecute_[i]; 155 156 // if (section->isInside(currentElement)) { 157 // section->removeElement(currentElement); 158 // } 159 // } 160 } 161 162 163 // void sector::clearSectionToExecute() 164 // { 165 // unsigned k; 166 // for(k = 0; k < sectionToExecute_.size(); k++) 167 // { 168 // if ( sectionToExecute_[k] != NULL ) clearSectionToExecute(k); 169 // } 170 // sectionToExecute_.clear(); 171 // } 172 173 // void sector::clearSectionToExecute(int a) 174 // { 175 // cout << " dataManager::clearSectionToExecute : effacement de la section d'index = " << a << endl; 176 // if (a < 0) return; 177 // if (a >= (int)sectionToExecute_.size()) return; 147 178 148 // lors de la creation de la section on a fait un 'new' d'un149 // softwareXXXX : on fait ici le 'delete'179 // // lors de la creation de la section on a fait un 'new' d'un 180 // // softwareXXXX : on fait ici le 'delete' 150 181 151 const abstractSoftware* soft = sectionToExecute_.at(a)->getSoftware();152 if ( soft != NULL ) delete soft;153 delete sectionToExecute_[a];154 sectionToExecute_.erase (sectionToExecute_.begin()+a);155 }182 // const abstractSoftware* soft = sectionToExecute_.at(a)->getSoftware(); 183 // if ( soft != NULL ) delete soft; 184 // delete sectionToExecute_[a]; 185 // sectionToExecute_.erase (sectionToExecute_.begin()+a); 186 // } -
Interface_Web/trunk/pspaWT/sources/controler/src/softwareGenerator.cc
r485 r493 12 12 } 13 13 14 softwareGenerator::softwareGenerator(string inputFileName, sectionToExecute* sect,dataManager* data) : abstractSoftware(inputFileName, sect,data) 14 // softwareGenerator::softwareGenerator(string inputFileName, sectionToExecute* sect,dataManager* data) : abstractSoftware(inputFileName, sect,data) 15 // { 16 // cout << " softwareUsersprogram::softwareGenerator ENREGISTREMENT " << endl; 17 // nameOfSoftware_ = new nomDeLogiciel("generator"); 18 // // registerElement(nomdElements::RFgun,TBoolOk); 19 // } 20 21 softwareGenerator::softwareGenerator(string inputFileName, computingBlock* cmpb,dataManager* data) : abstractSoftware(inputFileName, cmpb,data) 15 22 { 16 23 cout << " softwareUsersprogram::softwareGenerator ENREGISTREMENT " << endl; … … 21 28 bool softwareGenerator::createInputFile(particleBeam* beamBefore, string workingDir) 22 29 { 23 abstractElement* firstElement = get SectionToExecute()->getElements().front();30 abstractElement* firstElement = getComputingBlock()->getFirstElement(); 24 31 25 32 if ( firstElement->getNomdElement().getElementType() != nomdElements::RFgun ) { … … 93 100 bool result = true; 94 101 95 if ( get SectionToExecute()->getElements().size() != 1 ) {102 if ( getComputingBlock()->getNumberOfElements() != 1 ) { 96 103 dataManager_->consoleMessage(" softwareGenerator::buildBeamAfterElements : only one element (rfgun) must be calculated " ); 97 104 return false; -
Interface_Web/trunk/pspaWT/sources/controler/src/softwareMadx.cc
r487 r493 13 13 } 14 14 15 softwareMadx::softwareMadx(string inputFileName,sectionToExecute* sect, dataManager* data) : abstractSoftware(inputFileName,sect,data) 15 // softwareMadx::softwareMadx(string inputFileName,sectionToExecute* sect, dataManager* data) : abstractSoftware(inputFileName,sect,data) 16 // { 17 // nameOfSoftware_ = new nomDeLogiciel("madx"); 18 // } 19 20 softwareMadx::softwareMadx(string inputFileName,computingBlock* cmpb, dataManager* data) : abstractSoftware(inputFileName,cmpb,data) 16 21 { 17 22 nameOfSoftware_ = new nomDeLogiciel("madx"); … … 33 38 } 34 39 35 sector* sector= getSectionToExecute()->getSector();36 cout << " softwareMadx::createInputFile sector " << sector->getName() << endl;40 // sector* sector= getSectionToExecute()->getSector(); 41 // cout << " softwareMadx::createInputFile sector " << sector->getName() << endl; 37 42 /////////////////////////////////////////// 38 43 … … 40 45 string sbeam; 41 46 abstractElement* elPtr; 42 elPtr = getSectionToExecute()->getElements().front(); 47 // elPtr = getSectionToExecute()->getElements().front(); 48 elPtr = getComputingBlock()->getFirstElement(); 43 49 nomdElements::typedElement eType = elPtr->getNomdElement().getElementType(); 44 50 … … 85 91 ostringstream os; 86 92 os << "L: line=("; 87 unsigned nElts= getSectionToExecute()->getElements().size(); 93 // unsigned nElts= getSectionToExecute()->getElements().size(); 94 unsigned nElts= getComputingBlock()->getNumberOfElements(); 88 95 for(unsigned k = firstIndex; k < nElts; k++) 89 96 { 90 elPtr = getSectionToExecute()->getElements()[k]; 97 // elPtr = getSectionToExecute()->getElements()[k]; 98 elPtr = getComputingBlock()->getElement(k); 91 99 cout << " debug:: element [" << k << "] " << elPtr->getNomdElement().getExpandedName() << endl; 92 100 vector<statements> v= elPtr->parametersToSoftware(); … … 103 111 104 112 // relection and repetition /////////////// 105 os << "all: " << "line=(" << sector->getRepetitionNumber() << "*L);"; 113 // os << "all: " << "line=(" << sector->getRepetitionNumber() << "*L);"; 114 int bid = 1; 115 os << "all: " << "line=(" << bid << "*L);"; 106 116 /////////////////////////////////////////// 107 117 -
Interface_Web/trunk/pspaWT/sources/controler/src/softwareParmela.cc
r485 r493 13 13 } 14 14 15 softwareParmela::softwareParmela(string inputFileName,sectionToExecute* sect, dataManager* data) : abstractSoftware(inputFileName, sect, data) 15 // softwareParmela::softwareParmela(string inputFileName,sectionToExecute* sect, dataManager* data) : abstractSoftware(inputFileName, sect, data) 16 // { 17 // nameOfSoftware_ = new nomDeLogiciel("parmela"); 18 // cout << " CONSTRUCTEUR softwareParmela() COMPLET " << endl; 19 // } 20 21 softwareParmela::softwareParmela(string inputFileName,computingBlock* cmpb, dataManager* data) : abstractSoftware(inputFileName, cmpb, data) 16 22 { 17 23 nameOfSoftware_ = new nomDeLogiciel("parmela"); 18 cout << " CONSTRUCTEUR softwareParmela() COMPLET " << endl; 19 // registerElement(nomdElements::RFgun,TBoolOk); 20 // registerElement(nomdElements::drift,TBoolOk); 21 // registerElement(nomdElements::cell,TBoolOk); 22 // registerElement(nomdElements::bend,TBoolOk); 23 // registerElement(nomdElements::soleno,TBoolOk); 24 // registerElement(nomdElements::fit,TBoolIgnore); 25 // registerElement(nomdElements::snapshot,TBoolIgnore); 26 } 27 24 cout << " CONSTRUCTEUR softwareParmela() COMPLET avec COMPUTING BLOCK = " << cmpb << endl; 25 cout << " softwareParmela::CONSTRUCTEUR adresse mamager " << dataManager_ << endl; 26 cout << " softwareParmela::CONSTRUCTEUR adresse GLOBAUX " << dataManager_->getGlobalParameters() << endl; 27 } 28 29 void softwareParmela::setRelativeParmelaElementIndices() { 30 relativeParmelaElementIndices_.clear(); 31 32 relativeParmelaElementIndices_.resize(getComputingBlock()->getNumberOfElements(), -1); 33 cout << " setRelativeParmelaElementIndices() taille a priori : " << relativeParmelaElementIndices_.size() << endl; 34 abstractElement* elPtr = getComputingBlock()->getFirstElement(); 35 bool there_is_rfgun = (elPtr->getNomdElement().getElementType() == nomdElements::RFgun ); 36 37 // unsigned offsetNumElem; 38 // index du premier element de parmela 39 int id; 40 // les elements de parmela sont indexes de 1 Ã max, s'il n'y a pas de rfgun 41 if ( !there_is_rfgun ) { 42 id = 1; 43 // les elements de parmela sont indexes de 0 Ã max, s'il y a un rfgun 44 } else { 45 id = 0; 46 } 47 48 unsigned k; 49 unsigned curseur = 0; 50 // for ( k=numeroDeb_; k <= numeroFin_ ; k++ ) { 51 for ( k = 0; k < getComputingBlock()->getNumberOfElements(); k ++) { 52 abstractElement* elem = getComputingBlock()->getElement(k); 53 cout << " liste PARMELA no absolu " << k << " relatif provisoire " << relativeParmelaElementIndices_.at(curseur) << endl; 54 // if ( elem->is_accepted_by_software(nameOfSoftware_) == TBoolOk ) { 55 56 if ( getNomDeLogiciel()->doAcceptElement(elem->getNomdElement().getElementType()) == TBoolOk ) { 57 relativeParmelaElementIndices_.at(curseur) = id; 58 cout << " mis a " << id << endl; 59 id++; 60 } 61 curseur++; 62 } 63 } 28 64 29 65 30 66 bool softwareParmela::createInputFile(particleBeam* beamBefore, string workingDir) 31 67 { 68 69 cout << " softwareParmela::createInputFile ENTREE " << endl; 32 70 unsigned int k; 33 71 34 //setRelativeParmelaElementIndices();72 setRelativeParmelaElementIndices(); 35 73 string name = workingDir + inputFileName_; 36 74 ofstream outfile; … … 42 80 } 43 81 44 abstractElement* elPtr = getSectionToExecute()->getElements().front(); 82 // abstractElement* elPtr = getSectionToExecute()->getElements().front(); 83 84 abstractElement* elPtr = getComputingBlock()->getFirstElement(); 45 85 double initalKineticEnergy = 0.0; 86 46 87 bool there_is_rfgun = (elPtr->getNomdElement().getElementType() == nomdElements::RFgun ); 47 88 48 89 if ( !there_is_rfgun ) { 49 90 string nameOfInput = workingDir + "parin.input0"; … … 55 96 elPtr->setPhaseStep( dataManager_->getGlobalParameters()->getIntegrationStep() ); 56 97 initalKineticEnergy = elPtr->getInitialKineticEnergy(); 57 // les elements de parmela sont indexes de 0 Ã max, s'il y a un rfgun 58 } 59 98 } 99 60 100 outfile << "TITLE" << endl; 61 101 outfile << " titre provisoire " << endl; 62 102 outfile << "RUN /n0=1 /ip=999 /freq=" << dataManager_->getGlobalParameters()->getFrequency() << " /z0=0.0 /W0=" << initalKineticEnergy << " /itype=1" << endl; 63 103 outfile << "OUTPUT 0" << endl; 104 105 unsigned int premier = 0 ; 64 106 if ( there_is_rfgun ) { 65 107 outfile << elementsData(elPtr->parametersToSoftware()); 108 premier++; 66 109 } else { 67 110 outfile << "INPUT 0 /NP=" << beamBefore->getNbParticles() << endl; 68 111 } 69 70 // retrouver le sector !! 71 for ( k =1; k < getSectionToExecute()->getElements().size(); k++) 112 113 for ( k =premier++; k < getComputingBlock()->getNumberOfElements(); k++) 72 114 { 73 outfile << elementsData(get SectionToExecute()->getElements()[k]->parametersToSoftware());74 } 75 115 outfile << elementsData(getComputingBlock()->getElement(k)->parametersToSoftware()); 116 } 117 76 118 outfile << "ZOUT" << endl; 77 119 outfile << "START /wt=0.0 /dwt=" << dataManager_->getGlobalParameters()->getIntegrationStep() << " /nsteps=" << dataManager_->getGlobalParameters()->getNbSteps() << " nsc=" << dataManager_->getGlobalParameters()->getScPeriod() << " /nout=10" << endl; … … 121 163 122 164 unsigned curseur; 123 for ( unsigned int k=0; k < get SectionToExecute()->getElements().size() ; k++ ) {124 abstractElement* elem = get SectionToExecute()->getElements()[k];165 for ( unsigned int k=0; k < getComputingBlock()->getNumberOfElements() ; k++ ) { 166 abstractElement* elem = getComputingBlock()->getElement(k); 125 167 if ( elem == NULL ) { 126 168 dataManager_->consoleMessage(" softwareParmela::buildBeamAfterElements : null pointer on element " ); … … 129 171 130 172 curseur = k; 131 cout << " softwareParmela::buildBeamAfterElements : type element " << getSectionToExecute()->getElements()[curseur]->getNomdElement().getElementType() << endl; 132 if (!(nameOfSoftware_->doAcceptElement(getSectionToExecute()->getElements()[curseur]->getNomdElement().getElementType()) == TBoolOk)) { 133 134 cout << " softwareParmela::buildBeamAfterElements ELEMENT ETRANGER " << endl; 135 // if ( relativeParmelaElementIndices_.at(curseur) < 0 ) { 173 cout << " softwareParmela::buildBeamAfterElements : type element " << getComputingBlock()->getElement(curseur)->getNomdElement().getElementType() << endl; 174 175 176 // if (!(nameOfSoftware_->doAcceptElement(getComputingBlock()->getElements()[curseur]->getNomdElement().getElementType()) == TBoolOk)) { 177 178 if ( relativeParmelaElementIndices_.at(curseur) < 0 ) { 136 179 137 180 // si l'element doit etre ignore de parmela, on renvoie sur le diag precedent … … 149 192 double freq= dataManager_->getGlobalParameters()->getFrequency(); 150 193 unsigned numeroParmel; 151 //numeroParmel = (unsigned)relativeParmelaElementIndices_.at(curseur);152 numeroParmel = curseur;153 cout << " lecture PARMELA el no absolu " << k << " numero relatif " << numeroParmel << " nom " << elem->getNomdElement().getExpandedName() << endl;194 numeroParmel = (unsigned)relativeParmelaElementIndices_.at(curseur); 195 // numeroParmel = curseur; 196 cout << " lecture PARMELA el no relativement absolu " << k << " numero relatif " << numeroParmel << " nom " << elem->getNomdElement().getExpandedName() << endl; 154 197 // lecture sortie parmela 155 198 if(!beamFromParmela(workingDir,numeroParmel,freq,centroid,refPart,particles)) -
Interface_Web/trunk/pspaWT/sources/controler/src/softwareTest.cc
r485 r493 14 14 15 15 16 softwareTest::softwareTest(string inputFileName,sectionToExecute* sect, dataManager* data) : abstractSoftware(inputFileName, sect,data) 16 // softwareTest::softwareTest(string inputFileName,sectionToExecute* sect, dataManager* data) : abstractSoftware(inputFileName, sect,data) 17 // { 18 // nameOfSoftware_ = new nomDeLogiciel("test"); 19 // } 20 21 softwareTest::softwareTest(string inputFileName,computingBlock* cmpb, dataManager* data) : abstractSoftware(inputFileName, cmpb,data) 17 22 { 18 23 nameOfSoftware_ = new nomDeLogiciel("test"); … … 38 43 dataManager_->consoleMessage(" softwareTest::buildBeamAfterElements " ); 39 44 bool result = true; 40 for ( unsigned int k=0; k < get SectionToExecute()->getElements().size() ; k++ ) {45 for ( unsigned int k=0; k < getComputingBlock()->getNumberOfElements() ; k++ ) { 41 46 particleBeam* newDiag = dataManager_->updateCurrentDiagnostic(true); 42 47 // beams.push_back(particleBeam()); -
Interface_Web/trunk/pspaWT/sources/controler/src/softwareTransport.cc
r485 r493 11 11 } 12 12 13 softwareTransport::softwareTransport(string inputFileName,sectionToExecute* sect, dataManager* data) : abstractSoftware(inputFileName, sect,data) 13 // softwareTransport::softwareTransport(string inputFileName,sectionToExecute* sect, dataManager* data) : abstractSoftware(inputFileName, sect,data) 14 // { 15 // nameOfSoftware_ = new nomDeLogiciel("transport"); 16 // } 17 18 softwareTransport::softwareTransport(string inputFileName,computingBlock* cmpb, dataManager* data) : abstractSoftware(inputFileName, cmpb,data) 14 19 { 15 20 nameOfSoftware_ = new nomDeLogiciel("transport"); 16 // registerElement(nomdElements::beam,TBoolOk);17 // registerElement(nomdElements::drift,TBoolOk);18 // registerElement(nomdElements::bend,TBoolOk);19 // registerElement(nomdElements::soleno,TBoolOk);20 // registerElement(nomdElements::fit,TBoolOk);21 // registerElement(nomdElements::snapshot,TBoolIgnore);22 21 } 23 22 … … 26 25 27 26 28 abstractElement* premierEl = get SectionToExecute()->getElements().front();27 abstractElement* premierEl = getComputingBlock()->getFirstElement(); 29 28 30 29 // ceinture et bretelles … … 84 83 85 84 abstractElement* elPtr; 86 for (unsigned k = 0; k < get SectionToExecute()->getElements().size(); k++)85 for (unsigned k = 0; k < getComputingBlock()->getNumberOfElements(); k++) 87 86 { 88 elPtr = get SectionToExecute()->getElements()[k];87 elPtr = getComputingBlock()->getElement(k); 89 88 cout << "debug:: element [" << k << "] " << elPtr->getNomdElement().getExpandedName() << endl; 90 89 // outfile << elPtr->transportOutputFlow(); … … 142 141 bool result = true; 143 142 144 for (unsigned k = 0; k < get SectionToExecute()->getElements().size(); k++)143 for (unsigned k = 0; k < getComputingBlock()->getNumberOfElements(); k++) 145 144 { 146 abstractElement* ptr = get SectionToExecute()->getElements()[k];145 abstractElement* ptr = getComputingBlock()->getElement(k); 147 146 if ( ptr == NULL ) { 148 147 dataManager_->consoleMessage(" softwareTransport::buildBeamAfterElements : null pointer on element " ); -
Interface_Web/trunk/pspaWT/sources/controler/src/softwareUsersprogram.cc
r485 r493 10 10 } 11 11 12 softwareUsersprogram::softwareUsersprogram(string inputFileName, sectionToExecute* sect, dataManager* data) : abstractSoftware(inputFileName, sect,data) 12 // softwareUsersprogram::softwareUsersprogram(string inputFileName, sectionToExecute* sect, dataManager* data) : abstractSoftware(inputFileName, sect,data) 13 // { 14 // cout << " softwareUsersprogram::softwareUsersprogram ENREGISTREMENT " << endl; 15 // nameOfSoftware_ = new nomDeLogiciel("usersprogram"); 16 // // registerElement(nomdElements::snapshot,TBoolOk); 17 // } 18 19 softwareUsersprogram::softwareUsersprogram(string inputFileName, computingBlock* cmpb, dataManager* data) : abstractSoftware(inputFileName, cmpb,data) 13 20 { 14 21 cout << " softwareUsersprogram::softwareUsersprogram ENREGISTREMENT " << endl; … … 20 27 { 21 28 22 abstractElement* element = get SectionToExecute()->getElements().front();29 abstractElement* element = getComputingBlock()->getFirstElement(); 23 30 24 31 // Dans le cas où l'element n'est pas snapshot … … 99 106 // for (unsigned k = numeroDeb_; k <= numeroFin_; k++) 100 107 101 abstractElement* ptr = get SectionToExecute()->getElements().front();108 abstractElement* ptr = getComputingBlock()->getFirstElement(); 102 109 if ( ptr == NULL ) { 103 110 dataManager_->consoleMessage("ERROR softwareUsersprogram::buildBeamAfterElements : null pointer on element " ); -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_accelerator.h
r474 r493 27 27 virtual ~GWt_accelerator(); 28 28 inline WContainerWidget* getAcceleratorDetailledView() {return acceleratorDetailledView_;}; 29 inline WContainerWidget* getAcceleratorComputingView() {return acceleratorComputingView_;}; 29 30 inline WLayout* getAcceleratorGlobalViewLayout() {return acceleratorGlobalViewLayout_;}; 30 31 inline dataManager* getDataManager() { return dataManager_;}; … … 34 35 private : 35 36 WContainerWidget* acceleratorDetailledView_; 37 WContainerWidget* acceleratorComputingView_; 36 38 void addSector(); 37 39 void readConfiguration(); 40 void expandMachine(); 38 41 void run(); 39 42 void closeGraphicDialog(); -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h
r488 r493 18 18 #include "GWt_dialog.h" 19 19 #include "GWt_console.h" 20 #include "GWt_softwarePanel.h"20 //#include "GWt_softwarePanel.h" 21 21 #include "GWt_globalParameters.h" 22 22 #include "GWt_sectorParameters.h" -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_sector.h
r480 r493 8 8 #include "GWt_accelerator.h" 9 9 #include "GWt_ligneFaisceau.h" 10 //#include "GWt_softwarePanel.h" 10 11 11 12 using namespace Wt; … … 22 23 /* Return the controler sector element for this UI sector*/ 23 24 inline sector* getSectorControler() {return sectorControler_;}; 24 inline GWt_softwarePanel* getExecuteWidget() { 25 return executeWidget_; 26 } 25 26 // inline GWt_softwarePanel* getExecuteWidget() { 27 // return executeWidget_; 28 // } 29 27 30 /** 28 31 Get the accelerator for this sector … … 49 52 GWt_accelerator* UI_Accelerator_; 50 53 sector* sectorControler_; 51 GWt_softwarePanel* executeWidget_;54 // GWt_softwarePanel* executeWidget_; 52 55 53 56 }; -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_softwarePanel.h
r480 r493 7 7 // 8 8 9 #ifndef GWt_softwarePanel _SEEN10 #define GWt_softwarePanel _SEEN9 #ifndef GWt_softwarePanelBis_SEEN 10 #define GWt_softwarePanelBis_SEEN 11 11 12 12 #include <iostream> … … 20 20 21 21 class PspaApplication; 22 class GWt_ sector;22 class GWt_machine; 23 23 24 class GWt_softwarePanel : public WContainerWidget24 class GWt_softwarePanelBis : public WContainerWidget 25 25 { 26 26 public : 27 27 28 GWt_softwarePanel (dataManager*, GWt_sector*);29 virtual ~GWt_softwarePanel ();28 GWt_softwarePanelBis(dataManager*, GWt_machine*); 29 virtual ~GWt_softwarePanelBis(); 30 30 31 31 /** 32 32 Read all sectionToExecute from the controler and build a newsoftware panel with it 33 33 */ 34 void displayFromControler();35 void updateSections();34 void displayFromControler(); 35 // void updateSections(); 36 36 37 37 private : 38 38 39 bool updateSectionSelection(); 40 void addSectionToExecute(); 41 void deleteSectionToExecute(int section); 42 string getSelection(); 43 void fillComboWithElements(Wt::WComboBox* cBox); 39 // bool updateSectionSelection(); 40 void addComputingBlock(computingBlock* cpbl); 41 // void deleteComputingBlock(int section); 42 void deleteComputingBlock(computingBlock* cpbl); 43 // string getSelection(); 44 void fillComboWithElements(Wt::WComboBox* cBox); 44 45 45 46 /** Fill a ComboBox with the software list … … 47 48 */ 48 49 void fillComboWithSoftwares(Wt::WComboBox* cBox, std::string ); 49 Wt::WContainerWidget* createAddDeletePushButtons(int sectionIndex); 50 // Wt::WContainerWidget* createAddDeletePushButtons(int sectionIndex); 51 Wt::WContainerWidget* createAddDeletePushButtons(computingBlock* cpbl); 50 52 51 53 dataManager* dtmanage_; 52 WContainerWidget* contenuSections_;53 GWt_ sector* UIsector_;54 WContainerWidget* contenuSections_; 55 GWt_machine* UImachine_; 54 56 }; 55 57 #endif /* defined(__PSPA__GWt_softwarePanel__) */ -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_accelerator.cc
r474 r493 1 1 #include "GWt_accelerator.h" 2 2 #include "GWt_sector.h" 3 #include "GWt_machine.h" 3 4 4 5 #include <Wt/WLabel> … … 24 25 dataManager_(dt) 25 26 { 27 cout << " GWt_accelerator::GWt_accelerator CONSTRUCTION NOUVEL ACCELERATOR " << endl; 26 28 setObjectName("accelerator"); 27 29 addStyleClass("acceleratorPanel"); … … 58 60 addSectorParameters->setMinimumSize(32,32); 59 61 62 63 // expand machine 64 WPushButton* expandMachine = new WPushButton("init/expand machine",menu); 65 // set tooltips 66 expandMachine->setToolTip("expand the machine"); 67 // Set class for actions elements 68 expandMachine->setStyleClass("Button WhiteButton expand"); 69 expandMachine->setMaximumSize(128,32); 70 expandMachine->setMinimumSize(128,32); 71 72 // action 73 expandMachine->clicked().connect(this,&GWt_accelerator::expandMachine); 74 75 76 77 60 78 // Run 61 79 WPushButton* runParameters = new WPushButton("",menu); … … 84 102 85 103 WContainerWidget* acceleratorGlobalView = new WGroupBox("Global view",acceleratorScrollArea); 86 acceleratorDetailledView_ = new WGroupBox("Detailled view ",acceleratorScrollArea);87 104 acceleratorDetailledView_ = new WGroupBox("Detailled view of sector",acceleratorScrollArea); 105 acceleratorComputingView_ = new WGroupBox("Computing view",acceleratorScrollArea); 88 106 acceleratorGlobalViewLayout_= new WHBoxLayout(); 89 107 acceleratorGlobalView->setLayout(acceleratorGlobalViewLayout_); … … 121 139 if (sect.size() == 0) { 122 140 // Add the first sector 123 addSector();141 addSector(); 124 142 } else { 125 143 for (unsigned long a=0; a< sect.size(); a++) { … … 127 145 } 128 146 } 129 } 130 147 // cout << " INTERVENTION GWt_accelerator::readConfiguration " << endl; 148 // if ( dataManager_->getCurrentMachine() ) cout << " GWt_accelerator::readConfiguration nb elem. " << dataManager_->getCurrentMachine()->getNumberOfElements() << endl; 149 150 new GWt_machine(this, dataManager_->getCurrentMachine()); 151 } 152 153 void GWt_accelerator::expandMachine() { 154 cout << " coucou depuis GWt_accelerator::expandMachine() " << endl; 155 if (getDataManager()->expandMachine()) new GWt_machine(this, dataManager_->getCurrentMachine()); 156 } 131 157 132 158 void GWt_accelerator::run() 133 159 { 134 160 cout << "***********************************" << endl; 135 cout << " GWt_ softwarePanel::executer() " << endl<<endl;161 cout << " GWt_accelerator::executer() " << endl<<endl; 136 162 137 163 if (!areDataCoherent()) { … … 156 182 } 157 183 184 185 // recuperer les noms d'elements pour remplir les combos des menus de graphique 158 186 void GWt_accelerator::faireDessin() 159 187 { … … 161 189 choixHistoDessin_->clear(); 162 190 163 for (unsigned k = 0; k < getDataManager()->getSectors().size(); k++) { 164 sector* sector = getDataManager()->getSectors()[k]; 165 for (unsigned l = 0; l < sector->getSectionsToExecute().size(); l++) { 166 sectionToExecute* section = sector->getSectionsToExecute()[l]; 167 for (unsigned m = 0; m < section->getElements().size(); m++) { 168 169 abstractElement* elPtr = section->getElements()[m]; 170 // if(elPtr->getNomdElement().getElementType() == snapshot) continue; 171 191 if ( getDataManager()->getCurrentMachine() ) { 192 for (unsigned k = 0; k < getDataManager()->getCurrentMachine()->getComputingBlocks().size(); k++) { 193 computingBlock* cpblk = getDataManager()->getCurrentMachine()->getComputingBlocks().at(k); 194 for (unsigned l = 0; l < cpblk->getNumberOfElements(); l++) { 195 abstractElement* elPtr = cpblk->getElement(k); 172 196 choixElementDessin_->addItem(elPtr->getLabel()); 173 197 choixHistoDessin_->addItem(elPtr->getLabel()); … … 175 199 } 176 200 } 201 // for (unsigned k = 0; k < getDataManager()->getSectors().size(); k++) { 202 // sector* sector = getDataManager()->getSectors()[k]; 203 // for (unsigned l = 0; l < sector->getSectionsToExecute().size(); l++) { 204 // sectionToExecute* section = sector->getSectionsToExecute()[l]; 205 // for (unsigned m = 0; m < section->getElements().size(); m++) { 206 207 // abstractElement* elPtr = section->getElements()[m]; 208 // // if(elPtr->getNomdElement().getElementType() == snapshot) continue; 209 210 // choixElementDessin_->addItem(elPtr->getLabel()); 211 // choixHistoDessin_->addItem(elPtr->getLabel()); 212 // } 213 // } 214 // } 215 177 216 } 178 217 … … 675 714 // FIXME 676 715 cout << "***********************************" << endl; 677 cout << "** To be move in controler**" << endl;716 cout << "** GWt_accelerator::areDataCoherent() **" << endl; 678 717 cout << "***********************************" << endl; 679 return true; 680 #if BAVARD > 0 681 cout << "***********************************" << endl; 682 cout << " GWt_softwarePanel::areDataCoherent() " << endl<<endl; 683 #endif 684 685 bool caMarche = true; 718 if ( !dataManager_ ) return false; 719 return dataManager_->areDataCoherent(); 720 // return true; 721 722 // bool caMarche = true; 686 723 /* 687 724 // initialize dataManager … … 737 774 }//a 738 775 */ 739 return caMarche;740 } 741 776 // return caMarche; 777 } 778 -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_ligneFaisceau.cc
r483 r493 66 66 67 67 buildBeamLineWidget(); 68 getUISector()->getExecuteWidget()->displayFromControler(); 68 69 70 // getUISector()->getExecuteWidget()->displayFromControler(); 69 71 70 72 return UIabstractElement; … … 112 114 113 115 // FIXME 114 UI_sector_->getExecuteWidget()->updateSections();116 // UI_sector_->getExecuteWidget()->updateSections(); 115 117 } 116 118 … … 125 127 126 128 GWt_elementLigneFaisceau* elemLigneFaisceau = NULL; 127 for (unsigned int i =0; i< UI_sector_->getSectorControler()->getSectionsToExecute().size(); i++) { 128 std::vector <abstractElement*> abstractElem = UI_sector_->getSectorControler()->getSectionsToExecute()[i]->getElements(); 129 // for (unsigned int i =0; i< UI_sector_->getSectorControler()->getSectionsToExecute().size(); i++) { 130 // std::vector <abstractElement*> abstractElem = UI_sector_->getSectorControler()->getSectionsToExecute()[i]->getElements(); 131 std::vector <abstractElement*> abstractElem = UI_sector_->getSectorControler()->getElements(); 129 132 for (unsigned int j=0; j< abstractElem.size(); j++) { 130 133 131 elemLigneFaisceau = new GWt_elementLigneFaisceau(dataManager_, 134 // elemLigneFaisceau = new GWt_elementLigneFaisceau(dataManager_, 135 // this, 136 // abstractElem[j],UI_sector_->getSectorControler()->getSectionsToExecute()[i]->getSoftware()->getColor()); 137 138 139 elemLigneFaisceau = new GWt_elementLigneFaisceau(dataManager_, 132 140 this, 133 abstractElem[j],UI_sector_->getSectorControler()->getSectionsToExecute()[i]->getSoftware()->getColor()); 141 abstractElem[j],"#FFFFFF"); 142 143 134 144 135 145 // remove default text … … 150 160 151 161 } 152 } 162 // } 163 153 164 // remove last line 154 165 if (elemLigneFaisceau != NULL) { … … 171 182 172 183 buildBeamLineWidget(); 173 getUISector()->getExecuteWidget()->displayFromControler();184 // getUISector()->getExecuteWidget()->displayFromControler(); 174 185 /* 175 186 // remove Widget -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_sector.cc
r481 r493 116 116 117 117 // add the software panel 118 executeWidget_ = new GWt_softwarePanel(getAccelerator()->getDataManager(),this);119 vContainerLayout->addWidget(executeWidget_);118 // executeWidget_ = new GWt_softwarePanel(getAccelerator()->getDataManager(),this); 119 // vContainerLayout->addWidget(executeWidget_); 120 120 121 121 -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc
r481 r493 2 2 // PSPA 3 3 // 4 // Created by Garnier Laurent on 30/01/13. 5 // Copyright (c) 2013 Garnier Laurent. All rights reserved. 4 // Created by Garnier Laurent on 30/01/13.// Copyright (c) 2013 Garnier Laurent. All rights reserved. 6 5 // 7 6 … … 17 16 #include "GWt_dialog.h" 18 17 #include "GWt_console.h" 19 #include "GWt_ sector.h"18 #include "GWt_computingBlock.h" 20 19 #include "GWt_globalParameters.h" 21 20 #include "GWt_sectionToExecute.h" 22 21 #include "GWt_pspaApplication.h" 23 24 #define BAVARD 025 26 GWt_softwarePanel ::GWt_softwarePanel(dataManager* dataManager,GWt_sector* sect)22 #include "GWt_machine.h" 23 #define BAVARD 1 24 25 GWt_softwarePanelBis::GWt_softwarePanelBis(dataManager* dataManager,GWt_machine* mach) 27 26 : WContainerWidget(), 28 27 dtmanage_(dataManager), 29 UI sector_(sect)28 UImachine_(mach) 30 29 { 31 30 32 31 // le panel 33 32 WPanel *panelLogiciels = new WPanel(this); 34 panelLogiciels->setTitle(" sections of beam line for executing softwares ");33 panelLogiciels->setTitle(" Computing blocks "); 35 34 36 35 contenuSections_ = new WContainerWidget(); 37 36 contenuSections_->addWidget(new WBreak()); 38 37 contenuSections_->addWidget(new WBreak()); 39 displayFromControler(); 38 cout << " GWt_softwarePanelBis::GWt_softwarePanelBis DISPLAY SOFTWARE PANEL " << endl; 39 displayFromControler(); 40 40 41 41 panelLogiciels->setCentralWidget(contenuSections_); 42 42 } 43 43 44 GWt_softwarePanel ::~GWt_softwarePanel() {45 } 46 47 void GWt_softwarePanel ::displayFromControler()44 GWt_softwarePanelBis::~GWt_softwarePanelBis() { 45 } 46 47 void GWt_softwarePanelBis::displayFromControler() 48 48 { 49 #if BAVARD > 0 50 cout << "***********************************" << endl; 51 cout << " GWt_softwarePanel::addSectionToExecuteW() " << endl<<endl; 52 #endif 49 cout << " GWt_softwarePanelBis::displayFromControler() " << endl<<endl; 53 50 54 51 // Clear all 55 52 contenuSections_->clear(); 56 57 // Get all sectionsToExecute from this sector 58 if (!UIsector_->getSectorControler()) { 53 54 55 // Get all sectionsToExecute from this machine 56 if (!UImachine_->getMachineControler()) { 57 cout << " GWt_softwarePanelBis::displayFromControler() PAS DE MACHINE " << endl; 59 58 return; 60 } 61 62 if (UIsector_->getSectorControler()->getSectionsToExecute().size() == 0) { 59 } else { 60 cout << " GWt_softwarePanelBis::displayFromControler() MACHINE TROUVEE " << endl; 61 } 62 63 if (UImachine_->getMachineControler()->getComputingBlocks().size() == 0) { 63 64 // FIXME : Add a message to tell the user to add first an element 65 cout << " GWt_softwarePanelBis::displayFromControler() PAS DE BLOCK " << endl; 64 66 } else { 65 66 unsigned int firstSectionToExecuteIndex = 0; 67 for (unsigned int a=0; a<UIsector_->getSectorControler()->getSectionsToExecute().size(); a++) { 67 cout << " GWt_softwarePanelBis::displayFromControler() NOMBRE DE BLOCK " << UImachine_->getMachineControler()->getComputingBlocks().size() << endl; 68 69 unsigned int firstElemeOfComputingBlockIndex = 0; 70 71 for (unsigned int a=0; a<UImachine_->getMachineControler()->getComputingBlocks().size(); a++) { 72 cout << " GWt_softwarePanelBis::displayFromControler() BLOC No " << a+1 << endl; 68 73 abstractElement* premierElement = NULL; 69 74 abstractElement* dernierElement = NULL; 70 71 75 std::string premierElementLabel = ""; 72 76 std::string dernierElementLabel = ""; 73 if (premierElement) { 74 premierElementLabel = premierElement->getLabel(); 77 78 if ( !UImachine_->getMachineControler()->getComputingBlocks()[a]->isEmpty() ) { 79 premierElement = UImachine_->getMachineControler()->getComputingBlocks()[a]->getFirstElement(); 80 firstElemeOfComputingBlockIndex = UImachine_->getMachineControler()->getComputingBlocks()[a]->getRankOfFirstElement(); 81 dernierElement = UImachine_->getMachineControler()->getComputingBlocks()[a]->getLastElement(); 75 82 } 76 if (dernierElement) { 77 dernierElementLabel = dernierElement->getLabel(); 78 } 83 84 85 if (premierElement) premierElementLabel = premierElement->getLabel(); 86 if (dernierElement) dernierElementLabel = dernierElement->getLabel(); 87 cout << " GWt_softwarePanelBis::displayFromControler() dernier element a afficher " << dernierElementLabel << endl; 79 88 80 89 WComboBox* lineFromCombo = new WComboBox(); … … 84 93 85 94 // set to first 86 lineFromCombo->setCurrentIndex(first SectionToExecuteIndex);95 lineFromCombo->setCurrentIndex(firstElemeOfComputingBlockIndex); 87 96 // set to last 88 lineToCombo->setCurrentIndex(firstSectionToExecuteIndex + (unsigned int)UIsector_->getSectorControler()->getSectionsToExecute()[a]->getElements().size() - 1); 89 97 lineToCombo->setCurrentIndex(UImachine_->getMachineControler()->getComputingBlocks()[a]->getRankOfLastElement()); 90 98 WComboBox* softCombo = new WComboBox(); 91 99 92 fillComboWithSoftwares(softCombo,UI sector_->getSectorControler()->getSectionsToExecute()[a]->getSoftware()->getName());100 fillComboWithSoftwares(softCombo,UImachine_->getMachineControler()->getComputingBlocks()[a]->getSoftware()->getName()); 93 101 94 102 // disable the "to" comboBox … … 96 104 97 105 // disable the first "from" comboBox 98 if (a==0) { 99 lineFromCombo->disable(); 106 // if (a==0) { 107 // lineFromCombo->disable(); 108 // } 109 110 // enable the last "to" comboBox 111 if (a==UImachine_->getMachineControler()->getComputingBlocks().size()-1) { 112 lineToCombo->enable(); 100 113 } 101 // disable the last "to" comboBox 102 if (a==UIsector_->getSectorControler()->getSectionsToExecute().size()-1) { 103 lineToCombo->disable(); 104 } 105 106 // Add the sectionToExecute Widget 107 GWt_sectionToExecute* newSection = new GWt_sectionToExecute(lineFromCombo,lineToCombo,softCombo,createAddDeletePushButtons(a),UIsector_->getSectorControler()->getSectionsToExecute()[a],UIsector_); 108 109 /* // FIXME ? 110 stringstream st; 111 st << UIsectionsToExecute_deprecated_.size(); 112 113 // this is the mean to identify this section! 114 newSection->setObjectName(st.str()); 115 116 // push back on sections vector 117 UIsectionsToExecute_deprecated_.push_back(newSection); 118 */ 119 contenuSections_->addWidget(newSection); 120 // updateSections(); 121 122 firstSectionToExecuteIndex += UIsector_->getSectorControler()->getSectionsToExecute()[a]->getElements().size(); 114 115 // // Add computingBlock Widget 116 117 // GWt_computingBlock* newBlock = new GWt_computingBlock(lineFromCombo,lineToCombo,softCombo,createAddDeletePushButtons(a),UImachine_->getMachineControler()->getComputingBlocks()[a],UImachine_); 118 computingBlock* blocPtr = UImachine_->getMachineControler()->getComputingBlocks()[a]; 119 GWt_computingBlock* newBlock = new GWt_computingBlock(lineFromCombo,lineToCombo,softCombo,createAddDeletePushButtons(blocPtr),blocPtr,UImachine_); 120 121 cout << " GWt_softwarePanelBis::displayFromControler j'ajoute un bloc : " << newBlock << endl; 122 cout << " GWt_softwarePanelBis::displayFromControler nb widget avant : " << contenuSections_->count() << endl; 123 contenuSections_->addWidget(newBlock); 124 cout << " GWt_softwarePanelBis::displayFromControler nb widget apres : " << contenuSections_->count() << endl; 125 123 126 } 124 127 } 125 } 126 127 void GWt_softwarePanel::updateSections() 128 { 129 #if BAVARD > 0 130 cout << "***********************************" << endl; 131 cout << " GWt_softwarePanel::updateSections() " << endl<<endl; 132 #endif 133 134 /* 135 // update all sections in order to manage new/deleted items 136 for (int a = 0; a < UIsectionsToExecute_deprecated_.size(); a++) { 137 fillComboWithElements(UIsectionsToExecute_deprecated_[a]->getFirstElement()); 138 fillComboWithElements(UIsectionsToExecute_deprecated_[a]->getLastElement()); 139 UIsectionsToExecute_deprecated_[a]->getFirstElement()->setEnabled (true); 140 UIsectionsToExecute_deprecated_[a]->getLastElement()->setEnabled (true); 141 } 142 143 if (UIsectionsToExecute_deprecated_;.size() == 0) { 128 } 129 130 void GWt_softwarePanelBis::fillComboWithElements(Wt::WComboBox* cBox) 131 { 132 133 if (cBox == NULL) return; 134 135 if (!UImachine_->getMachineControler()) { 144 136 return; 145 137 } 146 147 // the first element will always be the first element of the beamLine 148 UIsectionsToExecute_deprecated_[0]->getFirstElement()->setCurrentIndex(0); 149 UIsectionsToExecute_deprecated_[0]->getFirstElement()->setEnabled (false); 150 151 // the last element will always be the last element of the beamLine 152 UIsectionsToExecute_deprecated_[UIsectionsToExecute_deprecated_.size()-1]->getLastElement()->setCurrentIndex(UIsectionsToExecute_deprecated_[UIsectionsToExecute_deprecated_;.size()-1]->getLastElement()->count()); 153 UIsectionsToExecute_deprecated_[UIsectionsToExecute_deprecated_.size()-1]->getLastElement()->setEnabled(false); 154 155 // set default values 156 updateSectionSelection(); 157 */ 158 } 159 160 bool GWt_softwarePanel::updateSectionSelection() 161 { 162 #if BAVARD > 0 163 cout << "***********************************" << endl; 164 cout << " GWt_softwarePanel::updateSectionSelection() " << endl<<endl; 165 #endif 166 167 if ( dtmanage_->getJobListSize() == 0 ) return false; 168 169 // traitement de la premiere ligne 170 // on impose le depart du calcul au premier element 171 string premier = ""; 172 if (UIsector_->getSectorControler()) { 173 if (UIsector_->getSectorControler()->getSectionsToExecute().size() > 0) { 174 if (UIsector_->getSectorControler()->getSectionsToExecute()[0]->getElements().size() > 0) { 175 premier = UIsector_->getSectorControler()->getSectionsToExecute()[0]->getElements()[0]->getLabel(); 176 } 177 } 178 } 179 180 // FIXME : A réécrire 181 /* 182 if (UIsectionsToExecute_deprecated_.size() > 0) { 183 UIsectionsToExecute_deprecated_[0]->setFirstElementCurrentSelection(premier); 184 } 185 186 Wt::WString currentString = UIsectionsToExecute_deprecated_[0]->getLastElementCurrentText(); 187 int current = dtmanage_->getNumeroFromElementLabel(currentString.toUTF8()); 188 189 // si la fin est mal definie on prend toute la config par defaut 190 if ( current <= 0 || current > dtmanage_->getBeamLineSize() ) 191 { 192 current = dtmanage_->getBeamLineSize(); 193 currentString = dtmanage_->getLabelFromElementNumero(current); 194 if (UIsectionsToExecute_deprecated_.size() > 0) { 195 UIsectionsToExecute_deprecated_[0]->setLastElementCurrentSelection(currentString); 196 //... 197 } 198 } 199 current++; 200 currentString = dtmanage_->getLabelFromElementNumero(current); 201 202 // traitement des suivantes (on avance d'un cran dans la liste) 203 for (int a = 1; a< UIsectionsToExecute_deprecated_;.size(); a++) 204 { 205 // debut 206 if ( current > dtmanage_->getBeamLineSize() ) 207 { 208 UIsectionsToExecute_deprecated_;[a]->setErrors("This section element could not be after previous session last element"); 209 exec_go_->disable(); 210 return false; 211 } 212 213 UIsectionsToExecute_deprecated_;[a]->setFirstElementCurrentSelection(currentString); 214 215 // fin 216 string finString = UIsectionsToExecute_deprecated_;[a]->getLastElementCurrentText().toUTF8(); 217 218 int numeroFin = dtmanage_->getNumeroFromElementLabel( finString); 219 220 if ( numeroFin < current) 221 { 222 UIsectionsToExecute_deprecated_;[a]->setErrors("Last section element should be after first section element"); 223 exec_go_->disable(); 224 return false; 225 } 226 227 if (numeroFin > dtmanage_->getBeamLineSize()) 228 { 229 UIsectionsToExecute_deprecated_;[a]->setErrors("Last section element number is greater than the beam line size"); 230 exec_go_->disable(); 231 return false; 232 } 233 234 // preparation de la ligne suivante 235 current = numeroFin +1; 236 currentString = dtmanage_->getLabelFromElementNumero(current); 237 } 238 // exec_go_->setDisabled(false); 239 240 if (!areDataCoherent()) { 241 #if BAVARD > 0 242 cout << " GWt_softwarePanel::addSectionToExecuteW() DISABLE" << endl; 243 #endif 244 exec_go_->disable(); 245 } else { 246 #if BAVARD > 0 247 cout << " GWt_softwarePanel::addSectionToExecuteW() ENABLE" << endl; 248 #endif 249 exec_go_->enable(); 250 } 251 */ 252 return true; 253 } 254 255 256 void GWt_softwarePanel::addSectionToExecute() { 257 // We put the last element of the previous sectionToExecute inside 258 259 // Get the last element from previous section 260 if (!UIsector_->getSectorControler()) { 261 return; 262 } 263 unsigned long s = UIsector_->getSectorControler()->getSectionsToExecute().size(); 264 if (s > 0) { 265 abstractElement* abs = UIsector_->getSectorControler()->getSectionsToExecute()[s-1]->getLastElement(); 266 UIsector_->getSectorControler()->addSectionToExecute(new sectionToExecute(abs,NULL,dtmanage_,UIsector_->getSectorControler())); 267 UIsector_->getSectorControler()->getSectionsToExecute()[s-1]->removeLastElement(); 268 } 269 270 271 displayFromControler(); 272 UIsector_->getBeamLineWidget()->buildBeamLineWidget(); 273 } 274 275 276 void GWt_softwarePanel::deleteSectionToExecute(int sectionLabel) 277 { 278 #if BAVARD > 0 279 cout << "***********************************" << endl; 280 cout << " GWt_softwarePanel::deleteSectionToExecuteW()" << endl<<endl; 281 #endif 282 283 stringstream st; 284 st << sectionLabel; 285 std::string sectionName = st.str(); 286 //FIXME 287 288 /* if ( dtmanage_->getJobListSize() == 0 ) return; 289 for (unsigned int sectionIndex = 0; sectionIndex< UIsectionsToExecute_deprecated_.size(); sectionIndex++) { 290 if (UIsectionsToExecute_deprecated_[sectionIndex]->objectName() == sectionName) { 291 292 // delete from dataManager 293 UIsector_->getSectorControler()->clearSectionToExecute(sectionIndex); 294 295 // delete from User Interface 296 contenuSections_->removeWidget(UIsectionsToExecute_deprecated_[sectionIndex]); 297 delete UIsectionsToExecute_deprecated_[sectionIndex]; 298 UIsectionsToExecute_deprecated_.erase (UIsectionsToExecute_deprecated_.begin()+sectionIndex); 299 } 300 } 301 */ 302 displayFromControler(); 303 } 304 305 306 void GWt_softwarePanel::fillComboWithElements(Wt::WComboBox* cBox) 307 { 308 309 if (cBox == NULL) return; 310 311 if (!UIsector_->getSectorControler()) { 312 return; 313 } 314 for (unsigned int a=0; a < UIsector_->getSectorControler()->getSectionsToExecute().size(); a++) { 315 for(unsigned int b=0; b < UIsector_->getSectorControler()->getSectionsToExecute()[a]->getElements().size(); b++) { 316 317 abstractElement* abs = UIsector_->getSectorControler()->getSectionsToExecute()[a]->getElements()[b]; 138 for(unsigned int b=0; b < UImachine_->getMachineControler()->getElements().size(); b++) { 139 140 abstractElement* abs = UImachine_->getMachineControler()->getElements()[b]; 318 141 if (abs != NULL) { 319 142 cBox->addItem(abs->getLabel()); 320 143 } 321 144 } 322 } 323 } 324 325 void GWt_softwarePanel::fillComboWithSoftwares(Wt::WComboBox* cBox, std::string selected) 145 } 146 147 void GWt_softwarePanelBis::fillComboWithSoftwares(Wt::WComboBox* cBox, std::string selected) 326 148 { 327 149 #if BAVARD > 0 … … 344 166 } 345 167 346 Wt::WContainerWidget* GWt_softwarePanel::createAddDeletePushButtons(int sectionNumber) 168 169 Wt::WContainerWidget* GWt_softwarePanelBis::createAddDeletePushButtons(computingBlock* cpbl) 347 170 { 348 171 WContainerWidget* buttonContainer= new WContainerWidget(); … … 352 175 // preparation du bouton add 353 176 WPushButton* exec_add = new WPushButton("+"); 354 exec_add->clicked().connect(this, &GWt_softwarePanel::addSectionToExecute); 177 // exec_add->clicked().connect(this, &GWt_softwarePanelBis::addComputingBlock); 178 exec_add->clicked().connect(boost::bind(&GWt_softwarePanelBis::addComputingBlock, this, cpbl)); 355 179 exec_add->setStyleClass("roundButton"); 356 180 exec_add->setMaximumSize(20,20); … … 361 185 // warningsContainer_->setStyleClass("warningsContainer"); 362 186 363 exec_delete->clicked().connect(boost::bind(&GWt_softwarePanel ::deleteSectionToExecute, this, sectionNumber));187 exec_delete->clicked().connect(boost::bind(&GWt_softwarePanelBis::deleteComputingBlock, this, cpbl)); 364 188 exec_delete->setStyleClass("roundButton"); 365 189 exec_delete->setMaximumSize(20,20); … … 372 196 return buttonContainer; 373 197 } 198 199 void GWt_softwarePanelBis::addComputingBlock(computingBlock* cpbl) { 200 // We put the last element of the previous sectionToExecute inside 201 202 if (!UImachine_->getMachineControler()) { 203 return; 204 } 205 // UImachine_->getMachineControler()->openNewLastBlock(); 206 UImachine_->getMachineControler()->openNewBlockAfter(cpbl); 207 displayFromControler(); 208 } 209 210 211 // void GWt_softwarePanelBis::deleteComputingBlock(int sectionLabel) 212 // { 213 // cout << " GWt_softwarePanelBis::deleteComputingBlock()" << endl; 214 215 // stringstream st; 216 // st << sectionLabel; 217 // std::string sectionName = st.str(); 218 // //FIXME 219 // vector<computingBlock*>& compBloc = UImachine_->getMachineControler()->getComputingBlocks(); 220 // cout << " GWt_softwarePanelBis::deleteComputingBlock() nb blocs = " << compBloc.size() << endl; 221 // cout << " GWt_softwarePanelBis::deleteComputingBlock() nb widgets = " << sectionName << endl; 222 // cout << " GWt_softwarePanelBis::deleteComputingBlock() nom bloc a detruire = " << contenuSections_->count() << endl; 223 224 // for ( unsigned k=0; k < compBloc.size(); k++) { 225 226 // } 227 // /* if ( dtmanage_->getJobListSize() == 0 ) return; 228 // for (unsigned int sectionIndex = 0; sectionIndex< UIsectionsToExecute_deprecated_.size(); sectionIndex++) { 229 // if (UIsectionsToExecute_deprecated_[sectionIndex]->objectName() == sectionName) { 230 231 // // delete from dataManager 232 // UIsector_->getSectorControler()->clearSectionToExecute(sectionIndex); 233 234 // // delete from User Interface 235 // contenuSections_->removeWidget(UIsectionsToExecute_deprecated_[sectionIndex]); 236 // delete UIsectionsToExecute_deprecated_[sectionIndex]; 237 // UIsectionsToExecute_deprecated_.erase (UIsectionsToExecute_deprecated_.begin()+sectionIndex); 238 // } 239 // } 240 // */ 241 // displayFromControler(); 242 // } 243 244 void GWt_softwarePanelBis::deleteComputingBlock(computingBlock* cpbl) 245 { 246 cout << " GWt_softwarePanelBis::deleteComputingBlock(computingBlock*)" << endl; 247 248 UImachine_->getMachineControler()->eraseComputingBlock(cpbl); 249 displayFromControler(); 250 } -
Interface_Web/trunk/pspaWT/workingArea/philFit.aml
r488 r493 7 7 <nsc value = "0" /> 8 8 </global> 9 <sector name = " a_sect">9 <sector name = "sector 1"> 10 10 <element name = "rfgun01"> 11 11 <description type = "rfgun" /> … … 55 55 <length design = "3" /> 56 56 <aperture at = "EXIT" shape = "CIRCLE"> 57 <xy_limit design = "1e+ 61" />57 <xy_limit design = "1e+06" /> 58 58 </aperture> 59 59 <solenoid> 60 60 <ksol design = "1.0199" /> 61 <vary is_on = " false" />61 <vary is_on = "true" /> 62 62 </solenoid> 63 63 </element> … … 82 82 </bend> 83 83 </element> 84 </sector> 85 <sector name = "sector 2"> 84 86 <element name = "drift03"> 85 87 <description type = "drift" /> … … 94 96 </element> 95 97 </sector> 98 <machine name = "dummy"> 99 <machineElements> 100 <melement name = "rfgun01" /> 101 <melement name = "cell01" /> 102 <melement name = "drift01" /> 103 <melement name = "solnd01" /> 104 <melement name = "drift02" /> 105 <melement name = "bend01" /> 106 <melement name = "drift03" /> 107 <melement name = "fit01" /> 108 </machineElements> 109 <mcomputingBlocks> 110 <computingBlock> 111 <software name = "parmela" /> 112 <blocExtension rankOfFirstElement = "0" numberOfelements = "3" /> 113 </computingBlock> 114 <computingBlock> 115 <software name = "transport" /> 116 <blocExtension rankOfFirstElement = "3" numberOfelements = "5" /> 117 </computingBlock> 118 </mcomputingBlocks> 119 </machine> 96 120 </laboratory>
Note: See TracChangeset
for help on using the changeset viewer.