Changeset 424 in PSPA
- Timestamp:
- Sep 30, 2013, 5:03:21 PM (11 years ago)
- Location:
- Interface_Web/trunk/pspaWT/sources
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/sources/controler/include/abstractElement.h
r418 r424 15 15 /* #include "softwareTransport.h" */ 16 16 17 #include "UAP/UAPNode.hpp" 18 17 19 using namespace std; 18 20 19 21 class abstractElement 20 22 { 21 protected : 23 24 protected : 25 26 int nbParam_; 27 string* parametersString_; 28 double phaseStepMax_; 22 29 23 int nbParam_; 24 string* parametersString_; 25 double phaseStepMax_; 30 double defaultLength_; 31 double defaultAperture_; 32 string defaultSpecificName_; 33 34 string specificName_; 35 nomdElements elementName_; 36 37 double lenghtElem_; // cm 38 double aperture_; // cm 39 40 double stepmaxcm_; 41 // bool curvedTrajectory_; 42 43 void setDefaultValues(); 44 void setDefaults(); 45 46 public : 47 48 abstractElement(); 49 abstractElement(string lab); 50 virtual ~abstractElement(); 51 52 void setParameters(double ll,double aper); 53 void setLabel(string lab); 54 string getLabel() const; 55 nomdElements getNomdElement() const; 56 57 double getLenghtOfElement() const; 58 int getNbParams() const; 59 60 virtual void setPhaseStep(double); 61 virtual double getInitialKineticEnergy() const; 26 62 27 double defaultLength_; 28 double defaultAperture_; 29 string defaultSpecificName_; 30 31 string specificName_; 32 nomdElements elementName_; 33 34 double lenghtElem_; // cm 35 double aperture_; // cm 36 37 double stepmaxcm_; 38 // bool curvedTrajectory_; 39 40 void setDefaultValues(); 41 void setDefaults(); 42 43 public : 44 45 abstractElement(); 46 abstractElement(string lab); 47 virtual ~abstractElement(); 48 49 void setParameters(double ll,double aper); 50 void setLabel(string lab); 51 string getLabel() const; 52 nomdElements getNomdElement() const; 53 54 55 double getLenghtOfElement() const; 56 int getNbParams() const; 63 virtual void setParametersString(string* param) = 0; 64 virtual string* getParametersString() const = 0; 65 virtual string FileOutputFlow() const = 0; 66 virtual vector< pair<string, vector<string> > > parametersToSoftware () const =0; 67 virtual void FileInput(ifstream& ifs) = 0; 68 virtual string print() = 0; 69 70 virtual void InputRep(UAPNode* root) = 0; 57 71 58 59 virtual void setPhaseStep(double); 60 virtual double getInitialKineticEnergy() const; 61 62 virtual void setParametersString(string* param) = 0; 63 virtual string* getParametersString() const = 0; 64 virtual string FileOutputFlow() const = 0; 65 virtual vector< pair<string, vector<string> > > parametersToSoftware () const =0; 66 virtual void FileInput(ifstream& ifs) = 0; 67 virtual string print() = 0; 72 /* Return the abstractSofware associated with this element 73 */ 74 inline abstractSoftware* getAbstractSoftware() { 75 return abstractSoftware_; 76 } 77 78 /* Set the software to this element 79 @param abstractSoftware a pointer to the abstract software 80 */ 81 inline void setSoftware(abstractSoftware* prog) { 82 abstractSoftware_ = prog; 83 } 84 85 private : 68 86 69 /** Return the abstractSofware associated with this element 70 */ 71 inline abstractSoftware* getAbstractSoftware() { 72 return abstractSoftware_; 73 } 74 75 76 77 /** 78 Set the software to this element 79 @param abstractSoftware a pointer to the abstract software 80 */ 81 inline void setSoftware(abstractSoftware* prog) { abstractSoftware_ = prog; } 82 83 84 85 private : 86 87 abstractSoftware *abstractSoftware_; 88 87 abstractSoftware *abstractSoftware_; 88 89 89 }; 90 90 #endif -
Interface_Web/trunk/pspaWT/sources/controler/include/dataManager.h
r419 r424 47 47 */ 48 48 int getNumeroFromElementLabel(string); 49 49 abstractElement* getElementPointerFromNumero(int); 50 50 51 51 void initializeExecution(); … … 61 61 @param filename 62 62 */ 63 void saveConfiguration(string folder, string filename); 63 void saveConfiguration(string folder, string filename); 64 bool restoreElements(string inputFileName); 65 66 void writeToAMLFile(string fileName); 64 67 65 bool restoreElements(string inputFileName); 66 67 68 /** return the jobList size 69 */ 70 inline int getJobListSize() const { 71 return jobList_.size(); 68 /** return the jobList size 69 */ 70 inline int getJobListSize() const { 71 return jobList_.size(); 72 } 73 74 // si newBeam = true, on cree un nouveau diag 75 // si newBeam = false, on utilise le dernier 76 inline particleBeam* updateCurrentDiagnostic(bool newBeam) { 77 if ( newBeam ) { 78 diagnosticBeam_.push_back(particleBeam()); 72 79 } 73 74 // si newBeam = true, on cree un nouveau diag 75 // si newBeam = false, on utilise le dernier 76 inline particleBeam* updateCurrentDiagnostic(bool newBeam) { 77 if ( newBeam ) { 78 diagnosticBeam_.push_back(particleBeam()); 79 } 80 indexElementToIndexDiag_.push_back(diagnosticBeam_.size() -1); 81 return &diagnosticBeam_.back(); 82 } 83 84 /** return a specific jobList index 85 return NULL if the index does not exist 86 */ 87 88 /* inline sectionToExecute* getJobListAt(int a) { */ 80 indexElementToIndexDiag_.push_back(diagnosticBeam_.size() -1); 81 return &diagnosticBeam_.back(); 82 } 83 84 /** return a specific jobList index 85 return NULL if the index does not exist 86 */ 87 88 /* inline sectionToExecute* getJobListAt(int a) { */ 89 89 /* if (a < 0) return NULL; */ 90 90 /* if (a >= getJobListSize()) return NULL; */ … … 92 92 /* } */ 93 93 94 95 94 95 96 96 /* inline const abstractSoftware* getSoftwareOfSection( int index) const { */ 97 97 /* if (index < 0) return NULL; */ … … 101 101 102 102 /** Clear a specific jobList */ 103 103 void clearSectionToExecute(int a); 104 104 105 private: 106 globalParameters globParam_; 107 particleBeam* currentBeam_; 105 private: 106 107 globalParameters globParam_; 108 particleBeam* currentBeam_; 108 109 PspaApplication* pspa_; 109 110 unsigned firstComputedElemNumero_; 110 111 unsigned lastComputedElemNumero_; 111 112 vector<particleBeam> diagnosticBeam_; 113 vector<unsigned> indexElementToIndexDiag_; 114 // numeroElementToIndexDiag_[k] contient, pour l'element d'index k, l'indice ind tel que diagnosticBeam_[ind] 115 // soit le faisceau resultat, en l'etat qu'il doit avoir apres l'element k 116 117 vector<sectionToExecute*> jobList_; 118 119 void removeFile(string nameOfFile); 120 void clearSectionToExecute(); 121 abstractSoftware* createSoftwareConnexion(nomDeLogiciel logi); 122 123 }; 112 113 vector<particleBeam> diagnosticBeam_; 114 vector<unsigned> indexElementToIndexDiag_; 115 // numeroElementToIndexDiag_[k] contient, pour l'element d'index k, l'indice ind tel que diagnosticBeam_[ind] 116 // soit le faisceau resultat, en l'etat qu'il doit avoir apres l'element k 117 118 vector<sectionToExecute*> jobList_; 119 120 void removeFile(string nameOfFile); 121 void clearSectionToExecute(); 122 abstractSoftware* createSoftwareConnexion(nomDeLogiciel logi); 123 }; 124 124 #endif -
Interface_Web/trunk/pspaWT/sources/controler/include/elementBeam.h
r418 r424 21 21 22 22 void setDefaultValues(); 23 24 23 void setDefaults(); 25 24 26 25 public : 27 26 28 27 elementBeam(); 29 30 28 ~elementBeam(); 31 29 32 30 33 31 virtual void setParametersString(string* param); 34 35 32 virtual string* getParametersString() const; 36 37 33 virtual vector< pair<string, vector<string> > > parametersToSoftware () const; 38 39 40 34 // virtual string parmelaOutputFlow() const; 41 42 43 35 // virtual string transportOutputFlow() const; 44 36 45 46 virtual string FileOutputFlow() const;47 37 virtual string FileOutputFlow() const; 38 virtual void FileInput(ifstream& ifs); 39 virtual void InputRep(UAPNode* root); 48 40 49 50 virtual void FileInput(ifstream& ifs); 51 52 /** return a string with all parameters and value 53 */ 41 /** return a string with all parameters and value */ 54 42 string print(); 55 56 43 }; 57 44 #endif -
Interface_Web/trunk/pspaWT/sources/controler/include/elementBend.h
r418 r424 8 8 //#include "PhysicalConstants.h" 9 9 10 11 10 using namespace std; 12 11 13 12 // aimant dipolaire, DANS LE PLAN XZ (le champ est dans la direction Y) 14 13 15 16 14 class elementBend : public abstractElement 17 15 { 18 16 19 double angleDeg_; // deg. 20 double radius_; // m 21 double beta1_; // deg. 22 double beta2_; // deg. 23 double momentum_; // MeV/c 17 double angleDeg_; // deg. 18 double radius_; // m 19 double beta1_; // deg. 20 double beta2_; // deg. 21 double momentum_; // MeV/c 22 23 double angleDegDef_; // deg. 24 double radiusDef_; // m 25 double beta1Def_; // deg. 26 double beta2Def_; // deg. 27 double momentumDef_; // MeV/c 24 28 25 double angleDegDef_; // deg. 26 double radiusDef_; // m 27 double beta1Def_; // deg. 28 double beta2Def_; // deg. 29 double momentumDef_; // MeV/c 29 void setDefaultValues(); 30 void setDefaults(); 31 32 public: 30 33 31 32 33 void setDefaultValues(); 34 void setDefaults(); 35 36 37 public: 38 39 elementBend(); 40 41 ~elementBend() {;} 42 43 double getLenghtOfElement() const; 44 45 virtual void setParametersString(string* param); 46 47 virtual string* getParametersString() const; 48 49 // virtual string parmelaOutputFlow() const; 50 51 // virtual string transportOutputFlow() const; 52 53 virtual string FileOutputFlow() const; 54 55 virtual vector< pair<string, vector<string> > > parametersToSoftware () const; 56 57 virtual void FileInput(ifstream& ifs); 58 59 /** return a string with all parameters and value 60 */ 61 string print(); 62 34 elementBend(); 35 ~elementBend() {;} 36 37 double getLenghtOfElement() const; 38 virtual void setParametersString(string* param); 39 virtual string* getParametersString() const; 40 virtual vector< pair<string, vector<string> > > parametersToSoftware () const; 41 // virtual string parmelaOutputFlow() const; 42 // virtual string transportOutputFlow() const; 43 44 virtual string FileOutputFlow() const; 45 virtual void FileInput(ifstream& ifs); 46 virtual void InputRep(UAPNode* root); 47 48 /** return a string with all parameters and value */ 49 string print(); 63 50 }; 64 65 66 51 #endif -
Interface_Web/trunk/pspaWT/sources/controler/include/elementCell.h
r418 r424 13 13 class elementCell : public abstractElement 14 14 { 15 // int nbParam_; 16 // string* parametersString_; 17 double initialPhaseDef_; 18 double acceleratingFieldDef_; 19 string acceleratingShapeFileDef_; 20 string focusingMagFileDef_; 21 double offsetMagDef_; 22 double scaleFactorDef_; 23 double initialPhase_; 24 double acceleratingField_; 25 string acceleratingShapeFile_; 26 string focusingMagFile_; 27 double offsetMag_; 28 double scaleFactor_; 29 30 void setDefaultValues(); 31 void setDefaults(); 15 32 16 // int nbParam_; 17 // string* parametersString_; 33 public : 34 35 elementCell(); 36 ~elementCell() { ;} 18 37 19 20 double initialPhaseDef_; 21 double acceleratingFieldDef_; 22 23 string acceleratingShapeFileDef_; 24 string focusingMagFileDef_; 25 double offsetMagDef_; 26 double scaleFactorDef_; 27 28 double initialPhase_; 29 double acceleratingField_; 30 31 string acceleratingShapeFile_; 32 string focusingMagFile_; 33 double offsetMag_; 34 double scaleFactor_; 35 36 37 void setDefaultValues(); 38 39 void setDefaults(); 40 41 public : 42 43 elementCell(); 44 45 46 ~elementCell() { ;} 47 48 virtual string* getParametersString() const; 49 50 virtual void setParametersString(string* param); 51 52 // virtual string parmelaOutputFlow() const; 53 54 /* virtual string transportOutputFlow() const */ 55 /* { */ 56 /* ostringstream sortie; */ 57 /* cout << " CELL sortie transport non programmee " << endl; */ 58 /* return sortie.str(); */ 59 /* } */ 60 61 62 virtual string FileOutputFlow() const; 63 64 virtual vector< pair<string, vector<string> > > parametersToSoftware () const; 65 66 virtual void FileInput(ifstream& ifs); 67 68 /** return a string with all parameters and value 69 */ 70 string print(); 71 38 virtual string* getParametersString() const; 39 virtual void setParametersString(string* param); 40 virtual vector< pair<string, vector<string> > > parametersToSoftware () const; 41 // virtual string parmelaOutputFlow() const; 42 // virtual string transportOutputFlow() const */ 43 44 virtual string FileOutputFlow() const; 45 virtual void FileInput(ifstream& ifs); 46 virtual void InputRep(UAPNode* root); 47 48 /** return a string with all parameters and value */ 49 string print(); 72 50 }; 73 74 51 #endif -
Interface_Web/trunk/pspaWT/sources/controler/include/elementDrift.h
r418 r424 1 1 #ifndef DRIFTDEFINITION_SEEN 2 2 #define DRIFTDEFINITION_SEEN 3 3 4 #include <string> 4 5 5 #include "abstractElement.h" 6 6 … … 9 9 class elementDrift : public abstractElement 10 10 { 11 12 void setDefaultValues(); 13 void setDefaults(); 11 14 12 void setDefaultValues();15 public: 13 16 14 void setDefaults(); 17 elementDrift(); 18 ~elementDrift() {;} 15 19 16 public: 17 18 elementDrift(); 19 20 21 ~elementDrift() {;} 22 23 24 virtual string* getParametersString() const; 25 26 virtual void setParametersString(string* param); 27 28 // virtual string parmelaOutputFlow() const; 29 30 // virtual string transportOutputFlow() const; 31 20 virtual string* getParametersString() const; 21 virtual void setParametersString(string* param); 22 virtual vector< pair<string, vector<string> > > parametersToSoftware () const; 23 // virtual string parmelaOutputFlow() const; 24 // virtual string transportOutputFlow() const; 32 25 33 26 virtual string FileOutputFlow() const; 27 virtual void FileInput(ifstream& ifs); 28 virtual void InputRep(UAPNode* root); 34 29 35 virtual vector< pair<string, vector<string> > > parametersToSoftware () const; 36 37 virtual void FileInput(ifstream& ifs); 38 39 /** return a string with all parameters and value 40 */ 30 /** return a string with all parameters and value */ 41 31 string print(); 42 43 32 }; 44 45 46 47 33 #endif -
Interface_Web/trunk/pspaWT/sources/controler/include/elementFit.h
r418 r424 8 8 using namespace std; 9 9 10 11 10 class elementFit : public abstractElement 12 11 { 12 // unites transport ( cm ; mrad) 13 string variableName_; 14 double variableValue_, tolerance_; 15 string variableNameDef_; 16 double variableValueDef_, toleranceDef_; 17 18 void setDefaultValues(); 19 void setDefaults(); 13 20 21 public: 14 22 15 // unites transport ( cm ; mrad) 16 string variableName_; 17 double variableValue_, tolerance_; 23 elementFit(); 24 ~elementFit() {;} 18 25 19 string variableNameDef_; 20 double variableValueDef_, toleranceDef_; 26 virtual void setParametersString(string* param); 27 virtual string* getParametersString() const; 28 virtual vector< pair<string, vector<string> > > parametersToSoftware () const; 29 // virtual string parmelaOutputFlow() const; 30 // virtual string transportOutputFlow() const; 21 31 22 void setDefaultValues(); 23 void setDefaults(); 24 25 26 public: 27 28 elementFit(); 29 ~elementFit() {;} 30 31 32 virtual void setParametersString(string* param); 33 34 virtual string* getParametersString() const; 35 36 // virtual string parmelaOutputFlow() const; 37 38 // virtual string transportOutputFlow() const; 39 40 virtual string FileOutputFlow() const; 41 42 virtual vector< pair<string, vector<string> > > parametersToSoftware () const; 32 virtual string FileOutputFlow() const; 33 virtual void FileInput(ifstream& ifs); 34 virtual void InputRep(UAPNode* root); 43 35 44 virtual void FileInput(ifstream& ifs); 45 46 /** return a string with all parameters and value 47 */ 48 string print(); 49 36 /** return a string with all parameters and value */ 37 string print(); 50 38 }; 51 39 #endif -
Interface_Web/trunk/pspaWT/sources/controler/include/elementRfgun.h
r418 r424 13 13 { 14 14 15 // int nbParam_; 16 // string* parametersString_; 15 // int nbParam_; 16 // string* parametersString_; 17 double defaultPhaseStep_; 18 int defaultNmacrop_; 19 double defaultSigma_t_; 20 double defaultSigma_r_; 21 double defaultEmit_x_; 22 double defaultEmit_y_; 23 double defaultE_cin_; 24 double defaultSigma_E_; 25 double defaultTotalCharge_; 26 double phaseStep_; // a recuperer dans les parametres globaux (methode setPhaseStep) 27 int nmacrop_; 28 double sigma_t_; // picoseconds 29 double sigma_r_; // cm 30 double emit_x_; // pi.mm.mrad 31 double emit_y_; // pi.mm.mrad 32 double E_cin_; // MeV 33 double sigma_E_; // MeV 34 double totalCharge_; // nC 35 36 void setDefaultValues(); 37 void setDefaults(); 17 38 18 double defaultPhaseStep_; 19 int defaultNmacrop_; 20 double defaultSigma_t_; 21 double defaultSigma_r_; 22 double defaultEmit_x_; 23 double defaultEmit_y_; 24 double defaultE_cin_; 25 double defaultSigma_E_; 26 double defaultTotalCharge_; 39 public: 27 40 28 double phaseStep_; // a recuperer dans les parametres globaux (methode setPhaseStep) 29 int nmacrop_; 30 double sigma_t_; // picoseconds 31 double sigma_r_; // cm 32 double emit_x_; // pi.mm.mrad 33 double emit_y_; // pi.mm.mrad 34 double E_cin_; // MeV 35 double sigma_E_; // MeV 36 double totalCharge_; // nC 37 38 void setDefaultValues(); 39 40 void setDefaults(); 41 42 public: 43 44 elementRfgun(); 45 46 ~elementRfgun() {;} 47 48 virtual void setPhaseStep(double ph) { phaseStep_ = ph;} 49 50 51 virtual string* getParametersString() const; 52 53 virtual void setParametersString(string* param); 54 55 virtual inline double getInitialKineticEnergy() const {return E_cin_;} 56 57 // virtual string parmelaOutputFlow() const; 58 59 /* virtual string transportOutputFlow() const */ 60 /* { */ 61 /* ostringstream sortie; */ 62 /* cout << " CELL sortie transport non programmee " << endl; */ 63 /* return sortie.str(); */ 64 /* } */ 65 66 // virtual string generatorOutputFlow() const; 41 elementRfgun(); 42 ~elementRfgun() {;} 43 44 virtual void setPhaseStep(double ph) { phaseStep_ = ph;} 45 virtual string* getParametersString() const; 46 virtual void setParametersString(string* param); 47 virtual inline double getInitialKineticEnergy() const {return E_cin_;} 48 virtual vector< pair<string, vector<string> > > parametersToSoftware () const; 49 // virtual string parmelaOutputFlow() const; 50 // virtual string transportOutputFlow() const 51 // virtual string generatorOutputFlow() const; 67 52 68 virtual string FileOutputFlow() const; 69 virtual vector< pair<string, vector<string> > > parametersToSoftware () const; 53 virtual string FileOutputFlow() const; 54 virtual void FileInput(ifstream& ifs); 55 virtual void InputRep(UAPNode* root); 70 56 71 virtual void FileInput(ifstream& ifs); 72 73 /** return a string with all parameters and value 74 */ 75 string print(); 76 77 57 /** return a string with all parameters and value */ 58 string print(); 78 59 }; 79 80 81 60 #endif -
Interface_Web/trunk/pspaWT/sources/controler/include/elementSnapshot.h
r418 r424 10 10 { 11 11 int incr_; 12 13 12 string snapshotFile_; 14 13 void setDefaultValues(); 15 14 void setDefaults(); 16 15 17 16 public : 18 17 19 18 elementSnapshot() {;} 20 19 elementSnapshot(int); … … 23 22 virtual string* getParametersString() const; 24 23 virtual void setParametersString(string* param); 25 // virtual string parmelaOutputFlow() const; 24 virtual vector< pair<string, vector<string> > > parametersToSoftware () const; 25 // virtual string parmelaOutputFlow() const; 26 26 // virtual string transportOutputFlow() const; 27 27 28 28 virtual string FileOutputFlow() const; 29 virtual vector< pair<string, vector<string> > > parametersToSoftware () const;30 31 29 virtual void FileInput(ifstream& ifs); 30 virtual void InputRep(UAPNode* root); 32 31 string print(); 33 32 }; -
Interface_Web/trunk/pspaWT/sources/controler/include/elementSoleno.h
r418 r424 6 6 #include "abstractElement.h" 7 7 8 //#include "mathematicalTools.h" 9 //#include "PhysicalConstants.h" 8 using namespace std; 10 9 11 using namespace std;12 10 class elementSoleno : public abstractElement 13 11 { 12 13 double B0_; // en kilogauss 14 double B0Def_;// en kilogauss 15 bool varyB0_; 16 bool varyB0Def_; 17 18 void setDefaultValues(); 19 void setDefaults(); 20 21 public : 14 22 15 double B0_; // en kilogauss 16 double B0Def_; // en kilogauss 23 elementSoleno(); 24 ~elementSoleno() {;} 25 26 virtual void setParametersString(string* param); 27 virtual string* getParametersString() const; 28 virtual vector< pair<string, vector<string> > > parametersToSoftware () const; 29 // virtual string parmelaOutputFlow() const; 30 // virtual string transportOutputFlow() const; 17 31 18 bool varyB0_; 19 bool varyB0Def_; 20 21 22 23 void setDefaultValues(); 24 void setDefaults(); 25 26 27 28 public : 29 30 elementSoleno(); 31 32 ~elementSoleno() {;} 33 34 virtual void setParametersString(string* param); 35 36 virtual string* getParametersString() const; 37 38 // virtual string parmelaOutputFlow() const; 39 40 // virtual string transportOutputFlow() const; 41 42 virtual string FileOutputFlow() const; 43 44 virtual vector< pair<string, vector<string> > > parametersToSoftware () const; 32 virtual string FileOutputFlow() const; 33 virtual void FileInput(ifstream& ifs); 34 virtual void InputRep(UAPNode* root); 45 35 46 virtual void FileInput(ifstream& ifs); 47 48 /** return a string with all parameters and value 49 */ 50 string print(); 51 36 /** return a string with all parameters and value */ 37 string print(); 52 38 }; 53 39 #endif -
Interface_Web/trunk/pspaWT/sources/controler/include/globalParameters.h
r257 r424 5 5 #include <string> 6 6 #include <fstream> 7 8 #include "UAP/UAPNode.hpp" 7 9 8 10 using namespace std; … … 56 58 string FileOutputFlow() const; 57 59 void FileInput(ifstream& ifs); 60 61 void InputRep(UAPNode* root); 58 62 }; 59 63 #endif -
Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc
r419 r424 5 5 #include "softwareTransport.h" 6 6 #include "GWt_pspaApplication.h" 7 #include "GWt_console.h" Ã7 #include "GWt_console.h" 8 8 #include "softwareGenerator.h" 9 9 #include "softwareTest.h" … … 12 12 #include <stdio.h> 13 13 #include <fstream> 14 15 #include "UAP/UAPUtilities.hpp" 16 #include "AML/AMLReader.hpp" 14 17 15 18 dataManager::dataManager(PspaApplication* pspa) : … … 102 105 void dataManager::clearSectionToExecute(int a) { 103 106 cout << " dataManager::clearSectionToExecute efaacement section d'index : " << a << endl; 104 if (a <0) return;105 if (a >=jobList_.size()) return;106 107 // lors de la creation de la section on a fait un 'new' d'un softwareXXXX108 // on fait ici le 'delete'107 if (a < 0) return; 108 if (a >= (int)jobList_.size()) return; 109 110 // lors de la creation de la section on a fait un 'new' d'un 111 // softwareXXXX : on fait ici le 'delete' 109 112 110 113 const abstractSoftware* soft = jobList_.at(a)->getSoftware(); 111 114 if ( soft != NULL ) delete soft; 112 115 jobList_.erase (jobList_.begin()+a); 113 116 } … … 151 154 abstractSoftware* softw = NULL; 152 155 string workingDir = pspa_->getWorkingDir(); 153 int debut; 154 int fin; 156 155 157 // on verifie la consecution des sections 156 158 int lastel = 0; 157 for(unsigned k = 0; k < jobList_.size(); k++) 158 {159 if ( jobList_[k]->getElementNumberInSection() != lastel +1 ) {160 consoleMessage("dataManager::executeAll ERROR : sections should be consecutive ");161 return false; 162 } else {163 lastel = jobList_[k]->getLastElementNumberInSection(); 164 165 } 166 167 for(unsigned k = 0; k < jobList_.size(); k++)168 169 159 for(unsigned k = 0; k < jobList_.size(); k++) { 160 if ( jobList_[k]->getElementNumberInSection() != lastel +1 ) { 161 consoleMessage("dataManager::executeAll ERROR : sections should be consecutive "); 162 return false; 163 } else { 164 lastel = jobList_[k]->getLastElementNumberInSection(); 165 } 166 } 167 168 unsigned debut; 169 unsigned fin; 170 for(unsigned k = 0; k < jobList_.size(); k++) { 171 cout << " dataManager::executeAll je m'apprete a executer : " << (jobList_[k]->getSoftware()->getName()) << endl; 170 172 171 172 173 174 175 173 debut = jobList_[k]->getElementNumberInSection(); 174 fin = jobList_[k]->getLastElementNumberInSection(); 175 softw = jobList_[k]->getSoftware(); 176 177 if (softw == NULL) { 176 178 success = false; 177 179 consoleMessage("dataManager::executeAll : unknown software"); … … 196 198 if ( !success ) break; 197 199 198 199 200 if ( debut < firstComputedElemNumero_ ) firstComputedElemNumero_ = debut; 200 201 if ( fin > lastComputedElemNumero_ ) lastComputedElemNumero_ = fin; … … 203 204 cout << "dataManager::executeAll #diagnosticBeam= " << diagnosticBeam_.size() << endl; 204 205 cout << "dataManager::executeAll #getBeamLineSize()= " << getBeamLineSize() << endl; 205 for ( intj = debut; j <= fin; j++) {206 for (unsigned j = debut; j <= fin; j++) { 206 207 abstractElement* elPtr= getElementPointerFromNumero(j); 207 208 cout << "[" << j << "] " << elPtr->getNomdElement().getExpandedName() << endl; 208 209 } 209 210 } //k 210 211 211 212 cout << " dataManager::executeAll premier element : " << firstComputedElemNumero_ << " dernier : " << lastComputedElemNumero_ << endl; 212 213 213 return success; 214 214 } … … 233 233 outfile << globParam_.FileOutputFlow(); 234 234 abstractElement* elPtr; 235 for( unsignedk = 0; k < getBeamLineSize() ; k++)235 for(int k = 0; k < getBeamLineSize() ; k++) 236 236 { 237 238 237 elPtr = pspa_->getBeamLine()->getAbstractElement(k); 238 outfile << elPtr->FileOutputFlow(); 239 239 } 240 240 outfile.close(); 241 } 242 243 // ecriture sur fichier AML 244 void dataManager::writeToAMLFile(string fileName) 245 { 246 UAPNode* uap_root = NULL; 247 uap_root = new UAPNode("UAP_root"); 248 UAPNode* rep = uap_root->addChild("AML_representation"); 249 250 // root node in the hierarchy 251 UAPNode* lab = rep->addChild("laboratory"); 252 lab->addAttribute("name","PSPA lab"); 253 254 // general global parameters 255 globParam_.InputRep(lab); 256 257 // accelerator or section of accelerator 258 //UAPNode* acc = lab->addChild("machine"); 259 //acc->addAttribute("name",fileName); 260 261 // sequence of elements 262 UAPNode* sect = lab->addChild("sector"); 263 sect->addAttribute("name","a_sect"); 264 265 abstractElement* elPtr; 266 for(int k = 0; k < getBeamLineSize() ; k++) { 267 elPtr = pspa_->getBeamLine()->getAbstractElement(k); 268 elPtr->InputRep(sect); 269 } 270 271 cout << "!Create the AML file ---------------------------" << endl; 272 AMLReader reader; 273 string aml_file = pspa_->getWorkingDir() + "/" + fileName + ".aml"; 274 reader.AMLRepToAMLFile (uap_root, aml_file); 241 275 } 242 276 -
Interface_Web/trunk/pspaWT/sources/controler/src/elementBeam.cc
r418 r424 3 3 #include "mixedTools.h" 4 4 5 elementBeam::elementBeam() : abstractElement() { 6 setDefaultValues(); 7 setDefaults(); 8 elementName_ = nomdElements("beam"); 9 nbParam_ = elementName_.getElementNbParameters(); 10 parametersString_ = new string[nbParam_+1]; 11 // transportOk_ = true; 12 // registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk); 5 elementBeam::elementBeam() : abstractElement() 6 { 7 setDefaultValues(); 8 setDefaults(); 9 elementName_ = nomdElements("beam"); 10 nbParam_ = elementName_.getElementNbParameters(); 11 parametersString_ = new string[nbParam_+1]; 12 // transportOk_ = true; 13 // registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk); 13 14 } 14 15 15 16 elementBeam::~elementBeam() {;} 16 17 17 void elementBeam::setDefaultValues() { 18 defaultSpecificName_ = "beam"; 19 xDef_ = 0.0; 20 xpDef_ = 0.0; 21 yDef_ = 0.0; 22 ypDef_ = 0.0; 23 dlDef_ = 0.0; 24 delDef_ = 0.0; 25 p0Def_ = 0.0; 18 void elementBeam::setDefaultValues() 19 { 20 defaultSpecificName_ = "beam"; 21 xDef_ = 0.0; 22 xpDef_ = 0.0; 23 yDef_ = 0.0; 24 ypDef_ = 0.0; 25 dlDef_ = 0.0; 26 delDef_ = 0.0; 27 p0Def_ = 0.0; 26 28 } 27 29 28 void elementBeam::setDefaults() { 29 specificName_ = defaultSpecificName_; 30 x_ = xDef_; 31 xp_ = xpDef_; 32 y_ = yDef_; 33 yp_ = ypDef_; 34 dl_ = dlDef_; 35 del_ = delDef_; 36 p0_ = p0Def_; 30 void elementBeam::setDefaults() 31 { 32 specificName_ = defaultSpecificName_; 33 x_ = xDef_; 34 xp_ = xpDef_; 35 y_ = yDef_; 36 yp_ = ypDef_; 37 dl_ = dlDef_; 38 del_ = delDef_; 39 p0_ = p0Def_; 37 40 } 38 41 39 40 string* elementBeam::getParametersString() const{41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 42 string* elementBeam::getParametersString() const 43 { 44 int compteur = -1; 45 parametersString_[++compteur] = mixedTools::intToString(nbParam_); 46 parametersString_[++compteur] = specificName_; 47 parametersString_[++compteur] = mixedTools::doubleToString(x_); 48 parametersString_[++compteur] = mixedTools::doubleToString(xp_); 49 parametersString_[++compteur] = mixedTools::doubleToString(y_); 50 parametersString_[++compteur] = mixedTools::doubleToString(yp_); 51 parametersString_[++compteur] = mixedTools::doubleToString(dl_); 52 parametersString_[++compteur] = mixedTools::doubleToString(del_); 53 parametersString_[++compteur] = mixedTools::doubleToString(p0_); 54 if ( compteur != nbParam_ ) { 55 cerr << " elementBeam::getParametersString() : ERROR nr pf parameters doesnt match " << endl; 56 return NULL; 57 } 58 return parametersString_; 56 59 } 57 60 58 59 60 61 void elementBeam::setParametersString(string* param) { 62 if ( param == NULL ) 63 { 64 cerr << " elementBeam::setParametersString parameters empty parameter set"; 65 return; 66 } 67 int compteur = -1; 68 int nbparam = atoi(param[++compteur].c_str()); 69 if ( nbparam != nbParam_ ) 70 { 71 cerr << " elementBeam::setParametersString parameters do not match for a BEAM"; 72 return; 73 } 61 void elementBeam::setParametersString(string* param) 62 { 63 if ( param == NULL ) { 64 cerr << " elementBeam::setParametersString parameters empty parameter set"; 65 return; 66 } 67 int compteur = -1; 68 int nbparam = atoi(param[++compteur].c_str()); 69 if ( nbparam != nbParam_ ) { 70 cerr << " elementBeam::setParametersString parameters do not match for a BEAM"; 71 return; 72 } 74 73 75 76 77 78 79 80 81 82 74 specificName_ = param[++compteur]; 75 x_ = atof(param[++compteur].c_str()); 76 xp_ = atof(param[++compteur].c_str()); 77 y_ = atof(param[++compteur].c_str()); 78 yp_ = atof(param[++compteur].c_str()); 79 dl_ = atof(param[++compteur].c_str()); 80 del_ = atof(param[++compteur].c_str()); 81 p0_ = atof(param[++compteur].c_str()); 83 82 } 84 83 … … 98 97 // } 99 98 100 string elementBeam::FileOutputFlow() const { 101 ostringstream sortie; 102 // sortie << elementName_.getElementType() << endl; 103 sortie << elementName_.getGenericLabel() << endl; 104 sortie << specificName_ << endl; 105 sortie << x_ << " " << xp_ << " " << y_ << " " << yp_ << endl; 106 sortie << dl_ << " " << del_ << " " << p0_ << endl; 107 cout << " elementBeam::FileOutputFlow, p0 = " << p0_ << endl; 108 return sortie.str(); 99 string elementBeam::FileOutputFlow() const 100 { 101 ostringstream sortie; 102 // sortie << elementName_.getElementType() << endl; 103 sortie << elementName_.getGenericLabel() << endl; 104 sortie << specificName_ << endl; 105 sortie << x_ << " " << xp_ << " " << y_ << " " << yp_ << endl; 106 sortie << dl_ << " " << del_ << " " << p0_ << endl; 107 cout << " elementBeam::FileOutputFlow, p0 = " << p0_ << endl; 108 return sortie.str(); 109 109 } 110 110 111 vector< pair<string, vector<string> > > elementBeam::parametersToSoftware () const { 111 vector< pair<string, vector<string> > > elementBeam::parametersToSoftware () const 112 { 112 113 vector< pair<string, vector<string> > > sortie; 113 114 sortie.push_back( pair<string, vector<string> >("labelsGenericSpecific", vector<string>() ) ); … … 127 128 } 128 129 129 130 void elementBeam::elementBeam::FileInput(ifstream& ifs){131 132 133 134 135 136 130 void elementBeam::elementBeam::FileInput(ifstream& ifs) 131 { 132 ifs >> specificName_; 133 ifs >> x_ >> xp_ >> y_ >> yp_; 134 ifs >> dl_ >> del_ >> p0_; 135 cout << " elementBeam::FileFileInput, p0 = " << p0_ << endl; 136 lenghtElem_ = getLenghtOfElement(); 137 cout << " elementBeam::FileInput calcule longueur = " << lenghtElem_ << endl; 137 138 } 138 139 140 string elementBeam::print() 141 { 142 string txt = ""; 143 txt += specificName_; 144 txt += "\n 1/2 horizontal beam extend rms (cm) : "; 145 txt += mixedTools::doubleToString(x_); 146 txt += "\n 1/2 horizontal beam divergence rms (mrad) : "; 147 txt += mixedTools::doubleToString(xp_); 148 txt += "\n1/2 vertical beam extend rms (cm) : "; 149 txt += mixedTools::doubleToString(y_); 150 txt += "\n1/2 horizontal beam divergence rms (mrad) : "; 151 txt += mixedTools::doubleToString(yp_); 152 txt += "\n1/2 longitudinal beam extend rms (cm) : "; 153 txt += mixedTools::doubleToString(dl_); 154 txt += "\n1/2 momentum spread rms (mrad) : "; 155 txt += mixedTools::doubleToString(del_); 156 txt += "\nmomentum of the central trajectory (GeV/c) : "; 157 txt += mixedTools::doubleToString(p0_); 158 return txt; 159 } 139 160 140 string elementBeam::print() { 141 string txt = ""; 142 txt += specificName_; 143 txt += "\n 1/2 horizontal beam extend rms (cm) : "; 144 txt += mixedTools::doubleToString(x_); 145 txt += "\n 1/2 horizontal beam divergence rms (mrad) : "; 146 txt += mixedTools::doubleToString(xp_); 147 txt += "\n1/2 vertical beam extend rms (cm) : "; 148 txt += mixedTools::doubleToString(y_); 149 txt += "\n1/2 horizontal beam divergence rms (mrad) : "; 150 txt += mixedTools::doubleToString(yp_); 151 txt += "\n1/2 longitudinal beam extend rms (cm) : "; 152 txt += mixedTools::doubleToString(dl_); 153 txt += "\n1/2 momentum spread rms (mrad) : "; 154 txt += mixedTools::doubleToString(del_); 155 txt += "\nmomentum of the central trajectory (GeV/c) : "; 156 txt += mixedTools::doubleToString(p0_); 157 158 return txt; 161 void elementBeam::InputRep(UAPNode* root) 162 { 163 UAPNode* ele = root->addChild("element"); 164 ele->addAttribute("name",specificName_); 165 166 UAPNode* node = ele->addChild("beam"); 167 168 // je fixe le type de particule, plus tard on pourra donner le choix 169 node->addChild("particle")->addAttribute("type","ELECTRON"); 170 171 // matrice 6X6 172 UAPNode* snode = node->addChild("sigma_matrix"); 173 string txt = ""; 174 txt = mixedTools::doubleToString(x_); 175 snode->addChild("11")->addAttribute("design",txt); 176 txt = mixedTools::doubleToString(xp_); 177 snode->addChild("22")->addAttribute("design",txt); 178 txt = mixedTools::doubleToString(y_); 179 snode->addChild("33")->addAttribute("design",txt); 180 txt = mixedTools::doubleToString(yp_); 181 snode->addChild("44")->addAttribute("design",txt); 182 txt = mixedTools::doubleToString(dl_); 183 snode->addChild("55")->addAttribute("design",txt); 184 txt = mixedTools::doubleToString(del_); 185 snode->addChild("66")->addAttribute("design",txt); 186 187 // momentum of the central trajectory (GeV/c) 188 txt = mixedTools::doubleToString(p0_); 189 node->addChild("pc")->addAttribute("design",txt); 159 190 } -
Interface_Web/trunk/pspaWT/sources/controler/src/elementBend.cc
r418 r424 11 11 nbParam_ = elementName_.getElementNbParameters(); 12 12 parametersString_ = new string[nbParam_+1]; 13 // registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk); 14 // registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk); 15 } 16 17 void elementBend::setDefaultValues() 18 { 19 defaultSpecificName_ = "bend"; 20 angleDegDef_ = 0.0; 21 radiusDef_ = 1.0; 22 beta1Def_ = 0.0; 23 beta2Def_ = 0.0; 24 momentumDef_ = 0.0; 13 // registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk); 14 // registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk); 15 } 16 17 void elementBend::setDefaultValues() 18 { 19 defaultSpecificName_ = "bend"; 20 angleDegDef_ = 0.0; 21 radiusDef_ = 1.0; 22 beta1Def_ = 0.0; 23 beta2Def_ = 0.0; 24 momentumDef_ = 0.0; 25 } 26 27 void elementBend::setDefaults() 28 { 29 specificName_ = defaultSpecificName_; 30 angleDeg_ = angleDegDef_; 31 radius_ = radiusDef_; 32 beta1_ = beta1Def_; 33 beta2_ = beta2Def_; 34 momentum_ = momentumDef_; 35 } 36 37 string* elementBend::getParametersString() const 38 { 39 int compteur = -1; 40 parametersString_[++compteur] = mixedTools::intToString(nbParam_); 41 parametersString_[++compteur] = specificName_; 42 parametersString_[++compteur] = mixedTools::doubleToString( angleDeg_); 43 parametersString_[++compteur] = mixedTools::doubleToString(radius_); 44 parametersString_[++compteur] = mixedTools::doubleToString(momentum_); 45 parametersString_[++compteur] = mixedTools::doubleToString(aperture_); 46 parametersString_[++compteur] = mixedTools::doubleToString(beta1_); 47 parametersString_[++compteur] = mixedTools::doubleToString(beta2_); 48 if ( compteur != nbParam_ ) { 49 cerr << " elementBend::getParametersString() : ERROR nr pf parameters dosnt match " << endl; 50 return NULL; 25 51 } 26 27 void elementBend::setDefaults() 28 { 29 specificName_ = defaultSpecificName_; 30 angleDeg_ = angleDegDef_; 31 radius_ = radiusDef_; 32 beta1_ = beta1Def_; 33 beta2_ = beta2Def_; 34 momentum_ = momentumDef_; 52 return parametersString_; 53 } 54 55 double elementBend::getLenghtOfElement() const 56 { 57 return 1.0e2 * radius_ * angleDeg_ * DEG_TO_RADIANS; 58 } 59 60 61 void elementBend::setParametersString(string* param) 62 { 63 if ( param == NULL ) { 64 cerr << " elementBend::setParametersString parameters empty parameter set"; 65 return; 35 66 } 36 37 string* elementBend::getParametersString() const 38 { 39 int compteur = -1; 40 parametersString_[++compteur] = mixedTools::intToString(nbParam_); 41 parametersString_[++compteur] = specificName_; 42 parametersString_[++compteur] = mixedTools::doubleToString( angleDeg_); 43 parametersString_[++compteur] = mixedTools::doubleToString(radius_); 44 parametersString_[++compteur] = mixedTools::doubleToString(momentum_); 45 parametersString_[++compteur] = mixedTools::doubleToString(aperture_); 46 parametersString_[++compteur] = mixedTools::doubleToString(beta1_); 47 parametersString_[++compteur] = mixedTools::doubleToString(beta2_); 48 if ( compteur != nbParam_ ) { 49 cerr << " elementBend::getParametersString() : ERROR nr pf parameters dosnt match " << endl; 50 return NULL; 51 } 52 return parametersString_; 53 } 54 55 double elementBend::getLenghtOfElement() const 56 { 57 return 1.0e2 * radius_ * angleDeg_ * DEG_TO_RADIANS; 58 } 59 60 61 void elementBend::setParametersString(string* param) 62 { 63 if ( param == NULL ) 64 { 65 cerr << " elementBend::setParametersString parameters empty parameter set"; 66 return; 67 } 68 69 int compteur = -1; 70 int nbparam = atoi(param[++compteur].c_str()); 71 if ( nbparam != nbParam_ ) 72 { 73 cerr << " elementBend::setParametersString parameters do not match for a BEND" << endl; 74 return; 75 } 76 specificName_ = param[++compteur]; 77 angleDeg_ = atof(param[++compteur].c_str()); 78 radius_ = atof(param[++compteur].c_str()); 79 momentum_ = atof(param[++compteur].c_str()); 80 aperture_ = atof(param[++compteur].c_str()); 81 beta1_ = atof(param[++compteur].c_str()); 82 beta2_ = atof(param[++compteur].c_str()); 83 // calcul de la longueur : rayon en m ; longueur en cm 84 lenghtElem_ = getLenghtOfElement(); 85 cout << " elementBend::setParametersString calcule longueur = " << lenghtElem_ << endl; 86 } 67 68 int compteur = -1; 69 int nbparam = atoi(param[++compteur].c_str()); 70 if ( nbparam != nbParam_ ) { 71 cerr << " elementBend::setParametersString parameters do not match for a BEND" << endl; 72 return; 73 } 74 specificName_ = param[++compteur]; 75 angleDeg_ = atof(param[++compteur].c_str()); 76 radius_ = atof(param[++compteur].c_str()); 77 momentum_ = atof(param[++compteur].c_str()); 78 aperture_ = atof(param[++compteur].c_str()); 79 beta1_ = atof(param[++compteur].c_str()); 80 beta2_ = atof(param[++compteur].c_str()); 81 // calcul de la longueur : rayon en m ; longueur en cm 82 lenghtElem_ = getLenghtOfElement(); 83 cout << " elementBend::setParametersString calcule longueur = " << lenghtElem_ << endl; 84 } 87 85 88 86 // string elementBend::parmelaOutputFlow() const … … 109 107 110 108 string elementBend::FileOutputFlow() const 111 { 112 ostringstream sortie; 113 // sortie << elementName_.getElementType() << endl; 114 sortie << elementName_.getGenericLabel() << endl; 115 sortie << specificName_ << endl; 116 sortie << angleDeg_ << " " << radius_ << " " << aperture_ << endl; 117 sortie << beta1_ << " " << beta2_ << " " << momentum_ << endl; 118 return sortie.str(); 119 } 120 121 vector< pair<string, vector<string> > > elementBend::parametersToSoftware () const{ 109 { 110 ostringstream sortie; 111 // sortie << elementName_.getElementType() << endl; 112 sortie << elementName_.getGenericLabel() << endl; 113 sortie << specificName_ << endl; 114 sortie << angleDeg_ << " " << radius_ << " " << aperture_ << endl; 115 sortie << beta1_ << " " << beta2_ << " " << momentum_ << endl; 116 return sortie.str(); 117 } 118 119 vector< pair<string, vector<string> > > elementBend::parametersToSoftware () const 120 { 122 121 vector< pair<string, vector<string> > > sortie; 123 122 sortie.push_back( pair<string, vector<string> >("labelsGenericSpecific", vector<string>() ) ); … … 148 147 } 149 148 150 151 string elementBend::print() { 152 string txt = ""; 153 154 txt += specificName_; 155 txt += "\nangle (deg.) : "; 156 txt += mixedTools::doubleToString(angleDeg_); 157 txt += "\nradius (m) : "; 158 txt += mixedTools::doubleToString(radius_); 159 txt += "\nmomentum (MeV/c) : "; 160 txt += mixedTools::doubleToString(momentum_); 161 txt += "\nlength (cm) : "; 162 txt += mixedTools::doubleToString(lenghtElem_); 163 txt += "\naperture (cm) : "; 164 txt += mixedTools::doubleToString(aperture_); 165 txt += "\npole face rotations (deg.) entrance : "; 166 txt += mixedTools::doubleToString(beta1_); 167 txt += "\nexit : "; 168 txt += mixedTools::doubleToString(beta2_); 169 170 return txt; 171 } 149 string elementBend::print() 150 { 151 string txt = ""; 152 txt += specificName_; 153 txt += "\nangle (deg.) : "; 154 txt += mixedTools::doubleToString(angleDeg_); 155 txt += "\nradius (m) : "; 156 txt += mixedTools::doubleToString(radius_); 157 txt += "\nmomentum (MeV/c) : "; 158 txt += mixedTools::doubleToString(momentum_); 159 txt += "\nlength (cm) : "; 160 txt += mixedTools::doubleToString(lenghtElem_); 161 txt += "\naperture (cm) : "; 162 txt += mixedTools::doubleToString(aperture_); 163 txt += "\npole face rotations (deg.) entrance : "; 164 txt += mixedTools::doubleToString(beta1_); 165 txt += "\nexit : "; 166 txt += mixedTools::doubleToString(beta2_); 167 return txt; 168 } 169 170 void elementBend::InputRep(UAPNode* root) 171 { 172 UAPNode* ele = root->addChild("element"); 173 ele->addAttribute("name",specificName_); 174 175 string txt = ""; 176 txt = mixedTools::doubleToString(lenghtElem_); 177 ele->addChild("length")->addAttribute("design",txt); 178 179 // pour Parmela /aper : radius of aperture at exit (gap) 180 UAPNode* node = ele->addChild("aperture"); 181 node->addAttribute("at","EXIT"); 182 node->addAttribute("shape","CIRCLE"); 183 txt = mixedTools::doubleToString(aperture_); 184 node->addChild("xy_limit")->addAttribute("design",txt); 185 186 // ??? encore pour Parmela /wt : ref energy 187 txt = mixedTools::doubleToString(momentum_); 188 ele->addChild("momentum")->addAttribute("design",txt); 189 190 node = ele->addChild("bend"); 191 192 // bending field g= 1/r = angle/length : on en déduit angle= g*length 193 double g = 1.0/radius_; 194 txt = mixedTools::doubleToString(g); 195 node->addChild("g")->addAttribute("design",txt); 196 197 txt = mixedTools::doubleToString(beta1_); 198 node->addChild("e1")->addAttribute("design",txt); 199 txt = mixedTools::doubleToString(beta2_); 200 node->addChild("e2")->addAttribute("design",txt); 201 } -
Interface_Web/trunk/pspaWT/sources/controler/src/elementCell.cc
r418 r424 8 8 9 9 elementCell::elementCell() : abstractElement() 10 11 12 13 14 15 16 17 10 { 11 setDefaultValues(); 12 setDefaults(); 13 elementName_ = nomdElements("cell"); 14 nbParam_ = elementName_.getElementNbParameters(); 15 parametersString_ = new string[nbParam_+1]; 16 // registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk); 17 } 18 18 19 19 void elementCell::setDefaultValues() 20 20 { 21 22 23 24 25 26 27 21 defaultSpecificName_ = "cell"; 22 initialPhaseDef_ = 0.0; 23 acceleratingFieldDef_ = 1.0; 24 acceleratingShapeFileDef_ = "xxxxxxx"; 25 focusingMagFileDef_ = "xxxxxx"; 26 offsetMagDef_ = 0.0; 27 scaleFactorDef_ = 1.0; 28 28 } 29 29 30 30 void elementCell::setDefaults() 31 31 { 32 specificName_ = defaultSpecificName_; 33 initialPhase_ = initialPhaseDef_; 34 acceleratingField_ = acceleratingFieldDef_; 35 acceleratingShapeFile_ = acceleratingShapeFileDef_; 36 focusingMagFile_ = focusingMagFileDef_; 37 offsetMag_ = offsetMagDef_; 38 scaleFactor_ = scaleFactorDef_; 39 } 40 41 42 string* elementCell::getParametersString() const 43 { 44 int compteur = -1; 45 parametersString_[++compteur] = mixedTools::intToString(nbParam_); 32 specificName_ = defaultSpecificName_; 33 initialPhase_ = initialPhaseDef_; 34 acceleratingField_ = acceleratingFieldDef_; 35 acceleratingShapeFile_ = acceleratingShapeFileDef_; 36 focusingMagFile_ = focusingMagFileDef_; 37 offsetMag_ = offsetMagDef_; 38 scaleFactor_ = scaleFactorDef_; 39 } 40 41 string* elementCell::getParametersString() const 42 { 43 int compteur = -1; 44 parametersString_[++compteur] = mixedTools::intToString(nbParam_); 46 45 parametersString_[++compteur] = specificName_; 47 parametersString_[++compteur] = mixedTools::doubleToString(lenghtElem_); 48 parametersString_[++compteur] = mixedTools::doubleToString(aperture_); 49 parametersString_[++compteur] = mixedTools::doubleToString(initialPhase_); 50 parametersString_[++compteur] = mixedTools::doubleToString( phaseStepMax_); 51 parametersString_[++compteur] = mixedTools::doubleToString(acceleratingField_); 52 parametersString_[++compteur] = acceleratingShapeFile_; 53 parametersString_[++compteur] = focusingMagFile_; 54 parametersString_[++compteur] = mixedTools::doubleToString(offsetMag_); 55 parametersString_[++compteur] = mixedTools::doubleToString(scaleFactor_); 56 if ( compteur != nbParam_ ) { 57 cerr << " elementCell::getParametersString() : ERROR nr pf parameters dosnt match " << endl; 58 return NULL; 59 } 60 return parametersString_; 61 } 62 46 parametersString_[++compteur] = mixedTools::doubleToString(lenghtElem_); 47 parametersString_[++compteur] = mixedTools::doubleToString(aperture_); 48 parametersString_[++compteur] = mixedTools::doubleToString(initialPhase_); 49 parametersString_[++compteur] = mixedTools::doubleToString( phaseStepMax_); 50 parametersString_[++compteur] = mixedTools::doubleToString(acceleratingField_); 51 parametersString_[++compteur] = acceleratingShapeFile_; 52 parametersString_[++compteur] = focusingMagFile_; 53 parametersString_[++compteur] = mixedTools::doubleToString(offsetMag_); 54 parametersString_[++compteur] = mixedTools::doubleToString(scaleFactor_); 55 if ( compteur != nbParam_ ) { 56 cerr << " elementCell::getParametersString() : ERROR nr pf parameters dosnt match " << endl; 57 return NULL; 58 } 59 return parametersString_; 60 } 63 61 64 62 void elementCell::setParametersString(string* param) 65 { 66 if ( param == NULL ) 67 { 68 cerr << " elementCell::setParametersString parameters empty parameter set"; 69 return; 70 } 71 int compteur = -1; 72 int nbparam = atoi(param[++compteur].c_str()); 73 if ( nbparam != nbParam_ ) 74 { 75 cerr << " elementCell::setParametersString parameters do not match for a CELL"; 76 return; 77 } 78 79 specificName_ = param[++compteur]; 80 lenghtElem_ = atof(param[++compteur].c_str()); 81 aperture_ = atof(param[++compteur].c_str()); 82 initialPhase_ = atof(param[++compteur].c_str()); 83 phaseStepMax_ = atof(param[++compteur].c_str()); 84 acceleratingField_ = atof(param[++compteur].c_str()); 85 acceleratingShapeFile_ = param[++compteur]; 86 focusingMagFile_ = param[++compteur]; 87 offsetMag_ = atof(param[++compteur].c_str()); 88 scaleFactor_ = atof(param[++compteur].c_str()); 89 } 63 { 64 if ( param == NULL ) { 65 cerr << " elementCell::setParametersString parameters empty parameter set"; 66 return; 67 } 68 int compteur = -1; 69 int nbparam = atoi(param[++compteur].c_str()); 70 if ( nbparam != nbParam_ ) { 71 cerr << " elementCell::setParametersString parameters do not match for a CELL"; 72 return; 73 } 74 75 specificName_ = param[++compteur]; 76 lenghtElem_ = atof(param[++compteur].c_str()); 77 aperture_ = atof(param[++compteur].c_str()); 78 initialPhase_ = atof(param[++compteur].c_str()); 79 phaseStepMax_ = atof(param[++compteur].c_str()); 80 acceleratingField_ = atof(param[++compteur].c_str()); 81 acceleratingShapeFile_ = param[++compteur]; 82 focusingMagFile_ = param[++compteur]; 83 offsetMag_ = atof(param[++compteur].c_str()); 84 scaleFactor_ = atof(param[++compteur].c_str()); 85 } 90 86 91 87 // string elementCell::parmelaOutputFlow() const … … 107 103 108 104 string elementCell::FileOutputFlow() const 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 vector< pair<string, vector<string> > > elementCell::parametersToSoftware () const{105 { 106 ostringstream sortie; 107 // sortie << elementName_.getElementType() << endl; 108 sortie << elementName_.getGenericLabel() << endl; 109 sortie << specificName_ << endl; 110 sortie << lenghtElem_ << " " << aperture_ << endl; 111 sortie << initialPhase_ << " " << acceleratingField_ << endl; 112 sortie << phaseStepMax_ << endl; 113 sortie << acceleratingShapeFile_ << endl; 114 sortie << focusingMagFile_ << endl; 115 sortie << offsetMag_ << " " << scaleFactor_ << endl; 116 return sortie.str(); 117 } 118 119 vector< pair<string, vector<string> > > elementCell::parametersToSoftware () const 120 { 125 121 vector< pair<string, vector<string> > > sortie; 126 122 sortie.push_back( pair<string, vector<string> >("labelsGenericSpecific", vector<string>() ) ); … … 140 136 sortie.back().second.push_back(mixedTools::doubleToString( offsetMag_)); 141 137 sortie.back().second.push_back(mixedTools::doubleToString( scaleFactor_)); 142 138 143 139 return sortie; 144 140 } 145 146 141 147 142 void elementCell::FileInput(ifstream& ifs) … … 156 151 } 157 152 158 159 string elementCell::print() { 160 string txt = ""; 161 162 163 txt += specificName_; 164 txt += "\nlength (cm) : "; 165 txt += mixedTools::doubleToString(lenghtElem_); 166 txt += "\naperture (cm) : "; 167 txt += mixedTools::doubleToString(aperture_); 168 txt += "\ninitial phase (deg.) : "; 169 txt += mixedTools::doubleToString(initialPhase_); 170 txt += "\nmax phase step (deg.) : "; 171 txt += mixedTools::doubleToString(phaseStepMax_); 172 txt += "\nmax accelerating field (MV/m) : "; 173 txt += mixedTools::doubleToString(acceleratingField_); 174 txt += "\nname of file for field shape : "; 175 txt += acceleratingShapeFile_; 176 txt += "\nname of file for focusing mag. field : "; 177 txt += focusingMagFile_; 178 txt += "\n z-offset for mag. field : "; 179 txt += mixedTools::doubleToString(offsetMag_); 180 txt += "\n scaling factor for mag. field : "; 181 txt += mixedTools::doubleToString(scaleFactor_); 182 return txt; 183 } 153 string elementCell::print() 154 { 155 string txt = ""; 156 txt += specificName_; 157 txt += "\nlength (cm) : "; 158 txt += mixedTools::doubleToString(lenghtElem_); 159 txt += "\naperture (cm) : "; 160 txt += mixedTools::doubleToString(aperture_); 161 txt += "\ninitial phase (deg.) : "; 162 txt += mixedTools::doubleToString(initialPhase_); 163 txt += "\nmax phase step (deg.) : "; 164 txt += mixedTools::doubleToString(phaseStepMax_); 165 txt += "\nmax accelerating field (MV/m) : "; 166 txt += mixedTools::doubleToString(acceleratingField_); 167 txt += "\nname of file for field shape : "; 168 txt += acceleratingShapeFile_; 169 txt += "\nname of file for focusing mag. field : "; 170 txt += focusingMagFile_; 171 txt += "\n z-offset for mag. field : "; 172 txt += mixedTools::doubleToString(offsetMag_); 173 txt += "\n scaling factor for mag. field : "; 174 txt += mixedTools::doubleToString(scaleFactor_); 175 return txt; 176 } 177 178 void elementCell::InputRep(UAPNode* root) 179 { 180 UAPNode* ele = root->addChild("element"); 181 ele->addAttribute("name",specificName_); 182 183 UAPNode* node = ele->addChild("methods"); 184 node->addChild("tracking")->addAttribute("value","parmela"); 185 186 string txt = ""; 187 txt = mixedTools::doubleToString(lenghtElem_); 188 ele->addChild("length")->addAttribute("design",txt); 189 190 node = ele->addChild("aperture"); 191 node->addAttribute("at","ENTRANCE"); 192 node->addAttribute("shape","CIRCLE"); 193 txt = mixedTools::doubleToString(aperture_); 194 node->addChild("xy_limit")->addAttribute("design",txt); 195 196 node = ele->addChild("linac_cavity"); 197 txt = mixedTools::doubleToString(initialPhase_); 198 node->addChild("phase0")->addAttribute("design",txt); 199 txt = mixedTools::doubleToString(acceleratingField_); 200 node->addChild("gradient")->addAttribute("design",txt); 201 202 // données propres à Parmela 203 ele->addChild("comment")->addAttribute("text","data specific to Parmela"); 204 txt = mixedTools::doubleToString(phaseStepMax_); 205 ele->addChild("phaseStepMax")->addAttribute("value",txt); 206 txt = acceleratingShapeFile_; 207 ele->addChild("acceleratingShapeField")->addAttribute("name",txt); 208 209 if ( focusingMagFile_ != "") { 210 txt = focusingMagFile_; 211 ele->addChild("focusingMagneticField")->addAttribute("name",txt); 212 txt = mixedTools::doubleToString(offsetMag_); 213 ele->addChild("z_offset")->addAttribute("value",txt); 214 txt = mixedTools::doubleToString(scaleFactor_); 215 ele->addChild("scaling_factor")->addAttribute("value",txt); 216 } 217 } -
Interface_Web/trunk/pspaWT/sources/controler/src/elementDrift.cc
r418 r424 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); 18 15 // registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk); 16 // registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk); 17 // registerAcceptableSoftware(nomDeLogiciel::test, TBoolOk); 19 18 } 20 19 21 void elementDrift::setDefaultValues() 22 { 23 defaultSpecificName_ = "drift"; 20 void elementDrift::setDefaultValues() { 21 defaultSpecificName_ = "drift"; 22 } 23 24 void elementDrift::setDefaults() { 25 specificName_ = defaultSpecificName_; 26 } 27 28 string* elementDrift::getParametersString() const 29 { 30 int compteur = -1; 31 parametersString_[++compteur] = mixedTools::intToString(nbParam_); 32 parametersString_[++compteur] = specificName_; 33 parametersString_[++compteur] = mixedTools::doubleToString(lenghtElem_); 34 parametersString_[++compteur] = mixedTools::doubleToString(aperture_); 35 if ( compteur != nbParam_ ) { 36 cerr << " elementDrift::getParametersString() : ERROR nr pf parameters dosnt match " << endl; 37 return NULL; 24 38 } 25 void elementDrift::setDefaults() 26 { 27 specificName_ = defaultSpecificName_; 39 return parametersString_; 40 } 41 42 void elementDrift::setParametersString(string* param) 43 { 44 if ( param == NULL ) { 45 cerr << " elementDrift::setParametersString parameters empty parameter set"; 46 return; 28 47 } 29 30 31 string* elementDrift::getParametersString() const 32 { 33 int compteur = -1; 34 parametersString_[++compteur] = mixedTools::intToString(nbParam_); 35 parametersString_[++compteur] = specificName_; 36 parametersString_[++compteur] = mixedTools::doubleToString(lenghtElem_); 37 parametersString_[++compteur] = mixedTools::doubleToString(aperture_); 38 if ( compteur != nbParam_ ) { 39 cerr << " elementDrift::getParametersString() : ERROR nr pf parameters dosnt match " << endl; 40 return NULL; 41 } 42 return parametersString_; 43 } 44 45 void elementDrift::setParametersString(string* param) 46 { 47 if ( param == NULL ) 48 { 49 cerr << " elementDrift::setParametersString parameters empty parameter set"; 50 return; 51 } 52 int compteur = -1; 53 int nbparam = atoi(param[++compteur].c_str()); 54 if ( nbparam != nbParam_ ) 55 { 56 cerr << " elementDrift::setParametersString parameters do not match for a DRIFT"; 57 return; 58 } 48 int compteur = -1; 49 int nbparam = atoi(param[++compteur].c_str()); 50 if ( nbparam != nbParam_ ) { 51 cerr << " elementDrift::setParametersString parameters do not match for a DRIFT"; 52 return; 53 } 59 54 specificName_ = param[++compteur]; 60 61 62 55 lenghtElem_ = atof(param[++compteur].c_str()); 56 aperture_ = atof(param[++compteur].c_str()); 57 } 63 58 64 59 // string elementDrift::parmelaOutputFlow() const … … 68 63 // return sortie.str(); 69 64 // } 70 71 65 72 66 // string elementDrift::transportOutputFlow() const … … 89 83 } 90 84 91 vector< pair<string, vector<string> > > elementDrift::parametersToSoftware () const { 85 vector< pair<string, vector<string> > > elementDrift::parametersToSoftware () const 86 { 92 87 vector< pair<string, vector<string> > > sortie; 93 88 sortie.push_back( pair<string, vector<string> >("labelsGenericSpecific", vector<string>() ) ); … … 100 95 } 101 96 102 103 104 97 void elementDrift::FileInput(ifstream& ifs) 105 98 { … … 108 101 } 109 102 103 string elementDrift::print() 104 { 105 string txt = ""; 106 txt += specificName_; 107 txt += "\nlength (cm) : "; 108 txt += mixedTools::doubleToString(lenghtElem_); 109 txt += "\naperture (cm) : "; 110 txt += mixedTools::doubleToString(aperture_); 111 return txt; 112 } 110 113 111 string elementDrift::print() { 112 string txt = ""; 114 void elementDrift::InputRep(UAPNode* root) 115 { 116 UAPNode* ele = root->addChild("element"); 117 ele->addAttribute("name",specificName_); 113 118 114 txt += specificName_; 115 txt += "\nlength (cm) : "; 116 txt += mixedTools::doubleToString(lenghtElem_); 117 txt += "\naperture (cm) : "; 118 txt += mixedTools::doubleToString(aperture_); 119 120 return txt; 119 string txt = ""; 120 txt = mixedTools::doubleToString(lenghtElem_); 121 ele->addChild("length")->addAttribute("design",txt); 122 123 UAPNode* node = ele->addChild("aperture"); 124 node->addAttribute("at","EXIT"); 125 node->addAttribute("shape","CIRCLE"); 126 txt = mixedTools::doubleToString(aperture_); 127 node->addChild("xy_limit")->addAttribute("design",txt); 121 128 } -
Interface_Web/trunk/pspaWT/sources/controler/src/elementFit.cc
r418 r424 4 4 elementFit::elementFit() : abstractElement() 5 5 { 6 7 8 9 10 11 12 13 14 6 setDefaultValues(); 7 setDefaults(); 8 elementName_ = nomdElements("fit"); 9 nbParam_ = elementName_.getElementNbParameters(); 10 parametersString_ = new string[nbParam_+1]; 11 // transportOk_ = true; 12 // parmelaIgnored_ = true; 13 // registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk); 14 // registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolIgnore); 15 15 } 16 16 17 17 void elementFit::setDefaultValues() 18 18 { 19 20 21 22 19 defaultSpecificName_ = "fit"; 20 variableNameDef_ = ""; 21 variableValueDef_ = 0.0; 22 toleranceDef_ = 0.0; 23 23 } 24 24 25 25 void elementFit::setDefaults() 26 26 { 27 28 29 30 27 specificName_ = defaultSpecificName_; 28 variableName_ = variableNameDef_; 29 variableValue_ = variableValueDef_; 30 tolerance_ = toleranceDef_; 31 31 } 32 33 34 32 35 33 string* elementFit::getParametersString() const 36 34 { 37 38 39 40 41 42 43 44 45 46 47 35 int compteur = -1; 36 parametersString_[++compteur] = mixedTools::intToString(nbParam_); 37 parametersString_[++compteur] = specificName_; 38 parametersString_[++compteur] = variableName_; 39 parametersString_[++compteur] = mixedTools::doubleToString(variableValue_ ); 40 parametersString_[++compteur] = mixedTools::doubleToString(tolerance_); 41 if ( compteur != nbParam_ ) { 42 cerr << " elementFit::getParametersString() : ERROR nr pf parameters dosnt match " << endl; 43 return NULL; 44 } 45 return parametersString_; 48 46 } 49 47 50 48 void elementFit::setParametersString(string* param) 51 49 { 52 if ( param == NULL ) 53 { 54 cerr << " elementFit::setParametersString parameters empty parameter set"; 55 return; 56 } 57 int compteur = -1; 58 int nbparam = atoi(param[++compteur].c_str()); 59 if ( nbparam != nbParam_ ) 60 { 61 cerr << " elementFit::setParametersString parameters do not match for a BEND" << endl; 62 return; 63 } 64 65 specificName_ = param[++compteur]; 66 variableName_ = param[++compteur]; 67 variableValue_ = atof(param[++compteur].c_str()); 68 tolerance_ = atof(param[++compteur].c_str()); 50 if ( param == NULL ) { 51 cerr << " elementFit::setParametersString parameters empty parameter set"; 52 return; 53 } 54 int compteur = -1; 55 int nbparam = atoi(param[++compteur].c_str()); 56 if ( nbparam != nbParam_ ) { 57 cerr << " elementFit::setParametersString parameters do not match for a BEND" << endl; 58 return; 59 } 60 61 specificName_ = param[++compteur]; 62 variableName_ = param[++compteur]; 63 variableValue_ = atof(param[++compteur].c_str()); 64 tolerance_ = atof(param[++compteur].c_str()); 69 65 } 70 71 66 72 67 // string elementFit::parmelaOutputFlow() const … … 88 83 string elementFit::FileOutputFlow() const 89 84 { 90 91 92 93 94 95 85 ostringstream sortie; 86 // sortie << elementName_.getElementType() << endl; 87 sortie << elementName_.getGenericLabel() << endl; 88 sortie << specificName_ << endl; 89 sortie << variableName_ << " " << variableValue_ << " " << tolerance_ << endl; 90 return sortie.str(); 96 91 } 97 92 98 vector< pair<string, vector<string> > > elementFit::parametersToSoftware () const { 93 vector< pair<string, vector<string> > > elementFit::parametersToSoftware () const 94 { 99 95 vector< pair<string, vector<string> > > sortie; 100 96 sortie.push_back( pair<string, vector<string> >("labelsGenericSpecific", vector<string>() ) ); … … 108 104 } 109 105 110 111 106 void elementFit::FileInput(ifstream& ifs) 112 107 { 113 114 108 ifs >> specificName_; 109 ifs >> variableName_ >> variableValue_ >> tolerance_; 115 110 } 116 111 112 string elementFit::print() 113 { 114 string txt = ""; 115 txt += specificName_; 116 return txt; 117 } 117 118 118 string elementFit::print() { 119 string txt = ""; 120 121 txt += specificName_; 122 return txt; 119 void elementFit::InputRep(UAPNode* root) 120 { 121 UAPNode* ele = root->addChild("element"); 122 ele->addAttribute("name",specificName_); 123 124 UAPNode* node = ele->addChild("fit"); 125 string txt = variableName_; 126 node->addAttribute("attribute",txt); 127 txt = mixedTools::doubleToString(variableValue_); 128 node->addAttribute("design",txt); 129 txt = mixedTools::doubleToString(tolerance_); 130 node->addAttribute("err",txt); 123 131 } -
Interface_Web/trunk/pspaWT/sources/controler/src/elementRfgun.cc
r418 r424 1 1 #include "elementRfgun.h" 2 3 2 4 3 #include "mathematicalTools.h" … … 9 8 elementRfgun::elementRfgun() : abstractElement() 10 9 { 11 12 13 14 15 16 17 18 10 setDefaultValues(); 11 setDefaults(); 12 elementName_ = nomdElements("rfgun"); 13 nbParam_ = elementName_.getElementNbParameters(); 14 parametersString_ = new string[nbParam_+1]; 15 // parmelaOk_ = true; 16 // registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk); 17 // registerAcceptableSoftware(nomDeLogiciel::generator, TBoolOk); 19 18 } 20 19 21 20 void elementRfgun::setDefaultValues() 22 21 { 23 defaultSpecificName_ = "rfgun"; 24 defaultPhaseStep_ = 1.0; 25 defaultNmacrop_ = 0; 26 defaultSigma_t_ = 0.0; 27 defaultSigma_r_ = 0.0; 28 defaultEmit_x_ = 0.0; 29 defaultEmit_y_ = 0.0; 30 defaultE_cin_ = 0.0; 31 defaultSigma_E_ = 0.0; 32 // defaultNb_true_particles_ = 1.0; 33 defaultTotalCharge_ = 0.0; 22 defaultSpecificName_ = "rfgun"; 23 defaultPhaseStep_ = 1.0; 24 defaultNmacrop_ = 0; 25 defaultSigma_t_ = 0.0; 26 defaultSigma_r_ = 0.0; 27 defaultEmit_x_ = 0.0; 28 defaultEmit_y_ = 0.0; 29 defaultE_cin_ = 0.0; 30 defaultSigma_E_ = 0.0; 31 // defaultNb_true_particles_ = 1.0; 32 defaultTotalCharge_ = 0.0; 33 } 34 35 void elementRfgun::setDefaults() 36 { 37 specificName_ = defaultSpecificName_; 38 phaseStep_ = defaultPhaseStep_; 39 nmacrop_ = defaultNmacrop_; 40 sigma_t_ = defaultSigma_t_; 41 sigma_r_ = defaultSigma_r_ ; 42 emit_x_ = defaultEmit_x_; 43 emit_y_ = defaultEmit_y_; 44 E_cin_ = defaultE_cin_; 45 sigma_E_ = defaultSigma_E_; 46 // nb_true_particles_ = defaultNb_true_particles_ ; 47 totalCharge_ = defaultTotalCharge_; 48 } 49 50 string* elementRfgun::getParametersString() const 51 { 52 int compteur = -1; 53 parametersString_[++compteur] = mixedTools::intToString(nbParam_); 54 parametersString_[++compteur] = specificName_; 55 parametersString_[++compteur] = mixedTools::intToString(nmacrop_); 56 parametersString_[++compteur] = mixedTools::doubleToString(sigma_t_); 57 parametersString_[++compteur] = mixedTools::doubleToString(sigma_r_); 58 parametersString_[++compteur] = mixedTools::doubleToString(emit_x_); 59 parametersString_[++compteur] = mixedTools::doubleToString(emit_y_); 60 parametersString_[++compteur] = mixedTools::doubleToString(E_cin_); 61 parametersString_[++compteur] = mixedTools::doubleToString(sigma_E_); 62 parametersString_[++compteur] = mixedTools::doubleToString(totalCharge_); 63 return parametersString_; 64 } 65 66 void elementRfgun::setParametersString(string* param) 67 { 68 if ( param == NULL ) { 69 cerr << " elementRfgun::setParametersString parameters empty parameter set"; 70 return; 34 71 } 35 36 void elementRfgun::setDefaults() 37 { 38 specificName_ = defaultSpecificName_; 39 phaseStep_ = defaultPhaseStep_; 40 nmacrop_ = defaultNmacrop_; 41 sigma_t_ = defaultSigma_t_; 42 sigma_r_ = defaultSigma_r_ ; 43 emit_x_ = defaultEmit_x_; 44 emit_y_ = defaultEmit_y_; 45 E_cin_ = defaultE_cin_; 46 sigma_E_ = defaultSigma_E_; 47 // nb_true_particles_ = defaultNb_true_particles_ ; 48 totalCharge_ = defaultTotalCharge_; 72 int compteur = -1; 73 int nbparam = atoi(param[++compteur].c_str()); 74 if ( nbparam != nbParam_ ) { 75 cerr << " elementRfgun::setParametersString parameters do not match for a DRIFT"; 76 return; 49 77 } 50 51 52 string* elementRfgun::getParametersString() const 53 { 54 int compteur = -1; 55 parametersString_[++compteur] = mixedTools::intToString(nbParam_); 56 parametersString_[++compteur] = specificName_; 57 parametersString_[++compteur] = mixedTools::intToString(nmacrop_); 58 parametersString_[++compteur] = mixedTools::doubleToString(sigma_t_); 59 parametersString_[++compteur] = mixedTools::doubleToString(sigma_r_); 60 parametersString_[++compteur] = mixedTools::doubleToString(emit_x_); 61 parametersString_[++compteur] = mixedTools::doubleToString(emit_y_); 62 parametersString_[++compteur] = mixedTools::doubleToString(E_cin_); 63 parametersString_[++compteur] = mixedTools::doubleToString(sigma_E_); 64 parametersString_[++compteur] = mixedTools::doubleToString(totalCharge_); 65 return parametersString_; 66 } 67 68 void elementRfgun::setParametersString(string* param) 69 { 70 if ( param == NULL ) 71 { 72 cerr << " elementRfgun::setParametersString parameters empty parameter set"; 73 return; 74 } 75 int compteur = -1; 76 int nbparam = atoi(param[++compteur].c_str()); 77 if ( nbparam != nbParam_ ) 78 { 79 cerr << " elementRfgun::setParametersString parameters do not match for a DRIFT"; 80 return; 81 } 82 83 specificName_ = param[++compteur]; 84 nmacrop_ = atoi(param[++compteur].c_str()); 85 sigma_t_ = atof(param[++compteur].c_str()); 86 sigma_r_ = atof(param[++compteur].c_str()); 87 emit_x_ = atof(param[++compteur].c_str()); 88 emit_y_ = atof(param[++compteur].c_str()); 89 E_cin_ = atof(param[++compteur].c_str()); 90 sigma_E_ = atof(param[++compteur].c_str()); 91 totalCharge_ = atof(param[++compteur].c_str()); 92 93 } 78 79 specificName_ = param[++compteur]; 80 nmacrop_ = atoi(param[++compteur].c_str()); 81 sigma_t_ = atof(param[++compteur].c_str()); 82 sigma_r_ = atof(param[++compteur].c_str()); 83 emit_x_ = atof(param[++compteur].c_str()); 84 emit_y_ = atof(param[++compteur].c_str()); 85 E_cin_ = atof(param[++compteur].c_str()); 86 sigma_E_ = atof(param[++compteur].c_str()); 87 totalCharge_ = atof(param[++compteur].c_str()); 88 } 94 89 95 90 // string elementRfgun::parmelaOutputFlow() const … … 131 126 // } 132 127 133 134 135 128 string elementRfgun::FileOutputFlow() const 136 { 137 ostringstream sortie; 138 // on prend les troncatures tmax et rmax à 3 sigmas 139 // sortie << elementName_.getElementType() << endl; 140 sortie << elementName_.getGenericLabel() << endl; 141 sortie << specificName_ << endl; 142 sortie << nmacrop_ << " " << sigma_t_ << " " << sigma_r_ << endl; 143 sortie << emit_x_ << " " << emit_y_ << endl; 144 sortie << E_cin_ << " " << sigma_E_ << endl; 145 sortie << phaseStep_ << " " << totalCharge_ << endl; 146 return sortie.str(); 147 } 148 149 vector< pair<string, vector<string> > > elementRfgun::parametersToSoftware () const { 129 { 130 ostringstream sortie; 131 // on prend les troncatures tmax et rmax à 3 sigmas 132 // sortie << elementName_.getElementType() << endl; 133 sortie << elementName_.getGenericLabel() << endl; 134 sortie << specificName_ << endl; 135 sortie << nmacrop_ << " " << sigma_t_ << " " << sigma_r_ << endl; 136 sortie << emit_x_ << " " << emit_y_ << endl; 137 sortie << E_cin_ << " " << sigma_E_ << endl; 138 sortie << phaseStep_ << " " << totalCharge_ << endl; 139 return sortie.str(); 140 } 141 142 vector< pair<string, vector<string> > > elementRfgun::parametersToSoftware () const 143 { 150 144 vector< pair<string, vector<string> > > sortie; 151 145 sortie.push_back( pair<string, vector<string> >("labelsGenericSpecific", vector<string>() ) ); … … 179 173 } 180 174 181 182 string elementRfgun::print() { 183 string txt = ""; 184 185 txt += specificName_; 186 txt += "\ntotal charge : "; 187 txt += mixedTools::doubleToString(totalCharge_); 188 txt += "\nsigma_t (ps) : "; 189 txt += mixedTools::doubleToString(sigma_t_); 190 txt += "\nsigma_r (cm) : "; 191 txt += mixedTools::doubleToString(sigma_r_); 192 txt += "\nemittance x (pi.mm.mrad) : "; 193 txt += mixedTools::doubleToString(emit_x_); 194 txt += "\nemittance y (pi.mm.mrad) : "; 195 txt += mixedTools::doubleToString(emit_y_); 196 txt += "\ninitial kinetic energy (MeV) : "; 197 txt += mixedTools::doubleToString(E_cin_); 198 txt += "\nsigma_Ecin (MeV) : "; 199 txt += mixedTools::doubleToString(sigma_E_); 200 txt += "\ntrue number of part. in beam : "; 201 txt += mixedTools::boolToString(nmacrop_); 202 203 return txt; 204 } 175 string elementRfgun::print() 176 { 177 string txt = ""; 178 txt += specificName_; 179 txt += "\ntotal charge : "; 180 txt += mixedTools::doubleToString(totalCharge_); 181 txt += "\nsigma_t (ps) : "; 182 txt += mixedTools::doubleToString(sigma_t_); 183 txt += "\nsigma_r (cm) : "; 184 txt += mixedTools::doubleToString(sigma_r_); 185 txt += "\nemittance x (pi.mm.mrad) : "; 186 txt += mixedTools::doubleToString(emit_x_); 187 txt += "\nemittance y (pi.mm.mrad) : "; 188 txt += mixedTools::doubleToString(emit_y_); 189 txt += "\ninitial kinetic energy (MeV) : "; 190 txt += mixedTools::doubleToString(E_cin_); 191 txt += "\nsigma_Ecin (MeV) : "; 192 txt += mixedTools::doubleToString(sigma_E_); 193 txt += "\ntrue number of part. in beam : "; 194 txt += mixedTools::boolToString(nmacrop_); 195 return txt; 196 } 197 198 void elementRfgun::InputRep(UAPNode* root) 199 { 200 UAPNode* ele = root->addChild("element"); 201 ele->addAttribute("name",specificName_); 202 203 UAPNode* node = ele->addChild("comment"); 204 node->addAttribute("type","RFgun"); 205 node->addAttribute("text","to simulate emission from a photocathode"); 206 207 node = ele->addChild("beam"); 208 node->addChild("particle")->addAttribute("type","ELECTRON"); 209 string txt = ""; 210 txt = mixedTools::intToString(nmacrop_); 211 node->addChild("n_particles")->addAttribute("design",txt); 212 txt = mixedTools::doubleToString(sigma_t_); 213 node->addChild("sig_t")->addAttribute("design",txt); 214 txt = mixedTools::doubleToString(emit_x_); 215 node->addChild("emittance_a")->addAttribute("design",txt); 216 txt = mixedTools::doubleToString(emit_y_); 217 node->addChild("emittance_b")->addAttribute("design",txt); 218 txt = mixedTools::doubleToString(E_cin_); 219 txt = mixedTools::doubleToString(E_cin_); 220 node->addChild("total_energy")->addAttribute("design",txt); 221 txt = mixedTools::doubleToString(sigma_E_); 222 node->addChild("sig_e")->addAttribute("design",txt); 223 txt = mixedTools::doubleToString(totalCharge_); 224 node->addChild("particle_charge")->addAttribute("design",txt); 225 226 // gaussian radial profile 227 txt = mixedTools::doubleToString(sigma_r_); 228 ele->addChild("sigma_r")->addAttribute("value",txt); 229 // integration step size (specific to Parmela) 230 txt = mixedTools::doubleToString(phaseStep_); 231 ele->addChild("phaseStep")->addAttribute("value",txt); 232 } 233 -
Interface_Web/trunk/pspaWT/sources/controler/src/elementSnapshot.cc
r418 r424 116 116 return txt; 117 117 } 118 119 void elementSnapshot::InputRep(UAPNode* root) 120 { 121 UAPNode* node= root->addChild("snapshot"); 122 node->addAttribute("name",specificName_); 123 } -
Interface_Web/trunk/pspaWT/sources/controler/src/elementSoleno.cc
r418 r424 5 5 elementSoleno::elementSoleno() : abstractElement() 6 6 { 7 8 9 10 11 12 13 14 7 cout << " passage constructeur elementSoleno " << endl; 8 setDefaultValues(); 9 setDefaults(); 10 elementName_ = nomdElements("soleno"); 11 nbParam_ = elementName_.getElementNbParameters(); 12 parametersString_ = new string[nbParam_+1]; 13 // registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk); 14 // registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolOk); 15 15 } 16 16 17 void elementSoleno::setDefaultValues() 18 { 19 defaultSpecificName_ = "solnd"; 20 B0Def_ = 0.0; 21 varyB0Def_ = false; 22 } 17 23 18 void elementSoleno::setDefaultValues() 19 { 20 defaultSpecificName_ = "solnd"; 21 B0Def_ = 0.0; 22 varyB0Def_ = false; 24 void elementSoleno::setDefaults() 25 { 26 specificName_ = defaultSpecificName_; 27 B0_ = B0Def_; 28 varyB0_ = varyB0Def_; 29 } 30 31 string* elementSoleno::getParametersString() const 32 { 33 cout << " passage elementSoleno::getParametersString() B0_= " << B0_ << endl; 34 int compteur = -1; 35 parametersString_[++compteur] = mixedTools::intToString(nbParam_); 36 parametersString_[++compteur] = specificName_; 37 parametersString_[++compteur] = mixedTools::doubleToString(lenghtElem_); 38 parametersString_[++compteur] = mixedTools::doubleToString(aperture_); 39 parametersString_[++compteur] = mixedTools::doubleToString(B0_); 40 parametersString_[++compteur] = mixedTools::intToString(varyB0_); 41 if ( compteur != nbParam_ ) { 42 cerr << " elementSoleno::getParametersString() : ERROR nr pf parameters dosnt match " << endl; 43 return NULL; 23 44 } 24 25 void elementSoleno::setDefaults() 26 { 27 specificName_ = defaultSpecificName_; 28 B0_ = B0Def_; 29 varyB0_ = varyB0Def_; 30 } 31 32 33 string* elementSoleno::getParametersString() const 34 { 35 cout << " passage elementSoleno::getParametersString() B0_= " << B0_ << endl; 36 int compteur = -1; 37 parametersString_[++compteur] = mixedTools::intToString(nbParam_); 38 parametersString_[++compteur] = specificName_; 39 parametersString_[++compteur] = mixedTools::doubleToString(lenghtElem_); 40 parametersString_[++compteur] = mixedTools::doubleToString(aperture_); 41 parametersString_[++compteur] = mixedTools::doubleToString(B0_); 42 parametersString_[++compteur] = mixedTools::intToString(varyB0_); 43 if ( compteur != nbParam_ ) { 44 cerr << " elementSoleno::getParametersString() : ERROR nr pf parameters dosnt match " << endl; 45 return NULL; 46 } 47 return parametersString_; 48 } 49 45 return parametersString_; 46 } 50 47 51 48 void elementSoleno::setParametersString(string* param) 52 49 { 53 if ( param == NULL ) 54 { 55 cerr << " elementSoleno::setParametersString parameters empty parameter set"; 56 return; 57 } 50 if ( param == NULL ) { 51 cerr << " elementSoleno::setParametersString parameters empty parameter set"; 52 return; 53 } 58 54 int compteur = -1; 59 55 int nbparam = atoi(param[++compteur].c_str()); 60 if ( nbparam != nbParam_ ) 61 { 62 cerr << " elementSoleno::setParametersString parameters do not match for a SOLENOID"; 63 return; 64 } 65 specificName_ = param[++compteur]; 66 lenghtElem_ = atof(param[++compteur].c_str()); 67 aperture_ = atof(param[++compteur].c_str()); 68 B0_ = atof(param[++compteur].c_str()); 69 varyB0_ = atoi(param[++compteur].c_str()); 56 if ( nbparam != nbParam_ ) { 57 cerr << " elementSoleno::setParametersString parameters do not match for a SOLENOID"; 58 return; 59 } 60 specificName_ = param[++compteur]; 61 lenghtElem_ = atof(param[++compteur].c_str()); 62 aperture_ = atof(param[++compteur].c_str()); 63 B0_ = atof(param[++compteur].c_str()); 64 varyB0_ = atoi(param[++compteur].c_str()); 70 65 } 71 66 … … 90 85 91 86 string elementSoleno::FileOutputFlow() const 92 93 94 95 96 97 98 99 87 { 88 ostringstream sortie; 89 // sortie << elementName_.getElementType() << endl; 90 sortie << elementName_.getGenericLabel() << endl; 91 sortie << specificName_ << endl; 92 sortie << lenghtElem_ << " " << aperture_<< " " << B0_ << " " << varyB0_ << endl; 93 return sortie.str(); 94 } 100 95 101 96 … … 115 110 } 116 111 117 118 112 void elementSoleno::FileInput(ifstream& ifs) 119 113 { … … 122 116 } 123 117 118 string elementSoleno::print() 119 { 120 string txt = ""; 121 txt += specificName_; 122 txt += "\nlength (cm) : "; 123 txt += mixedTools::doubleToString(lenghtElem_); 124 txt += "\naperture (cm) : "; 125 txt += mixedTools::doubleToString(aperture_); 126 txt += "\nfield (kG) : "; 127 txt += mixedTools::doubleToString(B0_); 128 txt += "\n : may vary ? "; 129 txt += mixedTools::boolToString(varyB0_); 130 return txt; 131 } 124 132 125 string elementSoleno::print() { 126 string txt = ""; 133 void elementSoleno::InputRep(UAPNode* root) 134 { 135 UAPNode* ele = root->addChild("element"); 136 ele->addAttribute("name",specificName_); 127 137 128 txt += specificName_; 129 txt += "\nlength (cm) : "; 130 txt += mixedTools::doubleToString(lenghtElem_); 131 txt += "\naperture (cm) : "; 132 txt += mixedTools::doubleToString(aperture_); 133 txt += "\nfield (kG) : "; 134 txt += mixedTools::doubleToString(B0_); 135 txt += "\n : may vary ? "; 136 txt += mixedTools::boolToString(varyB0_); 137 138 return txt; 138 string txt = ""; 139 txt = mixedTools::doubleToString(lenghtElem_); 140 ele->addChild("length")->addAttribute("design",txt); 141 142 // pour Parmela /aper : radius of aperture at exit (gap) 143 UAPNode* node = ele->addChild("aperture"); 144 node->addAttribute("at","EXIT"); 145 node->addAttribute("shape","CIRCLE"); 146 txt = mixedTools::doubleToString(aperture_); 147 node->addChild("xy_limit")->addAttribute("design",txt); 148 149 node = ele->addChild("solenoid"); 150 txt = mixedTools::doubleToString(B0_); 151 node->addChild("ksol")->addAttribute("design",txt); 152 153 // faire varier ou pas l'induction pour l'ajuster 154 if ( varyB0_ ) { 155 node->addChild("vary")->addAttribute("is_on","true"); 156 } else { 157 node->addChild("vary")->addAttribute("is_on","false"); 158 } 139 159 } -
Interface_Web/trunk/pspaWT/sources/controler/src/globalParameters.cc
r257 r424 54 54 ifs >> frequency_ >> integrationStep_ >> nstepsMax_ >> nsc_; 55 55 } 56 57 void globalParameters::InputRep(UAPNode* root) 58 { 59 UAPNode* node = root->addChild("global"); 60 string txt = ""; 61 txt = mixedTools::doubleToString(frequency_); 62 node->addChild("ref_freq")->addAttribute("design",txt); 63 64 node->addChild("comment")->addAttribute("text","data specific to Parmela"); 65 txt = mixedTools::doubleToString(integrationStep_); 66 node->addChild("integrationStep")->addAttribute("value",txt); 67 txt = mixedTools::intToString(nstepsMax_); 68 node->addChild("nSteps")->addAttribute("value",txt); 69 txt = mixedTools::intToString(nsc_); 70 node->addChild("nsc")->addAttribute("value",txt); 71 } -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc
r418 r424 76 76 useStyleSheet("htdocs/pspa.css"); 77 77 dtmanage_ = new dataManager(this); 78 // 78 // dtmanage_->setWorkingDir(workingDir_); 79 79 80 80 /* … … 390 390 GWt_globalParameters* bibi = static_cast<GWt_globalParameters*>(globalParam_); 391 391 bibi->updateGlobals(); 392 392 393 // dtmanage_->saveConfiguration(nameOfCase_); 393 394 dtmanage_->saveConfiguration(sessionId(),nameOfCase_); 395 396 // en test: j'ajoute la sauvegarde sur .aml 397 dtmanage_->writeToAMLFile(nameOfCase_); 394 398 } 395 399 … … 934 938 935 939 #ifdef HAS_IMAGEMAGIC 940 936 941 // no background 937 942 chart->setBackground(WBrush(Wt::NoBrush)); … … 951 956 */ 952 957 958 953 959 Wt::WPdfImage pdfImage("1000", "600"); 954 960 { … … 956 962 chart->paint(p1); 957 963 } 964 958 965 name = workingDir_ + "/chart-"+sessionId ()+".pdf"; 959 966 std::ofstream f1(name.c_str(), std::ios::out | std::ios::binary);
Note: See TracChangeset
for help on using the changeset viewer.