// ordinary call void SplitHeuristic::call(Level &L) { m_cm->init(L); buffer = Array<node>(L.size()); recCall(L, 0, L.size() - 1); buffer = Array<node>(-1); }
// SimDraw call void SplitHeuristic::call(Level &L, const EdgeArray<unsigned int> *edgeSubGraph) { // only difference to call is the different calculation of the crossingsmatrix m_cm->init(L, edgeSubGraph); buffer = Array<node>(L.size()); recCall(L, 0, L.size() - 1); buffer = Array<node>(-1); }
void SplitHeuristic::recCall(Level &L, int low, int high) { if (high <= low) return; const Hierarchy &H = L.hierarchy(); CrossingsMatrix &crossings = *m_cm; int up = high, down = low; // chooses L[low] as pivot int i; for (i = low+1; i <= high; i++) { if (crossings(i,low) < crossings(low,i)) buffer[down++] = L[i]; } // use two for-loops in order to keep the number of swaps low for (i = high; i >= low+1; i--) { if (crossings(i,low) >= crossings(low,i)) buffer[up--] = L[i]; } buffer[down] = L[low]; for (i = low; i < high; i++) { int j = H.pos(buffer[i]); if (i != j) { L.swap(i,j); crossings.swap(i,j); } } recCall(L,low,down-1); recCall(L,up+1,high); }
void recTLBWR() { recCall(Interp::TLBWR); }
void recTLBWI() { recCall(Interp::TLBWI); }
void recTLBP() { recCall(Interp::TLBP); }