Changeset 455 in PSPA


Ignore:
Timestamp:
Dec 16, 2013, 5:16:54 PM (10 years ago)
Author:
garnier
Message:

grosse modification pour intégrer les sections

Location:
Interface_Web/trunk/pspaWT
Files:
63 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/trunk/pspaWT/History

    r453 r455  
    55     PSPA - Plateforme de simulation en physique des accélérateurs
    66     =========================================================
     7
     816 Décembre 2013 : Laurent Garnier
     9Un certain nombre d'arguments/méthodes sont postfixés par "deprecated". Ils vont être supprimé prochainement et ne servent déja probablement plus a rien pour la plupart d'entre eux.
     10
     11- abstractSoftware :
     12  o DEPRECATED : Passage a "deprecated" des fonctions et arguments suivants :
     13    - initComputationLimits()
     14    - ComputationLimitsOk()
     15    - numeroDeb
     16    - numeroFin
     17  o Suppression des paramètres globParamPtr_ et sectParamPtr_
     18    qui sont désormais des paramètres de "dataManager" et "section"
     19  o Ajout de la méthode getSectionToExecute()
     20  o Changement du constructeur :
     21   - abstractSoftware(string,globalParameters*,dataManager*); 
     22   Par
     23   - abstractSoftware(string, sectionToExecute*);
     24  o Changement de la méthode createInputFile qui ne prend désormais plus de numéroDeb ni numéroFin.
     25   - createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
     26   Remplacé par :
     27   - createInputFile(particleBeam* beamBefore, string workingDir)
     28
     29- dataManager
     30   o DEPRECATED : Passage a "deprecated" des fonctions et arguments suivants :
     31     - getBeamLineSize()
     32     - getDiagnosticBeam(string)
     33     - getLabelFromElementNumero()
     34     - getLabelFromElementLabel()
     35   o Supression de :
     36     - addSectionToExecute()
     37     - addElement()
     38     - getElementPointerFromNumero()
     39     - clearSectionToExecute()
     40
     41- unknowSoftware :
     42  o Changement de la méthode createInputFile qui ne prend désormais plus de numéroDeb ni numéroFin.
     43   - createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
     44   Remplacé par :
     45   - createInputFile(particleBeam* beamBefore, string workingDir)
     46
     47- sectionToExecute : Désormais cette classe possède un vector d'abstractElement.
     48  o Changement du constructeur :
     49   - sectionToExecute(abstractElement*,abstractElement*,abstractSoftware*)
     50   Remplacé par :
     51   - sectionToExecute(abstractElement*,abstractSoftware*) -> Plus besoin de connaitre la fin, on ajoute les éléments au et
     52     à mesure dans la sectionToExecute.
     53  o supression de :
     54    - getFirstElement() -> On parcours désormais un vecteur d'éléments
     55    - getLastElement()
     56    - getElementNumberInSection()
     57    - getLastElementNumberInSection()
     58    - firstElementNumberInBeamLine, lastElementNumberInBeamLine, firstElement, lastElement
     59  o ajout d'un vecteur d'"abstractElement*" à cette section et des méthodes associées
     60
     61- sector :
     62  o ajout des méthodes et paramètres :
     63    - addElementAfter()
     64    - setSoftware()
     65    - clearSectionToExecute()
     66    - clearSectionToExecute(int)
     67    - dataManager_, sectorParam_
     68
     69- sectorParameters :
     70  o Changement du constructeur en ajoutant un paramètre vers le "sector" d'origine
     71  o Renommage de "sector_" en "sectorsStatements_" pour éviter les confusions
     72
     73- softwareGenerator :
     74  o Changement du constructeur :
     75    - softwareGenerator(string inputFileName, globalParameters* globals, dataManager* dt);
     76    Par :
     77    - softwareGenerator(string inputFileName, sectionToExecute*)
     78  o Changement de la méthode createInputFile qui ne prend désormais plus de numéroDeb ni numéroFin.
     79   - createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
     80
     81- softwareParmela :
     82  o Changement du constructeur :
     83    - softwareParmela(string inputFileName, globalParameters* globals, dataManager* dt);
     84    Par :
     85    - softwareParmela(string inputFileName, sectionToExecute*)
     86  o Changement de la méthode createInputFile qui ne prend désormais plus de numéroDeb ni numéroFin.
     87   - createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
     88
     89- softwareTest :
     90  o Changement du constructeur :
     91    - softwareTest(string inputFileName, globalParameters* globals, dataManager* dt);
     92    Par :
     93    - softwareTest(string inputFileName, sectionToExecute*)
     94  o Changement de la méthode createInputFile qui ne prend désormais plus de numéroDeb ni numéroFin.
     95   - createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
     96
     97- softwareUsersProgram :
     98  o Changement du constructeur :
     99    - softwareUsersProgram(string inputFileName, globalParameters* globals, dataManager* dt);
     100    Par :
     101    - softwareUsersProgram(string inputFileName, sectionToExecute*)
     102  o Changement de la méthode createInputFile qui ne prend désormais plus de numéroDeb ni numéroFin.
     103   - createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
     104
     105
     106- softwareMadX :
     107  o Changement du constructeur :
     108    - softwareMadX(string inputFileName, globalParameters* globals, dataManager* dt);
     109    Par :
     110    - softwareMadX(string inputFileName, sectionToExecute*)
     111  o Changement de la méthode createInputFile qui ne prend désormais plus de numéroDeb ni numéroFin.
     112   - createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
     113
     114
     115- softwareTransport :
     116  o Changement du constructeur :
     117    - softwareTransport(string inputFileName, globalParameters* globals, dataManager* dt);
     118    Par :
     119    - softwareTransport(string inputFileName, sectionToExecute*)
     120  o Changement de la méthode createInputFile qui ne prend désormais plus de numéroDeb ni numéroFin.
     121   - createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
     122
     123- GWt_elementBeam, Cell, Bend, Drift... :
     124  o Changement du constructeur pour l'associer à un abstrastElement
     125
     126- GWt_elementLigneFaisceu :
     127  o Remplacement de :
     128    - initialize_ligneFaisceau(nomdElements::typedElement eType,GWt_ligneFaisceau* ligne);
     129    Par :
     130    - initialize_ligneFaisceau(GWt_ligneFaisceau* ligne, abstractElement* abstractElem)
     131  o Suppression du pointeur vers PspaApplication*
     132  o DEPRECATED : GWt_abstractElement
     133
     134- GWt_dropZoneLigneFaisceau :
     135  o Desormais une dropZone n'est plus lié à PspaApplication mais à un dataManager
     136
     137- GWt_sectionToExecute :
     138  o Ajout d'un pointer vers le section qui contient cette section
     139
     140- GWt_softwarePanel :
     141  o Cette classe n'est plus liée à PspaApplication, mais au GWt_sector qui la contient
     142
     143- GWt_ligneFaisceau :
     144  o Desormais cette classe n'est plus lié à PspaApplication mais à un dataManager et un GWt_sector
     145  o DEPRECATED :
     146    - update()
     147    - manageLineFaisceauLayout()
     148
     149- GWt_sectorParameters
     150  o DEPRECATED :
     151    - createSector()
     152    - buttons()
     153    - execDialog()
     154
     155- PspaApplication :
     156  o La beamLine n'est plus gérée dans cette classe mais dans le dataManager, de ce fait, un certain nombre de fonctions et arguments disparaissent :
     157  o DEPRECATED :
     158    - beamLine
     159    - createBeamLine()
     160  o Un certain nombre de fonction sont déplacée dans la nouvelle classe GWt_accelerator :
     161    - dialogOnGraphics()
     162    - faireDessinPhaseSpace(WContainerWidget* toto, particleBeam* beam, string elementLabel, string namex, string namey, int typeFaisceau)
     163    - faireDessinEnveloppe(WContainerWidget* toto, string type)
     164    - chartPlot2vec(WContainerWidget* toto,vector<double>& xcor,vector<double>& ycor,Wt::Chart::SeriesType seriesType,Wt::Chart::FillRangeType fillRange,Wt::Chart::AxisValue value,bool isGridLinesEnables,string title,string legendx,string legendy,int width,int height,bool makeIcon = false)
     165    - removePathFromConfigName(string& config)
     166    - removeExtensionFromConfigName(string& config)
     167    - removeBeamLine()
     168    - dessiner()
     169    - dessinerEnveloppe()
     170    - dessinerPhaseSpace()
     171    - dessinerHistogramme()
     172
     173- GWt_accelerator :
     174  o Nouvelle classe afin de gérer toutes les fonctions spécifiques à un accélérateur et non pas à l'application PSPA. Cette classe pourra servir si l'on à plusieurs accélérateurs dans PSPA.
     175
    7176
    817712 Décembre 2013 : Laurent Garnier
  • Interface_Web/trunk/pspaWT/sources/controler/include/abstractSoftware.h

    r431 r455  
    1515
    1616class dataManager;
     17class sectionToExecute;
    1718
    1819class abstractSoftware
     
    2122 protected :
    2223 
    23   unsigned numeroDeb_, numeroFin_;
    24   globalParameters* globParamPtr_;
    25   sectorParameters* sectParamPtr_; //xx
     24  unsigned numeroDeb_deprecated_, numeroFin_deprecated_;
    2625  dataManager* dataManager_;
    2726  string inputFileName_;
     
    4140
    4241  bool launchJob(string commandLine, string& resul);
    43   bool initComputationLimits(unsigned int numeroDeb,unsigned int numeroFin);
    44   bool ComputationLimitsOk() const;
     42  bool initComputationLimits_deprecated(unsigned int numeroDeb,unsigned int numeroFin);
     43  bool ComputationLimitsOk_deprecated() const;
    4544
    4645  void registerElement(nomdElements::typedElement nomdel,trivaluedBool b);
    4746
    48  public :
     47  sectionToExecute* getSectionToExecute() {
     48    return sectionToExecute_;
     49  }
    4950
    50   abstractSoftware(string,globalParameters*,dataManager*);
    51   abstractSoftware(string,sectorParameters*,dataManager*);
     51  public :
     52
     53  abstractSoftware(string, sectionToExecute*);
    5254  ~abstractSoftware() {;}
    5355
     
    5860  trivaluedBool doAcceptElement(nomdElements::typedElement typdel);
    5961
    60   virtual bool createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir) = 0;
     62  virtual bool createInputFile(particleBeam* beamBefore, string workingDir) = 0;
    6163  virtual bool execute(string workingDir) = 0;
    6264  virtual bool buildBeamAfterElements(string workingDir) = 0;
     
    7274    return nameOfSoftware_.getString();
    7375  }
     76  private :
     77  sectionToExecute* sectionToExecute_;
     78 
    7479};
    7580#endif
  • Interface_Web/trunk/pspaWT/sources/controler/include/dataManager.h

    r449 r455  
    2828  virtual ~dataManager();
    2929  void consoleMessage(string message);
    30   int getBeamLineSize();
     30  int getBeamLineSize_deprecated();
    3131  inline globalParameters* getGlobalParameters()  {return &globParam_;}
    3232  inline particleBeam* getCurrentBeam() {return currentBeam_;}
    33 
    34   // xx
    35   inline sectorParameters* getSectorParameters() {return &sectorParam_;}
    3633   
    3734  particleBeam* getDiagnosticBeam(unsigned index);
    38   particleBeam* getDiagnosticBeam(string elementLabel);
     35  particleBeam* getDiagnosticBeam_deprecated(string elementLabel);
    3936
    40   sectionToExecute*  addSectionToExecute(abstractElement* debut,int debutIndex, abstractElement* fin, int finIndex, nomDeLogiciel logiciel);
    41 
    42   abstractElement* addElement(nomdElements::typedElement elemType);
    43   void removeElement(string);
    44  
    4537/** Add a new sector
    4638 */
     
    4941  /** return all sectors
    5042   */
    51   inline std::vector <sector*> getSectors() {return sectors_;};
     43  inline std::vector <sector*> getSectors() {return jobList_;};
    5244 
    5345  /**
     
    5547     @return return "" if not found
    5648  */
    57   string getLabelFromElementNumero(int numero);
     49  string getLabelFromElementNumero_deprecated(int numero);
    5850 
    5951  /**
     
    6153     @return return -1 if not found
    6254  */
    63   int getNumeroFromElementLabel(string);
    64   abstractElement*  getElementPointerFromNumero(int);
     55  int getNumeroFromElementLabel_deprecated(string);
    6556 
    6657  void initializeExecution();
     
    8273  /** return the jobList size
    8374   */
    84   inline int getJobListSize() const {
     75  inline unsigned long getJobListSize() const {
    8576    return jobList_.size();
    8677  }
     
    9687  }
    9788   
    98   /** Clear a specific jobList */
    99   void clearSectionToExecute(int a);
    100    
     89 
     90  /**
     91   Return the application attatch to this controler
     92   */
     93  inline PspaApplication* getPspaApplication() {
     94    return pspa_;
     95  };
     96
     97 
    10198 private:
    10299
    103100  globalParameters globParam_;
    104   sectorParameters sectorParam_; //xx
    105101  particleBeam* currentBeam_;
    106102  PspaApplication* pspa_;
    107   unsigned firstComputedElemNumero_;
    108   unsigned lastComputedElemNumero_;
    109103 
    110104  vector<particleBeam> diagnosticBeam_;
    111105  vector<unsigned> indexElementToIndexDiag_;
    112   vector<sectionToExecute*> jobList_;
    113   vector <sector*> sectors_;
     106  vector <sector*> jobList_;
    114107  void removeFile(string nameOfFile);
    115   void clearSectionToExecute();
    116   abstractSoftware* createSoftwareConnexion(nomDeLogiciel logi);
    117108};
    118109#endif
  • Interface_Web/trunk/pspaWT/sources/controler/include/particleBeam.h

    r442 r455  
    108108  void buildMomentRepresentation();
    109109  void clear();
    110   int getNbParticles() const;
     110  unsigned long getNbParticles() const;
    111111  const beam2Moments&  getTransportMoments() const;
    112112  double getUnnormalizedEmittanceX();
  • Interface_Web/trunk/pspaWT/sources/controler/include/sectionToExecute.h

    r431 r455  
    99{
    1010 public :
     11  /** Create a new sectionToExecute and initialize it with the given element
     12   */
     13  sectionToExecute(abstractElement*);
    1114
    12   sectionToExecute(abstractElement*,abstractElement*,abstractSoftware*);
     15  /** Create a new sectionToExecute and initialize it with the given element and software
     16   */
     17  sectionToExecute(abstractElement*,abstractSoftware*);
    1318 
    1419  /** Deprecated : To be removed ! */
     
    1722  ~sectionToExecute() {;}
    1823
    19   inline abstractElement* getFirstElement() {
    20     return firstElement;
    21   }
    22    
    23   inline abstractElement* getLastElement() {
    24     return lastElement;
    25   }
    26    
    27   /** Deprecated : To be removed ! */
    28   inline int getElementNumberInSection() const {
    29     return firstElementNumberInBeamLine;
    30   }
    31    
    32   /** Deprecated : To be removed ! */
    33   inline int getLastElementNumberInSection()  const {
    34     return lastElementNumberInBeamLine;
    35   }
    36 
    3724  inline abstractSoftware* getSoftware() const {
    38     return software;
     25    return software_;
    3926  }
    4027 
    41  private :
     28  inline abstractSoftware* setSoftware(abstractSoftware* soft) {
     29    software_ = soft;
     30  }
     31 
     32  /**
     33   Get the vector of elements of this sector
     34   */
     35  inline std::vector< abstractElement* > getElements() {return elements_;};
     36 
     37  bool insertAfter(abstractElement*,abstractElement*);
    4238
    43   abstractElement*  firstElement;
    44   abstractElement*  lastElement;
    45   abstractSoftware* software;
     39  private :
    4640
    47   int firstElementNumberInBeamLine;
    48   int lastElementNumberInBeamLine; 
     41  abstractSoftware* software_;
     42
     43  std::vector< abstractElement* > elements_;
    4944};
    5045#endif
  • Interface_Web/trunk/pspaWT/sources/controler/include/sector.h

    r449 r455  
    33
    44#include <vector>
    5 #include "sectionToExecute.h"
     5#include <string>
     6
     7#include "nomDeLogiciel.h"
     8#include "sectorParameters.h"
     9
     10class sectionToExecute;
     11class abstractElement;
     12class dataManager;
    613
    714class sector
     
    916  public :
    1017 
    11   sector(std::string name = "sector default name");
     18  sector(dataManager*, std::string name = "sector default name");
    1219  virtual ~sector();
    1320  /**
     
    4754   */
    4855  inline std::string getName() { return name_;};
    49 
    50   /**
    51    Return the vector of sectors inside this sector
    52    */
    53   inline std::vector <sector*> getInnerSectors() { return sectors_;};
    54 
    55   /**
    56    Add an inner sector
    57    */
    58   inline void addInnerSector(sector* s) {
    59     if (s) sectors_.push_back(s);
    60   };
    6156 
    6257  /**
     
    7267  };
    7368 
     69  /** Add an element after another one. Will put it in the same sectionToExecuteList. If the element after is NULL
     70   it will create a new sectionToExecute and put it inside.
     71   */
     72  void addElementAfter(abstractElement*,abstractElement*);
     73 
     74  /**
     75 set the specific software for the given sectionToExecute number
     76 */
     77  bool setSoftware(nomDeLogiciel, unsigned int sectionToExecuteNumber);
     78
     79  void clearSectionToExecute();
     80  /** Clear a specific jobList */
     81  void clearSectionToExecute(int a);
     82
     83  inline sectorParameters getSectorParameters() {
     84    return sectorParam_;
     85  }
     86
    7487private:
    75   std::vector <sector*> sectors_;
     88
    7689  std::vector <sectionToExecute*> sectionToExecute_;
    7790
     
    8093  sector* duplicatedFrom_;
    8194  unsigned int repetitionNumber_;
     95  dataManager* dataManager_;
     96  sectorParameters sectorParam_; //xx
    8297};
    8398#endif
  • Interface_Web/trunk/pspaWT/sources/controler/include/sectorParameters.h

    r436 r455  
    1010typedef pair<string, vector<string> > statements;
    1111
     12class sector;
     13
    1214class sectorParameters 
    1315{
    1416  string geometry_;
    15   vector<statements> sectors_;
     17  vector<statements> sectorsStatements_;
    1618
    1719 public :
    1820 
    19   sectorParameters();
     21  sectorParameters(sector*);
    2022  ~sectorParameters() {;}
    2123 
     
    2729  void setSectors(const vector<statements>&);
    2830  vector<statements> getSectors() const;
     31  sector* sector_;
    2932};
    3033#endif
  • Interface_Web/trunk/pspaWT/sources/controler/include/softwareGenerator.h

    r431 r455  
    1818 
    1919  softwareGenerator(); 
    20   softwareGenerator(string inputFileName, globalParameters* globals, dataManager* dt);
     20  softwareGenerator(string inputFileName, sectionToExecute*);
    2121
    2222  virtual ~softwareGenerator() {;}
    2323
    24   virtual bool createInputFile(particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir);
     24  virtual bool createInputFile(particleBeam* beamBefore, string workingDir);
    2525  virtual bool execute(string workingDir);
    2626  virtual bool buildBeamAfterElements(string workingDir);
  • Interface_Web/trunk/pspaWT/sources/controler/include/softwareMadx.h

    r431 r455  
    1313 
    1414  softwareMadx();
    15   softwareMadx(string,sectorParameters*,dataManager*);
     15  softwareMadx(string,sectionToExecute*);
    1616  virtual ~softwareMadx() {;}
    1717
    18   virtual bool createInputFile(particleBeam*,unsigned int,unsigned int,string);
     18  virtual bool createInputFile(particleBeam*, string);
    1919  virtual bool execute(string);
    2020  virtual bool buildBeamAfterElements(string);
  • Interface_Web/trunk/pspaWT/sources/controler/include/softwareParmela.h

    r418 r455  
    3636    softwareParmela();
    3737   
    38     softwareParmela(string inputFileName, globalParameters* globals, dataManager* beamLine);
     38    softwareParmela(string inputFileName, sectionToExecute*);
    3939
    4040  virtual ~softwareParmela() {;}
    4141
    4242
    43   virtual bool createInputFile(particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir);
     43  virtual bool createInputFile(particleBeam* beamBefore, string workingDir);
    4444
    4545  virtual bool  execute(string workingDir);
  • Interface_Web/trunk/pspaWT/sources/controler/include/softwareTest.h

    r386 r455  
    1818    softwareTest();
    1919   
    20     softwareTest(string inputFileName, globalParameters* globals, dataManager* );
     20    softwareTest(string inputFileName, sectionToExecute*);
    2121
    2222  virtual ~softwareTest() {;}
    2323
    2424
    25   virtual bool createInputFile( particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir);
     25  virtual bool createInputFile( particleBeam* beamBefore, string workingDir);
    2626
    2727
  • Interface_Web/trunk/pspaWT/sources/controler/include/softwareTransport.h

    r418 r455  
    2020 public :
    2121    softwareTransport();
    22     softwareTransport(string inputFileName, globalParameters* globals, dataManager* beamLine);
     22    softwareTransport(string inputFileName, sectionToExecute*);
    2323
    2424  virtual ~softwareTransport() {;}
    25   virtual bool createInputFile( particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir);
     25  virtual bool createInputFile( particleBeam* beamBefore, string workingDir);
    2626
    2727  virtual bool  execute(string workingDir);
  • Interface_Web/trunk/pspaWT/sources/controler/include/softwareUnknown.h

    r431 r455  
    1111  virtual ~softwareUnknown() {;}
    1212
    13   virtual bool createInputFile(particleBeam*,unsigned int,unsigned int,string);
     13  virtual bool createInputFile(particleBeam*,sectionToExecute* sectionToExe, string);
    1414  virtual bool execute(string);
    1515  virtual bool buildBeamAfterElements(string);
  • Interface_Web/trunk/pspaWT/sources/controler/include/softwareUsersprogram.h

    r442 r455  
    1313 public :
    1414    softwareUsersprogram();
    15     softwareUsersprogram(string inputFileName, globalParameters* globals, dataManager* beamLine);
     15    softwareUsersprogram(string inputFileName, sectionToExecute*);
    1616
    1717  virtual ~softwareUsersprogram() {;}
    18   virtual bool createInputFile( particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir);
     18  virtual bool createInputFile( particleBeam* beamBefore, string workingDir);
    1919
    2020  virtual bool  execute(string workingDir);
  • Interface_Web/trunk/pspaWT/sources/controler/src/abstractSoftware.cc

    r442 r455  
    77abstractSoftware::abstractSoftware()
    88{
    9   globParamPtr_ = NULL;
    10   sectParamPtr_ = NULL; //xx
    119  dataManager_ = NULL;
    1210  nameOfSoftware_ = nomDeLogiciel("unknownSoftware");
    1311}
    1412
    15 abstractSoftware::abstractSoftware(string inputFileName, globalParameters* globals, dataManager* dt)
     13abstractSoftware::abstractSoftware(string inputFileName, sectionToExecute* sect)
    1614{
    1715  inputFileName_ = inputFileName;
    18   globParamPtr_ = globals;
    19   sectParamPtr_ = NULL; //xx
    20   dataManager_ = dt;
    21   numeroDeb_ = 0;
    22   numeroFin_ = 0;
     16  sectionToExecute_ = sect;
     17  numeroDeb_deprecated_ = 0;
     18  numeroFin_deprecated_ = 0;
    2319  nameOfSoftware_ = nomDeLogiciel("unknownSoftware");
    2420}
    2521
    26 abstractSoftware::abstractSoftware(string inputFileName,sectorParameters* lattice,dataManager* dt)
     22bool abstractSoftware::initComputationLimits_deprecated(unsigned int numeroDeb,unsigned int numeroFin_deprecated_)
    2723{
    28   inputFileName_ = inputFileName;
    29   globParamPtr_ = NULL;
    30   sectParamPtr_ = lattice;
    31   dataManager_ = dt;
    32   numeroDeb_ = 0;
    33   numeroFin_ = 0;
    34   nameOfSoftware_ = nomDeLogiciel("unknownSoftware");
     24/*  numeroDeb_deprecated_ = numeroDeb;
     25  numeroFin_deprecated__ = numeroFin_deprecated_;
     26  return ComputationLimitsOk_deprecated();
     27*/
    3528}
    3629
    37 bool abstractSoftware::initComputationLimits(unsigned int numeroDeb,unsigned int numeroFin)
     30bool abstractSoftware::ComputationLimitsOk_deprecated() const
    3831{
    39   numeroDeb_ = numeroDeb;
    40   numeroFin_ = numeroFin;
    41   return ComputationLimitsOk();
    42 }
    43 
    44 bool abstractSoftware::ComputationLimitsOk() const
    45 {
    46   if (numeroDeb_ < 1 || numeroFin_ < 1 || numeroDeb_ > dataManager_->getBeamLineSize() || numeroFin_ > dataManager_->getBeamLineSize() ) {
     32/*  if (numeroDeb_deprecated_ < 1 || numeroFin_deprecated__ < 1 || numeroDeb_deprecated_ > dataManager_->getBeamLineSize() || numeroFin_deprecated__ > dataManager_->getBeamLineSize() ) {
    4733    dataManager_->consoleMessage(" abstractSoftware::initComputationLimit : num of element out of limits in software " + getName() );
    4834    return false;
     
    5036    return true;
    5137  }
     38*/
     39  return true;
    5240}
    5341
  • Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc

    r449 r455  
    88#include "GWt_pspaApplication.h"
    99#include "GWt_console.h"
    10 
    11 #include "softwareParmela.h"
    12 #include "softwareTransport.h"
    13 #include "softwareGenerator.h"
    14 #include "softwareGenerator.h"
    15 #include "softwareUsersprogram.h"
    16 #include "softwareTest.h"
    17 #include "softwareMadx.h" //xx
    18 #include "softwareUnknown.h" //xx
     10#include "GWt_ligneFaisceau.h" // FIXME to be removed !
    1911
    2012#include <boost/filesystem.hpp>
     
    4638}
    4739
    48 string dataManager::getLabelFromElementNumero(int numero)
    49 {
    50   abstractElement* ptr = pspa_->getBeamLine()->getAbstractElement(numero-1);
     40string dataManager::getLabelFromElementNumero_deprecated(int numero)
     41{
     42/*
     43 abstractElement* ptr = pspa_->getBeamLine()->getAbstractElement(numero-1);
    5144  if ( ptr == NULL ) return "";
    5245  return ptr->getLabel();
    53 }
    54 
    55 int dataManager::getNumeroFromElementLabel(string label)
    56 {
    57   int index = -1;   
     46*/
     47return "";
     48}
     49
     50int dataManager::getNumeroFromElementLabel_deprecated(string label)
     51{
     52/*  int index = -1;
    5853  for (int k = 0; k < getBeamLineSize() ; k++) {
    5954    if (pspa_->getBeamLine()->getAbstractElement(k) != NULL) {
     
    6661  }
    6762  return index;
    68 }
    69 
    70 abstractElement* dataManager::getElementPointerFromNumero(int k)
    71 {
    72   return pspa_->getBeamLine()->getAbstractElement(k-1);
    73 }
    74 
    75 sectionToExecute* dataManager::addSectionToExecute(abstractElement* debut,int debutIndex, abstractElement* fin, int finIndex, nomDeLogiciel logiciel)
    76 {
    77 #if BAVARD > 0
    78   cout << "***********************************" << endl;
    79   cout << " dataManager::addSectionToExecute " << endl << endl;
    80 #endif
    81 
    82   abstractSoftware* prog;
    83   string inputFileName;
    84   if(logiciel == nomDeLogiciel::parmela) {
    85     inputFileName = "parmin";
    86     prog = new softwareParmela(inputFileName, &globParam_, this);
    87   } else if (logiciel  == nomDeLogiciel::transport) {
    88     inputFileName = "transport.input";
    89     prog =  new softwareTransport(inputFileName, &globParam_, this);
    90   } else if (logiciel == nomDeLogiciel::generator) {
    91     inputFileName = "generator.in";
    92     prog = new softwareGenerator(inputFileName, &globParam_, this);
    93   } else if (logiciel  == nomDeLogiciel::madx) {
    94     inputFileName = "madx.input";
    95     prog = new softwareMadx(inputFileName,&sectorParam_,this); 
    96   } else if (logiciel  == nomDeLogiciel::usersprogram) {
    97     inputFileName = "dummy";
    98     prog = new softwareUsersprogram(inputFileName, &globParam_, this);
    99   } else if (logiciel  == nomDeLogiciel::test) {
    100     prog = new softwareTest(inputFileName, &globParam_, this);
    101   } else {
    102     prog = new softwareUnknown(); // xx
    103   }
    104 
    105   jobList_.push_back(new sectionToExecute(debut,debutIndex,fin,finIndex,prog));
    106   return jobList_.back();
    107 }
    108 
    109 void dataManager::clearSectionToExecute()
    110 {
    111   unsigned k;
    112   for(k = 0; k < jobList_.size(); k++)
    113     {
    114       if ( jobList_[k] != NULL ) clearSectionToExecute(k);
    115     }
    116   jobList_.clear();
    117 }
    118 
    119 void dataManager::clearSectionToExecute(int a)
    120 {
    121   cout << " dataManager::clearSectionToExecute : effacement de la section d'index = " << a << endl;
    122   if (a < 0) return;
    123   if (a >= (int)jobList_.size()) return;
    124  
    125   // lors de la creation de la section on a fait un 'new' d'un
    126   // softwareXXXX : on fait ici le 'delete'
    127  
    128   const abstractSoftware* soft = jobList_.at(a)->getSoftware();
    129   if ( soft != NULL ) delete soft;
    130   jobList_.erase (jobList_.begin()+a);
    131 }
     63*/
     64  return 0;
     65}
     66
    13267
    13368void dataManager::initializeExecution()
     
    14883  indexElementToIndexDiag_.clear();
    14984  currentBeam_ = NULL;
    150   firstComputedElemNumero_ = getBeamLineSize();
    151   lastComputedElemNumero_ = 1;
    152   clearSectionToExecute();
     85  for (unsigned int a=0; a< jobList_.size(); a++) {
     86      jobList_[a]->clearSectionToExecute();
     87  }
    15388}
    15489
     
    171106
    172107  bool success = true;
    173   abstractSoftware* softw = NULL;
    174108  string workingDir = pspa_->getWorkingDir();
    175109 
    176   // on verifie la consecution des sections
    177   int lastel = 0;
     110
     111  // Main loop !
    178112  for(unsigned k = 0; k < jobList_.size(); k++) {
    179     if ( jobList_[k]->getElementNumberInSection() != lastel +1 ) {
    180       consoleMessage("dataManager::executeAll ERROR : sections should be consecutive ");
    181       return false;
    182     } else {
    183       lastel = jobList_[k]->getLastElementNumberInSection();
    184     }
    185   }
    186  
    187   unsigned debut;
    188   unsigned fin;
    189   for(unsigned k = 0; k < jobList_.size(); k++) {
    190 
    191 #if BAVARD > 0 
     113    sector* sector = jobList_[k];
     114   
     115    // for the moment, we put everything in one line without loops
     116    for (unsigned int l=0; l <sector->getSectionsToExecute().size(); l++) {
     117      sectionToExecute* section = sector->getSectionsToExecute()[l];
     118      abstractSoftware* softw = section->getSoftware();
     119     
     120#if BAVARD > 0
    192121    cout << " dataManager::executeAll je m'apprete a executer : " << (jobList_[k]->getSoftware()->getName()) << endl;
    193122#endif
    194    
    195     debut = jobList_[k]->getElementNumberInSection();
    196     fin = jobList_[k]->getLastElementNumberInSection();
    197     softw = jobList_[k]->getSoftware();
    198    
    199     //cout << "k= " << k << ", de " << jobList_[k]->getFirstElement()->getLabel() << " à " << jobList_[k]->getLastElement()->getLabel() << " avec " << softw->getName() << endl;
    200 
     123     
     124      //cout << "k= " << k << ", de " << jobList_[k]->getFirstElement()->getLabel() << " à " << jobList_[k]->getLastElement()->getLabel() << " avec " << softw->getName() << endl;
     125     
    201126    if (softw == NULL) {
    202127      success = false;
     
    205130    }
    206131   
    207     success = softw->createInputFile(currentBeam_,debut,fin,workingDir);
     132    success = softw->createInputFile(currentBeam_,workingDir);
    208133    if ( success ) {
    209134      success = softw->execute(workingDir);
     
    222147    if ( !success ) break;
    223148   
    224     if ( debut < firstComputedElemNumero_ ) firstComputedElemNumero_ = debut;
    225     if ( fin > lastComputedElemNumero_ ) lastComputedElemNumero_ = fin;
    226 
    227 #if BAVARD > 0   
    228     cout << "dataManager::executeAll #diagnosticBeam= " << diagnosticBeam_.size() << endl;
    229     cout << "dataManager::executeAll #getBeamLineSize()= " << getBeamLineSize() << endl;
    230     for (unsigned j = debut; j <= fin; j++) {
    231       abstractElement* elPtr= getElementPointerFromNumero(j);
    232       cout << "[" << j << "] " << elPtr->getNomdElement().getExpandedName() << endl;
    233     }
     149#if BAVARD > 0
     150      cout << "dataManager::executeAll #diagnosticBeam= " << diagnosticBeam_.size() << endl;
     151      cout << "dataManager::executeAll #getBeamLineSize()= " << getBeamLineSize() << endl;
     152      std::vector< abstractElement* > elements = section->getElements();
     153      for (unsigned j = 0; j < elements.size(); j++) {
     154        cout << "[" << j << "] " << elements[j]->getNomdElement().getExpandedName() << endl;
     155      }
    234156#endif
    235 
     157    } //l
    236158  } //k
    237159  // if ( currentBeam_ ) {
     
    241163  //   currentBeam_->readFromAMLFile(aml_file);
    242164  // }
    243   cout << " dataManager::executeAll() : premier element = " << firstComputedElemNumero_ << " dernier = " << lastComputedElemNumero_ << endl;
     165  cout << " dataManager::executeAll() " << endl;
    244166
    245167  return success;
     
    264186 
    265187  outfile << globParam_.FileOutputFlow();
    266   outfile << sectorParam_.FileOutputFlow();
    267 
     188
     189  // FIXME Francois: Comment sauver la configuration des section ?
     190  for (unsigned int a=0; a< jobList_.size(); a++) {
     191    outfile << jobList_[a]->getSectorParameters().FileOutputFlow();
     192  }
     193  // END
     194 
    268195  abstractElement* elPtr;
    269   for(int k = 0; k < getBeamLineSize() ; k++)
    270     {
    271       elPtr = pspa_->getBeamLine()->getAbstractElement(k);
    272       outfile << elPtr->FileOutputFlow();
    273     }
     196  for (unsigned k = 0; k < jobList_.size(); k++) {
     197    sector* sector = jobList_[k];
     198    for (unsigned l = 0; l < sector->getSectionsToExecute().size(); l++) {
     199      sectionToExecute* section = sector->getSectionsToExecute()[l];
     200      for (unsigned m = 0; m < section->getElements().size(); m++) {
     201        elPtr = section->getElements()[m];
     202        outfile << elPtr->FileOutputFlow();
     203      }
     204    }
     205  }
    274206  outfile.close();
    275207}
     
    300232
    301233  abstractElement* elPtr;
    302   for(int k = 0; k < getBeamLineSize() ; k++) {
    303     elPtr = pspa_->getBeamLine()->getAbstractElement(k);
    304     elPtr->InputRep(sect);
    305   }
    306  
     234  for (unsigned k = 0; k < jobList_.size(); k++) {
     235    sector* sector = jobList_[k];
     236    for (unsigned l = 0; l < sector->getSectionsToExecute().size(); l++) {
     237      sectionToExecute* section = sector->getSectionsToExecute()[l];
     238      for (unsigned m = 0; m < section->getElements().size(); m++) {
     239        elPtr = section->getElements()[m];
     240        elPtr->InputRep(sect);
     241      }
     242    }
     243  }
    307244  cout << "!Create the AML file ---------------------------" << endl;
    308245  AMLReader reader;
     
    335272      globParam_.FileInput(infile);
    336273    } else if (elementLabel == string("sectors") ) {
    337       sectorParam_.raz();
    338       sectorParam_.FileInput(infile);
     274      // FIXME Francois !!!!!!!
     275//      sectorParam_.raz();
     276//      sectorParam_.FileInput(infile);
     277      // END
    339278    } else {
    340279      elementType = nomdElements::getTypeFromLabel(elementLabel);
     
    371310}
    372311
    373 particleBeam* dataManager::getDiagnosticBeam(string elementLabel)
    374 {
    375   return getDiagnosticBeam( getNumeroFromElementLabel(elementLabel) -1);
     312particleBeam* dataManager::getDiagnosticBeam_deprecated(string elementLabel)
     313{
     314  // FIXME : Devra etre changé par une récupération par "abstractElement" et non pas par label
     315  unsigned int number = 0;
     316  abstractElement* elPtr;
     317  for (unsigned k = 0; k < jobList_.size(); k++) {
     318    sector* sector = jobList_[k];
     319    for (unsigned l = 0; l < sector->getSectionsToExecute().size(); l++) {
     320      sectionToExecute* section = sector->getSectionsToExecute()[l];
     321      for (unsigned m = 0; m < section->getElements().size(); m++) {
     322        elPtr = section->getElements()[m];
     323        if (elPtr->getLabel() == elementLabel) {
     324          return getDiagnosticBeam(number);
     325        }
     326        number ++;
     327      }
     328    }
     329  }
     330  return NULL;
    376331}
    377332
     
    390345  if ( type == "x" ) {
    391346    unsigned i = 0;
    392     cout << " dataManager::donneesRmsEnveloppe BeamLineSize = " << getBeamLineSize() << endl;
     347    cout << " dataManager::donneesRmsEnveloppe " << endl;
    393348    //    for (unsigned k = 0; k < getBeamLineSize(); k++) {
    394     for (unsigned k = firstComputedElemNumero_ -1 ; k < lastComputedElemNumero_ ; k++) {
    395       abstractElement* elPtr = pspa_->getBeamLine()->getAbstractElement(k);
    396       //     if(elPtr->getNomdElement().getElementType() == snapshot) continue;
    397       //      if(elPtr->getNomdElement().getElementType() == fit) continue;
    398       particleBeam* beamToDraw = getDiagnosticBeam(i);
    399       if ( !beamToDraw->momentRepresentationOk() ) {
    400         beamToDraw->buildMomentRepresentation();
    401       }
    402 
    403       longueur += elPtr->getLenghtOfElement();
    404       valeur = beamToDraw->getXmaxRms();
    405       cout << " dataManager::donneesRmsEnveloppe index = " << k <<  " longueur = " << longueur << " enveloppe : " << valeur << endl;
    406       xcor.push_back(0.01*longueur);  // on passe en metres
    407       ycor.push_back(valeur);
    408       i++;
     349    for (unsigned k = 0; k < jobList_.size(); k++) {
     350      sector* sector = jobList_[k];
     351      for (unsigned l = 0; l < sector->getSectionsToExecute().size(); l++) {
     352        sectionToExecute* section = sector->getSectionsToExecute()[l];
     353        for (unsigned m = 0; m < section->getElements().size(); m++) {
     354          abstractElement* elPtr = section->getElements()[m];
     355          //     if(elPtr->getNomdElement().getElementType() == snapshot) continue;
     356          //      if(elPtr->getNomdElement().getElementType() == fit) continue;
     357          particleBeam* beamToDraw = getDiagnosticBeam(i);
     358          if ( !beamToDraw->momentRepresentationOk() ) {
     359            beamToDraw->buildMomentRepresentation();
     360          }
     361         
     362          longueur += elPtr->getLenghtOfElement();
     363          valeur = beamToDraw->getXmaxRms();
     364          cout << " dataManager::donneesRmsEnveloppe index = " << k <<  " longueur = " << longueur << " enveloppe : " << valeur << endl;
     365          xcor.push_back(0.01*longueur);  // on passe en metres
     366          ycor.push_back(valeur);
     367          i++;
     368        }
     369      }
    409370    }
    410371    legendy.clear();
     
    413374}
    414375
    415 int dataManager::getBeamLineSize() {
    416     return pspa_->getBeamLine()->getBeamLineSize();
    417 }
    418 
    419 
    420 abstractSoftware* dataManager::createSoftwareConnexion(nomDeLogiciel logi)
    421 {
    422   string inputFileName;
    423   if(logi == nomDeLogiciel::parmela) {
    424     cout << " dataManager::createSoftwareConnexion : logiciel identifie : parmela " << endl;
    425     inputFileName = "parmin";
    426     return new softwareParmela(inputFileName, &globParam_, this);
    427   } else if (logi == nomDeLogiciel::transport) {
    428     cout << " dataManager::createSoftwareConnexion : logiciel identifie : transport " << endl;
    429     inputFileName = "transport.input";
    430     return new softwareTransport(inputFileName, &globParam_, this);
    431   } else if (logi == nomDeLogiciel::generator) {
    432     cout << " dataManager::createSoftwareConnexion : logiciel identifie : generator " << endl;
    433     inputFileName = "generator.in";
    434     return new softwareGenerator(inputFileName, &globParam_, this);
    435   } else if (logi == nomDeLogiciel::test) {
    436     cout << " dataManager::createSoftwareConnexion : logiciel identifie : test " << endl;
    437         return new softwareTest(inputFileName, &globParam_, this);
    438   } else {
    439     cout << " dataManager::createSoftwareConnexion : logiciel identifie : null " << endl;
    440     return NULL;
    441   }
    442 }
     376int dataManager::getBeamLineSize_deprecated() {
     377// FIXME : Cette methode ne doit pas exister, mis a part pour savoir quelle est la taille de la beamLine
     378  unsigned int i = 0;
     379  for (unsigned k = 0; k < jobList_.size(); k++) {
     380    sector* sector = jobList_[k];
     381    for (unsigned l = 0; l < sector->getSectionsToExecute().size(); l++) {
     382      i += sector->getSectionsToExecute()[l]->getElements().size();
     383    }
     384  }
     385  return i;
     386}
     387
    443388
    444389sector* dataManager::addNewSector() {
     
    448393  str >> result;
    449394 
    450   sector* sect = new sector(std::string("sector ") + result);
    451   sectors_.push_back(sect);
     395  sector* sect = new sector(this, std::string("sector ") + result);
     396  jobList_.push_back(sect);
    452397  return sect;
    453398}
  • Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc

    r442 r455  
    3030}
    3131
    32 int particleBeam::getNbParticles() const {
     32unsigned long particleBeam::getNbParticles() const {
    3333  return relativePartic_.size();
    3434}
  • Interface_Web/trunk/pspaWT/sources/controler/src/sectionToExecute.cc

    r419 r455  
    22
    33
    4 sectionToExecute::sectionToExecute(abstractElement* f, abstractElement* l , abstractSoftware* s) {
    5     firstElement = f;
    6     lastElement =l;
    7     software = s;
     4sectionToExecute::sectionToExecute(abstractElement* a) {
     5  elements_.push_back(a);
    86}
    97
    108
    11 sectionToExecute::sectionToExecute(abstractElement* f, int fI, abstractElement* l , int lI, abstractSoftware* s) {
    12     firstElement = f;
    13     lastElement =l;
    14 
    15     firstElementNumberInBeamLine = fI;
    16     lastElementNumberInBeamLine =lI;
    17 
    18     software = s;
     9sectionToExecute::sectionToExecute(abstractElement* f, abstractSoftware* s) {
     10  elements_.push_back(f);
     11    software_ = s;
    1912}
    2013
     14
     15bool sectionToExecute::insertAfter(abstractElement* previousElement,abstractElement* currentElement) {
     16
     17  std::vector<abstractElement*>::iterator it;
     18  for (it = elements_.begin(); it < elements_.end(); it++) {
     19    if (*it == previousElement ) {
     20      elements_.insert (it+1,currentElement);
     21      return true;
     22    }
     23  }
     24  return false;
     25}
     26
     27/*
     28bool sectionToExecute::setSoftware(nomDeLogiciel logiciel) {
     29 
     30  if (sectionToExecuteNumber >= sectionToExecute_.size()) {
     31    return false;
     32  }
     33 
     34  abstractSoftware* prog;
     35  string inputFileName;
     36  if(logiciel == nomDeLogiciel::parmela) {
     37    inputFileName = "parmin";
     38    prog = new softwareParmela(inputFileName, this);
     39  } else if (logiciel  == nomDeLogiciel::transport) {
     40    inputFileName = "transport.input";
     41    prog =  new softwareTransport(inputFileName, this);
     42  } else if (logiciel == nomDeLogiciel::generator) {
     43    inputFileName = "generator.in";
     44    prog = new softwareGenerator(inputFileName, this);
     45  } else if (logiciel  == nomDeLogiciel::madx) {
     46    inputFileName = "madx.input";
     47    prog = new softwareMadx(inputFileName,this);
     48  } else if (logiciel  == nomDeLogiciel::usersprogram) {
     49    inputFileName = "dummy";
     50    prog = new softwareUsersprogram(inputFileName, this);
     51  } else if (logiciel  == nomDeLogiciel::test) {
     52    prog = new softwareTest(inputFileName, this);
     53  } else {
     54    prog = new softwareUnknown(); // xx
     55  }
     56 
     57  sectionToExecute_[sectionToExecuteNumber]->setSoftware(prog);
     58  return true;
     59}
     60*/
  • Interface_Web/trunk/pspaWT/sources/controler/src/sector.cc

    r449 r455  
    88
    99#include "sector.h"
     10#include "softwareParmela.h"
     11#include "softwareTransport.h"
     12#include "softwareGenerator.h"
     13#include "softwareGenerator.h"
     14#include "softwareUsersprogram.h"
     15#include "softwareTest.h"
     16#include "softwareMadx.h" //xx
     17#include "softwareUnknown.h" //xx
    1018
    11 sector::sector(std::string name):
     19#include "sectionToExecute.h"
     20#include "dataManager.h"
     21
     22sector::sector(dataManager* data, std::string name):
    1223reflected_(false),
    1324duplicatedFrom_(NULL),
    1425repetitionNumber_(1),
    15 name_(name)
     26name_(name),
     27dataManager_(data),
     28sectorParam_(this)
    1629{
    1730 
     
    2033sector::~sector()  {
    2134}
     35
     36void sector::addElementAfter(abstractElement* currentElement ,abstractElement* previousElement){
     37  if (previousElement == NULL) {
     38    if (sectionToExecute_.size() == 0) {
     39      sectionToExecute_.push_back(new sectionToExecute(currentElement));
     40    } else {
     41      sectionToExecute_.insert ( sectionToExecute_.begin() , new sectionToExecute(currentElement) );
     42    }
     43  } else {
     44 
     45    for (unsigned int i=0; i<sectionToExecute_.size(); i++) {
     46      sectionToExecute* section = sectionToExecute_[i];
     47      if (section->insertAfter(previousElement,currentElement)) {
     48        return;
     49      }
     50    }
     51  }
     52}
     53
     54void sector::clearSectionToExecute()
     55{
     56  unsigned k;
     57  for(k = 0; k < sectionToExecute_.size(); k++)
     58  {
     59    if ( sectionToExecute_[k] != NULL ) clearSectionToExecute(k);
     60  }
     61  sectionToExecute_.clear();
     62}
     63
     64void sector::clearSectionToExecute(int a)
     65{
     66  cout << " dataManager::clearSectionToExecute : effacement de la section d'index = " << a << endl;
     67  if (a < 0) return;
     68  if (a >= (int)sectionToExecute_.size()) return;
     69 
     70  // lors de la creation de la section on a fait un 'new' d'un
     71  // softwareXXXX : on fait ici le 'delete'
     72 
     73  const abstractSoftware* soft = sectionToExecute_.at(a)->getSoftware();
     74  if ( soft != NULL ) delete soft;
     75  sectionToExecute_.erase (sectionToExecute_.begin()+a);
     76}
  • Interface_Web/trunk/pspaWT/sources/controler/src/sectorParameters.cc

    r436 r455  
    55#define BAVARD 1
    66
    7 sectorParameters::sectorParameters()
     7sectorParameters::sectorParameters(sector* sect):
     8sector_(sect)
    89{
    910  geometry_= string("CIRCULAR");
    10   sectors_.push_back(statements("vide",vector<string>()));
    11   sectors_.back().second.push_back("xxx");
    12   sectors_.back().second.push_back("xxx");
    13   sectors_.back().second.push_back("Unchecked");
    14   sectors_.back().second.push_back("1");
     11  sectorsStatements_.push_back(statements("vide",vector<string>()));
     12  sectorsStatements_.back().second.push_back("xxx");
     13  sectorsStatements_.back().second.push_back("xxx");
     14  sectorsStatements_.back().second.push_back("Unchecked");
     15  sectorsStatements_.back().second.push_back("1");
    1516}
    1617
     
    4546void sectorParameters::raz()
    4647{
    47   if(!sectors_.empty()) sectors_.clear();
     48  if(!sectorsStatements_.empty()) sectorsStatements_.clear();
    4849}
    4950
     
    5253  ostringstream sortie;
    5354  sortie << " sectors " << endl;
    54   sortie << sectors_.size() << endl;
    55   for(int i = 0; i < sectors_.size(); i++) {
    56     sortie << sectors_.at(i).first << " " << sectors_.at(i).second.at(0) << " " << sectors_.at(i).second.at(1) << " " << sectors_.at(i).second.at(2) << " " << sectors_.at(i).second.at(3) << endl;
     55  sortie << sectorsStatements_.size() << endl;
     56  for(int i = 0; i < sectorsStatements_.size(); i++) {
     57    sortie << sectorsStatements_.at(i).first << " " << sectorsStatements_.at(i).second.at(0) << " " << sectorsStatements_.at(i).second.at(1) << " " << sectorsStatements_.at(i).second.at(2) << " " << sectorsStatements_.at(i).second.at(3) << endl;
    5758  }
    5859  return sortie.str(); 
     
    6667  for(int i = 0; i < n; i++) {
    6768    ifs >> txt;
    68     sectors_.push_back(statements(txt,vector<string>()));
     69    sectorsStatements_.push_back(statements(txt,vector<string>()));
    6970    for(int j = 0; j < 4; j++) {
    7071      ifs >> txt;
    71       sectors_.back().second.push_back(txt);
     72      sectorsStatements_.back().second.push_back(txt);
    7273    }
    7374  }
     
    104105
    105106vector<statements> sectorParameters::getSectors() const {
    106   return sectors_;
     107  return sectorsStatements_;
    107108}
    108109
     
    114115#endif
    115116
    116   if(!sectors_.empty()) sectors_.clear();
     117  if(!sectorsStatements_.empty()) sectorsStatements_.clear();
    117118
    118119  for(int i = 0; i < v.size(); i++) {
    119     sectors_.push_back(statements(v.at(i).first,vector<string>()));
     120    sectorsStatements_.push_back(statements(v.at(i).first,vector<string>()));
    120121    for(int j = 0; j < 4; j++)
    121       sectors_.back().second.push_back(v.at(i).second.at(j));
     122      sectorsStatements_.back().second.push_back(v.at(i).second.at(j));
    122123  }
    123124
    124125#if BAVARD > 0
    125   cout << "sectors_.size()= " << sectors_.size() << endl;
    126   for(int i = 0; i < sectors_.size(); i++) {
    127     cout << "name= " << sectors_.at(i).first << ", de " << sectors_.at(i).second.at(0) << ", à " << sectors_.at(i).second.at(1) << ", reflection = " << sectors_.at(i).second.at(2) << ", repeat= " << sectors_.at(i).second.at(3) << endl << endl;
     126  cout << "sectorsStatements_.size()= " << sectorsStatements_.size() << endl;
     127  for(int i = 0; i < sectorsStatements_.size(); i++) {
     128    cout << "name= " << sectorsStatements_.at(i).first << ", de " << sectorsStatements_.at(i).second.at(0) << ", à " << sectorsStatements_.at(i).second.at(1) << ", reflection = " << sectorsStatements_.at(i).second.at(2) << ", repeat= " << sectorsStatements_.at(i).second.at(3) << endl << endl;
    128129  }
    129130#endif
  • Interface_Web/trunk/pspaWT/sources/controler/src/softwareGenerator.cc

    r442 r455  
    1212}
    1313
    14 softwareGenerator::softwareGenerator(string inputFileName, globalParameters* globals, dataManager* dt) : abstractSoftware(inputFileName, globals, dt)
     14softwareGenerator::softwareGenerator(string inputFileName, sectionToExecute* sect) : abstractSoftware(inputFileName, sect)
    1515{
    1616  cout << " softwareUsersprogram::softwareGenerator ENREGISTREMENT " << endl;
     
    1919}
    2020
    21 bool softwareGenerator::createInputFile(particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
     21bool softwareGenerator::createInputFile(particleBeam* beamBefore, string workingDir)
    2222{
    23   if ( !initComputationLimits(numeroDeb,numeroFin) ) return false;
    24 
    25   if ( numeroDeb_ != numeroFin_ ) return false;
    26 
    27   abstractElement* elPtr;
    28   elPtr = dataManager_->getElementPointerFromNumero(numeroDeb_);
    29 
    30   if ( elPtr->getNomdElement().getElementType() != nomdElements::RFgun ) {
     23  abstractElement* firstElement = getSectionToExecute()->getElements().front();
     24 
     25  if ( firstElement->getNomdElement().getElementType() != nomdElements::RFgun ) {
    3126    dataManager_->consoleMessage(" softwareGenerator::createInputFile : the element must be rfgun " );
    3227    cerr << " softwareGenerator::createInputFile : the element must be rfgun" << endl;
     
    4742  outfile << " Add=FALSE, N_add=0" << endl;
    4843  outfile << " Species='electrons'" << endl;
    49   //  outfile << elPtr->generatorOutputFlow() << endl;
    50 
    51   outfile << elementsData(elPtr->parametersToSoftware()) << endl;
     44  //  outfile << firstElement->generatorOutputFlow() << endl;
     45
     46  outfile << elementsData(firstElement->parametersToSoftware()) << endl;
    5247
    5348  outfile << "/" << endl;
     
    6257 
    6358  ostringstream sortie;
    64   sortie << " EXECUTION DE GENERATOR DE l'ELEMENT " << numeroDeb_ << " A L'ELEMENT " << numeroFin_ << endl;
     59  sortie << " EXECUTION DE GENERATOR DE l'ELEMENT " << numeroDeb_deprecated_ << " A L'ELEMENT " << numeroFin_deprecated_ << endl;
    6560
    6661  string generatorJob = workingDir + "generator";
     
    9792
    9893  bool result = true;
    99   if ( !ComputationLimitsOk() ) return false;
    100 
    101   if ( numeroDeb_ != numeroFin_ ) {
     94  if ( !ComputationLimitsOk_deprecated() ) return false;
     95
     96  if ( numeroDeb_deprecated_ != numeroFin_deprecated_ ) {
    10297    dataManager_->consoleMessage(" softwareGenerator::buildBeamAfterElements : only one element (rfgun) must be calculated " );
    10398    return false;
  • Interface_Web/trunk/pspaWT/sources/controler/src/softwareMadx.cc

    r436 r455  
    88}
    99
    10 softwareMadx::softwareMadx(string inputFileName,sectorParameters* lattice,dataManager* dt) : abstractSoftware(inputFileName,lattice,dt)
     10softwareMadx::softwareMadx(string inputFileName,sectionToExecute* sect) : abstractSoftware(inputFileName,sect)
    1111{
    1212  nameOfSoftware_ = nomDeLogiciel("madx");
     
    1616}
    1717
    18 bool softwareMadx::createInputFile(particleBeam* beamBefore,unsigned int numeroDeb,unsigned int numeroFin,string workingDir)
     18bool softwareMadx::createInputFile(particleBeam* beamBefore, string workingDir)
    1919{
    2020  cout << "***********************************" << endl;
     
    2222
    2323  dataManager_->consoleMessage(" softwareMadx::createInputFile");
    24   if (!initComputationLimits(numeroDeb,numeroFin)) return false;
    2524
    2625  string name = workingDir + inputFileName_;
     
    3332  }
    3433
    35   cout << " softwareMadx::createInputFile(...) lecture des elts de " << numeroDeb_ << " à " << numeroFin_ << endl;
     34  cout << " softwareMadx::createInputFile(...) lecture des elts " << endl;
    3635 
    3736  // element label //////////////////////////
     
    4039
    4140  abstractElement* elPtr;
    42   for(unsigned k = numeroDeb_; k <= numeroFin_; k++)
     41  std::vector <abstractElement*> elements = getSectionToExecute()->getElements();
     42  for(unsigned k = 0; k < elements.size(); k++)
    4343    {
    44       elPtr = dataManager_->getElementPointerFromNumero(k);
     44      elPtr = elements[k];
    4545      //cout << " debug:: element [" << k << "] " << elPtr->getNomdElement().getExpandedName() << endl;
    4646      vector<statements> v= elPtr->parametersToSoftware();
     
    5252  outfile << endl; // saut de ligne
    5353
     54  //_______________________________________________________
     55  // FIXME Francois !!!!!
     56  //_______________________________________________________
     57 /*
    5458  vector<statements> u = sectParamPtr_->getSectors();
    5559  for(unsigned int i = 0; i < u.size(); i++) {
     
    5963    unsigned bi = dataManager_->getNumeroFromElementLabel(u.at(i).second.at(1));
    6064
    61     for(unsigned k = numeroDeb_; k <= numeroFin_; k++) {
    62       elPtr = dataManager_->getElementPointerFromNumero(k);
     65    std::vector <abstractElement*> elements = getSectionToExecute()->getElements();
     66    for(unsigned k = 0; k < elements.size(); k++) {
     67      elPtr = elements[k];
    6368     
    6469      if(k >= ai && k <= bi) {
     
    8590  ostringstream os;
    8691  os << "all: " << "line=(";
    87   for(unsigned k = numeroDeb_; k <= numeroFin_; k++) {
    88     elPtr = dataManager_->getElementPointerFromNumero(k);
     92  for(unsigned k = 0; k < elements.size(); k++) {
     93    elPtr = elements[k];
    8994    bool isMember = false;
    9095
     
    112117    }// i
    113118   
    114     if(isMember && k == numeroFin_) os << ");";
    115    
     119    if(isMember && k == (elements.size()-1)) os << ");";
     120    
    116121    if(!isMember) {
    117       if(k == numeroFin_) os << elPtr->getLabel() << ");";
     122      if(k == (elements.size()-1)) os << elPtr->getLabel() << ");";
    118123      else os << elPtr->getLabel() << ",";
    119124    }
     
    131136  outfile << "twiss,save,centre,file = "+workingDir+"twiss.out;" << endl; //p51
    132137  outfile << "stop;" << endl;
     138
     139  */
     140  //_______________________________________________________
     141  // FIXME Francois !!!!!
     142  //_______________________________________________________
    133143
    134144  outfile.close();
     
    174184
    175185  ostringstream sortie;
    176   sortie << " run madx from " << numeroDeb_ << " to " << numeroFin_ << endl;
     186  sortie << " run madx " << endl;
    177187
    178188  string mjob = workingDir + "madx64";
  • Interface_Web/trunk/pspaWT/sources/controler/src/softwareParmela.cc

    r418 r455  
    1212}
    1313
    14 softwareParmela::softwareParmela(string inputFileName, globalParameters* globals, dataManager* dt) : abstractSoftware(inputFileName, globals, dt)
     14softwareParmela::softwareParmela(string inputFileName,sectionToExecute* sect) : abstractSoftware(inputFileName, sect)
    1515{
    1616  nameOfSoftware_ = nomDeLogiciel("parmela");
     
    2626void softwareParmela::setRelativeParmelaElementIndices() {
    2727  relativeParmelaElementIndices_.clear();
    28   relativeParmelaElementIndices_.resize(numeroFin_ - numeroDeb_ + 1, -1);
     28  relativeParmelaElementIndices_.resize(numeroFin_deprecated_ - numeroDeb_deprecated_ + 1, -1);
    2929  cout << " setRelativeParmelaElementIndices() taille a priori : " << relativeParmelaElementIndices_.size() << endl;
    30   abstractElement* elPtr = dataManager_->getElementPointerFromNumero(numeroDeb_);
     30  abstractElement* elPtr = getSectionToExecute()->getElements().front();
    3131
    3232  bool there_is_rfgun = ( elPtr->getNomdElement().getElementType() == nomdElements::RFgun );
     
    3434  // les elements de parmela sont indexes de 1 à max, s'il n'y a pas de rfgun
    3535  if ( !there_is_rfgun ) {
    36     offsetNumElem = numeroDeb_ -1;
     36    offsetNumElem = numeroDeb_deprecated_ -1;
    3737    // les elements de parmela sont indexes de 0 à max, s'il y a un rfgun
    3838  } else {
    39     offsetNumElem = numeroDeb_;
     39    offsetNumElem = numeroDeb_deprecated_;
    4040  }
    4141
    4242  // index du premier element de parmela
    43   int id= numeroDeb_ - offsetNumElem;
     43  int id= numeroDeb_deprecated_ - offsetNumElem;
    4444  unsigned k;
    4545  unsigned curseur = 0;
    46   for ( k=numeroDeb_; k <= numeroFin_ ; k++ ) {
    47     abstractElement* elem = dataManager_->getElementPointerFromNumero(k);
     46  for ( k=0; k < getSectionToExecute()->getElements().size() ; k++ ) {
     47    abstractElement* elem = getSectionToExecute()->getElements()[k];
    4848    cout << " liste PARMELA no absolu " << k << " relatif provisoire " << relativeParmelaElementIndices_.at(curseur) << endl;
    4949    // if ( elem->is_accepted_by_software(nameOfSoftware_) == TBoolOk ) {
     
    5858
    5959
    60 bool softwareParmela::createInputFile(particleBeam* beamBefore,unsigned int numeroDeb,unsigned int numeroFin,string workingDir)
     60bool softwareParmela::createInputFile(particleBeam* beamBefore, string workingDir)
    6161{
    6262  unsigned int k;
    63   if ( !initComputationLimits(numeroDeb,numeroFin) ) return false;
     63
    6464  setRelativeParmelaElementIndices();
    6565  string name = workingDir + inputFileName_;
     
    7272  }
    7373 
    74   abstractElement* elPtr;
     74  abstractElement* elPtr = getSectionToExecute()->getElements().front();
    7575  double initalKineticEnergy = 0.0;
    76   elPtr = dataManager_->getElementPointerFromNumero(numeroDeb_);
    77   bool there_is_rfgun = ( elPtr->getNomdElement().getElementType() == nomdElements::RFgun );
     76  bool there_is_rfgun = (elPtr->getNomdElement().getElementType() == nomdElements::RFgun );
    7877 
    7978  if ( !there_is_rfgun ) {
     
    8483    //    offsetNumElem_ = numeroDeb_ -1;
    8584  } else {
    86     elPtr->setPhaseStep( globParamPtr_->getIntegrationStep() );
     85    elPtr->setPhaseStep( dataManager_->getGlobalParameters()->getIntegrationStep() );
    8786    initalKineticEnergy = elPtr->getInitialKineticEnergy();
    8887    // les elements de parmela sont indexes de 0 à max, s'il y a un rfgun
    89     //    offsetNumElem_ = numeroDeb_;
    9088  }
    9189 
    9290  outfile << "TITLE" << endl;
    9391  outfile << " titre provisoire " << endl;
    94   outfile << "RUN /n0=1 /ip=999 /freq=" << globParamPtr_->getFrequency() << "  /z0=0.0 /W0=" << initalKineticEnergy << "  /itype=1" << endl;
     92  outfile << "RUN /n0=1 /ip=999 /freq=" << dataManager_->getGlobalParameters()->getFrequency() << "  /z0=0.0 /W0=" << initalKineticEnergy << "  /itype=1" << endl;
    9593  outfile << "OUTPUT 0" << endl;
    96   unsigned int premier = numeroDeb_ ;
    9794  if ( there_is_rfgun ) {
    98     //    outfile << dataManager_->getElementPointerFromNumero(numeroDeb_)->parmelaOutputFlow();
    99     outfile << elementsData(dataManager_->getElementPointerFromNumero(numeroDeb_)->parametersToSoftware());
    100     premier++;
     95    //    outfile << dataManager_->getElementPointerFromNumero(numeroDeb_deprecated_)->parmelaOutputFlow();
     96    outfile << elementsData(elPtr->parametersToSoftware());
    10197  } else {
    10298    outfile << "INPUT 0 /NP=" << beamBefore->getNbParticles() << endl;
    10399  }
    104100 
    105   for ( k = premier; k <= numeroFin_; k++)
     101 // retrouver le sector !!
     102  for ( k =1; k <= getSectionToExecute()->getElements().size(); k++)
    106103    {
    107       elPtr = dataManager_->getElementPointerFromNumero(k);
    108       if (elPtr) {
    109         //      outfile << elPtr->parmelaOutputFlow();
    110         outfile << elementsData(elPtr->parametersToSoftware());
    111       }
     104      outfile << elementsData(getSectionToExecute()->getElements()[k]->parametersToSoftware());
    112105    }
    113106   
    114107  outfile << "ZOUT" << endl;
    115   outfile << "START /wt=0.0 /dwt=" << globParamPtr_->getIntegrationStep() << "  /nsteps=" << globParamPtr_->getNbSteps() << "  nsc=" << globParamPtr_->getScPeriod() << "  /nout=10" << endl;
     108  outfile << "START /wt=0.0 /dwt=" << dataManager_->getGlobalParameters()->getIntegrationStep() << "  /nsteps=" << dataManager_->getGlobalParameters()->getNbSteps() << "  nsc=" << dataManager_->getGlobalParameters()->getScPeriod() << "  /nout=10" << endl;
    116109  outfile << "END" << endl;
    117110  outfile.close();
     
    125118 
    126119  ostringstream sortie;
    127   sortie << " EXECUTION DE PARMELA DE l'ELEMENT " << numeroDeb_ << " A L'ELEMENT " << numeroFin_ << endl;
     120  sortie << " EXECUTION DE PARMELA DE l'ELEMENT " << numeroDeb_deprecated_ << " A L'ELEMENT " << numeroFin_deprecated_ << endl;
    128121   
    129122  string parmelaJob = workingDir + "parmela";
     
    158151  bool result = true;
    159152
    160   if ( !ComputationLimitsOk() ) return false;
     153  if ( !ComputationLimitsOk_deprecated() ) return false;
    161154  unsigned curseur;
    162   for(unsigned k = numeroDeb_; k <= numeroFin_; k++)
    163     {
    164       abstractElement* elem = dataManager_->getElementPointerFromNumero(k);
     155  for ( unsigned int k=0; k < getSectionToExecute()->getElements().size() ; k++ ) {
     156    abstractElement* elem = getSectionToExecute()->getElements()[k];
    165157      if ( elem == NULL ) {
    166158        dataManager_->consoleMessage(" softwareParmela::buildBeamAfterElements : null pointer on element " );
     
    168160      }
    169161
    170       curseur = k - numeroDeb_;
     162      curseur = k - numeroDeb_deprecated_;
    171163
    172164      if ( relativeParmelaElementIndices_.at(curseur) < 0 ) {
     
    192184          bareParticle refPart;
    193185          vector<bareParticle> particles;
    194           double freq= globParamPtr_->getFrequency();
     186          double freq= dataManager_->getGlobalParameters()->getFrequency();
    195187          unsigned numeroParmel;
    196188          numeroParmel = (unsigned)relativeParmelaElementIndices_.at(curseur);
  • Interface_Web/trunk/pspaWT/sources/controler/src/softwareTest.cc

    r386 r455  
    1414
    1515
    16 softwareTest::softwareTest(string inputFileName, globalParameters* globals, dataManager* dt) : abstractSoftware( inputFileName, globals, dt)
     16softwareTest::softwareTest(string inputFileName,sectionToExecute* sect) : abstractSoftware(inputFileName, sect)
    1717{
    1818  nameOfSoftware_ = nomDeLogiciel("test");
    1919}
    2020
    21 bool softwareTest::createInputFile( particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
     21bool softwareTest::createInputFile( particleBeam* beamBefore, string workingDir)
    2222{
    2323    dataManager_->consoleMessage(" softwareTest::createInputFile  " );
     
    3939  bool result = true;
    4040  unsigned k;
    41   for ( k= numeroDeb_; k <= numeroFin_; k++)
     41  for ( k= numeroDeb_deprecated_; k <= numeroFin_deprecated_; k++)
    4242    {
    4343      particleBeam* newDiag = dataManager_->updateCurrentDiagnostic(true);
  • Interface_Web/trunk/pspaWT/sources/controler/src/softwareTransport.cc

    r418 r455  
    1111}
    1212
    13 softwareTransport::softwareTransport(string inputFileName,globalParameters* globals, dataManager* dt) : abstractSoftware(inputFileName, globals, dt)
     13softwareTransport::softwareTransport(string inputFileName,sectionToExecute* sect) : abstractSoftware(inputFileName, sect)
    1414{
    1515  nameOfSoftware_ = nomDeLogiciel("transport");
     
    2222}
    2323
    24 bool softwareTransport::createInputFile(particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
     24bool softwareTransport::createInputFile(particleBeam* beamBefore, string workingDir)
    2525{
    2626
    2727
    28 
    29   if ( !initComputationLimits(numeroDeb,numeroFin) ) return false;
    30 
    31   abstractElement* premierEl = NULL;
    32   premierEl = dataManager_->getElementPointerFromNumero(numeroDeb_);
     28  abstractElement* premierEl = getSectionToExecute()->getElements().front();
    3329
    3430  // ceinture et bretelles
     
    8884
    8985  abstractElement* elPtr;
    90   for (unsigned k = numeroDeb_; k <= numeroFin_; k++)
     86  for (unsigned k = 0; k < getSectionToExecute()->getElements().size(); k++)
    9187    {
    92       elPtr = dataManager_->getElementPointerFromNumero(k);
     88      elPtr = getSectionToExecute()->getElements()[k];
    9389      cout << "debug:: element [" << k << "] " << elPtr->getNomdElement().getExpandedName() << endl;
    9490      //      outfile << elPtr->transportOutputFlow();
     
    109105
    110106  ostringstream sortie;
    111   sortie << " EXECUTION DE TRANSPORT DE " << numeroDeb_ << " a " << numeroFin_ << endl;
     107  sortie << " EXECUTION DE TRANSPORT DE " << numeroDeb_deprecated_ << " a " << numeroFin_deprecated_ << endl;
    112108 
    113109  string transportJob = workingDir + "transport";
     
    145141
    146142  bool result = true;
    147   if ( !ComputationLimitsOk() ) return false;
    148 
    149   for (unsigned k = numeroDeb_; k <= numeroFin_; k++)
     143  if ( !ComputationLimitsOk_deprecated() ) return false;
     144
     145  for (unsigned k = 0; k < getSectionToExecute()->getElements().size(); k++)
    150146    {
    151       abstractElement* ptr = dataManager_->getElementPointerFromNumero(k);
     147      abstractElement* ptr = getSectionToExecute()->getElements()[k];
    152148      if ( ptr == NULL ) {
    153149        dataManager_->consoleMessage(" softwareTransport::buildBeamAfterElements : null pointer on element " );
  • Interface_Web/trunk/pspaWT/sources/controler/src/softwareUnknown.cc

    r431 r455  
    1717}
    1818
    19 bool softwareUnknown::createInputFile(particleBeam* beamBefore,unsigned int numeroDeb,unsigned int numeroFin,string workingDir)
     19bool softwareUnknown::createInputFile(particleBeam* beamBefore,sectionToExecute* sectionToExe, string workingDir)
    2020{
    2121  return true;
  • Interface_Web/trunk/pspaWT/sources/controler/src/softwareUsersprogram.cc

    r442 r455  
    1010}
    1111
    12 softwareUsersprogram::softwareUsersprogram(string inputFileName,globalParameters* globals, dataManager* dt) : abstractSoftware(inputFileName, globals, dt)
     12softwareUsersprogram::softwareUsersprogram(string inputFileName, sectionToExecute* sect) : abstractSoftware(inputFileName, sect)
    1313{
    1414  cout << " softwareUsersprogram::softwareUsersprogram ENREGISTREMENT " << endl;
     
    1717}
    1818
    19 bool softwareUsersprogram::createInputFile(particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir)
     19bool softwareUsersprogram::createInputFile(particleBeam* beamBefore, string workingDir)
    2020{
    2121
     22  abstractElement* element = getSectionToExecute()->getElements().front();
    2223
    23   if ( !initComputationLimits(numeroDeb,numeroFin) ) return false;
    24   if ( numeroDeb_ != numeroFin_ ) {
    25     cout << " ERROR softwareUsersprogram::createInputFile : plusieurs elements  " << endl;
    26     return false;
    27   }
    28 
    29   abstractElement* element = NULL;
    30   element = dataManager_->getElementPointerFromNumero(numeroDeb_);
    3124  // Dans le cas où l'element n'est pas snapshot
    3225  if ( element->getNomdElement().getElementType() != nomdElements::snapshot ) {
     
    6356
    6457  ostringstream sortie;
    65   sortie << " EXECUTION DE " << nomProgram_ << " element " << numeroDeb_  << endl;
     58  sortie << " EXECUTION DE " << nomProgram_ << endl;
    6659 
    6760  string usersprogramJob = workingDir + nomProgram_;
     
    10396
    10497
    105   if ( !ComputationLimitsOk() ) return false;
    106 
     98  if ( !ComputationLimitsOk_deprecated() ) return false;
     99 
    107100  //  for (unsigned k = numeroDeb_; k <= numeroFin_; k++)
    108    
    109       abstractElement* ptr = dataManager_->getElementPointerFromNumero(numeroDeb_);
     101 
     102  abstractElement* ptr = getSectionToExecute()->getElements().front();
    110103      if ( ptr == NULL ) {
    111104        dataManager_->consoleMessage("ERROR  softwareUsersprogram::buildBeamAfterElements : null pointer on element " );
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_accelerator.h

    r446 r455  
    66#include <Wt/WContainerWidget>
    77#include <Wt/WScrollArea>
    8 #include "GWt_pspaApplication.h"
     8#include <Wt/WComboBox>
     9#include <Wt/WDialog>
     10#include <Wt/WPdfImage>
     11#include <Wt/Chart/WCartesianChart>
     12#include <Wt/WLength>
     13
    914#include "dataManager.h"
    1015
     16#include "GWt_dialog.h"
    1117
    1218using namespace Wt;
     
    1824 
    1925public:
    20   GWt_accelerator(WContainerWidget* parent,PspaApplication* pspa);
     26  GWt_accelerator(WContainerWidget*, dataManager*);
    2127  virtual ~GWt_accelerator();
    2228  inline WContainerWidget* getAcceleratorDetailledView() {return acceleratorDetailledView_;};
    2329  inline WLayout* getAcceleratorGlobalViewLayout() {return acceleratorGlobalViewLayout_;};
    24   inline PspaApplication* getControler() { return pspa_;};
    25  
     30  inline dataManager* getDataManager() { return dataManager_;};
     31  void faireDessin();
     32  WContainerWidget* createDrawingWidget();
     33
    2634  private :
    2735  WContainerWidget* acceleratorDetailledView_;
    2836  void addSector();
    2937  void run();
     38  void closeGraphicDialog();
     39  void dialogOnGraphics();
     40  void dessiner();
     41  void faireDessinPhaseSpace(WContainerWidget* toto, particleBeam* beam, string elementLabel, string namex, string namey, int typeFaisceau);
     42  void faireDessinEnveloppe(WContainerWidget* toto, string type);
     43  void dessinerEnveloppe();
     44  void dessinerPhaseSpace();
     45  void dessinerHistogramme();
     46  void chartPlot2vec(WContainerWidget* toto,vector<double>& xcor,vector<double>& ycor,Wt::Chart::SeriesType seriesType,Wt::Chart::FillRangeType fillRange,Wt::Chart::AxisValue value,bool isGridLinesEnables,string title,string legendx,string legendy,int width,int height,bool makeIcon = false);
     47 
     48
     49
    3050  WLayout* acceleratorGlobalViewLayout_;
    31   PspaApplication* pspa_;
     51  dataManager* dataManager_;
     52  WComboBox* choixElementDessin_;
     53  WComboBox* choixTypeDessinFaisceau_;
     54  WComboBox* choixAbsPhase_;
     55  WComboBox* choixOrdPhase_;
     56  WComboBox* choixEnveloppeDessin_;
     57  WComboBox* choixHistoDessin_;
     58  WComboBox* choixVariableHisto_;
     59  GWt_dialog* graphicsDialog_;
     60  WButtonGroup *group_;
     61  vector<GWt_dialog*> eDialog_;
     62  WContainerWidget* toto_;
     63  string nameOfCase_;
     64
    3265};
    3366
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_dropZoneLigneFaisceau.h

    r453 r455  
    22#define GWT_DROPZONELIGNEFAISEAU_SEEN
    33
    4 #include "GWt_pspaApplication.h"
     4#include "dataManager.h"
    55#include "GWt_ligneFaisceau.h"
    66
     
    1414    public :
    1515   
    16     GWt_dropZoneLigneFaisceau(PspaApplication* pspa_,GWt_ligneFaisceau* parent);
     16    GWt_dropZoneLigneFaisceau(dataManager* ,GWt_ligneFaisceau* );
    1717    ~GWt_dropZoneLigneFaisceau();
    1818    inline GWt_ligneFaisceau* getParent() {return parent_;};
    1919
    2020private:
    21     void initialise( PspaApplication* pspa);
     21    void initialise( dataManager*);
    2222    void mouseOver(const WMouseEvent &e );
    2323    void mouseOut(const WMouseEvent &e );
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementBeam.h

    r437 r455  
    1818   
    1919  GWt_elementBeam() {;}
    20   GWt_elementBeam(GWt_elementLigneFaisceau* );
     20  GWt_elementBeam(GWt_elementLigneFaisceau*, abstractElement* );
    2121  ~GWt_elementBeam() {;}
    2222 
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementBend.h

    r437 r455  
    1717   
    1818  GWt_elementBend() {;}
    19   GWt_elementBend(GWt_elementLigneFaisceau* );
     19  GWt_elementBend(GWt_elementLigneFaisceau*, abstractElement* );
    2020  ~GWt_elementBend() {;}
    2121 
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementCell.h

    r437 r455  
    2626   
    2727  GWt_elementCell() {;}
    28   GWt_elementCell(GWt_elementLigneFaisceau* );
     28  GWt_elementCell(GWt_elementLigneFaisceau*, abstractElement* );
    2929  ~GWt_elementCell() {;}
    3030 
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementDrift.h

    r437 r455  
    2020   
    2121  GWt_elementDrift() {;}
    22   GWt_elementDrift(GWt_elementLigneFaisceau* );
     22  GWt_elementDrift(GWt_elementLigneFaisceau*, abstractElement* );
    2323  ~GWt_elementDrift() {;}
    2424 
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementFit.h

    r437 r455  
    1414   
    1515  GWt_elementFit() {;}
    16   GWt_elementFit(GWt_elementLigneFaisceau* );
     16  GWt_elementFit(GWt_elementLigneFaisceau*, abstractElement* );
    1717  ~GWt_elementFit() {;}
    1818 
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementLigneFaisceau.h

    r453 r455  
    44#include "GWt_abstractElement.h"
    55#include "GWt_dropZoneLigneFaisceau.h"
    6 #include "GWt_pspaApplication.h"
     6#include "dataManager.h"
    77
    88#include <Wt/WContainerWidget>
     
    3131     */
    3232   
    33     GWt_elementLigneFaisceau(PspaApplication*,GWt_ligneFaisceau*);
    34     GWt_elementLigneFaisceau(nomdElements::typedElement,PspaApplication*,GWt_ligneFaisceau*);
     33    GWt_elementLigneFaisceau(dataManager*,GWt_ligneFaisceau*, abstractElement* abstractElem);
    3534   
    3635    ~GWt_elementLigneFaisceau();
     
    4645   
    4746    void setElementLabel(std::string label);
    48     void update();
    49    
     47
     48 
    5049    inline GWt_dropZoneLigneFaisceau* getDropZoneLeft() {
    5150        return dropZoneLeft_;
     
    5756
    5857    inline GWt_abstractElement* getGWt_AbstractElement() {
    59         return GWt_abstractElement_;
     58        return GWt_abstractElement_deprecated_;
    6059    }
    6160    inline void setSoftwareName(std::string name) {
     
    6766    void removeDone(GWt_abstractElement*);
    6867    std::string getElementNumberInBeamLine(nomdElements el);
    69     void initialize_ligneFaisceau(nomdElements::typedElement eType,GWt_ligneFaisceau* ligne);
     68    void initialize_ligneFaisceau(GWt_ligneFaisceau* ligne, abstractElement* abstractElem);
    7069    void mouseWentOut();
    7170    void mouseWentOver();
     71  /**
     72   Update the software of this element according to the sectionToExecute software. Will change the color of this object
     73   */
     74  void updateSoftware();
    7275    void setBGColor(const WColor);
    7376    GWt_dialog* messageDropZone_;
     
    7780    GWt_dropZoneLigneFaisceau* dropZoneRight_;
    7881    WText* elementLabel_;
    79     PspaApplication* pspa_;
    80     GWt_abstractElement* GWt_abstractElement_;
     82    dataManager* dataManager_;
     83    GWt_abstractElement* GWt_abstractElement_deprecated_;
    8184    WContainerWidget* elementContainer_;
    8285    WText* actionParameters_;
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementMpole.h

    r437 r455  
    2121 
    2222  GWt_elementMpole()  {;}
    23   GWt_elementMpole(GWt_elementLigneFaisceau*);
     23  GWt_elementMpole(GWt_elementLigneFaisceau*, abstractElement*);
    2424  ~GWt_elementMpole() {;}
    2525 
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementRfgun.h

    r437 r455  
    2525   
    2626  GWt_elementRfgun() {;}
    27   GWt_elementRfgun(GWt_elementLigneFaisceau* );
     27  GWt_elementRfgun(GWt_elementLigneFaisceau* , abstractElement*);
    2828  ~GWt_elementRfgun() {;}
    2929 
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementSnapshot.h

    r442 r455  
    2121   
    2222  GWt_elementSnapshot() {;}
    23   GWt_elementSnapshot(GWt_elementLigneFaisceau*,int);
     23  GWt_elementSnapshot(GWt_elementLigneFaisceau*, abstractElement*, int);
    2424  ~GWt_elementSnapshot() {;}
    2525 
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementSoleno.h

    r437 r455  
    2626   
    2727  GWt_elementSoleno() {;}
    28   GWt_elementSoleno(GWt_elementLigneFaisceau* );
     28  GWt_elementSoleno(GWt_elementLigneFaisceau* , abstractElement*);
    2929  ~GWt_elementSoleno() {;}
    3030 
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_ligneFaisceau.h

    r453 r455  
    1515
    1616class GWt_dropZoneLigneFaisceau;
     17class GWt_sector;
    1718
    1819class compteur {
     
    2627class GWt_ligneFaisceau : public WContainerWidget
    2728{
    28     PspaApplication* pspa_;
    29    
     29  dataManager* dataManager_;
     30 
    3031    public :
    31    
    32     GWt_ligneFaisceau() {;}
    33     GWt_ligneFaisceau(PspaApplication*);
    34    
     32 
     33  GWt_ligneFaisceau(dataManager*,GWt_sector*);
     34 
    3535    /**
    3636     
     
    7575   
    7676    void update();
    77    
    78     /** update the status of the given index element
    79      */
    80     void update(int);
    81 
     77 
     78  /** update the status of the given index element
     79   */
     80  void update_deprecated(int);
     81 
    8282    void initializeSoftwares();
    83 
    84     private :
    85     void manageLineFaisceauLayout();
    86     GWt_dropZoneLigneFaisceau* allDropZone_;
    87     WHBoxLayout* ligneFaisceauLayout_;
     83 
     84  /** Return the sector of this beamLine */
     85  inline GWt_sector* getUISector() { return UI_sector_;};
     86 
     87  private :
     88  void manageLineFaisceauLayout_deprecated();
     89  void buildBeamLineWidget();
     90 
     91  GWt_dropZoneLigneFaisceau* allDropZone_;
     92  WHBoxLayout* ligneFaisceauLayout_;
     93  GWt_sector* UI_sector_;
    8894};
    8995
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h

    r453 r455  
    1414#include <Wt/WComboBox>
    1515#include <Wt/WPushButton>
    16 #include <Wt/WDialog>
    17 #include <Wt/WPdfImage>
    18 #include <Wt/Chart/WCartesianChart>
    19 #include <Wt/WLength>
    2016#include <Wt/WButtonGroup>
    2117
     
    2319#include "GWt_console.h"
    2420#include "GWt_softwarePanel.h"
    25 #include "GWt_ligneFaisceau.h"
    2621#include "GWt_globalParameters.h"
    2722#include "GWt_sectorParameters.h"
     
    3025
    3126class GWt_abstractElementFactory;
     27class GWt_ligneFaisceau;
    3228
    3329using namespace Wt;
     
    3935 
    4036  dataManager* dtmanage_;
    41   string nameOfCase_;
    4237  string workingDir_;
    4338  WDialog* dialogSave_;
     
    4540  WLineEdit* saveNameEdit_;
    4641  WLineEdit* openNameEdit_;
    47   GWt_ligneFaisceau* beamLine_;
     42  GWt_ligneFaisceau* beamLine_deprecated_;
    4843   
    4944  GWt_globalParameters* globalParam_;
    5045  GWt_sectorParameters* sectorParam_;
    51  
    52   GWt_dialog* graphicsDialog_;
    53   WButtonGroup *group_;
    54   vector<GWt_dialog*> eDialog_;
    55  
     46  string nameOfCase_;
     47
    5648  WText* probleme_;
    57   WComboBox* choixElementDessin_;
    58   WComboBox* choixTypeDessinFaisceau_;
    59   WComboBox* choixAbsPhase_;
    60   WComboBox* choixOrdPhase_;
    61   WComboBox* choixEnveloppeDessin_;
    62   WComboBox* choixHistoDessin_;
    63   WComboBox* choixVariableHisto_;
    6449
    65   WContainerWidget* toto_;
    6650  WString applicationDefaultTitle_;
    6751   
    68   GWt_softwarePanel* executeWidget_;
    6952  WFileUpload* uploadFileSelectorWidget_;
    7053  GWt_console* console_;
     
    7356  WText* createTitle(const WString&);
    7457  WWidget* createPalette(WContainerWidget* parent);
    75   WWidget* createBeamLine();
     58  WWidget* createBeamLine_deprecated();
    7659  WWidget* createExecuteWidget();
    77   WContainerWidget* createDrawingWidget();
    7860
    7961  WWidget* createDashBoard(WContainerWidget*);
     62 
    8063  void messageBox1();
    8164  void messageBox2();
     
    8366  // extensions (.001, .002,...) pour les fichiers "snapshot"
    8467  int extensionFile_;
    85   void closeGraphicDialog();
    8668 
    8769  void createDragImage(const char *url,const char *smallurl,const char *mimeType,WContainerWidget *p,WString());
     
    9375  void fileTooLarge();
    9476 
    95   void dialogOnGraphics();
    96   void faireDessinPhaseSpace(WContainerWidget* toto, particleBeam* beam, string elementLabel, string namex, string namey, int typeFaisceau);
    97   void faireDessinEnveloppe(WContainerWidget* toto, string type);
    98   void chartPlot2vec(WContainerWidget* toto,vector<double>& xcor,vector<double>& ycor,Wt::Chart::SeriesType seriesType,Wt::Chart::FillRangeType fillRange,Wt::Chart::AxisValue value,bool isGridLinesEnables,string title,string legendx,string legendy,int width,int height,bool makeIcon = false);
    99 
    10077  bool removePathFromConfigName(string& config);
    10178  bool removeExtensionFromConfigName(string& config);
    102   void removeBeamLine();
    10379   
    104   void dessiner();
    105   void dessinerEnveloppe();
    106   void dessinerPhaseSpace();
    107   void dessinerHistogramme();
    108 
    10980 public :
    11081 
     
    12293  }
    12394
    124   inline GWt_softwarePanel* getExecuteWidget() {
    125     return executeWidget_;
    126   }
    127 
    12895  inline GWt_ligneFaisceau* getBeamLine() {
    129     return beamLine_;
     96    return beamLine_deprecated_;
    13097  }
    13198
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_sectionToExecute.h

    r407 r455  
    77
    88class GWt_softwarePanel;
     9class GWt_sector;
    910
    1011class GWt_sectionToExecute : public Wt::WContainerWidget
    1112{
    1213    public :
    13     GWt_sectionToExecute(Wt::WComboBox*,Wt::WComboBox*,Wt::WComboBox*,Wt::WContainerWidget* buttonPanel,GWt_softwarePanel* sPanel);
     14    GWt_sectionToExecute(Wt::WComboBox*,Wt::WComboBox*,Wt::WComboBox*,Wt::WContainerWidget* buttonPanel,GWt_softwarePanel* sPanel,GWt_sector*);
    1415
    1516    ~GWt_sectionToExecute() {;}
     
    6566    Wt::WContainerWidget* warningsContainer_;
    6667    Wt::WContainerWidget* errorsContainer_;
     68    GWt_sector* UI_sector_;
    6769};
    6870
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_sector.h

    r453 r455  
    66#include <Wt/WContainerWidget>
    77#include "sector.h"
    8 #include "GWt_pspaApplication.h"
    98#include "GWt_accelerator.h"
     9#include "GWt_ligneFaisceau.h"
    1010
    1111using namespace Wt;
     
    1717 
    1818public:
    19   GWt_sector(GWt_accelerator* parent,sector*);
     19  GWt_sector(GWt_accelerator*,sector*);
    2020  virtual ~GWt_sector();
    21   void createWidgetBeamLine(PspaApplication* pspa,WContainerWidget* parent);
    22 
     21  void createWidgetBeamLine(WContainerWidget* parent);
     22  /* Return the controler sector element for this UI sector*/
     23  inline sector* getSectorControler() {return sectorControler_;};
     24  inline GWt_softwarePanel* getExecuteWidget() {
     25    return executeWidget_;
     26  }
     27  /**
     28   Get the accelerator for this sector
     29   */
     30  inline GWt_accelerator* getAccelerator() {
     31    return UI_Accelerator_;
     32  }
     33 
    2334  private :
    24   GWt_ligneFaisceau* beamLine_;
     35  GWt_ligneFaisceau* UI_beamLine_;
    2536  void setIcon(WLayout*);
    2637  void displayWidgetBeamLine();
    27   GWt_accelerator* parent_;
    28   sector* sector_;
     38  GWt_accelerator* UI_Accelerator_;
     39  sector* sectorControler_;
     40  GWt_softwarePanel* executeWidget_;
     41
    2942};
    3043
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_sectorParameters.h

    r436 r455  
    1919class GWt_sectorParameters : public WContainerWidget
    2020{
    21   dataManager* dt_;
    2221  vector<statements> sectors_;
    2322 
     
    3332  WGroupBox *gb_;
    3433 
    35   void createSector();
    36   WContainerWidget* buttons(int);
     34  void createSector_deprecated();
     35  WContainerWidget* buttons_deprecated(int);
    3736  void dialogDone(WDialog::DialogCode code);
    3837  void add();
     
    4342 public :
    4443 
    45   GWt_sectorParameters() {;}
    46   GWt_sectorParameters(dataManager*);
     44  GWt_sectorParameters() {;};
    4745  virtual ~GWt_sectorParameters() {;}
    4846
    49   void execDialog();
     47  void execDialog_deprecated();
    5048  void setText(WText*);
    5149};
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_softwarePanel.h

    r449 r455  
    2020
    2121class PspaApplication;
     22class GWt_sector;
    2223
    2324class GWt_softwarePanel  : public WContainerWidget
     
    2526 public :
    2627 
    27   GWt_softwarePanel(dataManager*, PspaApplication*,WContainerWidget*);
     28  GWt_softwarePanel(dataManager*, GWt_sector*);
    2829  virtual ~GWt_softwarePanel();
    2930
     
    4546  WPushButton *exec_go_;
    4647  WContainerWidget* contenuSections_;
    47   PspaApplication* pspa_;
     48  GWt_sector* UIsector_;
    4849
    4950  std::vector <GWt_sectionToExecute*> sections_;
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_accelerator.cc

    r446 r455  
    88#include <Wt/WHBoxLayout>
    99#include <Wt/WComboBox>
     10#include <Wt/WRadioButton>
    1011#include <Wt/WPushButton>
    1112#include <Wt/WGroupBox>
     13#include <Wt/WStandardItemModel>
    1214
    1315#include <string>
    1416
    15 GWt_accelerator::GWt_accelerator(WContainerWidget* parent, PspaApplication* pspa) :
     17GWt_accelerator::GWt_accelerator(WContainerWidget* parent, dataManager* dt) :
    1618WContainerWidget(parent),
    17 pspa_(pspa)
     19dataManager_(dt)
    1820{
    1921  setObjectName("accelerator");
    2022  addStyleClass("acceleratorPanel");
    21    
     23  nameOfCase_ = "pspa"; // default  // FIXME
     24 
     25
    2226  WContainerWidget* menu = new WContainerWidget(this);
    2327  menu->addStyleClass("acceleratorMenu");
     
    5963  runParameters->setMinimumSize(32,32);
    6064 
     65  WPushButton* boutongraphicalAnalysis = new WPushButton("",menu);
     66  boutongraphicalAnalysis->setStyleClass("histoButton");
     67  boutongraphicalAnalysis->setToolTip ("analyse graphique");
     68  boutongraphicalAnalysis->setMaximumSize(32,32);
     69  boutongraphicalAnalysis->setMinimumSize(32,32);
     70
     71 
    6172  new WBreak(this);
    6273 
     
    7990  addSectorParameters->clicked().connect(this,&GWt_accelerator::addSector);
    8091  runParameters->clicked().connect(this,&GWt_accelerator::run);
    81 
     92  boutongraphicalAnalysis->clicked().connect(this, &GWt_accelerator::dialogOnGraphics);
     93
     94  graphicsDialog_ = new GWt_dialog("graphical analysis",createDrawingWidget(),false);
     95  graphicsDialog_->setMinimumSize(400,400);
     96  graphicsDialog_->setClosable(true);
     97  graphicsDialog_->hide();
    8298 
    8399}
     
    90106void GWt_accelerator::addSector()
    91107{
    92   sector* sect = pspa_->getDataManager()->addNewSector();
     108  sector* sect = getDataManager()->addNewSector();
    93109  GWt_sector* addedSector = new GWt_sector(this,sect);
    94110}
     
    97113{
    98114}
     115
     116void GWt_accelerator::faireDessin()
     117{
     118  choixElementDessin_->clear();
     119  choixHistoDessin_->clear();
     120 
     121  for (unsigned k = 0; k < getDataManager()->getSectors().size(); k++) {
     122    sector* sector = getDataManager()->getSectors()[k];
     123    for (unsigned l = 0; l < sector->getSectionsToExecute().size(); l++) {
     124      sectionToExecute* section = sector->getSectionsToExecute()[l];
     125      for (unsigned m = 0; m < section->getElements().size(); m++) {
     126       
     127        abstractElement* elPtr = section->getElements()[m];
     128        //    if(elPtr->getNomdElement().getElementType() == snapshot) continue;
     129       
     130        choixElementDessin_->addItem(elPtr->getLabel());
     131        choixHistoDessin_->addItem(elPtr->getLabel());
     132      }
     133    }
     134  }
     135}
     136
     137WContainerWidget* GWt_accelerator::createDrawingWidget()
     138{
     139  WGridLayout *glayout= new WGridLayout();
     140  WContainerWidget* dessin = new WContainerWidget();
     141  dessin->setLayout(glayout);
     142 
     143  group_ = new Wt::WButtonGroup(this);
     144 
     145  /////////////////////////////////////////////////////////////////////
     146 
     147  choixEnveloppeDessin_ = new WComboBox();
     148  choixEnveloppeDessin_->addItem("x");
     149  // choixEnveloppeDessin_->addItem("y");
     150  Wt::WRadioButton *button1= new WRadioButton(" enveloppe");
     151  group_->addButton(button1,1);
     152  glayout->addWidget(button1,0,1);
     153  glayout->addWidget(choixEnveloppeDessin_,0,2);
     154  /////////////////////////////////////////////////////////////////////
     155 
     156  choixElementDessin_ = new WComboBox();
     157  choixElementDessin_->setMinimumSize(50,10);
     158  choixTypeDessinFaisceau_ = new WComboBox();
     159  choixTypeDessinFaisceau_->addItem("courant_snyder");
     160  choixTypeDessinFaisceau_->addItem("macroparticles");
     161  Wt::WRadioButton *button2= new WRadioButton(" phase space after element");
     162 
     163  choixAbsPhase_ = new WComboBox();
     164  choixAbsPhase_->addItem("x");
     165  choixAbsPhase_->addItem("y");
     166  choixAbsPhase_->addItem("dz");
     167  choixAbsPhase_->addItem("xp");
     168  choixAbsPhase_->addItem("yp");
     169  choixAbsPhase_->addItem("dE/E");
     170  choixAbsPhase_->setCurrentIndex(0);
     171 
     172  choixOrdPhase_ = new WComboBox();
     173  choixOrdPhase_->addItem("x");
     174  choixOrdPhase_->addItem("y");
     175  choixOrdPhase_->addItem("dz");
     176  choixOrdPhase_->addItem("xp");
     177  choixOrdPhase_->addItem("yp");
     178  choixOrdPhase_->addItem("dE/E");
     179  choixOrdPhase_->setCurrentIndex(3);
     180 
     181  group_->addButton(button2,2);
     182  glayout->addWidget(button2,1,1);
     183  glayout->addWidget(choixElementDessin_,1,2);
     184  glayout->addWidget(choixTypeDessinFaisceau_,1,3);
     185  //  glayout->addWidget(new WText("abs. :"),2,2);
     186  glayout->addWidget(choixAbsPhase_,2,2);
     187  //  glayout->addWidget(new WText("ord. :"),2,4);
     188  glayout->addWidget(choixOrdPhase_,2,3);
     189  /////////////////////////////////////////////////////////////////////
     190 
     191  choixVariableHisto_= new WComboBox();
     192  choixVariableHisto_->addItem("x");
     193  choixVariableHisto_->addItem("y");
     194  choixVariableHisto_->addItem("z");
     195  choixVariableHisto_->addItem("xp");
     196  choixVariableHisto_->addItem("yp");
     197  choixVariableHisto_->addItem("dE/E");
     198  choixVariableHisto_->setCurrentIndex(5);
     199 
     200  choixHistoDessin_ = new WComboBox();
     201  Wt::WRadioButton *button3= new WRadioButton(" histogram after element ");
     202  group_->addButton(button3,3);
     203 
     204  glayout->addWidget(button3,3,1);
     205  glayout->addWidget(choixHistoDessin_,3,2);
     206  glayout->addWidget(choixVariableHisto_,3,3);
     207  /////////////////////////////////////////////////////////////////////
     208 
     209  WPushButton *close= new WPushButton("close");
     210  glayout->addWidget(close,4,1);
     211  close->clicked().connect(this,&GWt_accelerator::closeGraphicDialog);
     212 
     213  WPushButton *draw= new WPushButton("draw");
     214  glayout->addWidget(draw,4,2,2,1);
     215  draw->clicked().connect(this,&GWt_accelerator::dessiner);
     216  /////////////////////////////////////////////////////////////////////
     217 
     218  toto_ = new WContainerWidget();
     219  dessin->addWidget(toto_);
     220  return dessin;
     221}
     222
     223
     224void GWt_accelerator::dialogOnGraphics()
     225{
     226  graphicsDialog_->show();
     227}
     228
     229
     230void GWt_accelerator::closeGraphicDialog()
     231{
     232  cout << " close graphicsDialog_" << endl;
     233  for(unsigned i = 0; i < eDialog_.size(); i++) eDialog_[i]->done(WDialog::Rejected);
     234  eDialog_.clear();
     235  graphicsDialog_->done(WDialog::Rejected);
     236}
     237
     238
     239
     240void GWt_accelerator::dessiner()
     241{
     242  int k= group_->checkedId();
     243  cout << "dessiner k= " << k << endl;
     244 
     245  switch(k) {
     246    case  1:
     247      dessinerEnveloppe();
     248      break;
     249    case 2:
     250      dessinerPhaseSpace();
     251      break;
     252    case 3:
     253      dessinerHistogramme();
     254      break;
     255    default:
     256      GWt_dialog graphicalWarning("graphical analysis","select a button",GWt_dialog::Warning,false,true);
     257      graphicalWarning.exec();
     258      break;
     259  }
     260}
     261
     262void GWt_accelerator::dessinerPhaseSpace()
     263{
     264 
     265  int typeFaisceau = choixTypeDessinFaisceau_->currentIndex();
     266  //  int index = choixElementDessin_->currentIndex();
     267  string nameAbs = choixAbsPhase_->currentText().toUTF8();
     268  string nameOrd = choixOrdPhase_->currentText().toUTF8();
     269  if ( nameAbs == nameOrd ) {
     270    GWt_dialog phaseSpaceError(" graphical analysis", "the beam coordinates must be different !", GWt_dialog::Error, false,true);
     271    phaseSpaceError.exec();
     272    return;
     273  }
     274  string elementLabel = choixElementDessin_->currentText().toUTF8();
     275  particleBeam* beam = dataManager_->getDiagnosticBeam_deprecated(elementLabel);
     276  //  particleBeam* beam = dtmanage_->getDiagnosticBeam(index);
     277 
     278  if ( beam == NULL ) {
     279    GWt_dialog warningBeamState(" graphical analysis", "the beam does not exist at the end of this element !", GWt_dialog::Error, false,true);
     280    warningBeamState.exec();
     281    return;
     282  }
     283 
     284  toto_->clear();
     285  faireDessinPhaseSpace(toto_, beam, elementLabel, nameAbs, nameOrd, typeFaisceau);
     286 
     287  // if ( typeFaisceau == 0 )
     288  //   {
     289  //     if ( !beam->momentRepresentationOk() ) beam->buildMomentRepresentation();
     290  //     faireDessinTransport(toto_, beam, nameAbs, nameOrd );
     291  //   }
     292  // else if ( typeFaisceau == 1 )
     293  //   {
     294  //     if ( beam->particleRepresentationOk() ) faireDessinParmela(toto_, beam, nameAbs, nameOrd );
     295  //     else {
     296  //    GWt_dialog warningBeamState(" graphical analysis", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true);
     297  //    warningBeamState.exec();
     298  //     }
     299  //   }
     300  // else {
     301  //   GWt_dialog warningTypeDrawing(" graphical analysis", "type of  drawing not programmed !", GWt_dialog::Error, false,true);
     302  //   warningTypeDrawing.exec();
     303  // }
     304}
     305
     306void GWt_accelerator::dessinerEnveloppe()
     307{
     308  toto_->clear();
     309 
     310  int typeEnveloppe = choixEnveloppeDessin_->currentIndex();
     311  if ( typeEnveloppe == 0 )
     312  {
     313    faireDessinEnveloppe(toto_, "x");
     314  }
     315  else {
     316    GWt_dialog warningTypeEnveloppe(" graphical analysis", "type of enveloppe drawing not programmed !", GWt_dialog::Error, false,true);
     317    warningTypeEnveloppe.exec();
     318  }
     319}
     320
     321void GWt_accelerator::faireDessinEnveloppe(WContainerWidget* toto, string type)
     322{
     323 
     324  std::time_t result = std::time(NULL);
     325 
     326  GWt_dialog* envDialog = new GWt_dialog(WString("enveloppe&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(")+std::asctime(std::localtime(&result))+")",toto,false);
     327  eDialog_.push_back(envDialog);
     328  envDialog->setMinimumSize(400,400);
     329  envDialog->setClosable(true);
     330  envDialog->show();
     331 
     332  //  unsigned nbel = dtmanage_->getBeamLineSize();
     333  vector<double> xcor;
     334  vector<double> ycor;
     335  string titre;
     336  string legendx;
     337  string legendy;
     338  dataManager_->donneesRmsEnveloppe(type,xcor,ycor,titre,legendx,legendy);
     339 
     340  Wt::Chart::SeriesType seriesType = Wt::Chart::LineSeries;
     341  Wt::Chart::FillRangeType fillRange = Wt::Chart::NoFill;
     342  Wt::Chart::AxisValue location = Wt::Chart::ZeroValue;
     343  bool isGridLinesEnabled = false;
     344  chartPlot2vec(envDialog->contents(),xcor,ycor,seriesType,fillRange,location,isGridLinesEnabled,titre,legendx,legendy,500,300);
     345}
     346
     347void GWt_accelerator::faireDessinPhaseSpace(WContainerWidget* toto, particleBeam* beam, string elementLabel, string namex, string namey, int typeFaisceau)
     348{
     349 
     350  vector<double> xcor;
     351  vector<double> ycor;
     352  vector<string> legende;
     353  string titre;
     354  Wt::Chart::SeriesType seriesType;
     355 
     356  if ( typeFaisceau == 0 ) {
     357    seriesType = Wt::Chart::LineSeries;
     358    titre = "phase space rms";
     359    beam->donneesDessinEllipse(xcor,ycor,legende,namex,namey);
     360  } else if (  typeFaisceau == 1 ) {
     361    seriesType = Wt::Chart::PointSeries;
     362    titre = " phase space ";
     363    beam->particlesPhaseSpaceData(xcor,ycor,legende,namex,namey);
     364    // for ( int kk=0; kk < xcor.size(); kk++)
     365    //   {
     366    //  cout << " dess. phas. x= " << xcor.at(kk) << " x'= " << ycor.at(kk) << endl;
     367    //   }
     368  } else {
     369    GWt_dialog warningBeamState(" graphical analysis", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true);
     370    warningBeamState.exec();
     371    return;
     372  }
     373 
     374  std::time_t result = std::time(NULL);
     375  GWt_dialog* phaseSpaceDialog = new GWt_dialog(WString("phase space&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(")+std::asctime(std::localtime(&result))+")",toto,false);
     376  eDialog_.push_back(phaseSpaceDialog);
     377  phaseSpaceDialog->setMinimumSize(400,400);
     378  phaseSpaceDialog->setClosable(true);
     379  new WText(" case : " + nameOfCase_, phaseSpaceDialog->contents());
     380  new WBreak(phaseSpaceDialog->contents());
     381  new WText(" after element :  " + elementLabel, phaseSpaceDialog->contents());
     382 
     383  for (int k=0 ; k < (int)legende.size(); k++) {
     384    new WBreak(phaseSpaceDialog->contents());
     385    new WText(legende.at(k), phaseSpaceDialog->contents());
     386  }
     387 
     388  Wt::Chart::FillRangeType fillRange = Wt::Chart::NoFill;
     389  Wt::Chart::AxisValue location = Wt::Chart::ZeroValue;
     390  bool isGridLinesEnabled = false;
     391  chartPlot2vec(phaseSpaceDialog->contents(),xcor,ycor,seriesType,fillRange,location,isGridLinesEnabled,titre,namex,namey,500,300);
     392 
     393  phaseSpaceDialog->show();
     394}
     395
     396
     397void GWt_accelerator::dessinerHistogramme()
     398{
     399  toto_->clear();
     400 
     401  // std::time_t result = std::time(NULL);
     402  // GWt_dialog* histoDialog = new GWt_dialog(WString("histogramme&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(")+std::asctime(std::localtime(&result))+")",toto_,false);
     403  // eDialog_.push_back(histoDialog);
     404  // histoDialog->setMinimumSize(400,400);
     405  // histoDialog->setClosable(true);
     406 
     407  string elementLabel = choixHistoDessin_->currentText().toUTF8();
     408  particleBeam* beam = dataManager_->getDiagnosticBeam_deprecated(elementLabel);
     409  if (beam == NULL) {
     410    GWt_dialog warningBeamState("histogram","the beam does not exist at the end of this element !", GWt_dialog::Error, false,true);
     411    warningBeamState.exec();
     412    return;
     413  }
     414 
     415  if (!beam->particleRepresentationOk()) {
     416    GWt_dialog warningBeamState("histogram", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true);
     417    warningBeamState.exec();
     418    return;
     419  }
     420 
     421  unsigned iabs= choixVariableHisto_->currentIndex();
     422  vector<double> xcor;
     423  vector<int> hist;
     424  //  double out[3]= {0.0};
     425  vector<string> legende;
     426  beam->histogramme(iabs,xcor,hist,legende);
     427 
     428  cout<<"xcor.size()= "<<xcor.size()<<", hist.size()= "<<hist.size()<<endl;
     429  //////////////////////////////////////////////////////////////////////////////////
     430 
     431  int n = hist.size();
     432  vector<double> x;
     433  x.resize(2*n+2);
     434  vector<double> y;
     435  y.resize(2*n+2);
     436 
     437  int j= 0;
     438  x.at(j)= xcor[0];
     439  y.at(j)= 0.0;
     440  j++;
     441  x.at(j)= xcor[0];
     442  y.at(j)= hist[0];
     443  j++;
     444 
     445  for (int i = 1; i < n; ++i) {
     446    x.at(j)= xcor[i];
     447    y.at(j)= hist[i-1];
     448    j++;
     449    x.at(j)= xcor[i];
     450    y.at(j)= hist[i];
     451    j++;
     452  }
     453 
     454  x.at(j)= xcor[n];
     455  y.at(j)= hist[n-1];
     456  j++;
     457  x.at(j)= xcor[n];
     458  y.at(j)= 0.0;
     459  //////////////////////////////////////////////////////////////////////////////////
     460  std::time_t result = std::time(NULL);
     461  GWt_dialog* histoDialog = new GWt_dialog(WString("histogramme&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(")+std::asctime(std::localtime(&result))+")",toto_,false);
     462  eDialog_.push_back(histoDialog);
     463  histoDialog->setMinimumSize(400,400);
     464  histoDialog->setClosable(true);
     465 
     466  histoDialog->show();
     467 
     468  WContainerWidget *w= histoDialog->contents();
     469 
     470  // // legendes
     471  // string unites[2];
     472  // if(iabs == 0 || iabs == 1 || iabs == 2) {
     473  //   unites[0]= unites[1]= " mm";
     474  // }
     475  // if(iabs == 3 || iabs == 4) {
     476  //   unites[0]= unites[1]= " mrad";
     477  // }
     478  // if(iabs == 5) {
     479  //   unites[0]= " MeV"; unites[1]= " KeV";
     480  // }
     481 
     482  new WText(" case : " + nameOfCase_, w);
     483  new WBreak(w);
     484  new WText(" after element :  " + elementLabel, w);
     485 
     486  for (int k=0 ; k < (int)legende.size(); k++) {
     487    new WBreak(w);
     488    new WText(legende.at(k), w);
     489  }
     490 
     491 
     492  // new WText(" entries : "+ mixedTools::intToString((int)out[0]),w);
     493  // new WBreak(w);
     494  // new WText(" mean : "+ mixedTools::doubleToString(out[1])+unites[0],w);
     495  // new WBreak(w);
     496  // new WText(" sigma rms : "+ mixedTools::doubleToString(out[2])+unites[1],w);
     497  //////////////////////////////////////////////////////////////////////////////////
     498 
     499  string titre;
     500  if(iabs == 0) titre="x-coordinate";
     501  if(iabs == 1) titre="y-coordinate";
     502  if(iabs == 2) titre="z-coordinate";
     503  if(iabs == 3) titre="xp-divergence";
     504  if(iabs == 4) titre="yp-devergence";
     505  if(iabs == 5) titre="kinetic energy";
     506 
     507  string xname;
     508  if(iabs == 0) xname=" x (mm)";
     509  if(iabs == 1) xname=" y (mm)";
     510  if(iabs == 2) xname=" z (mm)";
     511  if(iabs == 3) xname=" xp (mrad)";
     512  if(iabs == 4) xname=" yp (mrad)";
     513  if(iabs == 5) xname=" dEcin/Ecin (%)";
     514 
     515  string yname;
     516  Wt::Chart::SeriesType seriesType = Wt::Chart::LineSeries;
     517  Wt::Chart::FillRangeType fillRange = Wt::Chart::ZeroValueFill;
     518  Wt::Chart::AxisValue location = Wt::Chart::MinimumValue;
     519  bool isGridLinesEnabled = true;
     520  chartPlot2vec(w,x,y,seriesType,fillRange,location,isGridLinesEnabled,titre,xname,yname,500,300);
     521}
     522
     523
     524
     525void GWt_accelerator::chartPlot2vec(WContainerWidget* toto,vector<double>& xcor,vector<double>& ycor,Wt::Chart::SeriesType seriesType,Wt::Chart::FillRangeType fillRange,Wt::Chart::AxisValue value,bool isGridLinesEnables,string title,string legendx,string legendy,int width,int height,bool makeIcon)
     526{
     527  int nbpts = xcor.size();
     528  cout << " PspaApplication::chartPlot2vec nbpts = " << nbpts << endl;
     529 
     530  WStandardItemModel *model = new WStandardItemModel(nbpts, 2, toto);
     531  for (int i = 0; i < nbpts; ++i) {
     532    model->setData(i, 0, xcor.at(i));
     533    model->setData(i, 1, ycor.at(i));
     534    //        cout << " PspaApplication::chartPlot2vec el= " << i+1 << " x= " << xcor.at(i) << " y= " << ycor.at(i) << endl;
     535  }
     536  //  cout << " PspaApplication::chartPlot2vec FLAG 0 " << endl;
     537  Wt::Chart::WCartesianChart *chart = new Wt::Chart::WCartesianChart(toto);
     538  if (!makeIcon) chart->setTitle(title);
     539  chart->initLayout();
     540  chart->setModel(model);        // set the model
     541  chart->setXSeriesColumn(0);    // set the column that holds the X data
     542 
     543  chart->setType(Wt::Chart::ScatterPlot);   // set type to ScatterPlot
     544  chart->setLegendEnabled(false); // enable the legend
     545 
     546  // Provide space for the X and Y axis and title.
     547  chart->setPlotAreaPadding(80, Left);
     548  chart->setPlotAreaPadding(40, Bottom);
     549  chart->setPlotAreaPadding(60, Top);
     550 
     551  // Typically, for mathematical functions, you want the axes to cross
     552  // at the 0 mark (value= ZeroValue)
     553  chart->axis(Wt::Chart::XAxis).setLocation(value);
     554  chart->axis(Wt::Chart::YAxis).setLocation(value);
     555 
     556  //  cout << " PspaApplication::chartPlot2vec FLAG 1 " << endl;
     557 
     558  Wt::Chart::WDataSeries s(1,seriesType);
     559  s.setPen(WColor("red"));
     560  s.setFillRange(fillRange);
     561  chart->addSeries(s);
     562 
     563  Wt::Chart::WAxis& axis = chart->axis(Wt::Chart::XAxis);
     564  axis.setLabelFormat("%.3f");
     565  axis.setTitle(legendx);
     566 
     567  chart->axis(Wt::Chart::Y1Axis).setTitle(legendy);
     568 
     569  if(isGridLinesEnables) {
     570    axis.setGridLinesEnabled(true);
     571    chart->axis(Wt::Chart::Y1Axis).setGridLinesEnabled(true);
     572  }
     573  //   cout << " PspaApplication::chartPlot2vec FLAG 2 " << endl;
     574 
     575  chart->resize(width,height); // WPaintedWidget must be given explicit size
     576  chart->setMargin(10, Top | Bottom); // ?
     577  chart->setMargin(WLength::Auto, Left | Right); //?
     578 
     579  if (makeIcon) {
     580    chart->setLegendEnabled(false); // enable the legend
     581    chart->setPlotAreaPadding(0);
     582    chart->setAxisPadding(0);
     583    WFont xAxisFont = chart->axis(Wt::Chart::XAxis).labelFont();
     584    xAxisFont.setSize(8);
     585    WFont yAxisFont = chart->axis(Wt::Chart::YAxis).labelFont();
     586    yAxisFont.setSize(8);
     587    chart->axis(Wt::Chart::XAxis).setLabelFont(xAxisFont);
     588    chart->axis(Wt::Chart::YAxis).setLabelFont(yAxisFont);
     589  }
     590  //  cout << " PspaApplication::chartPlot2vec FLAG 3 " << endl;
     591 
     592#ifdef HAS_IMAGEMAGIC
     593 
     594  //  cout << " PspaApplication::chartPlot2vec FLAG MAGIC " << endl;
     595 
     596  // no background
     597  chart->setBackground(WBrush(Wt::NoBrush));
     598 
     599  // axis black
     600  chart->axis(XAxis).setPen(WColor("black"));
     601  chart->axis(YAxis).setPen(WColor("black"));
     602 
     603  std::string name;
     604  /*
     605   Wt::WRasterImage pngImage("png", 1000, 1000);
     606   Wt::WPainter p(&pngImage);
     607   chart->paint(p);
     608   name = workingDir_ + "/chart-"+sessionId ()+".png";
     609   std::ofstream f(name.c_str(), std::ios::out |std::ios::trunc | std::ios::binary);
     610   pngImage.write(f);
     611   */
     612 
     613  Wt::WPdfImage pdfImage("1000", "600");
     614  {
     615    Wt::WPainter p1(&pdfImage);
     616    chart->paint(p1);
     617  }
     618 
     619  name = workingDir_ + "/chart-"+sessionId ()+".pdf";
     620  std::ofstream f1(name.c_str(), std::ios::out | std::ios::binary);
     621  pdfImage.write(f1);
     622 
     623  new WText("<a href='workingArea/chart-"+sessionId ()+".pdf' target='_blank'>Sauvegarder l'image</a>",toto);
     624 
     625#endif
     626  //  cout << " PspaApplication::chartPlot2vec FLAG FIN" << endl;
     627 
     628}
     629
     630
     631
     632
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_dropZoneLigneFaisceau.cc

    r453 r455  
    1010#include "nomdElements.h"
    1111
    12 GWt_dropZoneLigneFaisceau::GWt_dropZoneLigneFaisceau( PspaApplication* pspa,GWt_ligneFaisceau* parent)
     12class dataManager;
     13
     14GWt_dropZoneLigneFaisceau::GWt_dropZoneLigneFaisceau( dataManager* data,GWt_ligneFaisceau* parent)
    1315  : WContainerWidget(),
    1416parent_(parent)
    1517{
    16   initialise(pspa);
     18  initialise(data);
    1719}
    1820
     
    2123}
    2224
    23 void GWt_dropZoneLigneFaisceau::initialise( PspaApplication* pspa)
     25void GWt_dropZoneLigneFaisceau::initialise(dataManager* dataMgr)
    2426{
    2527 
     
    3234 
    3335  // accept drops
    34   vector <GWt_abstractElement*> elems = pspa->getAbstractElementFactory()->getAllElements();
     36  vector <GWt_abstractElement*> elems = dataMgr->getPspaApplication()->getAbstractElementFactory()->getAllElements();
    3537  for(int a = 0; a < elems.size(); a++) {
    3638    acceptDrops(elems[a]->getMimeType());
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementBeam.cc

    r437 r455  
    88#include <Wt/WPushButton>
    99
    10 GWt_elementBeam::GWt_elementBeam(GWt_elementLigneFaisceau* elemLigne)
    11 :GWt_abstractElement(new elementBeam())
     10GWt_elementBeam::GWt_elementBeam(GWt_elementLigneFaisceau* elemLigne,abstractElement* abstract)
     11:GWt_abstractElement(abstract)
    1212{
    1313  elementLigneFaiseauContainer_ = elemLigne;
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementBend.cc

    r437 r455  
    99#include <Wt/WPushButton>
    1010
    11 GWt_elementBend::GWt_elementBend(GWt_elementLigneFaisceau* elemLigne )
    12 :GWt_abstractElement(new elementBend())
     11GWt_elementBend::GWt_elementBend(GWt_elementLigneFaisceau* elemLigne ,abstractElement* abstract)
     12:GWt_abstractElement(abstract)
    1313{
    1414  elementLigneFaiseauContainer_ = elemLigne;
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementCell.cc

    r437 r455  
    1010#include <Wt/WPanel>
    1111
    12 GWt_elementCell::GWt_elementCell(GWt_elementLigneFaisceau* elemLigne)
    13 :GWt_abstractElement(new elementCell())
     12GWt_elementCell::GWt_elementCell(GWt_elementLigneFaisceau* elemLigne,abstractElement* abstract)
     13:GWt_abstractElement(abstract)
    1414{
    1515    elementLigneFaiseauContainer_ = elemLigne;
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementDrift.cc

    r437 r455  
    99#include <Wt/WPushButton>
    1010
    11 GWt_elementDrift::GWt_elementDrift(GWt_elementLigneFaisceau* elemLigne)
    12 :GWt_abstractElement(new elementDrift())
     11GWt_elementDrift::GWt_elementDrift(GWt_elementLigneFaisceau* elemLigne,abstractElement* abstract)
     12:GWt_abstractElement(abstract)
    1313{
    1414  elementLigneFaiseauContainer_ = elemLigne;
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementFit.cc

    r437 r455  
    99#include <Wt/WComboBox>
    1010
    11 GWt_elementFit::GWt_elementFit(GWt_elementLigneFaisceau* elemLigne)
    12 :GWt_abstractElement(new elementFit())
     11GWt_elementFit::GWt_elementFit(GWt_elementLigneFaisceau* elemLigne,abstractElement* abstract)
     12:GWt_abstractElement(abstract)
    1313{
    1414  elementLigneFaiseauContainer_ = elemLigne;
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementLigneFaisceau.cc

    r453 r455  
    1919#define PSPA_DEBUG 1
    2020
    21 GWt_elementLigneFaisceau::GWt_elementLigneFaisceau(PspaApplication* pspa,GWt_ligneFaisceau* ligne)
     21
     22GWt_elementLigneFaisceau::GWt_elementLigneFaisceau(dataManager* data,GWt_ligneFaisceau* ligne, abstractElement* abstractElem)
    2223  : WContainerWidget(),
    2324    firstTimeInsertMessage_(NULL),
    2425    dropZoneLeft_(NULL),
    2526    dropZoneRight_(NULL),
    26     GWt_abstractElement_(NULL),
     27    GWt_abstractElement_deprecated_(NULL),
    2728    elementLabel_(NULL),
    28     pspa_(pspa)
    29 {
    30   initialize_ligneFaisceau(nomdElements::inconnu,ligne);
    31 }
    32 
    33 
    34 GWt_elementLigneFaisceau::GWt_elementLigneFaisceau(nomdElements::typedElement type,PspaApplication* pspa,GWt_ligneFaisceau* ligne)
    35   : WContainerWidget(),
    36     firstTimeInsertMessage_(NULL),
    37     dropZoneLeft_(NULL),
    38     dropZoneRight_(NULL),
    39     GWt_abstractElement_(NULL),
    40     elementLabel_(NULL),
    41     pspa_(pspa)
     29    dataManager_(data)
    4230{
    4331  // set the css name
    4432  setObjectName("elementLigneFaisceau");
    45   initialize_ligneFaisceau(type,ligne);
    46 }
    47 
    48 void GWt_elementLigneFaisceau::initialize_ligneFaisceau(nomdElements::typedElement eType,GWt_ligneFaisceau* ligne)
     33  initialize_ligneFaisceau(ligne,abstractElem);
     34}
     35
     36void GWt_elementLigneFaisceau::initialize_ligneFaisceau(GWt_ligneFaisceau* ligne, abstractElement* abstractElem)
    4937{   
    50   cout << " new GWt_elementLigneFaisceau : "<< nomdElements::getLabelFromType(eType) << endl;
    51    
    5238  // set layout
    5339  //     +----------+--------+---------+
     
    6248 
    6349  // add first line :  initialize arrow and link images
    64   dropZoneLeft_ = new GWt_dropZoneLigneFaisceau(pspa_,ligne);
    65   dropZoneRight_ = new GWt_dropZoneLigneFaisceau(pspa_,ligne);
     50  dropZoneLeft_ = new GWt_dropZoneLigneFaisceau(dataManager_,ligne);
     51  dropZoneRight_ = new GWt_dropZoneLigneFaisceau(dataManager_,ligne);
    6652 
    6753  // change object name in order to manage css :
     
    7359 
    7460  // add first line :  initialize arrow and link images
    75   dropZoneLeft_ = new GWt_dropZoneLigneFaisceau(pspa_,ligne);
    76   dropZoneRight_ = new GWt_dropZoneLigneFaisceau(pspa_,ligne);
     61  dropZoneLeft_ = new GWt_dropZoneLigneFaisceau(dataManager_,ligne);
     62  dropZoneRight_ = new GWt_dropZoneLigneFaisceau(dataManager_,ligne);
    7763 
    7864  // change object name in order to manage css :
     
    8470 
    8571  // add the image if present
    86    
     72 
     73  nomdElements::typedElement eType = abstractElem->getNomdElement().getElementType();
     74
    8775  switch (  eType ) {
    8876  case nomdElements::RFgun :
    89     GWt_abstractElement_ = new GWt_elementRfgun(this);
     77    GWt_abstractElement_deprecated_ = new GWt_elementRfgun(this,abstractElem);
    9078    break;
    9179  case nomdElements::drift :
    92     GWt_abstractElement_ = new GWt_elementDrift(this);
     80    GWt_abstractElement_deprecated_ = new GWt_elementDrift(this,abstractElem);
    9381    break;
    9482  case nomdElements::cell  :
    95     GWt_abstractElement_ = new GWt_elementCell(this);
     83    GWt_abstractElement_deprecated_ = new GWt_elementCell(this,abstractElem);
    9684    break;
    9785  case nomdElements::bend  :
    98     GWt_abstractElement_ = new GWt_elementBend(this);
     86    GWt_abstractElement_deprecated_ = new GWt_elementBend(this,abstractElem);
    9987    break;
    10088  case nomdElements::soleno  :
    101     GWt_abstractElement_ = new GWt_elementSoleno(this);
     89    GWt_abstractElement_deprecated_ = new GWt_elementSoleno(this,abstractElem);
    10290    break;
    10391  case nomdElements::beam  :
    104     GWt_abstractElement_ = new GWt_elementBeam(this);
     92    GWt_abstractElement_deprecated_ = new GWt_elementBeam(this,abstractElem);
    10593    break;
    10694  case nomdElements::fit  :
    107     GWt_abstractElement_ = new GWt_elementFit(this);
     95    GWt_abstractElement_deprecated_ = new GWt_elementFit(this,abstractElem);
    10896    break;
    10997  case nomdElements::mpole  :
    110     GWt_abstractElement_ = new GWt_elementMpole(this);
     98    GWt_abstractElement_deprecated_ = new GWt_elementMpole(this,abstractElem);
    11199    break;
    112100  case nomdElements::snapshot :
    113101    {
    114       int incr = pspa_->getExtensionFile();
     102      int incr = dataManager_->getPspaApplication()->getExtensionFile();
    115103      incr++;
    116       pspa_->setExtensionFile(incr);
    117       GWt_abstractElement_ = new GWt_elementSnapshot(this,incr);
     104      dataManager_->getPspaApplication()->setExtensionFile(incr);
     105      GWt_abstractElement_deprecated_ = new GWt_elementSnapshot(this,abstractElem,incr);
    118106      break;
    119107    }
    120108  case nomdElements::inconnu :
    121     GWt_abstractElement_ = NULL;
     109    GWt_abstractElement_deprecated_ = NULL;
    122110  }
    123111 
     
    129117  elementContainer_->setLayout(vLayoutElementContainer);
    130118 
    131   if (GWt_abstractElement_ != NULL) {
    132     vLayoutElementContainer->addWidget(GWt_abstractElement_);
    133     GWt_abstractElement_->setMaximumSize(64,40);
    134     GWt_abstractElement_->setMinimumSize(64,40);
    135   }
    136  
    137   if (GWt_abstractElement_ == NULL) {
     119  if (GWt_abstractElement_deprecated_ != NULL) {
     120    vLayoutElementContainer->addWidget(GWt_abstractElement_deprecated_);
     121    GWt_abstractElement_deprecated_->setMaximumSize(64,40);
     122    GWt_abstractElement_deprecated_->setMinimumSize(64,40);
     123  }
     124 
     125  if (GWt_abstractElement_deprecated_ == NULL) {
    138126    elementLabel_ = new WText();
    139127  } else {
    140     elementLabel_ = new WText(GWt_abstractElement_->getAbstractElement()->getLabel());
     128    elementLabel_ = new WText(GWt_abstractElement_deprecated_->getAbstractElement()->getLabel());
    141129    }
    142130 
     
    191179  elementContainer_->mouseWentOut().connect(this,&GWt_elementLigneFaisceau::mouseWentOut);
    192180  elementContainer_->mouseWentOver().connect(this,&GWt_elementLigneFaisceau::mouseWentOver);
    193   actionParameters_->clicked().connect(GWt_abstractElement_,&GWt_abstractElement::showParameters);
    194   actionTrash_->clicked().connect(GWt_abstractElement_,&GWt_abstractElement::deleteElement);
     181  actionParameters_->clicked().connect(GWt_abstractElement_deprecated_,&GWt_abstractElement::showParameters);
     182  actionTrash_->clicked().connect(GWt_abstractElement_deprecated_,&GWt_abstractElement::deleteElement);
     183
     184  updateSoftware();
    195185}
    196186
     
    198188{}
    199189
    200 void GWt_elementLigneFaisceau::update()
     190void GWt_elementLigneFaisceau::updateSoftware()
    201191{
    202192  if (getGWt_AbstractElement()->getAbstractElement()) {
     
    229219{
    230220  clear();
    231   GWt_abstractElement_ = elem;
    232   addWidget(GWt_abstractElement_);
     221  GWt_abstractElement_deprecated_ = elem;
     222  addWidget(GWt_abstractElement_deprecated_);
    233223  if (static_cast <WContainerWidget*> (parent())) {
    234224    WContainerWidget* wc = static_cast <WContainerWidget*> (parent());
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementMpole.cc

    r437 r455  
    99#include <Wt/WPushButton>
    1010
    11 GWt_elementMpole::GWt_elementMpole(GWt_elementLigneFaisceau* elm) : GWt_abstractElement(new elementMultipole())
     11GWt_elementMpole::GWt_elementMpole(GWt_elementLigneFaisceau* elm,abstractElement* abstract) :
     12GWt_abstractElement(abstract)
    1213{
    1314  elementLigneFaiseauContainer_ = elm;
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementRfgun.cc

    r437 r455  
    88#include <Wt/WPushButton>
    99
    10 GWt_elementRfgun::GWt_elementRfgun(GWt_elementLigneFaisceau* elemLigne)
    11 :GWt_abstractElement(new elementRfgun())
     10GWt_elementRfgun::GWt_elementRfgun(GWt_elementLigneFaisceau* elemLigne,abstractElement* abstract)
     11:GWt_abstractElement(abstract)
    1212{
    1313  elementLigneFaiseauContainer_ = elemLigne;
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementSnapshot.cc

    r442 r455  
    99#include <Wt/WPushButton>
    1010
    11 GWt_elementSnapshot::GWt_elementSnapshot(GWt_elementLigneFaisceau* elemLigne, int num) : GWt_abstractElement(new elementSnapshot(num))
     11GWt_elementSnapshot::GWt_elementSnapshot(GWt_elementLigneFaisceau* elemLigne,abstractElement* abstract, int num) :
     12GWt_abstractElement(abstract)
    1213{
    1314  elementLigneFaiseauContainer_ = elemLigne;
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementSoleno.cc

    r437 r455  
    88#include <Wt/WPushButton>
    99
    10 GWt_elementSoleno::GWt_elementSoleno(GWt_elementLigneFaisceau* elemLigne)
    11 :GWt_abstractElement(new elementSoleno())
     10GWt_elementSoleno::GWt_elementSoleno(GWt_elementLigneFaisceau* elemLigne,abstractElement* abstract)
     11:GWt_abstractElement(abstract)
    1212{
    1313  elementLigneFaiseauContainer_ = elemLigne;
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_ligneFaisceau.cc

    r453 r455  
    33#include "GWt_elementLigneFaisceau.h"
    44#include "GWt_ligneFaisceau.h"
    5 
     5#include "GWt_sector.h"
     6#include "abstractElement.h"
    67#include "nomDeLogiciel.h"
    78
     
    1112
    1213
    13 GWt_ligneFaisceau::GWt_ligneFaisceau(PspaApplication* ps) :
    14   WContainerWidget(),
    15   pspa_(ps)
     14GWt_ligneFaisceau::GWt_ligneFaisceau(dataManager* data,GWt_sector* sect) :
     15WContainerWidget(),
     16dataManager_(data),
     17UI_sector_(sect)
    1618{
    1719 
     
    2426  // set the object name
    2527  setObjectName("ligneFaisceau");
    26   clear();
     28  buildBeamLineWidget();
    2729}
    2830
     
    3436  // add the first drop zone
    3537  decorationStyle().setBorder (WBorder (WBorder::Dotted));
    36   allDropZone_ = new GWt_dropZoneLigneFaisceau(pspa_,this);
     38  allDropZone_ = new GWt_dropZoneLigneFaisceau(dataManager_,this);
    3739  WVBoxLayout* fit = new WVBoxLayout();
    3840  allDropZone_->setLayout(fit);
     
    4951GWt_abstractElement* GWt_ligneFaisceau::addElement(nomdElements::typedElement eType, GWt_dropZoneLigneFaisceau* dropContainer )
    5052{
    51 
    52   GWt_abstractElement* GWtAbstractElem = NULL; 
    53   cout << " addElement::element : " << nomdElements::getLabelFromType(eType) << endl;
    54    
    55   // 3 cases :
    56   // -dropContainer is an element of the ligneFaisceauLayout_
    57   // -dropContainer is an element of the GWt_elementLigneFaisceau_
    58   // -dropContainer is NULL, insert in the last element
    59  
    60   if(eType == nomdElements::inconnu) {
    61     cout << "GWt_ligneFaisceau::element type " << eType << " inconnu " << endl;
    62     return NULL;
    63   }
    64  
    65   // add the element to the datamanager
    66  
    67   // first time we insert an element :
    68   GWt_elementLigneFaisceau* firstElemIsElement = dynamic_cast <GWt_elementLigneFaisceau*> (ligneFaisceauLayout_->itemAt(0)->widget());
    69 
    70   if( (ligneFaisceauLayout_->count() == 1) && (!firstElemIsElement) ) {
    71     int index = indexOf(dropContainer);
    72     if( (index != -1) || (dropContainer == NULL) ) { // found
    73       // remove global drop zone
    74       ligneFaisceauLayout_->clear();
    75       // add first element
    76       GWt_elementLigneFaisceau* elemLigneFaisceau = new GWt_elementLigneFaisceau(eType,pspa_,this);
    77       ligneFaisceauLayout_->addWidget(elemLigneFaisceau,1);
    78       GWtAbstractElem = elemLigneFaisceau->getGWt_AbstractElement();
    79       // remove arrow from begin and end
    80      
    81     } else { // error
    82       return NULL;
    83     }
    84   } else {
    85     int index = -1;
     53 
     54 
     55  GWt_abstractElement* UIabstractElement = NULL;
     56 
     57  // Add this element to the DataManager
     58
     59  // create a new abstractElement
     60    // FIXME : To be move in an abstractFactory in the controler !!
     61    abstractElement* currentElement = NULL;
     62    switch (  eType ) {
     63      case nomdElements::RFgun :
     64        currentElement = new elementRfgun();
     65        break;
     66      case nomdElements::drift :
     67        currentElement = new elementDrift();
     68        break;
     69      case nomdElements::cell  :
     70        currentElement = new elementCell();
     71        break;
     72      case nomdElements::bend  :
     73        currentElement = new elementBend();
     74        break;
     75      case nomdElements::soleno  :
     76        currentElement = new elementSoleno();
     77        break;
     78      case nomdElements::beam  :
     79        currentElement = new elementBeam();
     80        break;
     81      case nomdElements::fit  :
     82        currentElement = new elementFit();
     83        break;
     84      case nomdElements::mpole  :
     85        currentElement = new elementMultipole();
     86        break;
     87      case nomdElements::snapshot :
     88      {
     89        // FIXME : Snapshot a gérér
     90/*        int incr = dataManager_->getPspaApplication()->getExtensionFile();
     91        incr++;
     92        dataManager_->getPspaApplication()->setExtensionFile(incr);
     93*/
     94        currentElement = new elementSnapshot();
     95        break;
     96      }
     97    }
     98
     99   
     100    // look for the previous element
     101    abstractElement* previousElement = NULL;
     102   
    86103    for (int a=0; a< ligneFaisceauLayout_->count(); a++) {
    87104      GWt_elementLigneFaisceau* elem = static_cast <GWt_elementLigneFaisceau*> (ligneFaisceauLayout_->itemAt(a)->widget ());
    88105      if (elem) {
    89         if (elem->getDropZoneLeft() == dropContainer) {
    90           index = a;
    91         }
    92         if (elem->getDropZoneRight() == dropContainer) {
    93           index = a+1;
    94         }
    95       }
    96      
    97     }
    98    
    99     //  ligneFaisceauLayout_->addWidget(new GWt_elementLigneFaiseau(ptr),0);
    100     GWt_elementLigneFaisceau* elemLigneFaisceau = new GWt_elementLigneFaisceau(eType, pspa_,this);
    101     if (index != -1) {
    102       ligneFaisceauLayout_->insertWidget(index,elemLigneFaisceau,1);
    103       GWtAbstractElem = elemLigneFaisceau->getGWt_AbstractElement();
    104     } else {
    105       ligneFaisceauLayout_->addWidget(elemLigneFaisceau,1);
    106       GWtAbstractElem = elemLigneFaisceau->getGWt_AbstractElement();
    107     }
    108   }
    109   manageLineFaisceauLayout();
    110  
    111   return GWtAbstractElem;
    112 }
    113 
    114 
    115 void GWt_ligneFaisceau::manageLineFaisceauLayout() {
     106        if (elem->getDropZoneRight() == dropContainer) {
     107          previousElement = elem->getGWt_AbstractElement()->getAbstractElement();
     108        }
     109      }
     110    }
     111
     112    getUISector()->getSectorControler()->addElementAfter(currentElement,previousElement );
     113 
     114  buildBeamLineWidget();
     115  return UIabstractElement;
     116
     117}
     118
     119
     120void GWt_ligneFaisceau::manageLineFaisceauLayout_deprecated() {
    116121  // special : hide/setVisible arrow :
    117122  for (int a=0; a< ligneFaisceauLayout_->count(); a++) {
     
    151156  }
    152157 
    153   pspa_->getExecuteWidget()->updateSections();
    154 }
    155 
     158  // FIXME
     159  UI_sector_->getExecuteWidget()->updateSections();
     160}
     161
     162
     163void GWt_ligneFaisceau::buildBeamLineWidget() {
     164  // clear the layout and set default text
     165  clear();
     166  bool first = true;
     167
     168  // Get the dataManager's sector
     169  // rebuild the beamLine
     170
     171  GWt_elementLigneFaisceau* elemLigneFaisceau = NULL;
     172  for (unsigned int i =0; i< UI_sector_->getSectorControler()->getSectionsToExecute().size(); i++) {
     173    std::vector <abstractElement*> abstractElem = UI_sector_->getSectorControler()->getSectionsToExecute()[i]->getElements();
     174    for (unsigned int j=0; j< abstractElem.size(); j++) {
     175
     176      elemLigneFaisceau = new GWt_elementLigneFaisceau(dataManager_,
     177                                                       this,
     178                                                       abstractElem[j]);
     179     
     180      // remove default text
     181      if (first) {
     182        first = false;
     183        ligneFaisceauLayout_->clear();
     184        ligneFaisceauLayout_->addWidget(elemLigneFaisceau);
     185
     186        elemLigneFaisceau->getDropZoneLeft()->setStyleClass("elementLigneFaiseau_transparent");
     187        elemLigneFaisceau->getDropZoneRight()->setStyleClass("elementLigneFaiseau_line");
     188     
     189      } else {
     190        ligneFaisceauLayout_->addWidget(elemLigneFaisceau);
     191
     192        elemLigneFaisceau->getDropZoneLeft()->setStyleClass( "elementLigneFaiseau_line");
     193        elemLigneFaisceau->getDropZoneRight()->setStyleClass("elementLigneFaiseau_line");
     194      }
     195     
     196    }
     197  }
     198  // remove last line
     199  if (elemLigneFaisceau != NULL) {
     200    elemLigneFaisceau->getDropZoneRight()->setStyleClass("elementLigneFaiseau_transparent");
     201  }
     202 
     203}
    156204
    157205
    158206void GWt_ligneFaisceau::update() {
    159   manageLineFaisceauLayout();
     207  manageLineFaisceauLayout_deprecated();
    160208}
    161209
     
    186234   
    187235    // manage widgets if necessary
    188     manageLineFaisceauLayout();
     236    manageLineFaisceauLayout_deprecated();
    189237  }
    190238}
     
    201249           
    202250            if (GWt_elementLigneFaisceau* elem = dynamic_cast <GWt_elementLigneFaisceau*> (ligneFaisceauLayout_->itemAt(a)->widget ())) {
    203                 if (index == i) {
    204                     if (elem->getGWt_AbstractElement()) {
    205                         return elem->getGWt_AbstractElement()->getAbstractElement();
    206                     }
     251              if (index == i) {
     252                if (elem->getGWt_AbstractElement()) {
     253                  return elem->getGWt_AbstractElement()->getAbstractElement();
    207254                }
    208                 index ++;
    209             }
    210         }
    211     }
     255           }
     256             index ++;
     257        }
     258    }
     259  }
     260  return NULL;
     261}
     262
     263
     264
     265int GWt_ligneFaisceau::getAbstractElementNumeroFromLabel(std::string txt){
     266  int index = 1;
     267  if (txt == "") {
    212268    return NULL;
    213 }
    214 
    215 
    216 
    217 int GWt_ligneFaisceau::getAbstractElementNumeroFromLabel(std::string txt){
    218     int index = 1;
    219     if (txt == "") {
    220         return NULL;
    221     }
    222    
    223     for (int a=0; a< ligneFaisceauLayout_->count(); a++) {
    224         if (ligneFaisceauLayout_->itemAt(a)) {
    225            
    226             if (GWt_elementLigneFaisceau* elem = dynamic_cast <GWt_elementLigneFaisceau*> (ligneFaisceauLayout_->itemAt(a)->widget ())) {
    227                 if (elem->getGWt_AbstractElement()) {
    228                     if (elem->getGWt_AbstractElement()->getAbstractElement()->getLabel() == txt) {
    229                         return index;
    230                     }
    231                 }
    232                 index ++;
    233             }
    234         }
    235     }
    236     return NULL;
    237    
     269  }
     270 
     271  for (int a=0; a< ligneFaisceauLayout_->count(); a++) {
     272    if (ligneFaisceauLayout_->itemAt(a)) {
     273     
     274      if (GWt_elementLigneFaisceau* elem = dynamic_cast <GWt_elementLigneFaisceau*> (ligneFaisceauLayout_->itemAt(a)->widget ())) {
     275        if (elem->getGWt_AbstractElement()) {
     276          if (elem->getGWt_AbstractElement()->getAbstractElement()->getLabel() == txt) {
     277            return index;
     278          }
     279        }
     280        index ++;
     281      }
     282    }
     283  }
     284  return NULL;
     285 
    238286}
    239287
     
    263311}
    264312
    265 void GWt_ligneFaisceau::update(int i){
     313void GWt_ligneFaisceau::update_deprecated(int i){
    266314    int index = 0;
    267    
     315 
    268316    // first if 1
    269317    //    i--;
    270    
     318 
    271319    for (int a=0; a< ligneFaisceauLayout_->count(); a++) {
    272320        if (GWt_elementLigneFaisceau* elem = dynamic_cast <GWt_elementLigneFaisceau*> (ligneFaisceauLayout_->itemAt(a)->widget ())) {
    273321            if (index == i) {
    274                 elem->update();
     322    //        elem->update();
    275323            }
    276324            index ++;
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc

    r453 r455  
    4545  WApplication(env),
    4646  applicationDefaultTitle_("portail PSPA"),
    47   beamLine_(NULL),
    4847  extensionFile_(0)
    4948{
     
    7978  WPushButton* boutonRestaure = new WPushButton();
    8079  WPushButton* boutonLoadNew = new WPushButton();
    81   WPushButton* boutongraphicalAnalysis = new WPushButton();
    8280  WPushButton* boutonTrash = new WPushButton();
    8381 
     
    8583  boutonRestaure->setStyleClass("restoreButton");
    8684  boutonLoadNew->setStyleClass("loadNewButton");
    87   boutongraphicalAnalysis->setStyleClass("histoButton");
    8885  boutonTrash->setStyleClass("trashButton");
    8986 
     
    9188  boutonRestaure->setToolTip ("restaurer la configuration depuis le serveur");
    9289  boutonLoadNew->setToolTip ("charger une configuration");
    93   boutongraphicalAnalysis->setToolTip ("analyse graphique");
    94   boutonTrash->setToolTip ("tout effacer");
     90  boutonTrash->setToolTip ("supprimer l'accélerateur"); // FIXME ! a terminer
    9591 
    9692  boutonSauve->setMaximumSize(38,38);
     
    10096  boutonLoadNew->setMaximumSize(38,38);
    10197  boutonLoadNew->setMinimumSize(38,38);
    102   boutongraphicalAnalysis->setMaximumSize(38,38);
    103   boutongraphicalAnalysis->setMinimumSize(38,38);
    10498  boutonTrash->setMaximumSize(38,38);
    10599  boutonTrash->setMinimumSize(38,38);
     
    109103  // Upload when the button is clicked. React to a succesfull upload.
    110104  boutonLoadNew->clicked().connect(this, &PspaApplication::openFileSelector);
    111   boutongraphicalAnalysis->clicked().connect(this, &PspaApplication::dialogOnGraphics);
    112   boutonTrash->clicked().connect(this, &PspaApplication::removeBeamLine);
    113105  toolbarLayout->addWidget(boutonSauve , 0,Wt::AlignMiddle);
    114106  toolbarLayout->addWidget(boutonRestaure , 0,Wt::AlignMiddle);
    115107  toolbarLayout->addWidget(boutonLoadNew , 0,Wt::AlignMiddle);
    116   toolbarLayout->addWidget(boutongraphicalAnalysis , 0,Wt::AlignMiddle);
    117108  toolbarLayout->addWidget(boutonTrash , 0,Wt::AlignMiddle);
    118109  toolbarLayout->addWidget(new WText("") , 1,Wt::AlignMiddle);
     
    138129
    139130 
    140   GWt_accelerator* accel = new GWt_accelerator(acceleratorContainerWidget,this);
     131  new GWt_accelerator(acceleratorContainerWidget,dtmanage_);
    141132  new WBreak(acceleratorContainerWidget);
    142133
    143   WScrollArea* scroll = new  WScrollArea(acceleratorContainerWidget);
    144   scroll->setWidget(createBeamLine());
    145   scroll->setMinimumSize(300,150);
    146 
     134
     135  // ---------------------------------------------------------------
     136  // ********************* Ancien code : A supprimer ***************
     137  // ---------------------------------------------------------------
     138  beamLine_deprecated_ = NULL;
     139  /*
     140   WScrollArea* scroll = new  WScrollArea(acceleratorContainerWidget);
     141   scroll->setWidget(createBeamLine__deprecated());
     142   scroll->setMinimumSize(300,150);
     143   */
     144 
    147145  new WBreak(acceleratorContainerWidget);
    148146  //-----------
     
    153151
    154152  globalParam_ = new GWt_globalParameters(dtmanage_);
    155   sectorParam_ = new GWt_sectorParameters(dtmanage_);
     153  sectorParam_ = new GWt_sectorParameters();
    156154  WWidget* dboard = createDashBoard(acceleratorContainerWidget);
    157155  dboard->setMinimumSize(300,100);
     
    161159  //-----------
    162160
    163   graphicsDialog_ = new GWt_dialog("graphical analysis",createDrawingWidget(),false);
    164   graphicsDialog_->setMinimumSize(400,400);
    165   graphicsDialog_->setClosable(true);
    166   graphicsDialog_->hide();
    167  
    168   executeWidget_ = new GWt_softwarePanel(dtmanage_,this,acceleratorContainerWidget);
    169   executeWidget_->setMinimumSize(400,100);
    170161 
    171162  new WBreak(acceleratorContainerWidget);
     
    219210void PspaApplication::messageBox2()
    220211{
    221   sectorParam_->execDialog();
     212  sectorParam_->execDialog_deprecated();
    222213  return;
    223214}
     
    245236}
    246237
    247 Wt::WWidget* PspaApplication::createBeamLine()
     238/*Wt::WWidget* PspaApplication::createBeamLine__deprecated()
    248239{
    249240  extensionFile_= 0;
    250   if (!beamLine_) {
    251     beamLine_ = new GWt_ligneFaisceau(this);
     241  if (!beamLine__deprecated_) {
     242    // FIXME : get the one of the first app/sector for the moment
     243    beamLine__deprecated_ = accel_toBeRenameAsLocal->firstSector__deprecated()->getUIBeamLine ?
    252244  } else {
    253245    beamLine_->clear();
     
    256248  setTitle(applicationDefaultTitle_);
    257249
    258   return beamLine_;
    259 }
    260 
    261 void PspaApplication::dialogOnGraphics()
    262 {
    263   graphicsDialog_->show();
    264 }
    265 
    266 WContainerWidget* PspaApplication::createDrawingWidget()
    267 {
    268   WGridLayout *glayout= new WGridLayout();
    269   WContainerWidget* dessin = new WContainerWidget();
    270   dessin->setLayout(glayout);
    271 
    272   group_ = new Wt::WButtonGroup(this);
    273  
    274   /////////////////////////////////////////////////////////////////////
    275        
    276   choixEnveloppeDessin_ = new WComboBox();
    277   choixEnveloppeDessin_->addItem("x");
    278   // choixEnveloppeDessin_->addItem("y");
    279   Wt::WRadioButton *button1= new WRadioButton(" enveloppe");
    280   group_->addButton(button1,1);
    281   glayout->addWidget(button1,0,1);
    282   glayout->addWidget(choixEnveloppeDessin_,0,2);
    283   /////////////////////////////////////////////////////////////////////
    284 
    285   choixElementDessin_ = new WComboBox();
    286   choixElementDessin_->setMinimumSize(50,10);
    287   choixTypeDessinFaisceau_ = new WComboBox();
    288   choixTypeDessinFaisceau_->addItem("courant_snyder");
    289   choixTypeDessinFaisceau_->addItem("macroparticles");
    290   Wt::WRadioButton *button2= new WRadioButton(" phase space after element");
    291 
    292   choixAbsPhase_ = new WComboBox();
    293   choixAbsPhase_->addItem("x");
    294   choixAbsPhase_->addItem("y");
    295   choixAbsPhase_->addItem("dz");
    296   choixAbsPhase_->addItem("xp");
    297   choixAbsPhase_->addItem("yp");
    298   choixAbsPhase_->addItem("dE/E");
    299   choixAbsPhase_->setCurrentIndex(0);
    300  
    301   choixOrdPhase_ = new WComboBox();
    302   choixOrdPhase_->addItem("x");
    303   choixOrdPhase_->addItem("y");
    304   choixOrdPhase_->addItem("dz");
    305   choixOrdPhase_->addItem("xp");
    306   choixOrdPhase_->addItem("yp");
    307   choixOrdPhase_->addItem("dE/E");
    308   choixOrdPhase_->setCurrentIndex(3);
    309  
    310   group_->addButton(button2,2);
    311   glayout->addWidget(button2,1,1);
    312   glayout->addWidget(choixElementDessin_,1,2);
    313   glayout->addWidget(choixTypeDessinFaisceau_,1,3);
    314   //  glayout->addWidget(new WText("abs. :"),2,2);
    315   glayout->addWidget(choixAbsPhase_,2,2);
    316   //  glayout->addWidget(new WText("ord. :"),2,4);
    317   glayout->addWidget(choixOrdPhase_,2,3);
    318   /////////////////////////////////////////////////////////////////////
    319 
    320   choixVariableHisto_= new WComboBox();
    321   choixVariableHisto_->addItem("x");
    322   choixVariableHisto_->addItem("y");
    323   choixVariableHisto_->addItem("z");
    324   choixVariableHisto_->addItem("xp");
    325   choixVariableHisto_->addItem("yp");
    326   choixVariableHisto_->addItem("dE/E");
    327   choixVariableHisto_->setCurrentIndex(5);
    328 
    329   choixHistoDessin_ = new WComboBox();
    330   Wt::WRadioButton *button3= new WRadioButton(" histogram after element ");
    331   group_->addButton(button3,3);
    332 
    333   glayout->addWidget(button3,3,1);
    334   glayout->addWidget(choixHistoDessin_,3,2);
    335   glayout->addWidget(choixVariableHisto_,3,3);
    336   /////////////////////////////////////////////////////////////////////
    337  
    338   WPushButton *close= new WPushButton("close");
    339   glayout->addWidget(close,4,1);
    340   close->clicked().connect(this,&PspaApplication::closeGraphicDialog);
    341  
    342   WPushButton *draw= new WPushButton("draw");
    343   glayout->addWidget(draw,4,2,2,1);
    344   draw->clicked().connect(this,&PspaApplication::dessiner);
    345   /////////////////////////////////////////////////////////////////////
    346 
    347   toto_ = new WContainerWidget();
    348   dessin->addWidget(toto_);
    349   return dessin;
    350 }
    351 
    352 void PspaApplication::closeGraphicDialog()
    353 {
    354   cout << " close graphicsDialog_" << endl;
    355   for(unsigned i = 0; i < eDialog_.size(); i++) eDialog_[i]->done(WDialog::Rejected);
    356   eDialog_.clear();
    357   graphicsDialog_->done(WDialog::Rejected);
    358 }
    359 
    360 void PspaApplication::dessiner()
    361 {
    362   int k= group_->checkedId();
    363   cout << "dessiner k= " << k << endl;
    364 
    365   switch(k) {
    366   case  1:
    367     dessinerEnveloppe();
    368     break;
    369   case 2:
    370     dessinerPhaseSpace();
    371     break;
    372   case 3:
    373     dessinerHistogramme();
    374     break;
    375   default:
    376     GWt_dialog graphicalWarning("graphical analysis","select a button",GWt_dialog::Warning,false,true);
    377     graphicalWarning.exec();
    378     break;
    379   }
    380 }
    381 
     250  return beamLine__deprecated_;
     251}
     252*/
    382253
    383254void PspaApplication::sauver()
     
    511382  GWt_dialog*  messageBox= new GWt_dialog("Error during upload file" ,message ,GWt_dialog::Error,false,true);
    512383  messageBox->show();
    513 }
    514 
    515 void PspaApplication::faireDessin()
    516 {
    517   choixElementDessin_->clear();
    518   choixHistoDessin_->clear();
    519 
    520   int nombre = dtmanage_->getBeamLineSize(); 
    521   for(int i = 1; i <= nombre; i++) {
    522     abstractElement* elPtr = dtmanage_->getElementPointerFromNumero(i);
    523     //    if(elPtr->getNomdElement().getElementType() == snapshot) continue;
    524 
    525     choixElementDessin_->addItem(elPtr->getLabel());
    526     choixHistoDessin_->addItem(elPtr->getLabel());
    527   }
    528 }
    529 
    530 void PspaApplication::dessinerPhaseSpace()
    531 {   
    532    
    533   int typeFaisceau = choixTypeDessinFaisceau_->currentIndex();
    534   //  int index = choixElementDessin_->currentIndex();
    535   string nameAbs = choixAbsPhase_->currentText().toUTF8();
    536   string nameOrd = choixOrdPhase_->currentText().toUTF8();
    537   if ( nameAbs == nameOrd ) {
    538         GWt_dialog phaseSpaceError(" graphical analysis", "the beam coordinates must be different !", GWt_dialog::Error, false,true);
    539         phaseSpaceError.exec();
    540         return;
    541   }
    542   string elementLabel = choixElementDessin_->currentText().toUTF8();
    543   particleBeam* beam = dtmanage_->getDiagnosticBeam(elementLabel);
    544   //  particleBeam* beam = dtmanage_->getDiagnosticBeam(index);
    545    
    546   if ( beam == NULL ) {
    547     GWt_dialog warningBeamState(" graphical analysis", "the beam does not exist at the end of this element !", GWt_dialog::Error, false,true);
    548     warningBeamState.exec();
    549     return;
    550   }
    551    
    552     toto_->clear();
    553     faireDessinPhaseSpace(toto_, beam, elementLabel, nameAbs, nameOrd, typeFaisceau);
    554 
    555   // if ( typeFaisceau == 0 )
    556   //   {
    557   //     if ( !beam->momentRepresentationOk() ) beam->buildMomentRepresentation();
    558   //     faireDessinTransport(toto_, beam, nameAbs, nameOrd );
    559   //   }
    560   // else if ( typeFaisceau == 1 )
    561   //   {
    562   //     if ( beam->particleRepresentationOk() ) faireDessinParmela(toto_, beam, nameAbs, nameOrd );
    563   //     else {
    564   //    GWt_dialog warningBeamState(" graphical analysis", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true);
    565   //    warningBeamState.exec();
    566   //     }
    567   //   }
    568   // else {
    569   //   GWt_dialog warningTypeDrawing(" graphical analysis", "type of  drawing not programmed !", GWt_dialog::Error, false,true);
    570   //   warningTypeDrawing.exec();
    571   // }
    572 }
    573 
    574 void PspaApplication::dessinerEnveloppe()
    575 {
    576   toto_->clear();
    577  
    578   int typeEnveloppe = choixEnveloppeDessin_->currentIndex();
    579   if ( typeEnveloppe == 0 )
    580     {
    581       faireDessinEnveloppe(toto_, "x");
    582     }
    583   else {
    584     GWt_dialog warningTypeEnveloppe(" graphical analysis", "type of enveloppe drawing not programmed !", GWt_dialog::Error, false,true);
    585     warningTypeEnveloppe.exec();
    586   }
    587 }
    588 
    589 void PspaApplication::faireDessinEnveloppe(WContainerWidget* toto, string type)
    590 {
    591  
    592   std::time_t result = std::time(NULL);
    593  
    594   GWt_dialog* envDialog = new GWt_dialog(WString("enveloppe&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(")+std::asctime(std::localtime(&result))+")",toto,false);
    595   eDialog_.push_back(envDialog);
    596   envDialog->setMinimumSize(400,400);
    597   envDialog->setClosable(true);
    598   envDialog->show();
    599      
    600   //  unsigned nbel = dtmanage_->getBeamLineSize();
    601   vector<double> xcor;
    602   vector<double> ycor;
    603   string titre;
    604   string legendx;
    605   string legendy;
    606   dtmanage_->donneesRmsEnveloppe(type,xcor,ycor,titre,legendx,legendy);
    607 
    608   Wt::Chart::SeriesType seriesType = LineSeries;
    609   Wt::Chart::FillRangeType fillRange = NoFill;
    610   Wt::Chart::AxisValue location = ZeroValue;
    611   bool isGridLinesEnabled = false;
    612   chartPlot2vec(envDialog->contents(),xcor,ycor,seriesType,fillRange,location,isGridLinesEnabled,titre,legendx,legendy,500,300);
    613 }
    614 
    615 void PspaApplication::faireDessinPhaseSpace(WContainerWidget* toto, particleBeam* beam, string elementLabel, string namex, string namey, int typeFaisceau)
    616 {
    617 
    618   vector<double> xcor;
    619   vector<double> ycor;
    620   vector<string> legende;
    621   string titre;
    622   Wt::Chart::SeriesType seriesType;
    623  
    624   if ( typeFaisceau == 0 ) {
    625     seriesType = LineSeries;
    626     titre = "phase space rms";
    627     beam->donneesDessinEllipse(xcor,ycor,legende,namex,namey);
    628   } else if (  typeFaisceau == 1 ) {
    629     seriesType = PointSeries;
    630     titre = " phase space ";
    631     beam->particlesPhaseSpaceData(xcor,ycor,legende,namex,namey);
    632     // for ( int kk=0; kk < xcor.size(); kk++)
    633     //   {
    634     //  cout << " dess. phas. x= " << xcor.at(kk) << " x'= " << ycor.at(kk) << endl;
    635     //   }
    636   } else {
    637     GWt_dialog warningBeamState(" graphical analysis", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true);
    638     warningBeamState.exec();
    639     return;
    640   }
    641  
    642   std::time_t result = std::time(NULL);
    643   GWt_dialog* phaseSpaceDialog = new GWt_dialog(WString("phase space&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(")+std::asctime(std::localtime(&result))+")",toto,false);
    644   eDialog_.push_back(phaseSpaceDialog);
    645   phaseSpaceDialog->setMinimumSize(400,400);
    646   phaseSpaceDialog->setClosable(true);
    647   new WText(" case : " + nameOfCase_, phaseSpaceDialog->contents());
    648   new WBreak(phaseSpaceDialog->contents());
    649   new WText(" after element :  " + elementLabel, phaseSpaceDialog->contents());
    650 
    651   for (int k=0 ; k < (int)legende.size(); k++) {
    652     new WBreak(phaseSpaceDialog->contents());
    653     new WText(legende.at(k), phaseSpaceDialog->contents());
    654   }
    655 
    656   Wt::Chart::FillRangeType fillRange = NoFill;
    657   Wt::Chart::AxisValue location = ZeroValue;
    658   bool isGridLinesEnabled = false;
    659   chartPlot2vec(phaseSpaceDialog->contents(),xcor,ycor,seriesType,fillRange,location,isGridLinesEnabled,titre,namex,namey,500,300);
    660  
    661   phaseSpaceDialog->show();
    662384}
    663385
     
    878600
    879601
    880 
     602/*
    881603void PspaApplication::removeBeamLine() {
    882   createBeamLine();
     604  createBeamLine__deprecated();
    883605  executeWidget_->updateSections();
    884606}
    885 
    886 void PspaApplication::chartPlot2vec(WContainerWidget* toto,vector<double>& xcor,vector<double>& ycor,SeriesType seriesType,FillRangeType fillRange,AxisValue value,bool isGridLinesEnables,string title,string legendx,string legendy,int width,int height,bool makeIcon)
    887 {
    888   int nbpts = xcor.size();
    889   cout << " PspaApplication::chartPlot2vec nbpts = " << nbpts << endl;
    890 
    891   WStandardItemModel *model = new WStandardItemModel(nbpts, 2, toto);
    892   for (int i = 0; i < nbpts; ++i) {
    893     model->setData(i, 0, xcor.at(i));
    894     model->setData(i, 1, ycor.at(i));
    895     //        cout << " PspaApplication::chartPlot2vec el= " << i+1 << " x= " << xcor.at(i) << " y= " << ycor.at(i) << endl;
    896   }
    897   //  cout << " PspaApplication::chartPlot2vec FLAG 0 " << endl;
    898   WCartesianChart *chart = new WCartesianChart(toto);
    899   if (!makeIcon) chart->setTitle(title);
    900   chart->initLayout(); 
    901   chart->setModel(model);        // set the model
    902   chart->setXSeriesColumn(0);    // set the column that holds the X data
    903  
    904   chart->setType(ScatterPlot);   // set type to ScatterPlot
    905   chart->setLegendEnabled(false); // enable the legend 
    906 
    907   // Provide space for the X and Y axis and title.
    908   chart->setPlotAreaPadding(80, Left);
    909   chart->setPlotAreaPadding(40, Bottom);
    910   chart->setPlotAreaPadding(60, Top);
    911  
    912   // Typically, for mathematical functions, you want the axes to cross
    913   // at the 0 mark (value= ZeroValue)
    914   chart->axis(XAxis).setLocation(value);
    915   chart->axis(YAxis).setLocation(value);
    916  
    917   //  cout << " PspaApplication::chartPlot2vec FLAG 1 " << endl;
    918 
    919   WDataSeries s(1,seriesType);
    920   s.setPen(WColor("red"));
    921   s.setFillRange(fillRange);
    922   chart->addSeries(s);
    923  
    924   WAxis& axis = chart->axis(XAxis);
    925   axis.setLabelFormat("%.3f");
    926   axis.setTitle(legendx);
    927    
    928   chart->axis(Y1Axis).setTitle(legendy);
    929 
    930   if(isGridLinesEnables) {
    931     axis.setGridLinesEnabled(true);
    932     chart->axis(Y1Axis).setGridLinesEnabled(true);
    933   }
    934   //   cout << " PspaApplication::chartPlot2vec FLAG 2 " << endl;
    935 
    936   chart->resize(width,height); // WPaintedWidget must be given explicit size
    937   chart->setMargin(10, Top | Bottom); // ?
    938   chart->setMargin(WLength::Auto, Left | Right); //?
    939 
    940   if (makeIcon) {
    941     chart->setLegendEnabled(false); // enable the legend
    942     chart->setPlotAreaPadding(0);
    943     chart->setAxisPadding(0);
    944     WFont xAxisFont = chart->axis(XAxis).labelFont();
    945     xAxisFont.setSize(8);
    946     WFont yAxisFont = chart->axis(YAxis).labelFont();
    947     yAxisFont.setSize(8);
    948     chart->axis(XAxis).setLabelFont(xAxisFont);
    949     chart->axis(YAxis).setLabelFont(yAxisFont);
    950   }
    951   //  cout << " PspaApplication::chartPlot2vec FLAG 3 " << endl;
    952 
    953 #ifdef HAS_IMAGEMAGIC
    954 
    955   //  cout << " PspaApplication::chartPlot2vec FLAG MAGIC " << endl;
    956 
    957   // no background
    958   chart->setBackground(WBrush(Wt::NoBrush));
    959 
    960   // axis black
    961   chart->axis(XAxis).setPen(WColor("black"));
    962   chart->axis(YAxis).setPen(WColor("black"));
    963    
    964   std::string name;
    965   /*
    966  Wt::WRasterImage pngImage("png", 1000, 1000);
    967   Wt::WPainter p(&pngImage);
    968   chart->paint(p);
    969   name = workingDir_ + "/chart-"+sessionId ()+".png";
    970   std::ofstream f(name.c_str(), std::ios::out |std::ios::trunc | std::ios::binary);
    971   pngImage.write(f);
    972   */
    973 
    974   Wt::WPdfImage pdfImage("1000", "600");
    975     {
    976    Wt::WPainter p1(&pdfImage);
    977     chart->paint(p1);
    978       }
    979 
    980   name = workingDir_ + "/chart-"+sessionId ()+".pdf";
    981   std::ofstream f1(name.c_str(), std::ios::out | std::ios::binary);
    982   pdfImage.write(f1);
    983 
    984   new WText("<a href='workingArea/chart-"+sessionId ()+".pdf' target='_blank'>Sauvegarder l'image</a>",toto);
    985 
    986 #endif
    987   //  cout << " PspaApplication::chartPlot2vec FLAG FIN" << endl;
    988 
    989 }
    990 
    991 void PspaApplication::dessinerHistogramme()
    992 {
    993   toto_->clear();
    994  
    995   // std::time_t result = std::time(NULL);
    996   // GWt_dialog* histoDialog = new GWt_dialog(WString("histogramme&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(")+std::asctime(std::localtime(&result))+")",toto_,false);
    997   // eDialog_.push_back(histoDialog);
    998   // histoDialog->setMinimumSize(400,400);
    999   // histoDialog->setClosable(true);
    1000 
    1001   string elementLabel = choixHistoDessin_->currentText().toUTF8();   
    1002   particleBeam* beam = dtmanage_->getDiagnosticBeam(elementLabel);
    1003   if (beam == NULL) {
    1004     GWt_dialog warningBeamState("histogram","the beam does not exist at the end of this element !", GWt_dialog::Error, false,true);
    1005     warningBeamState.exec();
    1006     return;
    1007   }
    1008  
    1009   if (!beam->particleRepresentationOk()) {
    1010     GWt_dialog warningBeamState("histogram", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true);
    1011     warningBeamState.exec();
    1012     return;
    1013   }
    1014 
    1015   unsigned iabs= choixVariableHisto_->currentIndex(); 
    1016   vector<double> xcor;
    1017   vector<int> hist;
    1018   //  double out[3]= {0.0};
    1019   vector<string> legende;
    1020   beam->histogramme(iabs,xcor,hist,legende);
    1021 
    1022   cout<<"xcor.size()= "<<xcor.size()<<", hist.size()= "<<hist.size()<<endl;
    1023   //////////////////////////////////////////////////////////////////////////////////
    1024  
    1025   int n = hist.size();
    1026   vector<double> x;
    1027   x.resize(2*n+2);
    1028   vector<double> y;
    1029   y.resize(2*n+2);
    1030 
    1031   int j= 0;
    1032   x.at(j)= xcor[0];
    1033   y.at(j)= 0.0;
    1034   j++;
    1035   x.at(j)= xcor[0];
    1036   y.at(j)= hist[0];
    1037   j++;
    1038  
    1039   for (int i = 1; i < n; ++i) {
    1040     x.at(j)= xcor[i];
    1041     y.at(j)= hist[i-1];
    1042     j++;
    1043     x.at(j)= xcor[i];
    1044     y.at(j)= hist[i];
    1045     j++;
    1046   }
    1047 
    1048   x.at(j)= xcor[n];
    1049   y.at(j)= hist[n-1];
    1050   j++;
    1051   x.at(j)= xcor[n];
    1052   y.at(j)= 0.0;
    1053   //////////////////////////////////////////////////////////////////////////////////
    1054   std::time_t result = std::time(NULL);
    1055   GWt_dialog* histoDialog = new GWt_dialog(WString("histogramme&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(")+std::asctime(std::localtime(&result))+")",toto_,false);
    1056   eDialog_.push_back(histoDialog);
    1057   histoDialog->setMinimumSize(400,400);
    1058   histoDialog->setClosable(true);
    1059 
    1060   histoDialog->show();
    1061 
    1062   WContainerWidget *w= histoDialog->contents();
    1063 
    1064   // // legendes
    1065   // string unites[2];
    1066   // if(iabs == 0 || iabs == 1 || iabs == 2) {
    1067   //   unites[0]= unites[1]= " mm";
    1068   // }
    1069   // if(iabs == 3 || iabs == 4) {
    1070   //   unites[0]= unites[1]= " mrad";
    1071   // }
    1072   // if(iabs == 5) {
    1073   //   unites[0]= " MeV"; unites[1]= " KeV";
    1074   // }
    1075 
    1076   new WText(" case : " + nameOfCase_, w);
    1077   new WBreak(w);
    1078   new WText(" after element :  " + elementLabel, w);
    1079 
    1080   for (int k=0 ; k < (int)legende.size(); k++) {
    1081     new WBreak(w);
    1082     new WText(legende.at(k), w);
    1083   }
    1084 
    1085 
    1086   // new WText(" entries : "+ mixedTools::intToString((int)out[0]),w);
    1087   // new WBreak(w);
    1088   // new WText(" mean : "+ mixedTools::doubleToString(out[1])+unites[0],w);
    1089   // new WBreak(w);
    1090   // new WText(" sigma rms : "+ mixedTools::doubleToString(out[2])+unites[1],w);
    1091   //////////////////////////////////////////////////////////////////////////////////
    1092 
    1093   string titre;
    1094   if(iabs == 0) titre="x-coordinate";
    1095   if(iabs == 1) titre="y-coordinate";
    1096   if(iabs == 2) titre="z-coordinate";
    1097   if(iabs == 3) titre="xp-divergence";
    1098   if(iabs == 4) titre="yp-devergence";
    1099   if(iabs == 5) titre="kinetic energy";
    1100 
    1101   string xname;
    1102   if(iabs == 0) xname=" x (mm)";
    1103   if(iabs == 1) xname=" y (mm)";
    1104   if(iabs == 2) xname=" z (mm)";
    1105   if(iabs == 3) xname=" xp (mrad)";
    1106   if(iabs == 4) xname=" yp (mrad)";
    1107   if(iabs == 5) xname=" dEcin/Ecin (%)";
    1108 
    1109   string yname;
    1110   Wt::Chart::SeriesType seriesType = LineSeries;
    1111   Wt::Chart::FillRangeType fillRange = ZeroValueFill;
    1112   Wt::Chart::AxisValue location = MinimumValue;
    1113   bool isGridLinesEnabled = true;
    1114   chartPlot2vec(w,x,y,seriesType,fillRange,location,isGridLinesEnabled,titre,xname,yname,500,300);
    1115 }
    1116 
    1117 
     607*/
     608
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_sectionToExecute.cc

    r431 r455  
    99#include "GWt_softwarePanel.h"
    1010
    11 GWt_sectionToExecute::GWt_sectionToExecute(Wt::WComboBox* first,Wt::WComboBox* last,Wt::WComboBox* soft,Wt::WContainerWidget* buttonPanel, GWt_softwarePanel* sPanel)
     11GWt_sectionToExecute::GWt_sectionToExecute(Wt::WComboBox* first,Wt::WComboBox* last,Wt::WComboBox* soft,Wt::WContainerWidget* buttonPanel, GWt_softwarePanel* sPanel,GWt_sector* sect)
    1212:WContainerWidget(),
    1313firstElement(first),
    1414lastElement(last),
    1515software(soft),
    16 softwarePanel(sPanel)
     16softwarePanel(sPanel),
     17UI_sector_(sect)
    1718{
    1819  Wt::WGridLayout* mainContainerLayout = new Wt::WGridLayout();
     
    138139
    139140}
     141
     142/*
     143 void GWt_sectionToExecute::setSoftware(nomDeLogiciel logiciel)
     144{
     145  UI_sector_->getSectorControler()->setSoftware(logiciel);
     146
     147}
     148
     149*/
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_sector.cc

    r453 r455  
    1111
    1212GWt_sector::GWt_sector(GWt_accelerator* parent,sector* sect) :
    13 parent_(parent),
    14 sector_(sect)
     13UI_Accelerator_(parent),
     14sectorControler_(sect)
    1515{
    16   setIcon(parent->getAcceleratorGlobalViewLayout());
     16  setIcon(UI_Accelerator_->getAcceleratorGlobalViewLayout());
    1717}
    1818
     
    3434  parentLineLayout->addWidget(sectorContainer);
    3535 
    36   WLabel* icon = new WLabel(sector_->getName(),sectorContainer);
     36  WLabel* icon = new WLabel(sectorControler_->getName(),sectorContainer);
    3737  icon->setStyleClass("sectionIcon");
    3838  icon->setHeight(100);
     
    4242
    4343  std::stringstream str;
    44   str << sector_->getRepetitionNumber();
     44  str << sectorControler_->getRepetitionNumber();
    4545  std::string result;
    4646  str >> result;
     
    4848  // Add repetition times
    4949  WText* t = new WText(" x"+result+" ",sectorContainer);
    50   if (sector_->getRepetitionNumber() > 1) {
    51     t->setToolTip("repeted "+result+" times");
     50  if (sectorControler_->getRepetitionNumber() > 1) {
     51    t->setToolTip("executed "+result+" times");
    5252  } else {
    53     t->setToolTip("repeted "+result+" time");
     53    t->setToolTip("executed "+result+" time");
    5454  }
    5555  new WBreak(sectorContainer);
    5656
    5757  // Add refected
    58   if (sector_->getReflected()) {
    59     WText* t = new WText(" reflected from "+sector_->getDuplicatedFrom()->getName(),sectorContainer);
    60   } else if (sector_->getDuplicatedFrom() != NULL) {
    61     WText* t = new WText(" duplicated from "+sector_->getDuplicatedFrom()->getName(),sectorContainer);
     58  if (sectorControler_->getReflected()) {
     59    WText* t = new WText(" reflected from "+sectorControler_->getDuplicatedFrom()->getName(),sectorContainer);
     60  } else if (sectorControler_->getDuplicatedFrom() != NULL) {
     61    WText* t = new WText(" duplicated from "+sectorControler_->getDuplicatedFrom()->getName(),sectorContainer);
    6262  }
    6363  new WBreak(sectorContainer);
     
    6868
    6969
    70 void GWt_sector::createWidgetBeamLine(PspaApplication* pspa,WContainerWidget* parent) {
     70void GWt_sector::createWidgetBeamLine(WContainerWidget* parent) {
    7171
    7272  // suppress old detailled view if present
    7373  parent->clear();
    7474 
     75  // add the detailled view
    7576  WContainerWidget* wdg = new WContainerWidget(parent);
    7677
     
    8990  //  menu->setLayout(hmenuLayout);
    9091 
    91   new WLabel(sector_->getName()+" ",menu);
     92  new WLabel(sectorControler_->getName()+" ",menu);
    9293 
    9394  WPushButton* actionParameters = new WPushButton("",menu);
     
    110111 
    111112  // Add beamLine for this sector
    112   beamLine_ = new GWt_ligneFaisceau(pspa);
    113   vContainerLayout->addWidget(beamLine_);
     113  UI_beamLine_ = new GWt_ligneFaisceau(getAccelerator()->getDataManager(),this);
     114  vContainerLayout->addWidget(UI_beamLine_);
     115 
     116  // add the software panel
     117  executeWidget_ = new GWt_softwarePanel(getAccelerator()->getDataManager(),this);
     118  vContainerLayout->addWidget(executeWidget_);
     119 
     120
    114121  wdg->setLayout(vContainerLayout);
    115122}
     
    117124
    118125void GWt_sector::displayWidgetBeamLine() {
    119   createWidgetBeamLine(parent_->getControler(),parent_->getAcceleratorDetailledView());
     126  createWidgetBeamLine(getAccelerator()->getAcceleratorDetailledView());
    120127}
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_sectorParameters.cc

    r436 r455  
    1515#define BAVARD 0
    1616
    17 GWt_sectorParameters::GWt_sectorParameters(dataManager* dt)
    18 {
    19   dt_ = dt;
    20 }
    21 
    2217void GWt_sectorParameters::setText(WText *st)
    2318{
     
    2520}
    2621
    27 void GWt_sectorParameters::execDialog()
     22void GWt_sectorParameters::execDialog_deprecated()
    2823{
    2924#if BAVARD > 0
     
    4136
    4237  gb_ = new WGroupBox("sectors",dialog_->contents());
    43   createSector();
     38//  createSector();
    4439
    4540  dialog_->contents()->addWidget(new WBreak());
     
    5853}
    5954
    60 void GWt_sectorParameters::createSector()
     55void GWt_sectorParameters::createSector_deprecated()
    6156{
    6257#if BAVARD > 0
     
    6863  hbox->setContentsMargins(0,0,0,0);
    6964
    70   vector<statements> v = dt_->getSectorParameters()->getSectors();
     65/*  vector<statements> v = getSectors();
    7166
    7267  hbox->addWidget(new WText("name&nbsp;:&nbsp;"));
     
    8984  hbox->addWidget(repeat_);
    9085
    91   WContainerWidget* bs= buttons(cnt_.size());
     86  WContainerWidget* bs= buttons_deprecated(cnt_.size());
    9287  hbox->addWidget(bs);
    9388
     
    115110 
    116111  w3->setLayout(grid);
    117   gb_->addWidget(w3);
    118 }
    119 
    120 WContainerWidget* GWt_sectorParameters::buttons(int num)
     112  gb_->addWidget(w3);
     113 */
     114}
     115
     116WContainerWidget* GWt_sectorParameters::buttons_deprecated(int num)
    121117{
    122118#if BAVARD > 0
     
    157153    setStatus("OK...");
    158154    setAttributes();
    159     dt_->getSectorParameters()->setSectors(sectors_);
     155//    setSectors(sectors_);
    160156  } else {
    161157    setStatus("Cancelled!");
     
    163159  }
    164160
    165 #if BAVARD > 0
     161/*#if BAVARD > 0
    166162  cout << "dialogDone():: sectors_.size()= " << sectors_.size() << endl;
    167163  for(int i = 0; i < sectors_.size(); i++) {
     
    169165  }
    170166#endif
    171 
     167*/
    172168  cnt_.clear();
    173169}
     
    182178  setStatus("add sector");
    183179  setAttributes();
    184   createSector();
     180//  createSector();
    185181}
    186182
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc

    r449 r455  
    1717#include "GWt_dialog.h"
    1818#include "GWt_console.h"
     19#include "GWt_sector.h"
    1920#include "GWt_globalParameters.h"
    2021#include "GWt_sectionToExecute.h"
     
    2324#define BAVARD 0
    2425
    25 GWt_softwarePanel::GWt_softwarePanel(dataManager* dataManager,PspaApplication* pspa,WContainerWidget* parent)
    26   : WContainerWidget(parent)
    27 {
    28   dtmanage_ = dataManager;
    29   pspa_ = pspa;
     26GWt_softwarePanel::GWt_softwarePanel(dataManager* dataManager,GWt_sector* sect)
     27  : WContainerWidget(),
     28dtmanage_(dataManager),
     29UIsector_(sect)
     30{
    3031 
    3132  // bouton execute
     
    5152void GWt_softwarePanel::addSectionToExecuteW()
    5253{     
     54  cout << "***********************************" << endl;
     55  cout << "*  A réécrire  *" << endl;
     56  cout << "***********************************" << endl;
     57  return;
    5358#if BAVARD > 0
    5459  cout << "***********************************" << endl;
     
    5661#endif
    5762
    58   abstractElement* premierElement;
    59   abstractElement* dernierElement;
     63  abstractElement* premierElement = NULL;
     64  abstractElement* dernierElement = NULL;
    6065
    6166  int premierIndex = 0;
     
    6368 
    6469  cout << "sections_.size() = " << sections_.size() << endl;
    65 
     70/*
    6671  // if there is no section
    6772  if(sections_.size() == 0) {
     
    8792 
    8893  dtmanage_->addSectionToExecute(premierElement,premierIndex,dernierElement,dernierIndex,nomDeLogiciel());
    89 
     94*/
    9095  std::string premierElementLabel = "";
    9196  std::string dernierElementLabel = "";
     
    109114  fillComboWithSoftwares(softCombo);
    110115
    111   GWt_sectionToExecute* newSection = new GWt_sectionToExecute(lineFromCombo,lineToCombo,softCombo,createAddDeletePushButtons(sections_.size()),this);
     116  GWt_sectionToExecute* newSection = new GWt_sectionToExecute(lineFromCombo,lineToCombo,softCombo,createAddDeletePushButtons(sections_.size()),this,UIsector_);
    112117
    113118  stringstream st;
     
    165170  // traitement de la premiere ligne
    166171  // on impose le depart du calcul au premier element
    167   string premier = dtmanage_->getLabelFromElementNumero(1);
     172  string premier = "";
     173  if (UIsector_->getSectorControler()) {
     174    if (UIsector_->getSectorControler()->getSectionsToExecute().size() > 0) {
     175      if (UIsector_->getSectorControler()->getSectionsToExecute()[0]->getElements().size() > 0) {
     176        premier = UIsector_->getSectorControler()->getSectionsToExecute()[0]->getElements()[0]->getLabel();
     177      }
     178    }
     179  }
     180 
     181  // FIXME :  A réécrire
     182  /*
    168183  if (sections_.size() > 0) {
    169184    sections_[0]->setFirstElementCurrentSelection(premier);
     
    235250    exec_go_->enable();
    236251  }
    237 
     252*/
    238253  return true;
    239254}
     
    241256bool GWt_softwarePanel::areDataCoherent()
    242257{
     258// FIXME
     259  cout << "***********************************" << endl;
     260  cout << "**  To be move in controler  **" << endl;
     261  cout << "***********************************" << endl;
     262  return true;
    243263#if BAVARD > 0
    244264  cout << "***********************************" << endl;
     
    247267
    248268  bool caMarche = true;
    249 
     269/*
    250270  // initialize dataManager
    251271  dtmanage_->initializeExecution();
     
    299319      sections_[a]->setWarnings(diagnosticWarnings);
    300320    }//a
    301    
     321    */
    302322  return caMarche;
    303323}
     
    319339
    320340      // delete from dataManager
    321       dtmanage_->clearSectionToExecute(sectionIndex);
     341      UIsector_->getSectorControler()->clearSectionToExecute(sectionIndex);
    322342
    323343      // delete from User Interface
     
    352372  //  exec_go_->setDisabled(true);
    353373  calculDialog.hide(); 
    354   pspa_->faireDessin();
     374  UIsector_->getAccelerator()->faireDessin();
    355375}
    356376
    357377void GWt_softwarePanel::fillComboWithElements(Wt::WComboBox* cBox)
    358378{
    359   if (cBox == NULL) return;
     379  // FIXME
     380  cout << "***********************************" << endl;
     381  cout << "**  To be move in controler  **" << endl;
     382  cout << "***********************************" << endl;
     383  return;
     384
     385/*  if (cBox == NULL) return;
    360386
    361387  // get the last item selected
     
    376402  }
    377403  cBox->refresh();
     404*/
    378405}
    379406
Note: See TracChangeset for help on using the changeset viewer.