Changeset 227 in PSPA
- Timestamp:
- Dec 30, 2012, 12:11:42 PM (11 years ago)
- Location:
- Interface_Web/trunk/pspaWT
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/include/GWt_pspaApplication.h
r226 r227 38 38 dataManager* dtmanage_; 39 39 string nameOfCase_; 40 40 string workingDir_; 41 41 WDialog* dialogSave_; 42 42 WDialog* dialogOpen_; -
Interface_Web/trunk/pspaWT/include/dataManager.h
r226 r227 21 21 vector<sectionToExecute*> jobList_; 22 22 23 bool createInputFileParmela( unsigned int numeroDeb, unsigned int numerpFin );24 bool createInputFileTransport( unsigned int numeroDeb, unsigned int numeroFin );23 bool createInputFileParmela( unsigned int numeroDeb, unsigned int numerpFin, string workingDir); 24 bool createInputFileTransport( unsigned int numeroDeb, unsigned int numeroFin, string workingDir); 25 25 void removeFile(string nameOfFile); 26 26 void clearSectionToExecute(); … … 48 48 abstractElement* addElement(typedElement elemType); 49 49 string getLabelFromElementNumero(int numero); 50 void initializeExecution( );50 void initializeExecution(string workingDir); 51 51 string checkExecute(); 52 bool executeTransport( unsigned int indexDeb, unsigned int indexFin, string & resul);53 bool executeParmela( unsigned int indexDeb, unsigned int indexFin, string & resul);54 bool executeAll(string & resul);55 void saveConfiguration(string nameOfFile);56 bool restoreElements(string inputFileName);52 bool executeTransport( unsigned int indexDeb, unsigned int indexFin, string workingDir, string& resul); 53 bool executeParmela( unsigned int indexDeb, unsigned int indexFin, string workingDir, string& resul); 54 bool executeAll(string workingDir, string& resul); 55 void saveConfiguration(string workingDir, string nameOfFile); 56 bool restoreElements(string workingDir, string inputFileName); 57 57 void donneesRmsEnveloppe( string type, unsigned int numeroDeb, unsigned int numeroFin, vector<double>& xcor, vector<double>& ycor); 58 58 }; -
Interface_Web/trunk/pspaWT/include/environmentVariables.h
r121 r227 4 4 #include <stdlib.h> 5 5 #include <stdio.h> 6 static string WHERE_WE_ARE = string(getenv("PWD"));7 static string WORKINGAREA = WHERE_WE_ARE.append("/workingArea/");8 6 //static string WHERE_WE_ARE = string(getenv("PWD")); 7 //static string WORKINGAREA = WHERE_WE_ARE.append("/workingArea/"); 8 static string WORKINGAREA = "../workingArea/"; 9 9 #endif 10 10 -
Interface_Web/trunk/pspaWT/include/particleBeam.h
r226 r227 63 63 virtual ~particleBeam() {;} 64 64 65 bool setFromParmela( unsigned numeroElement,double referencefrequency);65 bool setFromParmela(string workingDir,unsigned numeroElement,double referencefrequency); 66 66 void buildMomentRepresentation(); 67 67 68 bool setFromTransport(string elementLabel, const nomdElements elem);68 bool setFromTransport(string workingDir, string elementLabel, const nomdElements elem); 69 69 70 70 // void setFromBeamParameters(double x, double xp, double y, double yp, double dl, double del, double P0); -
Interface_Web/trunk/pspaWT/src/GWt_pspaApplication.cc
r226 r227 42 42 PspaApplication::PspaApplication(const WEnvironment& env) : WApplication(env) 43 43 { 44 45 workingDir_ = WApplication::appRoot()+ WORKINGAREA; 44 46 nameOfCase_ = "pspa"; // default 45 47 … … 403 405 { 404 406 bool caMarche = true; 405 dtmanage_->initializeExecution( );407 dtmanage_->initializeExecution(workingDir_); 406 408 407 409 list<GWt_sectionToExecute*>::iterator itr; … … 450 452 451 453 string resultat; 452 if ( !dtmanage_->executeAll( resultat)) {454 if ( !dtmanage_->executeAll(workingDir_, resultat)) { 453 455 GWt_dialog warningDialog("PSPA : Echec", " echec lors de l'exécution !", GWt_dialog::Error, true,true); 454 456 warningDialog.exec(); … … 484 486 { 485 487 if ( code != Wt::WDialog::Accepted ) { GWt_tools::addConsoleMessage(" pas de sauvegarde"); return;} 486 else { GWt_tools::addConsoleMessage("sauvegarde sur repertoire : " + WORKINGAREA);}488 else { GWt_tools::addConsoleMessage("sauvegarde sur repertoire : " + workingDir_);} 487 489 nameOfCase_ = saveNameEdit_->text().toUTF8(); 488 490 cout << " PspaApplication::dialogSaveDone() nameOfCase_= " << nameOfCase_ << endl; … … 491 493 GWt_globalParameters* bibi = static_cast<GWt_globalParameters*>(globalParam_); 492 494 bibi->updateGlobals(); 493 dtmanage_->saveConfiguration(nameOfCase_); 495 // dtmanage_->saveConfiguration(nameOfCase_); 496 dtmanage_->saveConfiguration(workingDir_ , nameOfCase_); 494 497 } 495 498 … … 514 517 515 518 if ( code != Wt::WDialog::Accepted ) { GWt_tools::addConsoleMessage(" pas de restauration"); return;} 516 else { GWt_tools::addConsoleMessage("restauration depuis le repertoire " + WORKINGAREA);}519 else { GWt_tools::addConsoleMessage("restauration depuis le repertoire " + workingDir_ );} 517 520 518 521 nameOfCase_ = openNameEdit_->text().toUTF8(); … … 521 524 dialogSave_ = NULL; 522 525 523 bool test = dtmanage_->restoreElements( WORKINGAREA + nameOfCase_ +".save");526 bool test = dtmanage_->restoreElements(workingDir_, nameOfCase_); 524 527 if ( !test ) { 525 528 GWt_dialog restoreWarning(" element restoring", "failure in restoring elements !", GWt_dialog::Error, false,true); … … 582 585 GWt_tools::addConsoleMessage(string("restauration...")); 583 586 584 if ( !dtmanage_->restoreElements( uploadFileSelectorWidget_->spoolFileName()) ) {587 if ( !dtmanage_->restoreElements(workingDir_, uploadFileSelectorWidget_->spoolFileName()) ) { 585 588 GWt_dialog restoreWarning(" element restoring", "failure in restoring elements !", GWt_dialog::Error, false,true); 586 589 restoreWarning.exec(); … … 748 751 chart->paint(p); 749 752 std::string name; 750 name = WORKINGAREA+"/chart-"+sessionId ()+".png";753 name = workingDir_ + "/chart-"+sessionId ()+".png"; 751 754 std::ofstream f(name.c_str(), std::ios::out |std::ios::trunc | std::ios::binary); 752 755 pngImage.write(f); … … 830 833 chart->paint(p); 831 834 std::string name; 832 name = WORKINGAREA+"/chart-"+sessionId ()+".png";835 name = workingDir_ + "/chart-"+sessionId ()+".png"; 833 836 std::ofstream f(name.c_str(), std::ios::out |std::ios::trunc | std::ios::binary); 834 837 pngImage.write(f); -
Interface_Web/trunk/pspaWT/src/GWt_tools.cc
r226 r227 5 5 6 6 WContainerWidget* GWt_tools::console_ = new WContainerWidget(); 7 7 8 void GWt_tools::addConsoleMessage(WString msg) { 8 9 WText *w = new WText(console_); -
Interface_Web/trunk/pspaWT/src/dataManager.cc
r226 r227 1 1 #include "dataManager.h" 2 #include "environmentVariables.h"2 //#include "environmentVariables.h" 3 3 #include "transportMoments.h" 4 4 … … 90 90 } 91 91 92 bool dataManager::executeTransport( unsigned int indexDeb, unsigned int indexFin, string & resul)92 bool dataManager::executeTransport( unsigned int indexDeb, unsigned int indexFin, string workingDir, string& resul) 93 93 { 94 94 ostringstream sortie; 95 95 resul.clear(); 96 96 sortie << " EXECUTION DE TRANSPORT DE " << indexDeb << " a " << indexFin << endl; 97 if ( !createInputFileTransport( indexDeb, indexFin ) )97 if ( !createInputFileTransport( indexDeb, indexFin, workingDir) ) 98 98 { 99 99 sortie << " error creating transport input file " << endl; … … 105 105 string bufString; 106 106 char buf[132]; 107 string transportJob = WORKINGAREA+ "transport";107 string transportJob = workingDir + "transport"; 108 108 transportJob += string(" < "); 109 transportJob += WORKINGAREA+ "transport.input";109 transportJob += workingDir + "transport.input"; 110 110 // transportJob += string(" > "); 111 111 // transportJob += WORKINGAREA + "transport.output"; … … 113 113 114 114 ofstream outfile; 115 string nameOut = WORKINGAREA+ "transport.output";115 string nameOut = workingDir + "transport.output"; 116 116 117 117 … … 148 148 string elemLabel = getLabelFromElementNumero (k); 149 149 abstractElement* ptr = elementsGallery_.getElementPointerFromNumero(k); 150 if (!diagnosticBeam_.back().setFromTransport( elemLabel, ptr->getNomdElement() ) )150 if (!diagnosticBeam_.back().setFromTransport(workingDir, elemLabel, ptr->getNomdElement() ) ) 151 151 { 152 152 sortie << " reading transport output failed " << endl; … … 164 164 } 165 165 166 bool dataManager::executeParmela(unsigned int indexDeb,unsigned int indexFin,string & resul)166 bool dataManager::executeParmela(unsigned int indexDeb,unsigned int indexFin,string workingDir,string& resul) 167 167 { 168 168 ostringstream sortie; 169 169 bool ExecuteStatus = true; 170 170 resul.clear(); 171 if ( !createInputFileParmela(indexDeb,indexFin ) )171 if ( !createInputFileParmela(indexDeb,indexFin, workingDir) ) 172 172 { 173 173 sortie << " error creating parmela input file " << endl; … … 179 179 180 180 char buf[132]; 181 string parmelaJob = WORKINGAREA+ "parmela";181 string parmelaJob = workingDir + "parmela"; 182 182 parmelaJob += string(" "); 183 parmelaJob += WORKINGAREA;183 parmelaJob += workingDir; 184 184 cout << " job parmela= " << parmelaJob << endl; 185 185 FILE* pp = popen(parmelaJob.c_str(), "r"); … … 207 207 { 208 208 diagnosticBeam_.push_back(particleBeam()); 209 if (! diagnosticBeam_.back().setFromParmela( k, globParam_.getFrequency()) )209 if (! diagnosticBeam_.back().setFromParmela(workingDir, k, globParam_.getFrequency()) ) 210 210 { 211 211 sortie << " reading parmdesz failed " << endl; … … 224 224 } 225 225 226 bool dataManager::createInputFileTransport( unsigned int numeroDeb, unsigned int numeroFin )226 bool dataManager::createInputFileTransport( unsigned int numeroDeb, unsigned int numeroFin, string workingDir) 227 227 { 228 228 unsigned int k; … … 246 246 247 247 ofstream outfile; 248 string name = WORKINGAREA+ "transport.input";248 string name = workingDir + "transport.input"; 249 249 outfile.open(name.c_str(), ios::out); 250 250 if (!outfile) … … 309 309 } 310 310 311 bool dataManager::createInputFileParmela( unsigned int numeroDeb, unsigned int numeroFin )311 bool dataManager::createInputFileParmela( unsigned int numeroDeb, unsigned int numeroFin, string workingDir) 312 312 { 313 313 unsigned int k; … … 323 323 324 324 ofstream outfile; 325 string name = WORKINGAREA+ "parmin";325 string name = workingDir + "parmin"; 326 326 outfile.open(name.c_str(), ios::out); 327 327 if (!outfile) { … … 361 361 } 362 362 363 void dataManager::initializeExecution( )364 { 365 removeFile( "parmdesz");366 removeFile( "parmin");367 removeFile( "transport.input");368 removeFile( "transport.output");363 void dataManager::initializeExecution(string workingDir) 364 { 365 removeFile(workingDir + "parmdesz"); 366 removeFile(workingDir + "parmin"); 367 removeFile(workingDir + "transport.input"); 368 removeFile(workingDir + "transport.output"); 369 369 diagnosticBeam_.clear(); 370 370 currentBeam_ = NULL; … … 375 375 { 376 376 ifstream fileExists; 377 string completeName = WORKINGAREA + nameOfFile; 378 fileExists.open(completeName.c_str(), ios::in); 377 fileExists.open(nameOfFile.c_str(), ios::in); 379 378 if (fileExists) { 380 379 fileExists.close(); 381 remove( completeName.c_str());382 } 383 } 384 385 bool dataManager::executeAll(string &resul)380 remove(nameOfFile.c_str()); 381 } 382 } 383 384 bool dataManager::executeAll(string workingDir, string &resul) 386 385 { 387 386 bool success = true; … … 397 396 398 397 if(jobList_[k]->software == nomDeLogiciel::parmela) { 399 success = executeParmela( debut, fin, resultatPartiel);398 success = executeParmela( debut, fin, workingDir, resultatPartiel); 400 399 } else if (jobList_[k]->software == nomDeLogiciel::transport) { 401 success = executeTransport( debut, fin, resultatPartiel);400 success = executeTransport( debut, fin, workingDir, resultatPartiel); 402 401 } else { 403 402 success = false; … … 411 410 } 412 411 413 void dataManager::saveConfiguration(string nameOfFile)412 void dataManager::saveConfiguration(string workingDir, string nameOfFile) 414 413 { 415 414 ofstream outfile; 416 string name = WORKINGAREA+ nameOfFile + ".save";415 string name = workingDir + nameOfFile + ".save"; 417 416 outfile.open(name.c_str(), ios::out); 418 417 if (!outfile) { … … 431 430 } 432 431 433 bool dataManager::restoreElements(string inputFileName)432 bool dataManager::restoreElements(string workingDir, string inputFileName) 434 433 { 435 434 cout << "dataManager::restoreElements() fichier " << inputFileName << endl; 436 435 ifstream infile; 437 // string name = WORKINGAREA + "pspa.save";438 infile.open( inputFileName.c_str(), ios::in);436 string name = workingDir + inputFileName + ".save"; 437 infile.open(name.c_str(), ios::in); 439 438 if (!infile) { 440 cerr << " error opening input stream " << inputFileName << endl;441 return false; 442 } 443 else cout << " successful opening input stream " << inputFileName << endl;439 cerr << " error opening input stream " << name << endl; 440 return false; 441 } 442 else cout << " successful opening input stream " << name << endl; 444 443 445 444 string globalTitle; -
Interface_Web/trunk/pspaWT/src/particleBeam.cc
r226 r227 6 6 #include <algorithm> 7 7 8 #include "environmentVariables.h" 8 //#include "environmentVariables.h" 9 #include <Wt/WApplication> 9 10 10 11 … … 94 95 95 96 96 bool particleBeam::setFromTransport(string elLab, const nomdElements elem)97 bool particleBeam::setFromTransport(string workingDir, string elLab, const nomdElements elem) 97 98 { 98 99 string elementLabel = elLab; … … 104 105 string buf; 105 106 ifstream infile; 106 string nameIn = WORKINGAREA + "transport.output"; 107 // string nameIn = WORKINGAREA + "transport.output"; 108 string nameIn = workingDir + "transport.output"; 107 109 infile.open(nameIn.c_str(), ios::in); 108 110 if (!infile) { … … 139 141 140 142 141 bool particleBeam::setFromParmela( unsigned numeroElement, double referencefrequency) {143 bool particleBeam::setFromParmela(string workingDir,unsigned numeroElement, double referencefrequency) { 142 144 unsigned k; 143 145 FILE* filefais; 144 string nomfilefais = WORKINGAREA+ "parmdesz";146 string nomfilefais = workingDir + "parmdesz"; 145 147 cout << " nom fichier desz : " << nomfilefais << endl; 146 148 filefais = fopen(nomfilefais.c_str(), "r");
Note: See TracChangeset
for help on using the changeset viewer.