Changeset 316 in PSPA
- Timestamp:
- Feb 9, 2013, 12:03:49 PM (11 years ago)
- Location:
- Interface_Web/trunk/pspaWT
- Files:
-
- 2 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/cmt/requirements
r307 r316 32 32 ../sources/controler/src/softwareTransport.cc \ 33 33 ../sources/controler/src/softwareGenerator.cc \ 34 ../sources/controler/src/softwareTest.cc \ 34 35 ../sources/userInterface/src/GWt_cell.cc \ 35 36 ../sources/userInterface/src/GWt_rfgun.cc \ -
Interface_Web/trunk/pspaWT/sources/controler/include/abstractSoftware.h
r313 r316 19 19 globalParameters* globParamPtr_; 20 20 dataManager* dataManager_; 21 21 string inputFileName_; 22 22 23 23 abstractSoftware(); … … 27 27 public : 28 28 29 abstractSoftware( globalParameters* globals, dataManager* dt);29 abstractSoftware(string inputFileName, globalParameters* globals, dataManager* dt); 30 30 ~abstractSoftware() {;} 31 31 32 virtual bool createInputFile( string inputFileName,particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir) = 0;32 virtual bool createInputFile(particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir) = 0; 33 33 34 34 35 virtual bool execute( string inputFileName,unsigned int numeroDeb,unsigned int numeroFin,string workingDir) = 0;35 virtual bool execute(unsigned int numeroDeb,unsigned int numeroFin,string workingDir) = 0; 36 36 37 37 virtual bool buildBeamAfterElements(unsigned int numeroDeb,unsigned int numeroFin, vector<particleBeam>& beams, string workingDir) = 0; -
Interface_Web/trunk/pspaWT/sources/controler/include/dataManager.h
r313 r316 3 3 4 4 #include "abstractElement.h" 5 #include "abstractSoftware.h" 5 6 #include "globalParameters.h" 6 7 #include "nomdElements.h" … … 16 17 class dataManager 17 18 { 18 19 abstractSoftware* createSoftwareConnexion(nomDeLogiciel logi); 19 20 public: 20 21 -
Interface_Web/trunk/pspaWT/sources/controler/include/nomDeLogiciel.h
r304 r316 5 5 6 6 using namespace std; 7 8 7 9 8 10 class nomDeLogiciel … … 14 16 enum Logiciel 15 17 { 16 parmela, transport, generator, unknownSoftware17 }; 18 parmela, transport, generator, test, unknownSoftware 19 }; 18 20 19 21 … … 22 24 Logiciel program_; 23 25 std::string progString_; 24 int value_;25 26 // int value_; 27 26 28 static Logiciel fromString( std::string s); 27 29 static std::string toString( Logiciel lg); 28 static Logiciel fromValue( int v);29 static int toValue( Logiciel lg);30 // static Logiciel fromValue( int v); 31 // static int toValue( Logiciel lg); 30 32 31 33 public : … … 35 37 nomDeLogiciel(const string& s); 36 38 nomDeLogiciel(int val); 37 38 39 static int getNumberOfSoftwares(); 39 40 -
Interface_Web/trunk/pspaWT/sources/controler/include/softwareGenerator.h
r313 r316 4 4 5 5 #include "abstractSoftware.h" 6 #include "dataManager.h" 6 7 7 8 class softwareGenerator : public abstractSoftware … … 19 20 20 21 21 softwareGenerator( globalParameters* globals, dataManager*);22 softwareGenerator(string inputFileName, globalParameters* globals, dataManager* dt); 22 23 23 24 virtual ~softwareGenerator() {;} 24 25 25 26 26 virtual bool createInputFile( string inputFileName,particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir);27 virtual bool createInputFile(particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir); 27 28 28 29 29 virtual bool execute( string inputFileName,unsigned int numeroDeb,unsigned int numeroFin,string workingDir);30 virtual bool execute(unsigned int numeroDeb,unsigned int numeroFin,string workingDir); 30 31 31 32 -
Interface_Web/trunk/pspaWT/sources/controler/include/softwareParmela.h
r313 r316 9 9 protected : 10 10 11 // les elements de parmela sont indexes à partir du premier, il faut 12 // donc prevoir un offset pour le raccord a pspa 13 unsigned offsetNumElem_; 14 15 11 16 softwareParmela(); 12 17 … … 16 21 17 22 public : 18 softwareParmela( globalParameters* globals, dataManager* beamLine);23 softwareParmela(string inputFileName, globalParameters* globals, dataManager* beamLine); 19 24 20 25 virtual ~softwareParmela() {;} 21 26 22 27 23 virtual bool createInputFile( string inputFileName,particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir);28 virtual bool createInputFile(particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir); 24 29 25 virtual bool execute( string inputFileName,unsigned int numeroDeb,unsigned int numeroFin,string workingDir);30 virtual bool execute(unsigned int numeroDeb,unsigned int numeroFin,string workingDir); 26 31 27 32 -
Interface_Web/trunk/pspaWT/sources/controler/include/softwareTransport.h
r313 r316 14 14 15 15 public : 16 softwareTransport( globalParameters* globals, dataManager* beamLine);16 softwareTransport(string inputFileName, globalParameters* globals, dataManager* beamLine); 17 17 18 18 virtual ~softwareTransport() {;} 19 virtual bool createInputFile( string inputFileName,particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir);19 virtual bool createInputFile( particleBeam* beamBefore,unsigned int numeroDeb, unsigned int numeroFin, string workingDir); 20 20 21 virtual bool execute( string inputFileName,unsigned int numeroDeb,unsigned int numeroFin,string workingDir);21 virtual bool execute(unsigned int numeroDeb,unsigned int numeroFin,string workingDir); 22 22 23 23 -
Interface_Web/trunk/pspaWT/sources/controler/src/abstractSoftware.cc
r305 r316 4 4 abstractSoftware::abstractSoftware() 5 5 { 6 ; 6 globParamPtr_ = NULL; 7 dataManager_ = NULL; 8 7 9 } 8 10 9 abstractSoftware::abstractSoftware(globalParameters* globals, dataManager* dt) { 11 abstractSoftware::abstractSoftware(string inputFileName, globalParameters* globals, dataManager* dt) { 12 inputFileName_ = inputFileName; 10 13 globParamPtr_ = globals; 11 14 dataManager_ = dt; -
Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc
r314 r316 7 7 #include "GWt_console.h" 8 8 #include "softwareGenerator.h" 9 #include "softwareTest.h" 9 10 10 11 #include <stdio.h> … … 149 150 removeFile(workingDir_ + "parmdesz"); 150 151 removeFile(workingDir_ + "parmin"); 152 removeFile(workingDir_ + "parin.input0"); 151 153 removeFile(workingDir_ + "transport.input"); 152 154 removeFile(workingDir_ + "transport.output"); 155 removeFile(workingDir_ + "generator.in"); 156 removeFile(workingDir_ + "faisceau.ini"); 157 removeFile(workingDir_ + "generator.output"); 153 158 diagnosticBeam_.clear(); 154 159 currentBeam_ = NULL; … … 178 183 int debut = jobList_[k]->firstElement; 179 184 int fin = jobList_[k]->lastElement; 180 // resultatPartiel.clear();181 185 cout << " dataManager::executeAll je m'apprete a executer : " << (jobList_[k]->software).getString() << endl; 182 186 183 string inputFileName; 184 if(jobList_[k]->software == nomDeLogiciel::parmela) { 185 softw = new softwareParmela(&globParam_, this); 186 inputFileName = "parmin"; 187 } else if (jobList_[k]->software == nomDeLogiciel::transport) { 188 softw = new softwareTransport(&globParam_, this); 189 inputFileName = "transport.input"; 190 } else if (jobList_[k]->software == nomDeLogiciel::generator) { 191 softw = new softwareGenerator(&globParam_, this); 192 inputFileName = "generator.in"; 193 } else { 187 softw = createSoftwareConnexion(jobList_[k]->software ); 188 189 if ( softw == NULL ) { 194 190 success = false; 195 191 consoleMessage("dataManager::executeAll : unknown software"); … … 198 194 } 199 195 200 success = softw->createInputFile(inputFileName,currentBeam_, debut, fin, workingDir_); 201 // if ( !success ) { 202 // resultatPartiel += " error creating input file \n"; 203 // } else { 196 success = softw->createInputFile(currentBeam_, debut, fin, workingDir_); 204 197 if ( success ) { 205 success = softw->execute( inputFileName,debut,fin,workingDir_);198 success = softw->execute(debut,fin,workingDir_); 206 199 if ( success ) { 207 200 success = softw->buildBeamAfterElements(debut, fin, diagnosticBeam_, workingDir_); 208 // if ( !success ) {209 // resultatPartiel += " reading results failed \n";210 // }211 201 } 212 202 } … … 219 209 cout << " execute termine en ECHEC " << endl; 220 210 } 221 // resul += resultatPartiel;222 211 if ( !success ) break; 223 212 } … … 345 334 return pspa_->getBeamLine()->getBeamLineSize(); 346 335 } 336 337 abstractSoftware* dataManager::createSoftwareConnexion(nomDeLogiciel logi) { 338 339 string inputFileName; 340 if(logi == nomDeLogiciel::parmela) { 341 inputFileName = "parmin"; 342 return new softwareParmela(inputFileName, &globParam_, this); 343 } else if (logi == nomDeLogiciel::transport) { 344 inputFileName = "transport.input"; 345 return new softwareTransport(inputFileName, &globParam_, this); 346 } else if (logi == nomDeLogiciel::generator) { 347 inputFileName = "generator.in"; 348 return new softwareGenerator(inputFileName, &globParam_, this); 349 } else if (logi == nomDeLogiciel::test) { 350 return new softwareTest(inputFileName, &globParam_, this); 351 } else { 352 return NULL; 353 } 354 355 } -
Interface_Web/trunk/pspaWT/sources/controler/src/elementDrift.cc
r288 r316 28 28 if ( soft == nomDeLogiciel::transport ) return ok; 29 29 else if ( soft == nomDeLogiciel::parmela ) return ok; 30 else if ( soft == nomDeLogiciel::test ) return ok; 30 31 else return error; 31 32 } -
Interface_Web/trunk/pspaWT/sources/controler/src/nomDeLogiciel.cc
r304 r316 7 7 else if ( s == "transport" ) return transport; 8 8 else if ( s == "generator" ) return generator; 9 else if ( s == "test" ) return test; 9 10 return unknownSoftware; 10 11 } … … 17 18 case transport : { return "transport"; } 18 19 case generator : { return "generator"; } 20 case test : { return "test"; } 19 21 case unknownSoftware : { return "unknownSoftware"; } 20 22 } 21 23 return "unknownSoftware"; 22 }23 24 nomDeLogiciel::Logiciel nomDeLogiciel::fromValue( int v)25 {26 switch (v)27 {28 case 0 : { return parmela; }29 case 1 : { return transport; }30 case 2 : { return generator; }31 }32 return unknownSoftware;33 }34 35 int nomDeLogiciel::toValue( nomDeLogiciel::Logiciel lg)36 {37 switch (lg)38 {39 case parmela : { return 0; }40 case transport : { return 1; }41 case generator : { return 2; }42 case unknownSoftware : { return 3; }43 }44 return -1;45 24 } 46 25 … … 49 28 program_ = transport; 50 29 progString_ = toString(program_); 51 value_ = toValue(program_);30 // value_ = toValue(program_); 52 31 } 53 32 … … 56 35 program_ = fromString(s); 57 36 progString_ = toString(program_); 58 value_ = toValue(program_);37 // value_ = toValue(program_); 59 38 } 60 39 61 40 nomDeLogiciel::nomDeLogiciel(int val) 62 41 { 63 program_ = fromValue(val);42 program_ = (Logiciel)val; 64 43 progString_ = toString(program_); 65 value_ = toValue(program_); 44 // program_ = fromValue(val); 45 // value_ = toValue(program_); 66 46 } 47 48 67 49 68 50 int nomDeLogiciel::getNumberOfSoftwares() 69 51 { 70 return toValue(unknownSoftware); 52 // return toValue(unknownSoftware); 53 return unknownSoftware; 71 54 } 72 55 … … 77 60 program_ = nl.program_; 78 61 progString_ = nl.progString_; 79 value_ = nl.value_;62 // value_ = nl.value_; 80 63 return *this; 81 64 } -
Interface_Web/trunk/pspaWT/sources/controler/src/softwareGenerator.cc
r313 r316 4 4 #include "mathematicalConstants.h" 5 5 #include "PhysicalConstants.h" 6 #include "dataManager.h"6 //#include "dataManager.h" 7 7 8 8 … … 15 15 16 16 17 softwareGenerator::softwareGenerator( globalParameters* globals, dataManager* dt) : abstractSoftware(globals, dt)17 softwareGenerator::softwareGenerator(string inputFileName, globalParameters* globals, dataManager* dt) : abstractSoftware(inputFileName, globals, dt) 18 18 { 19 19 ; … … 21 21 22 22 23 bool softwareGenerator::createInputFile( string inputFileName,particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir)23 bool softwareGenerator::createInputFile(particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir) 24 24 { 25 25 if ( numeroDeb != numeroFin ) return false; … … 34 34 } 35 35 ofstream outfile; 36 string name = workingDir + inputFileName ;36 string name = workingDir + inputFileName_; 37 37 outfile.open(name.c_str(), ios::out); 38 38 if (!outfile) { … … 54 54 55 55 56 bool softwareGenerator::execute( string inputFileName,unsigned int numeroDeb,unsigned int numeroFin,string workingDir) {56 bool softwareGenerator::execute(unsigned int numeroDeb,unsigned int numeroFin,string workingDir) { 57 57 ostringstream sortie; 58 58 bool ExecuteStatus = true; … … 63 63 string generatorJob = workingDir + "generator"; 64 64 generatorJob += string(" "); 65 generatorJob += workingDir + inputFileName ;65 generatorJob += workingDir + inputFileName_; 66 66 67 67 -
Interface_Web/trunk/pspaWT/sources/controler/src/softwareParmela.cc
r314 r316 5 5 #include "PhysicalConstants.h" 6 6 #include "dataManager.h" 7 7 #include "mixedTools.h" 8 8 9 9 softwareParmela::softwareParmela() : abstractSoftware() … … 12 12 } 13 13 14 softwareParmela::softwareParmela( globalParameters* globals, dataManager* dt) : abstractSoftware(globals, dt)14 softwareParmela::softwareParmela(string inputFileName, globalParameters* globals, dataManager* dt) : abstractSoftware(inputFileName, globals, dt) 15 15 { 16 16 ; 17 17 } 18 18 19 bool softwareParmela::createInputFile( string inputFileName,particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir)19 bool softwareParmela::createInputFile( particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir) 20 20 { 21 21 unsigned int k; … … 29 29 30 30 ofstream outfile; 31 string name = workingDir + inputFileName ;31 string name = workingDir + inputFileName_; 32 32 outfile.open(name.c_str(), ios::out); 33 33 if (!outfile) { … … 44 44 if ( !beamToParmela(workingDir, beamBefore ) ) return false; 45 45 initalKineticEnergy = beamBefore->referenceKineticEnergyMeV(); 46 // les elements de parmela sont indexes de 1 Ã max, s'in n'y a pas de rfgun 47 offsetNumElem_ = numeroDeb -1; 46 48 } 47 49 else { 48 50 elPtr->setPhaseStep( globParamPtr_->getIntegrationStep() ); 49 51 initalKineticEnergy = elPtr->getInitialKineticEnergy(); 52 // les elements de parmela sont indexes de 0 Ã max, s'il y a un rfgun 53 offsetNumElem_ = numeroDeb; 50 54 } 51 55 … … 77 81 78 82 79 bool softwareParmela::execute( string inputFileName,unsigned int numeroDeb,unsigned int numeroFin,string workingDir)83 bool softwareParmela::execute(unsigned int numeroDeb,unsigned int numeroFin,string workingDir) 80 84 { 81 85 ostringstream sortie; … … 118 122 bool result = true; 119 123 unsigned k; 124 120 125 for ( k= numeroDeb; k <= numeroFin; k++) 121 126 { … … 124 129 bareParticle refPart; 125 130 vector<bareParticle> particles; 126 if (!beamFromParmela(workingDir,k , globParamPtr_->getFrequency(), centroid, refPart,particles ))131 if (!beamFromParmela(workingDir,k - offsetNumElem_ , globParamPtr_->getFrequency(), centroid, refPart,particles )) 127 132 { 128 133 abstractElement* elem = dataManager_->getElementPointerFromNumero(k); … … 147 152 148 153 149 bool softwareParmela::beamFromParmela(string workingDir,unsigned numero Element, double referencefrequency, vector<double>& centroid, bareParticle& refPart,vector<bareParticle>& particles ) {154 bool softwareParmela::beamFromParmela(string workingDir,unsigned numeroParmel, double referencefrequency, vector<double>& centroid, bareParticle& refPart,vector<bareParticle>& particles ) { 150 155 unsigned k; 151 156 FILE* filefais; … … 164 169 std::vector<parmelaParticle> faisceau; 165 170 166 cout << " beamFromParmela : numeroElement = " << numeroElement << endl; 167 unsigned indexElement = numeroElement-1; 171 // unsigned indexElement = numeroElement-1; 168 172 169 173 … … 174 178 175 179 while( partic.readFromParmelaFile(filefais) > 0 ) { 176 if ( partic.ne == (int) indexElement)180 if ( partic.ne == (int)numeroParmel ) 177 181 { 178 182 faisceau.push_back(partic); … … 190 194 testNombrePartRef++; 191 195 if ( testNombrePartRef != 1 ) { 196 dataManager_->consoleMessage(" beamFromParmela : nombre de part. de ref different de 1 :"); 192 197 cerr << " nombre de part. de ref different de 1 : " << testNombrePartRef << " !! " << endl; 193 198 return false; … … 199 204 if ( faisceau.size() == 0) 200 205 { 201 cerr << " beamFromParmela echec lecture element " << numeroElement << endl; 206 string stringNum = mixedTools::intToString( (int)numeroParmel ); 207 dataManager_->consoleMessage("beamFromParmela echec lecture element numero relatif parmela : " + stringNum); 208 cerr << " beamFromParmela echec lecture element numero relatif parmela " << numeroParmel << endl; 202 209 return false; 203 210 } … … 267 274 unsigned k; 268 275 double weight = 1.0; 276 cout << " ICI sortie des particules " << endl; 277 double xx,yy,zz; 278 double begamx, begamy, begamz; 269 279 for ( k=0; k < partic.size(); k++) { 270 outfile << partic.at(k).getPosition().output_flow() << partic.at(k).getBetaGamma().output_flow()<< weight << endl; 271 } 272 return true; 273 } 274 275 280 partic.at(k).getPosition().getComponents(xx,yy,zz); 281 partic.at(k).getBetaGamma().getComponents(begamx, begamy, begamz); 282 outfile << xx << " " << begamx << " " << yy << " " << begamy << " " << zz << " " << begamz << " " << weight << endl; 283 } 284 outfile.close(); 285 return true; 286 } 287 288 -
Interface_Web/trunk/pspaWT/sources/controler/src/softwareTransport.cc
r313 r316 11 11 } 12 12 13 softwareTransport::softwareTransport( globalParameters* globals, dataManager* dt) : abstractSoftware(globals, dt)13 softwareTransport::softwareTransport(string inputFileName,globalParameters* globals, dataManager* dt) : abstractSoftware(inputFileName, globals, dt) 14 14 { 15 15 ; … … 17 17 18 18 19 bool softwareTransport::createInputFile( string inputFileName,particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir)19 bool softwareTransport::createInputFile(particleBeam* beamBefore, unsigned int numeroDeb, unsigned int numeroFin, string workingDir) 20 20 { 21 21 unsigned int k; … … 36 36 37 37 ofstream outfile; 38 string name = workingDir + inputFileName ;38 string name = workingDir + inputFileName_; 39 39 outfile.open(name.c_str(), ios::out); 40 40 if (!outfile) … … 105 105 106 106 107 bool softwareTransport::execute( string inputFileName,unsigned int numeroDeb, unsigned int numeroFin, string workingDir)107 bool softwareTransport::execute( unsigned int numeroDeb, unsigned int numeroFin, string workingDir) 108 108 { 109 109 ostringstream sortie; … … 116 116 string transportJob = workingDir + "transport"; 117 117 transportJob += string(" < "); 118 transportJob += workingDir + inputFileName ;118 transportJob += workingDir + inputFileName_; 119 119 cout << " job transport= " << transportJob << endl; 120 120 -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_softwarePanel.cc
r313 r316 141 141 int current = dtmanage_->getNumeroFromElementLabel( currentString); 142 142 143 cout << " numero " << current << endl;144 143 // si la fin est mal definie on prend toute la config par defaut 145 144 if ( current <= 0 || current > dtmanage_->getBeamLineSize() ) … … 159 158 { 160 159 // debut 161 if ( current > =dtmanage_->getBeamLineSize() )160 if ( current > dtmanage_->getBeamLineSize() ) 162 161 { 163 // GWt_tools::addConsoleMessage(" bad section definition ! \n ");164 162 GWt_dialog warningDialog("PSPA : VÃrification des sections", " bad section definition !", GWt_dialog::Error,true,true); 165 163 warningDialog.exec(); … … 173 171 int numeroFin = dtmanage_->getNumeroFromElementLabel( finString); 174 172 175 if ( numeroFin < =current || numeroFin > dtmanage_->getBeamLineSize())173 if ( numeroFin < current || numeroFin > dtmanage_->getBeamLineSize()) 176 174 { 177 // GWt_tools::addConsoleMessage(" bad section definition ! \n "); 178 GWt_dialog warningDialog("PSPA : VÃrification des sections", " bad section definition !", GWt_dialog::Error, true,true); 175 GWt_dialog warningDialog("PSPA : Checking of sections", " bad section definition !", GWt_dialog::Error, true,true); 179 176 warningDialog.exec(); 180 177 return; … … 217 214 string diagnostic; 218 215 trivaluedBool essai = dtmanage_->checkExecute(diagnostic); 219 cout << " retour verif , essai = " << essai << endl;220 216 if ( essai == error ) { 221 cout << " appli : erreur " << endl;222 217 caMarche = false; 223 218 GWt_dialog calculDialog("PSPA check execute : ERROR", diagnostic , GWt_dialog::Error,true,true); 224 219 calculDialog.exec(); 225 220 } else if ( essai == warning ) { 226 cout << " appli : warnig " << endl;227 221 caMarche = true; 228 222 GWt_dialog calculDialog("PSPA check execute : warning ", diagnostic , GWt_dialog::Warning, false,true);
Note: See TracChangeset
for help on using the changeset viewer.