Changeset 313 in PSPA for Interface_Web


Ignore:
Timestamp:
Feb 5, 2013, 9:17:33 PM (11 years ago)
Author:
lemeur
Message:

messages sur console

Location:
Interface_Web/trunk/pspaWT/sources
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/trunk/pspaWT/sources/controler/include/abstractSoftware.h

    r312 r313  
    3333
    3434
    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;
    3636
    3737 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  
    2121    dataManager(PspaApplication*);
    2222    virtual ~dataManager();
    23    
     23    void consoleMessage(string message);
    2424    int getBeamLineSize();
    2525    inline globalParameters* getGlobalParameters()  {return &globParam_;}
     
    4949    trivaluedBool checkExecute(string& diagnostic);
    5050    trivaluedBool checkElementsForExec(nomDeLogiciel logiciel, unsigned indexDeb, unsigned indexFin, string& diagnostic);
    51     bool executeAll(string& resul);
     51    bool executeAll();
    5252    void saveConfiguration(string nameOfFile);
    5353    bool restoreElements(string inputFileName);
  • Interface_Web/trunk/pspaWT/sources/controler/include/softwareGenerator.h

    r312 r313  
    2727
    2828
    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);
    3030
    3131
  • Interface_Web/trunk/pspaWT/sources/controler/include/softwareParmela.h

    r312 r313  
    2323  virtual bool createInputFile(string inputFileName, particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir);
    2424
    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);
    2626
    2727
  • Interface_Web/trunk/pspaWT/sources/controler/include/softwareTransport.h

    r312 r313  
    1919  virtual bool createInputFile(string inputFileName, particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir);
    2020
    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);
    2222
    2323
  • Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc

    r312 r313  
    55#include "softwareTransport.h"
    66#include "GWt_pspaApplication.h"
     7#include "GWt_console.h"
    78#include "softwareGenerator.h"
    89
     
    2829}
    2930
     31void dataManager::consoleMessage(string message) {
     32   GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console"));
     33   if (console) console->addConsoleMessage(message);
     34}
    3035
    3136string dataManager::getLabelFromElementNumero(int numero)
     
    8085trivaluedBool dataManager::checkExecute(string& diagnostic)
    8186{
    82 
    8387   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
    8492  trivaluedBool resul = ok;
    8593  unsigned k,j;
     
    157165}
    158166
    159 bool dataManager::executeAll(string &resul)
     167bool dataManager::executeAll()
    160168{
    161169    bool success = true;
    162     resul.clear();
    163     string resultatPartiel;
     170    //    resul.clear();
     171    //    string resultatPartiel;
    164172    unsigned k;
    165173    abstractSoftware* softw =NULL;
     
    169177      int debut = jobList_[k]->firstElement;
    170178      int fin = jobList_[k]->lastElement;
    171       resultatPartiel.clear();
     179      //      resultatPartiel.clear();
    172180      cout << " dataManager::executeAll je m'apprete a executer : " << (jobList_[k]->software).getString() << endl;
    173181
     
    184192      } else {
    185193        success = false;
    186         resultatPartiel =  " unknown software -- STOP \n ";     
     194        consoleMessage("dataManager::executeAll : unknown software");
     195        //      resultatPartiel =  " unknown software -- STOP \n ";     
    187196        break;
    188197      }
    189198
    190199      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_);
    195205        if ( success ) {
    196206          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          // }
    200210        }
    201211      }
     
    208218        cout << " execute termine en ECHEC " << endl;
    209219      }
    210       resul += resultatPartiel;
     220      //      resul += resultatPartiel;
    211221      if ( !success ) break;
    212222    }
  • Interface_Web/trunk/pspaWT/sources/controler/src/softwareGenerator.cc

    r312 r313  
    2929
    3030  if ( elPtr->getNomdElement().getElementType() != RFgun ) {
     31    dataManager_->consoleMessage(" softwareGenerator::createInputFile : the element must be rfgun " );
    3132    cerr << " softwareGenerator::createInputFile : the element must be rfgun" << endl;
    3233    return false;
     
    3637  outfile.open(name.c_str(), ios::out);
    3738  if (!outfile) {
     39    dataManager_->consoleMessage(" softwareGenerator::createInputFile : error opening output stream " );
    3840    cerr << " error opening output stream " << name << endl;
    3941    return false;
     
    4749  outfile << "/" << endl;
    4850  outfile.close();
     51  dataManager_->consoleMessage("fichier input termine pour GENERATOR");
    4952  return true;
    5053}
    5154
    5255
    53 bool  softwareGenerator::execute(string inputFileName, unsigned int numeroDeb,unsigned int numeroFin,string workingDir,string& resul) {
     56bool  softwareGenerator::execute(string inputFileName, unsigned int numeroDeb,unsigned int numeroFin,string workingDir) {
    5457  ostringstream sortie;
    5558  bool ExecuteStatus = true;
    56   resul.clear();
     59  //  resul.clear();
    5760  sortie << " EXECUTION DE GENERATOR DE l'ELEMENT " << numeroDeb << " A L'ELEMENT " << numeroFin << endl;
    5861
     
    8790    }
    8891  }
    89   resul =  sortie.str();
     92  //  resul =  sortie.str();
     93    dataManager_->consoleMessage(sortie.str());
    9094  return ExecuteStatus;
    9195}
     
    9498
    9599  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  }
    97104
    98105  beams.push_back(particleBeam());
     
    104111    beams.back().setWithParticles(centroid, refPart,particles);
    105112  } else {
     113    dataManager_->consoleMessage(" softwareGenerator::buildBeamAfterElements : error  " );
    106114    result = false;
    107115  }
     
    116124  filefais = fopen(nomfilefais.c_str(), "r");
    117125  if ( filefais == (FILE*)0 ) {
     126    dataManager_->consoleMessage(" softwareGenerator::beamFromGenerator : error openig the file " + nomfilefais );
    118127    cerr << " beamFromGenerator() erreur a l'ouverture du fichier" << nomfilefais  << endl;;
    119128    return false;
     
    130139    {
    131140         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;
    133143        return false;
    134144      }
     
    161171  if ( faisceau.size() == 0)
    162172    {
     173    dataManager_->consoleMessage(" softwareGenerator::beamFromGenerator : error no particle found" );
    163174      cerr << " softwareGenerator::beamFromGenerator echec lecture " << endl;
    164175      return false;
  • Interface_Web/trunk/pspaWT/sources/controler/src/softwareParmela.cc

    r312 r313  
    2222
    2323  if ( numeroDeb < 1 || numeroFin > dataManager_->getBeamLineSize() ) {
     24    dataManager_->consoleMessage(" softwareParmela::createInputFile : numero of element out of limits " );
    2425    cerr << " numero of element out of limits " << endl;
    2526    return false;
    2627  }
    2728
    28 
    29     // unsigned indexDeb = numeroDeb - 1;
    30     // unsigned indexFin = numeroFin - 1;
    3129
    3230  ofstream outfile;
     
    3432  outfile.open(name.c_str(), ios::out);
    3533  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;
    3736    return false;
    3837  }
     
    7574  outfile << "END" << endl;
    7675  outfile.close();
     76  dataManager_->consoleMessage("fichier input termine pour PARMELA");
    7777  return true;
    7878}
    7979
    8080
    81 bool  softwareParmela::execute(string inputFileName,unsigned int numeroDeb,unsigned int numeroFin,string workingDir,string& resul)
     81bool  softwareParmela::execute(string inputFileName,unsigned int numeroDeb,unsigned int numeroFin,string workingDir)
    8282{
    8383  ostringstream sortie;
    8484  bool ExecuteStatus = true;
    85   resul.clear();
     85  //  resul.clear();
    8686  sortie << " EXECUTION DE PARMELA DE l'ELEMENT " << numeroDeb << " A L'ELEMENT " << numeroFin << endl;
    8787
     
    110110  }
    111111
    112   resul =  sortie.str(); 
     112  //  resul =  sortie.str();
     113    dataManager_->consoleMessage(sortie.str());
     114 
    113115  return ExecuteStatus;
    114116}
     
    132134                } else {
    133135                  // sortie << " reading parmdesz  failed " << endl;
     136    dataManager_->consoleMessage(" softwareParmela::buildBeamAfterElements : reading parmdesz  failed " );
    134137                  result = false;
    135138                  break;
     
    154157
    155158  if ( filefais == (FILE*)0 ) {
     159    dataManager_->consoleMessage(" beamFromParmela() erreur a l'ouverture du fichier 'parmdesz'");
    156160    cerr << " beamFromParmela() erreur a l'ouverture du fichier" << nomfilefais  << endl;;
    157161    return false;
     
    249253bool softwareParmela::beamToParmela(string workingDir, particleBeam* beam ) {
    250254  if ( !beam->particleRepresentationOk() ) {
     255    dataManager_->consoleMessage("softwareParmela::beamToParmela : beam not in particles form : not yet programmed");
    251256    cout << " softwareParmela::beamToParmela : beam not in particles form : not yet programmed " << endl;
    252257    return false;
     
    256261  outfile.open(name.c_str(), ios::out);
    257262  if (!outfile) {
     263    dataManager_->consoleMessage(" softwareParmela::beamToParmela : error opening output stream ");
    258264    cerr << " softwareParmela::beamToParmela : error opening output stream " << name << endl;
    259265    return false;
  • Interface_Web/trunk/pspaWT/sources/controler/src/softwareTransport.cc

    r312 r313  
    2121  unsigned int k;
    2222  if ( numeroDeb < 1 || numeroFin > dataManager_->getBeamLineSize() ) {
     23    dataManager_->consoleMessage(" softwareTransport::createInputFile : numero of element out of limits " );
    2324    cerr << " numero of element out of limits " << endl;
    2425    return false;
    2526  }
    26 
    27     // unsigned indexDeb = numeroDeb - 1;
    28     // unsigned indexFin = numeroFin - 1;
    29 
    3027  abstractElement* premierEl = NULL;
    3128  premierEl = dataManager_->getElementPointerFromNumero(numeroDeb);
     
    4340  if (!outfile)
    4441    {
     42    dataManager_->consoleMessage(" softwareTransport::createInputFile : error opening output stream " );
    4543      cerr << " error opening output stream " << name << endl;
    4644      return false;
     
    5957    // s'il n'y a pas faisceau courant, erreur
    6058    if ( beamBefore == NULL ) {
     59    dataManager_->consoleMessage(" softwareTransport::createInputFile : no input beam " );
    6160      cout << " pas de faisceau " << endl;
    6261      return false;
     
    6867        // on le met au format transport, s'il est deja au format 'particules' (par ex/ parmela)
    6968        if ( !beamBefore->particleRepresentationOk() ) {
     69    dataManager_->consoleMessage(" softwareParmela::createInputFile : ca cafouille dans les representations de faisceau : ni particules, ni moments ? " );
    7070          cout << " ca cafouille dans les representations de faisceau : ni particules, ni moments ? " << endl;
    7171          return false;
     
    9999
    100100  outfile.close();
     101  dataManager_->consoleMessage("fichier input termine pour TRANSPORT");
    101102  return true;
    102103}
     
    104105
    105106
    106 bool softwareTransport::execute(string inputFileName, unsigned int numeroDeb, unsigned int numeroFin, string workingDir, string& resul)
     107bool softwareTransport::execute(string inputFileName, unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
    107108{
    108109  ostringstream sortie;
    109   resul.clear();
     110  //  resul.clear();
    110111  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   //   }
    117112
    118113  bool ExecuteStatus = true;
     
    151146    }
    152147  }
    153   resul =  sortie.str();
     148  //  resul =  sortie.str();
     149    dataManager_->consoleMessage(sortie.str());
    154150  return ExecuteStatus;
    155151}
     
    163159          {
    164160            beams.push_back(particleBeam());
    165             //      string elemLabel = getLabelFromElementNumero (k);
    166161
    167162            abstractElement* ptr = dataManager_->getElementPointerFromNumero(k);
    168163
    169164            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;
    171167              result = false;
    172168              break;         
     
    179175            if (!moments2FromTransport(workingDir, elemLabel, ptr->getNomdElement(),transpMoments )  )
    180176              {
     177              dataManager_->consoleMessage(" softwareTransport::buildBeamAfterElements : failure in reading moments " );
    181178              cout << " softwareTransport::buildBeamAfterElements plantage dans lecture moments " << endl;
    182179                result = false;
     
    201198  infile.open(nameIn.c_str(), ios::in);
    202199  if (!infile) {
     200    dataManager_->consoleMessage(" softwareTransport::moments2FromTransport : error re-opening transport output stream ");
    203201    cerr << " dataManager::moments2FromTransport : error re-opening transport output stream " << nameIn << endl;
    204202    return false;
     
    221219  cout << " compteur= " << compteur << endl;
    222220  if ( compteur == 0 ) {
     221    dataManager_->consoleMessage(" softwareTransport::moments2FromTransport : element"+elementLabel+"not found in the file "+nameIn);
    223222    cerr << " dataManager::moments2FromTransport : element " << elementLabel << " non trouve dans le fichier  " << nameIn << endl;
    224223    return false;
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc

    r312 r313  
    271271    GWt_console* console = NULL;
    272272    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"));
    274274        console->addConsoleMessage(string("on va peut etre y arriver"));
    275275    }
     
    283283    wApp->processEvents();
    284284   
    285     string resultat;
    286     if ( !dtmanage_->executeAll(resultat)) {
     285    //    string resultat;
     286    if ( !dtmanage_->executeAll()) {
    287287        GWt_dialog warningDialog("PSPA : Echec", " echec lors de l'exÈcution !", GWt_dialog::Error, true,true);
    288288        warningDialog.exec();
    289289    }
    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    // }
    294297    //  cout << " PspaApplication : affichage console termine  " << endl;
    295298   
Note: See TracChangeset for help on using the changeset viewer.