- Timestamp:
- Jun 7, 2014, 5:38:26 AM (12 years ago)
- Location:
- branches/eam_branches/ipp-20140423/psphot/src
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
psphotFullForceSummary.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20140423/psphot/src
- Property svn:mergeinfo changed
/trunk/psphot/src merged: 36701,36718,36731,36734,36747,36754,36757,36759
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20140423/psphot/src/psphotFullForceSummary.c
r36666 r36828 186 186 psFitsClose(fits); 187 187 188 // Convert to an array indexed by ID 189 psArray *sortedTable = psArrayAlloc(4*inTable->n); 188 // Convert to a set of arrays indexed by model type + 1 189 // which contain pointers to arrays indexed by ID 190 #define MAX_MODEL_TYPE 10 191 psArray *sortedTables = psArrayAlloc(MAX_MODEL_TYPE+1); 190 192 for (int i=0; i<inTable->n; i++) { 191 193 psMetadata *row = inTable->data[i]; 192 194 psS32 ID = psMetadataLookupS32(&status, row, "ID"); 195 psS32 modelType = psMetadataLookupS32(&status, row, "MODEL_TYPE"); 196 // XXX: need to use the lookup table functions to be ready for changes in the model type numbers 197 if (modelType+1 >= MAX_MODEL_TYPE) { 198 psError(PSPHOT_ERR_CONFIG, false, "found modelType %d max allowed is %d", modelType, MAX_MODEL_TYPE); 199 return false; 200 } 201 psArray *sortedTable = sortedTables->data[modelType+1]; 202 if (!sortedTable) { 203 sortedTable = psArrayAlloc(4*inTable->n); 204 sortedTables->data[modelType+1] = sortedTable; 205 // dont' free sortedTable the array of tables gets our reference 206 } 193 207 if (ID >= sortedTable->n) { 194 208 sortedTable = psArrayRealloc(sortedTable, 2*ID); 195 209 // Why doesn't psArrayRealloc do this????? 196 sortedTable->n = sortedTable->nalloc;210 sortedTable->n = sortedTable->nalloc; 197 211 } 198 212 if (sortedTable->data[ID]) { … … 202 216 sortedTable->data[ID] = psMemIncrRefCounter(row); 203 217 } 204 psMetadataAddArray(config->arguments, PS_LIST_TAIL, "CFF_TABLE ", PS_META_REPLACE, "cff table", sortedTable);218 psMetadataAddArray(config->arguments, PS_LIST_TAIL, "CFF_TABLES", PS_META_REPLACE, "cff tables", sortedTables); 205 219 psFree(inTable); 206 psFree(sortedTable );220 psFree(sortedTables); 207 221 208 222 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
