Changeset 39926 for trunk/Ohana/src/dvomerge/src/build_links.c
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to
/branches/czw_branch/20160809 merged eligible
-
Property svn:mergeinfo
set to
-
trunk/Ohana
-
trunk/Ohana/src/dvomerge/src/build_links.c
r39536 r39926 15 15 data: they refer to the sequence number in the data blocks. 16 16 17 next_meas is a list of the equivalent sequence of the measure block as if it were sorted.17 next_measure is a list of the equivalent sequence of the measure block as if it were sorted. 18 18 19 19 to find the sequence of measurements for a given average: 20 20 n_0 = average->measureOffset 21 n_1 = next_meas [n_0]22 n_i = next_meas [n_i-1]21 n_1 = next_measure[n_0] 22 n_i = next_measure[n_i-1] 23 23 24 24 */ … … 31 31 32 32 off_t i, j, N; 33 off_t *next_meas ;33 off_t *next_measure; 34 34 35 35 if (!measure) return NULL; … … 38 38 N = 0; 39 39 40 ALLOCATE (next_meas , off_t, Nmeasure);40 ALLOCATE (next_measure, off_t, Nmeasure); 41 41 for (i = 0; i < Naverage; i++) { 42 42 if (!average[i].Nmeasure) continue; … … 45 45 for (j = 0; j < average[i].Nmeasure - 1; j++, N++) { 46 46 myAssert (measure[m+j+1].averef == i, "not sorted"); 47 next_meas [N] = N + 1;47 next_measure[N] = N + 1; 48 48 if (N >= Nmeasure) { 49 49 fprintf (stderr, "WARNING: N out of bounds (1)\n"); 50 50 } 51 51 } 52 next_meas [N] = -1;52 next_measure[N] = -1; 53 53 if (N >= Nmeasure) { 54 54 fprintf (stderr, "WARNING: N out of bounds (2)\n"); … … 61 61 N++; 62 62 } 63 return (next_meas );63 return (next_measure); 64 64 } 65 65 … … 74 74 75 75 off_t i, m, k, Nm, averef; 76 off_t *next_meas ;77 78 ALLOCATE (next_meas , off_t, Nmeasure);76 off_t *next_measure; 77 78 ALLOCATE (next_measure, off_t, Nmeasure); 79 79 80 80 /* reset the Nm, offset values for average */ … … 87 87 averef = measure[Nm].averef; 88 88 m = average[averef].measureOffset; 89 next_meas [Nm] = -1;89 next_measure[Nm] = -1; 90 90 91 91 if (m == -1) { /* no links yet for source */ … … 95 95 } 96 96 97 for (k = 0; next_meas [m] != -1; k++) {98 m = next_meas [m];97 for (k = 0; next_measure[m] != -1; k++) { 98 m = next_measure[m]; 99 99 if (m >= Nmeasure) { 100 100 fprintf (stderr, "WARNING: m out of bounds (1)\n"); … … 103 103 104 104 average[averef].Nmeasure = k + 2; 105 next_meas [m] = Nm;105 next_measure[m] = Nm; 106 106 if (m >= Nmeasure) { 107 107 fprintf (stderr, "WARNING: m out of bounds (2)\n"); 108 108 } 109 109 } 110 return (next_meas );110 return (next_measure); 111 111 } 112 112 113 113 /* average[].measureOffset, average[].Nmeasure are valid within an addstar run */ 114 int add_meas _link (Average *average, off_t *next_meas, off_t Nmeasure, off_t NMEASURE) {114 int add_measure_link (Average *average, off_t *next_measure, off_t Nmeasure, off_t NMEASURE) { 115 115 116 116 off_t k, m; 117 117 118 /* if we have trouble, check validity of next_meas [m] : m < Nmeasure */118 /* if we have trouble, check validity of next_measure[m] : m < Nmeasure */ 119 119 m = average[0].measureOffset; 120 120 121 121 for (k = 0; k < average[0].Nmeasure - 1; k++) { 122 m = next_meas [m];122 m = next_measure[m]; 123 123 if (m >= NMEASURE) { 124 124 fprintf (stderr, "WARNING: m out of bounds (3)\n"); … … 127 127 128 128 /* set up references */ 129 next_meas [Nmeasure] = -1;129 next_measure[Nmeasure] = -1; 130 130 if (Nmeasure >= NMEASURE) { 131 131 fprintf (stderr, "WARNING: Nmeasure out of bounds (1)\n"); … … 136 136 average[0].measureOffset = Nmeasure; 137 137 } else { 138 next_meas [m] = Nmeasure;138 next_measure[m] = Nmeasure; 139 139 if (m >= NMEASURE) { 140 140 fprintf (stderr, "WARNING: m out of bounds (4)\n"); … … 145 145 } 146 146 147 Measure *sort_measure (Average *average, off_t Naverage, Measure *measure, off_t Nmeasure, off_t *next_meas ) {147 Measure *sort_measure (Average *average, off_t Naverage, Measure *measure, off_t Nmeasure, off_t *next_measure) { 148 148 149 149 off_t i, k, n, np, N; … … 169 169 tmpmeasure[N].averef = i; 170 170 np = n; 171 n = next_meas [n];171 n = next_measure[n]; 172 172 } 173 173 } … … 183 183 184 184 off_t i, j, N; 185 off_t *next_miss ;185 off_t *next_missing; 186 186 187 187 N = 0; 188 188 189 ALLOCATE (next_miss , off_t, Nmissing);189 ALLOCATE (next_missing, off_t, Nmissing); 190 190 for (i = 0; i < Naverage; i++) { 191 191 for (j = 0; j < average[i].Nmissing - 1; j++, N++) { 192 next_miss [N] = N + 1;192 next_missing[N] = N + 1; 193 193 } 194 194 if (average[i].Nmissing > 0) { 195 next_miss [N] = -1;195 next_missing[N] = -1; 196 196 if (N >= Nmissing) { 197 197 fprintf (stderr, "overflow in init_missing_links"); … … 202 202 203 203 } 204 return (next_miss );205 } 206 207 int add_miss _link (Average *average, off_t *next_miss, off_t Nmissing) {204 return (next_missing); 205 } 206 207 int add_missing_link (Average *average, off_t *next_missing, off_t Nmissing) { 208 208 209 209 off_t k, m; … … 212 212 if (average[0].Nmissing < 1) { 213 213 average[0].missingOffset = Nmissing; 214 next_miss [Nmissing] = -1;214 next_missing[Nmissing] = -1; 215 215 return (TRUE); 216 216 } 217 217 218 218 m = average[0].missingOffset; 219 for (k = 0; k < average[0].Nmissing - 1; k++) m = next_miss [m];219 for (k = 0; k < average[0].Nmissing - 1; k++) m = next_missing[m]; 220 220 /* set up references */ 221 next_miss [Nmissing] = -1;222 next_miss [m] = Nmissing;221 next_missing[Nmissing] = -1; 222 next_missing[m] = Nmissing; 223 223 return (TRUE); 224 224 } … … 227 227 we must always save the missing table, if it exists */ 228 228 229 Missing *sort_missing (Average *average, off_t Naverage, Missing *missing, off_t Nmissing, off_t *next_miss ) {229 Missing *sort_missing (Average *average, off_t Naverage, Missing *missing, off_t Nmissing, off_t *next_missing) { 230 230 231 231 off_t i, k, n, N; … … 240 240 for (k = 0; k < average[i].Nmissing; k++, N++) { 241 241 tmpmissing[N] = missing[n]; 242 n = next_miss [n];242 n = next_missing[n]; 243 243 } 244 244 } … … 254 254 255 255 off_t i, j, N; 256 off_t *next_lens ;256 off_t *next_lensing; 257 257 258 258 if (!lensing) return NULL; … … 261 261 N = 0; 262 262 263 ALLOCATE (next_lens , off_t, Nlensing);263 ALLOCATE (next_lensing, off_t, Nlensing); 264 264 for (i = 0; i < Naverage; i++) { 265 265 if (!average[i].Nlensing) continue; … … 268 268 for (j = 0; j < average[i].Nlensing - 1; j++, N++) { 269 269 myAssert (lensing[m+j+1].averef == i, "not sorted"); 270 next_lens [N] = N + 1;270 next_lensing[N] = N + 1; 271 271 if (N >= Nlensing) { 272 272 fprintf (stderr, "WARNING: N out of bounds (1)\n"); 273 273 } 274 274 } 275 next_lens [N] = -1;275 next_lensing[N] = -1; 276 276 if (N >= Nlensing) { 277 277 fprintf (stderr, "WARNING: N out of bounds (2)\n"); … … 284 284 N++; 285 285 } 286 return (next_lens );286 return (next_lensing); 287 287 } 288 288 … … 297 297 298 298 off_t i, m, k, Nm, averef; 299 off_t *next_lens ;300 301 ALLOCATE (next_lens , off_t, Nlensing);299 off_t *next_lensing; 300 301 ALLOCATE (next_lensing, off_t, Nlensing); 302 302 303 303 /* reset the Nm, offset values for average */ … … 310 310 averef = lensing[Nm].averef; 311 311 m = average[averef].lensingOffset; 312 next_lens [Nm] = -1;312 next_lensing[Nm] = -1; 313 313 314 314 if (m == -1) { /* no links yet for source */ … … 318 318 } 319 319 320 for (k = 0; next_lens [m] != -1; k++) {321 m = next_lens [m];320 for (k = 0; next_lensing[m] != -1; k++) { 321 m = next_lensing[m]; 322 322 if (m >= Nlensing) { 323 323 fprintf (stderr, "WARNING: m out of bounds (1)\n"); … … 326 326 327 327 average[averef].Nlensing = k + 2; 328 next_lens [m] = Nm;328 next_lensing[m] = Nm; 329 329 if (m >= Nlensing) { 330 330 fprintf (stderr, "WARNING: m out of bounds (2)\n"); 331 331 } 332 332 } 333 return (next_lens );333 return (next_lensing); 334 334 } 335 335 336 336 /* average[].lensingOffset, average[].Nlensing are valid within an addstar run */ 337 int add_lens _link (Average *average, off_t *next_lens, off_t Nlensing, off_t NLENSING) {337 int add_lensing_link (Average *average, off_t *next_lensing, off_t Nlensing, off_t NLENSING) { 338 338 339 339 off_t k, m; 340 340 341 /* if we have trouble, check validity of next_lens [m] : m < Nlensing */341 /* if we have trouble, check validity of next_lensing[m] : m < Nlensing */ 342 342 m = average[0].lensingOffset; 343 343 344 344 for (k = 0; k < average[0].Nlensing - 1; k++) { 345 m = next_lens [m];345 m = next_lensing[m]; 346 346 if (m >= NLENSING) { 347 347 fprintf (stderr, "WARNING: m out of bounds (3)\n"); … … 350 350 351 351 /* set up references */ 352 next_lens [Nlensing] = -1;352 next_lensing[Nlensing] = -1; 353 353 if (Nlensing >= NLENSING) { 354 354 fprintf (stderr, "WARNING: Nlensing out of bounds (1)\n"); … … 359 359 average[0].lensingOffset = Nlensing; 360 360 } else { 361 next_lens [m] = Nlensing;361 next_lensing[m] = Nlensing; 362 362 if (m >= NLENSING) { 363 363 fprintf (stderr, "WARNING: m out of bounds (4)\n"); … … 368 368 } 369 369 370 Lensing *sort_lensing (Average *average, off_t Naverage, Lensing *lensing, off_t Nlensing, off_t *next_lens ) {370 Lensing *sort_lensing (Average *average, off_t Naverage, Lensing *lensing, off_t Nlensing, off_t *next_lensing) { 371 371 372 372 off_t i, k, n, np, N; … … 392 392 tmplensing[N].averef = i; 393 393 np = n; 394 n = next_lens [n];394 n = next_lensing[n]; 395 395 } 396 396 } 397 397 free (lensing); 398 398 return (tmplensing); 399 } 400 401 /*** Lensobj ****************************************************************************************/ 402 403 /* build the initial links assuming the table is sorted, 404 not partial, and has a correct set of average[].lensobjOffset,Nlensobj values */ 405 off_t *init_lensobj_links (Average *average, off_t Naverage, Lensobj *lensobj, off_t Nlensobj) { 406 407 off_t i, j, N; 408 off_t *next_lensobj; 409 410 if (!lensobj) return NULL; 411 if (SKIP_LENSOBJ) return NULL; 412 413 N = 0; 414 415 ALLOCATE (next_lensobj, off_t, Nlensobj); 416 for (i = 0; i < Naverage; i++) { 417 if (!average[i].Nlensobj) continue; 418 // off_t m = average[i].lensobjOffset; 419 // myAssert (lensobj[m].averef == i, "not sorted"); 420 for (j = 0; j < average[i].Nlensobj - 1; j++, N++) { 421 // myAssert (lensobj[m+j+1].averef == i, "not sorted"); 422 next_lensobj[N] = N + 1; 423 if (N >= Nlensobj) { 424 fprintf (stderr, "WARNING: N out of bounds (1)\n"); 425 } 426 } 427 next_lensobj[N] = -1; 428 if (N >= Nlensobj) { 429 fprintf (stderr, "WARNING: N out of bounds (2)\n"); 430 } 431 432 if (N >= Nlensobj) { 433 fprintf (stderr, "overflow in init_lensobj_links\n"); 434 abort (); 435 } 436 N++; 437 } 438 return (next_lensobj); 439 } 440 441 /* construct lensobj links which are valid FOR THIS LOAD 442 * - if we have a full load, we will get links which can 443 * be used by other programs (eg, relphot, etc) 444 * - if we have a partial load, the links are only valid 445 * for that partial load 446 */ 447 448 off_t *build_lensobj_links (Average *average, off_t Naverage, Lensobj *lensobj, off_t Nlensobj) { 449 450 fprintf (stderr, "input is not sorted but contains lensobj -- trouble\n"); 451 exit (2); 452 453 # if (0) 454 455 off_t i, m, k, Nm, averef; 456 off_t *next_lensobj; 457 458 ALLOCATE (next_lensobj, off_t, Nlensobj); 459 460 /* reset the Nm, offset values for average */ 461 for (i = 0; i < Naverage; i++) { 462 average[i].lensobjOffset = -1; 463 average[i].Nlensobj = 0; 464 } 465 466 for (Nm = 0; Nm < Nlensobj; Nm++) { 467 averef = lensobj[Nm].averef; 468 m = average[averef].lensobjOffset; 469 next_lensobj[Nm] = -1; 470 471 if (m == -1) { /* no links yet for source */ 472 average[averef].lensobjOffset = Nm; 473 average[averef].Nlensobj = 1; 474 continue; 475 } 476 477 for (k = 0; next_lensobj[m] != -1; k++) { 478 m = next_lensobj[m]; 479 if (m >= Nlensobj) { 480 fprintf (stderr, "WARNING: m out of bounds (1)\n"); 481 } 482 } 483 484 average[averef].Nlensobj = k + 2; 485 next_lensobj[m] = Nm; 486 if (m >= Nlensobj) { 487 fprintf (stderr, "WARNING: m out of bounds (2)\n"); 488 } 489 } 490 return (next_lensobj); 491 # endif 492 } 493 494 /* average[].lensobjOffset, average[].Nlensobj are valid within an addstar run */ 495 int add_lensobj_link (Average *average, off_t *next_lensobj, off_t Nlensobj, off_t NLENSOBJ) { 496 497 off_t k, m; 498 499 /* if we have trouble, check validity of next_lensobj[m] : m < Nlensobj */ 500 m = average[0].lensobjOffset; 501 502 for (k = 0; k < average[0].Nlensobj - 1; k++) { 503 m = next_lensobj[m]; 504 if (m >= NLENSOBJ) { 505 fprintf (stderr, "WARNING: m out of bounds (3)\n"); 506 } 507 } 508 509 /* set up references */ 510 next_lensobj[Nlensobj] = -1; 511 if (Nlensobj >= NLENSOBJ) { 512 fprintf (stderr, "WARNING: Nlensobj out of bounds (1)\n"); 513 } 514 515 // if Nlensobj is 0, m may have been mis-set; add to the end 516 if ((average[0].Nlensobj == 0) || (m == -1)) { 517 average[0].lensobjOffset = Nlensobj; 518 } else { 519 next_lensobj[m] = Nlensobj; 520 if (m >= NLENSOBJ) { 521 fprintf (stderr, "WARNING: m out of bounds (4)\n"); 522 } 523 } 524 525 return (TRUE); 526 } 527 528 Lensobj *sort_lensobj (Average *average, off_t Naverage, Lensobj *lensobj, off_t Nlensobj, off_t *next_lensobj) { 529 530 off_t i, k, n, np, N; 531 Lensobj *tmplensobj; 532 533 /* fix order of Lensobj (memory intensive, but fast) */ 534 np = -1; 535 N = 0; 536 ALLOCATE (tmplensobj, Lensobj, Nlensobj); 537 for (i = 0; i < Naverage; i++) { 538 if (!average[i].Nlensobj) continue; 539 n = average[i].lensobjOffset; 540 average[i].lensobjOffset = N; 541 int myObjID = average[i].objID; 542 for (k = 0; k < average[i].Nlensobj; k++, N++) { 543 if (n == -1) { 544 fprintf (stderr, "entry after %d has a problem\n", (int) np); 545 abort(); 546 } 547 tmplensobj[N] = lensobj[n]; 548 // myAssert (lensobj[n].averef == i, "error in averef"); 549 myAssert ((lensobj[n].objID == myObjID) || (lensobj[n].objID == -1), "error in objID?"); 550 // tmplensobj[N].averef = i; 551 np = n; 552 n = next_lensobj[n]; 553 } 554 } 555 free (lensobj); 556 return (tmplensobj); 399 557 } 400 558 … … 406 564 407 565 off_t i, j, N; 408 off_t *next_star ;566 off_t *next_starpar; 409 567 410 568 if (!starpar) return NULL; … … 415 573 // NOTE that is we choose DVO_SKIP_STARPAR, catalog.starpar is NULL. 416 574 // this code will let merge_catalogs_old.c do nothing for starpar 417 ALLOCATE (next_star , off_t, Nstarpar);418 if (!starpar) return next_star ;575 ALLOCATE (next_starpar, off_t, Nstarpar); 576 if (!starpar) return next_starpar; 419 577 420 578 for (i = 0; i < Naverage; i++) { … … 424 582 for (j = 0; j < average[i].Nstarpar - 1; j++, N++) { 425 583 myAssert (starpar[m+j+1].averef == i, "not sorted"); 426 next_star [N] = N + 1;584 next_starpar[N] = N + 1; 427 585 if (N >= Nstarpar) { 428 586 fprintf (stderr, "WARNING: N out of bounds (1)\n"); 429 587 } 430 588 } 431 next_star [N] = -1;589 next_starpar[N] = -1; 432 590 if (N >= Nstarpar) { 433 591 fprintf (stderr, "WARNING: N out of bounds (2)\n"); … … 440 598 N++; 441 599 } 442 return (next_star );600 return (next_starpar); 443 601 } 444 602 … … 453 611 454 612 off_t i, m, k, Nm, averef; 455 off_t *next_star ;456 457 ALLOCATE (next_star , off_t, Nstarpar);458 if (!starpar) return next_star ;613 off_t *next_starpar; 614 615 ALLOCATE (next_starpar, off_t, Nstarpar); 616 if (!starpar) return next_starpar; 459 617 460 618 /* reset the Nm, offset values for average */ … … 467 625 averef = starpar[Nm].averef; 468 626 m = average[averef].starparOffset; 469 next_star [Nm] = -1;627 next_starpar[Nm] = -1; 470 628 471 629 if (m == -1) { /* no links yet for source */ … … 475 633 } 476 634 477 for (k = 0; next_star [m] != -1; k++) {478 m = next_star [m];635 for (k = 0; next_starpar[m] != -1; k++) { 636 m = next_starpar[m]; 479 637 if (m >= Nstarpar) { 480 638 fprintf (stderr, "WARNING: m out of bounds (1)\n"); … … 483 641 484 642 average[averef].Nstarpar = k + 2; 485 next_star [m] = Nm;643 next_starpar[m] = Nm; 486 644 if (m >= Nstarpar) { 487 645 fprintf (stderr, "WARNING: m out of bounds (2)\n"); 488 646 } 489 647 } 490 return (next_star );648 return (next_starpar); 491 649 } 492 650 493 651 /* average[].starparOffset, average[].Nstarpar are valid within an addstar run */ 494 int add_star _link (Average *average, off_t *next_star, off_t Nstarpar, off_t NSTARPAR) {652 int add_starpar_link (Average *average, off_t *next_starpar, off_t Nstarpar, off_t NSTARPAR) { 495 653 496 654 off_t k, m; 497 655 498 /* if we have trouble, check validity of next_star [m] : m < Nstarpar */656 /* if we have trouble, check validity of next_starpar[m] : m < Nstarpar */ 499 657 m = average[0].starparOffset; 500 658 501 659 for (k = 0; k < average[0].Nstarpar - 1; k++) { 502 m = next_star [m];660 m = next_starpar[m]; 503 661 if (m >= NSTARPAR) { 504 662 fprintf (stderr, "WARNING: m out of bounds (3)\n"); … … 507 665 508 666 /* set up references */ 509 next_star [Nstarpar] = -1;667 next_starpar[Nstarpar] = -1; 510 668 if (Nstarpar >= NSTARPAR) { 511 669 fprintf (stderr, "WARNING: Nstarpar out of bounds (1)\n"); … … 516 674 average[0].starparOffset = Nstarpar; 517 675 } else { 518 next_star [m] = Nstarpar;676 next_starpar[m] = Nstarpar; 519 677 if (m >= NSTARPAR) { 520 678 fprintf (stderr, "WARNING: m out of bounds (4)\n"); … … 525 683 } 526 684 527 StarPar *sort_starpar (Average *average, off_t Naverage, StarPar *starpar, off_t Nstarpar, off_t *next_star ) {685 StarPar *sort_starpar (Average *average, off_t Naverage, StarPar *starpar, off_t Nstarpar, off_t *next_starpar) { 528 686 529 687 off_t i, k, n, np, N; … … 552 710 tmpstarpar[N].averef = i; 553 711 np = n; 554 n = next_star [n];712 n = next_starpar[n]; 555 713 } 556 714 } … … 566 724 567 725 off_t i, j, N; 568 off_t *next_galp ;726 off_t *next_galphot; 569 727 570 728 if (galphot) return NULL; … … 573 731 N = 0; 574 732 575 ALLOCATE (next_galp , off_t, Ngalphot);733 ALLOCATE (next_galphot, off_t, Ngalphot); 576 734 for (i = 0; i < Naverage; i++) { 577 735 if (!average[i].Ngalphot) continue; … … 580 738 for (j = 0; j < average[i].Ngalphot - 1; j++, N++) { 581 739 myAssert (galphot[m+j+1].averef == i, "not sorted"); 582 next_galp [N] = N + 1;740 next_galphot[N] = N + 1; 583 741 if (N >= Ngalphot) { 584 742 fprintf (stderr, "WARNING: N out of bounds (1)\n"); 585 743 } 586 744 } 587 next_galp [N] = -1;745 next_galphot[N] = -1; 588 746 if (N >= Ngalphot) { 589 747 fprintf (stderr, "WARNING: N out of bounds (2)\n"); … … 596 754 N++; 597 755 } 598 return (next_galp );756 return (next_galphot); 599 757 } 600 758 … … 609 767 610 768 off_t i, m, k, Nm, averef; 611 off_t *next_galp ;612 613 ALLOCATE (next_galp , off_t, Ngalphot);769 off_t *next_galphot; 770 771 ALLOCATE (next_galphot, off_t, Ngalphot); 614 772 615 773 /* reset the Nm, offset values for average */ … … 622 780 averef = galphot[Nm].averef; 623 781 m = average[averef].galphotOffset; 624 next_galp [Nm] = -1;782 next_galphot[Nm] = -1; 625 783 626 784 if (m == -1) { /* no links yet for source */ … … 630 788 } 631 789 632 for (k = 0; next_galp [m] != -1; k++) {633 m = next_galp [m];790 for (k = 0; next_galphot[m] != -1; k++) { 791 m = next_galphot[m]; 634 792 if (m >= Ngalphot) { 635 793 fprintf (stderr, "WARNING: m out of bounds (1)\n"); … … 638 796 639 797 average[averef].Ngalphot = k + 2; 640 next_galp [m] = Nm;798 next_galphot[m] = Nm; 641 799 if (m >= Ngalphot) { 642 800 fprintf (stderr, "WARNING: m out of bounds (2)\n"); 643 801 } 644 802 } 645 return (next_galp );803 return (next_galphot); 646 804 } 647 805 648 806 /* average[].galphotOffset, average[].Ngalphot are valid within an addstar run */ 649 int add_galp _link (Average *average, off_t *next_galp, off_t Ngalphot, off_t NGALPHOT) {807 int add_galphot_link (Average *average, off_t *next_galphot, off_t Ngalphot, off_t NGALPHOT) { 650 808 651 809 off_t k, m; 652 810 653 /* if we have trouble, check validity of next_galp [m] : m < Ngalphot */811 /* if we have trouble, check validity of next_galphot[m] : m < Ngalphot */ 654 812 m = average[0].galphotOffset; 655 813 656 814 for (k = 0; k < average[0].Ngalphot - 1; k++) { 657 m = next_galp [m];815 m = next_galphot[m]; 658 816 if (m >= NGALPHOT) { 659 817 fprintf (stderr, "WARNING: m out of bounds (3)\n"); … … 662 820 663 821 /* set up references */ 664 next_galp [Ngalphot] = -1;822 next_galphot[Ngalphot] = -1; 665 823 if (Ngalphot >= NGALPHOT) { 666 824 fprintf (stderr, "WARNING: Ngalphot out of bounds (1)\n"); … … 671 829 average[0].galphotOffset = Ngalphot; 672 830 } else { 673 next_galp [m] = Ngalphot;831 next_galphot[m] = Ngalphot; 674 832 if (m >= NGALPHOT) { 675 833 fprintf (stderr, "WARNING: m out of bounds (4)\n"); … … 680 838 } 681 839 682 GalPhot *sort_galphot (Average *average, off_t Naverage, GalPhot *galphot, off_t Ngalphot, off_t *next_galp ) {840 GalPhot *sort_galphot (Average *average, off_t Naverage, GalPhot *galphot, off_t Ngalphot, off_t *next_galphot) { 683 841 684 842 off_t i, k, n, np, N; … … 704 862 tmpgalphot[N].averef = i; 705 863 np = n; 706 n = next_galp [n];864 n = next_galphot[n]; 707 865 } 708 866 }
Note:
See TracChangeset
for help on using the changeset viewer.
