Skip to content

Commit

Permalink
Merge pull request #4606 from luis201420/grt_overlapped_edges_maze3D_fix
Browse files Browse the repository at this point in the history
Grt: Fixing the overlapped edges after maze3D
  • Loading branch information
eder-matheus authored Feb 5, 2024
2 parents 80fd75d + 0040e27 commit 8840467
Show file tree
Hide file tree
Showing 40 changed files with 9,836 additions and 10,726 deletions.
18 changes: 13 additions & 5 deletions src/grt/src/fastroute/include/FastRoute.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,6 @@ class FastRouteCore
const int L,
float& slack_th);
void convertToMazeroute();
int splitEdge(std::vector<TreeEdge>& treeedges,
std::vector<TreeNode>& treenodes,
int n1,
int n2,
int edge_n1n2);
void updateCongestionHistory(const int upType, bool stopDEC, int& max_adj);
int getOverflow2D(int* maxOverflow);
int getOverflow2Dmaze(int* maxOverflow, int* tUsage);
Expand Down Expand Up @@ -328,6 +323,13 @@ class FastRouteCore

// maze3D functions
void mazeRouteMSMDOrder3D(int expand, int ripupTHlb, int ripupTHub);
void addNeighborPoints(int netID,
int n1,
int n2,
std::vector<int*>& points_heap_3D,
multi_array<int, 3>& dist_3D,
multi_array<Direction, 3>& directions_3D,
multi_array<int, 3>& corr_edge_3D);
void setupHeap3D(int netID,
int edgeID,
std::vector<int*>& src_heap_3D,
Expand Down Expand Up @@ -458,6 +460,12 @@ class FastRouteCore
void releaseNetResources(const int netID);

// utility functions
void setTreeNodesVariables(int netID);
int splitEdge(std::vector<TreeEdge>& treeedges,
std::vector<TreeNode>& treenodes,
int n1,
int n2,
int edge_n1n2);
void printEdge(const int netID, const int edgeID);
void ConvertToFull3DType2();
void fillVIA();
Expand Down
107 changes: 0 additions & 107 deletions src/grt/src/fastroute/src/maze.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1307,113 +1307,6 @@ float getCost(const int i,
return cost;
}

int FastRouteCore::splitEdge(std::vector<TreeEdge>& treeedges,
std::vector<TreeNode>& treenodes,
const int n1,
const int n2,
const int edge_n1n2)
{
const int n2x = treenodes[n2].x;
const int n2y = treenodes[n2].y;

// create new node
const int new_node_id = treenodes.size();
TreeNode new_node;
new_node.x = n2x;
new_node.y = n2y;
new_node.stackAlias = treenodes[n2].stackAlias;

// create new edge
const int new_edge_id = treeedges.size();
TreeEdge new_edge;

// find one neighbor node id different to n1
int nbr;
int edge_n2_nbr; // edge id that connects the neighbor
if (treenodes[n2].nbr[0] == n1) {
nbr = treenodes[n2].nbr[1];
edge_n2_nbr = treenodes[n2].edge[1];
} else {
nbr = treenodes[n2].nbr[0];
edge_n2_nbr = treenodes[n2].edge[0];
}

// update n2 neighbor
int cnt = 0;
for (int i = 0; i < treenodes[n2].nbr_count; i++) {
if (treenodes[n2].nbr[i] == n1) {
continue;
}
if (treenodes[n2].nbr[i] == nbr) {
treenodes[n2].nbr[cnt] = new_node_id;
treenodes[n2].edge[cnt] = new_edge_id;
cnt++;
} else {
treenodes[n2].nbr[cnt] = treenodes[n2].nbr[i];
treenodes[n2].edge[cnt] = treenodes[n2].edge[i];
cnt++;
}
}
treenodes[n2].nbr_count = cnt;

// change edge neighbor
if (treeedges[edge_n2_nbr].n1 == n2) {
treeedges[edge_n2_nbr].n1 = new_node_id;
treeedges[edge_n2_nbr].n1a = new_node.stackAlias;
} else {
treeedges[edge_n2_nbr].n2 = new_node_id;
treeedges[edge_n2_nbr].n2a = new_node.stackAlias;
}

// change current edge
if (treeedges[edge_n1n2].n1 == n2) {
treeedges[edge_n1n2].n1 = new_node_id;
treeedges[edge_n1n2].n1a = new_node.stackAlias;
} else {
treeedges[edge_n1n2].n2 = new_node_id;
treeedges[edge_n1n2].n2a = new_node.stackAlias;
}

// change node neighbor
for (int i = 0; i < treenodes[nbr].nbr_count; i++) {
if (treenodes[nbr].nbr[i] == n2) {
treenodes[nbr].nbr[i] = new_node_id;
}
}

// change n1 node
for (int i = 0; i < treenodes[n1].nbr_count; i++) {
if (treenodes[n1].nbr[i] == n2) {
treenodes[n1].nbr[i] = new_node_id;
}
}

// config new edge
new_edge.len = 0;
new_edge.n1 = new_node_id;
new_edge.n1a = new_node.stackAlias;
new_edge.n2 = n2;
new_edge.n2a = treenodes[n2].stackAlias;
new_edge.route.type = RouteType::MazeRoute;
new_edge.route.routelen = 0;
new_edge.route.gridsX.push_back(n2x);
new_edge.route.gridsY.push_back(n2y);

// config new node
new_node.nbr_count = 3;
new_node.nbr[0] = nbr;
new_node.nbr[1] = n2;
new_node.nbr[2] = n1;
new_node.edge[0] = edge_n2_nbr;
new_node.edge[1] = new_edge_id;
new_node.edge[2] = edge_n1n2;

treeedges.push_back(new_edge);
treenodes.push_back(new_node);

return new_node_id;
}

void FastRouteCore::mazeRouteMSMD(const int iter,
const int expand,
const float cost_height,
Expand Down
Loading

0 comments on commit 8840467

Please sign in to comment.