| 1 | /********************************************************************** |
| 2 | |
| 3 | FILENAME: uiuc_menu_CD.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_CD.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_CD( 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 CXfabetaf_first = true; |
| 115 | static bool CXfadef_first = true; |
| 116 | static bool CXfaqf_first = true; |
| 117 | |
| 118 | switch(CD_map[linetoken2]) |
| 119 | { |
| 120 | case CDo_flag: |
| 121 | { |
| 122 | if (check_float(linetoken3)) |
| 123 | token3 >> token_value; |
| 124 | else |
| 125 | uiuc_warnings_errors(1, *command_line); |
| 126 | |
| 127 | CDo = token_value; |
| 128 | CDo_clean = CDo; |
| 129 | aeroDragParts -> storeCommands (*command_line); |
| 130 | break; |
| 131 | } |
| 132 | case CDK_flag: |
| 133 | { |
| 134 | if (check_float(linetoken3)) |
| 135 | token3 >> token_value; |
| 136 | else |
| 137 | uiuc_warnings_errors(1, *command_line); |
| 138 | |
| 139 | CDK = token_value; |
| 140 | CDK_clean = CDK; |
| 141 | aeroDragParts -> storeCommands (*command_line); |
| 142 | break; |
| 143 | } |
| 144 | case CLK_flag: |
| 145 | { |
| 146 | b_CLK = true; |
| 147 | if (check_float(linetoken3)) |
| 148 | token3 >> token_value; |
| 149 | else |
| 150 | uiuc_warnings_errors(1, *command_line); |
| 151 | CLK = token_value; |
| 152 | break; |
| 153 | } |
| 154 | case CD_a_flag: |
| 155 | { |
| 156 | if (check_float(linetoken3)) |
| 157 | token3 >> token_value; |
| 158 | else |
| 159 | uiuc_warnings_errors(1, *command_line); |
| 160 | |
| 161 | CD_a = token_value; |
| 162 | CD_a_clean = CD_a; |
| 163 | aeroDragParts -> storeCommands (*command_line); |
| 164 | break; |
| 165 | } |
| 166 | case CD_adot_flag: |
| 167 | { |
| 168 | if (check_float(linetoken3)) |
| 169 | token3 >> token_value; |
| 170 | else |
| 171 | uiuc_warnings_errors(1, *command_line); |
| 172 | |
| 173 | CD_adot = token_value; |
| 174 | CD_adot_clean = CD_adot; |
| 175 | aeroDragParts -> storeCommands (*command_line); |
| 176 | break; |
| 177 | } |
| 178 | case CD_q_flag: |
| 179 | { |
| 180 | if (check_float(linetoken3)) |
| 181 | token3 >> token_value; |
| 182 | else |
| 183 | uiuc_warnings_errors(1, *command_line); |
| 184 | |
| 185 | CD_q = token_value; |
| 186 | CD_q_clean = CD_q; |
| 187 | aeroDragParts -> storeCommands (*command_line); |
| 188 | break; |
| 189 | } |
| 190 | case CD_ih_flag: |
| 191 | { |
| 192 | if (check_float(linetoken3)) |
| 193 | token3 >> token_value; |
| 194 | else |
| 195 | uiuc_warnings_errors(1, *command_line); |
| 196 | |
| 197 | CD_ih = token_value; |
| 198 | aeroDragParts -> storeCommands (*command_line); |
| 199 | break; |
| 200 | } |
| 201 | case CD_de_flag: |
| 202 | { |
| 203 | if (check_float(linetoken3)) |
| 204 | token3 >> token_value; |
| 205 | else |
| 206 | uiuc_warnings_errors(1, *command_line); |
| 207 | |
| 208 | CD_de = token_value; |
| 209 | CD_de_clean = CD_de; |
| 210 | aeroDragParts -> storeCommands (*command_line); |
| 211 | break; |
| 212 | } |
| 213 | case CD_dr_flag: |
| 214 | { |
| 215 | if (check_float(linetoken3)) |
| 216 | token3 >> token_value; |
| 217 | else |
| 218 | uiuc_warnings_errors(1, *command_line); |
| 219 | |
| 220 | CD_dr = token_value; |
| 221 | aeroDragParts -> storeCommands (*command_line); |
| 222 | break; |
| 223 | } |
| 224 | case CD_da_flag: |
| 225 | { |
| 226 | if (check_float(linetoken3)) |
| 227 | token3 >> token_value; |
| 228 | else |
| 229 | uiuc_warnings_errors(1, *command_line); |
| 230 | |
| 231 | CD_da = token_value; |
| 232 | aeroDragParts -> storeCommands (*command_line); |
| 233 | break; |
| 234 | } |
| 235 | case CD_beta_flag: |
| 236 | { |
| 237 | if (check_float(linetoken3)) |
| 238 | token3 >> token_value; |
| 239 | else |
| 240 | uiuc_warnings_errors(1, *command_line); |
| 241 | |
| 242 | CD_beta = token_value; |
| 243 | aeroDragParts -> storeCommands (*command_line); |
| 244 | break; |
| 245 | } |
| 246 | case CD_df_flag: |
| 247 | { |
| 248 | if (check_float(linetoken3)) |
| 249 | token3 >> token_value; |
| 250 | else |
| 251 | uiuc_warnings_errors(1, *command_line); |
| 252 | |
| 253 | CD_df = token_value; |
| 254 | aeroDragParts -> storeCommands (*command_line); |
| 255 | break; |
| 256 | } |
| 257 | case CD_ds_flag: |
| 258 | { |
| 259 | if (check_float(linetoken3)) |
| 260 | token3 >> token_value; |
| 261 | else |
| 262 | uiuc_warnings_errors(1, *command_line); |
| 263 | |
| 264 | CD_ds = token_value; |
| 265 | aeroDragParts -> storeCommands (*command_line); |
| 266 | break; |
| 267 | } |
| 268 | case CD_dg_flag: |
| 269 | { |
| 270 | if (check_float(linetoken3)) |
| 271 | token3 >> token_value; |
| 272 | else |
| 273 | uiuc_warnings_errors(1, *command_line); |
| 274 | |
| 275 | CD_dg = token_value; |
| 276 | aeroDragParts -> storeCommands (*command_line); |
| 277 | break; |
| 278 | } |
| 279 | case CDfa_flag: |
| 280 | { |
| 281 | CDfa = aircraft_directory + linetoken3; |
| 282 | token4 >> token_value_convert1; |
| 283 | token5 >> token_value_convert2; |
| 284 | convert_y = uiuc_convert(token_value_convert1); |
| 285 | convert_x = uiuc_convert(token_value_convert2); |
| 286 | /* call 1D File Reader with file name (CDfa) and conversion |
| 287 | factors; function returns array of alphas (aArray) and |
| 288 | corresponding CD values (CDArray) and max number of |
| 289 | terms in arrays (nAlpha) */ |
| 290 | uiuc_1DdataFileReader(CDfa, |
| 291 | CDfa_aArray, |
| 292 | CDfa_CDArray, |
| 293 | CDfa_nAlpha); |
| 294 | aeroDragParts -> storeCommands (*command_line); |
| 295 | break; |
| 296 | } |
| 297 | case CDfCL_flag: |
| 298 | { |
| 299 | CDfCL = aircraft_directory + linetoken3; |
| 300 | token4 >> token_value_convert1; |
| 301 | token5 >> token_value_convert2; |
| 302 | convert_y = uiuc_convert(token_value_convert1); |
| 303 | convert_x = uiuc_convert(token_value_convert2); |
| 304 | /* call 1D File Reader with file name (CDfCL) and conversion |
| 305 | factors; function returns array of CLs (CLArray) and |
| 306 | corresponding CD values (CDArray) and max number of |
| 307 | terms in arrays (nCL) */ |
| 308 | uiuc_1DdataFileReader(CDfCL, |
| 309 | CDfCL_CLArray, |
| 310 | CDfCL_CDArray, |
| 311 | CDfCL_nCL); |
| 312 | aeroDragParts -> storeCommands (*command_line); |
| 313 | break; |
| 314 | } |
| 315 | case CDfade_flag: |
| 316 | { |
| 317 | CDfade = aircraft_directory + linetoken3; |
| 318 | token4 >> token_value_convert1; |
| 319 | token5 >> token_value_convert2; |
| 320 | token6 >> token_value_convert3; |
| 321 | convert_z = uiuc_convert(token_value_convert1); |
| 322 | convert_x = uiuc_convert(token_value_convert2); |
| 323 | convert_y = uiuc_convert(token_value_convert3); |
| 324 | /* call 2D File Reader with file name (CDfade) and |
| 325 | conversion factors; function returns array of |
| 326 | elevator deflections (deArray) and corresponding |
| 327 | alpha (aArray) and delta CD (CDArray) values and |
| 328 | max number of terms in alpha arrays (nAlphaArray) |
| 329 | and deflection array (nde) */ |
| 330 | uiuc_2DdataFileReader(CDfade, |
| 331 | CDfade_aArray, |
| 332 | CDfade_deArray, |
| 333 | CDfade_CDArray, |
| 334 | CDfade_nAlphaArray, |
| 335 | CDfade_nde); |
| 336 | aeroDragParts -> storeCommands (*command_line); |
| 337 | break; |
| 338 | } |
| 339 | case CDfdf_flag: |
| 340 | { |
| 341 | CDfdf = aircraft_directory + linetoken3; |
| 342 | token4 >> token_value_convert1; |
| 343 | token5 >> token_value_convert2; |
| 344 | convert_y = uiuc_convert(token_value_convert1); |
| 345 | convert_x = uiuc_convert(token_value_convert2); |
| 346 | /* call 1D File Reader with file name (CDfdf) and conversion |
| 347 | factors; function returns array of dfs (dfArray) and |
| 348 | corresponding CD values (CDArray) and max number of |
| 349 | terms in arrays (ndf) */ |
| 350 | uiuc_1DdataFileReader(CDfdf, |
| 351 | CDfdf_dfArray, |
| 352 | CDfdf_CDArray, |
| 353 | CDfdf_ndf); |
| 354 | aeroDragParts -> storeCommands (*command_line); |
| 355 | break; |
| 356 | } |
| 357 | case CDfadf_flag: |
| 358 | { |
| 359 | CDfadf = aircraft_directory + linetoken3; |
| 360 | token4 >> token_value_convert1; |
| 361 | token5 >> token_value_convert2; |
| 362 | token6 >> token_value_convert3; |
| 363 | convert_z = uiuc_convert(token_value_convert1); |
| 364 | convert_x = uiuc_convert(token_value_convert2); |
| 365 | convert_y = uiuc_convert(token_value_convert3); |
| 366 | /* call 2D File Reader with file name (CDfadf) and |
| 367 | conversion factors; function returns array of |
| 368 | flap deflections (dfArray) and corresponding |
| 369 | alpha (aArray) and delta CD (CDArray) values and |
| 370 | max number of terms in alpha arrays (nAlphaArray) |
| 371 | and deflection array (ndf) */ |
| 372 | uiuc_2DdataFileReader(CDfadf, |
| 373 | CDfadf_aArray, |
| 374 | CDfadf_dfArray, |
| 375 | CDfadf_CDArray, |
| 376 | CDfadf_nAlphaArray, |
| 377 | CDfadf_ndf); |
| 378 | aeroDragParts -> storeCommands (*command_line); |
| 379 | break; |
| 380 | } |
| 381 | case CXo_flag: |
| 382 | { |
| 383 | if (check_float(linetoken3)) |
| 384 | token3 >> token_value; |
| 385 | else |
| 386 | uiuc_warnings_errors(1, *command_line); |
| 387 | |
| 388 | CXo = token_value; |
| 389 | CXo_clean = CXo; |
| 390 | aeroDragParts -> storeCommands (*command_line); |
| 391 | break; |
| 392 | } |
| 393 | case CXK_flag: |
| 394 | { |
| 395 | if (check_float(linetoken3)) |
| 396 | token3 >> token_value; |
| 397 | else |
| 398 | uiuc_warnings_errors(1, *command_line); |
| 399 | |
| 400 | CXK = token_value; |
| 401 | CXK_clean = CXK; |
| 402 | aeroDragParts -> storeCommands (*command_line); |
| 403 | break; |
| 404 | } |
| 405 | case CX_a_flag: |
| 406 | { |
| 407 | if (check_float(linetoken3)) |
| 408 | token3 >> token_value; |
| 409 | else |
| 410 | uiuc_warnings_errors(1, *command_line); |
| 411 | |
| 412 | CX_a = token_value; |
| 413 | CX_a_clean = CX_a; |
| 414 | aeroDragParts -> storeCommands (*command_line); |
| 415 | break; |
| 416 | } |
| 417 | case CX_a2_flag: |
| 418 | { |
| 419 | if (check_float(linetoken3)) |
| 420 | token3 >> token_value; |
| 421 | else |
| 422 | uiuc_warnings_errors(1, *command_line); |
| 423 | |
| 424 | CX_a2 = token_value; |
| 425 | CX_a2_clean = CX_a2; |
| 426 | aeroDragParts -> storeCommands (*command_line); |
| 427 | break; |
| 428 | } |
| 429 | case CX_a3_flag: |
| 430 | { |
| 431 | if (check_float(linetoken3)) |
| 432 | token3 >> token_value; |
| 433 | else |
| 434 | uiuc_warnings_errors(1, *command_line); |
| 435 | |
| 436 | CX_a3 = token_value; |
| 437 | CX_a3_clean = CX_a3; |
| 438 | aeroDragParts -> storeCommands (*command_line); |
| 439 | break; |
| 440 | } |
| 441 | case CX_adot_flag: |
| 442 | { |
| 443 | if (check_float(linetoken3)) |
| 444 | token3 >> token_value; |
| 445 | else |
| 446 | uiuc_warnings_errors(1, *command_line); |
| 447 | |
| 448 | CX_adot = token_value; |
| 449 | CX_adot_clean = CX_adot; |
| 450 | aeroDragParts -> storeCommands (*command_line); |
| 451 | break; |
| 452 | } |
| 453 | case CX_q_flag: |
| 454 | { |
| 455 | if (check_float(linetoken3)) |
| 456 | token3 >> token_value; |
| 457 | else |
| 458 | uiuc_warnings_errors(1, *command_line); |
| 459 | |
| 460 | CX_q = token_value; |
| 461 | CX_q_clean = CX_q; |
| 462 | aeroDragParts -> storeCommands (*command_line); |
| 463 | break; |
| 464 | } |
| 465 | case CX_de_flag: |
| 466 | { |
| 467 | if (check_float(linetoken3)) |
| 468 | token3 >> token_value; |
| 469 | else |
| 470 | uiuc_warnings_errors(1, *command_line); |
| 471 | |
| 472 | CX_de = token_value; |
| 473 | CX_de_clean = CX_de; |
| 474 | aeroDragParts -> storeCommands (*command_line); |
| 475 | break; |
| 476 | } |
| 477 | case CX_dr_flag: |
| 478 | { |
| 479 | if (check_float(linetoken3)) |
| 480 | token3 >> token_value; |
| 481 | else |
| 482 | uiuc_warnings_errors(1, *command_line); |
| 483 | |
| 484 | CX_dr = token_value; |
| 485 | CX_dr_clean = CX_dr; |
| 486 | aeroDragParts -> storeCommands (*command_line); |
| 487 | break; |
| 488 | } |
| 489 | case CX_df_flag: |
| 490 | { |
| 491 | if (check_float(linetoken3)) |
| 492 | token3 >> token_value; |
| 493 | else |
| 494 | uiuc_warnings_errors(1, *command_line); |
| 495 | |
| 496 | CX_df = token_value; |
| 497 | CX_df_clean = CX_df; |
| 498 | aeroDragParts -> storeCommands (*command_line); |
| 499 | break; |
| 500 | } |
| 501 | case CX_adf_flag: |
| 502 | { |
| 503 | if (check_float(linetoken3)) |
| 504 | token3 >> token_value; |
| 505 | else |
| 506 | uiuc_warnings_errors(1, *command_line); |
| 507 | |
| 508 | CX_adf = token_value; |
| 509 | CX_adf_clean = CX_adf; |
| 510 | aeroDragParts -> storeCommands (*command_line); |
| 511 | break; |
| 512 | } |
| 513 | case CXfabetaf_flag: |
| 514 | { |
| 515 | int CXfabetaf_index, i; |
| 516 | string CXfabetaf_file; |
| 517 | double flap_value; |
| 518 | CXfabetaf_file = aircraft_directory + linetoken3; |
| 519 | token4 >> CXfabetaf_index; |
| 520 | if (CXfabetaf_index < 1 || CXfabetaf_index >= 30) |
| 521 | uiuc_warnings_errors(1, *command_line); |
| 522 | if (CXfabetaf_index > CXfabetaf_nf) |
| 523 | CXfabetaf_nf = CXfabetaf_index; |
| 524 | token5 >> flap_value; |
| 525 | token6 >> token_value_convert1; |
| 526 | token7 >> token_value_convert2; |
| 527 | token8 >> token_value_convert3; |
| 528 | token9 >> token_value_convert4; |
| 529 | token10 >> CXfabetaf_nice; |
| 530 | convert_z = uiuc_convert(token_value_convert1); |
| 531 | convert_x = uiuc_convert(token_value_convert2); |
| 532 | convert_y = uiuc_convert(token_value_convert3); |
| 533 | convert_f = uiuc_convert(token_value_convert4); |
| 534 | CXfabetaf_fArray[CXfabetaf_index] = flap_value * convert_f; |
| 535 | /* call 2D File Reader with file name (CXfabetaf_file) and |
| 536 | conversion factors; function returns array of |
| 537 | elevator deflections (deArray) and corresponding |
| 538 | alpha (aArray) and delta CZ (CZArray) values and |
| 539 | max number of terms in alpha arrays (nAlphaArray) |
| 540 | and delfection array (nde) */ |
| 541 | uiuc_2DdataFileReader(CXfabetaf_file, |
| 542 | datafile_xArray, |
| 543 | datafile_yArray, |
| 544 | datafile_zArray, |
| 545 | datafile_nxArray, |
| 546 | datafile_ny); |
| 547 | d_2_to_3(datafile_xArray, CXfabetaf_aArray, CXfabetaf_index); |
| 548 | d_1_to_2(datafile_yArray, CXfabetaf_betaArray, CXfabetaf_index); |
| 549 | d_2_to_3(datafile_zArray, CXfabetaf_CXArray, CXfabetaf_index); |
| 550 | i_1_to_2(datafile_nxArray, CXfabetaf_nAlphaArray, CXfabetaf_index); |
| 551 | CXfabetaf_nbeta[CXfabetaf_index] = datafile_ny; |
| 552 | if (CXfabetaf_first==true) |
| 553 | { |
| 554 | if (CXfabetaf_nice == 1) |
| 555 | { |
| 556 | CXfabetaf_na_nice = datafile_nxArray[1]; |
| 557 | CXfabetaf_nb_nice = datafile_ny; |
| 558 | d_1_to_1(datafile_yArray, CXfabetaf_bArray_nice); |
| 559 | for (i=1; i<=CXfabetaf_na_nice; i++) |
| 560 | CXfabetaf_aArray_nice[i] = datafile_xArray[1][i]; |
| 561 | } |
| 562 | aeroDragParts -> storeCommands (*command_line); |
| 563 | CXfabetaf_first=false; |
| 564 | } |
| 565 | break; |
| 566 | } |
| 567 | case CXfadef_flag: |
| 568 | { |
| 569 | int CXfadef_index, i; |
| 570 | string CXfadef_file; |
| 571 | double flap_value; |
| 572 | CXfadef_file = aircraft_directory + linetoken3; |
| 573 | token4 >> CXfadef_index; |
| 574 | if (CXfadef_index < 0 || CXfadef_index >= 30) |
| 575 | uiuc_warnings_errors(1, *command_line); |
| 576 | if (CXfadef_index > CXfadef_nf) |
| 577 | CXfadef_nf = CXfadef_index; |
| 578 | token5 >> flap_value; |
| 579 | token6 >> token_value_convert1; |
| 580 | token7 >> token_value_convert2; |
| 581 | token8 >> token_value_convert3; |
| 582 | token9 >> token_value_convert4; |
| 583 | token10 >> CXfadef_nice; |
| 584 | convert_z = uiuc_convert(token_value_convert1); |
| 585 | convert_x = uiuc_convert(token_value_convert2); |
| 586 | convert_y = uiuc_convert(token_value_convert3); |
| 587 | convert_f = uiuc_convert(token_value_convert4); |
| 588 | CXfadef_fArray[CXfadef_index] = flap_value * convert_f; |
| 589 | /* call 2D File Reader with file name (CXfadef_file) and |
| 590 | conversion factors; function returns array of |
| 591 | elevator deflections (deArray) and corresponding |
| 592 | alpha (aArray) and delta CZ (CZArray) values and |
| 593 | max number of terms in alpha arrays (nAlphaArray) |
| 594 | and delfection array (nde) */ |
| 595 | uiuc_2DdataFileReader(CXfadef_file, |
| 596 | datafile_xArray, |
| 597 | datafile_yArray, |
| 598 | datafile_zArray, |
| 599 | datafile_nxArray, |
| 600 | datafile_ny); |
| 601 | d_2_to_3(datafile_xArray, CXfadef_aArray, CXfadef_index); |
| 602 | d_1_to_2(datafile_yArray, CXfadef_deArray, CXfadef_index); |
| 603 | d_2_to_3(datafile_zArray, CXfadef_CXArray, CXfadef_index); |
| 604 | i_1_to_2(datafile_nxArray, CXfadef_nAlphaArray, CXfadef_index); |
| 605 | CXfadef_nde[CXfadef_index] = datafile_ny; |
| 606 | if (CXfadef_first==true) |
| 607 | { |
| 608 | if (CXfadef_nice == 1) |
| 609 | { |
| 610 | CXfadef_na_nice = datafile_nxArray[1]; |
| 611 | CXfadef_nde_nice = datafile_ny; |
| 612 | d_1_to_1(datafile_yArray, CXfadef_deArray_nice); |
| 613 | for (i=1; i<=CXfadef_na_nice; i++) |
| 614 | CXfadef_aArray_nice[i] = datafile_xArray[1][i]; |
| 615 | } |
| 616 | aeroDragParts -> storeCommands (*command_line); |
| 617 | CXfadef_first=false; |
| 618 | } |
| 619 | break; |
| 620 | } |
| 621 | case CXfaqf_flag: |
| 622 | { |
| 623 | int CXfaqf_index, i; |
| 624 | string CXfaqf_file; |
| 625 | double flap_value; |
| 626 | CXfaqf_file = aircraft_directory + linetoken3; |
| 627 | token4 >> CXfaqf_index; |
| 628 | if (CXfaqf_index < 0 || CXfaqf_index >= 30) |
| 629 | uiuc_warnings_errors(1, *command_line); |
| 630 | if (CXfaqf_index > CXfaqf_nf) |
| 631 | CXfaqf_nf = CXfaqf_index; |
| 632 | token5 >> flap_value; |
| 633 | token6 >> token_value_convert1; |
| 634 | token7 >> token_value_convert2; |
| 635 | token8 >> token_value_convert3; |
| 636 | token9 >> token_value_convert4; |
| 637 | token10 >> CXfaqf_nice; |
| 638 | convert_z = uiuc_convert(token_value_convert1); |
| 639 | convert_x = uiuc_convert(token_value_convert2); |
| 640 | convert_y = uiuc_convert(token_value_convert3); |
| 641 | convert_f = uiuc_convert(token_value_convert4); |
| 642 | CXfaqf_fArray[CXfaqf_index] = flap_value * convert_f; |
| 643 | /* call 2D File Reader with file name (CXfaqf_file) and |
| 644 | conversion factors; function returns array of |
| 645 | elevator deflections (deArray) and corresponding |
| 646 | alpha (aArray) and delta CZ (CZArray) values and |
| 647 | max number of terms in alpha arrays (nAlphaArray) |
| 648 | and delfection array (nde) */ |
| 649 | uiuc_2DdataFileReader(CXfaqf_file, |
| 650 | datafile_xArray, |
| 651 | datafile_yArray, |
| 652 | datafile_zArray, |
| 653 | datafile_nxArray, |
| 654 | datafile_ny); |
| 655 | d_2_to_3(datafile_xArray, CXfaqf_aArray, CXfaqf_index); |
| 656 | d_1_to_2(datafile_yArray, CXfaqf_qArray, CXfaqf_index); |
| 657 | d_2_to_3(datafile_zArray, CXfaqf_CXArray, CXfaqf_index); |
| 658 | i_1_to_2(datafile_nxArray, CXfaqf_nAlphaArray, CXfaqf_index); |
| 659 | CXfaqf_nq[CXfaqf_index] = datafile_ny; |
| 660 | if (CXfaqf_first==true) |
| 661 | { |
| 662 | if (CXfaqf_nice == 1) |
| 663 | { |
| 664 | CXfaqf_na_nice = datafile_nxArray[1]; |
| 665 | CXfaqf_nq_nice = datafile_ny; |
| 666 | d_1_to_1(datafile_yArray, CXfaqf_qArray_nice); |
| 667 | for (i=1; i<=CXfaqf_na_nice; i++) |
| 668 | CXfaqf_aArray_nice[i] = datafile_xArray[1][i]; |
| 669 | } |
| 670 | aeroDragParts -> storeCommands (*command_line); |
| 671 | CXfaqf_first=false; |
| 672 | } |
| 673 | break; |
| 674 | } |
| 675 | default: |
| 676 | { |
| 677 | if (ignore_unknown_keywords) { |
| 678 | // do nothing |
| 679 | } else { |
| 680 | // print error message |
| 681 | uiuc_warnings_errors(2, *command_line); |
| 682 | } |
| 683 | break; |
| 684 | } |
| 685 | }; |
| 686 | } |