- Timestamp:
- May 5, 2013, 2:20:46 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20130419/pswarp/src/pswarpOverlaps.c
r35434 r35512 45 45 if (!chip->process || !chip->file_exists) { 46 46 // this ensures one entry per chip (regardless of existence) 47 // XXX maybe not?pswarpBoundsAppend (bounds, NAN, NAN, NAN, NAN);47 pswarpBoundsAppend (bounds, NAN, NAN, NAN, NAN); 48 48 continue; 49 49 } … … 83 83 } 84 84 } 85 fprintf (stderr, "bounds %d : %f - %f, %f - %f\n", view->chip, Pmin, Pmax, Qmin, Qmax);85 // fprintf (stderr, "bounds %d : %f - %f, %f - %f\n", view->chip, Pmin, Pmax, Qmin, Qmax); 86 86 pswarpBoundsAppend (bounds, Pmin, Pmax, Qmin, Qmax); 87 87 } … … 164 164 } 165 165 166 bool pswarpFindOverlap (pmFPA * fpa, pswarpBounds *src, pswarpBounds *tgt) {166 bool pswarpFindOverlap (pmFPA *input, pmFPA *output, pswarpBounds *src, pswarpBounds *tgt) { 167 167 168 168 // we have the source and target bounds. loop over all output elements and check if any of the source 169 169 // elements overlap it. 170 170 171 assert (fpa->chips->n == tgt->Pmin->n); 172 173 for (int j = 0; j < fpa->chips->n; j++) { 174 pmChip *chip = fpa->chips->data[j]; 171 // also add the list if input (src) cells which land on each output (tgt) chip we do this 172 // by only identifying the input and output chips and adding all input chip cells to each 173 // output cell 174 175 assert (output->chips->n == tgt->Pmin->n); 176 assert (input->chips->n == src->Pmin->n); 177 178 for (int j = 0; j < output->chips->n; j++) { 179 pmChip *chip = output->chips->data[j]; 175 180 176 181 // we have src bounds … … 180 185 float Qmax = tgt->Qmax->data.F32[j]; 181 186 182 bool valid = false; 183 for (int i = 0; !valid && (i < src->Pmin->n); i++) { 187 psArray *inputChips = psArrayAllocEmpty(8); 188 189 bool hasOverlap = false; 190 for (int i = 0; i < src->Pmin->n; i++) { 184 191 // overlaps in P? 185 bool Pvalid = (Pmin < src->Pmax->data.F32[i]) && (Pmax > src->Pmin->data.F32[i]); 186 bool Qvalid = (Qmin < src->Qmax->data.F32[i]) && (Qmax > src->Qmin->data.F32[i]); 187 valid = Pvalid && Qvalid; 188 } 189 // if (valid) { 190 // fprintf (stderr, "chip %d is valid\n", j); 191 // } else { 192 // fprintf (stderr, "chip %d is NOT valid\n", j); 193 // } 194 chip->process = valid; 192 if (!isfinite(src->Pmin->data.F32[i])) continue; 193 if (!isfinite(src->Pmax->data.F32[i])) continue; 194 if (!isfinite(src->Qmin->data.F32[i])) continue; 195 if (!isfinite(src->Qmax->data.F32[i])) continue; 196 197 if (Pmin > src->Pmax->data.F32[i]) continue; 198 if (Pmax < src->Pmin->data.F32[i]) continue; 199 200 if (Qmin > src->Qmax->data.F32[i]) continue; 201 if (Qmax < src->Qmin->data.F32[i]) continue; 202 203 hasOverlap = true; 204 psArrayAdd (inputChips, 1, input->chips->data[i]); 205 } 206 chip->process = hasOverlap; 207 if (hasOverlap) { 208 // get the complete list of input cells for this set of input chips 209 // pmConceptsAverageCells needs a psList (not a psArray) 210 psList *inputCells = psListAlloc(NULL); 211 for (int nChip = 0; nChip < inputChips->n; nChip++) { 212 pmChip *inputChip = inputChips->data[nChip]; 213 for (int nCell = 0; nCell < inputChip->cells->n; nCell++) { 214 fprintf (stderr, "input %d, %d : output %d\n", nChip, nCell, j); 215 psListAdd (inputCells, PS_LIST_TAIL, inputChip->cells->data[nCell]); 216 } 217 } 218 219 // place the inputCells on each of the output cells 220 for (int nCell = 0; nCell < chip->cells->n; nCell++) { 221 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); 223 } 224 psFree (inputCells); 225 } 226 psFree (inputChips); 195 227 } 196 228 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
