Changeset 2855
- Timestamp:
- Dec 30, 2004, 10:18:37 AM (22 years ago)
- Location:
- trunk/psLib
- Files:
-
- 12 edited
-
psLib.kdevelop.filelist (modified) (1 diff)
-
psLib.kdevelop.pcs (modified) ( previous)
-
psLib.kdevses (modified) (2 diffs)
-
src/astronomy/psAstrometry.c (modified) (5 diffs)
-
src/astronomy/psAstrometry.h (modified) (6 diffs)
-
src/collections/psArray.c (modified) (2 diffs)
-
src/collections/psCollectionsErrors.dat (modified) (2 diffs)
-
src/collections/psCollectionsErrors.h (modified) (3 diffs)
-
src/types/psArray.c (modified) (2 diffs)
-
test/astronomy/tst_psAstrometry.c (modified) (24 diffs)
-
test/collections/verified/tst_psArray.stderr (modified) (1 diff)
-
test/image/tst_psImageManip.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/psLib.kdevelop.filelist
r2837 r2855 1 1 # KDevelop Custom Project File List 2 tags3 test/collections/psArray_02.c4 -
trunk/psLib/psLib.kdevses
r2837 r2855 2 2 <!DOCTYPE KDevPrjSession> 3 3 <KDevPrjSession> 4 <DocsAndViews NumberOfDocuments="0" /> 4 <DocsAndViews NumberOfDocuments="3" > 5 <Doc0 NumberOfViews="1" URL="file:/home/desonia/psLib/src/astronomy/psAstrometry.c" > 6 <View0 Type="Source" /> 7 </Doc0> 8 <Doc1 NumberOfViews="1" URL="file:/home/desonia/psLib/test/astronomy/tst_psAstrometry.c" > 9 <View0 Type="Source" /> 10 </Doc1> 11 <Doc2 NumberOfViews="1" URL="file:/home/desonia/psLib/src/collections/psArray.c" > 12 <View0 line="91" Type="Source" /> 13 </Doc2> 14 </DocsAndViews> 5 15 <pluginList> 6 16 <kdevbookmarks> … … 11 21 </bookmarks> 12 22 </kdevbookmarks> 23 <kdevsubversion> 24 <subversion recurseresolve="1" recurserelocate="1" recursemerge="1" recursecommit="1" base="" recursepropget="1" recurseswitch="1" recurseupdate="1" recursepropset="1" recursediff="1" recurserevert="1" forcemove="1" recursecheckout="1" forceremove="1" recurseadd="1" recurseproplist="1" forcemerge="1" /> 25 </kdevsubversion> 13 26 <kdevvalgrind> 14 27 <executable path="" params="" /> -
trunk/psLib/src/astronomy/psAstrometry.c
r2600 r2855 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1.5 2$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-12- 02 21:12:51$10 * @version $Revision: 1.53 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-12-30 20:18:36 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 399 399 400 400 // create array of NULL psCells 401 chip->cells = psArrayAlloc(nCells); 401 int n = (nCells > 0) ? nCells : 1; 402 chip->cells = psArrayAlloc(n); 402 403 psPtr* cells = chip->cells->data; 403 for (psS32 i=0;i<n Cells;i++) {404 for (psS32 i=0;i<n;i++) { 404 405 cells[i] = NULL; 405 406 } 407 chip->cells->n = 0; // per requirement 408 409 *(int*)&chip->row0 = 0; 410 *(int*)&chip->col0 = 0; 406 411 407 412 chip->metadata = NULL; … … 429 434 430 435 // create array of NULL psReadouts 431 cell->readouts = psArrayAlloc(nReadouts); 436 int n = (nReadouts > 0) ? nReadouts : 1; 437 cell->readouts = psArrayAlloc(n); 432 438 psPtr* readouts = cell->readouts->data; 433 for (psS32 i=0;i<n Readouts;i++) {439 for (psS32 i=0;i<n;i++) { 434 440 readouts[i] = NULL; 435 441 } 442 cell->readouts->n = 0; // per requirement 443 444 *(int*)&cell->row0 = 0; 445 *(int*)&cell->col0 = 0; 436 446 437 447 cell->metadata = NULL; … … 452 462 } 453 463 454 psReadout* psReadoutAlloc(psS32 col0, 455 psS32 row0, 456 const psImage* image) 457 { 458 PS_INT_CHECK_NON_NEGATIVE(col0, NULL); 459 PS_INT_CHECK_NON_NEGATIVE(row0, NULL); 460 464 psReadout* psReadoutAlloc() 465 { 461 466 psReadout* readout = psAlloc(sizeof(psReadout)); 462 467 463 *(psU32*)&readout->colBins = 1; 464 *(psU32*)&readout->rowBins = 1; 465 *(psS32*)&readout->col0 = col0; 466 *(psS32*)&readout->row0 = row0; 467 468 readout->image = (psImage*)image; 468 *(psU32*)&readout->colBins = 0; 469 *(psU32*)&readout->rowBins = 0; 470 *(psU32*)&readout->rowParity = 0; 471 *(psU32*)&readout->colParity = 0; 472 *(psS32*)&readout->col0 = 0; 473 *(psS32*)&readout->row0 = 0; 474 475 readout->image = NULL; 469 476 readout->mask = NULL; 470 477 readout->objects = NULL; … … 718 725 PS_PTR_CHECK_NULL(cellCoord, NULL); 719 726 PS_PTR_CHECK_NULL(cell, NULL); 720 PS_PTR_CHECK_NULL(cell->to TP, NULL);727 PS_PTR_CHECK_NULL(cell->toSky, NULL); 721 728 PS_PTR_CHECK_NULL(cell->parent, NULL); 722 729 PS_PTR_CHECK_NULL(cell->parent->parent, NULL); -
trunk/psLib/src/astronomy/psAstrometry.h
r2600 r2855 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1.3 2$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-12- 02 21:12:51$10 * @version $Revision: 1.33 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-12-30 20:18:36 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 99 99 typedef struct 100 100 { 101 const psU32 colBins; ///< Amount of binning in x-dimension 102 const psU32 rowBins; ///< Amount of binning in y-dimension 103 const psS32 col0; ///< Offset from the left of chip. 104 const psS32 row0; ///< Offset from the bottom of chip. 101 const psS32 col0; ///< Offset from the left of chip. 102 const psS32 row0; ///< Offset from the bottom of chip. 103 104 const int colParity; ///< Column Readout Direction 105 const int rowParity; ///< Row Readout Direction 106 107 const psU32 colBins; ///< Amount of binning in x-dimension 108 const psU32 rowBins; ///< Amount of binning in y-dimension 105 109 106 110 psImage* image; ///< Imaging area of readout … … 122 126 typedef struct 123 127 { 128 const psS32 col0; ///< Offset from the left of chip 129 const psS32 row0; ///< Offset from the bottom of chip 130 124 131 psArray* readouts; ///< readouts from the cell 132 125 133 psMetadata* metadata; ///< cell-level metadata 126 134 127 135 psPlaneTransform* toChip; ///< transformations from cell to chip coordinates 128 psPlaneTransform* fromChip; ///< transformations from c hip to cellcoordinates136 psPlaneTransform* fromChip; ///< transformations from cell to chip coordinates 129 137 psPlaneTransform* toFPA; ///< transformations from cell to FPA coordinates 130 psPlaneTransform* toTP; ///< transformations from cell to tangent planecoordinates131 psPlaneTransform* toSky; ///< transformations from cell to tangent plane coordinates138 psPlaneTransform* toTP; ///< transformations from cell to FPA coordinates 139 psPlaneTransform* toSky; ///< transformations from cell to tangent plane coordinates 132 140 133 141 struct psChip* parent; ///< chip in which contains this cell … … 145 153 typedef struct psChip 146 154 { 155 const psS32 col0; ///< Offset from the left of FPA 156 const psS32 row0; ///< Offset from the bottom of FPA 157 147 158 psArray* cells; ///< cells in the chip 159 148 160 psMetadata* metadata; ///< chip-level metadata 149 161 … … 282 294 /** Allocator for psObservatory 283 295 * 284 * This function shall construct a new psObservatory with attributes 296 * This function shall construct a new psObservatory with attributes 285 297 * cooresponding to the function parameters. 286 298 * … … 340 352 * to NULL. 341 353 * 342 * @return psReadout* newly allocated psReadout 343 */ 344 psReadout* psReadoutAlloc( 345 psS32 col0, ///< offset from the left of the cell 346 psS32 row0, ///< offset from the bottom of the cell 347 const psImage* image ///< image of the readout 348 ); 354 * @return psReadout* newly allocated psReadout with all internal pointers set to NULL 355 */ 356 psReadout* psReadoutAlloc(); 349 357 350 358 /** Allocates a Wallace's Grommit structure. -
trunk/psLib/src/collections/psArray.c
r2836 r2855 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.2 1$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-12- 28 01:48:05$11 * @version $Revision: 1.22 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-12-30 20:18:36 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 114 114 psBool success = false; 115 115 116 if (psArr == NULL) { 117 psError(PS_ERR_BAD_PARAMETER_NULL, true, 118 PS_ERRORTEXT_psArray_ARRAY_NULL); 119 return false; 120 } 116 121 117 122 psS32 n = psArr->n; -
trunk/psLib/src/collections/psCollectionsErrors.dat
r2681 r2855 9 9 # 10 10 psArray_REALLOC_NULL psArrayRealloc must be given a non-NULL psArray to resize. 11 psArray_ARRAY_NULL Specified psArray can not be NULL. 11 12 # 12 13 psVector_REALLOC_NULL psVectorRealloc must a given a non-NULL psVector to resize. Desired datatype unknown. … … 36 37 psList_ITERATOR_INVALID Specified iterator is not valid. 37 38 psList_ITERATOR_NULL Specified iterator is NULL. 38 psList_LIST_NULL Specified psList reference is NULL. 39 psList_LIST_NULL Specified psList reference is NULL. 39 40 psList_DATA_NULL Specified data item is NULL. 40 41 psList_DATA_NOT_FOUND Specified data item is not found in the psList. -
trunk/psLib/src/collections/psCollectionsErrors.h
r2681 r2855 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $10 * @date $Date: 2004-12- 10 02:50:14$9 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-12-30 20:18:36 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 31 31 //~Start #define PS_ERRORTEXT_$1 "$2" 32 32 #define PS_ERRORTEXT_psArray_REALLOC_NULL "psArrayRealloc must be given a non-NULL psArray to resize." 33 #define PS_ERRORTEXT_psArray_ARRAY_NULL "Specified psArray can not be NULL." 33 34 #define PS_ERRORTEXT_psVector_REALLOC_NULL "psVectorRealloc must a given a non-NULL psVector to resize. Desired datatype unknown." 34 35 #define PS_ERRORTEXT_psVector_NOT_A_VECTOR "The input psVector must have a vector dimension type." … … 53 54 #define PS_ERRORTEXT_psList_ITERATOR_INVALID "Specified iterator is not valid." 54 55 #define PS_ERRORTEXT_psList_ITERATOR_NULL "Specified iterator is NULL." 55 #define PS_ERRORTEXT_psList_LIST_NULL "Specified psList reference is NULL. "56 #define PS_ERRORTEXT_psList_LIST_NULL "Specified psList reference is NULL." 56 57 #define PS_ERRORTEXT_psList_DATA_NULL "Specified data item is NULL." 57 58 #define PS_ERRORTEXT_psList_DATA_NOT_FOUND "Specified data item is not found in the psList." -
trunk/psLib/src/types/psArray.c
r2836 r2855 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.2 1$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-12- 28 01:48:05$11 * @version $Revision: 1.22 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-12-30 20:18:36 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 114 114 psBool success = false; 115 115 116 if (psArr == NULL) { 117 psError(PS_ERR_BAD_PARAMETER_NULL, true, 118 PS_ERRORTEXT_psArray_ARRAY_NULL); 119 return false; 120 } 116 121 117 122 psS32 n = psArr->n; -
trunk/psLib/test/astronomy/tst_psAstrometry.c
r2536 r2855 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-1 1-30 21:47:19$7 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-12-30 20:18:36 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 278 278 279 279 /* 280 2. Call psFPAAlloc with nChips = 0. Verify that the chips array is 280 2. Call psFPAAlloc with nChips = 0. Verify that the chips array is 281 281 zero in size and the program execution does not stop. 282 282 */ … … 291 291 292 292 /* 293 3. Call psFPAAlloc with a NULL psExposure. Verify that the program 293 3. Call psFPAAlloc with a NULL psExposure. Verify that the program 294 294 execution doe not stop and the exposure attribute is NULL. 295 295 */ … … 303 303 304 304 /* 305 4. Call psFPAAlloc and set all references in the struct to a memory 306 buffer. Verify that psFree cleans up all the buffers referenced in 305 4. Call psFPAAlloc and set all references in the struct to a memory 306 buffer. Verify that psFree cleans up all the buffers referenced in 307 307 the struct, i.e., there is no memory leaks generated. 308 308 */ … … 353 353 354 354 /* 355 1. invoke psChipAlloc with nCells > 0 and parentFPA non-NULL. Verify 355 1. invoke psChipAlloc with nCells > 0 and parentFPA non-NULL. Verify 356 356 that: 357 357 a. the cells array is of the size nCells and all elements are NULL. 358 b. parent attribute is set to parentFPA parameter and the ref. count 358 b. parent attribute is set to parentFPA parameter and the ref. count 359 359 was incremented. 360 360 c. all other attributes are initialized to NULL or 0. … … 368 368 } 369 369 370 if (chip->cells->n != 8) {370 if (chip->cells->n != 0) { 371 371 psLogMsg(__func__,PS_LOG_ERROR, 372 372 "psChipAlloc did not set the number of cells properly."); 373 return 2; 374 } 375 376 if (chip->cells->nalloc != 8) { 377 psLogMsg(__func__,PS_LOG_ERROR, 378 "psChipAlloc did not allocate cell array size properly."); 373 379 return 2; 374 380 } … … 382 388 chip->cells->data[lcv] = psAlloc(4); // to check if these are freed. 383 389 } 390 chip->cells->n = 8; 384 391 385 392 if (chip->parent != fpa) { … … 419 426 2. invoke psChipAlloc with nCells = 0. Verify that: 420 427 a. execution does not halt 421 b. the cells array is of the size of zero.428 b. the cells array is of the size of one. 422 429 */ 423 430 … … 435 442 } 436 443 444 if (chip2->cells->nalloc != 1) { 445 psLogMsg(__func__,PS_LOG_ERROR, 446 "psChipAlloc did not allocate cell array size properly."); 447 return 12; 448 } 449 437 450 if (chip2->parent != fpa) { 438 451 psLogMsg(__func__,PS_LOG_ERROR, … … 448 461 449 462 /* 450 3. invoke psChipAlloc with parentFPA = NULL. Verify that parent 463 3. invoke psChipAlloc with parentFPA = NULL. Verify that parent 451 464 attribute is NULL and no error is generated. 452 465 */ … … 459 472 } 460 473 461 if (chip3->cells->n != 8) {474 if (chip3->cells->n != 0) { 462 475 psLogMsg(__func__,PS_LOG_ERROR, 463 476 "psChipAlloc did not set the number of cells properly."); 464 477 return 22; 478 } 479 480 if (chip3->cells->nalloc != 8) { 481 psLogMsg(__func__,PS_LOG_ERROR, 482 "psChipAlloc did not allocate cell array properly."); 483 return 23; 465 484 } 466 485 … … 487 506 488 507 psObservatory* obs = psObservatoryAlloc(name, 489 20.7*M_PI/180.0, 156.3*M_PI/180.0, 3055.0, 0.0065f); 490 491 psExposure* exp = psExposureAlloc(1.0, 2.0, 3.0, 4.0, 5.0, 492 now, 6.0f, 260.0f, 1013.0f, 0.7f, 10.0f, 0.650f, obs); 508 20.7*M_PI/180.0, 509 156.3*M_PI/180.0, 510 3055.0, 511 0.0065f); 512 513 psExposure* exp = psExposureAlloc(1.0, 514 2.0, 515 3.0, 516 4.0, 517 5.0, 518 now, 519 6.0f, 520 260.0f, 521 1013.0f, 522 0.7f, 523 10.0f, 524 0.650f, 525 obs); 493 526 494 527 psFPA* fpa = psFPAAlloc(8, exp); … … 507 540 1. invoke psCellAlloc with nReadouts > 0 and parentChip non-NULL. Verify that: 508 541 a. the readouts array is of the size nReadouts and all elements are NULL. 509 b. parent attribute is set to parentChip parameter and the ref. count 542 b. parent attribute is set to parentChip parameter and the ref. count 510 543 was incremented. 511 544 c. all other attributes are initialized to NULL or 0. … … 519 552 } 520 553 521 if (cell1->readouts->n != 8) {554 if (cell1->readouts->n != 0) { 522 555 psLogMsg(__func__,PS_LOG_ERROR, 523 556 "psCellAlloc did not set the number of readouts properly."); 557 return 2; 558 } 559 560 if (cell1->readouts->nalloc != 8) { 561 psLogMsg(__func__,PS_LOG_ERROR, 562 "psCellAlloc did not allocat the readout array properly."); 524 563 return 2; 525 564 } … … 533 572 cell1->readouts->data[lcv] = psAlloc(4); // to check if these are freed. 534 573 } 574 cell1->readouts->n = 8; 535 575 536 576 if (cell1->parent != chip) { … … 584 624 2. invoke psChipAlloc with nCells = 0. Verify that: 585 625 a. execution does not halt 586 b. the cells array is of the size of zero.626 b. the cells array is of the size of one. 587 627 */ 588 628 … … 600 640 } 601 641 642 if (cell2->readouts->nalloc != 1) { 643 psLogMsg(__func__,PS_LOG_ERROR, 644 "psCellAlloc did not allocate the readout array properly."); 645 return 13; 646 } 647 602 648 if (cell2->parent != chip) { 603 649 psLogMsg(__func__,PS_LOG_ERROR, … … 613 659 614 660 /* 615 3. invoke psChipAlloc with parentFPA = NULL. Verify that parent 661 3. invoke psChipAlloc with parentFPA = NULL. Verify that parent 616 662 attribute is NULL and no error is generated. 617 663 */ … … 624 670 } 625 671 626 if (cell3->readouts->n != 8) {672 if (cell3->readouts->n != 0) { 627 673 psLogMsg(__func__,PS_LOG_ERROR, 628 674 "psCellAlloc did not set the number of cells properly."); 629 675 return 22; 676 } 677 678 if (cell3->readouts->nalloc != 8) { 679 psLogMsg(__func__,PS_LOG_ERROR, 680 "psCellAlloc did not set the number of cells properly."); 681 return 23; 630 682 } 631 683 … … 647 699 static psS32 testReadoutAlloc(void) 648 700 { 649 psImage* image = psImageAlloc(64,64,PS_TYPE_S8); 650 651 652 /* 653 1. invoke psReadoutAlloc with unique/non-zero x0,y0 and non-NULL image. Verify that: 654 a. col0 & row0 are set to the parameters x0 and y0, respectively. 655 b. image attribute is set to image parameter and referenece is incremented 656 c. mask, objects, and metadata attributes are all NULL 657 */ 658 psReadout* readout = psReadoutAlloc(1,2,image); 701 psReadout* readout = psReadoutAlloc(); 659 702 660 703 if (readout == NULL) { … … 663 706 } 664 707 665 if (readout->col0 != 1) {708 if (readout->col0 != 0) { 666 709 psLogMsg(__func__,PS_LOG_ERROR, 667 710 "psReadoutAlloc did not set col0 properly."); … … 669 712 } 670 713 671 if (readout->row0 != 2) {714 if (readout->row0 != 0) { 672 715 psLogMsg(__func__,PS_LOG_ERROR, 673 716 "psReadoutAlloc did not set row0 properly."); … … 675 718 } 676 719 677 if (readout->image != image) {720 if (readout->image != NULL) { 678 721 psLogMsg(__func__,PS_LOG_ERROR, 679 722 "psReadoutAlloc did not set the image properly."); … … 681 724 } 682 725 683 if (psMemGetRefCounter(image) != 1) { 684 psLogMsg(__func__,PS_LOG_ERROR, 685 "psReadoutAlloc incremented reference counter for image."); 686 return 5; 687 } 726 readout->image = psAlloc(4); // to check if these are freed. 688 727 689 728 if (readout->metadata != NULL) { -
trunk/psLib/test/collections/verified/tst_psArray.stderr
r2354 r2855 3 3 <DATE><TIME>|<HOST>|E|psArrayRealloc (psArray.c:<LINENO>) 4 4 psArrayRealloc must be given a non-NULL psArray to resize. 5 <DATE><TIME>|<HOST>|E|psArrayRemove (psArray.c:<LINENO>) 6 Specified psArray can not be NULL. -
trunk/psLib/test/image/tst_psImageManip.c
r2835 r2855 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.3 3$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-12- 28 01:43:17 $8 * @version $Revision: 1.34 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-12-30 20:18:37 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Note:
See TracChangeset
for help on using the changeset viewer.
