Changeset 418 in PSPA


Ignore:
Timestamp:
Jun 21, 2013, 10:16:56 AM (11 years ago)
Author:
lemeur
Message:

definition des compatibilites des elements dans les software

Location:
Interface_Web/trunk/pspaWT
Files:
43 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/trunk/pspaWT/History

    r417 r418  
    55     PSPA - Plateforme de simulation en physique des accélérateurs
    66     =========================================================
     721 juin 2013  : Guy Le Meur
     8- la désignation des éléments compatibles avec un logiciel est faite
     9  dans le fichier correspondant softwareXXXX.cc
     10- dans les fichiers elementXXX les références aux software sont
     11  supprimées. La communication avec les logiciels est assurée par une méthode
     12  parametersToSoftware() qui envoie tous les paramètres, parmi lesquelles
     13  chaque logiciel fera le tri et construira son fichier d'entrée.
     14- La définition des couleurs d'affichage des logiciels sur l'interface
     15  est effectuée dans la classe 'nomDeLogiciel' (en attendant mieux).
    716
    81710 juin 2013  : Guy Le Meur
  • Interface_Web/trunk/pspaWT/sources/controler/include/abstractElement.h

    r359 r418  
    77
    88#include "nomdElements.h"
    9 #include "nomDeLogiciel.h"
    10 #include "trivaluedBool.h"
     9//#include "nomDeLogiciel.h"
     10//#include "trivaluedBool.h"
    1111#include "abstractSoftware.h"
    12 #include "softwareGenerator.h"
    13 #include "softwareParmela.h"
    14 #include "softwareTest.h"
    15 #include "softwareTransport.h"
     12/* #include "softwareGenerator.h" */
     13/* #include "softwareParmela.h" */
     14/* #include "softwareTest.h" */
     15/* #include "softwareTransport.h" */
    1616
    1717using namespace std;
     
    2323    int nbParam_;
    2424    string* parametersString_;
    25     //  double phaseStep_; // a recuperer dans les parametres globaux (methode setPhaseStep)
    2625    double phaseStepMax_;
    2726   
    2827    double defaultLength_;
    2928    double defaultAperture_;
    30     string defaultLabel_;
     29    string defaultSpecificName_;
    3130   
    32     string label_;
     31    string specificName_;
    3332    nomdElements elementName_;
    3433   
     
    5150    void setLabel(string lab);
    5251    string getLabel() const;
    53     //  typedElement getName() const;
    5452    nomdElements getNomdElement() const;
    5553   
    56     /* string getElementImage() const; */
    57     /* string getElementName() const; */
    5854   
    5955    double getLenghtOfElement() const;
    6056    int getNbParams() const;
    6157
    62     trivaluedBool is_accepted_by_software(nomDeLogiciel soft);
    6358   
    6459    virtual void setPhaseStep(double);
     
    6762    virtual void setParametersString(string* param) = 0;
    6863    virtual string* getParametersString() const = 0;
    69     virtual string parmelaOutputFlow() const = 0;
    70     virtual string transportOutputFlow() const = 0;
    71     virtual string generatorOutputFlow() const;
    7264    virtual string FileOutputFlow() const = 0;
     65    virtual vector< pair<string, vector<string> > > parametersToSoftware () const =0;
    7366    virtual void FileInput(ifstream& ifs) = 0;
    7467    virtual string print() = 0;
     
    7972        return abstractSoftware_;
    8073    }
     74
     75   
    8176   
    82    
    83     void registerAcceptableSoftware(nomDeLogiciel abs,trivaluedBool b);
    8477    /**
    8578     Set the software to this element
    86      @param abstractName the name of the abstract software
    87      @return trivaluedBool if this software is/not allowed/ignore on this component
     79     @param abstractSoftware a pointer to the abstract software
    8880     */
    89     trivaluedBool setSoftware(nomDeLogiciel abstractName);
     81    inline  void setSoftware(abstractSoftware* prog) { abstractSoftware_ = prog; }
     82
    9083   
     84
    9185    private :
    92     abstractSoftware *abstractSoftware_;
    9386
    94     /**
    95      Acceptable software list for this element
    96      */
    97     std::vector <nomDeLogiciel> acceptableSoftware_;
    98 
    99     /**
    100      Ignore software list for this element
    101      */
    102     std::vector <nomDeLogiciel> ignoreSoftware_;
     87            abstractSoftware *abstractSoftware_;
     88   
    10389};
    10490#endif
  • Interface_Web/trunk/pspaWT/sources/controler/include/abstractSoftware.h

    r386 r418  
    55#include "particleBeam.h"
    66#include "nomDeLogiciel.h"
     7#include "nomdElements.h"
     8#include "trivaluedBool.h"
     9
    710#include <iostream>
    811#include <string>
     
    2225  string inputFileName_;
    2326  nomDeLogiciel nameOfSoftware_;
     27
     28    /**
     29     Accepted elements list for this software
     30     */
     31  std::vector <nomdElements::typedElement> acceptedElements_;
     32
     33    /**
     34     Ignore software list for this element
     35     */
     36  std::vector <nomdElements::typedElement> ignoredElements_;
     37
    2438  abstractSoftware();
    2539
     
    2741  bool initComputationLimits(unsigned int numeroDeb,unsigned int numeroFin);
    2842  bool ComputationLimitsOk() const;
     43
     44
     45  void registerElement(nomdElements::typedElement nomdel,trivaluedBool b);
     46
    2947 public :
    3048
     
    3250  ~abstractSoftware() {;}
    3351
    34   inline nomDeLogiciel getNomDeLogiciel() const {
    35     return nameOfSoftware_;
    36   }
     52  inline const nomDeLogiciel* getNomDeLogiciel() const {
     53    return &nameOfSoftware_;
     54}
     55
     56  trivaluedBool doAcceptElement(nomdElements::typedElement typdel);
     57
    3758
    3859  virtual bool createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir) = 0;
  • Interface_Web/trunk/pspaWT/sources/controler/include/dataManager.h

    r401 r418  
    3333  void addSectionToExecute(abstractElement* debut,int debutIndex, abstractElement* fin, int finIndex, abstractSoftware* prog);
    3434
    35     abstractElement* addElement(typedElement elemType);
     35  abstractElement* addElement(nomdElements::typedElement elemType);
    3636  void removeElement(string);
    3737 
  • Interface_Web/trunk/pspaWT/sources/controler/include/elementBeam.h

    r359 r418  
    3434   
    3535    virtual string* getParametersString() const;
     36
     37    virtual vector< pair<string, vector<string> > > parametersToSoftware () const;
     38
    3639   
    37     virtual  string parmelaOutputFlow() const;
     40    //    virtual  string parmelaOutputFlow() const;
    3841   
    3942   
    40     virtual string transportOutputFlow() const;
     43    //    virtual string transportOutputFlow() const;
    4144   
    4245   
    4346    virtual string FileOutputFlow() const;
    4447   
     48
     49
    4550    virtual void FileInput(ifstream& ifs);
    4651
  • Interface_Web/trunk/pspaWT/sources/controler/include/elementBend.h

    r359 r418  
    4747    virtual string* getParametersString() const;
    4848   
    49     virtual  string parmelaOutputFlow() const;
     49    //    virtual  string parmelaOutputFlow() const;
    5050   
    51     virtual string transportOutputFlow() const;
     51    //   virtual string transportOutputFlow() const;
    5252   
    5353    virtual  string FileOutputFlow() const;
     54
     55    virtual vector< pair<string, vector<string> > > parametersToSoftware () const;
    5456   
    5557    virtual void FileInput(ifstream& ifs);
  • Interface_Web/trunk/pspaWT/sources/controler/include/elementCell.h

    r359 r418  
    5050    virtual void setParametersString(string* param);
    5151   
    52     virtual  string parmelaOutputFlow() const;
     52    //   virtual  string parmelaOutputFlow() const;
    5353   
    54     virtual string transportOutputFlow() const
    55     {
    56         ostringstream sortie;
    57         cout << " CELL sortie transport non programmee " << endl;
    58         return sortie.str();
    59     }
     54    /* virtual string transportOutputFlow() const */
     55    /* { */
     56    /*     ostringstream sortie; */
     57    /*     cout << " CELL sortie transport non programmee " << endl; */
     58    /*     return sortie.str(); */
     59    /* } */
    6060   
    6161   
    6262    virtual string FileOutputFlow() const;
    63    
     63
     64    virtual vector< pair<string, vector<string> > > parametersToSoftware () const;
     65
    6466    virtual void FileInput(ifstream& ifs);
    6567   
  • Interface_Web/trunk/pspaWT/sources/controler/include/elementDrift.h

    r359 r418  
    2626    virtual void setParametersString(string* param);
    2727   
    28     virtual  string parmelaOutputFlow() const;
     28    //    virtual  string parmelaOutputFlow() const;
    2929   
    30     virtual string transportOutputFlow() const;
     30    //    virtual string transportOutputFlow() const;
    3131   
    3232   
    3333    virtual string FileOutputFlow() const;
    34    
     34
     35    virtual vector< pair<string, vector<string> > > parametersToSoftware () const;
     36
    3537    virtual void FileInput(ifstream& ifs);
    3638   
  • Interface_Web/trunk/pspaWT/sources/controler/include/elementFit.h

    r359 r418  
    3434    virtual string* getParametersString() const;
    3535   
    36     virtual  string parmelaOutputFlow() const;
     36    //    virtual  string parmelaOutputFlow() const;
    3737   
    38     virtual string transportOutputFlow() const;
     38    //  virtual string transportOutputFlow() const;
    3939   
    4040    virtual  string FileOutputFlow() const;
    4141   
     42    virtual vector< pair<string, vector<string> > > parametersToSoftware () const;
     43
    4244    virtual void FileInput(ifstream& ifs);
    4345   
  • Interface_Web/trunk/pspaWT/sources/controler/include/elementRfgun.h

    r359 r418  
    5555    virtual inline double getInitialKineticEnergy() const {return E_cin_;}
    5656   
    57     virtual string parmelaOutputFlow() const;
     57    //    virtual string parmelaOutputFlow() const;
    5858   
    59     virtual string transportOutputFlow() const
    60     {
    61         ostringstream sortie;
    62         cout << " CELL sortie transport non programmee " << endl;
    63         return sortie.str();
    64     }
     59    /* virtual string transportOutputFlow() const */
     60    /* { */
     61    /*     ostringstream sortie; */
     62    /*     cout << " CELL sortie transport non programmee " << endl; */
     63    /*     return sortie.str(); */
     64    /* } */
    6565   
    66     virtual string generatorOutputFlow() const;
     66    //   virtual string generatorOutputFlow() const;
    6767
    6868    virtual string FileOutputFlow() const;
    69    
     69        virtual vector< pair<string, vector<string> > > parametersToSoftware () const;
     70
    7071    virtual void FileInput(ifstream& ifs);
    7172   
  • Interface_Web/trunk/pspaWT/sources/controler/include/elementSnapshot.h

    r379 r418  
    2323  virtual string* getParametersString() const;
    2424  virtual void setParametersString(string* param);
    25   virtual  string parmelaOutputFlow() const;
    26   virtual string transportOutputFlow() const; 
     25  //  virtual  string parmelaOutputFlow() const;
     26  // virtual string transportOutputFlow() const; 
    2727   
    2828  virtual string FileOutputFlow() const; 
     29  virtual vector< pair<string, vector<string> > > parametersToSoftware () const;
     30
    2931  virtual void FileInput(ifstream& ifs);
    3032  string print(); 
  • Interface_Web/trunk/pspaWT/sources/controler/include/elementSoleno.h

    r359 r418  
    3636    virtual string* getParametersString() const;
    3737   
    38     virtual  string parmelaOutputFlow() const;
     38    //    virtual  string parmelaOutputFlow() const;
    3939   
    40     virtual string transportOutputFlow() const;
     40    //   virtual string transportOutputFlow() const;
    4141   
    4242    virtual  string FileOutputFlow() const;
    4343   
     44  virtual vector< pair<string, vector<string> > > parametersToSoftware () const;
     45
    4446    virtual void FileInput(ifstream& ifs);
    4547   
  • Interface_Web/trunk/pspaWT/sources/controler/include/nomDeLogiciel.h

    r401 r418  
    1616  enum Logiciel
    1717  {
    18     parmela, transport, generator, test, unknownSoftware
     18    parmela, transport, generator, useraction, test, unknownSoftware
    1919  };
    2020
     
    2828  static Logiciel fromString( std::string s);
    2929  static std::string toString( Logiciel lg); 
    30   //  static Logiciel fromValue( int v); 
    31   //  static int toValue( Logiciel lg);
     30  std::string getWtColor( nomDeLogiciel::Logiciel lg) const;
    3231 
    3332 public :
     
    4039 
    4140  inline std::string getString() const {return progString_;}
    42  
     41
     42  inline nomDeLogiciel::Logiciel getLogiciel() const { return program_; }
     43
     44    /** Color of the background of the sofware
     45     Should be a valid Css name as FFEEDD
     46     */
     47  inline std::string  getColor() const {return getWtColor(program_);}
    4348  // operators
    4449 
  • Interface_Web/trunk/pspaWT/sources/controler/include/nomdElements.h

    r342 r418  
    44using namespace std;
    55
    6 enum typedElement {beam, RFgun, drift, cell, bend, soleno, fit, snapshot, inconnu};
     6// enum typedElement {beam, RFgun, drift, cell, bend, soleno, fit, snapshot, inconnu};
    77
    88
     
    1010class nomdElements
    1111{
     12
     13 public :
     14
     15enum typedElement {beam, RFgun, drift, cell, bend, soleno, fit, snapshot, inconnu};
     16
     17 private :
     18
    1219  typedElement e_;  // type entier (enum)
    13   std::string eName_;  // nom de l'element
    14   std::string eLabel_; // label affiche sous l'icone
     20  std::string expandedName_;  // nom generique de l'element
     21  std::string genericLabel_;
    1522  unsigned nbParam_;   // nombre de parametres a saisir
    1623
    1724  static   typedElement fromString(std::string s);
    18   static   typedElement fromLabel(std::string s);
    19   static   std::string toName(typedElement eType);
    20   static   std::string toLabel(typedElement eType);
     25  static   typedElement fromGenericLabel(std::string s);
     26  static   std::string toExpandedName(typedElement eType);
     27  static   std::string toGenericLabel(typedElement eType);
    2128  static   unsigned toNbParam(typedElement eType);
    2229
     
    3542
    3643  typedElement getElementType() const;
    37   std::string getElementName() const;
    38   std::string getElementLabel() const;
     44  std::string getExpandedName() const;
     45  std::string getGenericLabel() const;
    3946  unsigned getElementNbParameters() const;
    4047
  • Interface_Web/trunk/pspaWT/sources/controler/include/softwareGenerator.h

    r386 r418  
    1313
    1414 bool beamFromGenerator(string beamFileName, string workingDir, vector<double>& centroid, bareParticle& refPart,vector<bareParticle>& particles, vector<bareParticle>& passiveParticles );
     15
     16
     17 string elementsData(const vector< pair<string, vector<string> > >& donnees) const;
     18 string rfgunData(const vector< pair<string, vector<string> > >& donnees) const;
     19
    1520
    1621 public :
  • Interface_Web/trunk/pspaWT/sources/controler/include/softwareParmela.h

    r417 r418  
    2222  bool beamToParmela(string workingDir, particleBeam* partic );
    2323  void setRelativeParmelaElementIndices();
     24
     25
     26  string elementsData(const vector< pair<string, vector<string> > >& donnees) const ;
     27
     28  string rfgunData(const vector< pair<string, vector<string> > >& donnees) const;
     29  string cellData(const vector< pair<string, vector<string> > >& donnees) const;
     30  string driftData(const vector< pair<string, vector<string> > >& donnees) const;
     31  string solenoData(const vector< pair<string, vector<string> > >& donnees) const;
     32  string bendData(const vector< pair<string, vector<string> > >& donnees) const;
     33
     34
    2435 public :
    2536    softwareParmela();
  • Interface_Web/trunk/pspaWT/sources/controler/include/softwareTransport.h

    r386 r418  
    1010
    1111  bool  moments2FromTransport(string workingDir, string elLab, const nomdElements elem, beam2Moments& moments) const;
     12
     13  string elementsData(const vector< pair<string, vector<string> > >& donnees) const;
     14  string beamData(const vector< pair<string, vector<string> > >& donnees) const;
     15  string driftData(const vector< pair<string, vector<string> > >& donnees) const;
     16  string solenoData(const vector< pair<string, vector<string> > >& donnees) const;
     17  string bendData(const vector< pair<string, vector<string> > >& donnees) const;
     18  string fitData(const vector< pair<string, vector<string> > >& donnees) const;
    1219
    1320 public :
  • Interface_Web/trunk/pspaWT/sources/controler/src/abstractElement.cc

    r412 r418  
    66
    77abstractElement::abstractElement()
    8 : abstractSoftware_(NULL)
     8//: nameOfSoftware_(NULL)
     9  : abstractSoftware_(NULL)
    910{
    1011  setDefaultValues();
     
    1415
    1516abstractElement::abstractElement(string lab)
     17  //: nameOfSoftware_(NULL)
     18  : abstractSoftware_(NULL)
    1619{
    17   label_ = lab;
     20  specificName_ = lab;
    1821  setDefaultValues();
    1922  setDefaults();
     
    2427{
    2528  if (parametersString_ != NULL) delete [] parametersString_ ;
     29  //  if ( nameOfSoftware_ != NULL ) delete nameOfSoftware_;
    2630}
    2731
    2832void abstractElement::setDefaultValues()
    2933{
    30   defaultLabel_ = string("XXXXXX");
     34  defaultSpecificName_ = string("XXXXXX");
    3135  defaultLength_ = 0.0;
    3236  defaultAperture_ = 1.e+6;
     
    3640void abstractElement::setDefaults()
    3741{
    38   label_ = defaultLabel_;
     42  specificName_ = defaultSpecificName_;
    3943  nbParam_ = 2;
    4044  lenghtElem_ = defaultLength_;
     
    5559void abstractElement::setLabel(string lab)
    5660{
    57   label_= lab;
     61  specificName_= lab;
    5862}
    5963
    6064string abstractElement::getLabel() const
    6165{
    62   return label_;
     66  return specificName_;
    6367}
    6468
     
    8084
    8185
    82 trivaluedBool abstractElement::is_accepted_by_software(nomDeLogiciel prog) {
    83     if (acceptableSoftware_.size() == 0) {
    84         return TBoolError;
    85     }
    86 
    87     if ( std::find(acceptableSoftware_.begin(), acceptableSoftware_.end(), prog) != acceptableSoftware_.end()) {
    88         return TBoolOk;
    89     } else if ( std::find(ignoreSoftware_.begin(), ignoreSoftware_.end(), prog) != ignoreSoftware_.end()) {
    90         return TBoolIgnore;
    91     } else {
    92         return TBoolError;
    93     }
    94 
    95     return TBoolOk;
    96 }
    97 
    98 
    9986double abstractElement::getInitialKineticEnergy() const {
    10087  return 0.0;
     
    10289
    10390
    104 string abstractElement::generatorOutputFlow() const {
    105   return "";
    106 }
    10791
    108 trivaluedBool abstractElement::setSoftware(nomDeLogiciel prog)
    109 {
    110   trivaluedBool tb = TBoolError;
    111   if (std::find(acceptableSoftware_.begin(),acceptableSoftware_.end(),prog) != acceptableSoftware_.end()) {
    112     tb = TBoolOk;
    113   } else if (std::find(ignoreSoftware_.begin(),ignoreSoftware_.end(),prog) != ignoreSoftware_.end()) {
    114     tb = TBoolIgnore;
    115   } else {
    116     tb = TBoolError;
    117   }
    118  
    119   if (prog == nomDeLogiciel::unknownSoftware){
    120     tb = TBoolOk;
    121   }
    122  
    123   if ((tb == TBoolOk)/* || (tb == TBoolIgnore)*/) {
    124     if (prog == nomDeLogiciel::parmela) {
    125       abstractSoftware_ = new softwareParmela();
    126     } else if (prog == nomDeLogiciel::transport) {
    127       abstractSoftware_ = new softwareTransport();
    128     } else if (prog == nomDeLogiciel::generator) {
    129       abstractSoftware_ = new softwareGenerator();
    130     } else if (prog == nomDeLogiciel::test) {
    131       abstractSoftware_ = new softwareTest();
    132     } else if (prog == nomDeLogiciel::unknownSoftware) {
    133       abstractSoftware_ = NULL;
    134     }
    135   }
    136   return tb;
    137 }
    138 
    139 void abstractElement::registerAcceptableSoftware(nomDeLogiciel abs,trivaluedBool b) {
    140   if (b == TBoolIgnore) {
    141     ignoreSoftware_.push_back(abs);
    142   } else if (b == TBoolOk) {
    143     acceptableSoftware_.push_back(abs);
    144   }
    145 }
  • Interface_Web/trunk/pspaWT/sources/controler/src/abstractSoftware.cc

    r386 r418  
    3333}
    3434
     35
     36void abstractSoftware::registerElement(nomdElements::typedElement nomdel,trivaluedBool b) {
     37  if (b == TBoolIgnore) {
     38    ignoredElements_.push_back(nomdel);
     39  } else if (b == TBoolOk) {
     40    acceptedElements_.push_back(nomdel);
     41  }
     42}
     43
     44trivaluedBool abstractSoftware::doAcceptElement(nomdElements::typedElement typdel) {
     45  if (acceptedElements_.size() == 0) {
     46    return TBoolError;
     47  }
     48  if ( std::find(acceptedElements_.begin(), acceptedElements_.end(), typdel) != acceptedElements_.end()) {
     49    return TBoolOk;
     50  }
     51  if (ignoredElements_.size() == 0) {
     52    return TBoolError;
     53  }
     54  if ( std::find(ignoredElements_.begin(), ignoredElements_.end(), typdel) != ignoredElements_.end()) {
     55    return TBoolIgnore;
     56  }
     57  return TBoolOk;
     58}
     59
     60
    3561bool abstractSoftware::launchJob(string commandLine, string& resul)
    3662{
  • Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc

    r413 r418  
    179179      for (int j = debut; j <= fin; j++) {
    180180        abstractElement* elPtr= getElementPointerFromNumero(j);
    181         cout << "[" << j << "] " << elPtr->getNomdElement().getElementName() << endl;
     181        cout << "[" << j << "] " << elPtr->getNomdElement().getExpandedName() << endl;
    182182      }
    183183    } //k
     
    243243    pspa_->getBeamLine()->clear();
    244244   
    245     typedElement elementType;
     245    nomdElements::typedElement elementType;
    246246    string elementLabel;
    247247    while (infile >> elementLabel) {
  • Interface_Web/trunk/pspaWT/sources/controler/src/elementBeam.cc

    r387 r418  
    1010    parametersString_ = new string[nbParam_+1];
    1111    //  transportOk_ = true;
    12     registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk);
     12    //    registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk);
    1313}
    1414
     
    1616
    1717void elementBeam::setDefaultValues() {
    18     defaultLabel_ = "beam";
     18    defaultSpecificName_ = "beam";
    1919    xDef_ = 0.0;
    2020    xpDef_ = 0.0;
     
    2727
    2828void elementBeam::setDefaults() {
    29     label_ = defaultLabel_;
     29    specificName_ = defaultSpecificName_;
    3030    x_ = xDef_;
    3131    xp_ = xpDef_;
     
    4141    int compteur = -1;
    4242    parametersString_[++compteur] = mixedTools::intToString(nbParam_);
    43     parametersString_[++compteur] = label_;
     43    parametersString_[++compteur] = specificName_;
    4444    parametersString_[++compteur] = mixedTools::doubleToString(x_);
    4545    parametersString_[++compteur] = mixedTools::doubleToString(xp_);
     
    5555    return parametersString_;
    5656}
     57
     58
     59
    5760
    5861void elementBeam::setParametersString(string* param) {
     
    7073    }
    7174   
    72     label_ = param[++compteur];
     75    specificName_ = param[++compteur];
    7376    x_ = atof(param[++compteur].c_str());
    7477    xp_ = atof(param[++compteur].c_str());
     
    8083}
    8184
    82 string elementBeam::parmelaOutputFlow() const
    83 {
    84     ostringstream sortie;
    85     cout << " BEAM sortie parmela non programmee " << endl;
    86     return sortie.str();
    87 }
     85// string elementBeam::parmelaOutputFlow() const
     86// {
     87//     ostringstream sortie;
     88//     cout << " BEAM sortie parmela non programmee " << endl;
     89//     return sortie.str();
     90// }
    8891
    89 string elementBeam::transportOutputFlow() const {
    90     ostringstream sortie;
    91     beam2Moments moments(x_, xp_, y_, yp_, dl_, del_);
    92     cout << " elementBeam::transportOutputFlow(), p0 = " << p0_ << endl;
    93     sortie << label_ << ":" << moments.writeToTransportInput(p0_) << endl;
    94     return sortie.str();
    95 }
     92// string elementBeam::transportOutputFlow() const {
     93//     ostringstream sortie;
     94//     beam2Moments moments(x_, xp_, y_, yp_, dl_, del_);
     95//     cout << " elementBeam::transportOutputFlow(), p0 = " << p0_ << endl;
     96//     sortie << specificName_ << ":" << moments.writeToTransportInput(p0_) << endl;
     97//     return sortie.str();
     98// }
    9699
    97100string elementBeam::FileOutputFlow() const {
    98101    ostringstream sortie;
    99102    // sortie << elementName_.getElementType() << endl;
    100     sortie << elementName_.getElementLabel() << endl;
    101     sortie  << label_ << endl;
     103    sortie << elementName_.getGenericLabel() << endl;
     104    sortie  << specificName_ << endl;
    102105    sortie << x_ << "  " << xp_ << " " <<  y_  << " " <<  yp_  << endl;
    103106    sortie << dl_ << "  " << del_ << " " <<  p0_  << endl;
     
    106109}
    107110
     111vector< pair<string, vector<string> > > elementBeam::parametersToSoftware () const {
     112  vector< pair<string, vector<string> > >  sortie;
     113  sortie.push_back( pair<string, vector<string> >("labelsGenericSpecific",  vector<string>() ) );
     114  sortie.back().second.push_back(elementName_.getGenericLabel());
     115  sortie.back().second.push_back(specificName_);
     116  sortie.push_back( pair<string, vector<string> >("transverseCoordinates",  vector<string>() ) );
     117  sortie.back().second.push_back(mixedTools::doubleToString(x_));
     118  sortie.back().second.push_back(mixedTools::doubleToString(xp_));
     119  sortie.back().second.push_back(mixedTools::doubleToString(y_));
     120  sortie.back().second.push_back(mixedTools::doubleToString(xp_));
     121  sortie.push_back( pair<string, vector<string> >("longitudinalCoordinates",  vector<string>() ) );
     122  sortie.back().second.push_back(mixedTools::doubleToString(dl_));
     123  sortie.back().second.push_back(mixedTools::doubleToString(del_));                 
     124  sortie.push_back( pair<string, vector<string> >("momentum",  vector<string>() ) );
     125  sortie.back().second.push_back(mixedTools::doubleToString(p0_));
     126  return sortie;
     127}
     128
     129
    108130void elementBeam::elementBeam::FileInput(ifstream& ifs) {
    109     ifs >> label_;
     131    ifs >> specificName_;
    110132    ifs >> x_ >> xp_ >>  y_ >> yp_;
    111133    ifs >> dl_ >> del_ >> p0_;
     
    118140string elementBeam::print() {
    119141    string txt = "";
    120     txt += label_;
     142    txt += specificName_;
    121143    txt += "\n 1/2 horizontal beam extend rms (cm) : ";
    122144    txt += mixedTools::doubleToString(x_);
  • Interface_Web/trunk/pspaWT/sources/controler/src/elementBend.cc

    r387 r418  
    1111  nbParam_ = elementName_.getElementNbParameters();
    1212  parametersString_ = new string[nbParam_+1];
    13   // transportOk_ = true;
    14   // parmelaOk_ = true;
    15     registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk);
    16     registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk);
     13    // registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk);
     14    // registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk);
    1715}
    1816
    1917  void elementBend::setDefaultValues()
    2018  {
    21     defaultLabel_ = "bend";
     19    defaultSpecificName_ = "bend";
    2220    angleDegDef_ = 0.0;
    2321    radiusDef_ = 1.0;
     
    2927  void elementBend::setDefaults()
    3028  {
    31     label_ = defaultLabel_;
     29    specificName_ = defaultSpecificName_;
    3230    angleDeg_ = angleDegDef_;
    3331    radius_ = radiusDef_;
     
    4139   int compteur = -1;
    4240   parametersString_[++compteur] = mixedTools::intToString(nbParam_);
    43    parametersString_[++compteur] = label_;
     41   parametersString_[++compteur] = specificName_;
    4442   parametersString_[++compteur] = mixedTools::doubleToString( angleDeg_);
    4543   parametersString_[++compteur] = mixedTools::doubleToString(radius_);
     
    7674          return;
    7775        }
    78     label_ = param[++compteur];
     76    specificName_ = param[++compteur];
    7977    angleDeg_ =  atof(param[++compteur].c_str());
    8078    radius_ = atof(param[++compteur].c_str());
     
    8886 }
    8987
    90 string elementBend::parmelaOutputFlow() const
    91   {
    92     ostringstream sortie;
    93     // il faut entrer l'energie cinetique
    94     double ecin = momentum_/EREST_MeV;
    95     ecin = ecin*ecin + 1.;
    96     ecin = EREST_MeV*(sqrt(ecin) - 1.0);
    97     sortie << "BEND /l=" << lenghtElem_ << "  / aper=" << aperture_ << "  / iout=1 / wr=" << ecin << " /alpha=" << angleDeg_ << " / beta1=" << beta1_;
    98     sortie << " / beta2=" << beta1_  << endl;
     88// string elementBend::parmelaOutputFlow() const
     89//   {
     90//     ostringstream sortie;
     91//     // il faut entrer l'energie cinetique
     92//     double ecin = momentum_/EREST_MeV;
     93//     ecin = ecin*ecin + 1.;
     94//     ecin = EREST_MeV*(sqrt(ecin) - 1.0);
     95//     sortie << "BEND /l=" << lenghtElem_ << "  / aper=" << aperture_ << "  / iout=1 / wr=" << ecin << " /alpha=" << angleDeg_ << " / beta1=" << beta1_;
     96//     sortie << " / beta2=" << beta2_  << endl;
    9997
    100     return sortie.str();
    101   }
     98//     return sortie.str();
     99//   }
    102100
    103101
    104 string elementBend::transportOutputFlow() const
    105   {
    106     ostringstream sortie;
    107     sortie << label_ << ":" << "  SBEND, RADIUS=" << radius_ << ", ANGLE=" << angleDeg_ << ", E1=" << beta1_ << ", E2=" << beta2_ << ";" << endl;
    108     return sortie.str();
    109   }
     102// string elementBend::transportOutputFlow() const
     103//   {
     104//     ostringstream sortie;
     105//     sortie << specificName_ << ":" << "  SBEND, RADIUS=" << radius_ << ", ANGLE=" << angleDeg_ << ", E1=" << beta1_ << ", E2=" << beta2_ << ";" << endl;
     106//     return sortie.str();
     107//   }
    110108
    111109
     
    114112    ostringstream sortie;
    115113    //    sortie << elementName_.getElementType() << endl;
    116     sortie << elementName_.getElementLabel() << endl;
    117     sortie  << label_ << endl;
     114    sortie << elementName_.getGenericLabel() << endl;
     115    sortie  << specificName_ << endl;
    118116    sortie << angleDeg_ << "  " << radius_ << " " <<  aperture_  << endl;
    119117    sortie << beta1_ << "  " << beta2_ << " " << momentum_ << endl;
     
    121119  }
    122120
     121vector< pair<string, vector<string> > > elementBend::parametersToSoftware () const{
     122  vector< pair<string, vector<string> > >  sortie;
     123  sortie.push_back( pair<string, vector<string> >("labelsGenericSpecific",  vector<string>() ) );
     124  sortie.back().second.push_back(elementName_.getGenericLabel());
     125  sortie.back().second.push_back(specificName_);
     126  sortie.push_back( pair<string, vector<string> >("lenghtAperture",  vector<string>() ) );
     127  sortie.back().second.push_back(mixedTools::doubleToString( lenghtElem_));
     128  sortie.back().second.push_back(mixedTools::doubleToString( aperture_));
     129  sortie.push_back( pair<string, vector<string> >("angleDegre",  vector<string>() ) );
     130  sortie.back().second.push_back(mixedTools::doubleToString( angleDeg_));
     131  sortie.push_back( pair<string, vector<string> >("radius",  vector<string>() ) );
     132  sortie.back().second.push_back(mixedTools::doubleToString( radius_));
     133  sortie.push_back( pair<string, vector<string> >("rotatedFaces",  vector<string>() ) );
     134  sortie.back().second.push_back(mixedTools::doubleToString( beta1_));
     135  sortie.back().second.push_back(mixedTools::doubleToString( beta2_));
     136  sortie.push_back( pair<string, vector<string> >("momentum",  vector<string>() ) );
     137  sortie.back().second.push_back(mixedTools::doubleToString( momentum_));
     138  return sortie;
     139}
     140
    123141void elementBend::FileInput(ifstream& ifs)
    124142{
    125   ifs >> label_;
     143  ifs >> specificName_;
    126144  ifs >> angleDeg_ >> radius_ >>  aperture_;
    127145  ifs >> beta1_ >> beta2_ >> momentum_;
     
    134152    string txt = "";
    135153
    136     txt += label_;
     154    txt += specificName_;
    137155    txt += "\nangle (deg.) : ";
    138156    txt += mixedTools::doubleToString(angleDeg_);
  • Interface_Web/trunk/pspaWT/sources/controler/src/elementCell.cc

    r387 r418  
    1414      nbParam_ = elementName_.getElementNbParameters();
    1515      parametersString_ = new string[nbParam_+1];
    16       //      parmelaOk_ = true;
    17         registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk);
     16      //        registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk);
    1817    }
    1918
    2019void elementCell::setDefaultValues()
    2120{
    22     defaultLabel_ = "cell";
     21    defaultSpecificName_ = "cell";
    2322    initialPhaseDef_ = 0.0;
    2423    acceleratingFieldDef_ = 1.0;
     
    3130void elementCell::setDefaults()
    3231{
    33     label_ = defaultLabel_;
     32    specificName_ = defaultSpecificName_;
    3433    initialPhase_ = initialPhaseDef_;
    3534    acceleratingField_ = acceleratingFieldDef_;
     
    4544   int compteur = -1;
    4645    parametersString_[++compteur] = mixedTools::intToString(nbParam_);
    47   parametersString_[++compteur] = label_;
     46  parametersString_[++compteur] = specificName_;
    4847    parametersString_[++compteur] = mixedTools::doubleToString(lenghtElem_);
    4948    parametersString_[++compteur] = mixedTools::doubleToString(aperture_);
     
    7877      }
    7978
    80     label_ = param[++compteur];
     79    specificName_ = param[++compteur];
    8180    lenghtElem_ = atof(param[++compteur].c_str());
    8281    aperture_ = atof(param[++compteur].c_str());
     
    9089  }
    9190
    92 string elementCell::parmelaOutputFlow() const
    93   {
    94     ostringstream sortie;
    95     // on prend les troncatures tmax et rmax à 3 sigmas
    96     sortie << "CELL /l=" << lenghtElem_ << "  /aper=" << aperture_ << endl;
    97     sortie << "  /iout=1  /phi0=" << initialPhase_ << " /E0=" << acceleratingField_ << endl;
    98     sortie << " /nc=1 /dwtmax=" << phaseStepMax_ << " /sym=-1" << endl;
    99     sortie << "CFIELD 1" << endl;
    100     sortie << acceleratingShapeFile_ << endl;
    101     if ( focusingMagFile_ != "") {
    102       sortie << "POISSON /zoff=" << offsetMag_ << " /rmult=" << scaleFactor_ << endl;
    103       sortie << focusingMagFile_ << endl;
    104     }
     91// string elementCell::parmelaOutputFlow() const
     92//   {
     93//     ostringstream sortie;
     94//     sortie << "CELL /l=" << lenghtElem_ << "  /aper=" << aperture_ << endl;
     95//     sortie << "  /iout=1  /phi0=" << initialPhase_ << " /E0=" << acceleratingField_ << endl;
     96//     sortie << " /nc=1 /dwtmax=" << phaseStepMax_ << " /sym=-1" << endl;
     97//     sortie << "CFIELD 1" << endl;
     98//     sortie << acceleratingShapeFile_ << endl;
     99//     if ( focusingMagFile_ != "") {
     100//       sortie << "POISSON /zoff=" << offsetMag_ << " /rmult=" << scaleFactor_ << endl;
     101//       sortie << focusingMagFile_ << endl;
     102//     }
    105103
    106     return sortie.str();
    107   }
     104//     return sortie.str();
     105//   }
    108106
    109107
     
    112110    ostringstream sortie;
    113111    //    sortie << elementName_.getElementType()  << endl;
    114     sortie << elementName_.getElementLabel() << endl;
    115     sortie  << label_ << endl;
     112    sortie << elementName_.getGenericLabel() << endl;
     113    sortie  << specificName_ << endl;
    116114    sortie << lenghtElem_ << " " << aperture_ << endl;
    117115    sortie << initialPhase_ << "  " << acceleratingField_ << endl;
     
    123121  }
    124122
     123
     124vector< pair<string, vector<string> > > elementCell::parametersToSoftware () const {
     125  vector< pair<string, vector<string> > >  sortie;
     126  sortie.push_back( pair<string, vector<string> >("labelsGenericSpecific",  vector<string>() ) );
     127  sortie.back().second.push_back(elementName_.getGenericLabel());
     128  sortie.back().second.push_back(specificName_);
     129  sortie.push_back( pair<string, vector<string> >("lenghtAperture",  vector<string>() ) );
     130  sortie.back().second.push_back(mixedTools::doubleToString(lenghtElem_));
     131  sortie.back().second.push_back(mixedTools::doubleToString( aperture_));
     132  sortie.push_back( pair<string, vector<string> >("phaseInitialStepmax",  vector<string>() ) );
     133  sortie.back().second.push_back(mixedTools::doubleToString( initialPhase_));
     134  sortie.back().second.push_back(mixedTools::doubleToString( phaseStepMax_));
     135  sortie.push_back( pair<string, vector<string> >("fieldValueFile",  vector<string>() ) );
     136  sortie.back().second.push_back(mixedTools::doubleToString( acceleratingField_));
     137  sortie.back().second.push_back(acceleratingShapeFile_);
     138  sortie.push_back( pair<string, vector<string> >("MagFocusingFileOffsetScale",  vector<string>() ) );
     139  sortie.back().second.push_back(focusingMagFile_);
     140  sortie.back().second.push_back(mixedTools::doubleToString( offsetMag_));
     141  sortie.back().second.push_back(mixedTools::doubleToString( scaleFactor_));
     142
     143  return sortie;
     144}
     145
     146
    125147void elementCell::FileInput(ifstream& ifs)
    126148{
    127   ifs >> label_;
     149  ifs >> specificName_;
    128150  ifs >> lenghtElem_ >>  aperture_;
    129151  ifs >> initialPhase_ >> acceleratingField_;
     
    139161
    140162
    141     txt += label_;
     163    txt += specificName_;
    142164    txt += "\nlength (cm) : ";
    143165    txt += mixedTools::doubleToString(lenghtElem_);
  • Interface_Web/trunk/pspaWT/sources/controler/src/elementDrift.cc

    r387 r418  
    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);
     15    // registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk);
     16    // registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk);
     17    // registerAcceptableSoftware(nomDeLogiciel::test, TBoolOk);
    1818
    1919}
     
    2121  void elementDrift::setDefaultValues()
    2222  {
    23     defaultLabel_ = "drift";
     23    defaultSpecificName_ = "drift";
    2424  }
    2525  void elementDrift::setDefaults()
    2626  {
    27     label_ = defaultLabel_;
     27    specificName_ = defaultSpecificName_;
    2828  }
    2929
     
    3333   int compteur = -1;
    3434   parametersString_[++compteur] = mixedTools::intToString(nbParam_);
    35   parametersString_[++compteur] = label_;
     35  parametersString_[++compteur] = specificName_;
    3636   parametersString_[++compteur] = mixedTools::doubleToString(lenghtElem_);
    3737   parametersString_[++compteur] = mixedTools::doubleToString(aperture_);
     
    5757       return;
    5858     }
    59   label_ = param[++compteur];
     59  specificName_ = param[++compteur];
    6060   lenghtElem_ = atof(param[++compteur].c_str());
    6161   aperture_  = atof(param[++compteur].c_str());
    6262 }
    6363
    64 string elementDrift::parmelaOutputFlow() const
    65 {
    66   ostringstream sortie;
    67   sortie << "DRIFT /l=" << lenghtElem_ << "  /aper=" << aperture_ << "  /iout=1" << endl;
    68   return sortie.str();
    69 }
     64// string elementDrift::parmelaOutputFlow() const
     65// {
     66//   ostringstream sortie;
     67//   sortie << "DRIFT /l=" << lenghtElem_ << "  /aper=" << aperture_ << "  /iout=1" << endl;
     68//   return sortie.str();
     69// }
    7070
    7171
    72 string elementDrift::transportOutputFlow() const
    73   {
    74     ostringstream sortie;
    75     // longueur en m
    76     sortie << label_ << ":" << "  DRIFT, L=" << 0.01*lenghtElem_ << ";" << endl;
    77     return sortie.str();
    78   }
     72// string elementDrift::transportOutputFlow() const
     73//   {
     74//     ostringstream sortie;
     75//     // longueur en m
     76//     sortie << specificName_ << ":" << "  DRIFT, L=" << 0.01*lenghtElem_ << ";" << endl;
     77//     return sortie.str();
     78//   }
    7979
    8080
     
    8383  ostringstream sortie;
    8484  //  sortie << elementName_.getElementType()  << endl;
    85   sortie << elementName_.getElementLabel() << endl;
    86   sortie  << label_ << endl;
     85  sortie << elementName_.getGenericLabel() << endl;
     86  sortie  << specificName_ << endl;
    8787  sortie << lenghtElem_ << "  " << aperture_ <<endl;
    8888  return sortie.str();
    8989}
    9090
     91vector< pair<string, vector<string> > > elementDrift::parametersToSoftware () const {
     92  vector< pair<string, vector<string> > >  sortie;
     93  sortie.push_back( pair<string, vector<string> >("labelsGenericSpecific",  vector<string>() ) );
     94  sortie.back().second.push_back(elementName_.getGenericLabel());
     95  sortie.back().second.push_back(specificName_);
     96  sortie.push_back( pair<string, vector<string> >("lenghtAperture",  vector<string>() ) );
     97  sortie.back().second.push_back(mixedTools::doubleToString(lenghtElem_));
     98  sortie.back().second.push_back(mixedTools::doubleToString(aperture_));
     99  return sortie;
     100}
     101
     102
     103
    91104void elementDrift::FileInput(ifstream& ifs)
    92105{
    93   ifs >> label_;
     106  ifs >> specificName_;
    94107  ifs >> lenghtElem_ >>  aperture_;
    95108}
     
    99112    string txt = "";
    100113
    101     txt += label_;
     114    txt += specificName_;
    102115    txt += "\nlength (cm) : ";
    103116    txt += mixedTools::doubleToString(lenghtElem_);
  • Interface_Web/trunk/pspaWT/sources/controler/src/elementFit.cc

    r359 r418  
    1111    // transportOk_ = true;
    1212    // parmelaIgnored_ = true;
    13     registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk);
    14     registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolIgnore);
     13    // registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk);
     14    // registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolIgnore);
    1515}
    1616
    1717void elementFit::setDefaultValues()
    1818{
    19     defaultLabel_ = "fit";
     19    defaultSpecificName_ = "fit";
    2020    variableNameDef_ = "";
    2121    variableValueDef_ = 0.0;
     
    2525void elementFit::setDefaults()
    2626{
    27     label_ = defaultLabel_;
     27    specificName_ = defaultSpecificName_;
    2828    variableName_ = variableNameDef_;
    2929    variableValue_ = variableValueDef_;
     
    3737    int compteur = -1;
    3838    parametersString_[++compteur] = mixedTools::intToString(nbParam_);
    39     parametersString_[++compteur] = label_;
     39    parametersString_[++compteur] = specificName_;
    4040    parametersString_[++compteur] = variableName_;
    4141    parametersString_[++compteur] = mixedTools::doubleToString(variableValue_ );
     
    6363    }
    6464   
    65     label_ = param[++compteur];
     65    specificName_ = param[++compteur];
    6666    variableName_ = param[++compteur];
    6767    variableValue_ = atof(param[++compteur].c_str());
     
    7070
    7171
    72 string elementFit::parmelaOutputFlow() const
    73 {
    74     ostringstream sortie;
    75     return sortie.str();
    76 }
     72// string elementFit::parmelaOutputFlow() const
     73// {
     74//     ostringstream sortie;
     75//     return sortie.str();
     76// }
    7777
    78 string elementFit::transportOutputFlow() const
    79 {
    80     ostringstream sortie;
    81     sortie << label_ << ":" << "  FIT," << variableName_ << " = " << variableValue_ << ", TOLER = " << tolerance_ << " ;" << endl;
    82     if ( variableName_ == "R11" || variableName_ == "R22" || variableName_ == "R12" || variableName_ == "R21" ) {
    83         sortie << " PRINT, TRANS;" << endl;
    84     }
    85     return sortie.str();
    86 }
     78// string elementFit::transportOutputFlow() const
     79// {
     80//     ostringstream sortie;
     81//     sortie << specificName_ << ":" << "  FIT," << variableName_ << " = " << variableValue_ << ", TOLER = " << tolerance_ << " ;" << endl;
     82//     if ( variableName_ == "R11" || variableName_ == "R22" || variableName_ == "R12" || variableName_ == "R21" ) {
     83//         sortie << " PRINT, TRANS;" << endl;
     84//     }
     85//     return sortie.str();
     86// }
    8787
    8888string elementFit::FileOutputFlow() const
     
    9090    ostringstream sortie;
    9191    //    sortie << elementName_.getElementType() << endl;
    92     sortie << elementName_.getElementLabel() << endl;
    93     sortie  << label_ << endl;
     92    sortie << elementName_.getGenericLabel() << endl;
     93    sortie  << specificName_ << endl;
    9494    sortie  <<    variableName_ << " " << variableValue_ << " " << tolerance_ << endl;
    9595    return sortie.str();
    9696}
    9797
     98vector< pair<string, vector<string> > > elementFit::parametersToSoftware () const {
     99  vector< pair<string, vector<string> > >  sortie;
     100  sortie.push_back( pair<string, vector<string> >("labelsGenericSpecific",  vector<string>() ) );
     101  sortie.back().second.push_back(elementName_.getGenericLabel());
     102  sortie.back().second.push_back(specificName_);
     103  sortie.push_back( pair<string, vector<string> >("variable",  vector<string>() ) );
     104  sortie.back().second.push_back(variableName_);
     105  sortie.back().second.push_back(mixedTools::doubleToString(variableValue_));
     106  sortie.back().second.push_back(mixedTools::doubleToString(tolerance_));
     107  return sortie;
     108}
     109
     110
    98111void elementFit::FileInput(ifstream& ifs)
    99112{
    100     ifs >> label_;
     113    ifs >> specificName_;
    101114    ifs  >>  variableName_ >>  variableValue_   >> tolerance_;
    102115}
     
    106119    string txt = "";
    107120 
    108     txt += label_;
     121    txt += specificName_;
    109122    return txt;
    110123}
  • Interface_Web/trunk/pspaWT/sources/controler/src/elementRfgun.cc

    r387 r418  
    1515    parametersString_ = new string[nbParam_+1];
    1616    //      parmelaOk_ = true;
    17     registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk);
    18     registerAcceptableSoftware(nomDeLogiciel::generator, TBoolOk);
     17    // registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk);
     18    // registerAcceptableSoftware(nomDeLogiciel::generator, TBoolOk);
    1919}
    2020
    2121void elementRfgun::setDefaultValues()
    2222{
    23     defaultLabel_ = "rfgun";
     23    defaultSpecificName_ = "rfgun";
    2424    defaultPhaseStep_ = 1.0;
    2525    defaultNmacrop_ = 0;
     
    3636  void elementRfgun::setDefaults()
    3737  {
    38     label_ = defaultLabel_;
     38    specificName_ = defaultSpecificName_;
    3939    phaseStep_ = defaultPhaseStep_;
    4040    nmacrop_ = defaultNmacrop_;
     
    5454   int compteur = -1;
    5555    parametersString_[++compteur] = mixedTools::intToString(nbParam_);
    56   parametersString_[++compteur] = label_;
     56  parametersString_[++compteur] = specificName_;
    5757    parametersString_[++compteur] = mixedTools::intToString(nmacrop_);
    5858    parametersString_[++compteur] = mixedTools::doubleToString(sigma_t_);
     
    8181      }
    8282
    83     label_ = param[++compteur];
     83    specificName_ = param[++compteur];
    8484    nmacrop_ = atoi(param[++compteur].c_str());
    8585    sigma_t_ = atof(param[++compteur].c_str());
     
    9393  }
    9494
    95 string elementRfgun::parmelaOutputFlow() const
    96   {
    97     ostringstream sortie;
    98     // on prend les troncatures tmax et rmax à 3 sigmas
    99     sortie << "INPUT 10 /np=" << nmacrop_ << "  /sigt=" << sigma_t_ << endl;
    100     sortie << "  /tmax=" << 3.3*sigma_t_ << " /sigr=" << sigma_r_ << endl;
    101     sortie << " /rmax=" << 3.0*sigma_r_ << " /W0=" << E_cin_ << " /dw0=" << sigma_E_ << endl;
    102     sortie << " /dwt=" << phaseStep_ << " /ran=2" << endl;
    103 
    104     // on doit entrer le nb vrai de part. (avec signe moins)
     95// string elementRfgun::parmelaOutputFlow() const
     96//   {
     97//     ostringstream sortie;
     98//     // on prend les troncatures tmax et rmax à 3 sigmas
     99//     sortie << "INPUT 10 /np=" << nmacrop_ << "  /sigt=" << sigma_t_ << endl;
     100//     sortie << "  /tmax=" << 3.3*sigma_t_ << " /sigr=" << sigma_r_ << endl;
     101//     sortie << " /rmax=" << 3.0*sigma_r_ << " /W0=" << E_cin_ << " /dw0=" << sigma_E_ << endl;
     102//     sortie << " /dwt=" << phaseStep_ << " /ran=2" << endl;
     103
     104//     // on doit entrer le nb vrai de part. (avec signe moins)
    105105   
    106106
    107     sortie << "SCHEFF /beami=" << -fabs(totalCharge_)/ELECTRONANOCOULOMB << " /nprog=2 /point=-1.7"  << endl;
     107//     sortie << "SCHEFF /beami=" << -fabs(totalCharge_)/ELECTRONANOCOULOMB << " /nprog=2 /point=-1.7"  << endl;
    108108 
    109     return sortie.str();
    110   }
    111 
    112 string elementRfgun::generatorOutputFlow() const {
    113     ostringstream sortie;
    114     sortie << "Ipart=" << nmacrop_ << endl;
    115 
    116     sortie << "Probe=.True." << endl;
    117     sortie << "Noise_reduc=.T" << endl;
    118     sortie << "Cathode=.T." << endl;
    119     sortie << "Q_total=" << totalCharge_ << endl;
    120     sortie << "Ref_zpos=0.0" << endl;
    121     sortie << "Ref_clock=0.0" << endl;
    122     sortie << "Ref_Ekin=" << E_cin_ << endl; // tjs en MeV
    123     sortie << "Dist_z='g'" << endl;
    124     sortie << "sig_clock=" << 1.0e-3*sigma_t_ << endl; // passage de ps en ns
    125     sortie <<  "Dist_pz='g', sig_Ekin=" << 1000.*sigma_E_ << ",  emit_z=0.0 ,    cor_Ekin=0.0 " << endl;  // passage en keV
    126     sortie << "Dist_x='gauss',  sig_x=" <<  10.*sigma_r_ << endl;    // passage en mm
    127     sortie << "Dist_px='g', Nemit_x=" << emit_x_ << ",   cor_px=0.0" << endl;
    128     sortie << "Dist_y='gauss',  sig_y=" <<  10.*sigma_r_ << endl;    // passage en mm
    129     sortie << "Dist_py='g', Nemit_y=" << emit_y_ << ",   cor_py=0.0" << endl;
    130     return sortie.str();
    131 }
     109//     return sortie.str();
     110//   }
     111
     112// string elementRfgun::generatorOutputFlow() const {
     113//     ostringstream sortie;
     114//     sortie << "Ipart=" << nmacrop_ << endl;
     115
     116//     sortie << "Probe=.True." << endl;
     117//     sortie << "Noise_reduc=.T" << endl;
     118//     sortie << "Cathode=.T." << endl;
     119//     sortie << "Q_total=" << totalCharge_ << endl;
     120//     sortie << "Ref_zpos=0.0" << endl;
     121//     sortie << "Ref_clock=0.0" << endl;
     122//     sortie << "Ref_Ekin=" << E_cin_ << endl; // tjs en MeV
     123//     sortie << "Dist_z='g'" << endl;
     124//     sortie << "sig_clock=" << 1.0e-3*sigma_t_ << endl; // passage de ps en ns
     125//     sortie <<  "Dist_pz='g', sig_Ekin=" << 1000.*sigma_E_ << ",  emit_z=0.0 ,    cor_Ekin=0.0 " << endl;  // passage en keV
     126//     sortie << "Dist_x='gauss',  sig_x=" <<  10.*sigma_r_ << endl;    // passage en mm
     127//     sortie << "Dist_px='g', Nemit_x=" << emit_x_ << ",   cor_px=0.0" << endl;
     128//     sortie << "Dist_y='gauss',  sig_y=" <<  10.*sigma_r_ << endl;    // passage en mm
     129//     sortie << "Dist_py='g', Nemit_y=" << emit_y_ << ",   cor_py=0.0" << endl;
     130//     return sortie.str();
     131// }
    132132
    133133
     
    138138    // on prend les troncatures tmax et rmax à 3 sigmas
    139139    //    sortie << elementName_.getElementType() << endl;
    140     sortie << elementName_.getElementLabel() << endl;
    141     sortie  << label_ << endl;
     140    sortie << elementName_.getGenericLabel() << endl;
     141    sortie  << specificName_ << endl;
    142142    sortie <<  nmacrop_ << "  " << sigma_t_ << "  " << sigma_r_ << endl;
    143143    sortie << emit_x_ << "  " << emit_y_ << endl;
     
    147147  }
    148148
     149vector< pair<string, vector<string> > > elementRfgun::parametersToSoftware () const {
     150  vector< pair<string, vector<string> > >  sortie;
     151  sortie.push_back( pair<string, vector<string> >("labelsGenericSpecific",  vector<string>() ) );
     152  sortie.back().second.push_back(elementName_.getGenericLabel());
     153  sortie.back().second.push_back(specificName_);
     154  sortie.push_back( pair<string, vector<string> >("nbMacroparticles",  vector<string>() ) );
     155  sortie.back().second.push_back(mixedTools::intToString(nmacrop_));
     156  sortie.push_back( pair<string, vector<string> >("sigmasTR",  vector<string>() ) );
     157  sortie.back().second.push_back(mixedTools::doubleToString(sigma_t_));
     158  sortie.back().second.push_back(mixedTools::doubleToString(sigma_r_));
     159  sortie.push_back( pair<string, vector<string> >("emittancesXY",  vector<string>() ) );
     160  sortie.back().second.push_back(mixedTools::doubleToString(emit_x_));
     161  sortie.back().second.push_back(mixedTools::doubleToString(emit_y_));
     162  sortie.push_back( pair<string, vector<string> >("kineticE",  vector<string>() ) );
     163  sortie.back().second.push_back(mixedTools::doubleToString(E_cin_));
     164  sortie.back().second.push_back(mixedTools::doubleToString(sigma_E_));
     165  sortie.push_back( pair<string, vector<string> >("phaseStep",  vector<string>() ) );
     166  sortie.back().second.push_back(mixedTools::doubleToString(phaseStep_));
     167  sortie.push_back( pair<string, vector<string> >("totalCharge",  vector<string>() ) );
     168  sortie.back().second.push_back(mixedTools::doubleToString(totalCharge_));
     169  return sortie;
     170}
     171
    149172void elementRfgun::FileInput(ifstream& ifs)
    150173{
    151   ifs >> label_;
     174  ifs >> specificName_;
    152175  ifs >> nmacrop_ >> sigma_t_ >> sigma_r_;
    153176  ifs >> emit_x_  >>  emit_y_;
     
    160183    string txt = "";
    161184   
    162     txt += label_;
     185    txt += specificName_;
    163186    txt += "\ntotal charge : ";
    164187    txt += mixedTools::doubleToString(totalCharge_);
  • Interface_Web/trunk/pspaWT/sources/controler/src/elementSnapshot.cc

    r387 r418  
    1313  nbParam_ = elementName_.getElementNbParameters();
    1414  parametersString_ = new string[nbParam_+1];
    15   registerAcceptableSoftware(nomDeLogiciel::transport, TBoolIgnore);
    16   registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolIgnore);
    17   registerAcceptableSoftware(nomDeLogiciel::generator, TBoolIgnore);
    18   registerAcceptableSoftware(nomDeLogiciel::test, TBoolIgnore);
     15  // registerAcceptableSoftware(nomDeLogiciel::transport, TBoolIgnore);
     16  // registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolIgnore);
     17  // registerAcceptableSoftware(nomDeLogiciel::generator, TBoolIgnore);
     18  // registerAcceptableSoftware(nomDeLogiciel::useraction,
     19  //                                           TBoolOk);
     20  // registerAcceptableSoftware(nomDeLogiciel::test, TBoolIgnore);
    1921}
    2022
    2123void elementSnapshot::setDefaultValues()
    2224{
    23   defaultLabel_ = "snapshot";
     25  defaultSpecificName_ = "snapshot";
    2426}
    2527
    2628void elementSnapshot::setDefaults()
    2729{
    28   label_ = defaultLabel_;
     30  specificName_ = defaultSpecificName_;
    2931
    3032  if(incr_ < 10) {
     
    4143  int compteur = -1;
    4244  parametersString_[++compteur] = mixedTools::intToString(nbParam_);
    43   parametersString_[++compteur] = label_;
     45  parametersString_[++compteur] = specificName_;
    4446  parametersString_[++compteur] = snapshotFile_;
    4547 
     
    6668  }
    6769 
    68   label_ = param[++compteur];
     70  specificName_ = param[++compteur];
    6971}
    7072
    71 string elementSnapshot::parmelaOutputFlow() const
    72 {
    73     // ostringstream sortie;
    74     // return sortie.str();
    75   return string("");
    76 }
     73// string elementSnapshot::parmelaOutputFlow() const
     74// {
     75//     // ostringstream sortie;
     76//     // return sortie.str();
     77//   return string("");
     78// }
    7779
    78 string elementSnapshot::transportOutputFlow() const
    79 {
    80   return string("");
    81 }
     80// string elementSnapshot::transportOutputFlow() const
     81// {
     82//   return string("");
     83// }
    8284
    8385string elementSnapshot::FileOutputFlow() const
    8486{
    8587  ostringstream sortie;
    86   sortie << elementName_.getElementLabel() << endl;
    87   sortie  << label_ << endl;
     88  sortie << elementName_.getGenericLabel() << endl;
     89  sortie  << specificName_ << endl;
    8890  sortie << snapshotFile_ << endl;
    8991  return sortie.str();
    9092}
    9193
     94vector< pair<string, vector<string> > > elementSnapshot::parametersToSoftware () const {
     95  vector< pair<string, vector<string> > >  sortie;
     96  sortie.push_back( pair<string, vector<string> >("labelsGenericSpecific",  vector<string>() ) );
     97  sortie.back().second.push_back(elementName_.getGenericLabel());
     98  sortie.back().second.push_back(specificName_);
     99  sortie.push_back( pair<string, vector<string> >("snapshotFile",  vector<string>() ) );
     100  sortie.back().second.push_back(snapshotFile_);
     101  return sortie;
     102}
     103
    92104void elementSnapshot::FileInput(ifstream& ifs)
    93105{
    94   ifs >> label_;
     106  ifs >> specificName_;
    95107  ifs >> snapshotFile_;
    96108}
     
    99111{
    100112  string txt = ""; 
    101   txt += label_;
     113  txt += specificName_;
    102114  txt += "\nname of file for snapshot : ";
    103115  txt += snapshotFile_;
  • Interface_Web/trunk/pspaWT/sources/controler/src/elementSoleno.cc

    r387 r418  
    1111    nbParam_ = elementName_.getElementNbParameters();
    1212    parametersString_ = new string[nbParam_+1];
    13     registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk);
    14     registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk);
     13    // registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk);
     14    // registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk);
    1515}
    1616
     
    1818  void elementSoleno::setDefaultValues()
    1919  {
    20     defaultLabel_ = "solnd";
     20    defaultSpecificName_ = "solnd";
    2121    B0Def_ = 0.0;
    2222    varyB0Def_ = false;
     
    2525  void elementSoleno::setDefaults()
    2626  {
    27     label_ = defaultLabel_;
     27    specificName_ = defaultSpecificName_;
    2828    B0_ = B0Def_;
    2929    varyB0_ = varyB0Def_;
     
    3636   int compteur = -1;
    3737   parametersString_[++compteur] = mixedTools::intToString(nbParam_);
    38    parametersString_[++compteur] = label_;
     38   parametersString_[++compteur] = specificName_;
    3939   parametersString_[++compteur] = mixedTools::doubleToString(lenghtElem_);
    4040   parametersString_[++compteur] = mixedTools::doubleToString(aperture_);
     
    6363          return;
    6464        }
    65   label_ = param[++compteur];
     65  specificName_ = param[++compteur];
    6666    lenghtElem_ = atof(param[++compteur].c_str());
    6767    aperture_  = atof(param[++compteur].c_str());
     
    7070 }
    7171
    72 string elementSoleno::parmelaOutputFlow() const
    73   {
    74     ostringstream sortie;
    75     // on passe l'induction magnetique en Gauss
    76     sortie << "SOLENOID /l=" << lenghtElem_ << "  /aper=" << aperture_ << "  /iout=1 /h=" << 1000.*B0_  << endl;
    77     return sortie.str();
    78   }
     72// string elementSoleno::parmelaOutputFlow() const
     73//   {
     74//     ostringstream sortie;
     75//     // on passe l'induction magnetique en Gauss
     76//     sortie << "SOLENOID /l=" << lenghtElem_ << "  /aper=" << aperture_ << "  /iout=1 /h=" << 1000.*B0_  << endl;
     77//     return sortie.str();
     78//   }
    7979
    80 string elementSoleno::transportOutputFlow() const
    81   {
    82     ostringstream sortie;
    83     // on passe la longueur en metres
    84     sortie << label_ << ":" << "  SOLENOID, L=" << 0.01*lenghtElem_ << ", B=" << B0_ << ";" << endl;
    85     if ( varyB0_ ) {
    86       sortie <<  "  VARY, " << label_+"[B]"  << ";" << endl;
    87     }
    88     return sortie.str();
    89   }
     80// string elementSoleno::transportOutputFlow() const
     81//   {
     82//     ostringstream sortie;
     83//     // on passe la longueur en metres
     84//     sortie << specificName_ << ":" << "  SOLENOID, L=" << 0.01*lenghtElem_ << ", B=" << B0_ << ";" << endl;
     85//     if ( varyB0_ ) {
     86//       sortie <<  "  VARY, " << specificName_+"[B]"  << ";" << endl;
     87//     }
     88//     return sortie.str();
     89//   }
    9090
    9191string elementSoleno::FileOutputFlow() const
     
    9393    ostringstream sortie;
    9494    //    sortie << elementName_.getElementType() << endl;
    95     sortie << elementName_.getElementLabel() << endl;
    96     sortie  << label_ << endl;
     95    sortie << elementName_.getGenericLabel() << endl;
     96    sortie  << specificName_ << endl;
    9797    sortie << lenghtElem_ << "  " << aperture_<< " "  << B0_ << " " << varyB0_ << endl;
    9898    return sortie.str();
    9999  }
    100100
     101
     102vector< pair<string, vector<string> > > elementSoleno::parametersToSoftware () const {
     103  vector< pair<string, vector<string> > >  sortie;
     104  sortie.push_back( pair<string, vector<string> >("labelsGenericSpecific",  vector<string>() ) );
     105  sortie.back().second.push_back(elementName_.getGenericLabel());
     106  sortie.back().second.push_back(specificName_);
     107  sortie.push_back( pair<string, vector<string> >("lenghtAperture",  vector<string>() ) );
     108  sortie.back().second.push_back(mixedTools::doubleToString(lenghtElem_));
     109  sortie.back().second.push_back(mixedTools::doubleToString(aperture_));
     110  sortie.push_back( pair<string, vector<string> >("field",  vector<string>() ) );
     111  sortie.back().second.push_back(mixedTools::doubleToString(B0_));
     112  sortie.push_back( pair<string, vector<string> >("isBvariable",  vector<string>() ) );
     113  sortie.back().second.push_back(mixedTools::intToString(varyB0_));
     114  return sortie;
     115}
     116
     117
    101118void elementSoleno::FileInput(ifstream& ifs)
    102119{
    103   ifs >> label_;
     120  ifs >> specificName_;
    104121  ifs >> lenghtElem_ >>  aperture_ >> B0_ >> varyB0_ ;
    105122}
     
    109126    string txt = "";
    110127
    111     txt += label_;
     128    txt += specificName_;
    112129    txt += "\nlength (cm) : ";
    113130    txt += mixedTools::doubleToString(lenghtElem_);
  • Interface_Web/trunk/pspaWT/sources/controler/src/nomDeLogiciel.cc

    r316 r418  
    77    else if ( s == "transport" ) return transport;
    88    else if ( s == "generator" ) return generator;
     9    else if ( s == "useraction" ) return useraction;
    910    else if ( s == "test" ) return test;
    1011    return unknownSoftware;
     
    1819      case transport : { return "transport"; }
    1920      case generator : { return "generator"; }
     21      case useraction : { return "useraction"; }
    2022      case test : { return "test"; }
    2123      case unknownSoftware : { return "unknownSoftware"; }
     
    2426  }
    2527
     28    /** Color of the background of the sofware
     29     Should be a valid Css name as FFEEDD
     30     */
     31 std::string nomDeLogiciel::getWtColor( nomDeLogiciel::Logiciel lg) const
     32  {
     33    switch (lg)
     34      {
     35      case parmela : { return "#e09bdf"; }
     36      case transport : { return "#c0ea8e"; }
     37      case generator : { return "#a3c0ed"; }
     38      case useraction : { return "#FFFFFF"; }
     39      case test : { return "#ecc38e"; }
     40      case unknownSoftware : { return "#FFFFFF"; }
     41      }
     42    return "#FFFFFF";
     43  }
     44
     45
    2646 nomDeLogiciel::nomDeLogiciel() 
    2747  {
    28     program_ = transport;
     48    program_ = unknownSoftware;
    2949    progString_ = toString(program_);
    3050    //    value_ = toValue(program_);
  • Interface_Web/trunk/pspaWT/sources/controler/src/nomdElements.cc

    r373 r418  
    44#include "nomdElements.h"
    55
    6 typedElement nomdElements::fromString(std::string s)
     6nomdElements::typedElement nomdElements::fromString(std::string s)
    77{
    88  if( strstr(s.c_str(),"beam") ) return beam;
     
    1717}
    1818
    19 typedElement nomdElements::fromLabel(std::string s)
     19nomdElements::typedElement nomdElements::fromGenericLabel(std::string s)
    2020{
    2121  if( s == "beam" ) return beam;
     
    3030}
    3131
    32 std::string nomdElements::toName(typedElement eType)
     32std::string nomdElements::toExpandedName(nomdElements::typedElement eType)
    3333{
    3434  switch(eType) {
     
    4545}
    4646
    47 std::string nomdElements::toLabel(typedElement eType)
     47std::string nomdElements::toGenericLabel(nomdElements::typedElement eType)
    4848{
    4949  switch(eType) {
     
    6060}
    6161
    62 unsigned nomdElements::toNbParam(typedElement eType)
     62unsigned nomdElements::toNbParam(nomdElements::typedElement eType)
    6363{
    6464  switch(eType) {
     
    7979{
    8080  e_= fromString("");
    81   eName_ = toName(e_);
    82   eLabel_ = toLabel(e_);
     81  expandedName_ = toExpandedName(e_);
     82  genericLabel_ = toGenericLabel(e_);
    8383  nbParam_ = toNbParam(e_);
    8484}
     
    8787{
    8888  e_= ne.e_;
    89   eName_ = ne.eName_;
    90   eLabel_ = ne.eLabel_;
     89  expandedName_ = ne.expandedName_;
     90  genericLabel_ = ne.genericLabel_;
    9191  nbParam_ = ne.nbParam_;
    9292}
     
    9595{
    9696  e_= ne.e_;
    97   eName_ = ne.eName_;
    98   eLabel_ = ne.eLabel_;
     97  expandedName_ = ne.expandedName_;
     98  genericLabel_ = ne.genericLabel_;
    9999  nbParam_ = ne.nbParam_;
    100100}
     
    104104{
    105105  e_= fromString(s);
    106   eName_ = toName(e_);
    107   eLabel_ = toLabel(e_);
     106  expandedName_ = toExpandedName(e_);
     107  genericLabel_ = toGenericLabel(e_);
    108108  nbParam_ = toNbParam(e_);
    109109}
    110110
    111 nomdElements::nomdElements(typedElement& eType)
     111nomdElements::nomdElements(nomdElements::typedElement& eType)
    112112{
    113113  e_= eType;
    114   eName_ = toName(e_);
    115   eLabel_ = toLabel(e_);
     114  expandedName_ = toExpandedName(e_);
     115  genericLabel_ = toGenericLabel(e_);
    116116  nbParam_ = toNbParam(e_);
    117117}
     
    121121}
    122122
    123 std::string nomdElements::getLabelFromType(typedElement tp)
     123std::string nomdElements::getLabelFromType(nomdElements::typedElement tp)
    124124{
    125   return toLabel(tp);
     125  return toGenericLabel(tp);
    126126}
    127127
    128 typedElement nomdElements::getTypeFromLabel(std::string lb)
     128nomdElements::typedElement nomdElements::getTypeFromLabel(std::string lb)
    129129{
    130   return fromLabel(lb);
     130  return fromGenericLabel(lb);
    131131}
    132132
    133133
    134 typedElement nomdElements::getElementType() const {
     134nomdElements::typedElement nomdElements::getElementType() const {
    135135  return e_;
    136136}
    137137
    138 std::string nomdElements::getElementName() const {
    139   return eName_;
     138std::string nomdElements::getExpandedName() const {
     139  return expandedName_;
    140140}
    141141
    142 std::string nomdElements::getElementLabel() const {
    143   return eLabel_;
     142std::string nomdElements::getGenericLabel() const {
     143  return genericLabel_;
    144144}
    145145
     
    156156{
    157157  e_= ne.e_;
    158   eName_ = ne.eName_;
    159   eLabel_ = ne.eLabel_;
     158  expandedName_ = ne.expandedName_;
     159  genericLabel_ = ne.genericLabel_;
    160160  nbParam_ = ne.nbParam_;
    161161  return *this;
  • Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc

    r417 r418  
    392392 
    393393  if ( index >  2 && index < 5 ) {
     394    cout << " particleBeam::particlesPhaseSpaceComponent traitement vitesses " << endl;
    394395    for (unsigned i = 0; i < relativePartic_.size(); ++i) {
    395396      double begamz = relativePartic_.at(i).getBetaGamma().getComponent(2);
     
    400401      }
    401402    }
     403    cout << " particleBeam::particlesPhaseSpaceComponent traitement vitesses TERMINE " << endl;
    402404    return;
    403405  }
  • Interface_Web/trunk/pspaWT/sources/controler/src/softwareGenerator.cc

    r417 r418  
    1515{
    1616  nameOfSoftware_ = nomDeLogiciel("generator");
     17  registerElement(nomdElements::beam,TBoolOk);
    1718}
    1819
     
    2627  elPtr = dataManager_->getElementPointerFromNumero(numeroDeb_);
    2728
    28   if ( elPtr->getNomdElement().getElementType() != RFgun ) {
     29  if ( elPtr->getNomdElement().getElementType() != nomdElements::RFgun ) {
    2930    dataManager_->consoleMessage(" softwareGenerator::createInputFile : the element must be rfgun " );
    3031    cerr << " softwareGenerator::createInputFile : the element must be rfgun" << endl;
     
    4546  outfile << " Add=FALSE, N_add=0" << endl;
    4647  outfile << " Species='electrons'" << endl;
    47   outfile << elPtr->generatorOutputFlow() << endl;
     48  //  outfile << elPtr->generatorOutputFlow() << endl;
     49
     50  outfile << elementsData(elPtr->parametersToSoftware()) << endl;
     51
    4852  outfile << "/" << endl;
    4953  outfile.close();
     
    231235  return true;
    232236}
     237
     238
     239string softwareGenerator::elementsData(const vector< pair<string, vector<string> > >& donnees) const {
     240  unsigned k;
     241  cout << " PASSAGE softwareGenerator::elementsData " << endl;
     242  if ( donnees.at(0).first != "labelsGenericSpecific" ) {
     243    cout << " softwareGenerator::elementsData ERROR : element badly defined " << endl;
     244    return string();
     245  }
     246  string genericName = donnees.at(0).second.at(0);
     247  if ( genericName == "rfgun" ) return rfgunData(donnees);
     248  return string();
     249}
     250
     251string softwareGenerator::rfgunData(const vector< pair<string, vector<string> > >& donnees) const {
     252
     253  cout << " PASSAGE softwareGenerator::rfgunData " << endl;
     254  string nmacrop = "0";
     255  string sigma_t = "0.0";
     256  string sigma_r = "0.0";
     257  string emit_x = "0.0";
     258  string emit_y = "0.0";
     259  string E_cin = "0.0";
     260  string sigma_E = "0.0";
     261  string phaseStep = "0.0";
     262  string totalCharge = "0.0";
     263
     264  unsigned k;
     265  for ( k=1; k < donnees.size(); k++) {
     266    if ( donnees.at(k).first == "nbMacroparticles" ) {
     267      nmacrop = donnees.at(k).second.at(0);
     268    } else if ( donnees.at(k).first == "sigmasTR" ) {
     269      sigma_t = donnees.at(k).second.at(0);
     270      sigma_r = donnees.at(k).second.at(1);
     271    } else if ( donnees.at(k).first == "emittancesXY" ) {
     272      emit_x = donnees.at(k).second.at(0);
     273      emit_y = donnees.at(k).second.at(1);
     274    } else if ( donnees.at(k).first == "kineticE" ) {
     275      E_cin = donnees.at(k).second.at(0);
     276      sigma_E = donnees.at(k).second.at(1);
     277    } else if ( donnees.at(k).first == "phaseStep" ) {
     278      phaseStep = donnees.at(k).second.at(0);
     279    } else if ( donnees.at(k).first == "totalCharge" ) {
     280      totalCharge = donnees.at(k).second.at(0);
     281    }
     282  }
     283  ostringstream sortie;
     284
     285
     286    sortie << "Ipart=" << nmacrop << endl;
     287
     288    sortie << "Probe=.True." << endl;
     289    sortie << "Noise_reduc=.T" << endl;
     290    sortie << "Cathode=.T." << endl;
     291    sortie << "Q_total=" << totalCharge << endl;
     292    sortie << "Ref_zpos=0.0" << endl;
     293    sortie << "Ref_clock=0.0" << endl;
     294    sortie << "Ref_Ekin=" << E_cin << endl; // tjs en MeV
     295    sortie << "Dist_z='g'" << endl;
     296    sortie << "sig_clock=" << 1.0e-3*atof(sigma_t.c_str()) << endl; // passage de ps en ns
     297    sortie <<  "Dist_pz='g', sig_Ekin=" << 1000.*atof(sigma_E.c_str()) << ",  emit_z=0.0 ,    cor_Ekin=0.0 " << endl;  // passage en keV
     298    sortie << "Dist_x='gauss',  sig_x=" <<  10.*atof(sigma_r.c_str()) << endl;    // passage en mm
     299    sortie << "Dist_px='g', Nemit_x=" << emit_x << ",   cor_px=0.0" << endl;
     300    sortie << "Dist_y='gauss',  sig_y=" <<  10.*atof(sigma_r.c_str()) << endl;    // passage en mm
     301    sortie << "Dist_py='g', Nemit_y=" << emit_y << ",   cor_py=0.0" << endl;
     302 
     303  return sortie.str();
     304}
  • Interface_Web/trunk/pspaWT/sources/controler/src/softwareParmela.cc

    r417 r418  
    66#include "dataManager.h"
    77#include "mixedTools.h"
    8 //#include "nomDeLogiciel.h"
     8
    99softwareParmela::softwareParmela() : abstractSoftware()
    1010{
     
    1515{
    1616  nameOfSoftware_ = nomDeLogiciel("parmela");
     17  registerElement(nomdElements::RFgun,TBoolOk);
     18  registerElement(nomdElements::drift,TBoolOk);
     19  registerElement(nomdElements::cell,TBoolOk);
     20  registerElement(nomdElements::bend,TBoolOk);
     21  registerElement(nomdElements::soleno,TBoolOk);
     22  registerElement(nomdElements::fit,TBoolIgnore);
     23  registerElement(nomdElements::snapshot,TBoolIgnore);
    1724}
    1825
     
    2330  abstractElement* elPtr = dataManager_->getElementPointerFromNumero(numeroDeb_);
    2431
    25   bool there_is_rfgun = ( elPtr->getNomdElement().getElementType() == RFgun );
     32  bool there_is_rfgun = ( elPtr->getNomdElement().getElementType() == nomdElements::RFgun );
    2633  unsigned offsetNumElem;
    2734  // les elements de parmela sont indexes de 1 à max, s'il n'y a pas de rfgun
     
    4047    abstractElement* elem = dataManager_->getElementPointerFromNumero(k);
    4148    cout << " liste PARMELA no absolu " << k << " relatif provisoire " << relativeParmelaElementIndices_.at(curseur) << endl;
    42     if ( elem->is_accepted_by_software(nameOfSoftware_) == TBoolOk ) {
     49    // if ( elem->is_accepted_by_software(nameOfSoftware_) == TBoolOk ) {
     50    if ( doAcceptElement(elem->getNomdElement().getElementType() )  == TBoolOk ) {
    4351      relativeParmelaElementIndices_.at(curseur) = id;
    4452      cout << " mis a " << id << endl;
     
    6775  double initalKineticEnergy = 0.0;
    6876  elPtr = dataManager_->getElementPointerFromNumero(numeroDeb_);
    69   bool there_is_rfgun = ( elPtr->getNomdElement().getElementType() == RFgun );
     77  bool there_is_rfgun = ( elPtr->getNomdElement().getElementType() == nomdElements::RFgun );
    7078 
    7179  if ( !there_is_rfgun ) {
     
    8896  unsigned int premier = numeroDeb_ ;
    8997  if ( there_is_rfgun ) {
    90     outfile << dataManager_->getElementPointerFromNumero(numeroDeb_)->parmelaOutputFlow();
     98    //    outfile << dataManager_->getElementPointerFromNumero(numeroDeb_)->parmelaOutputFlow();
     99    outfile << elementsData(dataManager_->getElementPointerFromNumero(numeroDeb_)->parametersToSoftware());
    91100    premier++;
    92101  } else {
     
    98107      elPtr = dataManager_->getElementPointerFromNumero(k);
    99108      if (elPtr) {
    100         outfile << elPtr->parmelaOutputFlow();
     109        //      outfile << elPtr->parmelaOutputFlow();
     110        outfile << elementsData(elPtr->parametersToSoftware());
    101111      }
    102112    }
     
    185195          unsigned numeroParmel;
    186196          numeroParmel = (unsigned)relativeParmelaElementIndices_.at(curseur);
    187           cout << " lecture PARMELA el no absolu " << k << " numero relatif " << numeroParmel << " nom " << elem->getNomdElement().getElementName() << endl;
     197          cout << " lecture PARMELA el no absolu " << k << " numero relatif " << numeroParmel << " nom " << elem->getNomdElement().getExpandedName() << endl;
    188198        // lecture sortie parmela
    189199        if(!beamFromParmela(workingDir,numeroParmel,freq,centroid,refPart,particles))
     
    338348    return true;
    339349}
     350
     351
     352string softwareParmela::elementsData(const vector< pair<string, vector<string> > >& donnees) const {
     353  unsigned k;
     354  cout << " PASSAGE softwareParmela::elementsData " << endl;
     355  if ( donnees.at(0).first != "labelsGenericSpecific" ) {
     356    cout << " softwareParmela::elementsData ERROR : element badly defined " << endl;
     357    return string();
     358  }
     359  string genericName = donnees.at(0).second.at(0);
     360  if ( genericName == "rfgun" ) return rfgunData(donnees);
     361  if ( genericName == "cell" ) return cellData(donnees);
     362  if ( genericName == "drift" ) return driftData(donnees);
     363  if ( genericName == "solnd" ) return solenoData(donnees);
     364  if ( genericName == "bend" ) return bendData(donnees);
     365  return string();
     366}
     367
     368string softwareParmela::rfgunData(const vector< pair<string, vector<string> > >& donnees) const {
     369
     370  cout << " PASSAGE softwareParmela::rfgunData " << endl;
     371  string nmacrop = "0";
     372  string sigma_t = "0.0";
     373  string sigma_r = "0.0";
     374  string E_cin = "0.0";
     375  string sigma_E = "0.0";
     376  string phaseStep = "0.0";
     377  string totalCharge = "0.0";
     378
     379  unsigned k;
     380  for ( k=1; k < donnees.size(); k++) {
     381    if ( donnees.at(k).first == "nbMacroparticles" ) {
     382      nmacrop = donnees.at(k).second.at(0);
     383    } else if ( donnees.at(k).first == "sigmasTR" ) {
     384      sigma_t = donnees.at(k).second.at(0);
     385      sigma_r = donnees.at(k).second.at(1);
     386    } else if ( donnees.at(k).first == "kineticE" ) {
     387      E_cin = donnees.at(k).second.at(0);
     388      sigma_E = donnees.at(k).second.at(1);
     389    } else if ( donnees.at(k).first == "phaseStep" ) {
     390      phaseStep = donnees.at(k).second.at(0);
     391    } else if ( donnees.at(k).first == "totalCharge" ) {
     392      totalCharge = donnees.at(k).second.at(0);
     393    }
     394  }
     395  ostringstream sortie;
     396  // on prend les troncatures tmax et rmax à 3 sigmas
     397  sortie << "INPUT 10 /np=" << nmacrop << "  /sigt=" << sigma_t << endl;
     398  sortie << "  /tmax=" << 3.3*atof(sigma_t.c_str()) << " /sigr=" << sigma_r << endl;
     399  sortie << " /rmax=" << 3.0*atof(sigma_r.c_str()) << " /W0=" << E_cin << " /dw0=" << sigma_E << endl;
     400  sortie << " /dwt=" << phaseStep << " /ran=2" << endl;
     401
     402  // on doit entrer le nb vrai de part. (avec signe moins)
     403  sortie << "SCHEFF /beami=" << -fabs( atof(totalCharge.c_str()) )/ELECTRONANOCOULOMB << " /nprog=2 /point=-1.7"  << endl;
     404 
     405  return sortie.str();
     406}
     407
     408string softwareParmela::cellData(const vector< pair<string, vector<string> > >& donnees) const {
     409  cout << " PASSAGE softwareParmela::cellData " << endl;
     410
     411  string lenght = "0.0";
     412  string aperture = "0.0";
     413  string initialPhase = "0.0";
     414  string acceleratingField = "0.0";
     415  string phaseStepMax = "0.0";
     416  string acceleratingShapeFile = "";
     417  string focusingMagFile = "";
     418  string offsetMag = "0.0";
     419  string scaleFactor = "0.0";
     420
     421  unsigned k;
     422  for ( k=1; k < donnees.size(); k++) {
     423    if ( donnees.at(k).first == "lenghtAperture" ) {
     424      lenght = donnees.at(k).second.at(0);
     425      aperture = donnees.at(k).second.at(1);
     426    } else if ( donnees.at(k).first == "phaseInitialStepmax" ) {
     427      initialPhase = donnees.at(k).second.at(0);
     428      phaseStepMax = donnees.at(k).second.at(1);
     429    } else if ( donnees.at(k).first == "fieldValueFile" ) {
     430      acceleratingField = donnees.at(k).second.at(0);
     431      acceleratingShapeFile = donnees.at(k).second.at(1);
     432    } else if ( donnees.at(k).first == "MagFocusingFileOffsetScale") {
     433      focusingMagFile = donnees.at(k).second.at(0);
     434      offsetMag = donnees.at(k).second.at(1);
     435      scaleFactor = donnees.at(k).second.at(2);
     436    }
     437  }
     438  ostringstream sortie;
     439    sortie << "CELL /l=" << lenght << "  /aper=" << aperture << endl;
     440    sortie << "  /iout=1  /phi0=" << initialPhase << " /E0=" << acceleratingField << endl;
     441    sortie << " /nc=1 /dwtmax=" << phaseStepMax << " /sym=-1" << endl;
     442    sortie << "CFIELD 1" << endl;
     443    sortie << acceleratingShapeFile << endl;
     444    if ( focusingMagFile != "") {
     445      sortie << "POISSON /zoff=" << offsetMag << " /rmult=" << scaleFactor << endl;
     446      sortie << focusingMagFile << endl;
     447    }
     448  return sortie.str();
     449
     450}
     451
     452string softwareParmela::driftData(const vector< pair<string, vector<string> > >& donnees) const {
     453  cout << " PASSAGE softwareParmela::driftData " << endl;
     454
     455  string lenght = "0.0";
     456  string aperture = "0.0";
     457
     458  unsigned k;
     459  for ( k=1; k < donnees.size(); k++) {
     460    if ( donnees.at(k).first == "lenghtAperture" ) {
     461      lenght = donnees.at(k).second.at(0);
     462      aperture = donnees.at(k).second.at(1);
     463    }
     464  }
     465  ostringstream sortie;
     466  sortie << "DRIFT /l=" << lenght << "  /aper=" << aperture << "  /iout=1" << endl;
     467  return sortie.str();
     468}
     469
     470string softwareParmela::solenoData(const vector< pair<string, vector<string> > >& donnees) const {
     471  cout << " PASSAGE softwareParmela::solenoData " << endl;
     472  string lenght = "0.0";
     473  string aperture = "0.0";
     474  string B0 = "0.0";
     475
     476  unsigned k;
     477  for ( k=1; k < donnees.size(); k++) {
     478    if ( donnees.at(k).first == "lenghtAperture" ) {
     479      lenght = donnees.at(k).second.at(0);
     480      aperture = donnees.at(k).second.at(1);
     481    } else if ( donnees.at(k).first == "field" ) {
     482      B0 = donnees.at(k).second.at(0);
     483    }
     484  }
     485    ostringstream sortie;
     486    // on passe l'induction magnetique en Gauss
     487    sortie << "SOLENOID /l=" << lenght << "  /aper=" << aperture << "  /iout=1 /h=" << 1000.*atof(B0.c_str())  << endl;
     488    return sortie.str();
     489
     490}
     491
     492string softwareParmela::bendData(const vector< pair<string, vector<string> > >& donnees) const {
     493  cout << " PASSAGE softwareParmela::bendData " << endl;
     494
     495  string lenght = "0.0";
     496  string aperture = "0.0";
     497  string angleDeg = "0.0";
     498  string momentum = "0.0";
     499  string beta1 = "0.0";
     500  string beta2 = "0.0";
     501  unsigned k;
     502  for ( k=1; k < donnees.size(); k++) {
     503    if ( donnees.at(k).first == "lenghtAperture" ) {
     504      lenght = donnees.at(k).second.at(0);
     505      aperture = donnees.at(k).second.at(1);
     506    } else if ( donnees.at(k).first == "angleDegre" ) {
     507      angleDeg = donnees.at(k).second.at(0);
     508    } else if ( donnees.at(k).first == "momentum" ) {
     509      momentum = donnees.at(k).second.at(0);
     510     } else if ( donnees.at(k).first == "rotatedFaces" ) {
     511      beta1 = donnees.at(k).second.at(0);
     512      beta2 = donnees.at(k).second.at(1);
     513    }   
     514  }
     515
     516  double ecin = atof(momentum.c_str())/EREST_MeV;
     517    ecin = ecin*ecin + 1.;
     518    ecin = EREST_MeV*(sqrt(ecin) - 1.0);
     519
     520    ostringstream sortie;
     521    // il faut entrer l'energie cinetique
     522    sortie << "BEND /l=" << lenght << "  / aper=" << aperture << "  / iout=1 / wr=" << ecin << " /alpha=" << angleDeg << " / beta1=" << beta1;
     523    sortie << " / beta2=" << beta2  << endl;
     524
     525    return sortie.str();
     526
     527}
  • Interface_Web/trunk/pspaWT/sources/controler/src/softwareTransport.cc

    r413 r418  
    1414{
    1515  nameOfSoftware_ = nomDeLogiciel("transport");
     16  registerElement(nomdElements::beam,TBoolOk);
     17  registerElement(nomdElements::drift,TBoolOk);
     18  registerElement(nomdElements::bend,TBoolOk);
     19  registerElement(nomdElements::soleno,TBoolOk);
     20  registerElement(nomdElements::fit,TBoolOk);
     21  registerElement(nomdElements::snapshot,TBoolIgnore);
    1622}
    1723
     
    5258
    5359  // Dans le cas où le premier element n'est pas beam
    54   if ( premierEl->getNomdElement().getElementType() != beam ) {
     60  if ( premierEl->getNomdElement().getElementType() != nomdElements::beam ) {
    5561    // s'il n'y a pas faisceau courant, erreur
    5662    if ( beamBefore == NULL ) {
     
    8591    {
    8692      elPtr = dataManager_->getElementPointerFromNumero(k);
    87       cout << "debug:: element [" << k << "] " << elPtr->getNomdElement().getElementName() << endl;
    88       outfile << elPtr->transportOutputFlow();
     93      cout << "debug:: element [" << k << "] " << elPtr->getNomdElement().getExpandedName() << endl;
     94      //      outfile << elPtr->transportOutputFlow();
     95      outfile << elementsData(elPtr->parametersToSoftware());
    8996    }
    9097
     
    150157
    151158
    152       if ( ptr->is_accepted_by_software(nameOfSoftware_) != TBoolOk ) {
     159      // if ( ptr->is_accepted_by_software(nameOfSoftware_) != TBoolOk ) {
     160      if ( doAcceptElement(ptr->getNomdElement().getElementType())  != TBoolOk ) {
     161
    153162        // si l'element doit etre ignore, on renvoie sur le diag precedent
    154163        dataManager_->updateCurrentDiagnostic(false);
     
    241250  return moments.readFromTransportOutput(fichierStream);
    242251}
     252
     253string softwareTransport::elementsData(const vector< pair<string, vector<string> > >& donnees) const {
     254  unsigned k;
     255  cout << " PASSAGE softwareTransport::elementsData " << endl;
     256  if ( donnees.at(0).first != "labelsGenericSpecific" ) {
     257    cout << " softwareTransport::elementsData ERROR : element badly defined " << endl;
     258    return string();
     259  }
     260  string genericName = donnees.at(0).second.at(0);
     261  if ( genericName == "beam" ) return beamData(donnees);
     262  if ( genericName == "drift" ) return driftData(donnees);
     263  if ( genericName == "solnd" ) return solenoData(donnees);
     264  if ( genericName == "bend" ) return bendData(donnees);
     265  if ( genericName == "fit" ) return fitData(donnees);
     266  return string();
     267}
     268
     269string softwareTransport::beamData(const vector< pair<string, vector<string> > >& donnees) const {
     270
     271  cout << " PASSAGE softwareTransport::beamData " << endl;
     272  double x = 0.0;
     273  double xp = 0.0;
     274  double y = 0.0;
     275  double yp = 0.0;
     276  double dl = 0.0;
     277  double del = 0.0;
     278  double p0 = 0.0;
     279  string specificName = "";
     280
     281  unsigned k;
     282  for ( k=0; k < donnees.size(); k++) {
     283    if ( donnees.at(k).first == "transverseCoordinates" ) {
     284      x = atof( donnees.at(k).second.at(0).c_str() );
     285      xp = atof( donnees.at(k).second.at(1).c_str() );
     286      y = atof( donnees.at(k).second.at(2).c_str() );
     287      yp = atof( donnees.at(k).second.at(3).c_str() );
     288    } else if ( donnees.at(k).first == "longitudinalCoordinates" ) {
     289      dl = atof( donnees.at(k).second.at(0).c_str() );
     290      del = atof( donnees.at(k).second.at(1).c_str() );
     291    } else if ( donnees.at(k).first == "momentum" ) {
     292      p0 = atof( donnees.at(k).second.at(0).c_str() );
     293    } else if ( donnees.at(k).first == "labelsGenericSpecific" ) {
     294      specificName = donnees.at(k).second.at(1);
     295    }
     296  }
     297  ostringstream sortie;
     298    beam2Moments moments(x, xp, y, yp, dl, del);
     299    sortie << specificName << ":" << moments.writeToTransportInput(p0) << endl;
     300    return sortie.str();
     301  return sortie.str();
     302}
     303
     304string softwareTransport::driftData(const vector< pair<string, vector<string> > >& donnees) const {
     305  cout << " PASSAGE softwareTransport::driftData " << endl;
     306
     307  string lenght = "0.0";
     308  string specificName = "";
     309
     310  unsigned k;
     311  for ( k=0; k < donnees.size(); k++) {
     312    if ( donnees.at(k).first == "lenghtAperture" ) {
     313      lenght = donnees.at(k).second.at(0);
     314    } else if ( donnees.at(k).first == "labelsGenericSpecific" ) {
     315      specificName = donnees.at(k).second.at(1);
     316    }
     317  }
     318  ostringstream sortie;
     319    // longueur en m
     320  sortie << specificName << ":" << "  DRIFT, L=" << 0.01*atof(lenght.c_str()) << ";" << endl;
     321  return sortie.str();
     322}
     323
     324
     325string softwareTransport::solenoData(const vector< pair<string, vector<string> > >& donnees) const {
     326  cout << " softwareTransport::solenoData " << endl;
     327  string lenght = "0.0";
     328  string B0 = "0.0";
     329  string varyB0 = "0";
     330  string specificName = "";
     331
     332
     333  unsigned k;
     334  for ( k=0; k < donnees.size(); k++) {
     335    if ( donnees.at(k).first == "lenghtAperture" ) {
     336      lenght = donnees.at(k).second.at(0);
     337    } else if ( donnees.at(k).first == "field" ) {
     338      B0 = donnees.at(k).second.at(0);
     339    } else if ( donnees.at(k).first == "isBvariable" ) {
     340      varyB0 = donnees.at(k).second.at(0);
     341    } else if ( donnees.at(k).first == "labelsGenericSpecific" ) {
     342      specificName = donnees.at(k).second.at(1);
     343    }
     344  }
     345    ostringstream sortie;
     346    // on passe la longueur en metres
     347    sortie << specificName << ":" << "  SOLENOID, L=" << 0.01*atof (lenght.c_str()) << ", B=" << B0 << ";" << endl;
     348    if ( atoi(varyB0.c_str()) ) {
     349      sortie <<  "  VARY, " << specificName+"[B]"  << ";" << endl;
     350    }
     351    return sortie.str();
     352
     353}
     354
     355
     356string softwareTransport::bendData(const vector< pair<string, vector<string> > >& donnees) const {
     357
     358  cout << " softwareTransport::bendData " << endl;
     359
     360  string lenght = "0.0";
     361  string radius = "0.0";
     362  string angleDeg = "0.0";
     363  string beta1 = "0.0";
     364  string beta2 = "0.0";
     365
     366
     367
     368  string specificName = "";
     369
     370  unsigned k;
     371  for ( k=0; k < donnees.size(); k++) {
     372    if ( donnees.at(k).first == "lenghtAperture" ) {
     373      lenght = donnees.at(k).second.at(0);
     374    } else if ( donnees.at(k).first == "angleDegre" ) {
     375      angleDeg = donnees.at(k).second.at(0);
     376    } else if ( donnees.at(k).first == "radius" ) {
     377      radius = donnees.at(k).second.at(0);
     378     } else if ( donnees.at(k).first == "rotatedFaces" ) {
     379      beta1 = donnees.at(k).second.at(0);
     380      beta2 = donnees.at(k).second.at(1);
     381    } else if ( donnees.at(k).first == "labelsGenericSpecific" ) {
     382      specificName = donnees.at(k).second.at(1);
     383    }   
     384  }
     385
     386    ostringstream sortie;
     387    sortie << specificName << ":" << "  SBEND, RADIUS=" << radius << ", ANGLE=" << angleDeg << ", E1=" << beta1 << ", E2=" << beta2 << ";" << endl;
     388    return sortie.str();
     389
     390}
     391
     392
     393string softwareTransport::fitData(const vector< pair<string, vector<string> > >& donnees) const {
     394  cout << " softwareTransport::fitData " << endl;
     395  string variableName = "";
     396  string variableValue = "0.0";
     397  string tolerance = "0.0";
     398  string specificName = "";
     399
     400  unsigned k;
     401  for ( k=0; k < donnees.size(); k++) {
     402    if ( donnees.at(k).first == "variable") {
     403      variableName = donnees.at(k).second.at(0);
     404      variableValue = donnees.at(k).second.at(1);
     405      tolerance = donnees.at(k).second.at(2);
     406    } else if ( donnees.at(k).first == "labelsGenericSpecific" ) {
     407      specificName = donnees.at(k).second.at(1);
     408    }   
     409  }
     410    ostringstream sortie;
     411    sortie << specificName << ":" << "  FIT," << variableName << " = " << variableValue << ", TOLER = " << tolerance << " ;" << endl;
     412    if ( variableName == "R11" || variableName == "R22" || variableName == "R12" || variableName == "R21" ) {
     413        sortie << " PRINT, TRANS;" << endl;
     414    }
     415    return sortie.str();
     416}
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_elementLigneFaisceau.h

    r375 r418  
    3333   
    3434    GWt_elementLigneFaisceau(PspaApplication*);
    35     GWt_elementLigneFaisceau(typedElement,PspaApplication*);
     35    GWt_elementLigneFaisceau(nomdElements::typedElement,PspaApplication*);
    3636   
    3737    ~GWt_elementLigneFaisceau();
     
    6868    void removeDone(GWt_abstractElement*);
    6969    std::string getElementNumberInBeamLine(nomdElements el);
    70     void initialize_ligneFaisceau(typedElement eType);
     70    void initialize_ligneFaisceau(nomdElements::typedElement eType);
    7171    void mouseWentOut();
    7272    void mouseWentOver();
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_ligneFaisceau.h

    r401 r418  
    4343     and we center everything
    4444     */
    45     GWt_abstractElement* addElement(typedElement eType, GWt_dropZoneLigneFaisceau* dropContainer);
    46     GWt_abstractElement* addElement(typedElement eType);
     45    GWt_abstractElement* addElement(nomdElements::typedElement eType, GWt_dropZoneLigneFaisceau* dropContainer);
     46    GWt_abstractElement* addElement(nomdElements::typedElement eType);
    4747   
    4848    void removeElement(GWt_abstractElement*);
     
    5555    abstractElement* getAbstractElement(int i);
    5656
    57     /** return the index of the abstract element
     57    /** return the numero (1.. infty) of the abstract element
    5858     @param : label of this abstractElement in the beam line
    5959     */
    60     int getAbstractElementIndexFromLabel(std::string str);
     60    int getAbstractElementNumeroFromLabel(std::string txt);
    6161
    6262    //    void restoreElementCollectionFromDataManager();
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_abstractElement.cc

    r365 r418  
    5353      if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) {
    5454        GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console"));
    55         console->addConsoleMessage(" GWt_abstractElement::beginDialog : empty parameter set for element " + abstractElement_->getNomdElement().getElementName());
     55        console->addConsoleMessage(" GWt_abstractElement::beginDialog : empty parameter set for element " + abstractElement_->getNomdElement().getExpandedName());
    5656        }
    5757    }
     
    6464        if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) {
    6565          GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console"));
    66           console->addConsoleMessage(" element seems not to be a " + abstractElement_->getNomdElement().getElementName());
     66          console->addConsoleMessage(" element seems not to be a " + abstractElement_->getNomdElement().getExpandedName());
    6767        }
    6868    }
    6969 
    70   dialog_ = new WDialog("element " + abstractElement_->getNomdElement().getElementName());
     70  dialog_ = new WDialog("element " + abstractElement_->getNomdElement().getExpandedName());
    7171    new WText(" label of the element : ",dialog_->contents());
    7272    //  labelEdit_ = new WLineEdit(param[++compteur].c_str(), dialog_->contents());
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_dropZoneLigneFaisceau.cc

    r343 r418  
    7171  // get the type of element
    7272  nomdElements e(evt.mimeType());
    73   typedElement eType = e.getElementType();
     73  nomdElements::typedElement eType = e.getElementType();
    7474  ligneFaisceau->addElement(eType, this);
    7575}
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementLigneFaisceau.cc

    r401 r418  
    3535    pspa_(pspa)
    3636{
    37   initialize_ligneFaisceau(inconnu);
    38 }
    39 
    40 
    41 GWt_elementLigneFaisceau::GWt_elementLigneFaisceau(typedElement type,PspaApplication* pspa)
     37  initialize_ligneFaisceau(nomdElements::inconnu);
     38}
     39
     40
     41GWt_elementLigneFaisceau::GWt_elementLigneFaisceau(nomdElements::typedElement type,PspaApplication* pspa)
    4242  : WContainerWidget(),
    4343    firstTimeInsertMessage_(NULL),
     
    5353}
    5454
    55 void GWt_elementLigneFaisceau::initialize_ligneFaisceau(typedElement eType)
     55void GWt_elementLigneFaisceau::initialize_ligneFaisceau(nomdElements::typedElement eType)
    5656{   
    5757  cout<<"new GWt_elementLigneFaisceau : "<< this << endl;
     
    6262  //     +----------+--------+---------+
    6363 
    64    
    6564  WGridLayout *gridLayout = new WGridLayout();
    6665   
     
    9493   
    9594  switch (  eType ) {
    96   case RFgun :
     95  case nomdElements::RFgun :
    9796    GWt_abstractElement_ = new GWt_rfgun(this);
    9897    break;
    99   case drift :
     98  case nomdElements::drift :
    10099    GWt_abstractElement_ = new GWt_drift(this);
    101100    break;
    102   case cell  :
     101  case nomdElements::cell  :
    103102    GWt_abstractElement_ = new GWt_cell(this);
    104103    break;
    105   case bend  :
     104  case nomdElements::bend  :
    106105    GWt_abstractElement_ = new GWt_bend(this);
    107106    break;
    108   case soleno  :
     107  case nomdElements::soleno  :
    109108    GWt_abstractElement_ = new GWt_soleno(this);
    110109    break;
    111   case beam  :
     110  case nomdElements::beam  :
    112111    GWt_abstractElement_ = new GWt_beam(this);
    113112    break;
    114   case fit  :
     113  case nomdElements::fit  :
    115114    GWt_abstractElement_ = new GWt_fit(this);
    116115    break;
    117   case snapshot :
     116  case nomdElements::snapshot :
    118117    {
    119118      int incr = pspa_->getExtensionFile();
     
    123122      break;
    124123    }
    125   case inconnu :
     124  case nomdElements::inconnu :
    126125    GWt_abstractElement_ = NULL;
    127126  }
     
    207206  if (getGWt_AbstractElement()->getAbstractElement()) {
    208207    if (getGWt_AbstractElement()->getAbstractElement()->getAbstractSoftware()) {
    209       setBGColor(WColor(getGWt_AbstractElement()->getAbstractElement()->getAbstractSoftware()->getColor()));
     208      //      setBGColor(WColor(getGWt_AbstractElement()->getAbstractElement()->getAbstractSoftware()->getColor()));
     209      setBGColor(WColor(getGWt_AbstractElement()->getAbstractElement()->getAbstractSoftware()->getNomDeLogiciel()->getColor()));
    210210      softwareName_->setText(getGWt_AbstractElement()->getAbstractElement()->getAbstractSoftware()->getName());
    211211
     
    278278   
    279279    if(n < 10) {
    280       str= elem.getElementLabel()+"0"+number;
     280      str= elem.getGenericLabel()+"0"+number;
    281281    } else {
    282       str= elem.getElementLabel()+number;
     282      str= elem.getGenericLabel()+number;
    283283    }
    284284  }
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_ligneFaisceau.cc

    r401 r418  
    5151
    5252
    53 GWt_abstractElement* GWt_LigneFaisceau::addElement(typedElement eType){
     53GWt_abstractElement* GWt_LigneFaisceau::addElement(nomdElements::typedElement eType){
    5454  return addElement(eType,NULL);
    5555}
    5656
    57 GWt_abstractElement* GWt_LigneFaisceau::addElement(typedElement eType, GWt_dropZoneLigneFaisceau* dropContainer )
     57GWt_abstractElement* GWt_LigneFaisceau::addElement(nomdElements::typedElement eType, GWt_dropZoneLigneFaisceau* dropContainer )
    5858{
    5959
     
    6666  // -dropContainer is NULL, insert in the last element
    6767 
    68   if(eType == inconnu) {
     68  if(eType == nomdElements::inconnu) {
    6969    cout << "GWt_LigneFaisceau::element type " << eType << " inconnu " << endl;
    7070    return NULL;
     
    222222
    223223
    224 int GWt_LigneFaisceau::getAbstractElementIndexFromLabel(std::string txt){
    225     int index = 0;
     224
     225int GWt_LigneFaisceau::getAbstractElementNumeroFromLabel(std::string txt){
     226    int index = 1;
    226227    if (txt == "") {
    227228        return NULL;
     
    246247
    247248
     249
     250
    248251int GWt_LigneFaisceau::getBeamLineSize() {
    249252  int count = 0;
     
    289292  vector <abstractElement*> elems = getAllAbstractElements();
    290293    for (int a=0; a< elems.size(); a++) {
    291         elems[a]->setSoftware(nomDeLogiciel::unknownSoftware);
    292     }
    293 }
    294 
    295 
     294      //     elems[a]->setSoftware(nomDeLogiciel::unknownSoftware);
     295      elems[a]->setSoftware( NULL );
     296    }
     297}
     298
     299
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc

    r417 r418  
    617617    seriesType = PointSeries;
    618618    titre = " phase space ";
     619    cout << " PspaApplication::faireDessinPhaseSpace APPEL " << endl;
    619620    beam->particlesPhaseSpaceData(xcor,ycor,legende,namex,namey);
     621    cout << " PspaApplication::faireDessinPhaseSpace RETOUR " << endl;
    620622  } else {
    621623    GWt_dialog warningBeamState(" graphical analysis", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true);
     
    882884  WCartesianChart *chart = new WCartesianChart(toto);
    883885  if (!makeIcon) chart->setTitle(title);
    884 
    885886  chart->initLayout(); 
    886887  chart->setModel(model);        // set the model
     
    931932    chart->axis(YAxis).setLabelFont(yAxisFont);
    932933  }
    933  
     934
    934935#ifdef HAS_IMAGEMAGIC
    935936  // no background
     
    950951*/
    951952 
    952 //  Wt::WPdfImage pdfImage("1000", "600");
    953   WPdfImage pdfImage("1000", "600");
     953  Wt::WPdfImage pdfImage("1000", "600");
    954954  {
    955955   Wt::WPainter p1(&pdfImage);
     
    963963
    964964#endif
     965
    965966}
    966967
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_serverFileSelector.cc

    r417 r418  
    5353    Wt::WTreeNode* treeFileRoot = new Wt::WTreeNode("Workspace", folderIcon);
    5454
    55     treeFileRoot->setStyleClass("example-tree");
     55    //    treeFileRoot->setStyleClass("example-tree");
    5656    treeRoot_->setTreeRoot(treeFileRoot);
    5757    treeFileRoot->label()->setTextFormat(Wt::PlainText);
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc

    r413 r418  
    329329 
    330330  for (int a = 0; a< sections_.size(); a++)
    331   {
    332     string debString = sections_[a]->getFirstElementCurrentText().toUTF8();
    333     string finString = sections_[a]->getLastElementCurrentText().toUTF8();
    334    
    335     int debut = pspa_->getBeamLine()->getAbstractElementIndexFromLabel(debString)+1; // FIXME : Should NOT be +1
    336     int fin = pspa_->getBeamLine()->getAbstractElementIndexFromLabel(finString)+1; // FIXME : Should NOT be +1
    337    
    338     nomDeLogiciel prog = nomDeLogiciel ( sections_[a]->getSoftwareCurrentText().toUTF8());
    339     dtmanage_->addSectionToExecute(pspa_->getBeamLine()->getAbstractElement(debut),
    340                                    debut,
    341                                    pspa_->getBeamLine()->getAbstractElement(fin),
    342                                    fin,
    343                                    dtmanage_->createSoftwareConnexion(prog));
    344    
    345     diagnosticErrors = "";
    346     diagnosticWarnings = "";
    347 
    348     // check sections
    349     for (int i=debut-1; i<fin; i++) {
    350       if (pspa_->getBeamLine()) {
    351         if (pspa_->getBeamLine()->getAbstractElement(i)) {
    352           trivaluedBool tb = pspa_->getBeamLine()->getAbstractElement(i)->setSoftware(prog.getString());
    353           if (tb  == TBoolError ) {
    354             // j'insiste pour remettre le nom generique de l'element refuse (glm / 30/03/2013)
    355             diagnosticErrors += pspa_->getBeamLine()->getAbstractElement(i)->getNomdElement().getElementName() + " is not allowed with "+ prog.getString()+"<br /> ";
    356 
    357             caMarche = false;
    358 
    359             // intialize thissoftware
    360             pspa_->getBeamLine()->getAbstractElement(i)->setSoftware(nomDeLogiciel::unknownSoftware);
    361 
    362           } else if ( tb == TBoolIgnore ) {
    363             diagnosticWarnings += pspa_->getBeamLine()->getAbstractElement(i)->getLabel() + " will be ignored by  "+ prog.getString()+"<br /> ";
    364            
    365 
    366           }
    367           pspa_->getBeamLine()->update(i);
    368         }
     331    {
     332      string debString = sections_[a]->getFirstElementCurrentText().toUTF8();
     333      string finString = sections_[a]->getLastElementCurrentText().toUTF8();
     334   
     335      // int debut = pspa_->getBeamLine()->getAbstractElementIndexFromLabel(debString)+1; // FIXME : Should NOT be +1
     336      // int fin = pspa_->getBeamLine()->getAbstractElementIndexFromLabel(finString)+1; // FIXME : Should NOT be +1
     337
     338      int debut = pspa_->getBeamLine()->getAbstractElementNumeroFromLabel(debString);
     339      int fin = pspa_->getBeamLine()->getAbstractElementNumeroFromLabel(finString);
     340   
     341      nomDeLogiciel prog = nomDeLogiciel ( sections_[a]->getSoftwareCurrentText().toUTF8());
     342      abstractSoftware* softToExec = dtmanage_->createSoftwareConnexion(prog);
     343      dtmanage_->addSectionToExecute(pspa_->getBeamLine()->getAbstractElement(debut),
     344                                     debut,
     345                                     pspa_->getBeamLine()->getAbstractElement(fin),
     346                                     fin,
     347                                     softToExec);
     348   
     349      diagnosticErrors = "";
     350      diagnosticWarnings = "";
     351
     352      // check sections
     353      for (int i=debut-1; i<fin; i++) {
     354        if (pspa_->getBeamLine()) {
     355          if (pspa_->getBeamLine()->getAbstractElement(i)) {
     356            //         trivaluedBool tb = pspa_->getBeamLine()->getAbstractElement(i)->setSoftware(prog.getString());
     357
     358
     359            trivaluedBool tb = softToExec->doAcceptElement(pspa_->getBeamLine()->getAbstractElement(i)->getNomdElement().getElementType() );
     360
     361            if (tb  == TBoolOk ) {
     362              pspa_->getBeamLine()->getAbstractElement(i)->setSoftware(softToExec);
     363            } else {
     364              pspa_->getBeamLine()->getAbstractElement(i)->setSoftware( NULL );
     365
     366              if ( tb == TBoolIgnore ) {
     367                diagnosticWarnings += pspa_->getBeamLine()->getAbstractElement(i)->getLabel() + " will be ignored by  "+ prog.getString()+"<br /> ";           
     368              } else {
     369                // j'insiste pour remettre le nom generique de l'element refuse (glm / 30/03/2013)
     370                diagnosticErrors += pspa_->getBeamLine()->getAbstractElement(i)->getNomdElement().getExpandedName() + " is not allowed with "+ prog.getString()+"<br /> ";
     371                caMarche = false;
     372              }
     373            }
     374            pspa_->getBeamLine()->update(i);
     375          }
     376        }
    369377      }
    370     }
    371     // set errors and warnings
    372     sections_[a]->setErrors(diagnosticErrors);
    373     sections_[a]->setWarnings(diagnosticWarnings);
    374   }
     378      // set errors and warnings
     379      sections_[a]->setErrors(diagnosticErrors);
     380      sections_[a]->setWarnings(diagnosticWarnings);
     381    }
    375382   
    376383  return caMarche;
Note: See TracChangeset for help on using the changeset viewer.