Changeset 50 in PSPA


Ignore:
Timestamp:
Nov 3, 2012, 12:15:30 PM (12 years ago)
Author:
lemeur
Message:

implementation d'une persistence

Location:
Interface_Web/trunk/pspaWT
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/trunk/pspaWT/include/GWt_LigneFaisceau.h

    r48 r50  
    44#include "dataManager.h"
    55#include "GWt_pspaApplication.h"
     6#include "abstractElement.h"
    67
    78#include <Wt/WApplication>
     
    2223{
    2324
     25  //  WVBoxLayout* tempVBox_;
    2426  WHBoxLayout* beamLayout_;
    2527  //  dataManager* dtmanage_;
     
    2830public:
    2931  GWt_LigneFaisceau(PspaApplication*);
    30 
     32  void restoreElementCollection();
    3133private:
    3234  void dropEvent(WDropEvent evt);
  • Interface_Web/trunk/pspaWT/include/GWt_globalParameters.h

    r41 r50  
    3232    GWt_globalParameters(PspaApplication* ps);
    3333
     34    void updateGlobals();
     35
     36
     37    void renew();
    3438
    3539  void lancerCalcul();
  • Interface_Web/trunk/pspaWT/include/GWt_pspaApplication.h

    r41 r50  
    3535    return dtmanage_;
    3636  }
    37 
     37  void sauver();
     38  void restaurer();
    3839 private :
    3940  WTextArea* console_;
    4041  dataManager* dtmanage_;
     42  WWidget* globalParam_;
     43  WWidget* beamLine_;
    4144};
    4245
  • Interface_Web/trunk/pspaWT/include/abstractElement.h

    r48 r50  
    55#include <sstream>
    66#include <string>
    7 
    87
    98#include "mathematicalTools.h"
     
    108107 virtual string parmelaOutputFlow() const =0;
    109108
     109
    110110 virtual double getInitialKineticEnergy() const {return 0.0;}
     111
     112
     113 virtual string FileOutputFlow() const=0;
     114 virtual void FileInput(ifstream& ifs) = 0;
    111115
    112116};
  • Interface_Web/trunk/pspaWT/include/dataManager.h

    r48 r50  
    55#include "elementsCollection.h"
    66#include "globalParameters.h"
    7 //#include "driftDefinition.h"
     7#include "nomdElements.h"
    88//using namespace std;
    99
     
    2626  inline int beamLineSize() {return elementsGallery_.size();}
    2727  inline globalParameters* getGlobalParameters()  {return &globParam_;}
     28  inline elementsCollection* getCollection() {return &elementsGallery_;}
     29  abstractElement* addElement(nomdElement elemType);
    2830  abstractElement* addCell();
    2931  abstractElement* addDrift();
    3032  abstractElement* addInitialBeam();
    3133  void executeAll();
     34  void saveAll();
     35  void restoreAll();
     36
    3237};
    3338
  • Interface_Web/trunk/pspaWT/include/elementBend.h

    r45 r50  
    5151  }
    5252
     53virtual  string FileOutputFlow() const
     54  {
     55    ostringstream sortie;
     56    cout << " BEND sortie fichier non programmee " << endl;
     57    return sortie.str();
     58  }
    5359
     60
     61 virtual void FileInput(ifstream& ifs)
     62 {
     63    cout << " BEND lecture fichier non programmee " << endl;
     64 }
    5465};
    5566
  • Interface_Web/trunk/pspaWT/include/elementCell.h

    r48 r50  
    33
    44#include <string>
     5#include <fstream>
    56#include "abstractElement.h"
    67
     
    5051  virtual  string parmelaOutputFlow() const;
    5152
     53  virtual string FileOutputFlow() const;
     54
     55  virtual void FileInput(ifstream& ifs);
    5256
    5357};
  • Interface_Web/trunk/pspaWT/include/elementDrift.h

    r45 r50  
    44
    55#include "abstractElement.h"
    6 
    76
    87using namespace std;
     
    2726  virtual  string parmelaOutputFlow() const;
    2827
     28  virtual string FileOutputFlow() const;
     29
     30  virtual void FileInput(ifstream& ifs);
     31
    2932};
    3033
  • Interface_Web/trunk/pspaWT/include/elementInitialBeam.h

    r45 r50  
    66
    77#include "abstractElement.h"
     8
    89
    910using namespace std;
     
    5253 virtual string parmelaOutputFlow() const;
    5354
     55 virtual string FileOutputFlow() const;
     56
     57 virtual void FileInput(ifstream& ifs);
     58
     59
    5460};
    5561
  • Interface_Web/trunk/pspaWT/include/elementSoleno.h

    r45 r50  
    5151  }
    5252
     53
     54virtual  string FileOutputFlow() const
     55  {
     56    ostringstream sortie;
     57    cout << " SOLENO sortie fichier non progerammee " << endl;
     58    return sortie.str();
     59  }
     60
     61virtual void FileInput(ifstream& ifs)
     62{
     63    cout << " SOLENO lecture fichier non programmee " << endl;
     64}
     65
    5366};
    5467#endif
  • Interface_Web/trunk/pspaWT/include/elementsCollection.h

    r48 r50  
    3434      }
    3535  }
     36
     37 inline void raz()
     38 {
     39   unsigned int k;
     40   for (k=0; k < elements_.size(); k++)
     41     {
     42        if ( elements_[k] != NULL ) delete elements_[k];       
     43     }
     44   elements_.clear();
     45 }
    3646
    3747 inline int size() { return elements_.size(); }
  • Interface_Web/trunk/pspaWT/include/globalParameters.h

    r42 r50  
    44#include <iostream>
    55#include <string>
     6#include <fstream>
    67
    78
    89using namespace std;
    910
    10 class globalParameters
     11class globalParameters 
    1112
    1213{
     
    5152}
    5253
     54 inline void raz() { setDefaults();}
     55
    5356 inline double getFrequency() const {return frequency_;}
    5457 inline double getIntegrationStep() const {return integrationStep_;}
     
    6265 void setParametersString(string* param);
    6366
     67 string FileOutputFlow() const;
     68
     69 void FileInput(ifstream& ifs);
     70
     71
    6472};
    6573
  • Interface_Web/trunk/pspaWT/include/nomdElements.h

    r38 r50  
    22#define NOMDELEMENTS_SEEN
    33
     4#include <string>
     5
     6using namespace std;
    47
    58typedef enum
  • Interface_Web/trunk/pspaWT/src/GWt_LigneFaisceau.cc

    r48 r50  
    9898    }
    9999
    100   WVBoxLayout* tempVBox = new WVBoxLayout();
     100 // WVBoxLayout* tempVBox = new WVBoxLayout();
    101101
    102   if (!dropped) {
    103     dropped = new WPushButton();
    104     dropped->setIcon(evt.mimeType());
    105     dropped->setMaximumSize(50,50);
    106   }
     102 // if (!dropped) {
     103 //    dropped = new WPushButton();
     104 //    dropped->setIcon(evt.mimeType());
     105 //    dropped->setMaximumSize(50,50);
     106 // }
    107107
    108  WComboBox *selectionBox = new WComboBox();
    109   selectionBox->addItem("Parmela");
    110   selectionBox->addItem("Transport");
    111   selectionBox->addItem("Autre");
     108 // WComboBox *selectionBox = new WComboBox();
     109 // selectionBox->addItem("Parmela");
     110 // selectionBox->addItem("Transport");
     111 // selectionBox->addItem("Autre");
    112112 
    113   selectionBox->setCurrentIndex(1); // Parmela
    114   //  selectionBox->activated().connect(this, &MyWidget::comboChanged);
     113 // selectionBox->setCurrentIndex(1); // Parmela
     114 // //  selectionBox->activated().connect(this, &MyWidget::comboChanged);
    115115
    116   tempVBox->addWidget(dropped);
    117   tempVBox->addWidget(selectionBox);
     116 // tempVBox->addWidget(dropped);
     117 // tempVBox->addWidget(selectionBox);
    118118
    119   WContainerWidget* tempWidget = new WContainerWidget();
    120   tempWidget->setLayout(tempVBox);
    121   beamLayout_->addWidget(tempWidget);
     119  //  WContainerWidget* tempWidget = new WContainerWidget();
     120  // tempWidget->setLayout(tempVBox);
     121  //  beamLayout_->addWidget(tempWidget);
     122beamLayout_->addWidget(dropped);
     123}
     124
     125
     126void GWt_LigneFaisceau::restoreElementCollection()
     127{
     128  int nbElem = pspa_->getDataManager()->beamLineSize();
     129  cout << " nb elem a restaurer " << nbElem << endl;
     130  unsigned int k;
     131  beamLayout_->clear();
     132  for ( k=0; k < nbElem; k++)
     133    {     
     134      abstractElement* ptr = pspa_->getDataManager()->getCollection()->getElementPointer(k);
     135      nomdElement nom = ptr->getName();
     136      cout << "  GWt_LigneFaisceau:: je restaure element type " << nom << endl;
     137      WPushButton* dropped = NULL;
     138      switch (nom)
     139        {
     140        case initialBeam :
     141          {
     142            GWt_initialBeam* gwInitialBeam = new GWt_initialBeam(pspa_,ptr, string("icons/beam.jpg"));
     143            dropped = gwInitialBeam->getButton();
     144            beamLayout_->addWidget(dropped);
     145            break;
     146          }
     147        case drift :
     148          {
     149            GWt_drift* gdrift = new GWt_drift(pspa_,ptr, string("icons/drift.jpg"));     
     150            dropped = gdrift->getButton();
     151            beamLayout_->addWidget(dropped);
     152            break;
     153          }
     154        case cell :
     155          {
     156              GWt_cell* gwCell = new GWt_cell(pspa_,ptr, string("icons/cell.jpg"));
     157              dropped = gwCell->getButton();
     158              beamLayout_->addWidget(dropped);
     159              break;
     160          }
     161        default :
     162          {
     163            cerr << "  GWt_LigneFaisceau element type " << nom << " inconnu " << endl;
     164            break;
     165          }
     166     }
     167
     168    }
    122169
    123170}
  • Interface_Web/trunk/pspaWT/src/GWt_globalParameters.cc

    r38 r50  
    1919    panel->setTitle(" global parameters ");
    2020
    21     string* param = pspa_->getDataManager()->getGlobalParameters()->getParametersString();
    22         if ( param == NULL )
    23         {
    24           pspa_->addConsoleMessage(" GWt_globalParameters : empty parameter set");
    25         }
    26       int nbparam = atoi(param[0].c_str());
    27       if ( nbparam != 4 )
    28         {
    29           pspa_->addConsoleMessage(" element seems not to be a DRIFT");
    30         }
     21    // string* param = pspa_->getDataManager()->getGlobalParameters()->getParametersString();
     22    //  if ( param == NULL )
     23    //  {
     24    //    pspa_->addConsoleMessage(" GWt_globalParameters : empty parameter set");
     25    //  }
     26    //   int nbparam = atoi(param[0].c_str());
     27    //   if ( nbparam != 4 )
     28    //  {
     29    //    pspa_->addConsoleMessage(" GWt_globalParameters : wrong number of parameters");
     30    //  }
     31    // WText* freqText = new WText("frequency (MHz) : ");
     32    // frequencyEdit_ = new WLineEdit(param[1].c_str());
     33
     34    // WText *stepText = new WText("step in phase (deg.) : ");
     35    // stepEdit_ = new WLineEdit(param[2].c_str());
     36
     37    // WText *nstepMaxText = new WText("max step number : ");
     38    // nstepMAxEdit_ = new WLineEdit(param[3].c_str());
     39
     40    // WText *nscText = new WText("periodicity of s.c. computation : ");
     41    // nscEdit_ = new WLineEdit(param[4].c_str());
     42
     43
    3144    WText* freqText = new WText("frequency (MHz) : ");
    32     frequencyEdit_ = new WLineEdit(param[1].c_str());
     45    frequencyEdit_ = new WLineEdit();
    3346
    3447    WText *stepText = new WText("step in phase (deg.) : ");
    35     stepEdit_ = new WLineEdit(param[2].c_str());
     48    stepEdit_ = new WLineEdit();
    3649
    3750    WText *nstepMaxText = new WText("max step number : ");
    38     nstepMAxEdit_ = new WLineEdit(param[3].c_str());
     51    nstepMAxEdit_ = new WLineEdit();
    3952
    4053    WText *nscText = new WText("periodicity of s.c. computation : ");
    41     nscEdit_ = new WLineEdit(param[4].c_str());
     54    nscEdit_ = new WLineEdit();
     55
    4256
    4357
     
    7185
    7286    setLayout(globLayout);
    73  
     87      renew();
    7488  }
    7589
     90void GWt_globalParameters::renew()
     91{
     92  string* param = pspa_->getDataManager()->getGlobalParameters()->getParametersString();
     93  if ( param == NULL )
     94    {
     95      pspa_->addConsoleMessage(" GWt_globalParameters : empty parameter set");
     96    }
     97  int nbparam = atoi(param[0].c_str());
     98  if ( nbparam != 4 )
     99    {
     100      pspa_->addConsoleMessage(" GWt_globalParameters : wrong number of parameters");
     101    }
     102  frequencyEdit_->setText(param[1].c_str());
     103  stepEdit_->setText(param[2].c_str());
     104  nstepMAxEdit_->setText(param[3].c_str());
     105  nscEdit_->setText(param[4].c_str());
     106}
    76107
    77 void GWt_globalParameters::lancerCalcul()
     108void GWt_globalParameters::updateGlobals()
    78109  {
    79     pspa_->addConsoleMessage("on va peut etre y arriver");
    80110    string envoi[5];
    81111    envoi[0] = string("4");
     
    85115    envoi[4] = nscEdit_->text().toUTF8();
    86116    pspa_->getDataManager()->getGlobalParameters()->setParametersString(envoi);
     117  }
     118
     119void GWt_globalParameters::lancerCalcul()
     120  {
     121    pspa_->addConsoleMessage("on va peut etre y arriver");
     122    updateGlobals();
    87123    pspa_->getDataManager()->executeAll();
    88 
    89124
    90125  }
  • Interface_Web/trunk/pspaWT/src/GWt_initialBeam.cc

    r48 r50  
    1313  initialBeam_ = elem;
    1414  dropped_ = new WPushButton();
    15 
     15  cout << " GWt_initialBeam:: nom de l'image" << image << endl;
    1616  dropped_->clicked().connect(this, &GWt_initialBeam::openParametersForm);
    1717
  • Interface_Web/trunk/pspaWT/src/GWt_pspaApplication.cc

    r48 r50  
    1 /*
    2  * Copyright (C) 2008 Emweb bvba, Heverlee, Belgium.
    3  *
    4  * See the LICENSE file for terms of use.
    5  */
    61#include <stdio.h>
    72#include <string.h>
     
    1510#include <Wt/WTextArea>
    1611#include <Wt/WBreak>
     12#include <Wt/WPushButton>
    1713
    1814#include "GWt_pspaApplication.h"
     
    7571WWidget* PspaApplication::createGlobalParamWidget()
    7672{
    77   WContainerWidget* globalParam=new GWt_globalParameters(this);
     73   WContainerWidget* globalParam =new GWt_globalParameters(this);
    7874  globalParam->setMaximumSize(600,300);
    7975  globalParam->setMinimumSize(600,300);
     
    10298    WGridLayout *iconAndBeamLineLayout = new WGridLayout();
    10399
    104     //    iconAndBeamLineContainer->setLayout(iconAndBeamLineLayout);
    105 
    106     //    vBoxLayout->addWidget(iconAndBeamLineContainer,0,0);
    107 
    108 
    109   //  beamLayout_->addWidget(bidon);
    110 
    111100
    112101    console_ = new WTextArea();
     
    114103
    115104
    116   calculLayout->addWidget(createBeamLine() , 0, 0);
    117   calculLayout->addWidget(createGlobalParamWidget(),1,0);
     105    WGridLayout* toolbarLayout = new WGridLayout();
     106
     107    WPushButton* boutonSauve = new WPushButton(" sauvegarder");
     108    WPushButton* boutonRestaure = new WPushButton(" restaurer");
     109    toolbarLayout->addWidget(boutonSauve , 0, 0);
     110    toolbarLayout->addWidget(boutonRestaure , 0, 1);
     111
     112    boutonSauve->clicked().connect(this, &PspaApplication::sauver);
     113    boutonRestaure->clicked().connect(this, &PspaApplication::restaurer);
     114
     115    beamLine_ = createBeamLine();
     116  calculLayout->addWidget(beamLine_ , 0, 0);
     117  globalParam_ = createGlobalParamWidget();
     118  calculLayout->addWidget(globalParam_,1,0);
     119  calculLayout->addLayout(toolbarLayout  ,2,0);
    118120  iconAndBeamLineLayout->addWidget(createPalette() , 0, 0);
    119121  iconAndBeamLineLayout->addLayout(calculLayout  ,0,1);
     
    122124    iconAndBeamLineLayout->setColumnStretch(1,1);
    123125
    124   vBoxLayout->addLayout(iconAndBeamLineLayout,0,0);
    125   vBoxLayout->addWidget(console_,1,0);
     126  vBoxLayout->addLayout(iconAndBeamLineLayout,1,0);
     127  vBoxLayout->addWidget(console_,2,0);
    126128
    127 
    128 
    129 
    130     // iconAndBeamLineLayout->addWidget(createPalette() , 0, 0);
    131     // iconAndBeamLineLayout->addWidget(createBeamLine() , 0, 1);
    132 
    133 
    134 
    135     // vBoxLayout->addLayout(iconAndBeamLineLayout,0,0);
    136     // vBoxLayout->addWidget(bidon,1,0);
    137     // vBoxLayout->addWidget(console_,2,0);
    138129
    139130    vBoxLayout->setRowResizable(0);
     
    145136    new WText("<i>This examples requires that javascript support is enabled.</i>",root());
    146137  }
    147 
    148   // root()->addWidget(new WText("Votre nom, s'il vous plait ? "));  // show some text
    149   // nameEdit_ = new WLineEdit(root());                     // allow text input
    150   // nameEdit_->setFocus();                                 // give focus
    151 
    152   // WPushButton *button
    153   //   = new WPushButton("Go", root());              // create a button
    154   // button->setMargin(5, Left);                            // add 5 pixels margin
    155 
    156   // //  root()->addWidget(new WBreak());                       // insert a line break
    157 
    158   // //  greeting_ = new WText(root());                         // empty text
    159 
    160   // /*
    161   //  * Connect signals with slots
    162   //  *
    163   //  * - simple Wt-way
    164   //  */
    165   // button->clicked().connect(this, &PspaApplication::gopspa);
    166 
    167   /*
    168    * - using an arbitrary function object (binding values with boost::bind())
    169    */
    170   // nameEdit_->enterPressed().connect
    171   //   (boost::bind(&HelloApplication::greet, this));
    172138
    173139}
     
    189155}
    190156
     157void PspaApplication::sauver()
     158{
     159  cout << " on sauve " << endl;
     160  GWt_globalParameters* bibi = static_cast<GWt_globalParameters*>(globalParam_);
     161  bibi->updateGlobals();
     162  dtmanage_->saveAll();
    191163
     164}
    192165
    193 // WApplication *createApplication(const WEnvironment& env)
    194 // {
    195 //   /*
    196 //    * You could read information from the environment to decide whether
    197 //    * the user has permission to start a new application
    198 //    */
    199 //   return new PspaApplication(env);
    200 // }
     166void PspaApplication::restaurer()
     167{
     168  cout << " on restaure " << endl;
    201169
    202 // int main(int argc, char **argv)
    203 // {
    204 //   /*
    205 //    * Your main method may set up some shared resources, but should then
    206 //    * start the server application (FastCGI or httpd) that starts listening
    207 //    * for requests, and handles all of the application life cycles.
    208 //    *
    209 //    * The last argument to WRun specifies the function that will instantiate
    210 //    * new application objects. That function is executed when a new user surfs
    211 //    * to the Wt application, and after the library has negotiated browser
    212 //    * support. The function should return a newly instantiated application
    213 //    * object.
    214 //    */
    215 //   return WRun(argc, argv, &createApplication);
    216 // }
     170  dtmanage_->restoreAll();
     171
     172  GWt_globalParameters* bibi = static_cast<GWt_globalParameters*>(globalParam_);
     173  bibi->renew();
     174
     175  GWt_LigneFaisceau* bobo = static_cast<GWt_LigneFaisceau*>(beamLine_);
     176
     177  bobo->restoreElementCollection();
     178  //  dtmanage_->
     179
     180}
     181
  • Interface_Web/trunk/pspaWT/src/dataManager.cc

    r48 r50  
    11#include "dataManager.h"
    2 #include "nomdElements.h"
    32
    43
     
    65//using namespace std;
    76
    8 
     7abstractElement* dataManager::addElement(nomdElement elemType)
     8{
     9  switch ( elemType )
     10    {
     11    case initialBeam :
     12      {
     13        return elementsGallery_.createNewInitialBeam();
     14      }
     15    case drift :
     16      {
     17        return elementsGallery_.createNewDrift();
     18      }
     19    case cell :
     20      {
     21        return elementsGallery_.createNewCell();
     22      }
     23    default :
     24      {
     25        cerr << " dataManager::addElement : ERROR nknown type of element : " << elemType << endl;
     26        return NULL;
     27      }
     28    }
     29}
    930
    1031abstractElement* dataManager::addDrift()
     
    80101    executeParmela( 0, elementsGallery_.size()-1);
    81102  }
     103
     104
     105
     106  void dataManager::saveAll()
     107  {
     108     ofstream outfile;
     109  string name = string("/tmp/pspa.save");
     110  outfile.open(name.c_str(), ios::out);
     111      if (!outfile)
     112        {
     113          cerr << " error opening output file for persistency " << name << endl;
     114        }
     115  outfile << globParam_.FileOutputFlow();
     116  int k;
     117  abstractElement* elPtr;
     118  for ( k=0 ; k < elementsGallery_.size() ; k++)
     119    {
     120      elPtr = elementsGallery_.getElementPointer(k);
     121      outfile << elPtr->FileOutputFlow();
     122    }
     123    outfile.close();   
     124  }
     125
     126  void dataManager::restoreAll()
     127  {
     128     ifstream infile;
     129     string name = string("/tmp/pspa.save");
     130      infile.open(name.c_str(), ios::in);
     131      if (!infile)
     132        {
     133          cerr << " error opening input stream " << name << endl;
     134        }
     135      int ielem;
     136
     137      string globalTitle;
     138      if ( infile >> globalTitle )
     139        {
     140          if ( globalTitle == string("globals") )
     141            {
     142              cout << " restauration des globaux  " << endl;
     143              globParam_.raz();
     144              globParam_.FileInput(infile);
     145            }
     146          else
     147            {
     148              cerr << " dataManager::restoreAll ERROR : global parameters seems to be missing" << endl;
     149            }
     150        }
     151      else
     152        {
     153          cerr << " dataManager::restoreAll ERROR : reading data save file" << endl;
     154        }
     155      elementsGallery_.raz();
     156      nomdElement elem;
     157       while (infile >> ielem)
     158        {
     159          elem = (nomdElement)ielem;
     160          cout << " restauration element de type  " << elem << endl;
     161          abstractElement* nouveau = addElement(elem);
     162          nouveau->FileInput(infile);
     163        }
     164
     165
     166      infile.close();
     167  }
  • Interface_Web/trunk/pspaWT/src/elementCell.cc

    r45 r50  
    9494    return sortie.str();
    9595  }
     96
     97
     98string elementCell::FileOutputFlow() const
     99  {
     100    ostringstream sortie;
     101    sortie << elementName_  << endl;
     102    sortie << lenghtElem_ << " " << aperture_ << endl;
     103    sortie << initialPhase_ << "  " << acceleratingField_ << endl;
     104    sortie << phaseStepMax_ << endl;
     105    sortie << acceleratingShapeFile_ << endl;
     106    sortie << focusingMagFile_ << endl;
     107    sortie << offsetMag_ << " " << scaleFactor_ << endl;
     108    return sortie.str();
     109  }
     110
     111void elementCell::FileInput(ifstream& ifs)
     112{
     113  ifs >> lenghtElem_ >>  aperture_;
     114  ifs >> initialPhase_ >> acceleratingField_;
     115  ifs >> phaseStepMax_;
     116  ifs >> acceleratingShapeFile_;
     117  ifs >> focusingMagFile_;
     118  ifs >> offsetMag_ >> scaleFactor_;
     119}
  • Interface_Web/trunk/pspaWT/src/elementDrift.cc

    r45 r50  
    4747    return sortie.str();
    4848  }
     49
     50string elementDrift::FileOutputFlow() const
     51  {
     52    ostringstream sortie;
     53    sortie << elementName_ << endl;
     54    sortie << lenghtElem_ << "  " << aperture_ <<endl;
     55    return sortie.str();
     56  }
     57
     58void elementDrift::FileInput(ifstream& ifs)
     59{
     60  ifs >> lenghtElem_ >>  aperture_;
     61}
  • Interface_Web/trunk/pspaWT/src/elementInitialBeam.cc

    r45 r50  
    9090    return sortie.str();
    9191  }
     92
     93string elementInitialBeam::FileOutputFlow() const
     94  {
     95    ostringstream sortie;
     96    // on prend les troncatures tmax et rmax à 3 sigmas
     97    sortie << elementName_ << endl;
     98    sortie <<  nmacrop_ << "  " << sigma_t_ << "  " << sigma_r_ << endl;
     99    sortie << E_cin_ << " " << sigma_E_ << endl;
     100    sortie << phaseStep_ << "  "  << nb_true_particles_ << endl;
     101    return sortie.str();
     102  }
     103
     104void elementInitialBeam::FileInput(ifstream& ifs)
     105{
     106  ifs >> nmacrop_ >> sigma_t_ >> sigma_r_;
     107  ifs >> E_cin_ >> sigma_E_;
     108  ifs >> phaseStep_ >> nb_true_particles_;
     109}
  • Interface_Web/trunk/pspaWT/src/globalParameters.cc

    r45 r50  
    4141    nsc_ = atoi(param[4].c_str());
    4242 }
     43
     44string globalParameters::FileOutputFlow() const
     45{
     46    ostringstream sortie;
     47    sortie << " globals " << endl;
     48    sortie << frequency_ << " " << integrationStep_ << " " << nstepsMax_ << " " <<  nsc_ << endl;
     49    return sortie.str();
     50
     51}
     52
     53
     54void globalParameters::FileInput(ifstream& ifs)
     55{
     56  ifs >> frequency_ >>  integrationStep_ >> nstepsMax_ >> nsc_;
     57}
Note: See TracChangeset for help on using the changeset viewer.