Changeset 128 in PSPA for Interface_Web/trunk/pspaWT/src/particleBeam.cc
- Timestamp:
- Dec 3, 2012, 6:47:03 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/src/particleBeam.cc
r124 r128 2 2 #include "mathematicalConstants.h" 3 3 #include "PhysicalConstants.h" 4 //#include "nomdElements.h" 4 5 //#include <string> 5 6 #include <stdio.h> 6 7 7 8 #include "environmentVariables.h" 9 10 bool particleBeam::setFromTransport(string elLab, typedElement elemType) 11 { 12 string elementLabel = elLab; 13 // transformer le label en majuscules ; je ne suis pas sur que ca 14 // marchera a tous les coups (glm) 15 16 std::transform(elementLabel.begin(), elementLabel.end(), elementLabel.begin(), (int (*)(int))std::toupper); 17 cout << " particleBeam::setFromTransport on cherche element " << elementLabel << endl; 18 string buf; 19 ifstream infile; 20 string nameIn = WORKINGAREA + "transport.output"; 21 infile.open(nameIn.c_str(), ios::in); 22 if (!infile) 23 { 24 cerr << " particleBeam::setFromTransport : error re-opening transport output stream " << nameIn << endl; 25 return false; 26 } 27 // else cout << " particleBeam::setFromTransport() : ouverture du fichier " << nameIn << endl; 28 29 string::size_type nn = string::npos; 30 while ( getline(infile, buf) ) 31 { 32 // cout << " buf= " << buf << endl; 33 nn = buf.find(elementLabel); 34 // cout << " string::npos= " << string::npos << " nn= " << nn << endl; 35 if ( nn != string::npos ) 36 { 37 // cout << " particleBeam::setFromTransport : element " << elementLabel << " trouve " << endl; 38 break; 39 } 40 } 41 if ( nn == string::npos ) 42 { 43 cerr << " particleBeam::setFromTransport : element " << elementLabel << " non trouve dans le fichier " << nameIn << endl; 44 return false; 45 } 46 if (elemType == bend ) 47 { 48 getline(infile, buf); 49 getline(infile, buf); 50 } 51 readTransportMoments(infile); 52 // impressionDesMoments(); 53 infile.close(); 54 momentRepresentationOk_ = true; 55 return true; 56 } 8 57 9 58 … … 317 366 } 318 367 319 bool particleBeam::setFromTransport(ifstream& inp, unsigned nblignes) 320 { 321 unsigned k; 322 unsigned j,m; 323 unsigned nl0; 324 // cout << " particleBeam : lecture resultats transport nblignes= " << nblignes << endl; 325 string buf; 326 nl0 = nblignes - 7; 327 // cout << " setFromTransport nblignes= " << nblignes << endl; 328 for (k=0; k < nl0; k++) 329 { 330 getline(inp, buf); 331 // cout << " ligne " << k+1 << " buf= " << buf << endl; 332 } 333 334 readTransportMoments(inp); 335 368 void particleBeam::impressionDesMoments() const 369 { 370 unsigned j,m; 336 371 cout << " impression des moments " << endl; 337 372 for ( j = 0; j < 6; j++) … … 343 378 cout << endl; 344 379 } 345 346 momentRepresentationOk_ = true; 347 return true; 348 } 380 } 381 382 //&&&&&&&&&&& 383 384 // bool particleBeam::setFromTransport(ifstream& inp, unsigned nblignes) 385 // { 386 // unsigned k; 387 // unsigned j,m; 388 // unsigned nl0; 389 // // cout << " particleBeam : lecture resultats transport nblignes= " << nblignes << endl; 390 // string buf; 391 // nl0 = nblignes - 7; 392 // // cout << " setFromTransport nblignes= " << nblignes << endl; 393 // for (k=0; k < nl0; k++) 394 // { 395 // getline(inp, buf); 396 // // cout << " ligne " << k+1 << " buf= " << buf << endl; 397 // } 398 399 // readTransportMoments(inp); 400 401 // cout << " impression des moments " << endl; 402 // for ( j = 0; j < 6; j++) 403 // { 404 // for (m=0; m <= j; m++) 405 // { 406 // cout << ( rij_transportMoments_.at(j) ).at(m) << " "; 407 // } 408 // cout << endl; 409 // } 410 411 // momentRepresentationOk_ = true; 412 // return true; 413 // } 349 414 350 415
Note: See TracChangeset
for help on using the changeset viewer.