- Timestamp:
- Oct 2, 2018 12:21:11 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/UTIL/chemistry/gasphase_preproc/kpp4palm/src/fortran_file_vec.C
r2696 r3298 9 9 // 10 10 // ############################################################################ 11 //Current revisions: 12 //------------------ 13 / 14 / 15 //Former revisions: 16 //----------------- 17 //$Id: fortran_file.C 2470 2017-09-14 13:56:42Z forkel $ 18 // ketelsen 18.09.2018: Line 112: do k=is,ie bydo k=1,vl; line 156 ff: replaced index k by j 19 // 20 // forkel Sept.2018: added edit_Initialize 21 // changed loop direction for update_rconst in edit_Update_RCONST 22 / 2017-09-14 13:56:42Z forkel $ 23 // 24 // 25 // Nov 2016: Intial version of KP4 adapted to PALM (Klaus Ketelsen) 26 // 27 11 28 12 29 #include <fstream> … … 77 94 } 78 95 } 96 97 for (ip=pline.begin(); ip != pline.end(); ip++) { 98 if(kpp_switches.is_vector() ) { 99 ip->global_substitute ("phot (","phot(j,"); 100 } 101 } 102 79 103 ip = pline.begin()+1 ; 80 104 lo_line = ip->get_line() ; 81 105 lo_line.erase(); 82 lo_line = " INTEGER :: j,k"; 106 if(kpp_switches.is_vector() ) { 107 lo_line = " INTEGER :: j,k"; 108 } else { 109 lo_line = " INTEGER :: k"; 110 } 83 111 ip->set_line(lo_line); 84 112 … … 87 115 lo_line = ip->get_line() ; 88 116 lo_line.erase(); 89 lo_line = " do k= is,ie";117 lo_line = " do k=1,vl"; 90 118 ip->set_line(lo_line); 91 119 … … 93 121 lo_line = ip->get_line() ; 94 122 lo_line.erase(); 95 lo_line = " j = k -is+1";123 lo_line = " j = k"; 96 124 ip->set_line(lo_line); 97 125 … … 103 131 } else { 104 132 ip = pline.begin()+3 ; 133 lo_line = ip->get_line() ; 134 lo_line.erase(); 135 lo_line = " k = is"; 136 ip->set_line(lo_line); 137 } 138 139 return; 140 } 141 142 void fortran_file::edit_Initialize (vector <Vvar> &var_list) { 143 vector<program_line>::iterator ip; 144 vector<Vvar>::iterator iv; 145 string lo_line; 146 147 for (ip=pline.begin(); ip != pline.end(); ip++) { 148 ip->global_substitute ("*"," *"); 149 ip->global_substitute ("* *","**"); 150 ip->global_substitute (","," , "); 151 ip->global_substitute ("/"," / "); 152 ip->global_substitute ("1:VL","j"); 153 } 154 for (ip=pline.begin(); ip != pline.end(); ip++) { 155 for (iv=var_list.begin(); iv != var_list.end(); iv++) { 156 ip->change_variable_to_vector_g (*iv); 157 } 158 } 159 160 for (ip=pline.begin(); ip != pline.end(); ip++) { 161 if(kpp_switches.is_vector() ) { 162 ip->global_substitute ("qvap","qvap(j)"); 163 } 164 } 165 for (ip=pline.begin(); ip != pline.end(); ip++) { 166 if(kpp_switches.is_vector() ) { 167 ip->global_substitute ("fakt","fakt(j)"); 168 } 169 } 170 171 ip = pline.begin()+3 ; 172 lo_line = ip->get_line() ; 173 lo_line.erase(); 174 lo_line = " INTEGER :: j,k"; 175 ip->set_line(lo_line); 176 177 if(kpp_switches.is_vector() ) { 178 ip = pline.begin()+9 ; 179 lo_line = ip->get_line() ; 180 lo_line.erase(); 181 lo_line = " do k = is,ie"; 182 ip->set_line(lo_line); 183 184 ip = pline.begin()+10 ; 185 lo_line = ip->get_line() ; 186 lo_line.erase(); 187 lo_line = " j = k - is +1"; 188 ip->set_line(lo_line); 189 190 ip = pline.end()-2 ; 191 lo_line = ip->get_line() ; 192 // lo_line.erase(); 193 lo_line = " end do"; 194 ip->set_line(lo_line); 195 } else { 196 ip = pline.begin()+7 ; 105 197 lo_line = ip->get_line() ; 106 198 lo_line.erase(); … … 236 328 } 237 329 330 void fortran_file::edit_WAXPY () { 331 332 vector<program_line>::iterator ip; 333 334 cout << "Handling subroutine: WAXPY" <<endl; 335 336 for (ip=pline.begin(); ip != pline.end(); ip++) { 337 338 if(ip->get_token(0) == "REAL") { 339 ip->substitute("N",":,:"); 340 ip->substitute("N",":,:"); 341 ip->substitute("Alpha","Alpha(:)"); 342 } else { 343 ip->change_variable_to_vector ("Y"); 344 ip->change_variable_to_vector ("X"); 345 if(ip->get_token(0) != "SUBROUTINE") { 346 if(ip->get_token(0) == "IF") { 347 ip->substitute("Alpha","SUM(alpha(1:VL))"); 348 } else { 349 ip->substitute("Alpha","alpha(1:VL)"); 350 } 351 } 352 } 353 354 355 } 356 357 return; 358 } 359 360 void fortran_file::edit_FunTemplate () { 361 362 vector<program_line>::iterator ip; 363 364 cout << "Handling subroutine: FunTemplate" <<endl; 365 366 for (ip=pline.begin(); ip != pline.end(); ip++) { 367 368 if(ip->get_token(0) == "REAL") { 369 ip->substitute("NVAR",":,:"); 370 ip->substitute("T,","T(:),"); 371 ip->substitute("Told","Told(size(T)),Time(size(T))"); 372 } 373 374 375 } 376 377 return; 378 } 379 380 void fortran_file::edit_JacTemplate () { 381 382 vector<program_line>::iterator ip; 383 384 cout << "Handling subroutine: JacTemplate" <<endl; 385 386 for (ip=pline.begin(); ip != pline.end(); ip++) { 387 388 if(ip->get_token(0) == "REAL") { 389 ip->substitute("NVAR",":,:"); 390 ip->substitute("T,","T(:),"); 391 ip->substitute("Told","Told(size(T)),Time(size(T))"); 392 ip->substitute("LU_NONZERO",":,:"); 393 } 394 395 396 } 397 398 return; 399 } 400
Note: See TracChangeset
for help on using the changeset viewer.