| 1 | /********************************************************************** |
| 2 | |
| 3 | FILENAME: uiuc_menu_CL.cpp |
| 4 | |
| 5 | ---------------------------------------------------------------------- |
| 6 | |
| 7 | DESCRIPTION: reads input data for specified aircraft and creates |
| 8 | approporiate data storage space |
| 9 | |
| 10 | ---------------------------------------------------------------------- |
| 11 | |
| 12 | STATUS: alpha version |
| 13 | |
| 14 | ---------------------------------------------------------------------- |
| 15 | |
| 16 | REFERENCES: based on "menu reader" format of Michael Selig |
| 17 | |
| 18 | ---------------------------------------------------------------------- |
| 19 | |
| 20 | HISTORY: 04/04/2003 initial release |
| 21 | 06/30/2003 (RD) replaced istrstream with istringstream |
| 22 | to get rid of the annoying warning about |
| 23 | using the strstream header |
| 24 | |
| 25 | ---------------------------------------------------------------------- |
| 26 | |
| 27 | AUTHOR(S): Robert Deters <[email protected]> |
| 28 | Michael Selig <[email protected]> |
| 29 | |
| 30 | ---------------------------------------------------------------------- |
| 31 | |
| 32 | VARIABLES: |
| 33 | |
| 34 | ---------------------------------------------------------------------- |
| 35 | |
| 36 | INPUTS: n/a |
| 37 | |
| 38 | ---------------------------------------------------------------------- |
| 39 | |
| 40 | OUTPUTS: n/a |
| 41 | |
| 42 | ---------------------------------------------------------------------- |
| 43 | |
| 44 | CALLED BY: uiuc_menu() |
| 45 | |
| 46 | ---------------------------------------------------------------------- |
| 47 | |
| 48 | CALLS TO: check_float() if needed |
| 49 | d_2_to_3() if needed |
| 50 | d_1_to_2() if needed |
| 51 | i_1_to_2() if needed |
| 52 | d_1_to_1() if needed |
| 53 | |
| 54 | ---------------------------------------------------------------------- |
| 55 | |
| 56 | COPYRIGHT: (C) 2003 by Michael Selig |
| 57 | |
| 58 | This program is free software; you can redistribute it and/or |
| 59 | modify it under the terms of the GNU General Public License |
| 60 | as published by the Free Software Foundation. |
| 61 | |
| 62 | This program is distributed in the hope that it will be useful, |
| 63 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 64 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 65 | GNU General Public License for more details. |
| 66 | |
| 67 | You should have received a copy of the GNU General Public License |
| 68 | along with this program; if not, write to the Free Software |
| 69 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 70 | |
| 71 | **********************************************************************/ |
| 72 | |
| 73 | #include <simgear/compiler.h> |
| 74 | |
| 75 | |
| 76 | #include <cstdlib> |
| 77 | #include <string> |
| 78 | #include <iostream> |
| 79 | |
| 80 | #include "uiuc_menu_CL.h" |
| 81 | |
| 82 | using std::string; |
| 83 | using std::istringstream; |
| 84 | using std::cerr; |
| 85 | using std::cout; |
| 86 | using std::endl; |
| 87 | |
| 88 | #ifndef _MSC_VER |
| 89 | using std::exit; |
| 90 | #endif |
| 91 | |
| 92 | void parse_CL( const string& linetoken2, const string& linetoken3, |
| 93 | const string& linetoken4, const string& linetoken5, |
| 94 | const string& linetoken6, const string& linetoken7, |
| 95 | const string& linetoken8, const string& linetoken9, |
| 96 | const string& linetoken10, const string& aircraft_directory, |
| 97 | LIST command_line ) { |
| 98 | double token_value; |
| 99 | int token_value_convert1, token_value_convert2, token_value_convert3; |
| 100 | int token_value_convert4; |
| 101 | double datafile_xArray[100][100], datafile_yArray[100]; |
| 102 | double datafile_zArray[100][100]; |
| 103 | double convert_f; |
| 104 | int datafile_nxArray[100], datafile_ny; |
| 105 | istringstream token3(linetoken3.c_str()); |
| 106 | istringstream token4(linetoken4.c_str()); |
| 107 | istringstream token5(linetoken5.c_str()); |
| 108 | istringstream token6(linetoken6.c_str()); |
| 109 | istringstream token7(linetoken7.c_str()); |
| 110 | istringstream token8(linetoken8.c_str()); |
| 111 | istringstream token9(linetoken9.c_str()); |
| 112 | istringstream token10(linetoken10.c_str()); |
| 113 | |
| 114 | static bool CZfabetaf_first = true; |
| 115 | static bool CZfadef_first = true; |
| 116 | static bool CZfaqf_first = true; |
| 117 | |
| 118 | switch(CL_map[linetoken2]) |
| 119 | { |
| 120 | case CLo_flag: |
| 121 | { |
| 122 | if (check_float(linetoken3)) |
| 123 | token3 >> token_value; |
| 124 | else |
| 125 | uiuc_warnings_errors(1, *command_line); |
| 126 | |
| 127 | CLo = token_value; |
| 128 | CLo_clean = CLo; |
| 129 | aeroLiftParts -> storeCommands (*command_line); |
| 130 | break; |
| 131 | } |
| 132 | case CL_a_flag: |
| 133 | { |
| 134 | if (check_float(linetoken3)) |
| 135 | token3 >> token_value; |
| 136 | else |
| 137 | uiuc_warnings_errors(1, *command_line); |
| 138 | |
| 139 | CL_a = token_value; |
| 140 | CL_a_clean = CL_a; |
| 141 | aeroLiftParts -> storeCommands (*command_line); |
| 142 | break; |
| 143 | } |
| 144 | case CL_adot_flag: |
| 145 | { |
| 146 | if (check_float(linetoken3)) |
| 147 | token3 >> token_value; |
| 148 | else |
| 149 | uiuc_warnings_errors(1, *command_line); |
| 150 | |
| 151 | CL_adot = token_value; |
| 152 | CL_adot_clean = CL_adot; |
| 153 | aeroLiftParts -> storeCommands (*command_line); |
| 154 | break; |
| 155 | } |
| 156 | case CL_q_flag: |
| 157 | { |
| 158 | if (check_float(linetoken3)) |
| 159 | token3 >> token_value; |
| 160 | else |
| 161 | uiuc_warnings_errors(1, *command_line); |
| 162 | |
| 163 | CL_q = token_value; |
| 164 | CL_q_clean = CL_q; |
| 165 | aeroLiftParts -> storeCommands (*command_line); |
| 166 | break; |
| 167 | } |
| 168 | case CL_ih_flag: |
| 169 | { |
| 170 | if (check_float(linetoken3)) |
| 171 | token3 >> token_value; |
| 172 | else |
| 173 | uiuc_warnings_errors(1, *command_line); |
| 174 | |
| 175 | CL_ih = token_value; |
| 176 | aeroLiftParts -> storeCommands (*command_line); |
| 177 | break; |
| 178 | } |
| 179 | case CL_de_flag: |
| 180 | { |
| 181 | if (check_float(linetoken3)) |
| 182 | token3 >> token_value; |
| 183 | else |
| 184 | uiuc_warnings_errors(1, *command_line); |
| 185 | |
| 186 | CL_de = token_value; |
| 187 | CL_de_clean = CL_de; |
| 188 | aeroLiftParts -> storeCommands (*command_line); |
| 189 | break; |
| 190 | } |
| 191 | case CL_df_flag: |
| 192 | { |
| 193 | if (check_float(linetoken3)) |
| 194 | token3 >> token_value; |
| 195 | else |
| 196 | uiuc_warnings_errors(1, *command_line); |
| 197 | |
| 198 | CL_df = token_value; |
| 199 | aeroLiftParts -> storeCommands (*command_line); |
| 200 | break; |
| 201 | } |
| 202 | case CL_ds_flag: |
| 203 | { |
| 204 | if (check_float(linetoken3)) |
| 205 | token3 >> token_value; |
| 206 | else |
| 207 | uiuc_warnings_errors(1, *command_line); |
| 208 | |
| 209 | CL_ds = token_value; |
| 210 | aeroLiftParts -> storeCommands (*command_line); |
| 211 | break; |
| 212 | } |
| 213 | case CL_dg_flag: |
| 214 | { |
| 215 | if (check_float(linetoken3)) |
| 216 | token3 >> token_value; |
| 217 | else |
| 218 | uiuc_warnings_errors(1, *command_line); |
| 219 | |
| 220 | CL_dg = token_value; |
| 221 | aeroLiftParts -> storeCommands (*command_line); |
| 222 | break; |
| 223 | } |
| 224 | case CLfa_flag: |
| 225 | { |
| 226 | CLfa = aircraft_directory + linetoken3; |
| 227 | token4 >> token_value_convert1; |
| 228 | token5 >> token_value_convert2; |
| 229 | convert_y = uiuc_convert(token_value_convert1); |
| 230 | convert_x = uiuc_convert(token_value_convert2); |
| 231 | /* call 1D File Reader with file name (CLfa) and conversion |
| 232 | factors; function returns array of alphas (aArray) and |
| 233 | corresponding CL values (CLArray) and max number of |
| 234 | terms in arrays (nAlpha) */ |
| 235 | uiuc_1DdataFileReader(CLfa, |
| 236 | CLfa_aArray, |
| 237 | CLfa_CLArray, |
| 238 | CLfa_nAlpha); |
| 239 | aeroLiftParts -> storeCommands (*command_line); |
| 240 | break; |
| 241 | } |
| 242 | case CLfade_flag: |
| 243 | { |
| 244 | CLfade = aircraft_directory + linetoken3; |
| 245 | token4 >> token_value_convert1; |
| 246 | token5 >> token_value_convert2; |
| 247 | token6 >> token_value_convert3; |
| 248 | convert_z = uiuc_convert(token_value_convert1); |
| 249 | convert_x = uiuc_convert(token_value_convert2); |
| 250 | convert_y = uiuc_convert(token_value_convert3); |
| 251 | /* call 2D File Reader with file name (CLfade) and |
| 252 | conversion factors; function returns array of |
| 253 | elevator deflections (deArray) and corresponding |
| 254 | alpha (aArray) and delta CL (CLArray) values and |
| 255 | max number of terms in alpha arrays (nAlphaArray) |
| 256 | and deflection array (nde) */ |
| 257 | uiuc_2DdataFileReader(CLfade, |
| 258 | CLfade_aArray, |
| 259 | CLfade_deArray, |
| 260 | CLfade_CLArray, |
| 261 | CLfade_nAlphaArray, |
| 262 | CLfade_nde); |
| 263 | aeroLiftParts -> storeCommands (*command_line); |
| 264 | break; |
| 265 | } |
| 266 | case CLfdf_flag: |
| 267 | { |
| 268 | CLfdf = aircraft_directory + linetoken3; |
| 269 | token4 >> token_value_convert1; |
| 270 | token5 >> token_value_convert2; |
| 271 | convert_y = uiuc_convert(token_value_convert1); |
| 272 | convert_x = uiuc_convert(token_value_convert2); |
| 273 | /* call 1D File Reader with file name (CLfdf) and conversion |
| 274 | factors; function returns array of dfs (dfArray) and |
| 275 | corresponding CL values (CLArray) and max number of |
| 276 | terms in arrays (ndf) */ |
| 277 | uiuc_1DdataFileReader(CLfdf, |
| 278 | CLfdf_dfArray, |
| 279 | CLfdf_CLArray, |
| 280 | CLfdf_ndf); |
| 281 | aeroLiftParts -> storeCommands (*command_line); |
| 282 | |
| 283 | // additional variables to streamline flap routine in aerodeflections |
| 284 | //ndf = CLfdf_ndf; |
| 285 | //int temp_counter = 1; |
| 286 | //while (temp_counter <= ndf) |
| 287 | // { |
| 288 | // dfArray[temp_counter] = CLfdf_dfArray[temp_counter]; |
| 289 | // TimeArray[temp_counter] = dfTimefdf_TimeArray[temp_counter]; |
| 290 | // temp_counter++; |
| 291 | // } |
| 292 | break; |
| 293 | } |
| 294 | case CLfadf_flag: |
| 295 | { |
| 296 | CLfadf = aircraft_directory + linetoken3; |
| 297 | token4 >> token_value_convert1; |
| 298 | token5 >> token_value_convert2; |
| 299 | token6 >> token_value_convert3; |
| 300 | convert_z = uiuc_convert(token_value_convert1); |
| 301 | convert_x = uiuc_convert(token_value_convert2); |
| 302 | convert_y = uiuc_convert(token_value_convert3); |
| 303 | /* call 2D File Reader with file name (CLfadf) and |
| 304 | conversion factors; function returns array of |
| 305 | flap deflections (dfArray) and corresponding |
| 306 | alpha (aArray) and delta CL (CLArray) values and |
| 307 | max number of terms in alpha arrays (nAlphaArray) |
| 308 | and deflection array (ndf) */ |
| 309 | uiuc_2DdataFileReader(CLfadf, |
| 310 | CLfadf_aArray, |
| 311 | CLfadf_dfArray, |
| 312 | CLfadf_CLArray, |
| 313 | CLfadf_nAlphaArray, |
| 314 | CLfadf_ndf); |
| 315 | aeroLiftParts -> storeCommands (*command_line); |
| 316 | break; |
| 317 | } |
| 318 | case CZo_flag: |
| 319 | { |
| 320 | if (check_float(linetoken3)) |
| 321 | token3 >> token_value; |
| 322 | else |
| 323 | uiuc_warnings_errors(1, *command_line); |
| 324 | |
| 325 | CZo = token_value; |
| 326 | CZo_clean = CZo; |
| 327 | aeroLiftParts -> storeCommands (*command_line); |
| 328 | break; |
| 329 | } |
| 330 | case CZ_a_flag: |
| 331 | { |
| 332 | if (check_float(linetoken3)) |
| 333 | token3 >> token_value; |
| 334 | else |
| 335 | uiuc_warnings_errors(1, *command_line); |
| 336 | |
| 337 | CZ_a = token_value; |
| 338 | CZ_a_clean = CZ_a; |
| 339 | aeroLiftParts -> storeCommands (*command_line); |
| 340 | break; |
| 341 | } |
| 342 | case CZ_a2_flag: |
| 343 | { |
| 344 | if (check_float(linetoken3)) |
| 345 | token3 >> token_value; |
| 346 | else |
| 347 | uiuc_warnings_errors(1, *command_line); |
| 348 | |
| 349 | CZ_a2 = token_value; |
| 350 | CZ_a2_clean = CZ_a2; |
| 351 | aeroLiftParts -> storeCommands (*command_line); |
| 352 | break; |
| 353 | } |
| 354 | case CZ_a3_flag: |
| 355 | { |
| 356 | if (check_float(linetoken3)) |
| 357 | token3 >> token_value; |
| 358 | else |
| 359 | uiuc_warnings_errors(1, *command_line); |
| 360 | |
| 361 | CZ_a3 = token_value; |
| 362 | CZ_a3_clean = CZ_a3; |
| 363 | aeroLiftParts -> storeCommands (*command_line); |
| 364 | break; |
| 365 | } |
| 366 | case CZ_adot_flag: |
| 367 | { |
| 368 | if (check_float(linetoken3)) |
| 369 | token3 >> token_value; |
| 370 | else |
| 371 | uiuc_warnings_errors(1, *command_line); |
| 372 | |
| 373 | CZ_adot = token_value; |
| 374 | CZ_adot_clean = CZ_adot; |
| 375 | aeroLiftParts -> storeCommands (*command_line); |
| 376 | break; |
| 377 | } |
| 378 | case CZ_q_flag: |
| 379 | { |
| 380 | if (check_float(linetoken3)) |
| 381 | token3 >> token_value; |
| 382 | else |
| 383 | uiuc_warnings_errors(1, *command_line); |
| 384 | |
| 385 | CZ_q = token_value; |
| 386 | CZ_q_clean = CZ_q; |
| 387 | aeroLiftParts -> storeCommands (*command_line); |
| 388 | break; |
| 389 | } |
| 390 | case CZ_de_flag: |
| 391 | { |
| 392 | if (check_float(linetoken3)) |
| 393 | token3 >> token_value; |
| 394 | else |
| 395 | uiuc_warnings_errors(1, *command_line); |
| 396 | |
| 397 | CZ_de = token_value; |
| 398 | CZ_de_clean = CZ_de; |
| 399 | aeroLiftParts -> storeCommands (*command_line); |
| 400 | break; |
| 401 | } |
| 402 | case CZ_deb2_flag: |
| 403 | { |
| 404 | if (check_float(linetoken3)) |
| 405 | token3 >> token_value; |
| 406 | else |
| 407 | uiuc_warnings_errors(1, *command_line); |
| 408 | |
| 409 | CZ_deb2 = token_value; |
| 410 | CZ_deb2_clean = CZ_deb2; |
| 411 | aeroLiftParts -> storeCommands (*command_line); |
| 412 | break; |
| 413 | } |
| 414 | case CZ_df_flag: |
| 415 | { |
| 416 | if (check_float(linetoken3)) |
| 417 | token3 >> token_value; |
| 418 | else |
| 419 | uiuc_warnings_errors(1, *command_line); |
| 420 | |
| 421 | CZ_df = token_value; |
| 422 | CZ_df_clean = CZ_df; |
| 423 | aeroLiftParts -> storeCommands (*command_line); |
| 424 | break; |
| 425 | } |
| 426 | case CZ_adf_flag: |
| 427 | { |
| 428 | if (check_float(linetoken3)) |
| 429 | token3 >> token_value; |
| 430 | else |
| 431 | uiuc_warnings_errors(1, *command_line); |
| 432 | |
| 433 | CZ_adf = token_value; |
| 434 | CZ_adf_clean = CZ_adf; |
| 435 | aeroLiftParts -> storeCommands (*command_line); |
| 436 | break; |
| 437 | } |
| 438 | case CZfa_flag: |
| 439 | { |
| 440 | CZfa = aircraft_directory + linetoken3; |
| 441 | token4 >> token_value_convert1; |
| 442 | token5 >> token_value_convert2; |
| 443 | convert_y = uiuc_convert(token_value_convert1); |
| 444 | convert_x = uiuc_convert(token_value_convert2); |
| 445 | /* call 1D File Reader with file name (CZfa) and conversion |
| 446 | factors; function returns array of alphas (aArray) and |
| 447 | corresponding CZ values (CZArray) and max number of |
| 448 | terms in arrays (nAlpha) */ |
| 449 | uiuc_1DdataFileReader(CZfa, |
| 450 | CZfa_aArray, |
| 451 | CZfa_CZArray, |
| 452 | CZfa_nAlpha); |
| 453 | aeroLiftParts -> storeCommands (*command_line); |
| 454 | break; |
| 455 | } |
| 456 | case CZfabetaf_flag: |
| 457 | { |
| 458 | int CZfabetaf_index, i; |
| 459 | string CZfabetaf_file; |
| 460 | double flap_value; |
| 461 | CZfabetaf_file = aircraft_directory + linetoken3; |
| 462 | token4 >> CZfabetaf_index; |
| 463 | if (CZfabetaf_index < 0 || CZfabetaf_index >= 30) |
| 464 | uiuc_warnings_errors(1, *command_line); |
| 465 | if (CZfabetaf_index > CZfabetaf_nf) |
| 466 | CZfabetaf_nf = CZfabetaf_index; |
| 467 | token5 >> flap_value; |
| 468 | token6 >> token_value_convert1; |
| 469 | token7 >> token_value_convert2; |
| 470 | token8 >> token_value_convert3; |
| 471 | token9 >> token_value_convert4; |
| 472 | token10 >> CZfabetaf_nice; |
| 473 | convert_z = uiuc_convert(token_value_convert1); |
| 474 | convert_x = uiuc_convert(token_value_convert2); |
| 475 | convert_y = uiuc_convert(token_value_convert3); |
| 476 | convert_f = uiuc_convert(token_value_convert4); |
| 477 | CZfabetaf_fArray[CZfabetaf_index] = flap_value * convert_f; |
| 478 | /* call 2D File Reader with file name (CZfabetaf_file) and |
| 479 | conversion factors; function returns array of |
| 480 | beta (betaArray) and corresponding |
| 481 | alpha (aArray) and CZ (CZArray) values and |
| 482 | max number of terms in alpha arrays (nAlphaArray) |
| 483 | and beta array (nbeta) */ |
| 484 | uiuc_2DdataFileReader(CZfabetaf_file, |
| 485 | datafile_xArray, |
| 486 | datafile_yArray, |
| 487 | datafile_zArray, |
| 488 | datafile_nxArray, |
| 489 | datafile_ny); |
| 490 | d_2_to_3(datafile_xArray, CZfabetaf_aArray, CZfabetaf_index); |
| 491 | d_1_to_2(datafile_yArray, CZfabetaf_betaArray, CZfabetaf_index); |
| 492 | d_2_to_3(datafile_zArray, CZfabetaf_CZArray, CZfabetaf_index); |
| 493 | i_1_to_2(datafile_nxArray, CZfabetaf_nAlphaArray, CZfabetaf_index); |
| 494 | CZfabetaf_nbeta[CZfabetaf_index] = datafile_ny; |
| 495 | if (CZfabetaf_first==true) |
| 496 | { |
| 497 | if (CZfabetaf_nice == 1) |
| 498 | { |
| 499 | CZfabetaf_na_nice = datafile_nxArray[1]; |
| 500 | CZfabetaf_nb_nice = datafile_ny; |
| 501 | d_1_to_1(datafile_yArray, CZfabetaf_bArray_nice); |
| 502 | for (i=1; i<=CZfabetaf_na_nice; i++) |
| 503 | CZfabetaf_aArray_nice[i] = datafile_xArray[1][i]; |
| 504 | } |
| 505 | aeroLiftParts -> storeCommands (*command_line); |
| 506 | CZfabetaf_first=false; |
| 507 | } |
| 508 | break; |
| 509 | } |
| 510 | case CZfadef_flag: |
| 511 | { |
| 512 | int CZfadef_index, i; |
| 513 | string CZfadef_file; |
| 514 | double flap_value; |
| 515 | CZfadef_file = aircraft_directory + linetoken3; |
| 516 | token4 >> CZfadef_index; |
| 517 | if (CZfadef_index < 0 || CZfadef_index >= 30) |
| 518 | uiuc_warnings_errors(1, *command_line); |
| 519 | if (CZfadef_index > CZfadef_nf) |
| 520 | CZfadef_nf = CZfadef_index; |
| 521 | token5 >> flap_value; |
| 522 | token6 >> token_value_convert1; |
| 523 | token7 >> token_value_convert2; |
| 524 | token8 >> token_value_convert3; |
| 525 | token9 >> token_value_convert4; |
| 526 | token10 >> CZfadef_nice; |
| 527 | convert_z = uiuc_convert(token_value_convert1); |
| 528 | convert_x = uiuc_convert(token_value_convert2); |
| 529 | convert_y = uiuc_convert(token_value_convert3); |
| 530 | convert_f = uiuc_convert(token_value_convert4); |
| 531 | CZfadef_fArray[CZfadef_index] = flap_value * convert_f; |
| 532 | /* call 2D File Reader with file name (CZfadef_file) and |
| 533 | conversion factors; function returns array of |
| 534 | elevator deflections (deArray) and corresponding |
| 535 | alpha (aArray) and delta CZ (CZArray) values and |
| 536 | max number of terms in alpha arrays (nAlphaArray) |
| 537 | and delfection array (nde) */ |
| 538 | uiuc_2DdataFileReader(CZfadef_file, |
| 539 | datafile_xArray, |
| 540 | datafile_yArray, |
| 541 | datafile_zArray, |
| 542 | datafile_nxArray, |
| 543 | datafile_ny); |
| 544 | d_2_to_3(datafile_xArray, CZfadef_aArray, CZfadef_index); |
| 545 | d_1_to_2(datafile_yArray, CZfadef_deArray, CZfadef_index); |
| 546 | d_2_to_3(datafile_zArray, CZfadef_CZArray, CZfadef_index); |
| 547 | i_1_to_2(datafile_nxArray, CZfadef_nAlphaArray, CZfadef_index); |
| 548 | CZfadef_nde[CZfadef_index] = datafile_ny; |
| 549 | if (CZfadef_first==true) |
| 550 | { |
| 551 | if (CZfadef_nice == 1) |
| 552 | { |
| 553 | CZfadef_na_nice = datafile_nxArray[1]; |
| 554 | CZfadef_nde_nice = datafile_ny; |
| 555 | d_1_to_1(datafile_yArray, CZfadef_deArray_nice); |
| 556 | for (i=1; i<=CZfadef_na_nice; i++) |
| 557 | CZfadef_aArray_nice[i] = datafile_xArray[1][i]; |
| 558 | } |
| 559 | aeroLiftParts -> storeCommands (*command_line); |
| 560 | CZfadef_first=false; |
| 561 | } |
| 562 | break; |
| 563 | } |
| 564 | case CZfaqf_flag: |
| 565 | { |
| 566 | int CZfaqf_index, i; |
| 567 | string CZfaqf_file; |
| 568 | double flap_value; |
| 569 | CZfaqf_file = aircraft_directory + linetoken3; |
| 570 | token4 >> CZfaqf_index; |
| 571 | if (CZfaqf_index < 0 || CZfaqf_index >= 30) |
| 572 | uiuc_warnings_errors(1, *command_line); |
| 573 | if (CZfaqf_index > CZfaqf_nf) |
| 574 | CZfaqf_nf = CZfaqf_index; |
| 575 | token5 >> flap_value; |
| 576 | token6 >> token_value_convert1; |
| 577 | token7 >> token_value_convert2; |
| 578 | token8 >> token_value_convert3; |
| 579 | token9 >> token_value_convert4; |
| 580 | token10 >> CZfaqf_nice; |
| 581 | convert_z = uiuc_convert(token_value_convert1); |
| 582 | convert_x = uiuc_convert(token_value_convert2); |
| 583 | convert_y = uiuc_convert(token_value_convert3); |
| 584 | convert_f = uiuc_convert(token_value_convert4); |
| 585 | CZfaqf_fArray[CZfaqf_index] = flap_value * convert_f; |
| 586 | /* call 2D File Reader with file name (CZfaqf_file) and |
| 587 | conversion factors; function returns array of |
| 588 | pitch rate (qArray) and corresponding |
| 589 | alpha (aArray) and delta CZ (CZArray) values and |
| 590 | max number of terms in alpha arrays (nAlphaArray) |
| 591 | and pitch rate array (nq) */ |
| 592 | uiuc_2DdataFileReader(CZfaqf_file, |
| 593 | datafile_xArray, |
| 594 | datafile_yArray, |
| 595 | datafile_zArray, |
| 596 | datafile_nxArray, |
| 597 | datafile_ny); |
| 598 | d_2_to_3(datafile_xArray, CZfaqf_aArray, CZfaqf_index); |
| 599 | d_1_to_2(datafile_yArray, CZfaqf_qArray, CZfaqf_index); |
| 600 | d_2_to_3(datafile_zArray, CZfaqf_CZArray, CZfaqf_index); |
| 601 | i_1_to_2(datafile_nxArray, CZfaqf_nAlphaArray, CZfaqf_index); |
| 602 | CZfaqf_nq[CZfaqf_index] = datafile_ny; |
| 603 | if (CZfaqf_first==true) |
| 604 | { |
| 605 | if (CZfaqf_nice == 1) |
| 606 | { |
| 607 | CZfaqf_na_nice = datafile_nxArray[1]; |
| 608 | CZfaqf_nq_nice = datafile_ny; |
| 609 | d_1_to_1(datafile_yArray, CZfaqf_qArray_nice); |
| 610 | for (i=1; i<=CZfaqf_na_nice; i++) |
| 611 | CZfaqf_aArray_nice[i] = datafile_xArray[1][i]; |
| 612 | } |
| 613 | aeroLiftParts -> storeCommands (*command_line); |
| 614 | CZfaqf_first=false; |
| 615 | } |
| 616 | break; |
| 617 | } |
| 618 | default: |
| 619 | { |
| 620 | if (ignore_unknown_keywords) { |
| 621 | // do nothing |
| 622 | } else { |
| 623 | // print error message |
| 624 | uiuc_warnings_errors(2, *command_line); |
| 625 | } |
| 626 | break; |
| 627 | } |
| 628 | }; |
| 629 | } |