Construct brancher
| 229 | }; |
| 230 | /// Construct brancher |
| 231 | NestedSearch(Space& home) : Brancher(home), done(false) { |
| 232 | Radiotherapy& rt = static_cast<Radiotherapy&>(home); |
| 233 | // Set up ordering of rows. As a heuristic, pre-order the rows |
| 234 | // with the potentially cheapest ones first. |
| 235 | index.init(rt.rd.m+1); |
| 236 | for (int i = rt.rd.m; i--; ) { |
| 237 | index[i].idx = i; |
| 238 | index[i].weight = 0; |
| 239 | for (int j = rt.rd.n; j--; ) |
| 240 | index[i].weight += rt.rd.intensity[i*rt.rd.n + j] == 0; |
| 241 | } |
| 242 | Support::quicksort(&(index[0]), rt.rd.m); |
| 243 | for (int i = rt.rd.m; i--; ) |
| 244 | index[i].weight = 0; |
| 245 | index[rt.rd.m].idx = 10; |
| 246 | // A shared object must be disposed properly |
| 247 | home.notice(*this, AP_DISPOSE); |
| 248 | } |
| 249 | /// Copy constructor |
| 250 | NestedSearch(Space& home, NestedSearch& b) |
| 251 | : Brancher(home, b), done(b.done), index(b.index) { |