Changeset 313 in PSPA for Interface_Web
- Timestamp:
- Feb 5, 2013, 9:17:33 PM (11 years ago)
- Location:
- Interface_Web/trunk/pspaWT/sources
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/sources/controler/include/abstractSoftware.h
r312 r313 33 33 34 34 35 virtual bool execute(string inputFileName, unsigned int numeroDeb,unsigned int numeroFin,string workingDir ,string& resul) = 0;35 virtual bool execute(string inputFileName, unsigned int numeroDeb,unsigned int numeroFin,string workingDir) = 0; 36 36 37 37 virtual bool buildBeamAfterElements(unsigned int numeroDeb,unsigned int numeroFin, vector<particleBeam>& beams, string workingDir) = 0; -
Interface_Web/trunk/pspaWT/sources/controler/include/dataManager.h
r312 r313 21 21 dataManager(PspaApplication*); 22 22 virtual ~dataManager(); 23 23 void consoleMessage(string message); 24 24 int getBeamLineSize(); 25 25 inline globalParameters* getGlobalParameters() {return &globParam_;} … … 49 49 trivaluedBool checkExecute(string& diagnostic); 50 50 trivaluedBool checkElementsForExec(nomDeLogiciel logiciel, unsigned indexDeb, unsigned indexFin, string& diagnostic); 51 bool executeAll( string& resul);51 bool executeAll(); 52 52 void saveConfiguration(string nameOfFile); 53 53 bool restoreElements(string inputFileName); -
Interface_Web/trunk/pspaWT/sources/controler/include/softwareGenerator.h
r312 r313 27 27 28 28 29 virtual bool execute(string inputFileName,unsigned int numeroDeb,unsigned int numeroFin,string workingDir ,string& resul);29 virtual bool execute(string inputFileName,unsigned int numeroDeb,unsigned int numeroFin,string workingDir); 30 30 31 31 -
Interface_Web/trunk/pspaWT/sources/controler/include/softwareParmela.h
r312 r313 23 23 virtual bool createInputFile(string inputFileName, particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir); 24 24 25 virtual bool execute(string inputFileName,unsigned int numeroDeb,unsigned int numeroFin,string workingDir ,string& resul);25 virtual bool execute(string inputFileName,unsigned int numeroDeb,unsigned int numeroFin,string workingDir); 26 26 27 27 -
Interface_Web/trunk/pspaWT/sources/controler/include/softwareTransport.h
r312 r313 19 19 virtual bool createInputFile(string inputFileName, particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir); 20 20 21 virtual bool execute(string inputFileName,unsigned int numeroDeb,unsigned int numeroFin,string workingDir ,string& resul);21 virtual bool execute(string inputFileName,unsigned int numeroDeb,unsigned int numeroFin,string workingDir); 22 22 23 23 -
Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc
r312 r313 5 5 #include "softwareTransport.h" 6 6 #include "GWt_pspaApplication.h" 7 #include "GWt_console.h" 7 8 #include "softwareGenerator.h" 8 9 … … 28 29 } 29 30 31 void dataManager::consoleMessage(string message) { 32 GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console")); 33 if (console) console->addConsoleMessage(message); 34 } 30 35 31 36 string dataManager::getLabelFromElementNumero(int numero) … … 80 85 trivaluedBool dataManager::checkExecute(string& diagnostic) 81 86 { 82 83 87 cout << "dataManager::checkExecute()" << endl; 88 consoleMessage(" VERIFICATION AVANT EXECUTION "); 89 // console_ = static_cast<GWt_console*> (wApp->findWidget ("console")); 90 // if (console_) console_->addConsoleMessage(" VERIFICATION AVANT EXECUTION "); 91 84 92 trivaluedBool resul = ok; 85 93 unsigned k,j; … … 157 165 } 158 166 159 bool dataManager::executeAll( string &resul)167 bool dataManager::executeAll() 160 168 { 161 169 bool success = true; 162 resul.clear();163 string resultatPartiel;170 // resul.clear(); 171 // string resultatPartiel; 164 172 unsigned k; 165 173 abstractSoftware* softw =NULL; … … 169 177 int debut = jobList_[k]->firstElement; 170 178 int fin = jobList_[k]->lastElement; 171 resultatPartiel.clear();179 // resultatPartiel.clear(); 172 180 cout << " dataManager::executeAll je m'apprete a executer : " << (jobList_[k]->software).getString() << endl; 173 181 … … 184 192 } else { 185 193 success = false; 186 resultatPartiel = " unknown software -- STOP \n "; 194 consoleMessage("dataManager::executeAll : unknown software"); 195 // resultatPartiel = " unknown software -- STOP \n "; 187 196 break; 188 197 } 189 198 190 199 success = softw->createInputFile(inputFileName,currentBeam_, debut, fin, workingDir_); 191 if ( !success ) { 192 resultatPartiel += " error creating input file \n"; 193 } else { 194 success = softw->execute(inputFileName, debut,fin,workingDir_,resultatPartiel); 200 // if ( !success ) { 201 // resultatPartiel += " error creating input file \n"; 202 // } else { 203 if ( success ) { 204 success = softw->execute(inputFileName, debut,fin,workingDir_); 195 205 if ( success ) { 196 206 success = softw->buildBeamAfterElements(debut, fin, diagnosticBeam_, workingDir_); 197 if ( !success ) {198 resultatPartiel += " reading results failed \n";199 }207 // if ( !success ) { 208 // resultatPartiel += " reading results failed \n"; 209 // } 200 210 } 201 211 } … … 208 218 cout << " execute termine en ECHEC " << endl; 209 219 } 210 resul += resultatPartiel;220 // resul += resultatPartiel; 211 221 if ( !success ) break; 212 222 } -
Interface_Web/trunk/pspaWT/sources/controler/src/softwareGenerator.cc
r312 r313 29 29 30 30 if ( elPtr->getNomdElement().getElementType() != RFgun ) { 31 dataManager_->consoleMessage(" softwareGenerator::createInputFile : the element must be rfgun " ); 31 32 cerr << " softwareGenerator::createInputFile : the element must be rfgun" << endl; 32 33 return false; … … 36 37 outfile.open(name.c_str(), ios::out); 37 38 if (!outfile) { 39 dataManager_->consoleMessage(" softwareGenerator::createInputFile : error opening output stream " ); 38 40 cerr << " error opening output stream " << name << endl; 39 41 return false; … … 47 49 outfile << "/" << endl; 48 50 outfile.close(); 51 dataManager_->consoleMessage("fichier input termine pour GENERATOR"); 49 52 return true; 50 53 } 51 54 52 55 53 bool softwareGenerator::execute(string inputFileName, unsigned int numeroDeb,unsigned int numeroFin,string workingDir ,string& resul) {56 bool softwareGenerator::execute(string inputFileName, unsigned int numeroDeb,unsigned int numeroFin,string workingDir) { 54 57 ostringstream sortie; 55 58 bool ExecuteStatus = true; 56 resul.clear();59 // resul.clear(); 57 60 sortie << " EXECUTION DE GENERATOR DE l'ELEMENT " << numeroDeb << " A L'ELEMENT " << numeroFin << endl; 58 61 … … 87 90 } 88 91 } 89 resul = sortie.str(); 92 // resul = sortie.str(); 93 dataManager_->consoleMessage(sortie.str()); 90 94 return ExecuteStatus; 91 95 } … … 94 98 95 99 bool result = true; 96 if ( numeroDeb != numeroFin ) return false; 100 if ( numeroDeb != numeroFin ) { 101 dataManager_->consoleMessage(" softwareGenerator::buildBeamAfterElements : only one element (rfgun) must be calculated " ); 102 return false; 103 } 97 104 98 105 beams.push_back(particleBeam()); … … 104 111 beams.back().setWithParticles(centroid, refPart,particles); 105 112 } else { 113 dataManager_->consoleMessage(" softwareGenerator::buildBeamAfterElements : error " ); 106 114 result = false; 107 115 } … … 116 124 filefais = fopen(nomfilefais.c_str(), "r"); 117 125 if ( filefais == (FILE*)0 ) { 126 dataManager_->consoleMessage(" softwareGenerator::beamFromGenerator : error openig the file " + nomfilefais ); 118 127 cerr << " beamFromGenerator() erreur a l'ouverture du fichier" << nomfilefais << endl;; 119 128 return false; … … 130 139 { 131 140 if ( partic.index != 1 ) { 132 cout << " ERROR softwareGenerator::beamFromGenerator : particles are not electrons, we have to reconsider this method " << endl; 141 dataManager_->consoleMessage(" softwareGenerator::beamFromGenerator : particles are not electrons, we have to reconsider this method beamFromGenerator" ); 142 cout << " ERROR softwareGenerator::beamFromGenerator : particles are not electrons, we have to reconsider this method " << endl; 133 143 return false; 134 144 } … … 161 171 if ( faisceau.size() == 0) 162 172 { 173 dataManager_->consoleMessage(" softwareGenerator::beamFromGenerator : error no particle found" ); 163 174 cerr << " softwareGenerator::beamFromGenerator echec lecture " << endl; 164 175 return false; -
Interface_Web/trunk/pspaWT/sources/controler/src/softwareParmela.cc
r312 r313 22 22 23 23 if ( numeroDeb < 1 || numeroFin > dataManager_->getBeamLineSize() ) { 24 dataManager_->consoleMessage(" softwareParmela::createInputFile : numero of element out of limits " ); 24 25 cerr << " numero of element out of limits " << endl; 25 26 return false; 26 27 } 27 28 28 29 // unsigned indexDeb = numeroDeb - 1;30 // unsigned indexFin = numeroFin - 1;31 29 32 30 ofstream outfile; … … 34 32 outfile.open(name.c_str(), ios::out); 35 33 if (!outfile) { 36 cerr << " error opening output stream " << name << endl; 34 dataManager_->consoleMessage(" softwareParmela::createInputFile : error opening output stream " ); 35 cerr << " softwareParmela::createInputFile : error opening output stream " << name << endl; 37 36 return false; 38 37 } … … 75 74 outfile << "END" << endl; 76 75 outfile.close(); 76 dataManager_->consoleMessage("fichier input termine pour PARMELA"); 77 77 return true; 78 78 } 79 79 80 80 81 bool softwareParmela::execute(string inputFileName,unsigned int numeroDeb,unsigned int numeroFin,string workingDir ,string& resul)81 bool softwareParmela::execute(string inputFileName,unsigned int numeroDeb,unsigned int numeroFin,string workingDir) 82 82 { 83 83 ostringstream sortie; 84 84 bool ExecuteStatus = true; 85 resul.clear();85 // resul.clear(); 86 86 sortie << " EXECUTION DE PARMELA DE l'ELEMENT " << numeroDeb << " A L'ELEMENT " << numeroFin << endl; 87 87 … … 110 110 } 111 111 112 resul = sortie.str(); 112 // resul = sortie.str(); 113 dataManager_->consoleMessage(sortie.str()); 114 113 115 return ExecuteStatus; 114 116 } … … 132 134 } else { 133 135 // sortie << " reading parmdesz failed " << endl; 136 dataManager_->consoleMessage(" softwareParmela::buildBeamAfterElements : reading parmdesz failed " ); 134 137 result = false; 135 138 break; … … 154 157 155 158 if ( filefais == (FILE*)0 ) { 159 dataManager_->consoleMessage(" beamFromParmela() erreur a l'ouverture du fichier 'parmdesz'"); 156 160 cerr << " beamFromParmela() erreur a l'ouverture du fichier" << nomfilefais << endl;; 157 161 return false; … … 249 253 bool softwareParmela::beamToParmela(string workingDir, particleBeam* beam ) { 250 254 if ( !beam->particleRepresentationOk() ) { 255 dataManager_->consoleMessage("softwareParmela::beamToParmela : beam not in particles form : not yet programmed"); 251 256 cout << " softwareParmela::beamToParmela : beam not in particles form : not yet programmed " << endl; 252 257 return false; … … 256 261 outfile.open(name.c_str(), ios::out); 257 262 if (!outfile) { 263 dataManager_->consoleMessage(" softwareParmela::beamToParmela : error opening output stream "); 258 264 cerr << " softwareParmela::beamToParmela : error opening output stream " << name << endl; 259 265 return false; -
Interface_Web/trunk/pspaWT/sources/controler/src/softwareTransport.cc
r312 r313 21 21 unsigned int k; 22 22 if ( numeroDeb < 1 || numeroFin > dataManager_->getBeamLineSize() ) { 23 dataManager_->consoleMessage(" softwareTransport::createInputFile : numero of element out of limits " ); 23 24 cerr << " numero of element out of limits " << endl; 24 25 return false; 25 26 } 26 27 // unsigned indexDeb = numeroDeb - 1;28 // unsigned indexFin = numeroFin - 1;29 30 27 abstractElement* premierEl = NULL; 31 28 premierEl = dataManager_->getElementPointerFromNumero(numeroDeb); … … 43 40 if (!outfile) 44 41 { 42 dataManager_->consoleMessage(" softwareTransport::createInputFile : error opening output stream " ); 45 43 cerr << " error opening output stream " << name << endl; 46 44 return false; … … 59 57 // s'il n'y a pas faisceau courant, erreur 60 58 if ( beamBefore == NULL ) { 59 dataManager_->consoleMessage(" softwareTransport::createInputFile : no input beam " ); 61 60 cout << " pas de faisceau " << endl; 62 61 return false; … … 68 67 // on le met au format transport, s'il est deja au format 'particules' (par ex/ parmela) 69 68 if ( !beamBefore->particleRepresentationOk() ) { 69 dataManager_->consoleMessage(" softwareParmela::createInputFile : ca cafouille dans les representations de faisceau : ni particules, ni moments ? " ); 70 70 cout << " ca cafouille dans les representations de faisceau : ni particules, ni moments ? " << endl; 71 71 return false; … … 99 99 100 100 outfile.close(); 101 dataManager_->consoleMessage("fichier input termine pour TRANSPORT"); 101 102 return true; 102 103 } … … 104 105 105 106 106 bool softwareTransport::execute(string inputFileName, unsigned int numeroDeb, unsigned int numeroFin, string workingDir , string& resul)107 bool softwareTransport::execute(string inputFileName, unsigned int numeroDeb, unsigned int numeroFin, string workingDir) 107 108 { 108 109 ostringstream sortie; 109 resul.clear();110 // resul.clear(); 110 111 sortie << " EXECUTION DE TRANSPORT DE " << numeroDeb << " a " << numeroFin << endl; 111 // if ( !createInputFile( &beamAfterElement.back(), numeroDeb, numeroFin, workingDir) )112 // {113 // sortie << " error creating transport input file " << endl;114 // resul = sortie.str();115 // return false;116 // }117 112 118 113 bool ExecuteStatus = true; … … 151 146 } 152 147 } 153 resul = sortie.str(); 148 // resul = sortie.str(); 149 dataManager_->consoleMessage(sortie.str()); 154 150 return ExecuteStatus; 155 151 } … … 163 159 { 164 160 beams.push_back(particleBeam()); 165 // string elemLabel = getLabelFromElementNumero (k);166 161 167 162 abstractElement* ptr = dataManager_->getElementPointerFromNumero(k); 168 163 169 164 if ( ptr == NULL ) { 170 cout << " softwareTransport::buildBeamAfterElements pointeur nul sur element " << endl; 165 dataManager_->consoleMessage(" softwareTransport::buildBeamAfterElements : null pointer on element " ); 166 cout << " softwareTransport::buildBeamAfterElements : null pointer on element " << endl; 171 167 result = false; 172 168 break; … … 179 175 if (!moments2FromTransport(workingDir, elemLabel, ptr->getNomdElement(),transpMoments ) ) 180 176 { 177 dataManager_->consoleMessage(" softwareTransport::buildBeamAfterElements : failure in reading moments " ); 181 178 cout << " softwareTransport::buildBeamAfterElements plantage dans lecture moments " << endl; 182 179 result = false; … … 201 198 infile.open(nameIn.c_str(), ios::in); 202 199 if (!infile) { 200 dataManager_->consoleMessage(" softwareTransport::moments2FromTransport : error re-opening transport output stream "); 203 201 cerr << " dataManager::moments2FromTransport : error re-opening transport output stream " << nameIn << endl; 204 202 return false; … … 221 219 cout << " compteur= " << compteur << endl; 222 220 if ( compteur == 0 ) { 221 dataManager_->consoleMessage(" softwareTransport::moments2FromTransport : element"+elementLabel+"not found in the file "+nameIn); 223 222 cerr << " dataManager::moments2FromTransport : element " << elementLabel << " non trouve dans le fichier " << nameIn << endl; 224 223 return false; -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc
r312 r313 271 271 GWt_console* console = NULL; 272 272 if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) { 273 GWt_console*console = static_cast<GWt_console*> (wApp->findWidget ("console"));273 console = static_cast<GWt_console*> (wApp->findWidget ("console")); 274 274 console->addConsoleMessage(string("on va peut etre y arriver")); 275 275 } … … 283 283 wApp->processEvents(); 284 284 285 string resultat;286 if ( !dtmanage_->executeAll( resultat)) {285 // string resultat; 286 if ( !dtmanage_->executeAll()) { 287 287 GWt_dialog warningDialog("PSPA : Echec", " echec lors de l'exÃcution !", GWt_dialog::Error, true,true); 288 288 warningDialog.exec(); 289 289 } 290 cout << " PspaApplication : retour d'execution resultat = " << resultat << endl; 291 if (console) { 292 console->addConsoleMessage(resultat); 293 } 290 // cout << " PspaApplication : retour d'execution resultat = " << resultat << endl; 291 292 293 294 // if (console) { 295 // console->addConsoleMessage(resultat); 296 // } 294 297 // cout << " PspaApplication : affichage console termine " << endl; 295 298
Note: See TracChangeset
for help on using the changeset viewer.