pcb 4.1.1
An interactive printed circuit board layout editor.

toporouter.h File Reference

Topological Autorouter for PCB. More...

#include <assert.h>
#include "data.h"
#include "macro.h"
#include "autoroute.h"
#include "box.h"
#include "create.h"
#include "draw.h"
#include "error.h"
#include "find.h"
#include "heap.h"
#include "rtree.h"
#include "misc.h"
#include "mymem.h"
#include "polygon.h"
#include "rats.h"
#include "remove.h"
#include "thermal.h"
#include "undo.h"
#include "global.h"
#include "gts.h"
#include <stdlib.h>
#include <getopt.h>
#include <sys/time.h>
Include dependency graph for toporouter.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _toporouter_bbox_t
struct  _toporouter_bbox_class_t
struct  _toporouter_edge_t
struct  _toporouter_edge_class_t
struct  _toporouter_vertex_t
struct  _toporouter_vertex_class_t
struct  _toporouter_constraint_t
struct  _toporouter_constraint_class_t
struct  toporouter_spoint_t
struct  toporouter_layer_t
struct  toporouter_vertex_region_t
struct  _toporouter_rubberband_arc_t
struct  _toporouter_route_t
struct  _toporouter_netlist_t
struct  _toporouter_cluster_t
struct  _toporouter_serpintine_t
struct  _toporouter_oproute_t
struct  _toporouter_arc_t
struct  _toporouter_arc_class_t
struct  toporouter_netscore_t
struct  _toporouter_t
struct  drawing_context_t

Defines

#define TOPOROUTER_FLAG_VERBOSE   (1<<0)
#define TOPOROUTER_FLAG_HARDDEST   (1<<1)
#define TOPOROUTER_FLAG_HARDSRC   (1<<2)
#define TOPOROUTER_FLAG_MATCH   (1<<3)
#define TOPOROUTER_FLAG_LAYERHINT   (1<<4)
#define TOPOROUTER_FLAG_LEASTINVALID   (1<<5)
#define TOPOROUTER_FLAG_AFTERORDER   (1<<6)
#define TOPOROUTER_FLAG_AFTERRUBIX   (1<<7)
#define TOPOROUTER_FLAG_GOFAR   (1<<8)
#define TOPOROUTER_FLAG_DETOUR   (1<<9)
#define EPSILON   0.0001f
#define tvdistance(a, b)   hypot(vx(a)-vx(b),vy(a)-vy(b))
#define edge_v1(e)   (GTS_SEGMENT(e)->v1)
#define edge_v2(e)   (GTS_SEGMENT(e)->v2)
#define tedge_v1(e)   (TOPOROUTER_VERTEX(GTS_SEGMENT(e)->v1))
#define tedge_v2(e)   (TOPOROUTER_VERTEX(GTS_SEGMENT(e)->v2))
#define tedge(v1, v2)   TOPOROUTER_EDGE(gts_vertices_are_connected(GTS_VERTEX(v1), GTS_VERTEX(v2)))
#define edge_routing(e)   (TOPOROUTER_IS_CONSTRAINT(e) ? TOPOROUTER_CONSTRAINT(e)->routing : e->routing)
#define vrouting(v)   (edge_routing(v->routingedge))
#define edge_routing_next(e, list)   ((list->next) ? TOPOROUTER_VERTEX(list->next->data) : TOPOROUTER_VERTEX(edge_v2(e)))
#define edge_routing_prev(e, list)   ((list->prev) ? TOPOROUTER_VERTEX(list->prev->data) : TOPOROUTER_VERTEX(edge_v1(e)))
#define vx(v)   (GTS_POINT(v)->x)
#define vy(v)   (GTS_POINT(v)->y)
#define vz(v)   (GTS_POINT(v)->z)
#define close_enough_xy(a, b)   (vx(a) > vx(b) - EPSILON && vx(a) < vx(b) + EPSILON && vy(a) > vy(b) - EPSILON && vy(a) < vy(b) + EPSILON)
#define tev1x(e)   (vx(tedge_v1(e))
#define tev1y(e)   (vy(tedge_v1(e))
#define tev1z(e)   (vz(tedge_v1(e))
#define tev2x(e)   (vx(tedge_v2(e))
#define tev2y(e)   (vy(tedge_v2(e))
#define tev2z(e)   (vz(tedge_v2(e))
#define tvertex_intersect(a, b, c, d)   (TOPOROUTER_VERTEX(vertex_intersect(GTS_VERTEX(a),GTS_VERTEX(b),GTS_VERTEX(c),GTS_VERTEX(d))))
#define TOPOROUTER_IS_BBOX(obj)   (gts_object_is_from_class (obj, toporouter_bbox_class ()))
#define TOPOROUTER_BBOX(obj)   GTS_OBJECT_CAST (obj, toporouter_bbox_t, toporouter_bbox_class ())
#define TOPOROUTER_BBOX_CLASS(klass)   GTS_OBJECT_CLASS_CAST (klass, toporouter_bbox_class_t, toporouter_bbox_class ())
#define TOPOROUTER_IS_EDGE(obj)   (gts_object_is_from_class (obj, toporouter_edge_class ()))
#define TOPOROUTER_EDGE(obj)   GTS_OBJECT_CAST (obj, toporouter_edge_t, toporouter_edge_class ())
#define TOPOROUTER_EDGE_CLASS(klass)   GTS_OBJECT_CLASS_CAST (klass, toporouter_edge_class_t, toporouter_edge_class ())
#define EDGE_FLAG_DIRECTCONNECTION   (1<<0)
#define TOPOROUTER_IS_VERTEX(obj)   (gts_object_is_from_class (obj, toporouter_vertex_class ()))
#define TOPOROUTER_VERTEX(obj)   GTS_OBJECT_CAST (obj, toporouter_vertex_t, toporouter_vertex_class ())
#define TOPOROUTER_VERTEX_CLASS(klass)   GTS_OBJECT_CLASS_CAST (klass, toporouter_vertex_class_t, toporouter_vertex_class ())
#define VERTEX_FLAG_VIZ   (1<<1)
#define VERTEX_FLAG_CCW   (1<<2)
#define VERTEX_FLAG_CW   (1<<3)
#define VERTEX_FLAG_RED   (1<<4)
#define VERTEX_FLAG_GREEN   (1<<5)
#define VERTEX_FLAG_BLUE   (1<<6)
#define VERTEX_FLAG_TEMP   (1<<7)
#define VERTEX_FLAG_ROUTE   (1<<8)
#define VERTEX_FLAG_FAKE   (1<<10)
#define VERTEX_FLAG_SPECCUT   (1<<11)
#define TOPOROUTER_IS_CONSTRAINT(obj)   (gts_object_is_from_class (obj, toporouter_constraint_class ()))
#define TOPOROUTER_CONSTRAINT(obj)   GTS_OBJECT_CAST (obj, toporouter_constraint_t, toporouter_constraint_class ())
#define TOPOROUTER_CONSTRAINT_CLASS(klass)   GTS_OBJECT_CLASS_CAST (klass, toporouter_constraint_class_t, toporouter_constraint_class ())
#define TOPOROUTER_VERTEX_REGION(x)   ((toporouter_vertex_region_t *)x)
#define TOPOROUTER_RUBBERBAND_ARC(x)   ((toporouter_rubberband_arc_t *)x)
#define TOPOROUTER_ROUTE(x)   ((toporouter_route_t *)x)
#define TOPOROUTER_NETLIST(x)   ((toporouter_netlist_t *)x)
#define TOPOROUTER_CLUSTER(x)   ((toporouter_cluster_t *)x)
#define TOPOROUTER_OPROUTE(x)   ((toporouter_oproute_t *)x)
#define oproute_next(a, b)   (b->next ? TOPOROUTER_ARC(b->next->data) : a->term2)
#define oproute_prev(a, b)   (b->prev ? TOPOROUTER_ARC(b->prev->data) : a->term1)
#define TOPOROUTER_SERPINTINE(x)   ((toporouter_serpintine_t *)x)
#define TOPOROUTER_IS_ARC(obj)   (gts_object_is_from_class (obj, toporouter_arc_class()))
#define TOPOROUTER_ARC(obj)   GTS_OBJECT_CAST (obj, toporouter_arc_t, toporouter_arc_class())
#define TOPOROUTER_ARC_CLASS(klass)   GTS_OBJECT_CLASS_CAST (klass, toporouter_arc_class_t, toporouter_arc_class())
#define TOPOROUTER_NETSCORE(x)   ((toporouter_netscore_t *)x)
#define FOREACH_CLUSTER(clusters)
#define FOREACH_BBOX(boxes)
#define FOREACH_ROUTE(routes)
#define FOREACH_NETSCORE(netscores)
#define FOREACH_NETLIST(netlists)
#define FOREACH_END   }} while(0)

Typedefs

typedef struct _toporouter_bbox_t toporouter_bbox_t
typedef struct
_toporouter_bbox_class_t 
toporouter_bbox_class_t
typedef struct _toporouter_edge_t toporouter_edge_t
typedef struct
_toporouter_edge_class_t 
toporouter_edge_class_t
typedef struct _toporouter_vertex_t toporouter_vertex_t
typedef struct
_toporouter_vertex_class_t 
toporouter_vertex_class_t
typedef struct
_toporouter_constraint_t 
toporouter_constraint_t
typedef struct
_toporouter_constraint_class_t 
toporouter_constraint_class_t
typedef struct
_toporouter_rubberband_arc_t 
toporouter_rubberband_arc_t
typedef struct _toporouter_route_t toporouter_route_t
typedef struct
_toporouter_netlist_t 
toporouter_netlist_t
typedef struct
_toporouter_cluster_t 
toporouter_cluster_t
typedef struct
_toporouter_serpintine_t 
toporouter_serpintine_t
typedef struct
_toporouter_oproute_t 
toporouter_oproute_t
typedef struct _toporouter_arc_t toporouter_arc_t
typedef struct
_toporouter_arc_class_t 
toporouter_arc_class_t
typedef struct _toporouter_t toporouter_t
typedef gint(* oproute_adjseg_func )(toporouter_t *, GList **, GList **, guint *, gdouble, gdouble, gdouble, gdouble, toporouter_oproute_t *, toporouter_oproute_t *)

Enumerations

enum  toporouter_term_t {
  PAD, PIN, VIA, ARC,
  VIA_SHADOW, LINE, OTHER, BOARD,
  EXPANSION_AREA, POLYGON, TEMP
}

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

Definition in file toporouter.h.


Define Documentation

#define close_enough_xy (   a,
 
)    (vx(a) > vx(b) - EPSILON && vx(a) < vx(b) + EPSILON && vy(a) > vy(b) - EPSILON && vy(a) < vy(b) + EPSILON)

Definition at line 103 of file toporouter.h.

#define EDGE_FLAG_DIRECTCONNECTION   (1<<0)

Definition at line 163 of file toporouter.h.

Referenced by compute_candidate_points(), and delete_route().

#define edge_routing_next (   e,
  list 
)    ((list->next) ? TOPOROUTER_VERTEX(list->next->data) : TOPOROUTER_VERTEX(edge_v2(e)))

Definition at line 96 of file toporouter.h.

Referenced by edge_min_spacing(), and toporouter_draw_surface().

#define edge_routing_prev (   e,
  list 
)    ((list->prev) ? TOPOROUTER_VERTEX(list->prev->data) : TOPOROUTER_VERTEX(edge_v1(e)))

Definition at line 97 of file toporouter.h.

Referenced by edge_min_spacing(), and toporouter_draw_surface().

#define EPSILON   0.0001f

Definition at line 80 of file toporouter.h.

#define FOREACH_BBOX (   boxes)
Value:
do { \
  for(toporouter_bbox_t **i = ((toporouter_bbox_t **)boxes->pdata) + boxes->len - 1; i >= (toporouter_bbox_t **)boxes->pdata && boxes->len > 0; --i) { \
    toporouter_bbox_t *box = *i;

Definition at line 470 of file toporouter.h.

Referenced by cluster_vertices(), and print_cluster().

#define FOREACH_CLUSTER (   clusters)
Value:
do { \
  for(toporouter_cluster_t **i = ((toporouter_cluster_t **)clusters->pdata) + clusters->len - 1; i >= (toporouter_cluster_t **)clusters->pdata && clusters->len > 0; --i) { \
    toporouter_cluster_t *cluster = *i;

Definition at line 466 of file toporouter.h.

Referenced by cluster_merge(), cluster_vertices(), netlist_recalculate(), netlists_rollback(), and print_netlist().

#define FOREACH_NETLIST (   netlists)
Value:
do { \
  for(toporouter_netlist_t **i = ((toporouter_netlist_t **)netlists->pdata) + netlists->len - 1; i >= (toporouter_netlist_t **)netlists->pdata && netlists->len > 0; --i) { \
    toporouter_netlist_t *netlist = *i;

Definition at line 482 of file toporouter.h.

Referenced by find_netlist_by_name().

#define FOREACH_NETSCORE (   netscores)
Value:
do { \
  for(toporouter_netscore_t **i = ((toporouter_netscore_t **)netscores->pdata) + netscores->len - 1; i >= (toporouter_netscore_t **)netscores->pdata && netscores->len > 0; --i) { \
    toporouter_netscore_t *netscore = *i;

Definition at line 478 of file toporouter.h.

Referenced by order_nets_preroute_greedy().

#define FOREACH_ROUTE (   routes)
Value:
do { \
  for(toporouter_route_t **i = ((toporouter_route_t **)routes->pdata) + routes->len - 1; i >= (toporouter_route_t **)routes->pdata && routes->len > 0; --i) { \
    toporouter_route_t *routedata = *i;

Definition at line 474 of file toporouter.h.

#define oproute_next (   a,
 
)    (b->next ? TOPOROUTER_ARC(b->next->data) : a->term2)

Definition at line 332 of file toporouter.h.

#define oproute_prev (   a,
 
)    (b->prev ? TOPOROUTER_ARC(b->prev->data) : a->term1)

Definition at line 333 of file toporouter.h.

#define tedge (   v1,
  v2 
)    TOPOROUTER_EDGE(gts_vertices_are_connected(GTS_VERTEX(v1), GTS_VERTEX(v2)))

Definition at line 91 of file toporouter.h.

Referenced by check_adj_pushing_vertex(), check_speccut(), and oproute_path_speccut().

#define tev1x (   e)    (vx(tedge_v1(e))

Definition at line 105 of file toporouter.h.

#define tev1y (   e)    (vy(tedge_v1(e))

Definition at line 106 of file toporouter.h.

#define tev1z (   e)    (vz(tedge_v1(e))

Definition at line 107 of file toporouter.h.

#define tev2x (   e)    (vx(tedge_v2(e))

Definition at line 108 of file toporouter.h.

#define tev2y (   e)    (vy(tedge_v2(e))

Definition at line 109 of file toporouter.h.

#define tev2z (   e)    (vz(tedge_v2(e))

Definition at line 110 of file toporouter.h.

#define TOPOROUTER_ARC (   obj)    GTS_OBJECT_CAST (obj, toporouter_arc_t, toporouter_arc_class())
#define TOPOROUTER_ARC_CLASS (   klass)    GTS_OBJECT_CLASS_CAST (klass, toporouter_arc_class_t, toporouter_arc_class())

Definition at line 365 of file toporouter.h.

#define TOPOROUTER_BBOX (   obj)    GTS_OBJECT_CAST (obj, toporouter_bbox_t, toporouter_bbox_class ())
#define TOPOROUTER_BBOX_CLASS (   klass)    GTS_OBJECT_CLASS_CAST (klass, toporouter_bbox_class_t, toporouter_bbox_class ())

Definition at line 116 of file toporouter.h.

#define TOPOROUTER_CLUSTER (   x)    ((toporouter_cluster_t *)x)

Definition at line 328 of file toporouter.h.

#define TOPOROUTER_CONSTRAINT_CLASS (   klass)    GTS_OBJECT_CLASS_CAST (klass, toporouter_constraint_class_t, toporouter_constraint_class ())

Definition at line 229 of file toporouter.h.

#define TOPOROUTER_EDGE_CLASS (   klass)    GTS_OBJECT_CLASS_CAST (klass, toporouter_edge_class_t, toporouter_edge_class ())

Definition at line 161 of file toporouter.h.

#define TOPOROUTER_FLAG_AFTERORDER   (1<<6)

Definition at line 71 of file toporouter.h.

Referenced by hybrid_router(), and route().

#define TOPOROUTER_FLAG_AFTERRUBIX   (1<<7)

Definition at line 72 of file toporouter.h.

Referenced by cluster_vertices(), and hybrid_router().

#define TOPOROUTER_FLAG_DETOUR   (1<<9)

Definition at line 74 of file toporouter.h.

Referenced by detour_router(), and gcost().

#define TOPOROUTER_FLAG_GOFAR   (1<<8)

Definition at line 73 of file toporouter.h.

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

#define TOPOROUTER_FLAG_HARDDEST   (1<<1)

Definition at line 66 of file toporouter.h.

#define TOPOROUTER_FLAG_HARDSRC   (1<<2)

Definition at line 67 of file toporouter.h.

#define TOPOROUTER_FLAG_LAYERHINT   (1<<4)

Definition at line 69 of file toporouter.h.

#define TOPOROUTER_FLAG_LEASTINVALID   (1<<5)

Definition at line 70 of file toporouter.h.

Referenced by compute_candidate_points(), gcost(), roar_detour_route(), and roar_route().

#define TOPOROUTER_FLAG_MATCH   (1<<3)

Definition at line 68 of file toporouter.h.

#define TOPOROUTER_FLAG_VERBOSE   (1<<0)

Definition at line 65 of file toporouter.h.

#define TOPOROUTER_IS_ARC (   obj)    (gts_object_is_from_class (obj, toporouter_arc_class()))

Definition at line 363 of file toporouter.h.

Referenced by oproute_check_all_loops(), and oproute_rubberband_segment().

#define TOPOROUTER_IS_BBOX (   obj)    (gts_object_is_from_class (obj, toporouter_bbox_class ()))

Definition at line 114 of file toporouter.h.

#define TOPOROUTER_IS_EDGE (   obj)    (gts_object_is_from_class (obj, toporouter_edge_class ()))
#define TOPOROUTER_IS_VERTEX (   obj)    (gts_object_is_from_class (obj, toporouter_vertex_class ()))
#define TOPOROUTER_NETLIST (   x)    ((toporouter_netlist_t *)x)

Definition at line 318 of file toporouter.h.

Referenced by netlists_recalculate(), and netlists_rollback().

#define TOPOROUTER_NETSCORE (   x)    ((toporouter_netscore_t *)x)

Definition at line 408 of file toporouter.h.

#define TOPOROUTER_OPROUTE (   x)    ((toporouter_oproute_t *)x)

Definition at line 330 of file toporouter.h.

#define TOPOROUTER_RUBBERBAND_ARC (   x)    ((toporouter_rubberband_arc_t *)x)

Definition at line 276 of file toporouter.h.

Referenced by oproute_rubberband_segment().

#define TOPOROUTER_SERPINTINE (   x)    ((toporouter_serpintine_t *)x)

Definition at line 335 of file toporouter.h.

#define TOPOROUTER_VERTEX (   obj)    GTS_OBJECT_CAST (obj, toporouter_vertex_t, toporouter_vertex_class ())
#define TOPOROUTER_VERTEX_CLASS (   klass)    GTS_OBJECT_CLASS_CAST (klass, toporouter_vertex_class_t, toporouter_vertex_class ())

Definition at line 183 of file toporouter.h.

#define TOPOROUTER_VERTEX_REGION (   x)    ((toporouter_vertex_region_t *)x)

Definition at line 259 of file toporouter.h.

#define tvdistance (   a,
 
)    hypot(vx(a)-vx(b),vy(a)-vy(b))
#define tvertex_intersect (   a,
  b,
  c,
 
)    (TOPOROUTER_VERTEX(vertex_intersect(GTS_VERTEX(a),GTS_VERTEX(b),GTS_VERTEX(c),GTS_VERTEX(d))))

Definition at line 112 of file toporouter.h.

Referenced by speccut_edge_routing_from_edge().

#define VERTEX_FLAG_BLUE   (1<<6)

Definition at line 190 of file toporouter.h.

Referenced by toporouter_draw_surface(), and toporouter_draw_vertex().

#define VERTEX_FLAG_CCW   (1<<2)

Definition at line 186 of file toporouter.h.

#define VERTEX_FLAG_CW   (1<<3)

Definition at line 187 of file toporouter.h.

#define VERTEX_FLAG_FAKE   (1<<10)

Definition at line 193 of file toporouter.h.

Referenced by print_vertex().

#define VERTEX_FLAG_GREEN   (1<<5)

Definition at line 189 of file toporouter.h.

Referenced by toporouter_draw_surface(), and toporouter_draw_vertex().

#define VERTEX_FLAG_RED   (1<<4)

Definition at line 188 of file toporouter.h.

Referenced by toporouter_draw_surface(), and toporouter_draw_vertex().

#define VERTEX_FLAG_SPECCUT   (1<<11)
#define VERTEX_FLAG_VIZ   (1<<1)

Definition at line 185 of file toporouter.h.

#define vrouting (   v)    (edge_routing(v->routingedge))

Definition at line 94 of file toporouter.h.

Referenced by split_edge_routing().


Typedef Documentation

typedef gint(* oproute_adjseg_func)(toporouter_t *, GList **, GList **, guint *, gdouble, gdouble, gdouble, gdouble, toporouter_oproute_t *, toporouter_oproute_t *)

Definition at line 442 of file toporouter.h.

Definition at line 388 of file toporouter.h.

Definition at line 387 of file toporouter.h.

Definition at line 157 of file toporouter.h.

Definition at line 156 of file toporouter.h.

Definition at line 326 of file toporouter.h.

Definition at line 245 of file toporouter.h.

Definition at line 179 of file toporouter.h.

Definition at line 178 of file toporouter.h.

Definition at line 316 of file toporouter.h.

Definition at line 360 of file toporouter.h.

Definition at line 304 of file toporouter.h.

Definition at line 275 of file toporouter.h.

Definition at line 347 of file toporouter.h.

typedef struct _toporouter_t toporouter_t

Definition at line 390 of file toporouter.h.

Definition at line 225 of file toporouter.h.

Definition at line 224 of file toporouter.h.


Enumeration Type Documentation

Enumerator:
PAD 
PIN 
VIA 
ARC 
VIA_SHADOW 
LINE 
OTHER 
BOARD 
EXPANSION_AREA 
POLYGON 
TEMP 

Definition at line 118 of file toporouter.h.