IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 7, 2013, 8:44:53 AM (13 years ago)
Author:
eugene
Message:

fix md collisions / double free; get the right cells for multiple inputs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130419/pswarp/src/pswarpOverlaps.c

    r35512 r35525  
    166166bool pswarpFindOverlap (pmFPA *input, pmFPA *output, pswarpBounds *src, pswarpBounds *tgt) {
    167167
     168    bool status = false;
     169
    168170    // we have the source and target bounds.  loop over all output elements and check if any of the source
    169171    // elements overlap it.
     
    204206            psArrayAdd (inputChips, 1, input->chips->data[i]);
    205207        }
    206         chip->process = hasOverlap;
     208        chip->process |= hasOverlap;
    207209        if (hasOverlap) {
     210            pmChipSelectCells (chip);
    208211            // get the complete list of input cells for this set of input chips
    209212            // pmConceptsAverageCells needs a psList (not a psArray)
    210             psList *inputCells = psListAlloc(NULL);
     213            psArray *inputCells = psArrayAllocEmpty(8);
    211214            for (int nChip = 0; nChip < inputChips->n; nChip++) {
    212215                pmChip *inputChip = inputChips->data[nChip];
    213216                for (int nCell = 0; nCell < inputChip->cells->n; nCell++) {
    214217                    fprintf (stderr, "input %d, %d : output %d\n", nChip, nCell, j);
    215                     psListAdd (inputCells, PS_LIST_TAIL, inputChip->cells->data[nCell]);
     218                    psArrayAdd (inputCells, 8, inputChip->cells->data[nCell]);
    216219                }
    217220            }
     
    220223            for (int nCell = 0; nCell < chip->cells->n; nCell++) {
    221224                pmCell *outputCell = chip->cells->data[nCell];
    222                 psMetadataAddPtr(outputCell->analysis, PS_LIST_TAIL, "INPUT.CELLS", PS_DATA_LIST , "input cells touching this output cell", inputCells);
     225                psList *outList = psMetadataLookupPtr(&status, outputCell->analysis, "INPUT.CELLS");
     226                if (!outList) {
     227                    outList = psListAlloc(NULL);
     228                    psMetadataAddPtr(outputCell->analysis, PS_LIST_TAIL, "INPUT.CELLS", PS_DATA_LIST , "input cells touching this output cell", outList);
     229                    psFree (outList);
     230                }
     231                for (int nCell = 0; nCell < inputCells->n; nCell ++) {
     232                    psListAdd (outList, PS_LIST_TAIL, inputCells->data[nCell]);
     233                }
    223234            }
    224235            psFree (inputCells);
Note: See TracChangeset for help on using the changeset viewer.