Changeset 386 in PSPA for Interface_Web/trunk/pspaWT/sources/controler/src/beam2Moments.cc
- Timestamp:
- Mar 12, 2013, 1:54:41 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/sources/controler/src/beam2Moments.cc
r355 r386 78 78 79 79 // suppose qu'on est bien positionné dans le stream (a revoir) 80 voidbeam2Moments::readFromTransportOutput(stringstream& inp) {80 bool beam2Moments::readFromTransportOutput(stringstream& inp) { 81 81 string bidString, bidString1, bidString2; 82 82 double bidon, bidon1, bidon2; … … 87 87 string buf; 88 88 // sauter les eventuels 'VARY' 89 90 string varied = "VARIED:"; 91 // while ( varied == "VARIED:" ) { 92 // getline(inp, buf); 93 // cout << " beam2Moments::readFromTransportOutput ligne lue : " << buf << endl; 94 // stringstream str(buf); 95 // str >> varied; 96 // } 97 98 string testVary; 89 99 while ( notFound ) { 90 100 getline(inp, buf); 91 stringstream str(buf); 101 // cout << " beam2Moments::readFromTransportOutput ligne lue : " << buf << endl; 102 stringstream str(buf); 92 103 if ( str >> bidon1 >> bidString1 >> bidon2 >> ( rij_secondOrderMoments_.at(0) ).at(0) >> bidString2 ) { 93 notFound = false; 94 } 95 } 96 // test = inp >> bidon >> bidString >> bidon >> ( rij_secondOrderMoments_.at(0) ).at(0) >> bidString; 97 // cout << " beam2Moments::readFromTransportOutput TEST= " << test << endl; 98 // } 99 inp >> bidon >> ( rij_secondOrderMoments_.at(1) ).at(1) >> bidString >> ( rij_secondOrderMoments_.at(1) ).at(0); 100 inp >> bidon >> ( rij_secondOrderMoments_.at(2) ).at(2) >> bidString >> ( rij_secondOrderMoments_.at(2) ).at(0) >> ( rij_secondOrderMoments_.at(2) ).at(1); 101 inp >> bidon >> ( rij_secondOrderMoments_.at(3) ).at(3) >> bidString >> ( rij_secondOrderMoments_.at(3) ).at(0) >> ( rij_secondOrderMoments_.at(3) ).at(1) >> ( rij_secondOrderMoments_.at(3) ).at(2); 102 103 inp >> bidon >> ( rij_secondOrderMoments_.at(4) ).at(4) >> bidString >> ( rij_secondOrderMoments_.at(4) ).at(0) >> ( rij_secondOrderMoments_.at(4) ).at(1) >> ( rij_secondOrderMoments_.at(4) ).at(2) >> ( rij_secondOrderMoments_.at(4) ).at(3); 104 105 inp >> bidon >> ( rij_secondOrderMoments_.at(5) ).at(5) >> bidString >> ( rij_secondOrderMoments_.at(5) ).at(0) >> ( rij_secondOrderMoments_.at(5) ).at(1) >> ( rij_secondOrderMoments_.at(5) ).at(2) >> ( rij_secondOrderMoments_.at(5) ).at(3) >> ( rij_secondOrderMoments_.at(5) ).at(4); 106 104 // le format semble correct 105 if ( bidString1 != "M" ) { 106 // c'est bien ce qu'on attend : la longuer en metres 107 cout << " beam2Moments::readFromTransportOutput ON N'A PAS 'M' ligne lue : " << buf << endl; 108 notFound = true; 109 break; 110 } else { 111 // on a trouve la bonne ligne 112 cout << " beam2Moments::readFromTransportOutput lecture OK : ligne lue : " << buf << endl; 113 notFound = false; 114 } 115 } else { 116 // la ligne lue n'est pas au format 117 cout << " beam2Moments::readFromTransportOutput format non conforme ligne lue : " << buf << endl; 118 stringstream test(buf); 119 if ( test >> testVary ) { 120 if ( testVary == varied ) { 121 // ca peut arriver... on continue 122 cout << " beam2Moments::readFromTransportOutput VARIED RENCONTRE ligne lue : " << buf << endl; 123 notFound = true; 124 } else { 125 // on essaie de voir ce qui se passe (ce sera probablement a completer) 126 if ( testVary == "(" ) { 127 // on est trop loin, on est sur l'element suivant, on arrete 128 cout << " beam2Moments::readFromTransportOutput ON EST TOMBE SUR ELEMNT SUIVANT ligne lue : " << buf << endl; 129 notFound = true; 130 break; 131 } 132 if ( testVary == "0" ) { 133 // on doit etre a la fin du fichier, ce qu'on verifie 134 if ( test >> bidString ) { 135 if ( bidString == "*LENGTH*" ) { 136 // c'est bien ca, on arrete 137 cout << " beam2Moments::readFromTransportOutput ON EST A LA FIN DU FICHIER ligne lue : " << buf << endl; 138 notFound = true; 139 break; 140 } else { 141 // on n'y comprend plus grans chose, on arrete de toute facon 142 cout << " beam2Moments::readFromTransportOutput SITUATION NON PREVUE 1 ligne lue : " << buf << endl; 143 notFound = true; 144 break; 145 } // fin test lecture d'une chaine de caracteres 146 } else { 147 // on n'a pas pu lire la chaine, on n'y comprend rien, on arrete 148 cout << " beam2Moments::readFromTransportOutput SITUATION NON PREVUE 2 ligne lue : " << buf << endl; 149 notFound = true; 150 break; 151 } 152 } else { 153 // le premier element lu n'est pas 0, on n'est pas a la fin 154 // mais il n'y a pas de faisceau a cet endroit, sortie normale 155 cout << " beam2Moments::readFromTransportOutput SORTIE NORMALE ligne lue : " << buf << endl; 156 notFound = true; 157 break; 158 } 159 // si on arrive la, on est en pleine panade 160 cout << " beam2Moments::readFromTransportOutput SITUATION NON PREVUE 4 ligne lue : " << buf << endl; 161 notFound = true; 162 break; 163 } 164 } else { 165 // on n'a pas pu lire le premier element de la ligne (bizarre) 166 cout << " beam2Moments::readFromTransportOutput SITUATION NON PREVUE 5 ligne lue : " << buf << endl; 167 notFound = true; 168 break; 169 } 170 } 171 } // fin de boucle sur les lignes 172 173 if ( notFound ) return false; 174 175 176 if ( ! ( inp >> bidon >> ( rij_secondOrderMoments_.at(1) ).at(1) >> bidString >> ( rij_secondOrderMoments_.at(1) ).at(0) ) ) return false; 177 if ( ! (inp >> bidon >> ( rij_secondOrderMoments_.at(2) ).at(2) >> bidString >> ( rij_secondOrderMoments_.at(2) ).at(0) >> ( rij_secondOrderMoments_.at(2) ).at(1) ) ) return false; 178 if ( ! (inp >> bidon >> ( rij_secondOrderMoments_.at(3) ).at(3) >> bidString >> ( rij_secondOrderMoments_.at(3) ).at(0) >> ( rij_secondOrderMoments_.at(3) ).at(1) >> ( rij_secondOrderMoments_.at(3) ).at(2) ) ) return false; 179 180 if ( ! ( inp >> bidon >> ( rij_secondOrderMoments_.at(4) ).at(4) >> bidString >> ( rij_secondOrderMoments_.at(4) ).at(0) >> ( rij_secondOrderMoments_.at(4) ).at(1) >> ( rij_secondOrderMoments_.at(4) ).at(2) >> ( rij_secondOrderMoments_.at(4) ).at(3) ) ) return false; 181 182 if ( ! (inp >> bidon >> ( rij_secondOrderMoments_.at(5) ).at(5) >> bidString >> ( rij_secondOrderMoments_.at(5) ).at(0) >> ( rij_secondOrderMoments_.at(5) ).at(1) >> ( rij_secondOrderMoments_.at(5) ).at(2) >> ( rij_secondOrderMoments_.at(5) ).at(3) >> ( rij_secondOrderMoments_.at(5) ).at(4) ) ) return false; 183 184 return true; 107 185 } 108 186
Note: See TracChangeset
for help on using the changeset viewer.