Changeset 418 in PSPA
- Timestamp:
- Jun 21, 2013, 10:16:56 AM (11 years ago)
- Location:
- Interface_Web/trunk/pspaWT
- Files:
-
- 43 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/History
r417 r418 5 5 PSPA - Plateforme de simulation en physique des accélérateurs 6 6 ========================================================= 7 21 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). 7 16 8 17 10 juin 2013 : Guy Le Meur -
Interface_Web/trunk/pspaWT/sources/controler/include/abstractElement.h
r359 r418 7 7 8 8 #include "nomdElements.h" 9 #include "nomDeLogiciel.h"10 #include "trivaluedBool.h"9 //#include "nomDeLogiciel.h" 10 //#include "trivaluedBool.h" 11 11 #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" */ 16 16 17 17 using namespace std; … … 23 23 int nbParam_; 24 24 string* parametersString_; 25 // double phaseStep_; // a recuperer dans les parametres globaux (methode setPhaseStep)26 25 double phaseStepMax_; 27 26 28 27 double defaultLength_; 29 28 double defaultAperture_; 30 string default Label_;29 string defaultSpecificName_; 31 30 32 string label_;31 string specificName_; 33 32 nomdElements elementName_; 34 33 … … 51 50 void setLabel(string lab); 52 51 string getLabel() const; 53 // typedElement getName() const;54 52 nomdElements getNomdElement() const; 55 53 56 /* string getElementImage() const; */57 /* string getElementName() const; */58 54 59 55 double getLenghtOfElement() const; 60 56 int getNbParams() const; 61 57 62 trivaluedBool is_accepted_by_software(nomDeLogiciel soft);63 58 64 59 virtual void setPhaseStep(double); … … 67 62 virtual void setParametersString(string* param) = 0; 68 63 virtual string* getParametersString() const = 0; 69 virtual string parmelaOutputFlow() const = 0;70 virtual string transportOutputFlow() const = 0;71 virtual string generatorOutputFlow() const;72 64 virtual string FileOutputFlow() const = 0; 65 virtual vector< pair<string, vector<string> > > parametersToSoftware () const =0; 73 66 virtual void FileInput(ifstream& ifs) = 0; 74 67 virtual string print() = 0; … … 79 72 return abstractSoftware_; 80 73 } 74 75 81 76 82 83 void registerAcceptableSoftware(nomDeLogiciel abs,trivaluedBool b);84 77 /** 85 78 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 88 80 */ 89 trivaluedBool setSoftware(nomDeLogiciel abstractName); 81 inline void setSoftware(abstractSoftware* prog) { abstractSoftware_ = prog; } 82 90 83 84 91 85 private : 92 abstractSoftware *abstractSoftware_;93 86 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 103 89 }; 104 90 #endif -
Interface_Web/trunk/pspaWT/sources/controler/include/abstractSoftware.h
r386 r418 5 5 #include "particleBeam.h" 6 6 #include "nomDeLogiciel.h" 7 #include "nomdElements.h" 8 #include "trivaluedBool.h" 9 7 10 #include <iostream> 8 11 #include <string> … … 22 25 string inputFileName_; 23 26 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 24 38 abstractSoftware(); 25 39 … … 27 41 bool initComputationLimits(unsigned int numeroDeb,unsigned int numeroFin); 28 42 bool ComputationLimitsOk() const; 43 44 45 void registerElement(nomdElements::typedElement nomdel,trivaluedBool b); 46 29 47 public : 30 48 … … 32 50 ~abstractSoftware() {;} 33 51 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 37 58 38 59 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 33 33 void addSectionToExecute(abstractElement* debut,int debutIndex, abstractElement* fin, int finIndex, abstractSoftware* prog); 34 34 35 abstractElement* addElement(typedElement elemType);35 abstractElement* addElement(nomdElements::typedElement elemType); 36 36 void removeElement(string); 37 37 -
Interface_Web/trunk/pspaWT/sources/controler/include/elementBeam.h
r359 r418 34 34 35 35 virtual string* getParametersString() const; 36 37 virtual vector< pair<string, vector<string> > > parametersToSoftware () const; 38 36 39 37 virtual string parmelaOutputFlow() const;40 // virtual string parmelaOutputFlow() const; 38 41 39 42 40 virtual string transportOutputFlow() const;43 // virtual string transportOutputFlow() const; 41 44 42 45 43 46 virtual string FileOutputFlow() const; 44 47 48 49 45 50 virtual void FileInput(ifstream& ifs); 46 51 -
Interface_Web/trunk/pspaWT/sources/controler/include/elementBend.h
r359 r418 47 47 virtual string* getParametersString() const; 48 48 49 virtual string parmelaOutputFlow() const;49 // virtual string parmelaOutputFlow() const; 50 50 51 virtual string transportOutputFlow() const;51 // virtual string transportOutputFlow() const; 52 52 53 53 virtual string FileOutputFlow() const; 54 55 virtual vector< pair<string, vector<string> > > parametersToSoftware () const; 54 56 55 57 virtual void FileInput(ifstream& ifs); -
Interface_Web/trunk/pspaWT/sources/controler/include/elementCell.h
r359 r418 50 50 virtual void setParametersString(string* param); 51 51 52 virtual string parmelaOutputFlow() const;52 // virtual string parmelaOutputFlow() const; 53 53 54 virtual string transportOutputFlow() const55 {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 /* } */ 60 60 61 61 62 62 virtual string FileOutputFlow() const; 63 63 64 virtual vector< pair<string, vector<string> > > parametersToSoftware () const; 65 64 66 virtual void FileInput(ifstream& ifs); 65 67 -
Interface_Web/trunk/pspaWT/sources/controler/include/elementDrift.h
r359 r418 26 26 virtual void setParametersString(string* param); 27 27 28 virtual string parmelaOutputFlow() const;28 // virtual string parmelaOutputFlow() const; 29 29 30 virtual string transportOutputFlow() const;30 // virtual string transportOutputFlow() const; 31 31 32 32 33 33 virtual string FileOutputFlow() const; 34 34 35 virtual vector< pair<string, vector<string> > > parametersToSoftware () const; 36 35 37 virtual void FileInput(ifstream& ifs); 36 38 -
Interface_Web/trunk/pspaWT/sources/controler/include/elementFit.h
r359 r418 34 34 virtual string* getParametersString() const; 35 35 36 virtual string parmelaOutputFlow() const;36 // virtual string parmelaOutputFlow() const; 37 37 38 virtual string transportOutputFlow() const;38 // virtual string transportOutputFlow() const; 39 39 40 40 virtual string FileOutputFlow() const; 41 41 42 virtual vector< pair<string, vector<string> > > parametersToSoftware () const; 43 42 44 virtual void FileInput(ifstream& ifs); 43 45 -
Interface_Web/trunk/pspaWT/sources/controler/include/elementRfgun.h
r359 r418 55 55 virtual inline double getInitialKineticEnergy() const {return E_cin_;} 56 56 57 virtual string parmelaOutputFlow() const;57 // virtual string parmelaOutputFlow() const; 58 58 59 virtual string transportOutputFlow() const60 {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 /* } */ 65 65 66 virtual string generatorOutputFlow() const;66 // virtual string generatorOutputFlow() const; 67 67 68 68 virtual string FileOutputFlow() const; 69 69 virtual vector< pair<string, vector<string> > > parametersToSoftware () const; 70 70 71 virtual void FileInput(ifstream& ifs); 71 72 -
Interface_Web/trunk/pspaWT/sources/controler/include/elementSnapshot.h
r379 r418 23 23 virtual string* getParametersString() const; 24 24 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; 27 27 28 28 virtual string FileOutputFlow() const; 29 virtual vector< pair<string, vector<string> > > parametersToSoftware () const; 30 29 31 virtual void FileInput(ifstream& ifs); 30 32 string print(); -
Interface_Web/trunk/pspaWT/sources/controler/include/elementSoleno.h
r359 r418 36 36 virtual string* getParametersString() const; 37 37 38 virtual string parmelaOutputFlow() const;38 // virtual string parmelaOutputFlow() const; 39 39 40 virtual string transportOutputFlow() const;40 // virtual string transportOutputFlow() const; 41 41 42 42 virtual string FileOutputFlow() const; 43 43 44 virtual vector< pair<string, vector<string> > > parametersToSoftware () const; 45 44 46 virtual void FileInput(ifstream& ifs); 45 47 -
Interface_Web/trunk/pspaWT/sources/controler/include/nomDeLogiciel.h
r401 r418 16 16 enum Logiciel 17 17 { 18 parmela, transport, generator, test, unknownSoftware18 parmela, transport, generator, useraction, test, unknownSoftware 19 19 }; 20 20 … … 28 28 static Logiciel fromString( std::string s); 29 29 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; 32 31 33 32 public : … … 40 39 41 40 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_);} 43 48 // operators 44 49 -
Interface_Web/trunk/pspaWT/sources/controler/include/nomdElements.h
r342 r418 4 4 using namespace std; 5 5 6 enum typedElement {beam, RFgun, drift, cell, bend, soleno, fit, snapshot, inconnu};6 // enum typedElement {beam, RFgun, drift, cell, bend, soleno, fit, snapshot, inconnu}; 7 7 8 8 … … 10 10 class nomdElements 11 11 { 12 13 public : 14 15 enum typedElement {beam, RFgun, drift, cell, bend, soleno, fit, snapshot, inconnu}; 16 17 private : 18 12 19 typedElement e_; // type entier (enum) 13 std::string e Name_; // nomde l'element14 std::string eLabel_; // label affiche sous l'icone20 std::string expandedName_; // nom generique de l'element 21 std::string genericLabel_; 15 22 unsigned nbParam_; // nombre de parametres a saisir 16 23 17 24 static typedElement fromString(std::string s); 18 static typedElement from Label(std::string s);19 static std::string to Name(typedElement eType);20 static std::string to Label(typedElement eType);25 static typedElement fromGenericLabel(std::string s); 26 static std::string toExpandedName(typedElement eType); 27 static std::string toGenericLabel(typedElement eType); 21 28 static unsigned toNbParam(typedElement eType); 22 29 … … 35 42 36 43 typedElement getElementType() const; 37 std::string getE lementName() const;38 std::string get ElementLabel() const;44 std::string getExpandedName() const; 45 std::string getGenericLabel() const; 39 46 unsigned getElementNbParameters() const; 40 47 -
Interface_Web/trunk/pspaWT/sources/controler/include/softwareGenerator.h
r386 r418 13 13 14 14 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 15 20 16 21 public : -
Interface_Web/trunk/pspaWT/sources/controler/include/softwareParmela.h
r417 r418 22 22 bool beamToParmela(string workingDir, particleBeam* partic ); 23 23 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 24 35 public : 25 36 softwareParmela(); -
Interface_Web/trunk/pspaWT/sources/controler/include/softwareTransport.h
r386 r418 10 10 11 11 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; 12 19 13 20 public : -
Interface_Web/trunk/pspaWT/sources/controler/src/abstractElement.cc
r412 r418 6 6 7 7 abstractElement::abstractElement() 8 : abstractSoftware_(NULL) 8 //: nameOfSoftware_(NULL) 9 : abstractSoftware_(NULL) 9 10 { 10 11 setDefaultValues(); … … 14 15 15 16 abstractElement::abstractElement(string lab) 17 //: nameOfSoftware_(NULL) 18 : abstractSoftware_(NULL) 16 19 { 17 label_ = lab;20 specificName_ = lab; 18 21 setDefaultValues(); 19 22 setDefaults(); … … 24 27 { 25 28 if (parametersString_ != NULL) delete [] parametersString_ ; 29 // if ( nameOfSoftware_ != NULL ) delete nameOfSoftware_; 26 30 } 27 31 28 32 void abstractElement::setDefaultValues() 29 33 { 30 default Label_ = string("XXXXXX");34 defaultSpecificName_ = string("XXXXXX"); 31 35 defaultLength_ = 0.0; 32 36 defaultAperture_ = 1.e+6; … … 36 40 void abstractElement::setDefaults() 37 41 { 38 label_ = defaultLabel_;42 specificName_ = defaultSpecificName_; 39 43 nbParam_ = 2; 40 44 lenghtElem_ = defaultLength_; … … 55 59 void abstractElement::setLabel(string lab) 56 60 { 57 label_= lab;61 specificName_= lab; 58 62 } 59 63 60 64 string abstractElement::getLabel() const 61 65 { 62 return label_;66 return specificName_; 63 67 } 64 68 … … 80 84 81 85 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 99 86 double abstractElement::getInitialKineticEnergy() const { 100 87 return 0.0; … … 102 89 103 90 104 string abstractElement::generatorOutputFlow() const {105 return "";106 }107 91 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 33 33 } 34 34 35 36 void 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 44 trivaluedBool 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 35 61 bool abstractSoftware::launchJob(string commandLine, string& resul) 36 62 { -
Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc
r413 r418 179 179 for (int j = debut; j <= fin; j++) { 180 180 abstractElement* elPtr= getElementPointerFromNumero(j); 181 cout << "[" << j << "] " << elPtr->getNomdElement().getE lementName() << endl;181 cout << "[" << j << "] " << elPtr->getNomdElement().getExpandedName() << endl; 182 182 } 183 183 } //k … … 243 243 pspa_->getBeamLine()->clear(); 244 244 245 typedElement elementType;245 nomdElements::typedElement elementType; 246 246 string elementLabel; 247 247 while (infile >> elementLabel) { -
Interface_Web/trunk/pspaWT/sources/controler/src/elementBeam.cc
r387 r418 10 10 parametersString_ = new string[nbParam_+1]; 11 11 // transportOk_ = true; 12 registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk);12 // registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk); 13 13 } 14 14 … … 16 16 17 17 void elementBeam::setDefaultValues() { 18 default Label_ = "beam";18 defaultSpecificName_ = "beam"; 19 19 xDef_ = 0.0; 20 20 xpDef_ = 0.0; … … 27 27 28 28 void elementBeam::setDefaults() { 29 label_ = defaultLabel_;29 specificName_ = defaultSpecificName_; 30 30 x_ = xDef_; 31 31 xp_ = xpDef_; … … 41 41 int compteur = -1; 42 42 parametersString_[++compteur] = mixedTools::intToString(nbParam_); 43 parametersString_[++compteur] = label_;43 parametersString_[++compteur] = specificName_; 44 44 parametersString_[++compteur] = mixedTools::doubleToString(x_); 45 45 parametersString_[++compteur] = mixedTools::doubleToString(xp_); … … 55 55 return parametersString_; 56 56 } 57 58 59 57 60 58 61 void elementBeam::setParametersString(string* param) { … … 70 73 } 71 74 72 label_ = param[++compteur];75 specificName_ = param[++compteur]; 73 76 x_ = atof(param[++compteur].c_str()); 74 77 xp_ = atof(param[++compteur].c_str()); … … 80 83 } 81 84 82 string elementBeam::parmelaOutputFlow() const83 {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 // } 88 91 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 // } 96 99 97 100 string elementBeam::FileOutputFlow() const { 98 101 ostringstream sortie; 99 102 // sortie << elementName_.getElementType() << endl; 100 sortie << elementName_.get ElementLabel() << endl;101 sortie << label_ << endl;103 sortie << elementName_.getGenericLabel() << endl; 104 sortie << specificName_ << endl; 102 105 sortie << x_ << " " << xp_ << " " << y_ << " " << yp_ << endl; 103 106 sortie << dl_ << " " << del_ << " " << p0_ << endl; … … 106 109 } 107 110 111 vector< 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 108 130 void elementBeam::elementBeam::FileInput(ifstream& ifs) { 109 ifs >> label_;131 ifs >> specificName_; 110 132 ifs >> x_ >> xp_ >> y_ >> yp_; 111 133 ifs >> dl_ >> del_ >> p0_; … … 118 140 string elementBeam::print() { 119 141 string txt = ""; 120 txt += label_;142 txt += specificName_; 121 143 txt += "\n 1/2 horizontal beam extend rms (cm) : "; 122 144 txt += mixedTools::doubleToString(x_); -
Interface_Web/trunk/pspaWT/sources/controler/src/elementBend.cc
r387 r418 11 11 nbParam_ = elementName_.getElementNbParameters(); 12 12 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); 17 15 } 18 16 19 17 void elementBend::setDefaultValues() 20 18 { 21 default Label_ = "bend";19 defaultSpecificName_ = "bend"; 22 20 angleDegDef_ = 0.0; 23 21 radiusDef_ = 1.0; … … 29 27 void elementBend::setDefaults() 30 28 { 31 label_ = defaultLabel_;29 specificName_ = defaultSpecificName_; 32 30 angleDeg_ = angleDegDef_; 33 31 radius_ = radiusDef_; … … 41 39 int compteur = -1; 42 40 parametersString_[++compteur] = mixedTools::intToString(nbParam_); 43 parametersString_[++compteur] = label_;41 parametersString_[++compteur] = specificName_; 44 42 parametersString_[++compteur] = mixedTools::doubleToString( angleDeg_); 45 43 parametersString_[++compteur] = mixedTools::doubleToString(radius_); … … 76 74 return; 77 75 } 78 label_ = param[++compteur];76 specificName_ = param[++compteur]; 79 77 angleDeg_ = atof(param[++compteur].c_str()); 80 78 radius_ = atof(param[++compteur].c_str()); … … 88 86 } 89 87 90 string elementBend::parmelaOutputFlow() const91 {92 ostringstream sortie;93 // il faut entrer l'energie cinetique94 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; 99 97 100 return sortie.str();101 }98 // return sortie.str(); 99 // } 102 100 103 101 104 string elementBend::transportOutputFlow() const105 {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 // } 110 108 111 109 … … 114 112 ostringstream sortie; 115 113 // sortie << elementName_.getElementType() << endl; 116 sortie << elementName_.get ElementLabel() << endl;117 sortie << label_ << endl;114 sortie << elementName_.getGenericLabel() << endl; 115 sortie << specificName_ << endl; 118 116 sortie << angleDeg_ << " " << radius_ << " " << aperture_ << endl; 119 117 sortie << beta1_ << " " << beta2_ << " " << momentum_ << endl; … … 121 119 } 122 120 121 vector< 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 123 141 void elementBend::FileInput(ifstream& ifs) 124 142 { 125 ifs >> label_;143 ifs >> specificName_; 126 144 ifs >> angleDeg_ >> radius_ >> aperture_; 127 145 ifs >> beta1_ >> beta2_ >> momentum_; … … 134 152 string txt = ""; 135 153 136 txt += label_;154 txt += specificName_; 137 155 txt += "\nangle (deg.) : "; 138 156 txt += mixedTools::doubleToString(angleDeg_); -
Interface_Web/trunk/pspaWT/sources/controler/src/elementCell.cc
r387 r418 14 14 nbParam_ = elementName_.getElementNbParameters(); 15 15 parametersString_ = new string[nbParam_+1]; 16 // parmelaOk_ = true; 17 registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk); 16 // registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk); 18 17 } 19 18 20 19 void elementCell::setDefaultValues() 21 20 { 22 default Label_ = "cell";21 defaultSpecificName_ = "cell"; 23 22 initialPhaseDef_ = 0.0; 24 23 acceleratingFieldDef_ = 1.0; … … 31 30 void elementCell::setDefaults() 32 31 { 33 label_ = defaultLabel_;32 specificName_ = defaultSpecificName_; 34 33 initialPhase_ = initialPhaseDef_; 35 34 acceleratingField_ = acceleratingFieldDef_; … … 45 44 int compteur = -1; 46 45 parametersString_[++compteur] = mixedTools::intToString(nbParam_); 47 parametersString_[++compteur] = label_;46 parametersString_[++compteur] = specificName_; 48 47 parametersString_[++compteur] = mixedTools::doubleToString(lenghtElem_); 49 48 parametersString_[++compteur] = mixedTools::doubleToString(aperture_); … … 78 77 } 79 78 80 label_ = param[++compteur];79 specificName_ = param[++compteur]; 81 80 lenghtElem_ = atof(param[++compteur].c_str()); 82 81 aperture_ = atof(param[++compteur].c_str()); … … 90 89 } 91 90 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 // } 105 103 106 return sortie.str();107 }104 // return sortie.str(); 105 // } 108 106 109 107 … … 112 110 ostringstream sortie; 113 111 // sortie << elementName_.getElementType() << endl; 114 sortie << elementName_.get ElementLabel() << endl;115 sortie << label_ << endl;112 sortie << elementName_.getGenericLabel() << endl; 113 sortie << specificName_ << endl; 116 114 sortie << lenghtElem_ << " " << aperture_ << endl; 117 115 sortie << initialPhase_ << " " << acceleratingField_ << endl; … … 123 121 } 124 122 123 124 vector< 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 125 147 void elementCell::FileInput(ifstream& ifs) 126 148 { 127 ifs >> label_;149 ifs >> specificName_; 128 150 ifs >> lenghtElem_ >> aperture_; 129 151 ifs >> initialPhase_ >> acceleratingField_; … … 139 161 140 162 141 txt += label_;163 txt += specificName_; 142 164 txt += "\nlength (cm) : "; 143 165 txt += mixedTools::doubleToString(lenghtElem_); -
Interface_Web/trunk/pspaWT/sources/controler/src/elementDrift.cc
r387 r418 13 13 nbParam_ = elementName_.getElementNbParameters(); 14 14 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); 18 18 19 19 } … … 21 21 void elementDrift::setDefaultValues() 22 22 { 23 default Label_ = "drift";23 defaultSpecificName_ = "drift"; 24 24 } 25 25 void elementDrift::setDefaults() 26 26 { 27 label_ = defaultLabel_;27 specificName_ = defaultSpecificName_; 28 28 } 29 29 … … 33 33 int compteur = -1; 34 34 parametersString_[++compteur] = mixedTools::intToString(nbParam_); 35 parametersString_[++compteur] = label_;35 parametersString_[++compteur] = specificName_; 36 36 parametersString_[++compteur] = mixedTools::doubleToString(lenghtElem_); 37 37 parametersString_[++compteur] = mixedTools::doubleToString(aperture_); … … 57 57 return; 58 58 } 59 label_ = param[++compteur];59 specificName_ = param[++compteur]; 60 60 lenghtElem_ = atof(param[++compteur].c_str()); 61 61 aperture_ = atof(param[++compteur].c_str()); 62 62 } 63 63 64 string elementDrift::parmelaOutputFlow() const65 {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 // } 70 70 71 71 72 string elementDrift::transportOutputFlow() const73 {74 ostringstream sortie;75 // longueur en m76 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 // } 79 79 80 80 … … 83 83 ostringstream sortie; 84 84 // sortie << elementName_.getElementType() << endl; 85 sortie << elementName_.get ElementLabel() << endl;86 sortie << label_ << endl;85 sortie << elementName_.getGenericLabel() << endl; 86 sortie << specificName_ << endl; 87 87 sortie << lenghtElem_ << " " << aperture_ <<endl; 88 88 return sortie.str(); 89 89 } 90 90 91 vector< 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 91 104 void elementDrift::FileInput(ifstream& ifs) 92 105 { 93 ifs >> label_;106 ifs >> specificName_; 94 107 ifs >> lenghtElem_ >> aperture_; 95 108 } … … 99 112 string txt = ""; 100 113 101 txt += label_;114 txt += specificName_; 102 115 txt += "\nlength (cm) : "; 103 116 txt += mixedTools::doubleToString(lenghtElem_); -
Interface_Web/trunk/pspaWT/sources/controler/src/elementFit.cc
r359 r418 11 11 // transportOk_ = true; 12 12 // parmelaIgnored_ = true; 13 registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk);14 registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolIgnore);13 // registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk); 14 // registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolIgnore); 15 15 } 16 16 17 17 void elementFit::setDefaultValues() 18 18 { 19 default Label_ = "fit";19 defaultSpecificName_ = "fit"; 20 20 variableNameDef_ = ""; 21 21 variableValueDef_ = 0.0; … … 25 25 void elementFit::setDefaults() 26 26 { 27 label_ = defaultLabel_;27 specificName_ = defaultSpecificName_; 28 28 variableName_ = variableNameDef_; 29 29 variableValue_ = variableValueDef_; … … 37 37 int compteur = -1; 38 38 parametersString_[++compteur] = mixedTools::intToString(nbParam_); 39 parametersString_[++compteur] = label_;39 parametersString_[++compteur] = specificName_; 40 40 parametersString_[++compteur] = variableName_; 41 41 parametersString_[++compteur] = mixedTools::doubleToString(variableValue_ ); … … 63 63 } 64 64 65 label_ = param[++compteur];65 specificName_ = param[++compteur]; 66 66 variableName_ = param[++compteur]; 67 67 variableValue_ = atof(param[++compteur].c_str()); … … 70 70 71 71 72 string elementFit::parmelaOutputFlow() const73 {74 ostringstream sortie;75 return sortie.str();76 }72 // string elementFit::parmelaOutputFlow() const 73 // { 74 // ostringstream sortie; 75 // return sortie.str(); 76 // } 77 77 78 string elementFit::transportOutputFlow() const79 {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 // } 87 87 88 88 string elementFit::FileOutputFlow() const … … 90 90 ostringstream sortie; 91 91 // sortie << elementName_.getElementType() << endl; 92 sortie << elementName_.get ElementLabel() << endl;93 sortie << label_ << endl;92 sortie << elementName_.getGenericLabel() << endl; 93 sortie << specificName_ << endl; 94 94 sortie << variableName_ << " " << variableValue_ << " " << tolerance_ << endl; 95 95 return sortie.str(); 96 96 } 97 97 98 vector< 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 98 111 void elementFit::FileInput(ifstream& ifs) 99 112 { 100 ifs >> label_;113 ifs >> specificName_; 101 114 ifs >> variableName_ >> variableValue_ >> tolerance_; 102 115 } … … 106 119 string txt = ""; 107 120 108 txt += label_;121 txt += specificName_; 109 122 return txt; 110 123 } -
Interface_Web/trunk/pspaWT/sources/controler/src/elementRfgun.cc
r387 r418 15 15 parametersString_ = new string[nbParam_+1]; 16 16 // parmelaOk_ = true; 17 registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk);18 registerAcceptableSoftware(nomDeLogiciel::generator, TBoolOk);17 // registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk); 18 // registerAcceptableSoftware(nomDeLogiciel::generator, TBoolOk); 19 19 } 20 20 21 21 void elementRfgun::setDefaultValues() 22 22 { 23 default Label_ = "rfgun";23 defaultSpecificName_ = "rfgun"; 24 24 defaultPhaseStep_ = 1.0; 25 25 defaultNmacrop_ = 0; … … 36 36 void elementRfgun::setDefaults() 37 37 { 38 label_ = defaultLabel_;38 specificName_ = defaultSpecificName_; 39 39 phaseStep_ = defaultPhaseStep_; 40 40 nmacrop_ = defaultNmacrop_; … … 54 54 int compteur = -1; 55 55 parametersString_[++compteur] = mixedTools::intToString(nbParam_); 56 parametersString_[++compteur] = label_;56 parametersString_[++compteur] = specificName_; 57 57 parametersString_[++compteur] = mixedTools::intToString(nmacrop_); 58 58 parametersString_[++compteur] = mixedTools::doubleToString(sigma_t_); … … 81 81 } 82 82 83 label_ = param[++compteur];83 specificName_ = param[++compteur]; 84 84 nmacrop_ = atoi(param[++compteur].c_str()); 85 85 sigma_t_ = atof(param[++compteur].c_str()); … … 93 93 } 94 94 95 string elementRfgun::parmelaOutputFlow() const96 {97 ostringstream sortie;98 // on prend les troncatures tmax et rmax à 3 sigmas99 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) 105 105 106 106 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; 108 108 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 MeV123 sortie << "Dist_z='g'" << endl;124 sortie << "sig_clock=" << 1.0e-3*sigma_t_ << endl; // passage de ps en ns125 sortie << "Dist_pz='g', sig_Ekin=" << 1000.*sigma_E_ << ", emit_z=0.0 , cor_Ekin=0.0 " << endl; // passage en keV126 sortie << "Dist_x='gauss', sig_x=" << 10.*sigma_r_ << endl; // passage en mm127 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 mm129 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 // } 132 132 133 133 … … 138 138 // on prend les troncatures tmax et rmax à 3 sigmas 139 139 // sortie << elementName_.getElementType() << endl; 140 sortie << elementName_.get ElementLabel() << endl;141 sortie << label_ << endl;140 sortie << elementName_.getGenericLabel() << endl; 141 sortie << specificName_ << endl; 142 142 sortie << nmacrop_ << " " << sigma_t_ << " " << sigma_r_ << endl; 143 143 sortie << emit_x_ << " " << emit_y_ << endl; … … 147 147 } 148 148 149 vector< 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 149 172 void elementRfgun::FileInput(ifstream& ifs) 150 173 { 151 ifs >> label_;174 ifs >> specificName_; 152 175 ifs >> nmacrop_ >> sigma_t_ >> sigma_r_; 153 176 ifs >> emit_x_ >> emit_y_; … … 160 183 string txt = ""; 161 184 162 txt += label_;185 txt += specificName_; 163 186 txt += "\ntotal charge : "; 164 187 txt += mixedTools::doubleToString(totalCharge_); -
Interface_Web/trunk/pspaWT/sources/controler/src/elementSnapshot.cc
r387 r418 13 13 nbParam_ = elementName_.getElementNbParameters(); 14 14 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); 19 21 } 20 22 21 23 void elementSnapshot::setDefaultValues() 22 24 { 23 default Label_ = "snapshot";25 defaultSpecificName_ = "snapshot"; 24 26 } 25 27 26 28 void elementSnapshot::setDefaults() 27 29 { 28 label_ = defaultLabel_;30 specificName_ = defaultSpecificName_; 29 31 30 32 if(incr_ < 10) { … … 41 43 int compteur = -1; 42 44 parametersString_[++compteur] = mixedTools::intToString(nbParam_); 43 parametersString_[++compteur] = label_;45 parametersString_[++compteur] = specificName_; 44 46 parametersString_[++compteur] = snapshotFile_; 45 47 … … 66 68 } 67 69 68 label_ = param[++compteur];70 specificName_ = param[++compteur]; 69 71 } 70 72 71 string elementSnapshot::parmelaOutputFlow() const72 {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 // } 77 79 78 string elementSnapshot::transportOutputFlow() const79 {80 return string("");81 }80 // string elementSnapshot::transportOutputFlow() const 81 // { 82 // return string(""); 83 // } 82 84 83 85 string elementSnapshot::FileOutputFlow() const 84 86 { 85 87 ostringstream sortie; 86 sortie << elementName_.get ElementLabel() << endl;87 sortie << label_ << endl;88 sortie << elementName_.getGenericLabel() << endl; 89 sortie << specificName_ << endl; 88 90 sortie << snapshotFile_ << endl; 89 91 return sortie.str(); 90 92 } 91 93 94 vector< 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 92 104 void elementSnapshot::FileInput(ifstream& ifs) 93 105 { 94 ifs >> label_;106 ifs >> specificName_; 95 107 ifs >> snapshotFile_; 96 108 } … … 99 111 { 100 112 string txt = ""; 101 txt += label_;113 txt += specificName_; 102 114 txt += "\nname of file for snapshot : "; 103 115 txt += snapshotFile_; -
Interface_Web/trunk/pspaWT/sources/controler/src/elementSoleno.cc
r387 r418 11 11 nbParam_ = elementName_.getElementNbParameters(); 12 12 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); 15 15 } 16 16 … … 18 18 void elementSoleno::setDefaultValues() 19 19 { 20 default Label_ = "solnd";20 defaultSpecificName_ = "solnd"; 21 21 B0Def_ = 0.0; 22 22 varyB0Def_ = false; … … 25 25 void elementSoleno::setDefaults() 26 26 { 27 label_ = defaultLabel_;27 specificName_ = defaultSpecificName_; 28 28 B0_ = B0Def_; 29 29 varyB0_ = varyB0Def_; … … 36 36 int compteur = -1; 37 37 parametersString_[++compteur] = mixedTools::intToString(nbParam_); 38 parametersString_[++compteur] = label_;38 parametersString_[++compteur] = specificName_; 39 39 parametersString_[++compteur] = mixedTools::doubleToString(lenghtElem_); 40 40 parametersString_[++compteur] = mixedTools::doubleToString(aperture_); … … 63 63 return; 64 64 } 65 label_ = param[++compteur];65 specificName_ = param[++compteur]; 66 66 lenghtElem_ = atof(param[++compteur].c_str()); 67 67 aperture_ = atof(param[++compteur].c_str()); … … 70 70 } 71 71 72 string elementSoleno::parmelaOutputFlow() const73 {74 ostringstream sortie;75 // on passe l'induction magnetique en Gauss76 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 // } 79 79 80 string elementSoleno::transportOutputFlow() const81 {82 ostringstream sortie;83 // on passe la longueur en metres84 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 // } 90 90 91 91 string elementSoleno::FileOutputFlow() const … … 93 93 ostringstream sortie; 94 94 // sortie << elementName_.getElementType() << endl; 95 sortie << elementName_.get ElementLabel() << endl;96 sortie << label_ << endl;95 sortie << elementName_.getGenericLabel() << endl; 96 sortie << specificName_ << endl; 97 97 sortie << lenghtElem_ << " " << aperture_<< " " << B0_ << " " << varyB0_ << endl; 98 98 return sortie.str(); 99 99 } 100 100 101 102 vector< 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 101 118 void elementSoleno::FileInput(ifstream& ifs) 102 119 { 103 ifs >> label_;120 ifs >> specificName_; 104 121 ifs >> lenghtElem_ >> aperture_ >> B0_ >> varyB0_ ; 105 122 } … … 109 126 string txt = ""; 110 127 111 txt += label_;128 txt += specificName_; 112 129 txt += "\nlength (cm) : "; 113 130 txt += mixedTools::doubleToString(lenghtElem_); -
Interface_Web/trunk/pspaWT/sources/controler/src/nomDeLogiciel.cc
r316 r418 7 7 else if ( s == "transport" ) return transport; 8 8 else if ( s == "generator" ) return generator; 9 else if ( s == "useraction" ) return useraction; 9 10 else if ( s == "test" ) return test; 10 11 return unknownSoftware; … … 18 19 case transport : { return "transport"; } 19 20 case generator : { return "generator"; } 21 case useraction : { return "useraction"; } 20 22 case test : { return "test"; } 21 23 case unknownSoftware : { return "unknownSoftware"; } … … 24 26 } 25 27 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 26 46 nomDeLogiciel::nomDeLogiciel() 27 47 { 28 program_ = transport;48 program_ = unknownSoftware; 29 49 progString_ = toString(program_); 30 50 // value_ = toValue(program_); -
Interface_Web/trunk/pspaWT/sources/controler/src/nomdElements.cc
r373 r418 4 4 #include "nomdElements.h" 5 5 6 typedElement nomdElements::fromString(std::string s)6 nomdElements::typedElement nomdElements::fromString(std::string s) 7 7 { 8 8 if( strstr(s.c_str(),"beam") ) return beam; … … 17 17 } 18 18 19 typedElement nomdElements::fromLabel(std::string s)19 nomdElements::typedElement nomdElements::fromGenericLabel(std::string s) 20 20 { 21 21 if( s == "beam" ) return beam; … … 30 30 } 31 31 32 std::string nomdElements::to Name(typedElement eType)32 std::string nomdElements::toExpandedName(nomdElements::typedElement eType) 33 33 { 34 34 switch(eType) { … … 45 45 } 46 46 47 std::string nomdElements::to Label(typedElement eType)47 std::string nomdElements::toGenericLabel(nomdElements::typedElement eType) 48 48 { 49 49 switch(eType) { … … 60 60 } 61 61 62 unsigned nomdElements::toNbParam( typedElement eType)62 unsigned nomdElements::toNbParam(nomdElements::typedElement eType) 63 63 { 64 64 switch(eType) { … … 79 79 { 80 80 e_= fromString(""); 81 e Name_ = toName(e_);82 eLabel_ = toLabel(e_);81 expandedName_ = toExpandedName(e_); 82 genericLabel_ = toGenericLabel(e_); 83 83 nbParam_ = toNbParam(e_); 84 84 } … … 87 87 { 88 88 e_= ne.e_; 89 e Name_ = ne.eName_;90 eLabel_ = ne.eLabel_;89 expandedName_ = ne.expandedName_; 90 genericLabel_ = ne.genericLabel_; 91 91 nbParam_ = ne.nbParam_; 92 92 } … … 95 95 { 96 96 e_= ne.e_; 97 e Name_ = ne.eName_;98 eLabel_ = ne.eLabel_;97 expandedName_ = ne.expandedName_; 98 genericLabel_ = ne.genericLabel_; 99 99 nbParam_ = ne.nbParam_; 100 100 } … … 104 104 { 105 105 e_= fromString(s); 106 e Name_ = toName(e_);107 eLabel_ = toLabel(e_);106 expandedName_ = toExpandedName(e_); 107 genericLabel_ = toGenericLabel(e_); 108 108 nbParam_ = toNbParam(e_); 109 109 } 110 110 111 nomdElements::nomdElements( typedElement& eType)111 nomdElements::nomdElements(nomdElements::typedElement& eType) 112 112 { 113 113 e_= eType; 114 e Name_ = toName(e_);115 eLabel_ = toLabel(e_);114 expandedName_ = toExpandedName(e_); 115 genericLabel_ = toGenericLabel(e_); 116 116 nbParam_ = toNbParam(e_); 117 117 } … … 121 121 } 122 122 123 std::string nomdElements::getLabelFromType( typedElement tp)123 std::string nomdElements::getLabelFromType(nomdElements::typedElement tp) 124 124 { 125 return to Label(tp);125 return toGenericLabel(tp); 126 126 } 127 127 128 typedElement nomdElements::getTypeFromLabel(std::string lb)128 nomdElements::typedElement nomdElements::getTypeFromLabel(std::string lb) 129 129 { 130 return from Label(lb);130 return fromGenericLabel(lb); 131 131 } 132 132 133 133 134 typedElement nomdElements::getElementType() const {134 nomdElements::typedElement nomdElements::getElementType() const { 135 135 return e_; 136 136 } 137 137 138 std::string nomdElements::getE lementName() const {139 return e Name_;138 std::string nomdElements::getExpandedName() const { 139 return expandedName_; 140 140 } 141 141 142 std::string nomdElements::get ElementLabel() const {143 return eLabel_;142 std::string nomdElements::getGenericLabel() const { 143 return genericLabel_; 144 144 } 145 145 … … 156 156 { 157 157 e_= ne.e_; 158 e Name_ = ne.eName_;159 eLabel_ = ne.eLabel_;158 expandedName_ = ne.expandedName_; 159 genericLabel_ = ne.genericLabel_; 160 160 nbParam_ = ne.nbParam_; 161 161 return *this; -
Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc
r417 r418 392 392 393 393 if ( index > 2 && index < 5 ) { 394 cout << " particleBeam::particlesPhaseSpaceComponent traitement vitesses " << endl; 394 395 for (unsigned i = 0; i < relativePartic_.size(); ++i) { 395 396 double begamz = relativePartic_.at(i).getBetaGamma().getComponent(2); … … 400 401 } 401 402 } 403 cout << " particleBeam::particlesPhaseSpaceComponent traitement vitesses TERMINE " << endl; 402 404 return; 403 405 } -
Interface_Web/trunk/pspaWT/sources/controler/src/softwareGenerator.cc
r417 r418 15 15 { 16 16 nameOfSoftware_ = nomDeLogiciel("generator"); 17 registerElement(nomdElements::beam,TBoolOk); 17 18 } 18 19 … … 26 27 elPtr = dataManager_->getElementPointerFromNumero(numeroDeb_); 27 28 28 if ( elPtr->getNomdElement().getElementType() != RFgun ) {29 if ( elPtr->getNomdElement().getElementType() != nomdElements::RFgun ) { 29 30 dataManager_->consoleMessage(" softwareGenerator::createInputFile : the element must be rfgun " ); 30 31 cerr << " softwareGenerator::createInputFile : the element must be rfgun" << endl; … … 45 46 outfile << " Add=FALSE, N_add=0" << endl; 46 47 outfile << " Species='electrons'" << endl; 47 outfile << elPtr->generatorOutputFlow() << endl; 48 // outfile << elPtr->generatorOutputFlow() << endl; 49 50 outfile << elementsData(elPtr->parametersToSoftware()) << endl; 51 48 52 outfile << "/" << endl; 49 53 outfile.close(); … … 231 235 return true; 232 236 } 237 238 239 string 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 251 string 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 6 6 #include "dataManager.h" 7 7 #include "mixedTools.h" 8 //#include "nomDeLogiciel.h" 8 9 9 softwareParmela::softwareParmela() : abstractSoftware() 10 10 { … … 15 15 { 16 16 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); 17 24 } 18 25 … … 23 30 abstractElement* elPtr = dataManager_->getElementPointerFromNumero(numeroDeb_); 24 31 25 bool there_is_rfgun = ( elPtr->getNomdElement().getElementType() == RFgun );32 bool there_is_rfgun = ( elPtr->getNomdElement().getElementType() == nomdElements::RFgun ); 26 33 unsigned offsetNumElem; 27 34 // les elements de parmela sont indexes de 1 à max, s'il n'y a pas de rfgun … … 40 47 abstractElement* elem = dataManager_->getElementPointerFromNumero(k); 41 48 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 ) { 43 51 relativeParmelaElementIndices_.at(curseur) = id; 44 52 cout << " mis a " << id << endl; … … 67 75 double initalKineticEnergy = 0.0; 68 76 elPtr = dataManager_->getElementPointerFromNumero(numeroDeb_); 69 bool there_is_rfgun = ( elPtr->getNomdElement().getElementType() == RFgun );77 bool there_is_rfgun = ( elPtr->getNomdElement().getElementType() == nomdElements::RFgun ); 70 78 71 79 if ( !there_is_rfgun ) { … … 88 96 unsigned int premier = numeroDeb_ ; 89 97 if ( there_is_rfgun ) { 90 outfile << dataManager_->getElementPointerFromNumero(numeroDeb_)->parmelaOutputFlow(); 98 // outfile << dataManager_->getElementPointerFromNumero(numeroDeb_)->parmelaOutputFlow(); 99 outfile << elementsData(dataManager_->getElementPointerFromNumero(numeroDeb_)->parametersToSoftware()); 91 100 premier++; 92 101 } else { … … 98 107 elPtr = dataManager_->getElementPointerFromNumero(k); 99 108 if (elPtr) { 100 outfile << elPtr->parmelaOutputFlow(); 109 // outfile << elPtr->parmelaOutputFlow(); 110 outfile << elementsData(elPtr->parametersToSoftware()); 101 111 } 102 112 } … … 185 195 unsigned numeroParmel; 186 196 numeroParmel = (unsigned)relativeParmelaElementIndices_.at(curseur); 187 cout << " lecture PARMELA el no absolu " << k << " numero relatif " << numeroParmel << " nom " << elem->getNomdElement().getE lementName() << endl;197 cout << " lecture PARMELA el no absolu " << k << " numero relatif " << numeroParmel << " nom " << elem->getNomdElement().getExpandedName() << endl; 188 198 // lecture sortie parmela 189 199 if(!beamFromParmela(workingDir,numeroParmel,freq,centroid,refPart,particles)) … … 338 348 return true; 339 349 } 350 351 352 string 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 368 string 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 408 string 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 452 string 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 470 string 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 492 string 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 14 14 { 15 15 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); 16 22 } 17 23 … … 52 58 53 59 // Dans le cas où le premier element n'est pas beam 54 if ( premierEl->getNomdElement().getElementType() != beam ) {60 if ( premierEl->getNomdElement().getElementType() != nomdElements::beam ) { 55 61 // s'il n'y a pas faisceau courant, erreur 56 62 if ( beamBefore == NULL ) { … … 85 91 { 86 92 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()); 89 96 } 90 97 … … 150 157 151 158 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 153 162 // si l'element doit etre ignore, on renvoie sur le diag precedent 154 163 dataManager_->updateCurrentDiagnostic(false); … … 241 250 return moments.readFromTransportOutput(fichierStream); 242 251 } 252 253 string 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 269 string 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 304 string 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 325 string 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 356 string 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 393 string 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 33 33 34 34 GWt_elementLigneFaisceau(PspaApplication*); 35 GWt_elementLigneFaisceau( typedElement,PspaApplication*);35 GWt_elementLigneFaisceau(nomdElements::typedElement,PspaApplication*); 36 36 37 37 ~GWt_elementLigneFaisceau(); … … 68 68 void removeDone(GWt_abstractElement*); 69 69 std::string getElementNumberInBeamLine(nomdElements el); 70 void initialize_ligneFaisceau( typedElement eType);70 void initialize_ligneFaisceau(nomdElements::typedElement eType); 71 71 void mouseWentOut(); 72 72 void mouseWentOver(); -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_ligneFaisceau.h
r401 r418 43 43 and we center everything 44 44 */ 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); 47 47 48 48 void removeElement(GWt_abstractElement*); … … 55 55 abstractElement* getAbstractElement(int i); 56 56 57 /** return the indexof the abstract element57 /** return the numero (1.. infty) of the abstract element 58 58 @param : label of this abstractElement in the beam line 59 59 */ 60 int getAbstractElement IndexFromLabel(std::string str);60 int getAbstractElementNumeroFromLabel(std::string txt); 61 61 62 62 // void restoreElementCollectionFromDataManager(); -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_abstractElement.cc
r365 r418 53 53 if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) { 54 54 GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console")); 55 console->addConsoleMessage(" GWt_abstractElement::beginDialog : empty parameter set for element " + abstractElement_->getNomdElement().getE lementName());55 console->addConsoleMessage(" GWt_abstractElement::beginDialog : empty parameter set for element " + abstractElement_->getNomdElement().getExpandedName()); 56 56 } 57 57 } … … 64 64 if ( static_cast<GWt_console*> (wApp->findWidget ("console"))) { 65 65 GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console")); 66 console->addConsoleMessage(" element seems not to be a " + abstractElement_->getNomdElement().getE lementName());66 console->addConsoleMessage(" element seems not to be a " + abstractElement_->getNomdElement().getExpandedName()); 67 67 } 68 68 } 69 69 70 dialog_ = new WDialog("element " + abstractElement_->getNomdElement().getE lementName());70 dialog_ = new WDialog("element " + abstractElement_->getNomdElement().getExpandedName()); 71 71 new WText(" label of the element : ",dialog_->contents()); 72 72 // labelEdit_ = new WLineEdit(param[++compteur].c_str(), dialog_->contents()); -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_dropZoneLigneFaisceau.cc
r343 r418 71 71 // get the type of element 72 72 nomdElements e(evt.mimeType()); 73 typedElement eType = e.getElementType();73 nomdElements::typedElement eType = e.getElementType(); 74 74 ligneFaisceau->addElement(eType, this); 75 75 } -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_elementLigneFaisceau.cc
r401 r418 35 35 pspa_(pspa) 36 36 { 37 initialize_ligneFaisceau( inconnu);38 } 39 40 41 GWt_elementLigneFaisceau::GWt_elementLigneFaisceau( typedElement type,PspaApplication* pspa)37 initialize_ligneFaisceau(nomdElements::inconnu); 38 } 39 40 41 GWt_elementLigneFaisceau::GWt_elementLigneFaisceau(nomdElements::typedElement type,PspaApplication* pspa) 42 42 : WContainerWidget(), 43 43 firstTimeInsertMessage_(NULL), … … 53 53 } 54 54 55 void GWt_elementLigneFaisceau::initialize_ligneFaisceau( typedElement eType)55 void GWt_elementLigneFaisceau::initialize_ligneFaisceau(nomdElements::typedElement eType) 56 56 { 57 57 cout<<"new GWt_elementLigneFaisceau : "<< this << endl; … … 62 62 // +----------+--------+---------+ 63 63 64 65 64 WGridLayout *gridLayout = new WGridLayout(); 66 65 … … 94 93 95 94 switch ( eType ) { 96 case RFgun :95 case nomdElements::RFgun : 97 96 GWt_abstractElement_ = new GWt_rfgun(this); 98 97 break; 99 case drift :98 case nomdElements::drift : 100 99 GWt_abstractElement_ = new GWt_drift(this); 101 100 break; 102 case cell :101 case nomdElements::cell : 103 102 GWt_abstractElement_ = new GWt_cell(this); 104 103 break; 105 case bend :104 case nomdElements::bend : 106 105 GWt_abstractElement_ = new GWt_bend(this); 107 106 break; 108 case soleno :107 case nomdElements::soleno : 109 108 GWt_abstractElement_ = new GWt_soleno(this); 110 109 break; 111 case beam :110 case nomdElements::beam : 112 111 GWt_abstractElement_ = new GWt_beam(this); 113 112 break; 114 case fit :113 case nomdElements::fit : 115 114 GWt_abstractElement_ = new GWt_fit(this); 116 115 break; 117 case snapshot :116 case nomdElements::snapshot : 118 117 { 119 118 int incr = pspa_->getExtensionFile(); … … 123 122 break; 124 123 } 125 case inconnu :124 case nomdElements::inconnu : 126 125 GWt_abstractElement_ = NULL; 127 126 } … … 207 206 if (getGWt_AbstractElement()->getAbstractElement()) { 208 207 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())); 210 210 softwareName_->setText(getGWt_AbstractElement()->getAbstractElement()->getAbstractSoftware()->getName()); 211 211 … … 278 278 279 279 if(n < 10) { 280 str= elem.get ElementLabel()+"0"+number;280 str= elem.getGenericLabel()+"0"+number; 281 281 } else { 282 str= elem.get ElementLabel()+number;282 str= elem.getGenericLabel()+number; 283 283 } 284 284 } -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_ligneFaisceau.cc
r401 r418 51 51 52 52 53 GWt_abstractElement* GWt_LigneFaisceau::addElement( typedElement eType){53 GWt_abstractElement* GWt_LigneFaisceau::addElement(nomdElements::typedElement eType){ 54 54 return addElement(eType,NULL); 55 55 } 56 56 57 GWt_abstractElement* GWt_LigneFaisceau::addElement( typedElement eType, GWt_dropZoneLigneFaisceau* dropContainer )57 GWt_abstractElement* GWt_LigneFaisceau::addElement(nomdElements::typedElement eType, GWt_dropZoneLigneFaisceau* dropContainer ) 58 58 { 59 59 … … 66 66 // -dropContainer is NULL, insert in the last element 67 67 68 if(eType == inconnu) {68 if(eType == nomdElements::inconnu) { 69 69 cout << "GWt_LigneFaisceau::element type " << eType << " inconnu " << endl; 70 70 return NULL; … … 222 222 223 223 224 int GWt_LigneFaisceau::getAbstractElementIndexFromLabel(std::string txt){ 225 int index = 0; 224 225 int GWt_LigneFaisceau::getAbstractElementNumeroFromLabel(std::string txt){ 226 int index = 1; 226 227 if (txt == "") { 227 228 return NULL; … … 246 247 247 248 249 250 248 251 int GWt_LigneFaisceau::getBeamLineSize() { 249 252 int count = 0; … … 289 292 vector <abstractElement*> elems = getAllAbstractElements(); 290 293 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 617 617 seriesType = PointSeries; 618 618 titre = " phase space "; 619 cout << " PspaApplication::faireDessinPhaseSpace APPEL " << endl; 619 620 beam->particlesPhaseSpaceData(xcor,ycor,legende,namex,namey); 621 cout << " PspaApplication::faireDessinPhaseSpace RETOUR " << endl; 620 622 } else { 621 623 GWt_dialog warningBeamState(" graphical analysis", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true); … … 882 884 WCartesianChart *chart = new WCartesianChart(toto); 883 885 if (!makeIcon) chart->setTitle(title); 884 885 886 chart->initLayout(); 886 887 chart->setModel(model); // set the model … … 931 932 chart->axis(YAxis).setLabelFont(yAxisFont); 932 933 } 933 934 934 935 #ifdef HAS_IMAGEMAGIC 935 936 // no background … … 950 951 */ 951 952 952 // Wt::WPdfImage pdfImage("1000", "600"); 953 WPdfImage pdfImage("1000", "600"); 953 Wt::WPdfImage pdfImage("1000", "600"); 954 954 { 955 955 Wt::WPainter p1(&pdfImage); … … 963 963 964 964 #endif 965 965 966 } 966 967 -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_serverFileSelector.cc
r417 r418 53 53 Wt::WTreeNode* treeFileRoot = new Wt::WTreeNode("Workspace", folderIcon); 54 54 55 treeFileRoot->setStyleClass("example-tree");55 // treeFileRoot->setStyleClass("example-tree"); 56 56 treeRoot_->setTreeRoot(treeFileRoot); 57 57 treeFileRoot->label()->setTextFormat(Wt::PlainText); -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc
r413 r418 329 329 330 330 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 } 369 377 } 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 } 375 382 376 383 return caMarche;
Note: See TracChangeset
for help on using the changeset viewer.