[431] | 1 | #include <stdio.h> |
---|
| 2 | #include <fstream> |
---|
| 3 | |
---|
[27] | 4 | #include "dataManager.h" |
---|
[243] | 5 | #include "mathematicalConstants.h" |
---|
| 6 | #include "PhysicalConstants.h" |
---|
[431] | 7 | |
---|
| 8 | #include "GWt_pspaApplication.h" |
---|
| 9 | #include "GWt_console.h" |
---|
| 10 | |
---|
[295] | 11 | #include "softwareParmela.h" |
---|
| 12 | #include "softwareTransport.h" |
---|
[304] | 13 | #include "softwareGenerator.h" |
---|
[442] | 14 | #include "softwareGenerator.h" |
---|
| 15 | #include "softwareUsersprogram.h" |
---|
[316] | 16 | #include "softwareTest.h" |
---|
[431] | 17 | #include "softwareMadx.h" //xx |
---|
| 18 | #include "softwareUnknown.h" //xx |
---|
[27] | 19 | |
---|
[347] | 20 | #include <boost/filesystem.hpp> |
---|
[27] | 21 | |
---|
[424] | 22 | #include "UAP/UAPUtilities.hpp" |
---|
| 23 | #include "AML/AMLReader.hpp" |
---|
| 24 | |
---|
[431] | 25 | #define BAVARD 0 |
---|
| 26 | |
---|
[342] | 27 | dataManager::dataManager(PspaApplication* pspa) : |
---|
[359] | 28 | currentBeam_(NULL), |
---|
| 29 | pspa_ (pspa) |
---|
[342] | 30 | {} |
---|
[305] | 31 | |
---|
[359] | 32 | dataManager::~dataManager() |
---|
[50] | 33 | { |
---|
[431] | 34 | unsigned k; |
---|
| 35 | for (k=0; k < jobList_.size();k++) { |
---|
| 36 | if ( jobList_[k] != NULL ) delete jobList_[k]; |
---|
| 37 | } |
---|
| 38 | if ( currentBeam_ == NULL ) delete currentBeam_; |
---|
[50] | 39 | } |
---|
[38] | 40 | |
---|
[431] | 41 | void dataManager::consoleMessage(string message) |
---|
| 42 | { |
---|
| 43 | GWt_console* console = static_cast<GWt_console*> (wApp->findWidget ("console")); |
---|
| 44 | if (console) console->addConsoleMessage(message + "\n"); |
---|
| 45 | pspa_->processEvents(); |
---|
[313] | 46 | } |
---|
[299] | 47 | |
---|
[118] | 48 | string dataManager::getLabelFromElementNumero(int numero) |
---|
| 49 | { |
---|
[431] | 50 | abstractElement* ptr = pspa_->getBeamLine()->getAbstractElement(numero-1); |
---|
| 51 | if ( ptr == NULL ) return ""; |
---|
| 52 | return ptr->getLabel(); |
---|
[118] | 53 | } |
---|
| 54 | |
---|
[342] | 55 | int dataManager::getNumeroFromElementLabel(string label) |
---|
| 56 | { |
---|
[431] | 57 | int index = -1; |
---|
| 58 | for (int k = 0; k < getBeamLineSize() ; k++) { |
---|
| 59 | if (pspa_->getBeamLine()->getAbstractElement(k) != NULL) { |
---|
| 60 | if ( pspa_->getBeamLine()->getAbstractElement(k)->getLabel() == label ) |
---|
| 61 | { |
---|
| 62 | index = (int)k + 1; |
---|
| 63 | return index; |
---|
| 64 | } |
---|
[305] | 65 | } |
---|
[431] | 66 | } |
---|
| 67 | return index; |
---|
[305] | 68 | } |
---|
| 69 | |
---|
[342] | 70 | abstractElement* dataManager::getElementPointerFromNumero(int k) |
---|
| 71 | { |
---|
[371] | 72 | return pspa_->getBeamLine()->getAbstractElement(k-1); |
---|
[305] | 73 | } |
---|
| 74 | |
---|
[431] | 75 | sectionToExecute* dataManager::addSectionToExecute(abstractElement* debut,int debutIndex, abstractElement* fin, int finIndex, nomDeLogiciel logiciel) |
---|
[112] | 76 | { |
---|
[436] | 77 | #if BAVARD > 0 |
---|
[431] | 78 | cout << "***********************************" << endl; |
---|
| 79 | cout << " dataManager::addSectionToExecute " << endl << endl; |
---|
| 80 | #endif |
---|
| 81 | |
---|
[419] | 82 | abstractSoftware* prog; |
---|
| 83 | string inputFileName; |
---|
| 84 | if(logiciel == nomDeLogiciel::parmela) { |
---|
| 85 | inputFileName = "parmin"; |
---|
| 86 | prog = new softwareParmela(inputFileName, &globParam_, this); |
---|
| 87 | } else if (logiciel == nomDeLogiciel::transport) { |
---|
| 88 | inputFileName = "transport.input"; |
---|
| 89 | prog = new softwareTransport(inputFileName, &globParam_, this); |
---|
| 90 | } else if (logiciel == nomDeLogiciel::generator) { |
---|
| 91 | inputFileName = "generator.in"; |
---|
| 92 | prog = new softwareGenerator(inputFileName, &globParam_, this); |
---|
[431] | 93 | } else if (logiciel == nomDeLogiciel::madx) { |
---|
| 94 | inputFileName = "madx.input"; |
---|
| 95 | prog = new softwareMadx(inputFileName,§orParam_,this); |
---|
[442] | 96 | } else if (logiciel == nomDeLogiciel::usersprogram) { |
---|
| 97 | inputFileName = "dummy"; |
---|
| 98 | prog = new softwareUsersprogram(inputFileName, &globParam_, this); |
---|
| 99 | } else if (logiciel == nomDeLogiciel::test) { |
---|
| 100 | prog = new softwareTest(inputFileName, &globParam_, this); |
---|
[419] | 101 | } else { |
---|
[431] | 102 | prog = new softwareUnknown(); // xx |
---|
[419] | 103 | } |
---|
| 104 | |
---|
[431] | 105 | jobList_.push_back(new sectionToExecute(debut,debutIndex,fin,finIndex,prog)); |
---|
[419] | 106 | return jobList_.back(); |
---|
[112] | 107 | } |
---|
[58] | 108 | |
---|
[105] | 109 | void dataManager::clearSectionToExecute() |
---|
| 110 | { |
---|
[431] | 111 | unsigned k; |
---|
| 112 | for(k = 0; k < jobList_.size(); k++) |
---|
[105] | 113 | { |
---|
[431] | 114 | if ( jobList_[k] != NULL ) clearSectionToExecute(k); |
---|
[105] | 115 | } |
---|
[431] | 116 | jobList_.clear(); |
---|
[105] | 117 | } |
---|
[59] | 118 | |
---|
[431] | 119 | void dataManager::clearSectionToExecute(int a) |
---|
| 120 | { |
---|
| 121 | cout << " dataManager::clearSectionToExecute : effacement de la section d'index = " << a << endl; |
---|
[424] | 122 | if (a < 0) return; |
---|
| 123 | if (a >= (int)jobList_.size()) return; |
---|
[431] | 124 | |
---|
[424] | 125 | // lors de la creation de la section on a fait un 'new' d'un |
---|
| 126 | // softwareXXXX : on fait ici le 'delete' |
---|
[431] | 127 | |
---|
[419] | 128 | const abstractSoftware* soft = jobList_.at(a)->getSoftware(); |
---|
[424] | 129 | if ( soft != NULL ) delete soft; |
---|
[407] | 130 | jobList_.erase (jobList_.begin()+a); |
---|
[401] | 131 | } |
---|
| 132 | |
---|
[302] | 133 | void dataManager::initializeExecution() |
---|
[102] | 134 | { |
---|
[371] | 135 | string workingDir = pspa_->getWorkingDir(); |
---|
| 136 | if (workingDir == "") { |
---|
| 137 | return; |
---|
| 138 | } |
---|
| 139 | removeFile(workingDir + "parmdesz"); |
---|
| 140 | removeFile(workingDir + "parmin"); |
---|
| 141 | removeFile(workingDir + "parin.input0"); |
---|
| 142 | removeFile(workingDir + "transport.input"); |
---|
| 143 | removeFile(workingDir + "transport.output"); |
---|
| 144 | removeFile(workingDir + "generator.in"); |
---|
| 145 | removeFile(workingDir + "faisceau.ini"); |
---|
| 146 | removeFile(workingDir + "generator.output"); |
---|
| 147 | diagnosticBeam_.clear(); |
---|
[386] | 148 | indexElementToIndexDiag_.clear(); |
---|
[371] | 149 | currentBeam_ = NULL; |
---|
| 150 | firstComputedElemNumero_ = getBeamLineSize(); |
---|
| 151 | lastComputedElemNumero_ = 1; |
---|
| 152 | clearSectionToExecute(); |
---|
[105] | 153 | } |
---|
| 154 | |
---|
[305] | 155 | void dataManager::removeFile(string nameOfFile) |
---|
[105] | 156 | { |
---|
[431] | 157 | ifstream fileExists; |
---|
| 158 | fileExists.open(nameOfFile.c_str(), ios::in); |
---|
| 159 | if (fileExists) { |
---|
| 160 | fileExists.close(); |
---|
| 161 | remove(nameOfFile.c_str()); |
---|
| 162 | } |
---|
[112] | 163 | } |
---|
| 164 | |
---|
[313] | 165 | bool dataManager::executeAll() |
---|
[112] | 166 | { |
---|
[436] | 167 | #if BAVARD > 0 |
---|
[431] | 168 | cout << "***********************************" << endl; |
---|
| 169 | cout << " dataManager::executeAll() " << endl << endl; |
---|
[436] | 170 | #endif |
---|
[431] | 171 | |
---|
[371] | 172 | bool success = true; |
---|
| 173 | abstractSoftware* softw = NULL; |
---|
| 174 | string workingDir = pspa_->getWorkingDir(); |
---|
[431] | 175 | |
---|
[413] | 176 | // on verifie la consecution des sections |
---|
| 177 | int lastel = 0; |
---|
[424] | 178 | for(unsigned k = 0; k < jobList_.size(); k++) { |
---|
| 179 | if ( jobList_[k]->getElementNumberInSection() != lastel +1 ) { |
---|
| 180 | consoleMessage("dataManager::executeAll ERROR : sections should be consecutive "); |
---|
| 181 | return false; |
---|
| 182 | } else { |
---|
| 183 | lastel = jobList_[k]->getLastElementNumberInSection(); |
---|
[413] | 184 | } |
---|
[424] | 185 | } |
---|
[431] | 186 | |
---|
[424] | 187 | unsigned debut; |
---|
| 188 | unsigned fin; |
---|
| 189 | for(unsigned k = 0; k < jobList_.size(); k++) { |
---|
[436] | 190 | |
---|
| 191 | #if BAVARD > 0 |
---|
[424] | 192 | cout << " dataManager::executeAll je m'apprete a executer : " << (jobList_[k]->getSoftware()->getName()) << endl; |
---|
[436] | 193 | #endif |
---|
[431] | 194 | |
---|
[424] | 195 | debut = jobList_[k]->getElementNumberInSection(); |
---|
| 196 | fin = jobList_[k]->getLastElementNumberInSection(); |
---|
| 197 | softw = jobList_[k]->getSoftware(); |
---|
| 198 | |
---|
[431] | 199 | //cout << "k= " << k << ", de " << jobList_[k]->getFirstElement()->getLabel() << " Ã " << jobList_[k]->getLastElement()->getLabel() << " avec " << softw->getName() << endl; |
---|
| 200 | |
---|
[424] | 201 | if (softw == NULL) { |
---|
[431] | 202 | success = false; |
---|
| 203 | consoleMessage("dataManager::executeAll : unknown software"); |
---|
| 204 | break; |
---|
| 205 | } |
---|
| 206 | |
---|
| 207 | success = softw->createInputFile(currentBeam_,debut,fin,workingDir); |
---|
| 208 | if ( success ) { |
---|
| 209 | success = softw->execute(workingDir); |
---|
[371] | 210 | if ( success ) { |
---|
[431] | 211 | success = softw->buildBeamAfterElements(workingDir); |
---|
[371] | 212 | } |
---|
[431] | 213 | } |
---|
| 214 | |
---|
| 215 | if ( success ) { |
---|
| 216 | currentBeam_ = &diagnosticBeam_.at(indexElementToIndexDiag_.back()); |
---|
| 217 | cout << " execute termine avec succes " << endl; |
---|
| 218 | } else { |
---|
| 219 | currentBeam_ = NULL; |
---|
| 220 | cout << " execute termine en ECHEC " << endl; |
---|
| 221 | } |
---|
| 222 | if ( !success ) break; |
---|
| 223 | |
---|
| 224 | if ( debut < firstComputedElemNumero_ ) firstComputedElemNumero_ = debut; |
---|
| 225 | if ( fin > lastComputedElemNumero_ ) lastComputedElemNumero_ = fin; |
---|
[436] | 226 | |
---|
| 227 | #if BAVARD > 0 |
---|
[431] | 228 | cout << "dataManager::executeAll #diagnosticBeam= " << diagnosticBeam_.size() << endl; |
---|
| 229 | cout << "dataManager::executeAll #getBeamLineSize()= " << getBeamLineSize() << endl; |
---|
| 230 | for (unsigned j = debut; j <= fin; j++) { |
---|
| 231 | abstractElement* elPtr= getElementPointerFromNumero(j); |
---|
| 232 | cout << "[" << j << "] " << elPtr->getNomdElement().getExpandedName() << endl; |
---|
| 233 | } |
---|
[436] | 234 | #endif |
---|
| 235 | |
---|
[424] | 236 | } //k |
---|
[442] | 237 | // if ( currentBeam_ ) { |
---|
| 238 | // string aml_file = workingDir + "/" + "faisceau_final" + ".aml"; |
---|
| 239 | // currentBeam_->writeToAMLFile(aml_file); |
---|
| 240 | // // TESTS |
---|
| 241 | // currentBeam_->readFromAMLFile(aml_file); |
---|
| 242 | // } |
---|
[436] | 243 | cout << " dataManager::executeAll() : premier element = " << firstComputedElemNumero_ << " dernier = " << lastComputedElemNumero_ << endl; |
---|
| 244 | |
---|
[371] | 245 | return success; |
---|
[102] | 246 | } |
---|
[50] | 247 | |
---|
[347] | 248 | void dataManager::saveConfiguration(string folder, string nameOfFile) |
---|
[112] | 249 | { |
---|
[431] | 250 | ofstream outfile; |
---|
[436] | 251 | //string name = pspa_->getWorkingDir()+ folder + "/" + nameOfFile + ".save"; |
---|
[431] | 252 | cout << " dataManager::saveConfiguration : suppression du folder dans le nom de " << endl; |
---|
| 253 | cout << " sauvegarde, en attendant que ce soit autre chose que le sessionId" << endl; |
---|
| 254 | cout << " et qu'on puisse restaurer normalement" << endl; |
---|
| 255 | |
---|
| 256 | string name = pspa_->getWorkingDir() + "/" + nameOfFile + ".save"; |
---|
| 257 | // make dir if not exist |
---|
| 258 | boost::filesystem::create_directories(pspa_->getWorkingDir() + folder + "/"); |
---|
| 259 | |
---|
| 260 | outfile.open(name.c_str(), ios::out); |
---|
| 261 | if (!outfile) { |
---|
| 262 | cerr<<" ERROR opening output file for persistency "<<name<<endl; |
---|
| 263 | } |
---|
| 264 | |
---|
| 265 | outfile << globParam_.FileOutputFlow(); |
---|
| 266 | outfile << sectorParam_.FileOutputFlow(); |
---|
[436] | 267 | |
---|
[431] | 268 | abstractElement* elPtr; |
---|
| 269 | for(int k = 0; k < getBeamLineSize() ; k++) |
---|
[50] | 270 | { |
---|
[424] | 271 | elPtr = pspa_->getBeamLine()->getAbstractElement(k); |
---|
| 272 | outfile << elPtr->FileOutputFlow(); |
---|
[50] | 273 | } |
---|
[431] | 274 | outfile.close(); |
---|
[112] | 275 | } |
---|
| 276 | |
---|
[424] | 277 | // ecriture sur fichier AML |
---|
| 278 | void dataManager::writeToAMLFile(string fileName) |
---|
| 279 | { |
---|
| 280 | UAPNode* uap_root = NULL; |
---|
| 281 | uap_root = new UAPNode("UAP_root"); |
---|
| 282 | UAPNode* rep = uap_root->addChild("AML_representation"); |
---|
[431] | 283 | |
---|
[424] | 284 | // root node in the hierarchy |
---|
| 285 | UAPNode* lab = rep->addChild("laboratory"); |
---|
| 286 | lab->addAttribute("name","PSPA lab"); |
---|
[431] | 287 | |
---|
[436] | 288 | // general global parameters--docroot . --http-address 0.0.0.0 --http-port 8077 |
---|
[424] | 289 | globParam_.InputRep(lab); |
---|
[431] | 290 | |
---|
[424] | 291 | // accelerator or section of accelerator |
---|
| 292 | //UAPNode* acc = lab->addChild("machine"); |
---|
| 293 | //acc->addAttribute("name",fileName); |
---|
| 294 | |
---|
[436] | 295 | //sectorParam_.InputRep(lab); |
---|
[431] | 296 | |
---|
[424] | 297 | // sequence of elements |
---|
| 298 | UAPNode* sect = lab->addChild("sector"); |
---|
| 299 | sect->addAttribute("name","a_sect"); |
---|
| 300 | |
---|
| 301 | abstractElement* elPtr; |
---|
| 302 | for(int k = 0; k < getBeamLineSize() ; k++) { |
---|
| 303 | elPtr = pspa_->getBeamLine()->getAbstractElement(k); |
---|
| 304 | elPtr->InputRep(sect); |
---|
| 305 | } |
---|
| 306 | |
---|
| 307 | cout << "!Create the AML file ---------------------------" << endl; |
---|
| 308 | AMLReader reader; |
---|
| 309 | string aml_file = pspa_->getWorkingDir() + "/" + fileName + ".aml"; |
---|
| 310 | reader.AMLRepToAMLFile (uap_root, aml_file); |
---|
| 311 | } |
---|
| 312 | |
---|
[431] | 313 | bool dataManager::restoreElements(string inputFileName) |
---|
[112] | 314 | { |
---|
[431] | 315 | cout << "***********************************" << endl; |
---|
| 316 | cout << " dataManager::restoreElements() fichier :" << inputFileName << endl << endl; |
---|
| 317 | |
---|
| 318 | ifstream infile; |
---|
| 319 | string name = inputFileName; |
---|
| 320 | infile.open(name.c_str(), ios::in); |
---|
| 321 | if (!infile) { |
---|
| 322 | cerr << " error opening input stream " << name << endl; |
---|
| 323 | return false; |
---|
| 324 | } |
---|
| 325 | else cout << " successful opening input stream : " << name << endl; |
---|
| 326 | |
---|
[436] | 327 | //NOTE:: je ne sais pas si les "secteurs" seront conservés, aussi pour ne pas trop changer les fichiers je lis les données aprÚs "globals" dans la boucle |
---|
[431] | 328 | |
---|
| 329 | pspa_->getBeamLine()->clear(); |
---|
| 330 | nomdElements::typedElement elementType; |
---|
| 331 | string elementLabel; |
---|
| 332 | while (infile >> elementLabel) { |
---|
[436] | 333 | if (elementLabel == string("globals") ) { |
---|
| 334 | globParam_.raz(); |
---|
| 335 | globParam_.FileInput(infile); |
---|
| 336 | } else if (elementLabel == string("sectors") ) { |
---|
[431] | 337 | sectorParam_.raz(); |
---|
| 338 | sectorParam_.FileInput(infile); |
---|
[112] | 339 | } else { |
---|
[431] | 340 | elementType = nomdElements::getTypeFromLabel(elementLabel); |
---|
| 341 | GWt_abstractElement* nouveau = pspa_->getBeamLine()->addElement(elementType); |
---|
| 342 | if ( nouveau == NULL ) { |
---|
| 343 | cerr << " dataManager::restoreElements() : restore element " << elementLabel << " failed " << endl; |
---|
| 344 | return false; |
---|
| 345 | } else { |
---|
| 346 | nouveau->FileInput(infile); |
---|
| 347 | } |
---|
[112] | 348 | } |
---|
[431] | 349 | }// while |
---|
| 350 | |
---|
[436] | 351 | #if BAVARD > 1 |
---|
[431] | 352 | unsigned k; |
---|
| 353 | for(k = 0; k < getBeamLineSize(); k++) { |
---|
| 354 | abstractElement* ptr = pspa_->getBeamLine()->getAbstractElement(k); |
---|
| 355 | cout << "recupere " << ptr->getLabel() << endl; |
---|
| 356 | } |
---|
| 357 | #endif |
---|
| 358 | |
---|
| 359 | infile.close(); |
---|
| 360 | return true; |
---|
[305] | 361 | } |
---|
[50] | 362 | |
---|
[305] | 363 | particleBeam* dataManager::getDiagnosticBeam(unsigned index) |
---|
[179] | 364 | { |
---|
[386] | 365 | if (index >= indexElementToIndexDiag_.size() ) { |
---|
| 366 | return NULL; |
---|
| 367 | } else { |
---|
| 368 | int indDiag = indexElementToIndexDiag_.at(index); |
---|
| 369 | return &diagnosticBeam_.at(indDiag); |
---|
| 370 | } |
---|
[179] | 371 | } |
---|
[149] | 372 | |
---|
[386] | 373 | particleBeam* dataManager::getDiagnosticBeam(string elementLabel) |
---|
| 374 | { |
---|
| 375 | return getDiagnosticBeam( getNumeroFromElementLabel(elementLabel) -1); |
---|
| 376 | } |
---|
[236] | 377 | |
---|
[359] | 378 | |
---|
[342] | 379 | // on ne tient pas compte des elements "snapshot" presents dans la beamLine |
---|
[381] | 380 | void dataManager::donneesRmsEnveloppe(string type,vector<double>& xcor,vector<double>& ycor, string& titre, string& legendx, string& legendy) |
---|
[342] | 381 | { |
---|
| 382 | double longueur = 0.0; |
---|
| 383 | double valeur = 0.0; |
---|
| 384 | xcor.clear(); |
---|
| 385 | ycor.clear(); |
---|
[381] | 386 | titre.clear(); |
---|
| 387 | titre = " rms enveloppe "; |
---|
| 388 | legendx.clear(); |
---|
| 389 | legendx = " z (m)"; |
---|
[342] | 390 | if ( type == "x" ) { |
---|
| 391 | unsigned i = 0; |
---|
[355] | 392 | cout << " dataManager::donneesRmsEnveloppe BeamLineSize = " << getBeamLineSize() << endl; |
---|
[368] | 393 | // for (unsigned k = 0; k < getBeamLineSize(); k++) { |
---|
| 394 | for (unsigned k = firstComputedElemNumero_ -1 ; k < lastComputedElemNumero_ ; k++) { |
---|
[342] | 395 | abstractElement* elPtr = pspa_->getBeamLine()->getAbstractElement(k); |
---|
[386] | 396 | // if(elPtr->getNomdElement().getElementType() == snapshot) continue; |
---|
[381] | 397 | // if(elPtr->getNomdElement().getElementType() == fit) continue; |
---|
[386] | 398 | particleBeam* beamToDraw = getDiagnosticBeam(i); |
---|
| 399 | if ( !beamToDraw->momentRepresentationOk() ) { |
---|
| 400 | beamToDraw->buildMomentRepresentation(); |
---|
[316] | 401 | } |
---|
| 402 | |
---|
[342] | 403 | longueur += elPtr->getLenghtOfElement(); |
---|
[386] | 404 | valeur = beamToDraw->getXmaxRms(); |
---|
[368] | 405 | cout << " dataManager::donneesRmsEnveloppe index = " << k << " longueur = " << longueur << " enveloppe : " << valeur << endl; |
---|
[381] | 406 | xcor.push_back(0.01*longueur); // on passe en metres |
---|
[342] | 407 | ycor.push_back(valeur); |
---|
| 408 | i++; |
---|
| 409 | } |
---|
[381] | 410 | legendy.clear(); |
---|
| 411 | legendy = " x (cm) "; |
---|
[342] | 412 | } |
---|
[316] | 413 | } |
---|
[342] | 414 | |
---|
| 415 | int dataManager::getBeamLineSize() { |
---|
[359] | 416 | return pspa_->getBeamLine()->getBeamLineSize(); |
---|
[342] | 417 | } |
---|
| 418 | |
---|
[401] | 419 | |
---|
[359] | 420 | abstractSoftware* dataManager::createSoftwareConnexion(nomDeLogiciel logi) |
---|
[342] | 421 | { |
---|
[431] | 422 | string inputFileName; |
---|
| 423 | if(logi == nomDeLogiciel::parmela) { |
---|
| 424 | cout << " dataManager::createSoftwareConnexion : logiciel identifie : parmela " << endl; |
---|
| 425 | inputFileName = "parmin"; |
---|
| 426 | return new softwareParmela(inputFileName, &globParam_, this); |
---|
| 427 | } else if (logi == nomDeLogiciel::transport) { |
---|
| 428 | cout << " dataManager::createSoftwareConnexion : logiciel identifie : transport " << endl; |
---|
| 429 | inputFileName = "transport.input"; |
---|
| 430 | return new softwareTransport(inputFileName, &globParam_, this); |
---|
| 431 | } else if (logi == nomDeLogiciel::generator) { |
---|
| 432 | cout << " dataManager::createSoftwareConnexion : logiciel identifie : generator " << endl; |
---|
| 433 | inputFileName = "generator.in"; |
---|
| 434 | return new softwareGenerator(inputFileName, &globParam_, this); |
---|
| 435 | } else if (logi == nomDeLogiciel::test) { |
---|
| 436 | cout << " dataManager::createSoftwareConnexion : logiciel identifie : test " << endl; |
---|
[359] | 437 | return new softwareTest(inputFileName, &globParam_, this); |
---|
[431] | 438 | } else { |
---|
| 439 | cout << " dataManager::createSoftwareConnexion : logiciel identifie : null " << endl; |
---|
| 440 | return NULL; |
---|
| 441 | } |
---|
[342] | 442 | } |
---|
[449] | 443 | |
---|
| 444 | sector* dataManager::addNewSector() { |
---|
| 445 | std::stringstream str; |
---|
| 446 | str << getSectors().size()+1; |
---|
| 447 | std::string result; |
---|
| 448 | str >> result; |
---|
| 449 | |
---|
| 450 | sector* sect = new sector(std::string("sector ") + result); |
---|
| 451 | sectors_.push_back(sect); |
---|
| 452 | return sect; |
---|
| 453 | } |
---|
| 454 | |
---|