Last change
on this file since 1441 was
248,
checked in by Matthew Whiting, 17 years ago
|
Non-minor changes are:
- Removed the calls to calcFluxes() in the search routines. These are unnecessary, as the fluxes are re-calculated later, and the values will be irrelevant once the merging is done -- they are just wasting CPU cycles.
- Added user feedback to Cube::ReconSearch?().
- Tweaked areClose.cc to try to improve the efficiency.
- Tweaked mergeIntoList() so that it uses the requested parameters rather than assuming adjacency in all dimensions.
|
File size:
1.3 KB
|
Line | |
---|
1 | #include <vector> |
---|
2 | #include <Cubes/cubes.hh> |
---|
3 | #include <Utils/utils.hh> |
---|
4 | |
---|
5 | void mergeIntoList(Detection &object, std::vector <Detection> &objList, Param &par) |
---|
6 | { |
---|
7 | /** |
---|
8 | * A function to add a detection to a list of detections, checking |
---|
9 | * first to see if it can be combined with existing members of the |
---|
10 | * list. |
---|
11 | * |
---|
12 | * The areClose testing and combining is now done with the |
---|
13 | * parameters as given by the Param set, not just assuming adjacency |
---|
14 | * (as previously done). |
---|
15 | * |
---|
16 | * \param object The Detection to be merged into the list. |
---|
17 | * \param objList The vector list of Detections. |
---|
18 | * \param par The Param set, used for testing if merging needs to be done. |
---|
19 | */ |
---|
20 | |
---|
21 | bool haveMerged = false; |
---|
22 | // bool flagAdjacent = par.getFlagAdjacent(); |
---|
23 | // par.setFlagAdjacent(true); |
---|
24 | // float threshold = par.getThreshV(); |
---|
25 | // par.setThreshV(1.5); |
---|
26 | |
---|
27 | std::vector<Detection>::iterator iter; |
---|
28 | for(int ctr=0; (!(haveMerged) && (ctr<objList.size())); ctr++){ |
---|
29 | |
---|
30 | if(areClose(object, objList[ctr], par)){ |
---|
31 | Detection newobj = objList[ctr] + object; |
---|
32 | iter = objList.begin() + ctr; |
---|
33 | objList.erase( iter ); |
---|
34 | objList.push_back( newobj ); |
---|
35 | haveMerged = true; |
---|
36 | } |
---|
37 | |
---|
38 | } |
---|
39 | |
---|
40 | if(!haveMerged) objList.push_back(object); |
---|
41 | |
---|
42 | // par.setFlagAdjacent(flagAdjacent); |
---|
43 | // par.setThreshV(threshold); |
---|
44 | |
---|
45 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.