pcb 4.1.1
An interactive printed circuit board layout editor.

toporouter.c File Reference

Topological Autorouter for PCB. More...

#include "toporouter.h"
#include "pcb-printf.h"
Include dependency graph for toporouter.c:

Go to the source code of this file.

Data Structures

struct  toporouter_heap_search_data_t

Defines

#define BOARD_EDGE_RESOLUTION   MIL_TO_COORD (100.)
#define VIA_COST_AS_DISTANCE   MIL_TO_COORD (100.)
#define ROAR_DETOUR_THRESHOLD   MIL_TO_COORD (10.)
#define MARGIN   10.0f
#define tv_on_layer(v, l)   (l == TOPOROUTER_BBOX(TOPOROUTER_VERTEX(v)->boxes->data)->layer)
#define VERTEX_CENTRE(x)   TOPOROUTER_VERTEX( vertex_bbox(x)->point )
#define DEBUG_CLUSTER_FIND   1
#define FCOST(x)   (x->gcost + x->hcost)
#define closelist_insert(p)   closelist = g_list_prepend(closelist, p)
#define edge_gradient(e)
#define toporouter_edge_gradient(e)   (cartesian_gradient(vx(edge_v1(e)), vy(edge_v1(e)), vx(edge_v2(e)), vy(edge_v2(e))))
#define edge_is_blocked(e)   (TOPOROUTER_IS_EDGE(e) ? (e->flags & EDGE_FLAG_DIRECTCONNECTION) : 0)
#define vlayer(x)   (&r->layers[(int)vz(x)])
#define TEST_AND_INSERT(z)   if(d > EPSILON) arcs = g_list_prepend(arcs, new_rubberband_arc(v, z, arcr, d, arcwind, i));
#define ARC_CHECKS(z)
#define REMOVE_ROUTING(x)
#define INSERT_ROUTING(x)

Functions

static void toporouter_edge_init (toporouter_edge_t *edge)
 Initialise an edge.
toporouter_edge_class_ttoporouter_edge_class (void)
static void toporouter_bbox_init (toporouter_bbox_t *box)
 Initialise a bounding box.
toporouter_bbox_class_ttoporouter_bbox_class (void)
static void toporouter_vertex_class_init (toporouter_vertex_class_t *klass)
 Initialise a vertex class.
static void toporouter_vertex_init (toporouter_vertex_t *vertex)
 Initialise a vertex.
toporouter_vertex_class_ttoporouter_vertex_class (void)
static void toporouter_constraint_class_init (toporouter_constraint_class_t *klass)
 Initialise a constraint class.
static void toporouter_constraint_init (toporouter_constraint_t *constraint)
 Initialise a constraint.
toporouter_constraint_class_ttoporouter_constraint_class (void)
static void toporouter_arc_init (toporouter_arc_t *arc)
 Initialise an arc.
toporouter_arc_class_ttoporouter_arc_class (void)
drawing_context_ttoporouter_output_init (int w, int h, char *filename)
 Initialise output.
void toporouter_output_close (drawing_context_t *dc)
 Close output.
gdouble lookup_keepaway (char *name)
 Lookup a keepaway.
gdouble lookup_thickness (char *name)
 Lookup thickness.
static gdouble cluster_keepaway (toporouter_cluster_t *cluster)
static gdouble cluster_thickness (toporouter_cluster_t *cluster)
gint toporouter_draw_vertex (gpointer item, gpointer data)
 Draw a vertex.
gint toporouter_draw_edge (gpointer item, gpointer data)
 Draw an edge.
toporouter_bbox_tvertex_bbox (toporouter_vertex_t *v)
 *
char * vertex_netlist (toporouter_vertex_t *v)
char * constraint_netlist (toporouter_constraint_t *c)
static guint epsilon_equals (gdouble a, gdouble b)
void print_bbox (toporouter_bbox_t *box)
 Print a bounding box.
void print_vertex (toporouter_vertex_t *v)
 Print a vertex.
gdouble vertex_net_thickness (toporouter_vertex_t *v)
gdouble vertex_net_keepaway (toporouter_vertex_t *v)
static void point_from_point_to_point (toporouter_vertex_t *a, toporouter_vertex_t *b, double d, double *x, double *y)
 Fills in x and y with coordinates of point from a towards b of distance d.
static gint coord_wind (gdouble ax, gdouble ay, gdouble bx, gdouble by, gdouble cx, gdouble cy)
int point_wind (GtsPoint *a, GtsPoint *b, GtsPoint *c)
 
static int vertex_wind (GtsVertex *a, GtsVertex *b, GtsVertex *c)
static int tvertex_wind (toporouter_vertex_t *a, toporouter_vertex_t *b, toporouter_vertex_t *c)
static void coord_move_towards_coord_values (double ax, double ay, double px, double py, double d, double *x, double *y)
 Moves vertex v d units in the direction of vertex p.
static void vertex_move_towards_vertex_values (GtsVertex *v, GtsVertex *p, double d, double *x, double *y)
 Moves vertex v d units in the direction of vertex p.
static gdouble min_spacing (toporouter_vertex_t *v1, toporouter_vertex_t *v2)
static gdouble min_vertex_net_spacing (toporouter_vertex_t *v1, toporouter_vertex_t *v2)
static gdouble min_oproute_vertex_spacing (toporouter_oproute_t *oproute, toporouter_vertex_t *v2)
gdouble min_oproute_net_spacing (toporouter_oproute_t *oproute, toporouter_vertex_t *v2)
gdouble min_net_net_spacing (toporouter_vertex_t *v1, toporouter_vertex_t *v2)
void toporouter_draw_cluster (toporouter_t *r, drawing_context_t *dc, toporouter_cluster_t *cluster, gdouble red, gdouble green, gdouble blue, guint layer)
void toporouter_draw_surface (toporouter_t *r, GtsSurface *s, char *filename, int w, int h, int mode, GList *datas, int layer, GList *candidatepoints)
void toporouter_layer_free (toporouter_layer_t *l)
 Free a layer.
guint groupcount (void)
void toporouter_free (toporouter_t *r)
int wind (toporouter_spoint_t *p1, toporouter_spoint_t *p2, toporouter_spoint_t *p3)
 
static void print_toporouter_constraint (toporouter_constraint_t *tc)
static void print_toporouter_vertex (toporouter_vertex_t *tv)
static void vertices_on_line (toporouter_spoint_t *a, double m, double r, toporouter_spoint_t *b0, toporouter_spoint_t *b1)
 
static void coords_on_line (double ax, gdouble ay, double m, double r, double *b0x, double *b0y, double *b1x, double *b1y)
 
gdouble vertex_gradient (toporouter_spoint_t *a, toporouter_spoint_t *b)
 Returns gradient of segment given by a & b.
static gdouble cartesian_gradient (gdouble x0, gdouble y0, gdouble x1, gdouble y1)
 Returns gradient of segment given by (x0,y0) & (x1,y1).
static gdouble point_gradient (GtsPoint *a, GtsPoint *b)
 Returns gradient of segment given by (x0,y0) & (x1,y1).
gdouble segment_gradient (GtsSegment *s)
gdouble perpendicular_gradient (gdouble m)
 Returns gradient perpendicular to m.
gdouble vertices_plane_distance (toporouter_spoint_t *a, toporouter_spoint_t *b)
 Returns the distance between two vertices in the x-y plane.
static void vertex_outside_segment (toporouter_spoint_t *a, toporouter_spoint_t *b, gdouble r, toporouter_spoint_t *p)
 Finds the point p distance r away from a on the line segment of a & b.
static bool coord_intersect_prop (double ax, double ay, double bx, double by, double cx, double cy, double dx, double dy)
 
static bool point_intersect_prop (GtsPoint *a, GtsPoint *b, GtsPoint *c, GtsPoint *d)
 
static int vertex_intersect_prop (GtsVertex *a, GtsVertex *b, GtsVertex *c, GtsVertex *d)
 
GtsVertexvertex_intersect (GtsVertex *a, GtsVertex *b, GtsVertex *c, GtsVertex *d)
 
void coord_intersect (gdouble ax, gdouble ay, gdouble bx, gdouble by, gdouble cx, gdouble cy, gdouble dx, gdouble dy, gdouble *rx, gdouble *ry)
 
int point_between (GtsPoint *a, GtsPoint *b, GtsPoint *c)
 
static int vertex_between (GtsVertex *a, GtsVertex *b, GtsVertex *c)
void delaunay_create_from_vertices (GList *vertices, GtsSurface **surface, GtsTriangle **t)
GSList * list_to_slist (GList *i)
toporouter_bbox_ttoporouter_bbox_create_from_points (int layer, GList *vertices, toporouter_term_t type, gpointer data)
toporouter_bbox_ttoporouter_bbox_create (int layer, GList *vertices, toporouter_term_t type, gpointer data)
GtsVertexinsert_vertex (toporouter_t *r, toporouter_layer_t *l, gdouble x, gdouble y, toporouter_bbox_t *box)
GList * insert_constraint_edge (toporouter_t *r, toporouter_layer_t *l, gdouble x1, gdouble y1, guint flags1, gdouble x2, gdouble y2, guint flags2, toporouter_bbox_t *box)
void insert_constraints_from_list (toporouter_t *r, toporouter_layer_t *l, GList *vlist, toporouter_bbox_t *box)
void insert_centre_point (toporouter_t *r, toporouter_layer_t *l, gdouble x, gdouble y)
GtsPointmidpoint (GtsPoint *a, GtsPoint *b)
static gdouble pad_rad (PadType *pad)
static gdouble pin_rad (PinType *pin)
GList * rect_with_attachments (gdouble rad, gdouble x0, gdouble y0, gdouble x1, gdouble y1, gdouble x2, gdouble y2, gdouble x3, gdouble y3, gdouble z)
int read_pads (toporouter_t *r, toporouter_layer_t *l, guint layer)
 Read pad data from layer into toporouter_layer_t struct.
int read_points (toporouter_t *r, toporouter_layer_t *l, int layer)
 Read points data (all layers) into GList.
int read_lines (toporouter_t *r, toporouter_layer_t *l, LayerType *layer, int ln)
 Read line data from layer into toporouter_layer_t struct.
static void create_board_edge (double x0, double y0, double x1, double y1, int layer, GList **vlist)
static void read_board_constraints (toporouter_t *r, toporouter_layer_t *l, int layer)
gdouble triangle_cost (GtsTriangle *t, gpointer *data)
void print_constraint (toporouter_constraint_t *e)
void print_edge (toporouter_edge_t *e)
static void pick_first_face (GtsFace *f, GtsFace **first)
void unconstrain (toporouter_layer_t *l, toporouter_constraint_t *c)
void build_cdt (toporouter_t *r, toporouter_layer_t *l)
gint visited_cmp (gconstpointer a, gconstpointer b)
static double coord_angle (double ax, double ay, double bx, double by)
GList * cluster_vertices (toporouter_t *r, toporouter_cluster_t *c)
void print_cluster (toporouter_cluster_t *c)
toporouter_cluster_tcluster_create (toporouter_t *r, toporouter_netlist_t *netlist)
toporouter_bbox_ttoporouter_bbox_locate (toporouter_t *r, toporouter_term_t type, void *data, gdouble x, gdouble y, guint layergroup)
void cluster_join_bbox (toporouter_cluster_t *cluster, toporouter_bbox_t *box)
toporouter_netlist_tnetlist_create (toporouter_t *r, char *netlist, char *style)
void import_clusters (toporouter_t *r)
void import_geometry (toporouter_t *r)
gint compare_points (gconstpointer a, gconstpointer b)
gint compare_segments (gconstpointer a, gconstpointer b)
toporouter_cluster_tcluster_find (toporouter_t *r, gdouble x, gdouble y, gdouble z)
gdouble simple_h_cost (toporouter_t *r, toporouter_vertex_t *curpoint, toporouter_vertex_t *destpoint)
gdouble route_heap_cmp (gpointer item, gpointer data)
void toporouter_heap_search (gpointer data, gpointer user_data)
static gdouble angle_span (gdouble a1, gdouble a2)
gdouble edge_capacity (toporouter_edge_t *e)
gdouble edge_flow (toporouter_edge_t *e, toporouter_vertex_t *v1, toporouter_vertex_t *v2, toporouter_vertex_t *dest)
void print_path (GList *path)
GList * split_path (GList *path)
gint routing_edge_insert (gconstpointer a, gconstpointer b, gpointer user_data)
 Sorting into ascending distance from v1.
toporouter_vertex_tnew_temp_toporoutervertex (gdouble x, gdouble y, toporouter_edge_t *e)
toporouter_vertex_tnew_temp_toporoutervertex_in_segment (toporouter_edge_t *e, toporouter_vertex_t *v, gdouble r, toporouter_vertex_t *ref)
 Create vertex on edge e at radius r from v, closest to ref.
gint vertex_keepout_test (toporouter_t *r, toporouter_vertex_t *v)
void closest_cluster_pair (toporouter_t *r, GList *src_vertices, GList *dest_vertices, toporouter_vertex_t **a, toporouter_vertex_t **b)
toporouter_vertex_tclosest_dest_vertex (toporouter_t *r, toporouter_vertex_t *v, toporouter_route_t *routedata)
gdouble triangle_interior_capacity (GtsTriangle *t, toporouter_vertex_t *v)
 Returns the capacity of the triangle cut through v.
static toporouter_vertex_tsegment_common_vertex (GtsSegment *s1, GtsSegment *s2)
static toporouter_vertex_troute_vertices_common_vertex (toporouter_vertex_t *v1, toporouter_vertex_t *v2)
static guint edges_third_edge (GtsSegment *s1, GtsSegment *s2, toporouter_vertex_t **v1, toporouter_vertex_t **v2)
gdouble flow_from_edge_to_edge (GtsTriangle *t, toporouter_edge_t *e1, toporouter_edge_t *e2, toporouter_vertex_t *common_v, toporouter_vertex_t *curpoint)
 Returns the flow from e1 to e2, and the flow from the vertex oppisate e1 to e1 and the vertex oppisate e2 to e2.
guint check_triangle_interior_capacity (GtsTriangle *t, toporouter_vertex_t *v, toporouter_vertex_t *curpoint, toporouter_edge_t *op_edge, toporouter_edge_t *adj_edge1, toporouter_edge_t *adj_edge2)
toporouter_vertex_tedge_routing_next_not_temp (toporouter_edge_t *e, GList *list)
toporouter_vertex_tedge_routing_prev_not_temp (toporouter_edge_t *e, GList *list)
void edge_adjacent_vertices (toporouter_edge_t *e, toporouter_vertex_t *v, toporouter_vertex_t **v1, toporouter_vertex_t **v2)
GList * candidate_vertices (toporouter_vertex_t *v1, toporouter_vertex_t *v2, toporouter_vertex_t *dest, toporouter_edge_t *e)
GList * edge_routing_first_not_temp (toporouter_edge_t *e)
GList * edge_routing_last_not_temp (toporouter_edge_t *e)
void delete_vertex (toporouter_vertex_t *v)
GList * triangle_candidate_points_from_vertex (GtsTriangle *t, toporouter_vertex_t *v, toporouter_vertex_t *dest, toporouter_route_t *routedata)
void routedata_insert_temppoints (toporouter_route_t *data, GList *temppoints)
static gint constraint_route_test (toporouter_constraint_t *c, toporouter_route_t *routedata)
GList * all_candidates_on_edge (toporouter_edge_t *e, toporouter_route_t *routedata)
GList * triangle_all_candidate_points_from_vertex (GtsTriangle *t, toporouter_vertex_t *v, toporouter_route_t *routedata)
GList * triangle_all_candidate_points_from_edge (toporouter_t *r, GtsTriangle *t, toporouter_edge_t *e, toporouter_route_t *routedata, toporouter_vertex_t **dest, toporouter_vertex_t *curpoint)
GList * triangle_candidate_points_from_edge (toporouter_t *r, GtsTriangle *t, toporouter_edge_t *e, toporouter_vertex_t *v, toporouter_vertex_t **dest, toporouter_route_t *routedata)
GList * compute_candidate_points (toporouter_t *tr, toporouter_layer_t *l, toporouter_vertex_t *curpoint, toporouter_route_t *data, toporouter_vertex_t **closestdest)
gboolean temp_point_clean (gpointer key, gpointer value, gpointer user_data)
void clean_routing_edges (toporouter_t *r, toporouter_route_t *data)
gdouble path_score (toporouter_t *r, GList *path)
void print_vertices (GList *vertices)
gint space_edge (gpointer item, gpointer data)
void swap_vertices (toporouter_vertex_t **v1, toporouter_vertex_t **v2)
void split_edge_routing (toporouter_vertex_t *v, GList **l1, GList **l2)
GList * vertices_routing_conflicts (toporouter_vertex_t *v, toporouter_vertex_t *pv)
gdouble vertices_routing_conflict_cost (toporouter_t *r, toporouter_vertex_t *v, toporouter_vertex_t *pv, guint *n)
gdouble gcost (toporouter_t *r, toporouter_route_t *data, toporouter_vertex_t *srcv, toporouter_vertex_t *v, toporouter_vertex_t *pv, guint *n, toporouter_netlist_t *pair)
guint candidate_is_available (toporouter_vertex_t *pv, toporouter_vertex_t *v)
GList * route (toporouter_t *r, toporouter_route_t *data, guint debug)
void vertex_move_towards_vertex (GtsVertex *v, GtsVertex *p, double d)
gdouble pathvertex_arcing_through_constraint (toporouter_vertex_t *pathv, toporouter_vertex_t *arcv)
gint vertices_connected (toporouter_vertex_t *a, toporouter_vertex_t *b)
gdouble edge_min_spacing (GList *list, toporouter_edge_t *e, toporouter_vertex_t *v, guint debug)
guint vertex_line_normal_intersection (gdouble x1, gdouble y1, gdouble x2, gdouble y2, gdouble x3, gdouble y3, gdouble *x, gdouble *y)
void print_toporouter_arc (toporouter_arc_t *arc)
void toporouter_arc_remove (toporouter_oproute_t *oproute, toporouter_arc_t *arc)
toporouter_arc_ttoporouter_arc_new (toporouter_oproute_t *oproute, toporouter_vertex_t *v1, toporouter_vertex_t *v2, toporouter_vertex_t *centre, gdouble r, gint dir)
void path_set_oproute (GList *path, toporouter_oproute_t *oproute)
void print_oproute (toporouter_oproute_t *oproute)
gdouble export_pcb_drawline (guint layer, guint x0, guint y0, guint x1, guint y1, guint thickness, guint keepaway)
gdouble arc_angle (toporouter_arc_t *arc)
gdouble export_pcb_drawarc (guint layer, toporouter_arc_t *a, guint thickness, guint keepaway)
void calculate_term_to_arc (toporouter_vertex_t *v, toporouter_arc_t *arc, guint dir)
void arc_ortho_projections (toporouter_arc_t *arc, toporouter_arc_t *narc, gdouble *b1, gdouble *b2)
 
guint calculate_arc_to_arc (toporouter_t *ar, toporouter_arc_t *parc, toporouter_arc_t *arc)
void export_oproutes (toporouter_t *ar, toporouter_oproute_t *oproute)
void oproute_free (toporouter_oproute_t *oproute)
void oproute_calculate_tof (toporouter_oproute_t *oproute)
gdouble line_line_distance_at_normal (gdouble line1_x1, gdouble line1_y1, gdouble line1_x2, gdouble line1_y2, gdouble line2_x1, gdouble line2_y1, gdouble line2_x2, gdouble line2_y2, gdouble x, gdouble y)
void calculate_serpintine (gdouble delta, gdouble r, gdouble initiala, gdouble *a, guint *nhalfcycles)
gdouble oproute_min_spacing (toporouter_oproute_t *a, toporouter_oproute_t *b)
gdouble vector_angle (gdouble ox, gdouble oy, gdouble ax, gdouble ay, gdouble bx, gdouble by)
toporouter_serpintine_ttoporouter_serpintine_new (gdouble x, gdouble y, gdouble x0, gdouble y0, gdouble x1, gdouble y1, gpointer start, gdouble halfa, gdouble radius, guint nhalfcycles)
gdouble check_non_intersect_vertex (gdouble x0, gdouble y0, gdouble x1, gdouble y1, toporouter_vertex_t *pathv, toporouter_vertex_t *arcv, toporouter_vertex_t *opv, gint wind, gint *arcwind, gdouble *arcr, guint debug)
gdouble check_intersect_vertex (gdouble x0, gdouble y0, gdouble x1, gdouble y1, toporouter_vertex_t *pathv, toporouter_vertex_t *arcv, toporouter_vertex_t *opv, gint wind, gint *arcwind, gdouble *arcr, guint debug)
guint check_arc_for_loops (gpointer t1, toporouter_arc_t *arc, gpointer t2)
 Returns non-zero if arc has loops.
toporouter_rubberband_arc_tnew_rubberband_arc (toporouter_vertex_t *pathv, toporouter_vertex_t *arcv, gdouble r, gdouble d, gint wind, GList *list)
gint compare_rubberband_arcs (toporouter_rubberband_arc_t *a, toporouter_rubberband_arc_t *b)
void free_list_elements (gpointer data, gpointer user_data)
gdouble check_adj_pushing_vertex (toporouter_oproute_t *oproute, gdouble x0, gdouble y0, gdouble x1, gdouble y1, toporouter_vertex_t *v, gdouble *arcr, gint *arcwind, toporouter_vertex_t **arc)
GList * oproute_rubberband_segment (toporouter_t *r, toporouter_oproute_t *oproute, GList *path, gpointer t1, gpointer t2, guint debug)
 
void oproute_check_all_loops (toporouter_t *r, toporouter_oproute_t *oproute)
GtsTriangleopposite_triangle (GtsTriangle *t, toporouter_edge_t *e)
void speccut_edge_routing_from_edge (GList *i, toporouter_edge_t *e)
void speccut_edge_patch_links (toporouter_edge_t *e)
gint check_speccut (toporouter_oproute_t *oproute, toporouter_vertex_t *v1, toporouter_vertex_t *v2, toporouter_edge_t *e, toporouter_edge_t *e1, toporouter_edge_t *e2)
gint oproute_path_speccut (toporouter_oproute_t *oproute)
toporouter_oproute_toproute_rubberband (toporouter_t *r, GList *path)
void toporouter_export (toporouter_t *r)
toporouter_route_troutedata_create (void)
toporouter_route_timport_route (toporouter_t *r, RatType *line)
void delete_route (toporouter_route_t *routedata, guint destroy)
void remove_route (GList *path)
 Remove route can be later reapplied.
gint apply_route (GList *path, toporouter_route_t *routedata)
gint compare_routedata_ascending (gconstpointer a, gconstpointer b)
void print_costmatrix (gdouble *m, guint n)
static void init_cost_matrix (gdouble *m, guint n)
toporouter_netscore_tnetscore_create (toporouter_t *r, toporouter_route_t *routedata, guint n, guint id)
static void netscore_destroy (toporouter_netscore_t *netscore)
void print_netscores (GPtrArray *netscores)
void netscore_pairwise_calculation (toporouter_netscore_t *netscore, GPtrArray *netscores)
gint netscore_pairwise_size_compare (toporouter_netscore_t **a, toporouter_netscore_t **b)
gint netscore_pairwise_compare (toporouter_netscore_t **a, toporouter_netscore_t **b)
guint order_nets_preroute_greedy (toporouter_t *r, GList *nets, GList **rnets)
toporouter_vertex_tedge_closest_vertex (toporouter_edge_t *e, toporouter_vertex_t *v)
void snapshot (toporouter_t *r, char *name, GList *datas)
GList * route_conflicts (toporouter_route_t *route)
gint spread_edge (gpointer item, gpointer data)
void route_checkpoint (toporouter_route_t *route, toporouter_route_t *temproute)
void route_restore (toporouter_route_t *route)
void cluster_merge (toporouter_route_t *routedata)
void netlist_recalculate (toporouter_netlist_t *netlist, GList *ignore)
void netlists_recalculate (GList *netlists, GList *ignore)
void netlists_rollback (GList *netlists)
void print_netlist (toporouter_netlist_t *netlist)
gint roar_route (toporouter_t *r, toporouter_route_t *routedata, gint threshold)
gint roar_router (toporouter_t *r, gint failcount, gint threshold)
gint route_detour_compare (toporouter_route_t **a, toporouter_route_t **b)
void roar_detour_route (toporouter_t *r, toporouter_route_t *data)
void detour_router (toporouter_t *r)
gint rubix_router (toporouter_t *r, gint failcount)
guint hybrid_router (toporouter_t *r)
void parse_arguments (toporouter_t *r, int argc, char **argv)
toporouter_ttoporouter_new (void)
void acquire_twonets (toporouter_t *r)
toporouter_netlist_tfind_netlist_by_name (toporouter_t *r, char *name)
gint toporouter_set_pair (toporouter_t *r, toporouter_netlist_t *n1, toporouter_netlist_t *n2)
static int toporouter (int argc, char **argv, Coord x, Coord y)
static int escape (int argc, char **argv, Coord x, Coord y)
void hid_toporouter_init ()

Variables

static HID_Action toporouter_action_list []

Detailed Description

Topological Autorouter for PCB.


Copyright.


Topological Autorouter for PCB, interactive printed circuit board design

Copyright (C) 2009 Anthony Blake

Copyright (C) 2009-2011 PCB Contributors (see ChangeLog for details)

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Contact addresses for email: Anthony Blake, tonyb33@gmail.com

Warning:
This is *EXPERIMENTAL* code.

As the code is experimental, the algorithms and code are likely to change. Which means it isn't documented or optimized. If you would like to learn about Topological Autorouters, the following papers are good starting points:

This file implements a topological autorouter, and uses techniques from the following publications:

Dayan, T. and Dai, W.W.M., "Layer Assignment for a Rubber Band Router" Tech Report UCSC-CRL-92-50, Univ. of California, Santa Cruz, 1992.

Dai, W.W.M and Dayan, T. and Staepelaere, D., "Topological Routing in SURF: Generating a Rubber-Band Sketch" Proc. 28th ACM/IEEE Design Automation Conference, 1991, pp. 39-44.

David Staepelaere, Jeffrey Jue, Tal Dayan, Wayne Wei-Ming Dai, "SURF: Rubber-Band Routing System for Multichip Modules," IEEE Design and Test of Computers ,vol. 10, no. 4, pp. 18-26, October/December, 1993.

Dayan, T., "Rubber-band based topological router" PhD Thesis, Univ. of California, Santa Cruz, 1997.

David Staepelaere, "Geometric transformations for a rubber-band sketch" Master's thesis, Univ. of California, Santa Cruz, September 1992.

Definition in file toporouter.c.


Define Documentation

#define ARC_CHECKS (   z)
Value:
(!(arc1 && arc1->centre == z) && !(arc2 && arc2->centre == z) && \
  !(TOPOROUTER_IS_VERTEX(t1) && z == v1) && !(TOPOROUTER_IS_VERTEX(t2) && z == v2))

Referenced by oproute_rubberband_segment().

#define BOARD_EDGE_RESOLUTION   MIL_TO_COORD (100.)

Definition at line 68 of file toporouter.c.

Referenced by create_board_edge().

#define closelist_insert (   p)    closelist = g_list_prepend(closelist, p)

Definition at line 2908 of file toporouter.c.

Referenced by route().

#define DEBUG_CLUSTER_FIND   1

Definition at line 2829 of file toporouter.c.

#define edge_gradient (   e)
Value:

Definition at line 3054 of file toporouter.c.

Referenced by new_temp_toporoutervertex_in_segment().

#define edge_is_blocked (   e)    (TOPOROUTER_IS_EDGE(e) ? (e->flags & EDGE_FLAG_DIRECTCONNECTION) : 0)
#define FCOST (   x)    (x->gcost + x->hcost)

Definition at line 2901 of file toporouter.c.

Referenced by route_heap_cmp().

#define INSERT_ROUTING (   x)
Value:
x->netlist->routed = g_list_prepend(x->netlist->routed, x); \
  r->routednets = g_list_prepend(r->routednets, x); \
  r->failednets = g_list_remove(r->failednets, x)

Definition at line 7304 of file toporouter.c.

Referenced by roar_detour_route(), roar_route(), and rubix_router().

#define MARGIN   10.0f
#define REMOVE_ROUTING (   x)
Value:
x->netlist->routed = g_list_remove(x->netlist->routed, x); \
  r->routednets = g_list_remove(r->routednets, x); \
  r->failednets = g_list_prepend(r->failednets, x)

Definition at line 7300 of file toporouter.c.

Referenced by roar_detour_route(), and roar_route().

#define ROAR_DETOUR_THRESHOLD   MIL_TO_COORD (10.)

Definition at line 70 of file toporouter.c.

Referenced by detour_router().

#define TEST_AND_INSERT (   z)    if(d > EPSILON) arcs = g_list_prepend(arcs, new_rubberband_arc(v, z, arcr, d, arcwind, i));
#define toporouter_edge_gradient (   e)    (cartesian_gradient(vx(edge_v1(e)), vy(edge_v1(e)), vx(edge_v2(e)), vy(edge_v2(e))))

Definition at line 3231 of file toporouter.c.

Referenced by triangle_interior_capacity().

#define tv_on_layer (   v,
 
)    (l == TOPOROUTER_BBOX(TOPOROUTER_VERTEX(v)->boxes->data)->layer)

Definition at line 846 of file toporouter.c.

#define VERTEX_CENTRE (   x)    TOPOROUTER_VERTEX( vertex_bbox(x)->point )

Definition at line 1787 of file toporouter.c.

#define VIA_COST_AS_DISTANCE   MIL_TO_COORD (100.)

Definition at line 69 of file toporouter.c.

Referenced by toporouter_new().

#define vlayer (   x)    (&r->layers[(int)vz(x)])

Definition at line 4657 of file toporouter.c.

Referenced by route().


Function Documentation

void acquire_twonets ( toporouter_t r)

Definition at line 7699 of file toporouter.c.

References PCBType::Data, END_LOOP, import_route(), line, PCB, RAT_LOOP, _toporouter_t::routes, and TEST_FLAG.

Referenced by toporouter().

Here is the call graph for this function:

static gdouble angle_span ( gdouble  a1,
gdouble  a2 
) [inline, static]

Definition at line 2931 of file toporouter.c.

References M_PI.

void arc_ortho_projections ( toporouter_arc_t arc,
toporouter_arc_t narc,
gdouble *  b1,
gdouble *  b2 
)

b1 is the projection in the direction of narc, while b2 is the perpendicular projection.

Definition at line 5391 of file toporouter.c.

References c, _toporouter_arc_t::centre, vx, vy, _toporouter_arc_t::x0, and _toporouter_arc_t::y0.

Referenced by calculate_arc_to_arc().

void calculate_serpintine ( gdouble  delta,
gdouble  r,
gdouble  initiala,
gdouble *  a,
guint *  nhalfcycles 
)

Definition at line 5746 of file toporouter.c.

References M_PI, and n.

guint candidate_is_available ( toporouter_vertex_t pv,
toporouter_vertex_t v 
)

Definition at line 4660 of file toporouter.c.

References _toporouter_vertex_t::parent.

Referenced by route().

static gdouble cartesian_gradient ( gdouble  x0,
gdouble  y0,
gdouble  x1,
gdouble  y1 
) [inline, static]

Returns gradient of segment given by (x0,y0) & (x1,y1).

Definition at line 1321 of file toporouter.c.

References epsilon_equals().

Referenced by check_non_intersect_vertex(), line_line_distance_at_normal(), point_gradient(), read_pads(), segment_gradient(), and vertex_line_normal_intersection().

Here is the call graph for this function:

gdouble check_adj_pushing_vertex ( toporouter_oproute_t oproute,
gdouble  x0,
gdouble  y0,
gdouble  x1,
gdouble  y1,
toporouter_vertex_t v,
gdouble *  arcr,
gint *  arcwind,
toporouter_vertex_t **  arc 
)
guint check_arc_for_loops ( gpointer  t1,
toporouter_arc_t arc,
gpointer  t2 
)

Returns non-zero if arc has loops.

Definition at line 5906 of file toporouter.c.

References coord_intersect_prop(), TOPOROUTER_ARC, TOPOROUTER_IS_VERTEX, TOPOROUTER_VERTEX, vx, vy, _toporouter_arc_t::x0, _toporouter_arc_t::x1, _toporouter_arc_t::y0, and _toporouter_arc_t::y1.

Referenced by oproute_check_all_loops().

Here is the call graph for this function:

gdouble check_intersect_vertex ( gdouble  x0,
gdouble  y0,
gdouble  x1,
gdouble  y1,
toporouter_vertex_t pathv,
toporouter_vertex_t arcv,
toporouter_vertex_t opv,
gint  wind,
gint *  arcwind,
gdouble *  arcr,
guint  debug 
)
gdouble check_non_intersect_vertex ( gdouble  x0,
gdouble  y0,
gdouble  x1,
gdouble  y1,
toporouter_vertex_t pathv,
toporouter_vertex_t arcv,
toporouter_vertex_t opv,
gint  wind,
gint *  arcwind,
gdouble *  arcr,
guint  debug 
)
guint check_triangle_interior_capacity ( GtsTriangle t,
toporouter_vertex_t v,
toporouter_vertex_t curpoint,
toporouter_edge_t op_edge,
toporouter_edge_t adj_edge1,
toporouter_edge_t adj_edge2 
)

Definition at line 3408 of file toporouter.c.

References flow_from_edge_to_edge(), TOPOROUTER_IS_CONSTRAINT, and triangle_interior_capacity().

Referenced by triangle_all_candidate_points_from_edge(), and triangle_candidate_points_from_edge().

Here is the call graph for this function:

void clean_routing_edges ( toporouter_t r,
toporouter_route_t data 
)

Definition at line 4336 of file toporouter.c.

References _toporouter_route_t::alltemppoints, and temp_point_clean().

Referenced by route().

Here is the call graph for this function:

void closest_cluster_pair ( toporouter_t r,
GList *  src_vertices,
GList *  dest_vertices,
toporouter_vertex_t **  a,
toporouter_vertex_t **  b 
)

Definition at line 3153 of file toporouter.c.

References _toporouter_t::flags, min, simple_h_cost(), TOPOROUTER_FLAG_GOFAR, TOPOROUTER_VERTEX, vertex_keepout_test(), and vz.

Referenced by route().

Here is the call graph for this function:

toporouter_vertex_t* closest_dest_vertex ( toporouter_t r,
toporouter_vertex_t v,
toporouter_route_t routedata 
)

Definition at line 3195 of file toporouter.c.

References _toporouter_route_t::destvertices, _toporouter_t::flags, simple_h_cost(), TOPOROUTER_FLAG_GOFAR, TOPOROUTER_VERTEX, vx, vy, and vz.

Referenced by route().

Here is the call graph for this function:

toporouter_cluster_t* cluster_create ( toporouter_t r,
toporouter_netlist_t netlist 
)
void cluster_join_bbox ( toporouter_cluster_t cluster,
toporouter_bbox_t box 
)

Definition at line 2618 of file toporouter.c.

References _toporouter_cluster_t::boxes, and _toporouter_bbox_t::cluster.

Referenced by import_clusters().

static gdouble cluster_keepaway ( toporouter_cluster_t cluster) [inline, static]
static gdouble cluster_thickness ( toporouter_cluster_t cluster) [inline, static]
gint compare_points ( gconstpointer  a,
gconstpointer  b 
)

Definition at line 2808 of file toporouter.c.

References GTS_POINT, _GtsPoint::x, and _GtsPoint::y.

gint compare_routedata_ascending ( gconstpointer  a,
gconstpointer  b 
)

Definition at line 6822 of file toporouter.c.

References _toporouter_route_t::score.

gint compare_rubberband_arcs ( toporouter_rubberband_arc_t a,
toporouter_rubberband_arc_t b 
)

Definition at line 5943 of file toporouter.c.

References _toporouter_rubberband_arc_t::d.

Referenced by oproute_rubberband_segment().

gint compare_segments ( gconstpointer  a,
gconstpointer  b 
)

Definition at line 2823 of file toporouter.c.

static double coord_angle ( double  ax,
double  ay,
double  bx,
double  by 
) [static]

Definition at line 2528 of file toporouter.c.

Referenced by export_pcb_drawarc().

void coord_intersect ( gdouble  ax,
gdouble  ay,
gdouble  bx,
gdouble  by,
gdouble  cx,
gdouble  cy,
gdouble  dx,
gdouble  dy,
gdouble *  rx,
gdouble *  ry 
)

intersection vertex: AB and CD must share a point interior to both segments.

Returns:
vertex at intersection of AB and CD.

Definition at line 1485 of file toporouter.c.

References cx, and cy.

static bool coord_intersect_prop ( double  ax,
double  ay,
double  bx,
double  by,
double  cx,
double  cy,
double  dx,
double  dy 
) [static]

Proper intersection: AB and CD must share a point interior to both segments.

Returns:
TRUE if AB properly intersects CD.

Definition at line 1396 of file toporouter.c.

References coord_wind().

Referenced by check_arc_for_loops(), and oproute_rubberband_segment().

Here is the call graph for this function:

static void coord_move_towards_coord_values ( double  ax,
double  ay,
double  px,
double  py,
double  d,
double *  x,
double *  y 
) [static]

Moves vertex v d units in the direction of vertex p.

Definition at line 819 of file toporouter.c.

Referenced by candidate_vertices(), check_intersect_vertex(), check_non_intersect_vertex(), and create_board_edge().

static gint coord_wind ( gdouble  ax,
gdouble  ay,
gdouble  bx,
gdouble  by,
gdouble  cx,
gdouble  cy 
) [inline, static]
static void coords_on_line ( double  ax,
gdouble  ay,
double  m,
double  r,
double *  b0x,
double *  b0y,
double *  b1x,
double *  b1y 
) [static]

coords_on_line: Given coordinates ax, ay, gradient m, and radius r:

Returns:
coordinates on line of a & m at r from a.

Definition at line 1277 of file toporouter.c.

References c.

Referenced by calculate_arc_to_arc(), calculate_term_to_arc(), and check_non_intersect_vertex().

static void create_board_edge ( double  x0,
double  y0,
double  x1,
double  y1,
int  layer,
GList **  vlist 
) [static]

Definition at line 2104 of file toporouter.c.

References BOARD_EDGE_RESOLUTION, coord_move_towards_coord_values(), GTS_VERTEX_CLASS, gts_vertex_new(), MIN, toporouter_vertex_class(), x, and y.

Referenced by read_board_constraints().

Here is the call graph for this function:

void edge_adjacent_vertices ( toporouter_edge_t e,
toporouter_vertex_t v,
toporouter_vertex_t **  v1,
toporouter_vertex_t **  v2 
)

Definition at line 3458 of file toporouter.c.

References edge_routing, edge_routing_next_not_temp(), edge_routing_prev_not_temp(), tedge_v1, and tedge_v2.

Referenced by triangle_candidate_points_from_edge().

Here is the call graph for this function:

gdouble edge_capacity ( toporouter_edge_t e)

Definition at line 2939 of file toporouter.c.

References edge_v1, edge_v2, GTS_POINT, and gts_point_distance().

Referenced by candidate_vertices().

Here is the call graph for this function:

toporouter_vertex_t* edge_closest_vertex ( toporouter_edge_t e,
toporouter_vertex_t v 
)

Definition at line 7029 of file toporouter.c.

References edge_routing, GTS_POINT, gts_point_distance2(), _toporouter_vertex_t::routingedge, and TOPOROUTER_VERTEX.

Here is the call graph for this function:

gdouble edge_flow ( toporouter_edge_t e,
toporouter_vertex_t v1,
toporouter_vertex_t v2,
toporouter_vertex_t dest 
)

Definition at line 2945 of file toporouter.c.

References edge_routing, min_spacing(), min_vertex_net_spacing(), tedge_v1, tedge_v2, and TOPOROUTER_VERTEX.

Referenced by candidate_vertices().

Here is the call graph for this function:

GList* edge_routing_first_not_temp ( toporouter_edge_t e)
GList* edge_routing_last_not_temp ( toporouter_edge_t e)
static guint edges_third_edge ( GtsSegment s1,
GtsSegment s2,
toporouter_vertex_t **  v1,
toporouter_vertex_t **  v2 
) [inline, static]

Definition at line 3300 of file toporouter.c.

References TOPOROUTER_VERTEX, _GtsSegment::v1, and _GtsSegment::v2.

Referenced by oproute_path_speccut().

static guint epsilon_equals ( gdouble  a,
gdouble  b 
) [inline, static]

Definition at line 612 of file toporouter.c.

References EPSILON.

Referenced by cartesian_gradient(), new_temp_toporoutervertex(), and triangle_interior_capacity().

gdouble export_pcb_drawarc ( guint  layer,
toporouter_arc_t a,
guint  thickness,
guint  keepaway 
)
gdouble export_pcb_drawline ( guint  layer,
guint  x0,
guint  y0,
guint  x1,
guint  y1,
guint  thickness,
guint  keepaway 
)

Definition at line 5273 of file toporouter.c.

References AddObjectToCreateUndoList(), CreateDrawnLineOnLayer(), LAYER_PTR, line, MakeFlags(), PCB, and TEST_FLAG.

Referenced by export_oproutes().

Here is the call graph for this function:

toporouter_netlist_t* find_netlist_by_name ( toporouter_t r,
char *  name 
)

Definition at line 7715 of file toporouter.c.

References FOREACH_END, FOREACH_NETLIST, and _toporouter_t::netlists.

gdouble flow_from_edge_to_edge ( GtsTriangle t,
toporouter_edge_t e1,
toporouter_edge_t e2,
toporouter_vertex_t common_v,
toporouter_vertex_t curpoint 
)

Returns the flow from e1 to e2, and the flow from the vertex oppisate e1 to e1 and the vertex oppisate e2 to e2.

Definition at line 3331 of file toporouter.c.

References box, _toporouter_bbox_t::cluster, cluster_keepaway(), cluster_thickness(), edge_routing, edge_v1, GTS_SEGMENT, gts_triangle_edge_opposite(), GTS_VERTEX, MAX, min_spacing(), segment_common_vertex(), TOPOROUTER_EDGE, TOPOROUTER_IS_CONSTRAINT, TOPOROUTER_VERTEX, vertex_bbox(), VERTEX_FLAG_ROUTE, vertex_net_keepaway(), and vertex_net_thickness().

Referenced by check_speccut(), and check_triangle_interior_capacity().

Here is the call graph for this function:

void free_list_elements ( gpointer  data,
gpointer  user_data 
)

Definition at line 5947 of file toporouter.c.

Referenced by oproute_rubberband_segment().

guint groupcount ( void  )
void hid_toporouter_init ( )

Definition at line 7875 of file toporouter.c.

guint hybrid_router ( toporouter_t r)
static void init_cost_matrix ( gdouble *  m,
guint  n 
) [inline, static]

Definition at line 6843 of file toporouter.c.

References n.

void insert_centre_point ( toporouter_t r,
toporouter_layer_t l,
gdouble  x,
gdouble  y 
)

Definition at line 1719 of file toporouter.c.

References f, GTS_POINT, GTS_VERTEX_CLASS, gts_vertex_new(), toporouter_vertex_class(), toporouter_layer_t::vertices, _GtsPoint::x, and _GtsPoint::y.

Here is the call graph for this function:

GList* insert_constraint_edge ( toporouter_t r,
toporouter_layer_t l,
gdouble  x1,
gdouble  y1,
guint  flags1,
gdouble  x2,
gdouble  y2,
guint  flags2,
toporouter_bbox_t box 
)
void insert_constraints_from_list ( toporouter_t r,
toporouter_layer_t l,
GList *  vlist,
toporouter_bbox_t box 
)

Definition at line 1695 of file toporouter.c.

References _toporouter_bbox_t::constraints, _toporouter_vertex_t::flags, insert_constraint_edge(), TOPOROUTER_VERTEX, vx, and vy.

Referenced by read_board_constraints(), read_pads(), and read_points().

Here is the call graph for this function:

GtsVertex* insert_vertex ( toporouter_t r,
toporouter_layer_t l,
gdouble  x,
gdouble  y,
toporouter_bbox_t box 
)
gdouble line_line_distance_at_normal ( gdouble  line1_x1,
gdouble  line1_y1,
gdouble  line1_x2,
gdouble  line1_y2,
gdouble  line2_x1,
gdouble  line2_y1,
gdouble  line2_x2,
gdouble  line2_y2,
gdouble  x,
gdouble  y 
)

Definition at line 5722 of file toporouter.c.

References cartesian_gradient(), and perpendicular_gradient().

Here is the call graph for this function:

GSList* list_to_slist ( GList *  i)

Definition at line 1570 of file toporouter.c.

Referenced by build_cdt(), and toporouter_bbox_create_from_points().

GtsPoint* midpoint ( GtsPoint a,
GtsPoint b 
)

Definition at line 1736 of file toporouter.c.

References gts_point_class(), gts_point_new(), _GtsPoint::x, and _GtsPoint::y.

Here is the call graph for this function:

gdouble min_net_net_spacing ( toporouter_vertex_t v1,
toporouter_vertex_t v2 
)

Definition at line 924 of file toporouter.c.

References cluster_keepaway(), cluster_thickness(), MAX, _toporouter_vertex_t::route, and _toporouter_route_t::src.

Here is the call graph for this function:

gdouble min_oproute_net_spacing ( toporouter_oproute_t oproute,
toporouter_vertex_t v2 
)
static gdouble min_oproute_vertex_spacing ( toporouter_oproute_t oproute,
toporouter_vertex_t v2 
) [inline, static]

Definition at line 890 of file toporouter.c.

References lookup_keepaway(), lookup_thickness(), MAX, _toporouter_oproute_t::style, vertex_net_keepaway(), and vertex_net_thickness().

Referenced by check_adj_pushing_vertex().

Here is the call graph for this function:

static gdouble min_spacing ( toporouter_vertex_t v1,
toporouter_vertex_t v2 
) [inline, static]
static gdouble min_vertex_net_spacing ( toporouter_vertex_t v1,
toporouter_vertex_t v2 
) [inline, static]

Definition at line 873 of file toporouter.c.

References cluster_keepaway(), cluster_thickness(), MAX, TOPOROUTER_VERTEX, vertex_bbox(), vertex_net_keepaway(), and vertex_net_thickness().

Referenced by edge_flow().

Here is the call graph for this function:

toporouter_netlist_t* netlist_create ( toporouter_t r,
char *  netlist,
char *  style 
)
void netlist_recalculate ( toporouter_netlist_t netlist,
GList *  ignore 
)

Definition at line 7246 of file toporouter.c.

References cluster_merge(), _toporouter_netlist_t::clusters, FOREACH_CLUSTER, FOREACH_END, n, _toporouter_netlist_t::routed, and TOPOROUTER_ROUTE.

Referenced by netlists_recalculate(), and roar_route().

Here is the call graph for this function:

void netlists_recalculate ( GList *  netlists,
GList *  ignore 
)

Definition at line 7263 of file toporouter.c.

References netlist_recalculate(), and TOPOROUTER_NETLIST.

Referenced by roar_detour_route(), and roar_route().

Here is the call graph for this function:

void netlists_rollback ( GList *  netlists)
static void netscore_destroy ( toporouter_netscore_t netscore) [inline, static]

Definition at line 6891 of file toporouter.c.

References toporouter_netscore_t::pairwise_nodetour.

Referenced by order_nets_preroute_greedy().

gint netscore_pairwise_compare ( toporouter_netscore_t **  a,
toporouter_netscore_t **  b 
)

Definition at line 6975 of file toporouter.c.

Referenced by toporouter_new().

gint netscore_pairwise_size_compare ( toporouter_netscore_t **  a,
toporouter_netscore_t **  b 
)

Definition at line 6952 of file toporouter.c.

toporouter_rubberband_arc_t* new_rubberband_arc ( toporouter_vertex_t pathv,
toporouter_vertex_t arcv,
gdouble  r,
gdouble  d,
gint  wind,
GList *  list 
)
toporouter_vertex_t* new_temp_toporoutervertex_in_segment ( toporouter_edge_t e,
toporouter_vertex_t v,
gdouble  r,
toporouter_vertex_t ref 
)

Create vertex on edge e at radius r from v, closest to ref.

Definition at line 3122 of file toporouter.c.

References edge_gradient, m, new_temp_toporoutervertex(), vertices_on_line(), vx, vy, toporouter_spoint_t::x, and toporouter_spoint_t::y.

Referenced by all_candidates_on_edge(), triangle_candidate_points_from_edge(), and triangle_candidate_points_from_vertex().

Here is the call graph for this function:

GtsTriangle* opposite_triangle ( GtsTriangle t,
toporouter_edge_t e 
)

Definition at line 6296 of file toporouter.c.

References GTS_EDGE, and GTS_TRIANGLE.

Referenced by check_speccut().

void oproute_check_all_loops ( toporouter_t r,
toporouter_oproute_t oproute 
)
void oproute_free ( toporouter_oproute_t oproute)

Definition at line 5674 of file toporouter.c.

References _toporouter_oproute_t::arcs, _toporouter_arc_t::centre, _toporouter_vertex_t::flags, GTS_OBJECT, gts_object_destroy(), and VERTEX_FLAG_TEMP.

Referenced by toporouter_export().

Here is the call graph for this function:

gdouble oproute_min_spacing ( toporouter_oproute_t a,
toporouter_oproute_t b 
)

Definition at line 5759 of file toporouter.c.

References lookup_keepaway(), lookup_thickness(), MAX, and _toporouter_oproute_t::style.

Here is the call graph for this function:

gint oproute_path_speccut ( toporouter_oproute_t oproute)
guint order_nets_preroute_greedy ( toporouter_t r,
GList *  nets,
GList **  rnets 
)

Definition at line 6994 of file toporouter.c.

References FOREACH_END, FOREACH_NETSCORE, len, netscore_create(), netscore_destroy(), netscore_pairwise_calculation(), _toporouter_t::netsort, print_netscores(), TOPOROUTER_ROUTE, and TRUE.

Referenced by rubix_router().

Here is the call graph for this function:

static gdouble pad_rad ( PadType pad) [inline, static]

Definition at line 1742 of file toporouter.c.

References lookup_keepaway(), lookup_thickness(), and pad_st::Name.

Referenced by read_pads().

Here is the call graph for this function:

void parse_arguments ( toporouter_t r,
int  argc,
char **  argv 
)
gdouble path_score ( toporouter_t r,
GList *  path 
)

Definition at line 4344 of file toporouter.c.

References GTS_POINT, gts_point_distance(), TOPOROUTER_VERTEX, _toporouter_t::viacost, and vz.

Referenced by detour_router(), and route().

Here is the call graph for this function:

void path_set_oproute ( GList *  path,
toporouter_oproute_t oproute 
)
gdouble pathvertex_arcing_through_constraint ( toporouter_vertex_t pathv,
toporouter_vertex_t arcv 
)
gdouble perpendicular_gradient ( gdouble  m)
static void pick_first_face ( GtsFace f,
GtsFace **  first 
) [static]

Definition at line 2182 of file toporouter.c.

References f.

Referenced by build_cdt().

static gdouble pin_rad ( PinType pin) [inline, static]

Definition at line 1748 of file toporouter.c.

References lookup_keepaway(), lookup_thickness(), and pin_st::Name.

Referenced by read_points().

Here is the call graph for this function:

int point_between ( GtsPoint a,
GtsPoint b,
GtsPoint c 
)

Returns:
true if c is between a and b.

Definition at line 1504 of file toporouter.c.

References point_wind(), _GtsPoint::x, and _GtsPoint::y.

Referenced by vertex_between().

Here is the call graph for this function:

static void point_from_point_to_point ( toporouter_vertex_t a,
toporouter_vertex_t b,
double  d,
double *  x,
double *  y 
) [static]

Fills in x and y with coordinates of point from a towards b of distance d.

Definition at line 764 of file toporouter.c.

References vx, and vy.

Referenced by calculate_arc_to_arc(), calculate_term_to_arc(), and toporouter_draw_surface().

static gdouble point_gradient ( GtsPoint a,
GtsPoint b 
) [inline, static]

Returns gradient of segment given by (x0,y0) & (x1,y1).

Definition at line 1332 of file toporouter.c.

References cartesian_gradient(), _GtsPoint::x, and _GtsPoint::y.

Referenced by calculate_arc_to_arc(), and calculate_term_to_arc().

Here is the call graph for this function:

static bool point_intersect_prop ( GtsPoint a,
GtsPoint b,
GtsPoint c,
GtsPoint d 
) [static]

proper intersection: AB and CD must share a point interior to both segments.

Returns:
TRUE if AB properly intersects CD.

Definition at line 1422 of file toporouter.c.

References point_wind().

Referenced by vertex_intersect_prop().

Here is the call graph for this function:

int point_wind ( GtsPoint a,
GtsPoint b,
GtsPoint c 
)

wind_v:

Returns:
1, 0, -1 for counterclockwise, collinear or clockwise, respectively.

Definition at line 794 of file toporouter.c.

References EPSILON, _GtsPoint::x, and _GtsPoint::y.

Referenced by point_between(), point_intersect_prop(), tvertex_wind(), and vertex_wind().

void print_constraint ( toporouter_constraint_t e)

Definition at line 2158 of file toporouter.c.

References print_vertex(), tedge_v1, and tedge_v2.

Referenced by build_cdt().

Here is the call graph for this function:

void print_costmatrix ( gdouble *  m,
guint  n 
)

Definition at line 6830 of file toporouter.c.

References n.

void print_edge ( toporouter_edge_t e)

Definition at line 2166 of file toporouter.c.

References edge_routing, print_vertex(), tedge_v1, tedge_v2, and TOPOROUTER_VERTEX.

Referenced by triangle_candidate_points_from_vertex().

Here is the call graph for this function:

void print_netlist ( toporouter_netlist_t netlist)
void print_netscores ( GPtrArray *  netscores)

Definition at line 6898 of file toporouter.c.

Referenced by order_nets_preroute_greedy().

void print_path ( GList *  path)

Definition at line 2988 of file toporouter.c.

References _toporouter_vertex_t::child, _toporouter_vertex_t::parent, print_vertex(), and TOPOROUTER_VERTEX.

Here is the call graph for this function:

void print_toporouter_arc ( toporouter_arc_t arc)

Definition at line 5184 of file toporouter.c.

References _toporouter_arc_t::centre, _toporouter_arc_t::dir, _toporouter_arc_t::r, vx, and vy.

Referenced by print_oproute().

static void print_toporouter_constraint ( toporouter_constraint_t tc) [inline, static]
static void print_toporouter_vertex ( toporouter_vertex_t tv) [inline, static]

Definition at line 1223 of file toporouter.c.

References _GtsVertex::p, _toporouter_vertex_t::v, _GtsPoint::x, and _GtsPoint::y.

void print_vertices ( GList *  vertices)

Definition at line 4373 of file toporouter.c.

References print_bbox(), print_vertex(), TOPOROUTER_VERTEX, and vertex_bbox().

Here is the call graph for this function:

static void read_board_constraints ( toporouter_t r,
toporouter_layer_t l,
int  layer 
) [static]

Definition at line 2126 of file toporouter.c.

References _toporouter_t::bboxes, BOARD, create_board_edge(), insert_constraints_from_list(), PCBType::MaxHeight, PCBType::MaxWidth, PCB, and toporouter_bbox_create().

Referenced by import_geometry().

Here is the call graph for this function:

int read_lines ( toporouter_t r,
toporouter_layer_t l,
LayerType layer,
int  ln 
)

Read line data from layer into toporouter_layer_t struct.

Inserts points and constraints into GLists.

Definition at line 2069 of file toporouter.c.

References _toporouter_t::bboxes, _toporouter_bbox_t::constraints, END_LOOP, GetLayerGroupNumberByNumber(), GTS_VERTEX_CLASS, gts_vertex_new(), insert_constraint_edge(), _toporouter_t::layers, LINE, line, LINE_LOOP, toporouter_bbox_create_from_points(), and toporouter_vertex_class().

Referenced by import_geometry().

Here is the call graph for this function:

int read_points ( toporouter_t r,
toporouter_layer_t l,
int  layer 
)

Read points data (all layers) into GList.

Inserts pin and via points.

Definition at line 1969 of file toporouter.c.

References _toporouter_t::bboxes, PCBType::Data, ELEMENT_LOOP, END_LOOP, GTS_POINT, insert_constraints_from_list(), insert_vertex(), _toporouter_t::layers, PCB, PIN, pin, PIN_LOOP, pin_rad(), _toporouter_bbox_t::point, rect_with_attachments(), TEST_FLAG, pin_st::Thickness, toporouter_bbox_create(), VIA, VIA_LOOP, pin_st::X, x, pin_st::Y, and y.

Referenced by import_geometry().

Here is the call graph for this function:

GList* rect_with_attachments ( gdouble  rad,
gdouble  x0,
gdouble  y0,
gdouble  x1,
gdouble  y1,
gdouble  x2,
gdouble  y2,
gdouble  x3,
gdouble  y3,
gdouble  z 
)

Definition at line 1754 of file toporouter.c.

References GTS_VERTEX_CLASS, gts_vertex_new(), TOPOROUTER_VERTEX, and toporouter_vertex_class().

Referenced by read_pads(), and read_points().

Here is the call graph for this function:

gint roar_router ( toporouter_t r,
gint  failcount,
gint  threshold 
)

Definition at line 7411 of file toporouter.c.

References _, _toporouter_t::failednets, Message(), roar_route(), _toporouter_t::routednets, and TOPOROUTER_ROUTE.

Referenced by hybrid_router().

Here is the call graph for this function:

GList* route ( toporouter_t r,
toporouter_route_t data,
guint  debug 
)
GList* route_conflicts ( toporouter_route_t route)

Definition at line 7085 of file toporouter.c.

References _toporouter_route_t::path, TOPOROUTER_ROUTE, TOPOROUTER_VERTEX, vertices_routing_conflicts(), and vz.

Referenced by roar_detour_route(), and roar_route().

Here is the call graph for this function:

gint route_detour_compare ( toporouter_route_t **  a,
toporouter_route_t **  b 
)

Definition at line 7440 of file toporouter.c.

Referenced by detour_router().

gdouble route_heap_cmp ( gpointer  item,
gpointer  data 
)

Definition at line 2903 of file toporouter.c.

References FCOST, and TOPOROUTER_VERTEX.

Referenced by route().

static toporouter_vertex_t* route_vertices_common_vertex ( toporouter_vertex_t v1,
toporouter_vertex_t v2 
) [inline, static]

Definition at line 3293 of file toporouter.c.

References GTS_SEGMENT, _toporouter_vertex_t::routingedge, and segment_common_vertex().

Referenced by vertices_routing_conflicts().

Here is the call graph for this function:

void routedata_insert_temppoints ( toporouter_route_t data,
GList *  temppoints 
)
gint routing_edge_insert ( gconstpointer  a,
gconstpointer  b,
gpointer  user_data 
)

Sorting into ascending distance from v1.

Definition at line 3062 of file toporouter.c.

References edge_v1, EPSILON, GTS_POINT, and gts_point_distance2().

Referenced by apply_route(), new_temp_toporoutervertex(), and speccut_edge_routing_from_edge().

Here is the call graph for this function:

gint rubix_router ( toporouter_t r,
gint  failcount 
)

Definition at line 7577 of file toporouter.c.

References cluster_merge(), _toporouter_t::failednets, INSERT_ROUTING, order_nets_preroute_greedy(), route(), and TOPOROUTER_ROUTE.

Referenced by hybrid_router().

Here is the call graph for this function:

static toporouter_vertex_t* segment_common_vertex ( GtsSegment s1,
GtsSegment s2 
) [inline, static]
gdouble segment_gradient ( GtsSegment s)

Definition at line 1338 of file toporouter.c.

References cartesian_gradient(), GTS_POINT, _GtsSegment::v1, and _GtsSegment::v2.

Here is the call graph for this function:

gdouble simple_h_cost ( toporouter_t r,
toporouter_vertex_t curpoint,
toporouter_vertex_t destpoint 
)

Definition at line 2894 of file toporouter.c.

References GTS_POINT, gts_point_distance(), _toporouter_t::viacost, and vz.

Referenced by closest_cluster_pair(), closest_dest_vertex(), and route().

Here is the call graph for this function:

void snapshot ( toporouter_t r,
char *  name,
GList *  datas 
)

*

Definition at line 7051 of file toporouter.c.

References buffer, groupcount(), _toporouter_t::layers, toporouter_layer_t::surface, and toporouter_draw_surface().

Here is the call graph for this function:

gint space_edge ( gpointer  item,
gpointer  data 
)
void speccut_edge_patch_links ( toporouter_edge_t e)
void split_edge_routing ( toporouter_vertex_t v,
GList **  l1,
GList **  l2 
)
GList* split_path ( GList *  path)
gint spread_edge ( gpointer  item,
gpointer  data 
)

Definition at line 7114 of file toporouter.c.

References edge_routing, edge_v1, edge_v2, GTS_POINT, gts_point_distance(), s, TOPOROUTER_EDGE, TOPOROUTER_IS_CONSTRAINT, TOPOROUTER_VERTEX, vertex_move_towards_vertex_values(), vx, vy, x, and y.

Here is the call graph for this function:

void swap_vertices ( toporouter_vertex_t **  v1,
toporouter_vertex_t **  v2 
)

Definition at line 4461 of file toporouter.c.

Referenced by vertices_routing_conflicts().

gboolean temp_point_clean ( gpointer  key,
gpointer  value,
gpointer  user_data 
)
static int toporouter ( int  argc,
char **  argv,
Coord  x,
Coord  y 
) [static]
toporouter_arc_class_t* toporouter_arc_class ( void  )

Definition at line 248 of file toporouter.c.

References gts_constraint_class(), GTS_OBJECT_CLASS, gts_object_class_new(), and toporouter_arc_init().

Referenced by toporouter_arc_new().

Here is the call graph for this function:

void toporouter_arc_remove ( toporouter_oproute_t oproute,
toporouter_arc_t arc 
)
toporouter_bbox_class_t* toporouter_bbox_class ( void  )

Definition at line 117 of file toporouter.c.

References gts_bbox_class(), GTS_OBJECT_CLASS, gts_object_class_new(), and toporouter_bbox_init().

Referenced by toporouter_bbox_create(), and toporouter_bbox_create_from_points().

Here is the call graph for this function:

toporouter_bbox_t* toporouter_bbox_create ( int  layer,
GList *  vertices,
toporouter_term_t  type,
gpointer  data 
)
toporouter_bbox_t* toporouter_bbox_create_from_points ( int  layer,
GList *  vertices,
toporouter_term_t  type,
gpointer  data 
)
static void toporouter_bbox_init ( toporouter_bbox_t box) [static]
toporouter_bbox_t* toporouter_bbox_locate ( toporouter_t r,
toporouter_term_t  type,
void *  data,
gdouble  x,
gdouble  y,
guint  layergroup 
)
toporouter_constraint_class_t* toporouter_constraint_class ( void  )

Definition at line 207 of file toporouter.c.

References gts_constraint_class(), GTS_OBJECT_CLASS, gts_object_class_new(), toporouter_constraint_class_init(), and toporouter_constraint_init().

Referenced by insert_constraint_edge().

Here is the call graph for this function:

static void toporouter_constraint_class_init ( toporouter_constraint_class_t klass) [static]

Initialise a constraint class.

Definition at line 191 of file toporouter.c.

Referenced by toporouter_constraint_class().

static void toporouter_constraint_init ( toporouter_constraint_t constraint) [static]

Initialise a constraint.

Definition at line 200 of file toporouter.c.

References _toporouter_constraint_t::box, and _toporouter_constraint_t::routing.

Referenced by toporouter_constraint_class().

void toporouter_draw_cluster ( toporouter_t r,
drawing_context_t dc,
toporouter_cluster_t cluster,
gdouble  red,
gdouble  green,
gdouble  blue,
guint  layer 
)

Definition at line 941 of file toporouter.c.

Referenced by toporouter_draw_surface().

toporouter_edge_class_t* toporouter_edge_class ( void  )

Definition at line 84 of file toporouter.c.

References gts_edge_class(), GTS_OBJECT_CLASS, gts_object_class_new(), and toporouter_edge_init().

Referenced by build_cdt(), check_speccut(), delaunay_create_from_vertices(), and unconstrain().

Here is the call graph for this function:

static void toporouter_edge_init ( toporouter_edge_t edge) [static]

Initialise an edge.

Definition at line 77 of file toporouter.c.

References _toporouter_edge_t::flags, and _toporouter_edge_t::routing.

Referenced by toporouter_edge_class().

void toporouter_export ( toporouter_t r)
void toporouter_free ( toporouter_t r)

Definition at line 1174 of file toporouter.c.

References _, groupcount(), _toporouter_t::layers, Message(), _toporouter_t::starttime, and toporouter_layer_free().

Referenced by toporouter().

Here is the call graph for this function:

void toporouter_heap_search ( gpointer  data,
gpointer  user_data 
)
void toporouter_layer_free ( toporouter_layer_t l)

Free a layer.

Definition at line 1153 of file toporouter.c.

References toporouter_layer_t::constraints, and toporouter_layer_t::vertices.

Referenced by toporouter_free().

void toporouter_output_close ( drawing_context_t dc)

Close output.

Definition at line 312 of file toporouter.c.

References drawing_context_t::filename.

Referenced by toporouter_draw_surface().

drawing_context_t* toporouter_output_init ( int  w,
int  h,
char *  filename 
)

Initialise output.

Definition at line 274 of file toporouter.c.

References filename, drawing_context_t::filename, drawing_context_t::ih, drawing_context_t::iw, malloc(), MARGIN, PCBType::MaxHeight, PCBType::MaxWidth, PCB, and drawing_context_t::s.

Referenced by toporouter_draw_surface().

Here is the call graph for this function:

toporouter_serpintine_t* toporouter_serpintine_new ( gdouble  x,
gdouble  y,
gdouble  x0,
gdouble  y0,
gdouble  x1,
gdouble  y1,
gpointer  start,
gdouble  halfa,
gdouble  radius,
guint  nhalfcycles 
)
gint toporouter_set_pair ( toporouter_t r,
toporouter_netlist_t n1,
toporouter_netlist_t n2 
)

Definition at line 7724 of file toporouter.c.

References _toporouter_netlist_t::pair.

static void toporouter_vertex_class_init ( toporouter_vertex_class_t klass) [static]

Initialise a vertex class.

Definition at line 141 of file toporouter.c.

Referenced by toporouter_vertex_class().

GList* triangle_all_candidate_points_from_vertex ( GtsTriangle t,
toporouter_vertex_t v,
toporouter_route_t routedata 
)

Definition at line 3855 of file toporouter.c.

References all_candidates_on_edge(), gts_triangle_edge_opposite(), GTS_VERTEX, and TOPOROUTER_EDGE.

Referenced by compute_candidate_points().

Here is the call graph for this function:

gdouble triangle_cost ( GtsTriangle t,
gpointer *  data 
)

Definition at line 2144 of file toporouter.c.

References gts_triangle_area(), and gts_triangle_quality().

Here is the call graph for this function:

gdouble triangle_interior_capacity ( GtsTriangle t,
toporouter_vertex_t v 
)

Returns the capacity of the triangle cut through v.

Definition at line 3238 of file toporouter.c.

References edge_v1, edge_v2, epsilon_equals(), GTS_POINT, gts_point_distance2(), gts_triangle_edge_opposite(), GTS_VERTEX, len, MAX, MIN, perpendicular_gradient(), TOPOROUTER_EDGE, toporouter_edge_gradient, vx, vy, x, and y.

Referenced by check_speccut(), and check_triangle_interior_capacity().

Here is the call graph for this function:

static int tvertex_wind ( toporouter_vertex_t a,
toporouter_vertex_t b,
toporouter_vertex_t c 
) [inline, static]

Definition at line 810 of file toporouter.c.

References GTS_POINT, and point_wind().

Referenced by check_intersect_vertex(), check_non_intersect_vertex(), and check_speccut().

Here is the call graph for this function:

gdouble vector_angle ( gdouble  ox,
gdouble  oy,
gdouble  ax,
gdouble  ay,
gdouble  bx,
gdouble  by 
)

Definition at line 5765 of file toporouter.c.

static int vertex_between ( GtsVertex a,
GtsVertex b,
GtsVertex c 
) [inline, static]

Definition at line 1521 of file toporouter.c.

References GTS_POINT, and point_between().

Referenced by build_cdt().

Here is the call graph for this function:

gdouble vertex_gradient ( toporouter_spoint_t a,
toporouter_spoint_t b 
)

Returns gradient of segment given by a & b.

Definition at line 1310 of file toporouter.c.

References toporouter_spoint_t::x, and toporouter_spoint_t::y.

Referenced by vertex_outside_segment().

GtsVertex* vertex_intersect ( GtsVertex a,
GtsVertex b,
GtsVertex c,
GtsVertex d 
)

intersection vertex: AB and CD must share a point interior to both segments.

Returns:
vertex at intersection of AB and CD.

Definition at line 1454 of file toporouter.c.

References f, GTS_VERTEX_CLASS, gts_vertex_new(), _GtsVertex::p, toporouter_vertex_class(), vertex_intersect_prop(), _GtsPoint::x, and _GtsPoint::y.

Referenced by build_cdt().

Here is the call graph for this function:

static int vertex_intersect_prop ( GtsVertex a,
GtsVertex b,
GtsVertex c,
GtsVertex d 
) [inline, static]

Definition at line 1440 of file toporouter.c.

References GTS_POINT, and point_intersect_prop().

Referenced by vertex_intersect().

Here is the call graph for this function:

gint vertex_keepout_test ( toporouter_t r,
toporouter_vertex_t v 
)

Definition at line 3141 of file toporouter.c.

References _toporouter_t::keepoutlayers, and vz.

Referenced by closest_cluster_pair(), and compute_candidate_points().

guint vertex_line_normal_intersection ( gdouble  x1,
gdouble  y1,
gdouble  x2,
gdouble  y2,
gdouble  x3,
gdouble  y3,
gdouble *  x,
gdouble *  y 
)

Definition at line 5162 of file toporouter.c.

References cartesian_gradient(), EPSILON, MAX, MIN, and perpendicular_gradient().

Referenced by check_adj_pushing_vertex(), check_intersect_vertex(), check_non_intersect_vertex(), and check_speccut().

Here is the call graph for this function:

void vertex_move_towards_vertex ( GtsVertex v,
GtsVertex p,
double  d 
)

Definition at line 5039 of file toporouter.c.

References GTS_POINT, x, and y.

static void vertex_move_towards_vertex_values ( GtsVertex v,
GtsVertex p,
double  d,
double *  x,
double *  y 
) [static]

Moves vertex v d units in the direction of vertex p.

Definition at line 834 of file toporouter.c.

References GTS_POINT.

Referenced by candidate_vertices(), space_edge(), and spread_edge().

char* vertex_netlist ( toporouter_vertex_t v)

Definition at line 592 of file toporouter.c.

References box, _toporouter_bbox_t::cluster, _toporouter_netlist_t::netlist, _toporouter_cluster_t::netlist, and vertex_bbox().

Referenced by print_vertex(), and triangle_candidate_points_from_vertex().

Here is the call graph for this function:

static void vertex_outside_segment ( toporouter_spoint_t a,
toporouter_spoint_t b,
gdouble  r,
toporouter_spoint_t p 
) [inline, static]

Finds the point p distance r away from a on the line segment of a & b.

Definition at line 1371 of file toporouter.c.

References vertex_gradient(), vertices_on_line(), vertices_plane_distance(), toporouter_spoint_t::x, and toporouter_spoint_t::y.

Referenced by read_pads().

Here is the call graph for this function:

static int vertex_wind ( GtsVertex a,
GtsVertex b,
GtsVertex c 
) [inline, static]

Definition at line 804 of file toporouter.c.

References GTS_POINT, and point_wind().

Referenced by compute_candidate_points().

Here is the call graph for this function:

static void vertices_on_line ( toporouter_spoint_t a,
double  m,
double  r,
toporouter_spoint_t b0,
toporouter_spoint_t b1 
) [static]

vertices_on_line: Given vertex a, gradient m, and radius r:

Returns:
vertices on line of a & m at r from a.

Definition at line 1238 of file toporouter.c.

References c, toporouter_spoint_t::x, and toporouter_spoint_t::y.

Referenced by new_temp_toporoutervertex_in_segment(), read_pads(), and vertex_outside_segment().

gdouble vertices_plane_distance ( toporouter_spoint_t a,
toporouter_spoint_t b 
)

Returns the distance between two vertices in the x-y plane.

Definition at line 1362 of file toporouter.c.

References toporouter_spoint_t::x, and toporouter_spoint_t::y.

Referenced by vertex_outside_segment().

gdouble vertices_routing_conflict_cost ( toporouter_t r,
toporouter_vertex_t v,
toporouter_vertex_t pv,
guint *  n 
)

Definition at line 4602 of file toporouter.c.

References penalty(), TOPOROUTER_ROUTE, and vertices_routing_conflicts().

Referenced by gcost().

Here is the call graph for this function:

gint visited_cmp ( gconstpointer  a,
gconstpointer  b 
)

Definition at line 2520 of file toporouter.c.

int wind ( toporouter_spoint_t p1,
toporouter_spoint_t p2,
toporouter_spoint_t p3 
)

wind:

Returns:
1, 0, -1 for counterclockwise, collinear or clockwise, respectively.

Definition at line 1203 of file toporouter.c.

References toporouter_spoint_t::x, and toporouter_spoint_t::y.

Referenced by export_pcb_drawarc(), new_rubberband_arc(), and read_pads().


Variable Documentation

Initial value:
 {
  {"Escape", N_("Select a set of pads"), escape,
    N_("Pad escape"), N_("Escape()")},
  {"Toporouter", N_("Select net(s)"), toporouter,
    N_("Topological autorouter"), N_("Toporouter()")}
}

Definition at line 7866 of file toporouter.c.