1 | #ifndef DATAMANAGER_SEEN |
---|
2 | #define DATAMANAGER_SEEN |
---|
3 | |
---|
4 | #include "abstractElement.h" |
---|
5 | #include "abstractSoftware.h" |
---|
6 | #include "globalParameters.h" |
---|
7 | #include "nomdElements.h" |
---|
8 | #include "particleBeam.h" |
---|
9 | #include "sectionToExecute.h" |
---|
10 | #include "nomDeLogiciel.h" |
---|
11 | #include "trivaluedBool.h" |
---|
12 | #include "beam2Moments.h" |
---|
13 | #include "parmelaParticle.h" |
---|
14 | #include "nomDeLogiciel.h" |
---|
15 | |
---|
16 | class PspaApplication; |
---|
17 | |
---|
18 | class dataManager |
---|
19 | { |
---|
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_;} |
---|
29 | |
---|
30 | particleBeam* getDiagnosticBeam(unsigned index); |
---|
31 | particleBeam* getDiagnosticBeam(string elementLabel); |
---|
32 | |
---|
33 | sectionToExecute* addSectionToExecute(abstractElement* debut,int debutIndex, abstractElement* fin, int finIndex, nomDeLogiciel logiciel); |
---|
34 | |
---|
35 | abstractElement* addElement(nomdElements::typedElement elemType); |
---|
36 | void removeElement(string); |
---|
37 | |
---|
38 | /** |
---|
39 | Get the label from the order number in the beam line |
---|
40 | @return return "" if not found |
---|
41 | */ |
---|
42 | string getLabelFromElementNumero(int numero); |
---|
43 | |
---|
44 | /** |
---|
45 | Get the numero from the label in the beam line |
---|
46 | @return return -1 if not found |
---|
47 | */ |
---|
48 | int getNumeroFromElementLabel(string); |
---|
49 | abstractElement* getElementPointerFromNumero(int); |
---|
50 | |
---|
51 | void initializeExecution(); |
---|
52 | // trivaluedBool checkExecute(string& diagnostic); |
---|
53 | // trivaluedBool checkElementsForExec(nomDeLogiciel logiciel, unsigned indexDeb, unsigned indexFin, string& diagnostic); |
---|
54 | bool executeAll(); |
---|
55 | |
---|
56 | void donneesRmsEnveloppe(string type,vector<double>& xcor,vector<double>& ycor, string& titre, string& legendx, string& legendy); |
---|
57 | |
---|
58 | /** |
---|
59 | Save a configuration file on the server |
---|
60 | @param folder |
---|
61 | @param filename |
---|
62 | */ |
---|
63 | void saveConfiguration(string folder, string filename); |
---|
64 | bool restoreElements(string inputFileName); |
---|
65 | |
---|
66 | void writeToAMLFile(string fileName); |
---|
67 | |
---|
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()); |
---|
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) { */ |
---|
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 | /* } */ |
---|
101 | |
---|
102 | /** Clear a specific jobList */ |
---|
103 | void clearSectionToExecute(int a); |
---|
104 | |
---|
105 | private: |
---|
106 | |
---|
107 | globalParameters globParam_; |
---|
108 | particleBeam* currentBeam_; |
---|
109 | PspaApplication* pspa_; |
---|
110 | unsigned firstComputedElemNumero_; |
---|
111 | unsigned lastComputedElemNumero_; |
---|
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 | #endif |
---|