Changeset 7006 for trunk/psModules/src/astrom/pmFPA.c
- Timestamp:
- Apr 30, 2006, 12:04:46 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/astrom/pmFPA.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/astrom/pmFPA.c
r6984 r7006 12 12 * XXX: Should we implement non-linear cell->chip transforms? 13 13 * 14 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $15 * @date $Date: 2006-04- 26 00:27:14$14 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2006-04-30 22:04:46 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 36 36 static void readoutFree(pmReadout *readout) 37 37 { 38 psTrace(__func__, 9, "Removing readout %lx from cell %lx...\n", (size_t)readout, (size_t)readout->parent);38 // if this readout has a parent, drop that instance 39 39 if (readout->parent) { 40 psTrace(__func__, 9, "Removing readout %lx from cell %lx...\n", (size_t)readout, (size_t)readout->parent); 40 41 psArray *readouts = readout->parent->readouts; 41 42 for (int i = 0; i < readouts->n; i++) { … … 55 56 static void cellFree(pmCell *cell) 56 57 { 57 psTrace(__func__, 9, "Removing cell %lx from chip %lx...\n", (size_t)cell, (size_t)cell->parent); 58 59 // if this cell has a parent, drop that instance 58 60 if (cell->parent) { 61 psTrace(__func__, 9, "Removing cell %lx from chip %lx...\n", (size_t)cell, (size_t)cell->parent); 59 62 psArray *cells = cell->parent->cells; 60 63 for (int i = 0; i < cells->n; i++) { … … 76 79 static void chipFree(pmChip* chip) 77 80 { 78 psTrace(__func__, 9, "Removing chip %lx from fpa %lx...\n", (size_t)chip, (size_t)chip->parent);81 // if this chip has a parent, drop that instance 79 82 if (chip->parent) { 83 psTrace(__func__, 9, "Removing chip %lx from fpa %lx...\n", (size_t)chip, (size_t)chip->parent); 80 84 psArray *chips = chip->parent->chips; 81 85 for (int i = 0; i < chips->n; i++) { … … 85 89 } 86 90 } 91 87 92 psTrace(__func__, 9, "Freeing chip %lx\n", (size_t)chip); 88 93 pmChipFreeCells(chip); … … 93 98 psFree(chip->hdu); 94 99 psFree(chip->mosaic); 100 101 # if FPA_ASTROM 102 103 psFree(chip->toFPA); 104 psFree(chip->fromFPA); 105 # endif 95 106 } 96 107 … … 99 110 { 100 111 psTrace(__func__, 9, "Freeing fpa %lx\n", (size_t)fpa); 112 113 // NULL the parent pointers 101 114 psArray *chips = fpa->chips; 102 for ( psS32i = 0 ; i < chips->n ; i++) {115 for (int i = 0 ; i < chips->n ; i++) { 103 116 pmChip *tmpChip = chips->data[i]; 104 117 if (! tmpChip) { 105 118 continue; 106 119 } 107 chips->data[i] = NULL;108 120 tmpChip->parent = NULL; 109 121 } … … 113 125 psFree(fpa->camera); 114 126 psFree(fpa->hdu); 127 128 # if FPA_ASTROM 129 130 psFree(fpa->fromTangentPlane); 131 psFree(fpa->toTangentPlane); 132 psFree(fpa->projection); 133 # endif 115 134 } 116 135 … … 127 146 continue; 128 147 } 129 readouts->data[i] = NULL;130 148 tmpReadout->parent = NULL; 131 149 psTrace(__func__, 9, "Will now free readout %lx...\n", (size_t)tmpReadout); 132 psFree(tmpReadout); // Drop the readout133 150 } 134 151 cell->readouts = psArrayRealloc(cell->readouts, 0); … … 149 166 continue; 150 167 } 151 cells->data[i] = NULL;152 168 tmpCell->parent = NULL; 153 169 pmCellFreeReadouts(tmpCell);// Drop all readouts the cell holds 154 psFree(tmpCell); // Drop the cell155 170 } 156 171 chip->cells = psArrayRealloc(chip->cells, 0); … … 221 236 psMemSetDeallocator(tmpChip, (psFreeFunc) chipFree); 222 237 223 tmpChip->analysis = psMetadataAlloc(); 238 # if FPA_ASTROM 239 240 tmpChip->col0 = 0; 241 tmpChip->row0 = 0; 242 tmpChip->toFPA = NULL; 243 tmpChip->fromFPA = NULL; 244 # endif 245 246 tmpChip->analysis = psMetadataAlloc(); 224 247 tmpChip->cells = psArrayAlloc(0); 225 248 tmpChip->parent = fpa; 226 249 if (fpa != NULL) { 227 fpa->chips =psArrayAdd(fpa->chips, 1, (psPtr) tmpChip);250 psArrayAdd(fpa->chips, 1, (psPtr) tmpChip); 228 251 } 229 252 tmpChip->hdu = NULL; … … 239 262 } 240 263 pmConceptsBlankChip(tmpChip); 241 242 264 return(tmpChip); 243 265 } … … 248 270 psMemSetDeallocator(tmpFPA, (psFreeFunc) FPAFree); 249 271 250 tmpFPA->analysis = NULL; 251 tmpFPA->camera = psMemIncrRefCounter((psPtr)camera); 272 # if FPA_ASTROM 273 274 tmpFPA->fromTangentPlane = NULL; 275 tmpFPA->toTangentPlane = NULL; 276 tmpFPA->projection = NULL; 277 # endif 278 279 tmpFPA->analysis = NULL; 280 tmpFPA->camera = psMemIncrRefCounter((psPtr)camera); 252 281 tmpFPA->chips = psArrayAlloc(0); 253 282 tmpFPA->hdu = NULL;
Note:
See TracChangeset
for help on using the changeset viewer.
