Changeset 38 in PSPA for Interface_Web/trunk/pspaWT/include
- Timestamp:
- Oct 26, 2012, 5:58:24 PM (12 years ago)
- Location:
- Interface_Web/trunk/pspaWT/include
- Files:
-
- 8 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/include/LigneFaisceau.h
r33 r38 23 23 24 24 WHBoxLayout* beamLayout_; 25 dataManager* dtmanage_; 25 // dataManager* dtmanage_; 26 PspaApplication* pspa_; 26 27 27 28 public: … … 30 31 private: 31 32 void dropEvent(WDropEvent evt); 32 void lancerCalcul(); 33 void openDriftParametersForm(); 34 PspaApplication* pspa_; 33 // void lancerCalcul(); 34 // void openDriftParametersForm(int etiquette); 35 36 35 37 }; 36 38 -
Interface_Web/trunk/pspaWT/include/abstractElementDefinition.h
r29 r38 5 5 #include <sstream> 6 6 #include <string> 7 7 8 8 9 #include "mathematicalTools.h" … … 17 18 protected: 18 19 20 double phaseStep_; // a recuperer dans les parametres globaux (methode setPhaseStep) 21 double phaseStepMax_; 22 23 double defaultLength_; 24 double defaultAperture_; 25 26 27 19 28 string label_; 20 29 nomdElement elementName_; … … 22 31 double aperture_; // cm 23 32 24 double stepmaxcm_;// (cm) 33 double stepmaxcm_; 34 // bool curvedTrajectory_; 25 35 26 bool curvedTrajectory_; 36 void setDefaultValues() 37 { 38 defaultLength_ = 0.0; 39 defaultAperture_ = 1.e+6; 40 phaseStep_ = 0.0; 41 phaseStepMax_ = 10.; 42 } 43 44 45 void setDefaults() 46 { 47 lenghtElem_ = defaultLength_; 48 aperture_ = defaultAperture_; 49 } 50 27 51 public : 28 52 29 53 30 AbstractElementDefinition() : label_(string("")), lenghtElem_(0.0), aperture_(0.0), stepmaxcm_(1000000.), curvedTrajectory_(false) {;} 54 AbstractElementDefinition() 55 { 56 label_ = string(""); 57 setDefaultValues(); 58 setDefaults(); 59 stepmaxcm_ = 1000000; 60 // curvedTrajectory_ = false; 61 } 31 62 32 63 33 AbstractElementDefinition(string lab, double ll, double ap)64 AbstractElementDefinition(string lab) 34 65 { 35 66 label_ = lab; 36 lenghtElem_ = ll;37 aperture_ = ap;38 stepmaxcm_ = 1000000 .;39 curvedTrajectory_ = false;67 setDefaultValues(); 68 setDefaults(); 69 stepmaxcm_ = 1000000; 70 // curvedTrajectory_ = false; 40 71 } 41 72 42 73 virtual ~AbstractElementDefinition() {;} 74 75 void setPhaseStep(double ph) { phaseStep_ = ph;} 76 77 78 void setParameters(double ll, double aper) 79 { 80 lenghtElem_ = ll; 81 aperture_ = aper; 82 } 83 84 virtual void setParametersString(string* param) = 0; 43 85 44 86 string getLabel() const … … 53 95 } 54 96 55 double getStepMaxcm() const56 {57 return stepmaxcm_;58 }59 97 60 98 double getLenghtOfElement() const { return lenghtElem_;} 61 99 62 // double setLenght(double xl) { lenghtElem_ = xl;}100 virtual string* getParametersString() const = 0; 63 101 64 102 65 103 virtual string parmelaOutputFlow() const =0; 66 104 105 virtual double getInitialKineticEnergy() const {return 0.0;} 67 106 68 107 }; -
Interface_Web/trunk/pspaWT/include/bendDefinition.h
r29 r38 24 24 BendDefinition() : AbstractElementDefinition() {elementName_ = bend;} 25 25 26 BendDefinition(string lab , double ll, double ap, double WrMeV, double alphaRad) ;26 BendDefinition(string lab) ; 27 27 28 28 -
Interface_Web/trunk/pspaWT/include/cellDefinition.h
r31 r38 74 74 } 75 75 76 CellDefinition(string lab , double ll, double ap, double freq, double E0, int nc, double stepmax_cm, int symIndex, double sinphi, double cosphi, double Baxial, carteChamp* carte);76 CellDefinition(string lab); 77 77 78 78 -
Interface_Web/trunk/pspaWT/include/dataManager.h
r29 r38 4 4 #include "abstractElementDefinition.h" 5 5 #include "elementsCollection.h" 6 7 8 using namespace std;6 #include "globalParameters.h" 7 //#include "driftDefinition.h" 8 //using namespace std; 9 9 10 10 class dataManager … … 12 12 13 13 elementsCollection elementsGallery_; 14 globalParameters globParam_; 15 16 14 17 void createInputFileParmela( int indexDeb, int indexFin); 15 18 void executeParmela( int indexDeb, int indexFin); … … 18 21 19 22 20 dataManager() ;21 ~dataManager() ;23 dataManager() {;} 24 ~dataManager() {;} 22 25 23 26 inline int beamLineSize() {return elementsGallery_.size();} 24 25 void addDrift(); 27 inline globalParameters* getGlobalParameters() {return &globParam_;} 28 AbstractElementDefinition* addCell(); 29 AbstractElementDefinition* addDrift(); 30 AbstractElementDefinition* addInitialBeam(); 26 31 void executeAll(); 27 32 }; -
Interface_Web/trunk/pspaWT/include/driftDefinition.h
r29 r38 2 2 #define DRIFTDEFINITION_SEEN 3 3 4 #include <iostream> 4 5 #include <string> 5 6 #include "abstractElementDefinition.h" 6 7 #include "mathematicalTools.h" 7 8 #include "mixedTools.h" 8 9 9 10 using namespace std; … … 13 14 { 14 15 15 16 int nbParam_; 17 string* parametersString_; 16 18 17 19 public: 18 20 19 DriftDefinition() : AbstractElementDefinition() {elementName_ = drift;} 21 DriftDefinition() : AbstractElementDefinition() 22 { 23 elementName_ = drift; 24 nbParam_ = 2; 25 parametersString_ = new string[nbParam_+1]; 26 } 20 27 21 DriftDefinition(string lab , double ll, double ap) : AbstractElementDefinition(lab, ll, ap)28 DriftDefinition(string lab) : AbstractElementDefinition(lab) 22 29 { 23 30 elementName_ = drift; 31 nbParam_ = 2; 32 parametersString_ = new string[nbParam_+1]; 24 33 } 25 34 26 35 ~DriftDefinition() {;} 27 36 37 virtual string* getParametersString() const 38 { 39 std::cout << " getParametersString long= " << lenghtElem_ << " ouv= " << aperture_ << std::endl; 40 parametersString_[0] = mixedTools::intToString(nbParam_); 41 parametersString_[1] = mixedTools::doubleToString(lenghtElem_); 42 parametersString_[2] = mixedTools::doubleToString(aperture_); 43 return parametersString_; 44 } 45 46 virtual void setParametersString(string* param) 47 { 48 if ( param == NULL ) 49 { 50 cerr << " DriftDefinition::setParametersString parameters empty parameter set"; 51 return; 52 } 53 int nbparam = atoi(param[0].c_str()); 54 if ( nbparam != nbParam_ ) 55 { 56 cerr << " DriftDefinition::setParametersString parameters do not match for a DRIFT"; 57 return; 58 } 59 lenghtElem_ = atof(param[1].c_str()); 60 aperture_ = atof(param[2].c_str()); 61 } 28 62 29 63 virtual string parmelaOutputFlow() const -
Interface_Web/trunk/pspaWT/include/driftForm.h
r33 r38 12 12 #include <Wt/WText> 13 13 #include <Wt/WLabel> 14 #include <Wt/WBreak> 14 15 15 16 using namespace Wt; 16 17 17 class driftForm : public WTable18 class driftForm 18 19 { 19 20 public: 20 21 21 driftForm(PspaApplication* ps , WContainerWidget *parent = 0);22 driftForm(PspaApplication* ps); 22 23 23 24 private: 24 25 25 26 void submit(); 27 void driftDialogDone(); 26 28 27 29 28 30 PspaApplication* pspa_; 29 WLineEdit* xlengthEdit_;30 WLineEdit* apertureEdit_;31 WLineEdit* xlengthEdit_; 32 // WLineEdit* apertureEdit_; 31 33 }; 32 34 #endif -
Interface_Web/trunk/pspaWT/include/elementsCollection.h
r29 r38 7 7 #include "abstractElementDefinition.h" 8 8 #include "driftDefinition.h" 9 #include "cellDefinition.h" 10 #include "bendDefinition.h" 11 #include "soleDefinition.h" 9 #include "initialBeamDefinition.h" 10 #include "elementCell.h" 11 //#include "cellDefinition.h" 12 //#include "bendDefinition.h" 13 //#include "soleDefinition.h" 12 14 13 15 14 using namespace std;16 //using namespace std; 15 17 16 18 … … 19 21 20 22 21 vector < pair<AbstractElementDefinition*, double >> elements_;22 double zdebCurrent_; 23 vector < AbstractElementDefinition*> elements_; 24 23 25 24 26 public: 25 27 26 28 27 elementsCollection() { zdebCurrent_ = 0.0;}29 elementsCollection() {;} 28 30 29 31 ~elementsCollection() … … 32 34 for (k=0; k < elements_.size(); k++) 33 35 { 34 if ( elements_[k] .first != NULL ) delete elements_[k].first;36 if ( elements_[k] != NULL ) delete elements_[k]; 35 37 } 36 38 } … … 38 40 inline int size() { return elements_.size(); } 39 41 40 inline void createDrift(string label, double lenght, double aperture)42 inline AbstractElementDefinition* createNewDrift() 41 43 { 42 elements_.push_back( make_pair(new DriftDefinition(label,lenght, aperture), zdebCurrent_));43 zdebCurrent_ += lenght;44 elements_.push_back(new DriftDefinition()); 45 return elements_.back(); 44 46 } 45 47 46 inline void createBend(string label, double lenght, double aperture, double WrMeV, double alphaDeg)48 inline AbstractElementDefinition* createNewInitialBeam() 47 49 { 48 elements_.push_back( make_pair (new BendDefinition(label, lenght, aperture, WrMeV, alphaDeg), zdebCurrent_));49 zdebCurrent_ += lenght;50 elements_.push_back(new initialBeamDefinition()); 51 return elements_.back(); 50 52 } 51 53 52 inline void createCell(string lab, double lenght, double ap, double freq, double E0, int nc, double dwtmax, int symIndex, double sinphi, double cosphi, double Baxial, carteChamp* carte)54 inline AbstractElementDefinition* createNewCell() 53 55 { 54 elements_.push_back( make_pair( new CellDefinition(lab, lenght, ap, freq, E0, nc, dwtmax, symIndex, sinphi, cosphi, Baxial, carte), zdebCurrent_));55 zdebCurrent_ += lenght;56 elements_.push_back(new elementCell()); 57 return elements_.back(); 56 58 } 57 58 inline void createSolenoid(string label,double lenght,double aperture,double BGauss)59 {60 elements_.push_back( make_pair( new SolenoidDefinition(label,lenght,aperture,BGauss), zdebCurrent_) );61 zdebCurrent_ += lenght;62 }63 59 64 60 … … 70 66 for ( k=0; k < elements_.size() ; k++) 71 67 { 72 if ( elements_[k] .first->getLabel() == label ) return elements_[k].first;68 if ( elements_[k]->getLabel() == label ) return elements_[k]; 73 69 } 74 cerr << " elementsCollection::getElementPointer() : unknown element label: " << label <<endl;70 std::cerr << " elementsCollection::getElementPointer() : unknown element label: " << label << std::endl; 75 71 return NULL; 76 72 } … … 80 76 { 81 77 if ( index >= elements_.size() ) return NULL; 82 else return elements_[index] .first;78 else return elements_[index]; 83 79 } 84 80 -
Interface_Web/trunk/pspaWT/include/nomdElements.h
r29 r38 5 5 typedef enum 6 6 { 7 drift, cell, bend, sole, solenoidalBmap7 initialBeam, drift, cell, bend, sole, solenoidalBmap 8 8 } nomdElement; 9 9 -
Interface_Web/trunk/pspaWT/include/pspa.h
r29 r38 11 11 #include <Wt/WImage> 12 12 #include <Wt/WTextArea> 13 14 #include "dataManager.h" 13 15 14 16 // c++0x only, for std::bind … … 26 28 WWidget* createPalette(); 27 29 WWidget* createBeamLine(); 30 WWidget* createGlobalParamWidget(); 28 31 void createDragImage(const char *url, const char *smallurl, 29 32 const char *mimeType, … … 33 36 } 34 37 38 inline dataManager* getDataManager() const 39 { 40 return dtmanage_; 41 } 42 35 43 private : 36 44 WTextArea* console_; 45 dataManager* dtmanage_; 37 46 }; 38 47 -
Interface_Web/trunk/pspaWT/include/soleDefinition.h
r29 r38 19 19 SolenoidDefinition() : AbstractElementDefinition() {elementName_ = sole;} 20 20 21 SolenoidDefinition(string lab ,double ll,double ap,double BGauss) : AbstractElementDefinition(lab,ll,ap)21 SolenoidDefinition(string lab) : AbstractElementDefinition(lab) 22 22 { 23 23 elementName_ = sole;
Note: See TracChangeset
for help on using the changeset viewer.