Commit 5048bd16 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

If task cells are not immediate neighbours, we cannot use these as edge weights, so ignore

These are expected to be gravity tasks
parent 1cd90d07
...@@ -617,41 +617,46 @@ static void repart_edge_metis(int partweights, int bothweights, int timebins, ...@@ -617,41 +617,46 @@ static void repart_edge_metis(int partweights, int bothweights, int timebins,
if (cj->nodeID == nodeID) weights_v[cjd] += 0.5 * w; if (cj->nodeID == nodeID) weights_v[cjd] += 0.5 * w;
} }
if (timebins) { /* Find indices of ci/cj neighbours. Note with gravity these cells may
/* Add weights to edge for all cells based on the expected * not be neighbours, in that case we ignore any edge weight for that
* interaction time (calculated as the time to the last expected * pair. */
* time) as we want to avoid having active cells on the edges, so we int ik = -1;
* cut for that. Note that weight is added to the local and remote for (int k = 26 * cid; k < 26 * nr_cells; k++) {
* cells, as we want to keep both away from any cuts, this can if (inds[k] == cjd) {
* overflow int, so take care. */ ik = k;
int dti = num_time_bins - get_time_bin(ci->ti_end_min); break;
int dtj = num_time_bins - get_time_bin(cj->ti_end_min); }
double dt = (double)(1 << dti) + (double)(1 << dtj); }
/* ci */ /* cj */
int kk; int jk = -1;
for (kk = 26 * cid; inds[kk] != cjd; kk++) for (int k = 26 * cjd; k < 26 * nr_cells; k++) {
; if (inds[k] == cid) {
weights_e[kk] += dt; jk = k;
break;
/* cj */ }
for (kk = 26 * cjd; inds[kk] != cid; kk++) }
; if (ik != -1 && jk != -1) {
weights_e[kk] += dt;
} else { if (timebins) {
/* Add weights to edge for all cells based on the expected
/* Add weights from task costs to the edge. */ * interaction time (calculated as the time to the last expected
* time) as we want to avoid having active cells on the edges, so
/* ci */ * we cut for that. Note that weight is added to the local and
int kk; * remote cells, as we want to keep both away from any cuts, this
for (kk = 26 * cid; inds[kk] != cjd; kk++) * can overflow int, so take care. */
; int dti = num_time_bins - get_time_bin(ci->ti_end_min);
weights_e[kk] += w; int dtj = num_time_bins - get_time_bin(cj->ti_end_min);
double dt = (double)(1 << dti) + (double)(1 << dtj);
/* cj */ weights_e[ik] += dt;
for (kk = 26 * cjd; inds[kk] != cid; kk++) weights_e[jk] += dt;
;
weights_e[kk] += w; } else {
/* Add weights from task costs to the edge. */
weights_e[ik] += w;
weights_e[jk] += w;
}
} }
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment