[27] | 1 | #ifndef DATAMANAGER_SEEN |
---|
| 2 | #define DATAMANAGER_SEEN |
---|
| 3 | |
---|
[41] | 4 | #include "abstractElement.h" |
---|
[316] | 5 | #include "abstractSoftware.h" |
---|
[38] | 6 | #include "globalParameters.h" |
---|
[50] | 7 | #include "nomdElements.h" |
---|
[54] | 8 | #include "particleBeam.h" |
---|
[58] | 9 | #include "sectionToExecute.h" |
---|
| 10 | #include "nomDeLogiciel.h" |
---|
[230] | 11 | #include "trivaluedBool.h" |
---|
[236] | 12 | #include "beam2Moments.h" |
---|
[295] | 13 | #include "parmelaParticle.h" |
---|
[359] | 14 | #include "nomDeLogiciel.h" |
---|
[236] | 15 | |
---|
[305] | 16 | class PspaApplication; |
---|
[236] | 17 | |
---|
[27] | 18 | class dataManager |
---|
| 19 | { |
---|
[342] | 20 | |
---|
| 21 | public: |
---|
| 22 | |
---|
| 23 | dataManager(PspaApplication*); |
---|
| 24 | virtual ~dataManager(); |
---|
| 25 | void consoleMessage(string message); |
---|
| 26 | int getBeamLineSize(); |
---|
| 27 | inline globalParameters* getGlobalParameters() {return &globParam_;} |
---|
| 28 | inline particleBeam* getCurrentBeam() {return currentBeam_;} |
---|
[302] | 29 | |
---|
[342] | 30 | particleBeam* getDiagnosticBeam(unsigned index); |
---|
[386] | 31 | particleBeam* getDiagnosticBeam(string elementLabel); |
---|
| 32 | |
---|
[419] | 33 | sectionToExecute* addSectionToExecute(abstractElement* debut,int debutIndex, abstractElement* fin, int finIndex, nomDeLogiciel logiciel); |
---|
[359] | 34 | |
---|
[418] | 35 | abstractElement* addElement(nomdElements::typedElement elemType); |
---|
[342] | 36 | void removeElement(string); |
---|
| 37 | |
---|
| 38 | /** |
---|
[305] | 39 | Get the label from the order number in the beam line |
---|
| 40 | @return return "" if not found |
---|
[342] | 41 | */ |
---|
| 42 | string getLabelFromElementNumero(int numero); |
---|
| 43 | |
---|
| 44 | /** |
---|
[305] | 45 | Get the numero from the label in the beam line |
---|
| 46 | @return return -1 if not found |
---|
[342] | 47 | */ |
---|
| 48 | int getNumeroFromElementLabel(string); |
---|
[359] | 49 | abstractElement* getElementPointerFromNumero(int); |
---|
[342] | 50 | |
---|
| 51 | void initializeExecution(); |
---|
[359] | 52 | // trivaluedBool checkExecute(string& diagnostic); |
---|
| 53 | // trivaluedBool checkElementsForExec(nomDeLogiciel logiciel, unsigned indexDeb, unsigned indexFin, string& diagnostic); |
---|
[342] | 54 | bool executeAll(); |
---|
[344] | 55 | |
---|
[381] | 56 | void donneesRmsEnveloppe(string type,vector<double>& xcor,vector<double>& ycor, string& titre, string& legendx, string& legendy); |
---|
[355] | 57 | |
---|
[347] | 58 | /** |
---|
| 59 | Save a configuration file on the server |
---|
| 60 | @param folder |
---|
| 61 | @param filename |
---|
| 62 | */ |
---|
| 63 | void saveConfiguration(string folder, string filename); |
---|
| 64 | |
---|
| 65 | bool restoreElements(string inputFileName); |
---|
| 66 | |
---|
[401] | 67 | |
---|
| 68 | /** return the jobList size |
---|
| 69 | */ |
---|
[419] | 70 | inline int getJobListSize() const { |
---|
[401] | 71 | return jobList_.size(); |
---|
| 72 | } |
---|
[342] | 73 | |
---|
[386] | 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 | |
---|
[401] | 84 | /** return a specific jobList index |
---|
| 85 | return NULL if the index does not exist |
---|
| 86 | */ |
---|
[419] | 87 | |
---|
| 88 | /* inline sectionToExecute* getJobListAt(int a) { */ |
---|
| 89 | /* if (a < 0) return NULL; */ |
---|
| 90 | /* if (a >= getJobListSize()) return NULL; */ |
---|
| 91 | /* return jobList_[a]; */ |
---|
| 92 | /* } */ |
---|
| 93 | |
---|
| 94 | |
---|
| 95 | |
---|
| 96 | /* inline const abstractSoftware* getSoftwareOfSection( int index) const { */ |
---|
| 97 | /* if (index < 0) return NULL; */ |
---|
| 98 | /* if (index >= getJobListSize()) return NULL; */ |
---|
| 99 | /* return jobList_[index]->getSoftware(); */ |
---|
| 100 | /* } */ |
---|
[302] | 101 | |
---|
[401] | 102 | /** Clear a specific jobList */ |
---|
| 103 | void clearSectionToExecute(int a); |
---|
| 104 | |
---|
[347] | 105 | private: |
---|
| 106 | globalParameters globParam_; |
---|
| 107 | particleBeam* currentBeam_; |
---|
[355] | 108 | PspaApplication* pspa_; |
---|
[368] | 109 | unsigned firstComputedElemNumero_; |
---|
| 110 | unsigned lastComputedElemNumero_; |
---|
[386] | 111 | |
---|
[347] | 112 | vector<particleBeam> diagnosticBeam_; |
---|
[386] | 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 | |
---|
[347] | 117 | vector<sectionToExecute*> jobList_; |
---|
| 118 | |
---|
| 119 | void removeFile(string nameOfFile); |
---|
| 120 | void clearSectionToExecute(); |
---|
[419] | 121 | abstractSoftware* createSoftwareConnexion(nomDeLogiciel logi); |
---|
| 122 | |
---|
[342] | 123 | }; |
---|
[27] | 124 | #endif |
---|