Changeset 424 in PSPA


Ignore:
Timestamp:
Sep 30, 2013, 5:03:21 PM (11 years ago)
Author:
touze
Message:

sauvgarde de la configuration sur fichier format AML

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

Legend:

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

    r418 r424  
    1515/* #include "softwareTransport.h" */
    1616
     17#include "UAP/UAPNode.hpp"
     18
    1719using namespace std;
    1820
    1921class abstractElement
    2022{
    21     protected :
     23
     24 protected :
     25 
     26  int nbParam_;
     27  string* parametersString_;
     28  double phaseStepMax_;
    2229   
    23     int nbParam_;
    24     string* parametersString_;
    25     double phaseStepMax_;
     30  double defaultLength_;
     31  double defaultAperture_;
     32  string defaultSpecificName_;
     33 
     34  string specificName_;
     35  nomdElements elementName_;
     36 
     37  double lenghtElem_; // cm
     38  double aperture_; // cm
     39 
     40  double stepmaxcm_;
     41  //  bool curvedTrajectory_;
     42 
     43  void setDefaultValues();
     44  void setDefaults();
     45 
     46 public :
     47 
     48  abstractElement();
     49  abstractElement(string lab);
     50  virtual ~abstractElement();
     51 
     52  void setParameters(double ll,double aper);
     53  void setLabel(string lab);
     54  string getLabel() const;
     55  nomdElements getNomdElement() const;
     56 
     57  double getLenghtOfElement() const;
     58  int getNbParams() const;
     59 
     60  virtual void setPhaseStep(double);
     61  virtual double getInitialKineticEnergy() const;
    2662   
    27     double defaultLength_;
    28     double defaultAperture_;
    29     string defaultSpecificName_;
    30    
    31     string specificName_;
    32     nomdElements elementName_;
    33    
    34     double lenghtElem_; // cm
    35     double aperture_; // cm
    36    
    37     double stepmaxcm_;
    38     //  bool curvedTrajectory_;
    39    
    40     void setDefaultValues();
    41     void setDefaults();
    42    
    43     public :
    44    
    45     abstractElement();
    46     abstractElement(string lab);
    47     virtual ~abstractElement();
    48    
    49     void setParameters(double ll,double aper);
    50     void setLabel(string lab);
    51     string getLabel() const;
    52     nomdElements getNomdElement() const;
    53    
    54    
    55     double getLenghtOfElement() const;
    56     int getNbParams() const;
     63  virtual void setParametersString(string* param) = 0;
     64  virtual string* getParametersString() const = 0;
     65  virtual string FileOutputFlow() const = 0;
     66  virtual vector< pair<string, vector<string> > > parametersToSoftware () const =0;
     67  virtual void FileInput(ifstream& ifs) = 0;
     68  virtual string print() = 0;
     69 
     70  virtual void InputRep(UAPNode* root) = 0;
    5771
    58    
    59     virtual void setPhaseStep(double);
    60     virtual double getInitialKineticEnergy() const;
    61    
    62     virtual void setParametersString(string* param) = 0;
    63     virtual string* getParametersString() const = 0;
    64     virtual string FileOutputFlow() const = 0;
    65     virtual vector< pair<string, vector<string> > > parametersToSoftware () const =0;
    66     virtual void FileInput(ifstream& ifs) = 0;
    67     virtual string print() = 0;
     72  /* Return the abstractSofware associated with this element
     73   */
     74  inline abstractSoftware* getAbstractSoftware() {
     75    return abstractSoftware_;
     76  }
     77 
     78  /* Set the software to this element
     79     @param abstractSoftware a pointer to the abstract software
     80  */
     81  inline void setSoftware(abstractSoftware* prog) {
     82    abstractSoftware_ = prog;
     83  }
     84 
     85 private :
    6886
    69     /** Return the abstractSofware associated with this element
    70      */
    71     inline abstractSoftware* getAbstractSoftware() {
    72         return abstractSoftware_;
    73     }
    74 
    75    
    76    
    77     /**
    78      Set the software to this element
    79      @param abstractSoftware a pointer to the abstract software
    80      */
    81     inline  void setSoftware(abstractSoftware* prog) { abstractSoftware_ = prog; }
    82 
    83    
    84 
    85     private :
    86 
    87             abstractSoftware *abstractSoftware_;
    88    
     87  abstractSoftware *abstractSoftware_;
     88 
    8989};
    9090#endif
  • Interface_Web/trunk/pspaWT/sources/controler/include/dataManager.h

    r419 r424  
    4747  */
    4848  int getNumeroFromElementLabel(string);
    49     abstractElement*  getElementPointerFromNumero(int);
     49  abstractElement*  getElementPointerFromNumero(int);
    5050 
    5151  void initializeExecution();
     
    6161   @param filename
    6262   */
    63     void saveConfiguration(string folder, string filename);
     63  void saveConfiguration(string folder, string filename);
     64  bool restoreElements(string inputFileName);
     65 
     66  void writeToAMLFile(string fileName);
    6467   
    65     bool restoreElements(string inputFileName);
    66    
    67    
    68     /** return the jobList size
    69      */
    70     inline int getJobListSize() const {
    71         return jobList_.size();
     68  /** return the jobList size
     69   */
     70  inline int getJobListSize() const {
     71    return jobList_.size();
     72  }
     73 
     74  // si newBeam = true, on cree un nouveau diag
     75  // si newBeam = false, on utilise le dernier
     76  inline particleBeam* updateCurrentDiagnostic(bool newBeam) {
     77    if ( newBeam ) {
     78      diagnosticBeam_.push_back(particleBeam());
    7279    }
    73 
    74     // si newBeam = true, on cree un nouveau diag
    75     // si newBeam = false, on utilise le dernier
    76     inline particleBeam* updateCurrentDiagnostic(bool newBeam) {
    77       if ( newBeam ) {
    78         diagnosticBeam_.push_back(particleBeam());
    79       }
    80       indexElementToIndexDiag_.push_back(diagnosticBeam_.size() -1);
    81       return &diagnosticBeam_.back();
    82     }
    83 
    84     /** return a specific jobList index
    85      return NULL if the index does not exist
    86      */
    87 
    88     /* inline sectionToExecute* getJobListAt(int a) { */
     80    indexElementToIndexDiag_.push_back(diagnosticBeam_.size() -1);
     81    return &diagnosticBeam_.back();
     82  }
     83 
     84  /** return a specific jobList index
     85      return NULL if the index does not exist
     86  */
     87 
     88  /* inline sectionToExecute* getJobListAt(int a) { */
    8989    /*     if (a < 0) return NULL; */
    9090    /*     if (a >= getJobListSize()) return NULL; */
     
    9292    /* } */
    9393
    94 
    95 
     94 
     95 
    9696    /* inline const abstractSoftware* getSoftwareOfSection( int index) const { */
    9797    /*     if (index < 0) return NULL; */
     
    101101   
    102102    /** Clear a specific jobList */
    103     void clearSectionToExecute(int a);
     103  void clearSectionToExecute(int a);
    104104   
    105 private:
    106     globalParameters globParam_;
    107     particleBeam* currentBeam_;
     105 private:
     106
     107  globalParameters globParam_;
     108  particleBeam* currentBeam_;
    108109  PspaApplication* pspa_;
    109110  unsigned firstComputedElemNumero_;
    110111  unsigned lastComputedElemNumero_;
    111 
    112     vector<particleBeam> diagnosticBeam_;
    113     vector<unsigned> indexElementToIndexDiag_;
    114     // numeroElementToIndexDiag_[k] contient, pour l'element d'index k, l'indice ind tel que diagnosticBeam_[ind]
    115     // soit le faisceau resultat, en l'etat qu'il doit avoir apres l'element k
    116 
    117     vector<sectionToExecute*> jobList_;
    118    
    119     void removeFile(string nameOfFile);
    120     void clearSectionToExecute();
    121      abstractSoftware* createSoftwareConnexion(nomDeLogiciel logi);
    122 
    123   };
     112 
     113  vector<particleBeam> diagnosticBeam_;
     114  vector<unsigned> indexElementToIndexDiag_;
     115  // numeroElementToIndexDiag_[k] contient, pour l'element d'index k, l'indice ind tel que diagnosticBeam_[ind]
     116  // soit le faisceau resultat, en l'etat qu'il doit avoir apres l'element k
     117 
     118  vector<sectionToExecute*> jobList_;
     119 
     120  void removeFile(string nameOfFile);
     121  void clearSectionToExecute();
     122  abstractSoftware* createSoftwareConnexion(nomDeLogiciel logi);
     123};
    124124#endif
  • Interface_Web/trunk/pspaWT/sources/controler/include/elementBeam.h

    r418 r424  
    2121   
    2222    void setDefaultValues();
    23    
    2423    void setDefaults();
    2524   
    26     public :
     25 public :
    2726   
    2827    elementBeam();
    29    
    3028    ~elementBeam();
    3129   
    3230   
    3331    virtual void setParametersString(string* param);
    34    
    3532    virtual string* getParametersString() const;
    36 
    3733    virtual vector< pair<string, vector<string> > > parametersToSoftware () const;
    38 
    39    
    4034    //    virtual  string parmelaOutputFlow() const;
    41    
    42    
    4335    //    virtual string transportOutputFlow() const;
    4436   
    45    
    46     virtual string FileOutputFlow() const;
    47    
     37    virtual string FileOutputFlow() const;   
     38    virtual void FileInput(ifstream& ifs);
     39    virtual void InputRep(UAPNode* root);
    4840
    49 
    50     virtual void FileInput(ifstream& ifs);
    51 
    52     /** return a string with all parameters and value
    53      */
     41    /** return a string with all parameters and value */
    5442    string print();
    55    
    5643};
    5744#endif
  • Interface_Web/trunk/pspaWT/sources/controler/include/elementBend.h

    r418 r424  
    88//#include "PhysicalConstants.h"
    99
    10 
    1110using namespace std;
    1211
    1312// aimant dipolaire,  DANS LE PLAN XZ (le champ est dans la direction Y)
    1413
    15 
    1614class elementBend : public abstractElement
    1715{
    1816   
    19     double angleDeg_; // deg.
    20     double radius_; // m
    21     double beta1_; // deg.
    22     double beta2_; // deg.
    23     double momentum_; // MeV/c
     17  double angleDeg_; // deg.
     18  double radius_; // m
     19  double beta1_; // deg.
     20  double beta2_; // deg.
     21  double momentum_; // MeV/c
     22 
     23  double angleDegDef_; // deg.
     24  double radiusDef_; // m
     25  double beta1Def_; // deg.
     26  double beta2Def_; // deg.
     27  double momentumDef_; // MeV/c
    2428   
    25     double angleDegDef_; // deg.
    26     double radiusDef_; // m
    27     double beta1Def_; // deg.
    28     double beta2Def_; // deg.
    29     double momentumDef_; // MeV/c
     29  void setDefaultValues();
     30  void setDefaults();
     31   
     32 public:
    3033   
    31    
    32    
    33     void setDefaultValues();
    34     void setDefaults();
    35    
    36    
    37 public:
    38    
    39     elementBend();
    40    
    41     ~elementBend() {;}
    42    
    43     double getLenghtOfElement() const;
    44        
    45     virtual void setParametersString(string* param);
    46    
    47     virtual string* getParametersString() const;
    48    
    49     //    virtual  string parmelaOutputFlow() const;
    50    
    51     //   virtual string transportOutputFlow() const;
    52    
    53     virtual  string FileOutputFlow() const;
    54 
    55     virtual vector< pair<string, vector<string> > > parametersToSoftware () const;
    56    
    57     virtual void FileInput(ifstream& ifs);
    58    
    59     /** return a string with all parameters and value
    60      */
    61     string print();
    62    
     34  elementBend();
     35  ~elementBend() {;}
     36 
     37  double getLenghtOfElement() const;
     38  virtual void setParametersString(string* param);
     39  virtual string* getParametersString() const;
     40  virtual vector< pair<string, vector<string> > > parametersToSoftware () const;
     41  //   virtual  string parmelaOutputFlow() const;
     42  //   virtual string transportOutputFlow() const;
     43 
     44  virtual string FileOutputFlow() const;
     45  virtual void FileInput(ifstream& ifs);
     46  virtual void InputRep(UAPNode* root);
     47 
     48  /** return a string with all parameters and value */
     49  string print();
    6350};
    64 
    65 
    6651#endif
  • Interface_Web/trunk/pspaWT/sources/controler/include/elementCell.h

    r418 r424  
    1313class elementCell : public abstractElement
    1414{
     15  //  int nbParam_;
     16  // string* parametersString_;
     17  double initialPhaseDef_;
     18  double acceleratingFieldDef_; 
     19  string acceleratingShapeFileDef_;
     20  string focusingMagFileDef_;
     21  double offsetMagDef_;
     22  double scaleFactorDef_;
     23  double initialPhase_;
     24  double acceleratingField_;
     25  string acceleratingShapeFile_;
     26  string focusingMagFile_;
     27  double offsetMag_;
     28  double scaleFactor_;
     29 
     30  void setDefaultValues(); 
     31  void setDefaults();
    1532   
    16     //  int nbParam_;
    17     // string* parametersString_;
     33 public :
     34 
     35  elementCell();
     36  ~elementCell() { ;}
    1837   
    19    
    20     double initialPhaseDef_;
    21     double acceleratingFieldDef_;
    22    
    23     string acceleratingShapeFileDef_;
    24     string focusingMagFileDef_;
    25     double offsetMagDef_;
    26     double scaleFactorDef_;
    27    
    28     double initialPhase_;
    29     double acceleratingField_;
    30    
    31     string acceleratingShapeFile_;
    32     string focusingMagFile_;
    33     double offsetMag_;
    34     double scaleFactor_;
    35    
    36    
    37     void setDefaultValues();
    38    
    39     void setDefaults();
    40    
    41     public :
    42    
    43     elementCell();
    44    
    45    
    46     ~elementCell() { ;}
    47    
    48     virtual string* getParametersString() const;
    49    
    50     virtual void setParametersString(string* param);
    51    
    52     //   virtual  string parmelaOutputFlow() const;
    53    
    54     /* virtual string transportOutputFlow() const */
    55     /* { */
    56     /*     ostringstream sortie; */
    57     /*     cout << " CELL sortie transport non programmee " << endl; */
    58     /*     return sortie.str(); */
    59     /* } */
    60    
    61    
    62     virtual string FileOutputFlow() const;
    63 
    64     virtual vector< pair<string, vector<string> > > parametersToSoftware () const;
    65 
    66     virtual void FileInput(ifstream& ifs);
    67    
    68     /** return a string with all parameters and value
    69      */
    70     string print();
    71    
     38  virtual string* getParametersString() const; 
     39  virtual void setParametersString(string* param);
     40  virtual vector< pair<string, vector<string> > > parametersToSoftware () const;
     41  // virtual  string parmelaOutputFlow() const;
     42  // virtual string transportOutputFlow() const */
     43 
     44  virtual string FileOutputFlow() const;
     45  virtual void FileInput(ifstream& ifs);
     46  virtual void InputRep(UAPNode* root);
     47 
     48  /** return a string with all parameters and value */
     49  string print();
    7250};
    73 
    7451#endif
  • Interface_Web/trunk/pspaWT/sources/controler/include/elementDrift.h

    r418 r424  
    11#ifndef DRIFTDEFINITION_SEEN
    22#define DRIFTDEFINITION_SEEN
     3
    34#include <string>
    4 
    55#include "abstractElement.h"
    66
     
    99class elementDrift : public abstractElement
    1010{
     11 
     12  void setDefaultValues();
     13  void setDefaults();
    1114   
    12     void setDefaultValues();
     15 public:
    1316   
    14     void setDefaults();
     17  elementDrift();
     18  ~elementDrift() {;}
    1519   
    16 public:
    17    
    18     elementDrift();
    19    
    20    
    21     ~elementDrift() {;}
    22    
    23    
    24     virtual string* getParametersString() const;
    25    
    26     virtual void setParametersString(string* param);
    27    
    28     //    virtual  string parmelaOutputFlow() const;
    29    
    30     //    virtual string transportOutputFlow() const;
    31    
     20  virtual string* getParametersString() const;
     21  virtual void setParametersString(string* param);
     22  virtual vector< pair<string, vector<string> > > parametersToSoftware () const;
     23  //    virtual  string parmelaOutputFlow() const; 
     24  //    virtual string transportOutputFlow() const;
    3225   
    3326    virtual string FileOutputFlow() const;
     27    virtual void FileInput(ifstream& ifs);
     28    virtual void InputRep(UAPNode* root);
    3429
    35     virtual vector< pair<string, vector<string> > > parametersToSoftware () const;
    36 
    37     virtual void FileInput(ifstream& ifs);
    38    
    39     /** return a string with all parameters and value
    40      */
     30    /** return a string with all parameters and value */
    4131    string print();
    42    
    4332};
    44 
    45 
    46 
    4733#endif
  • Interface_Web/trunk/pspaWT/sources/controler/include/elementFit.h

    r418 r424  
    88using namespace std;
    99
    10 
    1110class elementFit : public abstractElement
    1211{
     12  // unites transport ( cm ; mrad)
     13  string variableName_;
     14  double variableValue_, tolerance_; 
     15  string variableNameDef_;
     16  double variableValueDef_, toleranceDef_;
     17 
     18  void setDefaultValues();
     19  void setDefaults(); 
    1320   
     21 public:
    1422   
    15     // unites transport ( cm ; mrad)
    16     string variableName_;
    17     double variableValue_, tolerance_;
     23  elementFit();
     24  ~elementFit() {;}
    1825   
    19     string variableNameDef_;
    20     double variableValueDef_, toleranceDef_;
     26  virtual void setParametersString(string* param);
     27  virtual string* getParametersString() const;
     28  virtual vector< pair<string, vector<string> > > parametersToSoftware () const;
     29  //  virtual  string parmelaOutputFlow() const;
     30  //  virtual string transportOutputFlow() const;
    2131   
    22     void setDefaultValues();
    23     void setDefaults();
    24    
    25    
    26 public:
    27    
    28     elementFit();
    29     ~elementFit() {;}
    30    
    31    
    32     virtual void setParametersString(string* param);
    33    
    34     virtual string* getParametersString() const;
    35    
    36     //    virtual  string parmelaOutputFlow() const;
    37    
    38     //  virtual string transportOutputFlow() const;
    39    
    40     virtual  string FileOutputFlow() const;
    41    
    42     virtual vector< pair<string, vector<string> > > parametersToSoftware () const;
     32  virtual  string FileOutputFlow() const;
     33  virtual void FileInput(ifstream& ifs);
     34  virtual void InputRep(UAPNode* root);
    4335
    44     virtual void FileInput(ifstream& ifs);
    45    
    46     /** return a string with all parameters and value
    47      */
    48     string print();
    49    
     36  /** return a string with all parameters and value */
     37  string print();
    5038};
    5139#endif
  • Interface_Web/trunk/pspaWT/sources/controler/include/elementRfgun.h

    r418 r424  
    1313{
    1414   
    15     //  int nbParam_;
    16     //  string* parametersString_;
     15  //  int nbParam_;
     16  //  string* parametersString_;
     17  double defaultPhaseStep_;
     18  int defaultNmacrop_;
     19  double defaultSigma_t_;
     20  double defaultSigma_r_;
     21  double defaultEmit_x_;
     22  double defaultEmit_y_;
     23  double defaultE_cin_;
     24  double defaultSigma_E_;
     25  double defaultTotalCharge_;
     26  double phaseStep_; // a recuperer dans les parametres globaux (methode setPhaseStep)
     27  int nmacrop_;
     28  double sigma_t_; // picoseconds
     29  double sigma_r_; // cm
     30  double emit_x_; // pi.mm.mrad
     31  double emit_y_; // pi.mm.mrad
     32  double E_cin_;   // MeV
     33  double sigma_E_; // MeV
     34  double totalCharge_;  // nC
     35 
     36  void setDefaultValues();
     37  void setDefaults();
    1738   
    18     double defaultPhaseStep_;
    19     int defaultNmacrop_;
    20     double defaultSigma_t_;
    21     double defaultSigma_r_;
    22     double defaultEmit_x_;
    23     double defaultEmit_y_;
    24     double defaultE_cin_;
    25     double defaultSigma_E_;
    26     double defaultTotalCharge_;
     39 public:
    2740   
    28     double phaseStep_; // a recuperer dans les parametres globaux (methode setPhaseStep)
    29     int nmacrop_;
    30     double sigma_t_; // picoseconds
    31     double sigma_r_; // cm
    32     double emit_x_; // pi.mm.mrad
    33     double emit_y_; // pi.mm.mrad
    34     double E_cin_;   // MeV
    35     double sigma_E_; // MeV
    36     double totalCharge_;  // nC
    37    
    38     void setDefaultValues();
    39    
    40     void setDefaults();
    41    
    42 public:
    43    
    44     elementRfgun();
    45    
    46     ~elementRfgun() {;}
    47    
    48     virtual void setPhaseStep(double ph) { phaseStep_ = ph;}
    49    
    50    
    51     virtual string* getParametersString() const;
    52    
    53     virtual void setParametersString(string* param);
    54    
    55     virtual inline double getInitialKineticEnergy() const {return E_cin_;}
    56    
    57     //    virtual string parmelaOutputFlow() const;
    58    
    59     /* virtual string transportOutputFlow() const */
    60     /* { */
    61     /*     ostringstream sortie; */
    62     /*     cout << " CELL sortie transport non programmee " << endl; */
    63     /*     return sortie.str(); */
    64     /* } */
    65    
    66     //   virtual string generatorOutputFlow() const;
     41  elementRfgun();
     42  ~elementRfgun() {;}
     43 
     44  virtual void setPhaseStep(double ph) { phaseStep_ = ph;}
     45  virtual string* getParametersString() const;
     46  virtual void setParametersString(string* param); 
     47  virtual inline double getInitialKineticEnergy() const {return E_cin_;}
     48  virtual vector< pair<string, vector<string> > > parametersToSoftware () const;
     49  // virtual string parmelaOutputFlow() const;
     50  // virtual string transportOutputFlow() const
     51  // virtual string generatorOutputFlow() const;
    6752
    68     virtual string FileOutputFlow() const;
    69         virtual vector< pair<string, vector<string> > > parametersToSoftware () const;
     53  virtual string FileOutputFlow() const;   
     54  virtual void FileInput(ifstream& ifs);
     55  virtual void InputRep(UAPNode* root);
    7056
    71     virtual void FileInput(ifstream& ifs);
    72    
    73     /** return a string with all parameters and value
    74      */
    75     string print();
    76    
    77    
     57  /** return a string with all parameters and value */
     58  string print();
    7859};
    79 
    80 
    8160#endif
  • Interface_Web/trunk/pspaWT/sources/controler/include/elementSnapshot.h

    r418 r424  
    1010{
    1111  int incr_;
    12 
    1312  string snapshotFile_;
    1413  void setDefaultValues();
    1514  void setDefaults();
    16    
     15 
    1716 public :
    18 
     17 
    1918  elementSnapshot() {;}
    2019  elementSnapshot(int);
     
    2322  virtual string* getParametersString() const;
    2423  virtual void setParametersString(string* param);
    25   //  virtual  string parmelaOutputFlow() const;
     24  virtual vector< pair<string, vector<string> > > parametersToSoftware () const;
     25  // virtual  string parmelaOutputFlow() const;
    2626  // virtual string transportOutputFlow() const; 
    2727   
    2828  virtual string FileOutputFlow() const; 
    29   virtual vector< pair<string, vector<string> > > parametersToSoftware () const;
    30 
    3129  virtual void FileInput(ifstream& ifs);
     30  virtual void InputRep(UAPNode* root);
    3231  string print(); 
    3332};
  • Interface_Web/trunk/pspaWT/sources/controler/include/elementSoleno.h

    r418 r424  
    66#include "abstractElement.h"
    77
    8 //#include "mathematicalTools.h"
    9 //#include "PhysicalConstants.h"
     8using namespace std;
    109
    11 using namespace std;
    1210class elementSoleno : public abstractElement
    1311{
     12 
     13  double B0_;   // en kilogauss
     14  double B0Def_;// en kilogauss 
     15  bool varyB0_;
     16  bool varyB0Def_;
     17 
     18  void setDefaultValues();
     19  void setDefaults();
     20 
     21 public :
    1422   
    15     double B0_;   // en kilogauss
    16     double B0Def_;   // en kilogauss
     23  elementSoleno();
     24  ~elementSoleno() {;}
     25 
     26  virtual void setParametersString(string* param); 
     27  virtual string* getParametersString() const;
     28  virtual vector< pair<string, vector<string> > > parametersToSoftware () const;
     29  // virtual  string parmelaOutputFlow() const;
     30  // virtual string transportOutputFlow() const;
    1731   
    18     bool varyB0_;
    19     bool varyB0Def_;
    20    
    21    
    22    
    23     void setDefaultValues();
    24     void setDefaults();
    25    
    26    
    27    
    28     public :
    29    
    30     elementSoleno();
    31    
    32     ~elementSoleno() {;}
    33    
    34     virtual void setParametersString(string* param);
    35    
    36     virtual string* getParametersString() const;
    37    
    38     //    virtual  string parmelaOutputFlow() const;
    39    
    40     //   virtual string transportOutputFlow() const;
    41    
    42     virtual  string FileOutputFlow() const;
    43    
    44   virtual vector< pair<string, vector<string> > > parametersToSoftware () const;
     32  virtual  string FileOutputFlow() const;
     33  virtual void FileInput(ifstream& ifs);
     34  virtual void InputRep(UAPNode* root);
    4535
    46     virtual void FileInput(ifstream& ifs);
    47    
    48     /** return a string with all parameters and value
    49      */
    50     string print();
    51    
     36  /** return a string with all parameters and value */
     37  string print();
    5238};
    5339#endif
  • Interface_Web/trunk/pspaWT/sources/controler/include/globalParameters.h

    r257 r424  
    55#include <string>
    66#include <fstream>
     7
     8#include "UAP/UAPNode.hpp"
    79
    810using namespace std;
     
    5658  string FileOutputFlow() const;
    5759  void FileInput(ifstream& ifs);
     60
     61  void InputRep(UAPNode* root);
    5862};
    5963#endif
  • Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc

    r419 r424  
    55#include "softwareTransport.h"
    66#include "GWt_pspaApplication.h"
    7 #include "GWt_console.h"Ò
     7#include "GWt_console.h"
    88#include "softwareGenerator.h"
    99#include "softwareTest.h"
     
    1212#include <stdio.h>
    1313#include <fstream>
     14
     15#include "UAP/UAPUtilities.hpp"
     16#include "AML/AMLReader.hpp"
    1417
    1518dataManager::dataManager(PspaApplication* pspa) :
     
    102105void dataManager::clearSectionToExecute(int a) {
    103106  cout << " dataManager::clearSectionToExecute efaacement section d'index : " << a << endl;
    104   if (a<0) return;
    105   if (a>= jobList_.size()) return;
    106 
    107   // lors de la creation de la section on a fait un 'new' d'un softwareXXXX
    108   // on fait ici le 'delete'
     107  if (a < 0) return;
     108  if (a >= (int)jobList_.size()) return;
     109
     110  // lors de la creation de la section on a fait un 'new' d'un
     111  // softwareXXXX : on fait ici le 'delete'
    109112
    110113  const abstractSoftware* soft = jobList_.at(a)->getSoftware();
    111     if ( soft != NULL ) delete soft;
     114  if ( soft != NULL ) delete soft;
    112115  jobList_.erase (jobList_.begin()+a);
    113116}
     
    151154  abstractSoftware* softw = NULL;
    152155  string workingDir = pspa_->getWorkingDir();
    153   int debut;
    154   int fin;
     156 
    155157  // on verifie la consecution des sections
    156158  int lastel = 0;
    157   for(unsigned k = 0; k < jobList_.size(); k++)
    158     {
    159       if ( jobList_[k]->getElementNumberInSection() != lastel +1 ) {
    160         consoleMessage("dataManager::executeAll ERROR : sections should be consecutive ");
    161         return false;
    162       } else {
    163         lastel = jobList_[k]->getLastElementNumberInSection();
    164       }
    165     }
    166 
    167   for(unsigned k = 0; k < jobList_.size(); k++)
    168     {
    169       cout << " dataManager::executeAll je m'apprete a executer : " << (jobList_[k]->getSoftware()->getName()) << endl;
     159  for(unsigned k = 0; k < jobList_.size(); k++) {
     160    if ( jobList_[k]->getElementNumberInSection() != lastel +1 ) {
     161      consoleMessage("dataManager::executeAll ERROR : sections should be consecutive ");
     162      return false;
     163    } else {
     164      lastel = jobList_[k]->getLastElementNumberInSection();
     165    }
     166  }
     167
     168  unsigned debut;
     169  unsigned fin;
     170  for(unsigned k = 0; k < jobList_.size(); k++) {
     171    cout << " dataManager::executeAll je m'apprete a executer : " << (jobList_[k]->getSoftware()->getName()) << endl;
    170172     
    171       debut = jobList_[k]->getElementNumberInSection();
    172       fin = jobList_[k]->getLastElementNumberInSection();
    173       softw = jobList_[k]->getSoftware();
    174      
    175       if (softw == NULL) {
     173    debut = jobList_[k]->getElementNumberInSection();
     174    fin = jobList_[k]->getLastElementNumberInSection();
     175    softw = jobList_[k]->getSoftware();
     176   
     177    if (softw == NULL) {
    176178        success = false;
    177179        consoleMessage("dataManager::executeAll : unknown software");
     
    196198      if ( !success ) break;
    197199     
    198      
    199200      if ( debut < firstComputedElemNumero_ ) firstComputedElemNumero_ = debut;
    200201      if ( fin > lastComputedElemNumero_ ) lastComputedElemNumero_ = fin;
     
    203204      cout << "dataManager::executeAll #diagnosticBeam= " << diagnosticBeam_.size() << endl;
    204205      cout << "dataManager::executeAll #getBeamLineSize()= " << getBeamLineSize() << endl;
    205       for (int j = debut; j <= fin; j++) {
     206      for (unsigned j = debut; j <= fin; j++) {
    206207        abstractElement* elPtr= getElementPointerFromNumero(j);
    207208        cout << "[" << j << "] " << elPtr->getNomdElement().getExpandedName() << endl;
    208209      }
    209     } //k
     210  } //k
    210211 
    211212  cout << " dataManager::executeAll premier element : " << firstComputedElemNumero_ << " dernier : " << lastComputedElemNumero_ << endl;
    212  
    213213  return success;
    214214}
     
    233233    outfile << globParam_.FileOutputFlow();
    234234    abstractElement* elPtr;
    235     for(unsigned k = 0; k < getBeamLineSize() ; k++)
     235    for(int k = 0; k < getBeamLineSize() ; k++)
    236236    {
    237         elPtr = pspa_->getBeamLine()->getAbstractElement(k);
    238         outfile << elPtr->FileOutputFlow();
     237      elPtr = pspa_->getBeamLine()->getAbstractElement(k);
     238      outfile << elPtr->FileOutputFlow();
    239239    }
    240240    outfile.close();
     241}
     242
     243// ecriture sur fichier AML
     244void dataManager::writeToAMLFile(string fileName)
     245{
     246  UAPNode* uap_root = NULL;
     247  uap_root = new UAPNode("UAP_root");
     248  UAPNode* rep = uap_root->addChild("AML_representation");
     249
     250  // root node in the hierarchy
     251  UAPNode* lab = rep->addChild("laboratory");
     252  lab->addAttribute("name","PSPA lab");
     253
     254  // general global parameters
     255  globParam_.InputRep(lab);
     256
     257  // accelerator or section of accelerator
     258  //UAPNode* acc = lab->addChild("machine");
     259  //acc->addAttribute("name",fileName);
     260
     261  // sequence of elements
     262  UAPNode* sect = lab->addChild("sector");
     263  sect->addAttribute("name","a_sect");
     264
     265  abstractElement* elPtr;
     266  for(int k = 0; k < getBeamLineSize() ; k++) {
     267    elPtr = pspa_->getBeamLine()->getAbstractElement(k);
     268    elPtr->InputRep(sect);
     269  }
     270 
     271  cout << "!Create the AML file ---------------------------" << endl;
     272  AMLReader reader;
     273  string aml_file = pspa_->getWorkingDir() + "/" + fileName + ".aml";
     274  reader.AMLRepToAMLFile (uap_root, aml_file);
    241275}
    242276
  • Interface_Web/trunk/pspaWT/sources/controler/src/elementBeam.cc

    r418 r424  
    33#include "mixedTools.h"
    44
    5 elementBeam::elementBeam() :  abstractElement() {
    6     setDefaultValues();
    7     setDefaults();
    8     elementName_ = nomdElements("beam");
    9     nbParam_ = elementName_.getElementNbParameters();
    10     parametersString_ = new string[nbParam_+1];
    11     //  transportOk_ = true;
    12     //    registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk);
     5elementBeam::elementBeam() :  abstractElement()
     6{
     7  setDefaultValues();
     8  setDefaults();
     9  elementName_ = nomdElements("beam");
     10  nbParam_ = elementName_.getElementNbParameters();
     11  parametersString_ = new string[nbParam_+1];
     12  // transportOk_ = true;
     13  // registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk);
    1314}
    1415
    1516elementBeam::~elementBeam() {;}
    1617
    17 void elementBeam::setDefaultValues() {
    18     defaultSpecificName_ = "beam";
    19     xDef_ = 0.0;
    20     xpDef_ = 0.0;
    21     yDef_ = 0.0;
    22     ypDef_ = 0.0;
    23     dlDef_ = 0.0;
    24     delDef_ = 0.0;
    25     p0Def_ = 0.0;
     18void elementBeam::setDefaultValues()
     19{
     20  defaultSpecificName_ = "beam";
     21  xDef_ = 0.0;
     22  xpDef_ = 0.0;
     23  yDef_ = 0.0;
     24  ypDef_ = 0.0;
     25  dlDef_ = 0.0;
     26  delDef_ = 0.0;
     27  p0Def_ = 0.0;
    2628}
    2729
    28 void elementBeam::setDefaults() {
    29     specificName_ = defaultSpecificName_;
    30     x_ = xDef_;
    31     xp_ = xpDef_;
    32     y_ = yDef_;
    33     yp_ = ypDef_;
    34     dl_ = dlDef_;
    35     del_ = delDef_;
    36     p0_ = p0Def_;
     30void elementBeam::setDefaults()
     31{
     32  specificName_ = defaultSpecificName_;
     33  x_ = xDef_;
     34  xp_ = xpDef_;
     35  y_ = yDef_;
     36  yp_ = ypDef_;
     37  dl_ = dlDef_;
     38  del_ = delDef_;
     39  p0_ = p0Def_;
    3740}
    3841
    39 
    40 string* elementBeam::getParametersString() const {
    41     int compteur = -1;
    42     parametersString_[++compteur] = mixedTools::intToString(nbParam_);
    43     parametersString_[++compteur] = specificName_;
    44     parametersString_[++compteur] = mixedTools::doubleToString(x_);
    45     parametersString_[++compteur] = mixedTools::doubleToString(xp_);
    46     parametersString_[++compteur] = mixedTools::doubleToString(y_);
    47     parametersString_[++compteur] = mixedTools::doubleToString(yp_);
    48     parametersString_[++compteur] = mixedTools::doubleToString(dl_);
    49     parametersString_[++compteur] = mixedTools::doubleToString(del_);
    50     parametersString_[++compteur] = mixedTools::doubleToString(p0_);
    51     if ( compteur != nbParam_ ) {
    52         cerr << " elementBeam::getParametersString() : ERROR nr pf parameters doesnt match " << endl;
    53         return NULL;
    54     }
    55     return parametersString_;
     42string* elementBeam::getParametersString() const
     43{
     44  int compteur = -1;
     45  parametersString_[++compteur] = mixedTools::intToString(nbParam_);
     46  parametersString_[++compteur] = specificName_;
     47  parametersString_[++compteur] = mixedTools::doubleToString(x_);
     48  parametersString_[++compteur] = mixedTools::doubleToString(xp_);
     49  parametersString_[++compteur] = mixedTools::doubleToString(y_);
     50  parametersString_[++compteur] = mixedTools::doubleToString(yp_);
     51  parametersString_[++compteur] = mixedTools::doubleToString(dl_);
     52  parametersString_[++compteur] = mixedTools::doubleToString(del_);
     53  parametersString_[++compteur] = mixedTools::doubleToString(p0_);
     54  if ( compteur != nbParam_ ) {
     55    cerr << " elementBeam::getParametersString() : ERROR nr pf parameters doesnt match " << endl;
     56    return NULL;
     57  }
     58  return parametersString_;
    5659}
    5760
    58 
    59 
    60 
    61 void elementBeam::setParametersString(string* param) {
    62     if ( param == NULL )
    63     {
    64         cerr << "  elementBeam::setParametersString parameters empty parameter set";
    65         return;
    66     }
    67     int compteur = -1;
    68     int nbparam = atoi(param[++compteur].c_str());
    69     if ( nbparam != nbParam_ )
    70     {
    71         cerr << "  elementBeam::setParametersString parameters do not match for a BEAM";
    72         return;
    73     }
     61void elementBeam::setParametersString(string* param)
     62{
     63  if ( param == NULL ) {
     64    cerr << "  elementBeam::setParametersString parameters empty parameter set";
     65    return;
     66  }
     67  int compteur = -1;
     68  int nbparam = atoi(param[++compteur].c_str());
     69  if ( nbparam != nbParam_ ) {
     70    cerr << "  elementBeam::setParametersString parameters do not match for a BEAM";
     71    return;
     72  }
    7473   
    75     specificName_ = param[++compteur];
    76     x_ = atof(param[++compteur].c_str());
    77     xp_ = atof(param[++compteur].c_str());
    78     y_ = atof(param[++compteur].c_str());
    79     yp_ = atof(param[++compteur].c_str());
    80     dl_ = atof(param[++compteur].c_str());
    81     del_ = atof(param[++compteur].c_str());
    82     p0_ = atof(param[++compteur].c_str());
     74  specificName_ = param[++compteur];
     75  x_ = atof(param[++compteur].c_str());
     76  xp_ = atof(param[++compteur].c_str());
     77  y_ = atof(param[++compteur].c_str());
     78  yp_ = atof(param[++compteur].c_str());
     79  dl_ = atof(param[++compteur].c_str());
     80  del_ = atof(param[++compteur].c_str());
     81  p0_ = atof(param[++compteur].c_str());
    8382}
    8483
     
    9897// }
    9998
    100 string elementBeam::FileOutputFlow() const {
    101     ostringstream sortie;
    102     // sortie << elementName_.getElementType() << endl;
    103     sortie << elementName_.getGenericLabel() << endl;
    104     sortie  << specificName_ << endl;
    105     sortie << x_ << "  " << xp_ << " " <<  y_  << " " <<  yp_  << endl;
    106     sortie << dl_ << "  " << del_ << " " <<  p0_  << endl;
    107     cout << " elementBeam::FileOutputFlow, p0 = " << p0_ << endl;
    108     return sortie.str();
     99string elementBeam::FileOutputFlow() const
     100{
     101  ostringstream sortie;
     102  // sortie << elementName_.getElementType() << endl;
     103  sortie << elementName_.getGenericLabel() << endl;
     104  sortie  << specificName_ << endl;
     105  sortie << x_ << "  " << xp_ << " " <<  y_  << " " <<  yp_  << endl;
     106  sortie << dl_ << "  " << del_ << " " <<  p0_  << endl;
     107  cout << " elementBeam::FileOutputFlow, p0 = " << p0_ << endl;
     108  return sortie.str();
    109109}
    110110
    111 vector< pair<string, vector<string> > > elementBeam::parametersToSoftware () const {
     111vector< pair<string, vector<string> > > elementBeam::parametersToSoftware () const
     112{
    112113  vector< pair<string, vector<string> > >  sortie;
    113114  sortie.push_back( pair<string, vector<string> >("labelsGenericSpecific",  vector<string>() ) );
     
    127128}
    128129
    129 
    130 void elementBeam::elementBeam::FileInput(ifstream& ifs) {
    131     ifs >> specificName_;
    132     ifs >> x_ >> xp_ >>  y_ >> yp_;
    133     ifs >> dl_ >> del_ >> p0_;
    134     cout << " elementBeam::FileFileInput, p0 = " << p0_ << endl;
    135     lenghtElem_ = getLenghtOfElement();
    136     cout << " elementBeam::FileInput calcule longueur = " << lenghtElem_ << endl;
     130void elementBeam::elementBeam::FileInput(ifstream& ifs)
     131{
     132  ifs >> specificName_;
     133  ifs >> x_ >> xp_ >>  y_ >> yp_;
     134  ifs >> dl_ >> del_ >> p0_;
     135  cout << " elementBeam::FileFileInput, p0 = " << p0_ << endl;
     136  lenghtElem_ = getLenghtOfElement();
     137  cout << " elementBeam::FileInput calcule longueur = " << lenghtElem_ << endl;
    137138}
    138139
     140string elementBeam::print()
     141{
     142  string txt = "";
     143  txt += specificName_;
     144  txt += "\n 1/2 horizontal beam extend rms (cm) : ";
     145  txt += mixedTools::doubleToString(x_);
     146  txt += "\n 1/2 horizontal beam divergence rms (mrad) : ";
     147  txt += mixedTools::doubleToString(xp_);
     148  txt += "\n1/2 vertical beam extend rms (cm) : ";
     149  txt += mixedTools::doubleToString(y_);
     150  txt += "\n1/2 horizontal beam divergence rms (mrad) : ";
     151  txt += mixedTools::doubleToString(yp_);
     152  txt += "\n1/2 longitudinal beam extend rms (cm) : ";
     153  txt += mixedTools::doubleToString(dl_);
     154  txt += "\n1/2 momentum spread rms (mrad) : ";
     155  txt += mixedTools::doubleToString(del_);
     156  txt += "\nmomentum of the central trajectory (GeV/c) : ";
     157  txt += mixedTools::doubleToString(p0_); 
     158  return txt;
     159}
    139160
    140 string elementBeam::print() {
    141     string txt = "";
    142     txt += specificName_;
    143     txt += "\n 1/2 horizontal beam extend rms (cm) : ";
    144     txt += mixedTools::doubleToString(x_);
    145     txt += "\n 1/2 horizontal beam divergence rms (mrad) : ";
    146     txt += mixedTools::doubleToString(xp_);
    147     txt += "\n1/2 vertical beam extend rms (cm) : ";
    148     txt += mixedTools::doubleToString(y_);
    149     txt += "\n1/2 horizontal beam divergence rms (mrad) : ";
    150     txt += mixedTools::doubleToString(yp_);
    151     txt += "\n1/2 longitudinal beam extend rms (cm) : ";
    152     txt += mixedTools::doubleToString(dl_);
    153     txt += "\n1/2 momentum spread rms (mrad) : ";
    154     txt += mixedTools::doubleToString(del_);
    155     txt += "\nmomentum of the central trajectory (GeV/c) : ";
    156     txt += mixedTools::doubleToString(p0_);
    157    
    158     return txt;
     161void elementBeam::InputRep(UAPNode* root)
     162{
     163  UAPNode* ele = root->addChild("element");
     164  ele->addAttribute("name",specificName_);
     165 
     166  UAPNode* node = ele->addChild("beam");
     167
     168  // je fixe le type de particule, plus tard on pourra donner le choix
     169  node->addChild("particle")->addAttribute("type","ELECTRON");
     170
     171  // matrice 6X6
     172  UAPNode* snode = node->addChild("sigma_matrix");
     173  string txt = "";
     174  txt = mixedTools::doubleToString(x_);
     175  snode->addChild("11")->addAttribute("design",txt);
     176  txt = mixedTools::doubleToString(xp_);
     177  snode->addChild("22")->addAttribute("design",txt);
     178  txt = mixedTools::doubleToString(y_);
     179  snode->addChild("33")->addAttribute("design",txt);
     180  txt = mixedTools::doubleToString(yp_);
     181  snode->addChild("44")->addAttribute("design",txt);
     182  txt = mixedTools::doubleToString(dl_);
     183  snode->addChild("55")->addAttribute("design",txt);
     184  txt = mixedTools::doubleToString(del_);
     185  snode->addChild("66")->addAttribute("design",txt);
     186
     187  // momentum of the central trajectory (GeV/c)
     188  txt = mixedTools::doubleToString(p0_);
     189  node->addChild("pc")->addAttribute("design",txt);
    159190}
  • Interface_Web/trunk/pspaWT/sources/controler/src/elementBend.cc

    r418 r424  
    1111  nbParam_ = elementName_.getElementNbParameters();
    1212  parametersString_ = new string[nbParam_+1];
    13     // registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk);
    14     // registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk);
    15 }
    16 
    17   void elementBend::setDefaultValues()
    18   {
    19     defaultSpecificName_ = "bend";
    20     angleDegDef_ = 0.0;
    21     radiusDef_ = 1.0;
    22     beta1Def_ = 0.0;
    23     beta2Def_ = 0.0;
    24     momentumDef_ = 0.0;
     13  // registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk);
     14  // registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk);
     15}
     16
     17void elementBend::setDefaultValues()
     18{
     19  defaultSpecificName_ = "bend";
     20  angleDegDef_ = 0.0;
     21  radiusDef_ = 1.0;
     22  beta1Def_ = 0.0;
     23  beta2Def_ = 0.0;
     24  momentumDef_ = 0.0;
     25}
     26
     27void elementBend::setDefaults()
     28{
     29  specificName_ = defaultSpecificName_;
     30  angleDeg_ = angleDegDef_;
     31  radius_ = radiusDef_;
     32  beta1_ = beta1Def_;
     33  beta2_ = beta2Def_;
     34  momentum_ = momentumDef_;
     35}
     36
     37string* elementBend::getParametersString() const
     38{
     39  int compteur = -1;
     40  parametersString_[++compteur] = mixedTools::intToString(nbParam_);
     41  parametersString_[++compteur] = specificName_;
     42  parametersString_[++compteur] = mixedTools::doubleToString( angleDeg_);
     43  parametersString_[++compteur] = mixedTools::doubleToString(radius_);
     44  parametersString_[++compteur] = mixedTools::doubleToString(momentum_);
     45  parametersString_[++compteur] = mixedTools::doubleToString(aperture_);
     46  parametersString_[++compteur] = mixedTools::doubleToString(beta1_);
     47  parametersString_[++compteur] = mixedTools::doubleToString(beta2_);
     48  if ( compteur != nbParam_ ) {
     49    cerr << " elementBend::getParametersString() : ERROR nr pf parameters dosnt match " << endl;
     50    return NULL;
    2551  }
    26 
    27   void elementBend::setDefaults()
    28   {
    29     specificName_ = defaultSpecificName_;
    30     angleDeg_ = angleDegDef_;
    31     radius_ = radiusDef_;
    32     beta1_ = beta1Def_;
    33     beta2_ = beta2Def_;
    34     momentum_ = momentumDef_;
     52  return parametersString_;
     53}
     54
     55double elementBend::getLenghtOfElement() const
     56{
     57  return 1.0e2 * radius_ * angleDeg_ * DEG_TO_RADIANS;
     58}
     59
     60
     61void  elementBend::setParametersString(string* param)
     62{
     63  if ( param == NULL ) {
     64    cerr << "  elementBend::setParametersString parameters empty parameter set";
     65    return;
    3566  }
    36 
    37  string* elementBend::getParametersString() const
    38  {
    39    int compteur = -1;
    40    parametersString_[++compteur] = mixedTools::intToString(nbParam_);
    41    parametersString_[++compteur] = specificName_;
    42    parametersString_[++compteur] = mixedTools::doubleToString( angleDeg_);
    43    parametersString_[++compteur] = mixedTools::doubleToString(radius_);
    44    parametersString_[++compteur] = mixedTools::doubleToString(momentum_);
    45    parametersString_[++compteur] = mixedTools::doubleToString(aperture_);
    46    parametersString_[++compteur] = mixedTools::doubleToString(beta1_);
    47    parametersString_[++compteur] = mixedTools::doubleToString(beta2_);
    48    if ( compteur != nbParam_ ) {
    49      cerr << " elementBend::getParametersString() : ERROR nr pf parameters dosnt match " << endl;
    50      return NULL;
    51    }
    52    return parametersString_;
    53  }
    54 
    55  double elementBend::getLenghtOfElement() const
    56 {
    57  return 1.0e2 * radius_ * angleDeg_ * DEG_TO_RADIANS;
    58 }
    59 
    60 
    61  void  elementBend::setParametersString(string* param)
    62  {
    63         if ( param == NULL )
    64         {
    65           cerr << "  elementBend::setParametersString parameters empty parameter set";
    66           return;
    67         }
    68 
    69    int compteur = -1;
    70    int nbparam = atoi(param[++compteur].c_str());
    71     if ( nbparam != nbParam_ )
    72         {
    73           cerr << "  elementBend::setParametersString parameters do not match for a BEND" << endl;
    74           return;
    75         }
    76     specificName_ = param[++compteur];
    77     angleDeg_ =  atof(param[++compteur].c_str());
    78     radius_ = atof(param[++compteur].c_str());
    79     momentum_ = atof(param[++compteur].c_str());
    80     aperture_  = atof(param[++compteur].c_str());
    81     beta1_ = atof(param[++compteur].c_str());
    82     beta2_ = atof(param[++compteur].c_str());
    83     // calcul de la longueur : rayon en m ; longueur en cm
    84     lenghtElem_ = getLenghtOfElement();
    85     cout << " elementBend::setParametersString calcule longueur = " << lenghtElem_ << endl;
    86  }
     67 
     68  int compteur = -1;
     69  int nbparam = atoi(param[++compteur].c_str());
     70  if ( nbparam != nbParam_ ) {
     71    cerr << "  elementBend::setParametersString parameters do not match for a BEND" << endl;
     72    return;
     73  }
     74  specificName_ = param[++compteur];
     75  angleDeg_ =  atof(param[++compteur].c_str());
     76  radius_ = atof(param[++compteur].c_str());
     77  momentum_ = atof(param[++compteur].c_str());
     78  aperture_  = atof(param[++compteur].c_str());
     79  beta1_ = atof(param[++compteur].c_str());
     80  beta2_ = atof(param[++compteur].c_str());
     81  // calcul de la longueur : rayon en m ; longueur en cm
     82  lenghtElem_ = getLenghtOfElement();
     83  cout << " elementBend::setParametersString calcule longueur = " << lenghtElem_ << endl;
     84}
    8785
    8886// string elementBend::parmelaOutputFlow() const
     
    109107
    110108string elementBend::FileOutputFlow() const
    111   {
    112     ostringstream sortie;
    113     //    sortie << elementName_.getElementType() << endl;
    114     sortie << elementName_.getGenericLabel() << endl;
    115     sortie  << specificName_ << endl;
    116     sortie << angleDeg_ << "  " << radius_ << " " <<  aperture_  << endl;
    117     sortie << beta1_ << "  " << beta2_ << " " << momentum_ << endl;
    118     return sortie.str();
    119   }
    120 
    121 vector< pair<string, vector<string> > > elementBend::parametersToSoftware () const{
     109{
     110  ostringstream sortie;
     111  //    sortie << elementName_.getElementType() << endl;
     112  sortie << elementName_.getGenericLabel() << endl;
     113  sortie  << specificName_ << endl;
     114  sortie << angleDeg_ << "  " << radius_ << " " <<  aperture_  << endl;
     115  sortie << beta1_ << "  " << beta2_ << " " << momentum_ << endl;
     116  return sortie.str();
     117}
     118
     119vector< pair<string, vector<string> > > elementBend::parametersToSoftware () const
     120{
    122121  vector< pair<string, vector<string> > >  sortie;
    123122  sortie.push_back( pair<string, vector<string> >("labelsGenericSpecific",  vector<string>() ) );
     
    148147}
    149148
    150 
    151 string elementBend::print() {
    152     string txt = "";
    153 
    154     txt += specificName_;
    155     txt += "\nangle (deg.) : ";
    156     txt += mixedTools::doubleToString(angleDeg_);
    157     txt += "\nradius (m) : ";
    158     txt += mixedTools::doubleToString(radius_);
    159     txt += "\nmomentum (MeV/c) : ";
    160     txt += mixedTools::doubleToString(momentum_);
    161     txt += "\nlength (cm) : ";
    162     txt += mixedTools::doubleToString(lenghtElem_);
    163     txt += "\naperture (cm) : ";
    164     txt += mixedTools::doubleToString(aperture_);
    165     txt += "\npole face rotations (deg.) entrance : ";
    166     txt += mixedTools::doubleToString(beta1_);
    167     txt += "\nexit : ";
    168     txt += mixedTools::doubleToString(beta2_);
    169    
    170     return txt;
    171 }
     149string elementBend::print()
     150{
     151  string txt = "";
     152  txt += specificName_;
     153  txt += "\nangle (deg.) : ";
     154  txt += mixedTools::doubleToString(angleDeg_);
     155  txt += "\nradius (m) : ";
     156  txt += mixedTools::doubleToString(radius_);
     157  txt += "\nmomentum (MeV/c) : ";
     158  txt += mixedTools::doubleToString(momentum_);
     159  txt += "\nlength (cm) : ";
     160  txt += mixedTools::doubleToString(lenghtElem_);
     161  txt += "\naperture (cm) : ";
     162  txt += mixedTools::doubleToString(aperture_);
     163  txt += "\npole face rotations (deg.) entrance : ";
     164  txt += mixedTools::doubleToString(beta1_);
     165  txt += "\nexit : ";
     166  txt += mixedTools::doubleToString(beta2_);
     167  return txt;
     168}
     169
     170void elementBend::InputRep(UAPNode* root)
     171{
     172  UAPNode* ele = root->addChild("element");
     173  ele->addAttribute("name",specificName_);
     174
     175  string txt = "";
     176  txt = mixedTools::doubleToString(lenghtElem_);
     177  ele->addChild("length")->addAttribute("design",txt);
     178
     179  // pour Parmela /aper : radius of aperture at exit (gap)
     180  UAPNode* node = ele->addChild("aperture");
     181  node->addAttribute("at","EXIT");
     182  node->addAttribute("shape","CIRCLE");
     183  txt = mixedTools::doubleToString(aperture_);
     184  node->addChild("xy_limit")->addAttribute("design",txt);
     185
     186  // ??? encore pour Parmela /wt : ref energy
     187  txt = mixedTools::doubleToString(momentum_);
     188  ele->addChild("momentum")->addAttribute("design",txt);
     189
     190  node = ele->addChild("bend");
     191
     192  // bending field g= 1/r = angle/length : on en déduit angle= g*length
     193  double g = 1.0/radius_;
     194  txt = mixedTools::doubleToString(g);
     195  node->addChild("g")->addAttribute("design",txt);
     196
     197  txt = mixedTools::doubleToString(beta1_);
     198  node->addChild("e1")->addAttribute("design",txt);
     199  txt = mixedTools::doubleToString(beta2_);
     200  node->addChild("e2")->addAttribute("design",txt); 
     201}
  • Interface_Web/trunk/pspaWT/sources/controler/src/elementCell.cc

    r418 r424  
    88
    99elementCell::elementCell()  : abstractElement()
    10     {
    11       setDefaultValues();
    12       setDefaults();
    13       elementName_ = nomdElements("cell");
    14       nbParam_ = elementName_.getElementNbParameters();
    15       parametersString_ = new string[nbParam_+1];
    16       //        registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk);
    17     }
     10{
     11  setDefaultValues();
     12  setDefaults();
     13  elementName_ = nomdElements("cell");
     14  nbParam_ = elementName_.getElementNbParameters();
     15  parametersString_ = new string[nbParam_+1];
     16  //        registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk);
     17}
    1818
    1919void elementCell::setDefaultValues()
    2020{
    21     defaultSpecificName_ = "cell";
    22     initialPhaseDef_ = 0.0;
    23     acceleratingFieldDef_ = 1.0;
    24     acceleratingShapeFileDef_ = "xxxxxxx";
    25     focusingMagFileDef_ = "xxxxxx";
    26     offsetMagDef_ = 0.0;
    27     scaleFactorDef_ = 1.0;
     21  defaultSpecificName_ = "cell";
     22  initialPhaseDef_ = 0.0;
     23  acceleratingFieldDef_ = 1.0;
     24  acceleratingShapeFileDef_ = "xxxxxxx";
     25  focusingMagFileDef_ = "xxxxxx";
     26  offsetMagDef_ = 0.0;
     27  scaleFactorDef_ = 1.0;
    2828}
    2929
    3030void elementCell::setDefaults()
    3131{
    32     specificName_ = defaultSpecificName_;
    33     initialPhase_ = initialPhaseDef_;
    34     acceleratingField_ = acceleratingFieldDef_;
    35     acceleratingShapeFile_ = acceleratingShapeFileDef_;
    36     focusingMagFile_ = focusingMagFileDef_;
    37     offsetMag_ = offsetMagDef_;
    38     scaleFactor_ = scaleFactorDef_;
    39   }
    40 
    41 
    42   string* elementCell::getParametersString() const
    43   {
    44    int compteur = -1;
    45     parametersString_[++compteur] = mixedTools::intToString(nbParam_);
     32  specificName_ = defaultSpecificName_;
     33  initialPhase_ = initialPhaseDef_;
     34  acceleratingField_ = acceleratingFieldDef_;
     35  acceleratingShapeFile_ = acceleratingShapeFileDef_;
     36  focusingMagFile_ = focusingMagFileDef_;
     37  offsetMag_ = offsetMagDef_;
     38  scaleFactor_ = scaleFactorDef_;
     39}
     40
     41string* elementCell::getParametersString() const
     42{
     43  int compteur = -1;
     44  parametersString_[++compteur] = mixedTools::intToString(nbParam_);
    4645  parametersString_[++compteur] = specificName_;
    47     parametersString_[++compteur] = mixedTools::doubleToString(lenghtElem_);
    48     parametersString_[++compteur] = mixedTools::doubleToString(aperture_);
    49     parametersString_[++compteur] = mixedTools::doubleToString(initialPhase_);
    50     parametersString_[++compteur] = mixedTools::doubleToString( phaseStepMax_);
    51     parametersString_[++compteur] = mixedTools::doubleToString(acceleratingField_);
    52     parametersString_[++compteur] = acceleratingShapeFile_;
    53     parametersString_[++compteur] = focusingMagFile_;
    54     parametersString_[++compteur] = mixedTools::doubleToString(offsetMag_);
    55     parametersString_[++compteur] = mixedTools::doubleToString(scaleFactor_);
    56    if ( compteur != nbParam_ ) {
    57      cerr << " elementCell::getParametersString() : ERROR nr pf parameters dosnt match " << endl;
    58      return NULL;
    59    }
    60     return parametersString_;
    61   }
    62 
     46  parametersString_[++compteur] = mixedTools::doubleToString(lenghtElem_);
     47  parametersString_[++compteur] = mixedTools::doubleToString(aperture_);
     48  parametersString_[++compteur] = mixedTools::doubleToString(initialPhase_);
     49  parametersString_[++compteur] = mixedTools::doubleToString( phaseStepMax_);
     50  parametersString_[++compteur] = mixedTools::doubleToString(acceleratingField_);
     51  parametersString_[++compteur] = acceleratingShapeFile_;
     52  parametersString_[++compteur] = focusingMagFile_;
     53  parametersString_[++compteur] = mixedTools::doubleToString(offsetMag_);
     54  parametersString_[++compteur] = mixedTools::doubleToString(scaleFactor_);
     55  if ( compteur != nbParam_ ) {
     56    cerr << " elementCell::getParametersString() : ERROR nr pf parameters dosnt match " << endl;
     57    return NULL;
     58  }
     59  return parametersString_;
     60}
    6361
    6462void elementCell::setParametersString(string* param)
    65   {
    66     if ( param == NULL )
    67       {
    68         cerr << "  elementCell::setParametersString parameters empty parameter set";
    69         return;
    70       }
    71    int compteur = -1;
    72     int nbparam = atoi(param[++compteur].c_str());
    73     if ( nbparam != nbParam_ )
    74       {
    75         cerr << "  elementCell::setParametersString parameters do not match for a CELL";
    76         return;
    77       }
    78 
    79     specificName_ = param[++compteur];
    80     lenghtElem_ = atof(param[++compteur].c_str());
    81     aperture_ = atof(param[++compteur].c_str());
    82     initialPhase_ = atof(param[++compteur].c_str());
    83     phaseStepMax_ = atof(param[++compteur].c_str());
    84     acceleratingField_ = atof(param[++compteur].c_str());
    85     acceleratingShapeFile_ = param[++compteur];
    86     focusingMagFile_ = param[++compteur];
    87     offsetMag_ = atof(param[++compteur].c_str());
    88     scaleFactor_ = atof(param[++compteur].c_str());
    89   }
     63{
     64  if ( param == NULL ) {
     65    cerr << "  elementCell::setParametersString parameters empty parameter set";
     66    return;
     67  }
     68  int compteur = -1;
     69  int nbparam = atoi(param[++compteur].c_str());
     70  if ( nbparam != nbParam_ ) {
     71    cerr << "  elementCell::setParametersString parameters do not match for a CELL";
     72    return;
     73  }
     74 
     75  specificName_ = param[++compteur];
     76  lenghtElem_ = atof(param[++compteur].c_str());
     77  aperture_ = atof(param[++compteur].c_str());
     78  initialPhase_ = atof(param[++compteur].c_str());
     79  phaseStepMax_ = atof(param[++compteur].c_str());
     80  acceleratingField_ = atof(param[++compteur].c_str());
     81  acceleratingShapeFile_ = param[++compteur];
     82  focusingMagFile_ = param[++compteur];
     83  offsetMag_ = atof(param[++compteur].c_str());
     84  scaleFactor_ = atof(param[++compteur].c_str());
     85}
    9086
    9187// string elementCell::parmelaOutputFlow() const
     
    107103
    108104string elementCell::FileOutputFlow() const
    109   {
    110     ostringstream sortie;
    111     //    sortie << elementName_.getElementType()  << endl;
    112     sortie << elementName_.getGenericLabel() << endl;
    113     sortie  << specificName_ << endl;
    114     sortie << lenghtElem_ << " " << aperture_ << endl;
    115     sortie << initialPhase_ << "  " << acceleratingField_ << endl;
    116     sortie << phaseStepMax_ << endl;
    117     sortie << acceleratingShapeFile_ << endl;
    118     sortie << focusingMagFile_ << endl;
    119     sortie << offsetMag_ << " " << scaleFactor_ << endl;
    120     return sortie.str();
    121   }
    122 
    123 
    124 vector< pair<string, vector<string> > > elementCell::parametersToSoftware () const {
     105{
     106  ostringstream sortie;
     107  //    sortie << elementName_.getElementType()  << endl;
     108  sortie << elementName_.getGenericLabel() << endl;
     109  sortie  << specificName_ << endl;
     110  sortie << lenghtElem_ << " " << aperture_ << endl;
     111  sortie << initialPhase_ << "  " << acceleratingField_ << endl;
     112  sortie << phaseStepMax_ << endl;
     113  sortie << acceleratingShapeFile_ << endl;
     114  sortie << focusingMagFile_ << endl;
     115  sortie << offsetMag_ << " " << scaleFactor_ << endl;
     116  return sortie.str();
     117}
     118
     119vector< pair<string, vector<string> > > elementCell::parametersToSoftware () const
     120{
    125121  vector< pair<string, vector<string> > >  sortie;
    126122  sortie.push_back( pair<string, vector<string> >("labelsGenericSpecific",  vector<string>() ) );
     
    140136  sortie.back().second.push_back(mixedTools::doubleToString( offsetMag_));
    141137  sortie.back().second.push_back(mixedTools::doubleToString( scaleFactor_));
    142 
     138 
    143139  return sortie;
    144140}
    145 
    146141
    147142void elementCell::FileInput(ifstream& ifs)
     
    156151}
    157152
    158 
    159 string elementCell::print() {
    160     string txt = "";
    161 
    162 
    163     txt += specificName_;
    164     txt += "\nlength (cm) : ";
    165     txt += mixedTools::doubleToString(lenghtElem_);
    166     txt += "\naperture (cm) : ";
    167     txt += mixedTools::doubleToString(aperture_);
    168     txt += "\ninitial phase (deg.) : ";
    169     txt += mixedTools::doubleToString(initialPhase_);
    170     txt += "\nmax phase step (deg.) : ";
    171     txt += mixedTools::doubleToString(phaseStepMax_);
    172     txt += "\nmax accelerating field (MV/m) : ";
    173     txt += mixedTools::doubleToString(acceleratingField_);
    174     txt += "\nname of file for field shape : ";
    175     txt += acceleratingShapeFile_;
    176     txt += "\nname of file for focusing mag. field : ";
    177     txt += focusingMagFile_;
    178     txt += "\n z-offset for mag. field : ";
    179     txt += mixedTools::doubleToString(offsetMag_);
    180     txt += "\n scaling factor for mag. field : ";
    181     txt += mixedTools::doubleToString(scaleFactor_);
    182     return txt;
    183 }
     153string elementCell::print()
     154{
     155  string txt = "";
     156  txt += specificName_;
     157  txt += "\nlength (cm) : ";
     158  txt += mixedTools::doubleToString(lenghtElem_);
     159  txt += "\naperture (cm) : ";
     160  txt += mixedTools::doubleToString(aperture_);
     161  txt += "\ninitial phase (deg.) : ";
     162  txt += mixedTools::doubleToString(initialPhase_);
     163  txt += "\nmax phase step (deg.) : ";
     164  txt += mixedTools::doubleToString(phaseStepMax_);
     165  txt += "\nmax accelerating field (MV/m) : ";
     166  txt += mixedTools::doubleToString(acceleratingField_);
     167  txt += "\nname of file for field shape : ";
     168  txt += acceleratingShapeFile_;
     169  txt += "\nname of file for focusing mag. field : ";
     170  txt += focusingMagFile_;
     171  txt += "\n z-offset for mag. field : ";
     172  txt += mixedTools::doubleToString(offsetMag_);
     173  txt += "\n scaling factor for mag. field : ";
     174  txt += mixedTools::doubleToString(scaleFactor_);
     175  return txt;
     176}
     177
     178void elementCell::InputRep(UAPNode* root)
     179{
     180  UAPNode* ele = root->addChild("element");
     181  ele->addAttribute("name",specificName_);
     182
     183  UAPNode* node = ele->addChild("methods");
     184  node->addChild("tracking")->addAttribute("value","parmela");
     185
     186  string txt = "";
     187  txt = mixedTools::doubleToString(lenghtElem_);
     188  ele->addChild("length")->addAttribute("design",txt);
     189
     190  node = ele->addChild("aperture");
     191  node->addAttribute("at","ENTRANCE");
     192  node->addAttribute("shape","CIRCLE");
     193  txt = mixedTools::doubleToString(aperture_);
     194  node->addChild("xy_limit")->addAttribute("design",txt);
     195
     196  node = ele->addChild("linac_cavity");
     197  txt = mixedTools::doubleToString(initialPhase_);
     198  node->addChild("phase0")->addAttribute("design",txt);
     199  txt = mixedTools::doubleToString(acceleratingField_);
     200  node->addChild("gradient")->addAttribute("design",txt);
     201
     202  // données propres à Parmela
     203  ele->addChild("comment")->addAttribute("text","data specific to Parmela");
     204  txt = mixedTools::doubleToString(phaseStepMax_);
     205  ele->addChild("phaseStepMax")->addAttribute("value",txt);
     206  txt = acceleratingShapeFile_;
     207  ele->addChild("acceleratingShapeField")->addAttribute("name",txt);
     208
     209  if ( focusingMagFile_ != "") {
     210    txt = focusingMagFile_;
     211    ele->addChild("focusingMagneticField")->addAttribute("name",txt);
     212    txt = mixedTools::doubleToString(offsetMag_);
     213    ele->addChild("z_offset")->addAttribute("value",txt);
     214    txt = mixedTools::doubleToString(scaleFactor_);
     215    ele->addChild("scaling_factor")->addAttribute("value",txt);
     216  }
     217}
  • Interface_Web/trunk/pspaWT/sources/controler/src/elementDrift.cc

    r418 r424  
    1313  nbParam_ = elementName_.getElementNbParameters();
    1414  parametersString_ = new string[nbParam_+1];
    15     // registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk);
    16     // registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk);
    17     // registerAcceptableSoftware(nomDeLogiciel::test, TBoolOk);
    18 
     15  // registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk);
     16  // registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk);
     17  // registerAcceptableSoftware(nomDeLogiciel::test, TBoolOk);
    1918}
    2019
    21   void elementDrift::setDefaultValues()
    22   {
    23     defaultSpecificName_ = "drift";
     20void elementDrift::setDefaultValues() {
     21  defaultSpecificName_ = "drift";
     22}
     23
     24void elementDrift::setDefaults() {
     25  specificName_ = defaultSpecificName_;
     26}
     27
     28string* elementDrift::getParametersString() const
     29{
     30  int compteur = -1;
     31  parametersString_[++compteur] = mixedTools::intToString(nbParam_);
     32  parametersString_[++compteur] = specificName_;
     33  parametersString_[++compteur] = mixedTools::doubleToString(lenghtElem_);
     34  parametersString_[++compteur] = mixedTools::doubleToString(aperture_);
     35  if ( compteur != nbParam_ ) {
     36    cerr << " elementDrift::getParametersString() : ERROR nr pf parameters dosnt match " << endl;
     37    return NULL;
    2438  }
    25   void elementDrift::setDefaults()
    26   {
    27     specificName_ = defaultSpecificName_;
     39  return parametersString_;
     40}
     41
     42void  elementDrift::setParametersString(string* param)
     43{
     44  if ( param == NULL ) {
     45    cerr << "  elementDrift::setParametersString parameters empty parameter set";
     46    return;
    2847  }
    29 
    30 
    31  string* elementDrift::getParametersString() const
    32  {
    33    int compteur = -1;
    34    parametersString_[++compteur] = mixedTools::intToString(nbParam_);
    35   parametersString_[++compteur] = specificName_;
    36    parametersString_[++compteur] = mixedTools::doubleToString(lenghtElem_);
    37    parametersString_[++compteur] = mixedTools::doubleToString(aperture_);
    38    if ( compteur != nbParam_ ) {
    39      cerr << " elementDrift::getParametersString() : ERROR nr pf parameters dosnt match " << endl;
    40      return NULL;
    41    }
    42    return parametersString_;
    43  }
    44 
    45  void  elementDrift::setParametersString(string* param)
    46  {
    47    if ( param == NULL )
    48      {
    49        cerr << "  elementDrift::setParametersString parameters empty parameter set";
    50        return;
    51      }
    52    int compteur = -1;
    53    int nbparam = atoi(param[++compteur].c_str());
    54    if ( nbparam != nbParam_ )
    55      {
    56        cerr << "  elementDrift::setParametersString parameters do not match for a DRIFT";
    57        return;
    58      }
     48  int compteur = -1;
     49  int nbparam = atoi(param[++compteur].c_str());
     50  if ( nbparam != nbParam_ ) {
     51    cerr << "  elementDrift::setParametersString parameters do not match for a DRIFT";
     52    return;
     53  }
    5954  specificName_ = param[++compteur];
    60    lenghtElem_ = atof(param[++compteur].c_str());
    61    aperture_  = atof(param[++compteur].c_str());
    62  }
     55  lenghtElem_ = atof(param[++compteur].c_str());
     56  aperture_  = atof(param[++compteur].c_str());
     57}
    6358
    6459// string elementDrift::parmelaOutputFlow() const
     
    6863//   return sortie.str();
    6964// }
    70 
    7165
    7266// string elementDrift::transportOutputFlow() const
     
    8983}
    9084
    91 vector< pair<string, vector<string> > > elementDrift::parametersToSoftware () const {
     85vector< pair<string, vector<string> > > elementDrift::parametersToSoftware () const
     86{
    9287  vector< pair<string, vector<string> > >  sortie;
    9388  sortie.push_back( pair<string, vector<string> >("labelsGenericSpecific",  vector<string>() ) );
     
    10095}
    10196
    102 
    103 
    10497void elementDrift::FileInput(ifstream& ifs)
    10598{
     
    108101}
    109102
     103string elementDrift::print()
     104{
     105  string txt = "";
     106  txt += specificName_;
     107  txt += "\nlength (cm) : ";
     108  txt += mixedTools::doubleToString(lenghtElem_);
     109  txt += "\naperture (cm) : ";
     110  txt += mixedTools::doubleToString(aperture_); 
     111  return txt;
     112}
    110113
    111 string elementDrift::print() {
    112     string txt = "";
     114void elementDrift::InputRep(UAPNode* root)
     115{
     116  UAPNode* ele = root->addChild("element");
     117  ele->addAttribute("name",specificName_);
    113118
    114     txt += specificName_;
    115     txt += "\nlength (cm) : ";
    116     txt += mixedTools::doubleToString(lenghtElem_);
    117     txt += "\naperture (cm) : ";
    118     txt += mixedTools::doubleToString(aperture_);
    119    
    120     return txt;
     119  string txt = "";
     120  txt = mixedTools::doubleToString(lenghtElem_);
     121  ele->addChild("length")->addAttribute("design",txt);
     122
     123  UAPNode* node = ele->addChild("aperture");
     124  node->addAttribute("at","EXIT");
     125  node->addAttribute("shape","CIRCLE");
     126  txt = mixedTools::doubleToString(aperture_);
     127  node->addChild("xy_limit")->addAttribute("design",txt);
    121128}
  • Interface_Web/trunk/pspaWT/sources/controler/src/elementFit.cc

    r418 r424  
    44elementFit::elementFit() : abstractElement()
    55{
    6     setDefaultValues();
    7     setDefaults();
    8     elementName_ = nomdElements("fit");
    9     nbParam_ = elementName_.getElementNbParameters();
    10     parametersString_ = new string[nbParam_+1];
    11     // transportOk_ = true;
    12     // parmelaIgnored_ = true;
    13     // registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk);
    14     // registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolIgnore);
     6  setDefaultValues();
     7  setDefaults();
     8  elementName_ = nomdElements("fit");
     9  nbParam_ = elementName_.getElementNbParameters();
     10  parametersString_ = new string[nbParam_+1];
     11  // transportOk_ = true;
     12  // parmelaIgnored_ = true;
     13  // registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk);
     14  // registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolIgnore);
    1515}
    1616
    1717void elementFit::setDefaultValues()
    1818{
    19     defaultSpecificName_ = "fit";
    20     variableNameDef_ = "";
    21     variableValueDef_ = 0.0;
    22     toleranceDef_ = 0.0;
     19  defaultSpecificName_ = "fit";
     20  variableNameDef_ = "";
     21  variableValueDef_ = 0.0;
     22  toleranceDef_ = 0.0;
    2323}
    2424
    2525void elementFit::setDefaults()
    2626{
    27     specificName_ = defaultSpecificName_;
    28     variableName_ = variableNameDef_;
    29     variableValue_ = variableValueDef_;
    30     tolerance_ = toleranceDef_;
     27  specificName_ = defaultSpecificName_;
     28  variableName_ = variableNameDef_;
     29  variableValue_ = variableValueDef_;
     30  tolerance_ = toleranceDef_;
    3131}
    32 
    33 
    3432
    3533string* elementFit::getParametersString() const
    3634{
    37     int compteur = -1;
    38     parametersString_[++compteur] = mixedTools::intToString(nbParam_);
    39     parametersString_[++compteur] = specificName_;
    40     parametersString_[++compteur] = variableName_;
    41     parametersString_[++compteur] = mixedTools::doubleToString(variableValue_ );
    42     parametersString_[++compteur] = mixedTools::doubleToString(tolerance_);
    43     if ( compteur != nbParam_ ) {
    44         cerr << " elementFit::getParametersString() : ERROR nr pf parameters dosnt match " << endl;
    45         return NULL;
    46     }
    47     return parametersString_;
     35  int compteur = -1;
     36  parametersString_[++compteur] = mixedTools::intToString(nbParam_);
     37  parametersString_[++compteur] = specificName_;
     38  parametersString_[++compteur] = variableName_;
     39  parametersString_[++compteur] = mixedTools::doubleToString(variableValue_ );
     40  parametersString_[++compteur] = mixedTools::doubleToString(tolerance_);
     41  if ( compteur != nbParam_ ) {
     42    cerr << " elementFit::getParametersString() : ERROR nr pf parameters dosnt match " << endl;
     43    return NULL;
     44  }
     45  return parametersString_;
    4846}
    4947
    5048void elementFit::setParametersString(string* param)
    5149{
    52     if ( param == NULL )
    53     {
    54         cerr << "  elementFit::setParametersString parameters empty parameter set";
    55         return;
    56     }
    57     int compteur = -1;
    58     int nbparam = atoi(param[++compteur].c_str());
    59     if ( nbparam != nbParam_ )
    60     {
    61         cerr << "  elementFit::setParametersString parameters do not match for a BEND" << endl;
    62         return;
    63     }
    64    
    65     specificName_ = param[++compteur];
    66     variableName_ = param[++compteur];
    67     variableValue_ = atof(param[++compteur].c_str());
    68     tolerance_ = atof(param[++compteur].c_str());
     50  if ( param == NULL ) {
     51    cerr << "  elementFit::setParametersString parameters empty parameter set";
     52    return;
     53  }
     54  int compteur = -1;
     55  int nbparam = atoi(param[++compteur].c_str());
     56  if ( nbparam != nbParam_ ) {
     57    cerr << "  elementFit::setParametersString parameters do not match for a BEND" << endl;
     58    return;
     59  }
     60 
     61  specificName_ = param[++compteur];
     62  variableName_ = param[++compteur];
     63  variableValue_ = atof(param[++compteur].c_str());
     64  tolerance_ = atof(param[++compteur].c_str());
    6965}
    70 
    7166
    7267// string elementFit::parmelaOutputFlow() const
     
    8883string elementFit::FileOutputFlow() const
    8984{
    90     ostringstream sortie;
    91     //    sortie << elementName_.getElementType() << endl;
    92     sortie << elementName_.getGenericLabel() << endl;
    93     sortie  << specificName_ << endl;
    94     sortie  <<    variableName_ << " " << variableValue_ << " " << tolerance_ << endl;
    95     return sortie.str();
     85  ostringstream sortie;
     86  //    sortie << elementName_.getElementType() << endl;
     87  sortie << elementName_.getGenericLabel() << endl;
     88  sortie  << specificName_ << endl;
     89  sortie  <<    variableName_ << " " << variableValue_ << " " << tolerance_ << endl;
     90  return sortie.str();
    9691}
    9792
    98 vector< pair<string, vector<string> > > elementFit::parametersToSoftware () const {
     93vector< pair<string, vector<string> > > elementFit::parametersToSoftware () const
     94{
    9995  vector< pair<string, vector<string> > >  sortie;
    10096  sortie.push_back( pair<string, vector<string> >("labelsGenericSpecific",  vector<string>() ) );
     
    108104}
    109105
    110 
    111106void elementFit::FileInput(ifstream& ifs)
    112107{
    113     ifs >> specificName_;
    114     ifs  >>  variableName_ >>  variableValue_   >> tolerance_;
     108  ifs >> specificName_;
     109  ifs  >>  variableName_ >>  variableValue_   >> tolerance_;
    115110}
    116111
     112string elementFit::print()
     113{
     114  string txt = "";
     115  txt += specificName_;
     116  return txt;
     117}
    117118
    118 string elementFit::print() {
    119     string txt = "";
    120  
    121     txt += specificName_;
    122     return txt;
     119void elementFit::InputRep(UAPNode* root)
     120{
     121  UAPNode* ele = root->addChild("element");
     122  ele->addAttribute("name",specificName_);
     123
     124  UAPNode* node = ele->addChild("fit");
     125  string txt = variableName_;
     126  node->addAttribute("attribute",txt);
     127  txt = mixedTools::doubleToString(variableValue_);
     128  node->addAttribute("design",txt);
     129  txt = mixedTools::doubleToString(tolerance_);
     130  node->addAttribute("err",txt);
    123131}
  • Interface_Web/trunk/pspaWT/sources/controler/src/elementRfgun.cc

    r418 r424  
    11#include "elementRfgun.h"
    2 
    32
    43#include "mathematicalTools.h"
     
    98elementRfgun::elementRfgun() : abstractElement()
    109{
    11     setDefaultValues();
    12     setDefaults();
    13     elementName_ = nomdElements("rfgun");
    14     nbParam_ = elementName_.getElementNbParameters();
    15     parametersString_ = new string[nbParam_+1];
    16     //      parmelaOk_ = true;
    17     // registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk);
    18     // registerAcceptableSoftware(nomDeLogiciel::generator, TBoolOk);
     10  setDefaultValues();
     11  setDefaults();
     12  elementName_ = nomdElements("rfgun");
     13  nbParam_ = elementName_.getElementNbParameters();
     14  parametersString_ = new string[nbParam_+1];
     15  //      parmelaOk_ = true;
     16  // registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk);
     17  // registerAcceptableSoftware(nomDeLogiciel::generator, TBoolOk);
    1918}
    2019
    2120void elementRfgun::setDefaultValues()
    2221{
    23     defaultSpecificName_ = "rfgun";
    24     defaultPhaseStep_ = 1.0;
    25     defaultNmacrop_ = 0;
    26     defaultSigma_t_ = 0.0;
    27     defaultSigma_r_ = 0.0;
    28     defaultEmit_x_ = 0.0;
    29     defaultEmit_y_ = 0.0;
    30     defaultE_cin_ = 0.0;
    31     defaultSigma_E_ = 0.0;
    32     //    defaultNb_true_particles_ = 1.0;
    33     defaultTotalCharge_ = 0.0;
     22  defaultSpecificName_ = "rfgun";
     23  defaultPhaseStep_ = 1.0;
     24  defaultNmacrop_ = 0;
     25  defaultSigma_t_ = 0.0;
     26  defaultSigma_r_ = 0.0;
     27  defaultEmit_x_ = 0.0;
     28  defaultEmit_y_ = 0.0;
     29  defaultE_cin_ = 0.0;
     30  defaultSigma_E_ = 0.0;
     31  //    defaultNb_true_particles_ = 1.0;
     32  defaultTotalCharge_ = 0.0;
     33}
     34
     35void elementRfgun::setDefaults()
     36{
     37  specificName_ = defaultSpecificName_;
     38  phaseStep_ = defaultPhaseStep_;
     39  nmacrop_ = defaultNmacrop_;
     40  sigma_t_ = defaultSigma_t_;
     41  sigma_r_ = defaultSigma_r_ ;
     42  emit_x_ = defaultEmit_x_;
     43  emit_y_ = defaultEmit_y_;
     44  E_cin_ = defaultE_cin_;
     45  sigma_E_ = defaultSigma_E_;
     46  //    nb_true_particles_ = defaultNb_true_particles_ ;
     47  totalCharge_ = defaultTotalCharge_;
     48}
     49
     50string* elementRfgun::getParametersString() const
     51{
     52  int compteur = -1;
     53  parametersString_[++compteur] = mixedTools::intToString(nbParam_);
     54  parametersString_[++compteur] = specificName_;
     55  parametersString_[++compteur] = mixedTools::intToString(nmacrop_);
     56  parametersString_[++compteur] = mixedTools::doubleToString(sigma_t_);
     57  parametersString_[++compteur] = mixedTools::doubleToString(sigma_r_);
     58  parametersString_[++compteur] = mixedTools::doubleToString(emit_x_);
     59  parametersString_[++compteur] = mixedTools::doubleToString(emit_y_);
     60  parametersString_[++compteur] = mixedTools::doubleToString(E_cin_);
     61  parametersString_[++compteur] = mixedTools::doubleToString(sigma_E_);
     62  parametersString_[++compteur] = mixedTools::doubleToString(totalCharge_);
     63  return parametersString_;
     64}
     65
     66void elementRfgun::setParametersString(string* param)
     67{
     68  if ( param == NULL ) {
     69    cerr << "  elementRfgun::setParametersString parameters empty parameter set";
     70    return;
    3471  }
    35 
    36   void elementRfgun::setDefaults()
    37   {
    38     specificName_ = defaultSpecificName_;
    39     phaseStep_ = defaultPhaseStep_;
    40     nmacrop_ = defaultNmacrop_;
    41     sigma_t_ = defaultSigma_t_;
    42     sigma_r_ = defaultSigma_r_ ;
    43     emit_x_ = defaultEmit_x_;
    44     emit_y_ = defaultEmit_y_;
    45     E_cin_ = defaultE_cin_;
    46     sigma_E_ = defaultSigma_E_;
    47     //    nb_true_particles_ = defaultNb_true_particles_ ;
    48     totalCharge_ = defaultTotalCharge_;
     72  int compteur = -1;
     73  int nbparam = atoi(param[++compteur].c_str());
     74  if ( nbparam != nbParam_ ) {
     75    cerr << "  elementRfgun::setParametersString parameters do not match for a DRIFT";
     76    return;
    4977  }
    50 
    51 
    52 string* elementRfgun::getParametersString() const
    53   {
    54    int compteur = -1;
    55     parametersString_[++compteur] = mixedTools::intToString(nbParam_);
    56   parametersString_[++compteur] = specificName_;
    57     parametersString_[++compteur] = mixedTools::intToString(nmacrop_);
    58     parametersString_[++compteur] = mixedTools::doubleToString(sigma_t_);
    59     parametersString_[++compteur] = mixedTools::doubleToString(sigma_r_);
    60     parametersString_[++compteur] = mixedTools::doubleToString(emit_x_);
    61     parametersString_[++compteur] = mixedTools::doubleToString(emit_y_);
    62     parametersString_[++compteur] = mixedTools::doubleToString(E_cin_);
    63     parametersString_[++compteur] = mixedTools::doubleToString(sigma_E_);
    64     parametersString_[++compteur] = mixedTools::doubleToString(totalCharge_);
    65     return parametersString_;
    66   }
    67 
    68   void elementRfgun::setParametersString(string* param)
    69   {
    70     if ( param == NULL )
    71       {
    72         cerr << "  elementRfgun::setParametersString parameters empty parameter set";
    73         return;
    74       }
    75    int compteur = -1;
    76     int nbparam = atoi(param[++compteur].c_str());
    77     if ( nbparam != nbParam_ )
    78       {
    79         cerr << "  elementRfgun::setParametersString parameters do not match for a DRIFT";
    80         return;
    81       }
    82 
    83     specificName_ = param[++compteur];
    84     nmacrop_ = atoi(param[++compteur].c_str());
    85     sigma_t_ = atof(param[++compteur].c_str());
    86     sigma_r_ = atof(param[++compteur].c_str());
    87     emit_x_ = atof(param[++compteur].c_str());
    88     emit_y_ = atof(param[++compteur].c_str());
    89     E_cin_ = atof(param[++compteur].c_str());
    90     sigma_E_ = atof(param[++compteur].c_str());
    91     totalCharge_ = atof(param[++compteur].c_str());
    92 
    93   }
     78 
     79  specificName_ = param[++compteur];
     80  nmacrop_ = atoi(param[++compteur].c_str());
     81  sigma_t_ = atof(param[++compteur].c_str());
     82  sigma_r_ = atof(param[++compteur].c_str());
     83  emit_x_ = atof(param[++compteur].c_str());
     84  emit_y_ = atof(param[++compteur].c_str());
     85  E_cin_ = atof(param[++compteur].c_str());
     86  sigma_E_ = atof(param[++compteur].c_str());
     87  totalCharge_ = atof(param[++compteur].c_str()); 
     88}
    9489
    9590// string elementRfgun::parmelaOutputFlow() const
     
    131126// }
    132127
    133 
    134 
    135128string elementRfgun::FileOutputFlow() const
    136   {
    137     ostringstream sortie;
    138     // on prend les troncatures tmax et rmax à 3 sigmas
    139     //    sortie << elementName_.getElementType() << endl;
    140     sortie << elementName_.getGenericLabel() << endl;
    141     sortie  << specificName_ << endl;
    142     sortie <<  nmacrop_ << "  " << sigma_t_ << "  " << sigma_r_ << endl;
    143     sortie << emit_x_ << "  " << emit_y_ << endl;
    144     sortie << E_cin_ << " " << sigma_E_ << endl;
    145     sortie << phaseStep_ << "  "  << totalCharge_ << endl;
    146     return sortie.str();
    147   }
    148 
    149 vector< pair<string, vector<string> > > elementRfgun::parametersToSoftware () const {
     129{
     130  ostringstream sortie;
     131  // on prend les troncatures tmax et rmax à 3 sigmas
     132  //    sortie << elementName_.getElementType() << endl;
     133  sortie << elementName_.getGenericLabel() << endl;
     134  sortie  << specificName_ << endl;
     135  sortie <<  nmacrop_ << "  " << sigma_t_ << "  " << sigma_r_ << endl;
     136  sortie << emit_x_ << "  " << emit_y_ << endl;
     137  sortie << E_cin_ << " " << sigma_E_ << endl;
     138  sortie << phaseStep_ << "  "  << totalCharge_ << endl;
     139  return sortie.str();
     140}
     141
     142vector< pair<string, vector<string> > > elementRfgun::parametersToSoftware () const
     143{
    150144  vector< pair<string, vector<string> > >  sortie;
    151145  sortie.push_back( pair<string, vector<string> >("labelsGenericSpecific",  vector<string>() ) );
     
    179173}
    180174
    181 
    182 string elementRfgun::print() {
    183     string txt = "";
    184    
    185     txt += specificName_;
    186     txt += "\ntotal charge : ";
    187     txt += mixedTools::doubleToString(totalCharge_);
    188     txt += "\nsigma_t (ps) : ";
    189     txt += mixedTools::doubleToString(sigma_t_);
    190     txt += "\nsigma_r (cm) : ";
    191     txt += mixedTools::doubleToString(sigma_r_);
    192     txt += "\nemittance x (pi.mm.mrad) : ";
    193     txt += mixedTools::doubleToString(emit_x_);
    194     txt += "\nemittance y (pi.mm.mrad) : ";
    195     txt += mixedTools::doubleToString(emit_y_);
    196     txt += "\ninitial kinetic energy (MeV) : ";
    197     txt += mixedTools::doubleToString(E_cin_);
    198     txt += "\nsigma_Ecin (MeV) : ";
    199     txt += mixedTools::doubleToString(sigma_E_);
    200     txt += "\ntrue number of part. in beam : ";
    201     txt += mixedTools::boolToString(nmacrop_);
    202    
    203     return txt;
    204 }
     175string elementRfgun::print()
     176{
     177  string txt = "";
     178  txt += specificName_;
     179  txt += "\ntotal charge : ";
     180  txt += mixedTools::doubleToString(totalCharge_);
     181  txt += "\nsigma_t (ps) : ";
     182  txt += mixedTools::doubleToString(sigma_t_);
     183  txt += "\nsigma_r (cm) : ";
     184  txt += mixedTools::doubleToString(sigma_r_);
     185  txt += "\nemittance x (pi.mm.mrad) : ";
     186  txt += mixedTools::doubleToString(emit_x_);
     187  txt += "\nemittance y (pi.mm.mrad) : ";
     188  txt += mixedTools::doubleToString(emit_y_);
     189  txt += "\ninitial kinetic energy (MeV) : ";
     190  txt += mixedTools::doubleToString(E_cin_);
     191  txt += "\nsigma_Ecin (MeV) : ";
     192  txt += mixedTools::doubleToString(sigma_E_);
     193  txt += "\ntrue number of part. in beam : ";
     194  txt += mixedTools::boolToString(nmacrop_);
     195  return txt;
     196}
     197
     198void elementRfgun::InputRep(UAPNode* root)
     199{
     200  UAPNode* ele = root->addChild("element");
     201  ele->addAttribute("name",specificName_);
     202
     203  UAPNode* node = ele->addChild("comment");
     204  node->addAttribute("type","RFgun");
     205  node->addAttribute("text","to simulate emission from a photocathode");
     206
     207  node = ele->addChild("beam");
     208  node->addChild("particle")->addAttribute("type","ELECTRON");
     209  string txt = "";
     210  txt = mixedTools::intToString(nmacrop_);
     211  node->addChild("n_particles")->addAttribute("design",txt);
     212  txt = mixedTools::doubleToString(sigma_t_);
     213  node->addChild("sig_t")->addAttribute("design",txt);
     214  txt = mixedTools::doubleToString(emit_x_);
     215  node->addChild("emittance_a")->addAttribute("design",txt);
     216  txt = mixedTools::doubleToString(emit_y_);
     217  node->addChild("emittance_b")->addAttribute("design",txt);
     218  txt = mixedTools::doubleToString(E_cin_);
     219  txt = mixedTools::doubleToString(E_cin_);
     220  node->addChild("total_energy")->addAttribute("design",txt);
     221  txt = mixedTools::doubleToString(sigma_E_);
     222  node->addChild("sig_e")->addAttribute("design",txt);
     223  txt = mixedTools::doubleToString(totalCharge_);
     224  node->addChild("particle_charge")->addAttribute("design",txt);
     225
     226  // gaussian radial profile
     227  txt = mixedTools::doubleToString(sigma_r_);
     228  ele->addChild("sigma_r")->addAttribute("value",txt);
     229  // integration step size (specific to Parmela)
     230  txt = mixedTools::doubleToString(phaseStep_);
     231  ele->addChild("phaseStep")->addAttribute("value",txt);
     232}
     233
  • Interface_Web/trunk/pspaWT/sources/controler/src/elementSnapshot.cc

    r418 r424  
    116116  return txt;
    117117}
     118
     119void elementSnapshot::InputRep(UAPNode* root)
     120{
     121  UAPNode* node= root->addChild("snapshot");
     122  node->addAttribute("name",specificName_);
     123}
  • Interface_Web/trunk/pspaWT/sources/controler/src/elementSoleno.cc

    r418 r424  
    55elementSoleno::elementSoleno() :  abstractElement()
    66{
    7     cout << " passage constructeur elementSoleno " << endl;
    8     setDefaultValues();
    9     setDefaults();
    10     elementName_ = nomdElements("soleno");
    11     nbParam_ = elementName_.getElementNbParameters();
    12     parametersString_ = new string[nbParam_+1];
    13     // registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk);
    14     // registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk);
     7  cout << " passage constructeur elementSoleno " << endl;
     8  setDefaultValues();
     9  setDefaults();
     10  elementName_ = nomdElements("soleno");
     11  nbParam_ = elementName_.getElementNbParameters();
     12  parametersString_ = new string[nbParam_+1];
     13  // registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk);
     14  // registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk);
    1515}
    1616
     17void elementSoleno::setDefaultValues()
     18{
     19  defaultSpecificName_ = "solnd";
     20  B0Def_ = 0.0;
     21  varyB0Def_ = false;
     22}
    1723
    18   void elementSoleno::setDefaultValues()
    19   {
    20     defaultSpecificName_ = "solnd";
    21     B0Def_ = 0.0;
    22     varyB0Def_ = false;
     24void elementSoleno::setDefaults()
     25{
     26  specificName_ = defaultSpecificName_;
     27  B0_ = B0Def_;
     28  varyB0_ = varyB0Def_;
     29}
     30
     31string* elementSoleno::getParametersString() const
     32{
     33  cout << " passage elementSoleno::getParametersString() B0_= " << B0_ << endl;
     34  int compteur = -1;
     35  parametersString_[++compteur] = mixedTools::intToString(nbParam_);
     36  parametersString_[++compteur] = specificName_;
     37  parametersString_[++compteur] = mixedTools::doubleToString(lenghtElem_);
     38  parametersString_[++compteur] = mixedTools::doubleToString(aperture_);
     39  parametersString_[++compteur] = mixedTools::doubleToString(B0_);
     40  parametersString_[++compteur] = mixedTools::intToString(varyB0_);
     41  if ( compteur != nbParam_ ) {
     42    cerr << " elementSoleno::getParametersString() : ERROR nr pf parameters dosnt match " << endl;
     43    return NULL;
    2344  }
    24 
    25   void elementSoleno::setDefaults()
    26   {
    27     specificName_ = defaultSpecificName_;
    28     B0_ = B0Def_;
    29     varyB0_ = varyB0Def_;
    30   }
    31 
    32 
    33  string* elementSoleno::getParametersString() const
    34  {
    35    cout << " passage elementSoleno::getParametersString() B0_= " << B0_ << endl;
    36    int compteur = -1;
    37    parametersString_[++compteur] = mixedTools::intToString(nbParam_);
    38    parametersString_[++compteur] = specificName_;
    39    parametersString_[++compteur] = mixedTools::doubleToString(lenghtElem_);
    40    parametersString_[++compteur] = mixedTools::doubleToString(aperture_);
    41    parametersString_[++compteur] = mixedTools::doubleToString(B0_);
    42    parametersString_[++compteur] = mixedTools::intToString(varyB0_);
    43    if ( compteur != nbParam_ ) {
    44      cerr << " elementSoleno::getParametersString() : ERROR nr pf parameters dosnt match " << endl;
    45      return NULL;
    46    }
    47    return parametersString_;
    48  }
    49 
     45  return parametersString_;
     46}
    5047
    5148 void  elementSoleno::setParametersString(string* param)
    5249 {
    53         if ( param == NULL )
    54         {
    55           cerr << "  elementSoleno::setParametersString parameters empty parameter set";
    56           return;
    57         }
     50   if ( param == NULL ) {
     51     cerr << "  elementSoleno::setParametersString parameters empty parameter set";
     52     return;
     53   }
    5854   int compteur = -1;
    5955   int nbparam = atoi(param[++compteur].c_str());
    60     if ( nbparam != nbParam_ )
    61         {
    62           cerr << "  elementSoleno::setParametersString parameters do not match for a SOLENOID";
    63           return;
    64         }
    65   specificName_ = param[++compteur];
    66     lenghtElem_ = atof(param[++compteur].c_str());
    67     aperture_  = atof(param[++compteur].c_str());
    68     B0_ = atof(param[++compteur].c_str());
    69     varyB0_ = atoi(param[++compteur].c_str());
     56   if ( nbparam != nbParam_ ) {
     57     cerr << "  elementSoleno::setParametersString parameters do not match for a SOLENOID";
     58     return;
     59   }
     60   specificName_ = param[++compteur];
     61   lenghtElem_ = atof(param[++compteur].c_str());
     62   aperture_  = atof(param[++compteur].c_str());
     63   B0_ = atof(param[++compteur].c_str());
     64   varyB0_ = atoi(param[++compteur].c_str());
    7065 }
    7166
     
    9085
    9186string elementSoleno::FileOutputFlow() const
    92   {
    93     ostringstream sortie;
    94     //    sortie << elementName_.getElementType() << endl;
    95     sortie << elementName_.getGenericLabel() << endl;
    96     sortie  << specificName_ << endl;
    97     sortie << lenghtElem_ << "  " << aperture_<< " "  << B0_ << " " << varyB0_ << endl;
    98     return sortie.str();
    99   }
     87{
     88  ostringstream sortie;
     89  //    sortie << elementName_.getElementType() << endl;
     90  sortie << elementName_.getGenericLabel() << endl;
     91  sortie  << specificName_ << endl;
     92  sortie << lenghtElem_ << "  " << aperture_<< " "  << B0_ << " " << varyB0_ << endl;
     93  return sortie.str();
     94}
    10095
    10196
     
    115110}
    116111
    117 
    118112void elementSoleno::FileInput(ifstream& ifs)
    119113{
     
    122116}
    123117
     118string elementSoleno::print()
     119{
     120  string txt = "";
     121  txt += specificName_;
     122  txt += "\nlength (cm) : ";
     123  txt += mixedTools::doubleToString(lenghtElem_);
     124  txt += "\naperture (cm) : ";
     125  txt += mixedTools::doubleToString(aperture_);
     126  txt += "\nfield (kG) : ";
     127  txt += mixedTools::doubleToString(B0_);
     128  txt += "\n : may vary ? ";
     129  txt += mixedTools::boolToString(varyB0_); 
     130  return txt;
     131}
    124132
    125 string elementSoleno::print() {
    126     string txt = "";
     133void elementSoleno::InputRep(UAPNode* root)
     134{
     135  UAPNode* ele = root->addChild("element");
     136  ele->addAttribute("name",specificName_);
    127137
    128     txt += specificName_;
    129     txt += "\nlength (cm) : ";
    130     txt += mixedTools::doubleToString(lenghtElem_);
    131     txt += "\naperture (cm) : ";
    132     txt += mixedTools::doubleToString(aperture_);
    133     txt += "\nfield (kG) : ";
    134     txt += mixedTools::doubleToString(B0_);
    135     txt += "\n : may vary ? ";
    136     txt += mixedTools::boolToString(varyB0_);
    137    
    138     return txt;
     138  string txt = "";
     139  txt = mixedTools::doubleToString(lenghtElem_);
     140  ele->addChild("length")->addAttribute("design",txt);
     141
     142  // pour Parmela /aper : radius of aperture at exit (gap)
     143  UAPNode* node = ele->addChild("aperture");
     144  node->addAttribute("at","EXIT");
     145  node->addAttribute("shape","CIRCLE");
     146  txt = mixedTools::doubleToString(aperture_);
     147  node->addChild("xy_limit")->addAttribute("design",txt);
     148
     149  node = ele->addChild("solenoid");
     150  txt = mixedTools::doubleToString(B0_);
     151  node->addChild("ksol")->addAttribute("design",txt);
     152
     153  // faire varier ou pas l'induction pour l'ajuster
     154  if ( varyB0_ ) {
     155    node->addChild("vary")->addAttribute("is_on","true");
     156  } else {
     157    node->addChild("vary")->addAttribute("is_on","false");
     158  }
    139159}
  • Interface_Web/trunk/pspaWT/sources/controler/src/globalParameters.cc

    r257 r424  
    5454  ifs >> frequency_ >> integrationStep_ >> nstepsMax_ >> nsc_;
    5555}
     56
     57void globalParameters::InputRep(UAPNode* root)
     58{
     59  UAPNode* node = root->addChild("global");
     60  string txt = "";
     61  txt = mixedTools::doubleToString(frequency_);
     62  node->addChild("ref_freq")->addAttribute("design",txt);
     63
     64  node->addChild("comment")->addAttribute("text","data specific to Parmela");
     65  txt = mixedTools::doubleToString(integrationStep_);
     66  node->addChild("integrationStep")->addAttribute("value",txt);
     67  txt = mixedTools::intToString(nstepsMax_);
     68  node->addChild("nSteps")->addAttribute("value",txt);
     69  txt = mixedTools::intToString(nsc_);
     70  node->addChild("nsc")->addAttribute("value",txt);
     71}
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc

    r418 r424  
    7676  useStyleSheet("htdocs/pspa.css");
    7777  dtmanage_ = new dataManager(this);
    78   //    dtmanage_->setWorkingDir(workingDir_);
     78  // dtmanage_->setWorkingDir(workingDir_);
    7979 
    8080  /*
     
    390390    GWt_globalParameters* bibi = static_cast<GWt_globalParameters*>(globalParam_);
    391391    bibi->updateGlobals();
     392
    392393    //  dtmanage_->saveConfiguration(nameOfCase_);
    393394    dtmanage_->saveConfiguration(sessionId(),nameOfCase_);
     395
     396    // en test: j'ajoute la sauvegarde sur .aml
     397    dtmanage_->writeToAMLFile(nameOfCase_);
    394398}
    395399
     
    934938
    935939#ifdef HAS_IMAGEMAGIC
     940
    936941  // no background
    937942  chart->setBackground(WBrush(Wt::NoBrush));
     
    951956*/
    952957 
     958
    953959  Wt::WPdfImage pdfImage("1000", "600");
    954960  {
     
    956962    chart->paint(p1);
    957963  }
     964
    958965  name = workingDir_ + "/chart-"+sessionId ()+".pdf";
    959966  std::ofstream f1(name.c_str(), std::ios::out | std::ios::binary);
Note: See TracChangeset for help on using the changeset viewer.