Changeset 2052
- Timestamp:
- Oct 12, 2004, 9:10:00 AM (22 years ago)
- Location:
- trunk/psLib
- Files:
-
- 3 edited
-
src/astronomy/psAstrometry.c (modified) (7 diffs)
-
src/astronomy/slalib.h (modified) (3 diffs)
-
test/astronomy/tst_psAstrometry.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astronomy/psAstrometry.c
r2048 r2052 8 8 * @author George Gusciora, MHPCC 9 9 * 10 * @version $Revision: 1.3 3$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-10-12 01:34:09$10 * @version $Revision: 1.34 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-10-12 19:10:00 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 352 352 newFPA->toTangentPlane = NULL; 353 353 newFPA->pattern = NULL; 354 newFPA->exposure = psMemIncrRefCounter((psExposure*)exp); 355 newFPA->grommit = psGrommitAlloc(exp); 354 355 if (exp != NULL) { 356 newFPA->exposure = psMemIncrRefCounter((psExposure*)exp); 357 newFPA->grommit = psGrommitAlloc(exp); 358 } else { 359 newFPA->exposure = NULL; 360 newFPA->grommit = NULL; 361 } 356 362 357 363 newFPA->colorPlus = NULL; … … 455 461 psGrommit* psGrommitAlloc(const psExposure* exp) 456 462 { 457 double* AOPRMS = psAlloc(sizeof(double)*14);458 459 463 if (exp == NULL) { 460 464 psAbort(__func__, "the 'exp' parameter is NULL\n"); … … 478 482 double tlr = exp->observatory->tlr; 479 483 484 psGrommit* grommit = (psGrommit* ) psAlloc(sizeof(psGrommit)); 485 480 486 slaAoppa(date, dut, elongm, phim, hm, xp, yp, 481 tdk, pmb, rh, wl, tlr, AOPRMS); 482 483 psGrommit* grommit = (psGrommit* ) psAlloc(sizeof(psGrommit)); 484 *(double *)&grommit->latitude = AOPRMS[0]; 485 *(double *)&grommit->sinLat = AOPRMS[1]; 486 *(double *)&grommit->cosLat = AOPRMS[2]; 487 *(double *)&grommit->height = AOPRMS[3]; 488 *(double *)&grommit->abberationMag = AOPRMS[4]; 489 *(double *)&grommit->temperature = AOPRMS[5]; 490 *(double *)&grommit->pressure = AOPRMS[6]; 491 *(double *)&grommit->humidity = AOPRMS[7]; 492 *(double *)&grommit->wavelength = AOPRMS[8]; 493 *(double *)&grommit->lapseRate = AOPRMS[9]; 494 *(double *)&grommit->refractA = AOPRMS[10]; 495 *(double *)&grommit->refractB = AOPRMS[11]; 496 *(double *)&grommit->longitudeOffset = AOPRMS[12]; 497 *(double *)&grommit->siderealTime = AOPRMS[13]; 498 499 psFree(AOPRMS); 487 tdk, pmb, rh, wl, tlr, (double*)grommit); 500 488 501 489 return (grommit); … … 680 668 } 681 669 682 slaAopqk(tpCoord->x, tpCoord->y, (double *)grommit,670 slaAopqk(tpCoord->x, tpCoord->y, (double*)grommit, 683 671 &AOB, &ZOB, &HOB, &outSphere->r, &outSphere->d); 684 672 … … 782 770 const psGrommit* grommit) 783 771 { 772 char* type = "RA"; 773 784 774 if (in == NULL) { 785 775 psAbort(__func__, "input parameter in is NULL."); … … 792 782 } 793 783 794 slaOapqk( "RA", in->r, in->d, (double *)grommit, &tpCoord->x, &tpCoord->y);784 slaOapqk(type, in->r, in->d, (double*)grommit, &tpCoord->x, &tpCoord->y); 795 785 796 786 return(tpCoord); -
trunk/psLib/src/astronomy/slalib.h
r1630 r2052 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $10 * @date $Date: 2004- 08-26 21:11:55$9 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-10-12 19:10:00 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 19 19 #ifdef FORTRAN_DOUBLE_UNDERSCORE_SUFFIX 20 20 #ifdef FORTRAN_UPPERCASE 21 #define slaAoppa _SLA_AOPPA__22 #define slaAopqk _SLA_AOPQK__23 #define slaOapqk _SLA_OAPQK__21 #define fslaAoppa _SLA_AOPPA__ 22 #define fslaAopqk _SLA_AOPQK__ 23 #define fslaOapqk _SLA_OAPQK__ 24 24 #else 25 #define slaAoppa _sla_aoppa__26 #define slaAopqk _sla_aopqk__27 #define slaOapqk _sla_oapqk__25 #define fslaAoppa _sla_aoppa__ 26 #define fslaAopqk _sla_aopqk__ 27 #define fslaOapqk _sla_oapqk__ 28 28 #endif 29 29 #elif FORTRAN_NO_UNDERSCORE_SUFFIX 30 30 #ifdef FORTRAN_UPPERCASE 31 #define slaAoppa _SLA_AOPPA32 #define slaAopqk _SLA_AOPQK33 #define slaOapqk _SLA_OAPQK31 #define fslaAoppa _SLA_AOPPA 32 #define fslaAopqk _SLA_AOPQK 33 #define fslaOapqk _SLA_OAPQK 34 34 #else 35 #define slaAoppa _sla_aoppa36 #define slaAopqk _sla_aopqk37 #define slaOapqk _sla_oapqk35 #define fslaAoppa _sla_aoppa 36 #define fslaAopqk _sla_aopqk 37 #define fslaOapqk _sla_oapqk 38 38 #endif 39 39 #else 40 40 #ifdef FORTRAN_UPPERCASE 41 #define slaAoppa _SLA_AOPPA_42 #define slaAopqk _SLA_AOPQK_43 #define slaOapqk _SLA_OAPQK_41 #define fslaAoppa _SLA_AOPPA_ 42 #define fslaAopqk _SLA_AOPQK_ 43 #define fslaOapqk _SLA_OAPQK_ 44 44 #else 45 #define slaAoppa _sla_aoppa_46 #define slaAopqk _sla_aopqk_47 #define slaOapqk _sla_oapqk_45 #define fslaAoppa _sla_aoppa_ 46 #define fslaAopqk _sla_aopqk_ 47 #define fslaOapqk _sla_oapqk_ 48 48 #endif 49 49 #endif … … 51 51 #ifdef FORTRAN_DOUBLE_UNDERSCORE_SUFFIX 52 52 #ifdef FORTRAN_UPPERCASE 53 #define slaAoppa SLA_AOPPA__54 #define slaAopqk SLA_AOPQK__55 #define slaOapqk SLA_OAPQK__53 #define fslaAoppa SLA_AOPPA__ 54 #define fslaAopqk SLA_AOPQK__ 55 #define fslaOapqk SLA_OAPQK__ 56 56 #else 57 #define slaAoppa sla_aoppa__58 #define slaAopqk sla_aopqk__59 #define slaOapqk sla_oapqk__57 #define fslaAoppa sla_aoppa__ 58 #define fslaAopqk sla_aopqk__ 59 #define fslaOapqk sla_oapqk__ 60 60 #endif 61 61 #elif FORTRAN_NO_UNDERSCORE_SUFFIX 62 62 #ifdef FORTRAN_UPPERCASE 63 #define slaAoppa SLA_AOPPA64 #define slaAopqk SLA_AOPQK65 #define slaOapqk SLA_OAPQK63 #define fslaAoppa SLA_AOPPA 64 #define fslaAopqk SLA_AOPQK 65 #define fslaOapqk SLA_OAPQK 66 66 #else 67 #define slaAoppa sla_aoppa68 #define slaAopqk sla_aopqk69 #define slaOapqk sla_oapqk67 #define fslaAoppa sla_aoppa 68 #define fslaAopqk sla_aopqk 69 #define fslaOapqk sla_oapqk 70 70 #endif 71 71 #else 72 72 #ifdef FORTRAN_UPPERCASE 73 #define slaAoppa SLA_AOPPA_74 #define slaAopqk SLA_AOPQK_75 #define slaOapqk SLA_OAPQK_73 #define fslaAoppa SLA_AOPPA_ 74 #define fslaAopqk SLA_AOPQK_ 75 #define fslaOapqk SLA_OAPQK_ 76 76 #else 77 #define slaAoppa sla_aoppa_78 #define slaAopqk sla_aopqk_79 #define slaOapqk sla_oapqk_77 #define fslaAoppa sla_aoppa_ 78 #define fslaAopqk sla_aopqk_ 79 #define fslaOapqk sla_oapqk_ 80 80 #endif 81 81 #endif 82 82 #endif 83 83 84 extern void slaAoppa(85 doubledate,86 doubledut,87 doubleelongm,88 doublephim,89 doublehim,90 doublexp,91 doubleyp,92 doubletdk,93 doublepmb,94 doublerh,95 doublewl,96 doubletlr,97 double *AOPRMS84 extern void fslaAoppa( 85 const double* date, 86 const double* dut, 87 const double* elongm, 88 const double* phim, 89 const double* him, 90 const double* xp, 91 const double* yp, 92 const double* tdk, 93 const double* pmb, 94 const double* rh, 95 const double* wl, 96 const double* tlr, 97 double* AOPRMS 98 98 ); 99 99 100 extern void slaAopqk(101 doubleRAP,102 doubleDAP,103 double *AOPRMS,104 double *AOB,105 double *ZOB,106 double *HOB,107 double *DOB,108 double *ROB100 extern void fslaAopqk( 101 const double* RAP, 102 const double* DAP, 103 double* AOPRMS, 104 double* AOB, 105 double* ZOB, 106 double* HOB, 107 double* DOB, 108 double* ROB 109 109 ); 110 110 111 extern void slaOapqk(112 char *TYPE,113 doubleOB1,114 doubleOB2,115 double *AOPRMS,116 double *RAP,117 double *DAP111 extern void fslaOapqk( 112 char* TYPE, 113 const double* OB1, 114 const double* OB2, 115 double* AOPRMS, 116 double* RAP, 117 double* DAP 118 118 ); 119 119 120 /* 121 void slaAoppa(date, dut, elongm, phim, hm, xp, yp, tdk, pmb, rh, wl, tlr, aoprms) 122 123 PARAMETERS 124 125 double date 126 double dut 127 double elongm 128 double phim 129 double hm 130 double xp 131 double yp 132 double tdk 133 double pmb 134 double rh 135 double wl 136 double tlr 137 double *aoprms 138 */ 139 #define slaAoppa(date,dut,elongm,phim,him,xp,yp,tdk,pmb,rh,wl,tlr,AOPRMS) \ 140 fslaAoppa(&date,&dut,&elongm,&phim,&him,&xp,&yp,&tdk,&pmb,&rh,&wl,&tlr,AOPRMS) 141 142 /* 143 void slaAopqk(rap, dap, aoprms, aob, zob, hob, dob, rob) 144 145 PARAMETERS 146 147 double rap 148 double dap 149 double *aoprms 150 double *aob 151 double *zob 152 double *hob 153 double *dob 154 double *rob 155 */ 156 157 #define slaAopqk(RAP,DAP,AOPRMS,AOB,ZOB,HOB,DOB,ROB) \ 158 fslaAopqk(&RAP,&DAP,AOPRMS,AOB,ZOB,HOB,DOB,ROB) 159 160 /* 161 void slaOapqk(type, ob1, ob2, aoprms, rap, dap) 162 163 PARAMETERS 164 165 char *type 166 double ob1 167 double ob2 168 double *aoprms 169 double *rap 170 double *dap 171 */ 172 173 #define slaOapqk(TYPE, OB1, OB2, AOPRMS, RAP, DAP) \ 174 fslaOapqk(TYPE, &OB1, &OB2, AOPRMS, RAP, DAP) 175 120 176 #endif -
trunk/psLib/test/astronomy/tst_psAstrometry.c
r2048 r2052 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-10-12 01:34:09$7 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-10-12 19:10:00 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 20 20 static int testObservatoryAlloc(void); 21 21 static int testFPAAlloc(void); 22 // static int testGrommitAlloc(void);22 static int testChipAlloc(void); 23 23 24 24 testDescription tests[] = { … … 26 26 {testObservatoryAlloc,736,"psObservatoryAlloc",0,false}, 27 27 {testFPAAlloc,739,"psFPAAlloc",0,false}, 28 {testChipAlloc,740,"psChipAlloc",0,false}, 28 29 {NULL} 29 30 }; … … 319 320 psFree(exp); 320 321 psFree(obs); 322 psFree(now); 321 323 322 324 return 0; 323 325 } 326 327 static int testChipAlloc(void) 328 { 329 char* name = "The Kaiser Royal Observatory"; 330 331 psTime* now = psTimeGetTime(PS_TIME_UTC); 332 333 psObservatory* obs = psObservatoryAlloc(name, 334 20.7*M_PI/180.0, 156.3*M_PI/180.0, 3055.0, 0.0065f); 335 336 psExposure* exp = psExposureAlloc(1.0, 2.0, 3.0, 4.0, 5.0, 337 now, 6.0f, 260.0f, 1013.0f, 0.7f, 10.0f, 0.650f, obs); 338 339 psFPA* fpa = psFPAAlloc(8, exp); 340 341 // N.B. psFPAAlloc made made a reference to any of these that it is 342 // referencing, so these don't necessary are actually freed here. Just 343 // these references to the buffers are freed. 344 psFree(exp); 345 psFree(obs); 346 psFree(now); 347 348 /* 349 1. invoke psChipAlloc with nCells > 0 and parentFPA non-NULL. Verify 350 that: 351 a. the cells array is of the size nCells and all elements are NULL. 352 b. parent attribute is set to parentFPA parameter and the ref. count 353 was incremented. 354 c. all other attributes are initialized to NULL or 0. 355 */ 356 357 psChip* chip = psChipAlloc(8, fpa); 358 359 if (chip == NULL) { 360 psLogMsg(__func__,PS_LOG_ERROR,"psChipAlloc returned NULL."); 361 return 1; 362 } 363 364 if (chip->cells->n != 8) { 365 psLogMsg(__func__,PS_LOG_ERROR, 366 "psChipAlloc did not set the number of cells properly."); 367 return 2; 368 } 369 370 for (int lcv=0; lcv < 8; lcv++) { 371 if (chip->cells->data[lcv] != NULL) { 372 psLogMsg(__func__,PS_LOG_ERROR, 373 "psChipAlloc did not set cell %d to NULL.", lcv); 374 return 3; 375 } 376 } 377 378 if (chip->parent != fpa) { 379 psLogMsg(__func__,PS_LOG_ERROR, 380 "psChipAlloc did not set the parent properly."); 381 return 4; 382 } 383 384 if (psMemGetRefCounter(fpa) != 2) { 385 psLogMsg(__func__,PS_LOG_ERROR, 386 "psChipAlloc did not increment reference counter for parent FPA."); 387 return 5; 388 } 389 390 if (chip->metadata != NULL) { 391 psLogMsg(__func__,PS_LOG_ERROR, 392 "psChipAlloc did not set metadata to NULL."); 393 return 6; 394 } 395 396 if (chip->toFPA != NULL) { 397 psLogMsg(__func__,PS_LOG_ERROR, 398 "psChipAlloc did not set toFPA to NULL."); 399 return 7; 400 } 401 402 if (chip->fromFPA != NULL) { 403 psLogMsg(__func__,PS_LOG_ERROR, 404 "psChipAlloc did not set fromFPA to NULL."); 405 return 8; 406 } 407 408 /* 409 2. invoke psChipAlloc with nCells = 0. Verify that: 410 a. execution does not halt 411 b. the cells array is of the size of zero. 412 */ 413 414 psChip* chip2 = psChipAlloc(0,fpa); 415 416 if (chip2 == NULL) { 417 psLogMsg(__func__,PS_LOG_ERROR,"psChipAlloc returned NULL."); 418 return 11; 419 } 420 421 if (chip2->cells->n != 0) { 422 psLogMsg(__func__,PS_LOG_ERROR, 423 "psChipAlloc did not set the number of cells properly."); 424 return 12; 425 } 426 427 if (chip2->parent != fpa) { 428 psLogMsg(__func__,PS_LOG_ERROR, 429 "psChipAlloc did not set the parent properly."); 430 return 14; 431 } 432 433 if (psMemGetRefCounter(fpa) != 3) { 434 psLogMsg(__func__,PS_LOG_ERROR, 435 "psChipAlloc did not increment reference counter for parent FPA."); 436 return 15; 437 } 438 439 /* 440 3. invoke psChipAlloc with parentFPA = NULL. Verify that parent 441 attribute is NULL and no error is generated. 442 */ 443 444 psChip* chip3 = psChipAlloc(8,NULL); 445 446 if (chip3 == NULL) { 447 psLogMsg(__func__,PS_LOG_ERROR,"psChipAlloc returned NULL."); 448 return 21; 449 } 450 451 if (chip3->cells->n != 8) { 452 psLogMsg(__func__,PS_LOG_ERROR, 453 "psChipAlloc did not set the number of cells properly."); 454 return 22; 455 } 456 457 if (chip3->parent != NULL) { 458 psLogMsg(__func__,PS_LOG_ERROR, 459 "psChipAlloc did not set the parent to NULL."); 460 return 24; 461 } 462 463 psFree(chip); 464 psFree(chip2); 465 psFree(chip3); 466 psFree(fpa); 467 468 return 0; 469 }
Note:
See TracChangeset
for help on using the changeset viewer.
