KiCad PCB EDA Suite
MATRIX_ROUTING_HEAD Class Reference

class MATRIX_ROUTING_HEAD handle the matrix routing that describes the actual board More...

#include <autorout.h>

Public Member Functions

 MATRIX_ROUTING_HEAD ()
 
 ~MATRIX_ROUTING_HEAD ()
 
void WriteCell (int aRow, int aCol, int aSide, MATRIX_CELL aCell)
 
wxPoint GetBrdCoordOrigin ()
 function GetBrdCoordOrigin More...
 
bool ComputeMatrixSize (BOARD *aPcb, bool aUseBoardEdgesOnly=false)
 Function ComputeMatrixSize calculates the number of rows and columns of dimensions of aPcb for routing and automatic calculation of area. More...
 
int InitRoutingMatrix ()
 Function InitBoard initializes the data structures. More...
 
void UnInitRoutingMatrix ()
 
void SetCellOperation (int aLogicOp)
 
MATRIX_CELL GetCell (int aRow, int aCol, int aSide)
 
void SetCell (int aRow, int aCol, int aSide, MATRIX_CELL aCell)
 
void OrCell (int aRow, int aCol, int aSide, MATRIX_CELL aCell)
 
void XorCell (int aRow, int aCol, int aSide, MATRIX_CELL aCell)
 
void AndCell (int aRow, int aCol, int aSide, MATRIX_CELL aCell)
 
void AddCell (int aRow, int aCol, int aSide, MATRIX_CELL aCell)
 
DIST_CELL GetDist (int aRow, int aCol, int aSide)
 
void SetDist (int aRow, int aCol, int aSide, DIST_CELL)
 
int GetDir (int aRow, int aCol, int aSide)
 
void SetDir (int aRow, int aCol, int aSide, int aDir)
 
int CalcDist (int x, int y, int z, int side)
 
int GetApxDist (int r1, int c1, int r2, int c2)
 

Public Attributes

MATRIX_CELLm_BoardSide [MAX_ROUTING_LAYERS_COUNT]
 
DIST_CELLm_DistSide [MAX_ROUTING_LAYERS_COUNT]
 
DIR_CELLm_DirSide [MAX_ROUTING_LAYERS_COUNT]
 
bool m_InitMatrixDone
 
int m_RoutingLayersCount
 
int m_GridRouting
 
EDA_RECT m_BrdBox
 
int m_Nrows
 
int m_Ncols
 
int m_MemSize
 
int m_RouteCount
 

Private Attributes

void(MATRIX_ROUTING_HEAD::* m_opWriteCell )(int aRow, int aCol, int aSide, MATRIX_CELL aCell)
 

Detailed Description

class MATRIX_ROUTING_HEAD handle the matrix routing that describes the actual board

Definition at line 104 of file autorout.h.

Constructor & Destructor Documentation

MATRIX_ROUTING_HEAD::MATRIX_ROUTING_HEAD ( )
MATRIX_ROUTING_HEAD::~MATRIX_ROUTING_HEAD ( )

Member Function Documentation

void MATRIX_ROUTING_HEAD::AddCell ( int  aRow,
int  aCol,
int  aSide,
MATRIX_CELL  aCell 
)
void MATRIX_ROUTING_HEAD::AndCell ( int  aRow,
int  aCol,
int  aSide,
MATRIX_CELL  aCell 
)
int MATRIX_ROUTING_HEAD::CalcDist ( int  x,
int  y,
int  z,
int  side 
)

Definition at line 138 of file dist.cpp.

References BOTTOM, dir_penalty_BOTTOM, dir_penalty_TOP, dist, EMPTY, FROM_OTHERSIDE, m_RouteCount, penalty, and TOP.

Referenced by Autoroute_One_Track().

139 {
140  int adjust, ldist;
141 
142  adjust = 0; /* set if hole is encountered */
143 
144  if( x == EMPTY )
145  x = 10;
146 
147  if( y == EMPTY )
148  {
149  y = 10;
150  }
151  else if( y == FROM_OTHERSIDE )
152  {
153  if( z == EMPTY )
154  z = 10;
155 
156  adjust = penalty[x-1][z-1];
157  }
158 
159  ldist = dist[x-1][y-1] + penalty[x-1][y-1] + adjust;
160 
161  if( m_RouteCount > 1 )
162  {
163  if( side == BOTTOM )
164  ldist += dir_penalty_TOP[x-1][y-1];
165 
166  if( side == TOP )
167  ldist += dir_penalty_BOTTOM[x-1][y-1];
168  }
169 
170  return ldist * 10;
171 }
#define FROM_OTHERSIDE
Definition: ar_cell.h:108
static const int dist[10][10]
Definition: dist.cpp:57
static const int penalty[10][10]
Definition: dist.cpp:74
#define TOP
Definition: autorout.h:49
static const int dir_penalty_TOP[10][10]
Definition: dist.cpp:92
#define EMPTY
Definition: autorout.h:51
static int dir_penalty_BOTTOM[10][10]
Definition: dist.cpp:109
#define BOTTOM
Definition: autorout.h:50
bool MATRIX_ROUTING_HEAD::ComputeMatrixSize ( BOARD aPcb,
bool  aUseBoardEdgesOnly = false 
)

Function ComputeMatrixSize calculates the number of rows and columns of dimensions of aPcb for routing and automatic calculation of area.

Parameters
aPcb= the physical board
aUseBoardEdgesOnly= true to use board edges only, = false to use the full board bounding box (default)
int MATRIX_ROUTING_HEAD::GetApxDist ( int  r1,
int  c1,
int  r2,
int  c2 
)

Definition at line 42 of file dist.cpp.

Referenced by Autoroute_One_Track(), and SetWork().

43 {
44  int d1, d2; /* row and column deltas */
45 
46  if( ( d1 = r1 - r2 ) < 0 ) /* get absolute row delta */
47  d1 = -d1;
48 
49  if( ( d2 = c1 - c2 ) < 0 ) /* get absolute column delta */
50  d2 = -d2;
51 
52  return ( d1+d2 ) * 50;
53 }
wxPoint MATRIX_ROUTING_HEAD::GetBrdCoordOrigin ( )
inline

function GetBrdCoordOrigin

Returns
the board coordinate corresponding to the routing matrix origin ( board coordinate offset )

Definition at line 139 of file autorout.h.

References EDA_RECT::GetOrigin(), and RoutingMatrix.

Referenced by TraceFilledCircle(), TraceFilledRectangle(), and TraceSegmentPcb().

140  {
141  return m_BrdBox.GetOrigin();
142  }
const wxPoint GetOrigin() const
Definition: eda_rect.h:112
EDA_RECT m_BrdBox
Definition: autorout.h:115
MATRIX_CELL MATRIX_ROUTING_HEAD::GetCell ( int  aRow,
int  aCol,
int  aSide 
)
int MATRIX_ROUTING_HEAD::GetDir ( int  aRow,
int  aCol,
int  aSide 
)

Referenced by Autoroute_One_Track(), and Retrace().

DIST_CELL MATRIX_ROUTING_HEAD::GetDist ( int  aRow,
int  aCol,
int  aSide 
)

Referenced by Autoroute_One_Track().

int MATRIX_ROUTING_HEAD::InitRoutingMatrix ( )

Function InitBoard initializes the data structures.

Returns
the amount of memory used or -1 if default.
void MATRIX_ROUTING_HEAD::OrCell ( int  aRow,
int  aCol,
int  aSide,
MATRIX_CELL  aCell 
)
void MATRIX_ROUTING_HEAD::SetCell ( int  aRow,
int  aCol,
int  aSide,
MATRIX_CELL  aCell 
)
void MATRIX_ROUTING_HEAD::SetCellOperation ( int  aLogicOp)
void MATRIX_ROUTING_HEAD::SetDir ( int  aRow,
int  aCol,
int  aSide,
int  aDir 
)

Referenced by Autoroute_One_Track().

void MATRIX_ROUTING_HEAD::SetDist ( int  aRow,
int  aCol,
int  aSide,
DIST_CELL   
)

Referenced by Autoroute_One_Track().

void MATRIX_ROUTING_HEAD::UnInitRoutingMatrix ( )
void MATRIX_ROUTING_HEAD::WriteCell ( int  aRow,
int  aCol,
int  aSide,
MATRIX_CELL  aCell 
)
inline

Definition at line 129 of file autorout.h.

Referenced by TraceFilledCircle(), and TraceFilledRectangle().

130  {
131  (*this.*m_opWriteCell)( aRow, aCol, aSide, aCell );
132  }
void(MATRIX_ROUTING_HEAD::* m_opWriteCell)(int aRow, int aCol, int aSide, MATRIX_CELL aCell)
Definition: autorout.h:122
void MATRIX_ROUTING_HEAD::XorCell ( int  aRow,
int  aCol,
int  aSide,
MATRIX_CELL  aCell 
)

Member Data Documentation

MATRIX_CELL* MATRIX_ROUTING_HEAD::m_BoardSide[MAX_ROUTING_LAYERS_COUNT]

Definition at line 107 of file autorout.h.

EDA_RECT MATRIX_ROUTING_HEAD::m_BrdBox

Definition at line 115 of file autorout.h.

DIR_CELL* MATRIX_ROUTING_HEAD::m_DirSide[MAX_ROUTING_LAYERS_COUNT]

Definition at line 110 of file autorout.h.

Referenced by Autoroute_One_Track().

DIST_CELL* MATRIX_ROUTING_HEAD::m_DistSide[MAX_ROUTING_LAYERS_COUNT]

Definition at line 108 of file autorout.h.

int MATRIX_ROUTING_HEAD::m_GridRouting
bool MATRIX_ROUTING_HEAD::m_InitMatrixDone

Definition at line 112 of file autorout.h.

int MATRIX_ROUTING_HEAD::m_MemSize

Definition at line 117 of file autorout.h.

int MATRIX_ROUTING_HEAD::m_Ncols
int MATRIX_ROUTING_HEAD::m_Nrows
void(MATRIX_ROUTING_HEAD::* MATRIX_ROUTING_HEAD::m_opWriteCell) (int aRow, int aCol, int aSide, MATRIX_CELL aCell)
private

Definition at line 122 of file autorout.h.

int MATRIX_ROUTING_HEAD::m_RouteCount

Definition at line 118 of file autorout.h.

Referenced by CalcDist().

int MATRIX_ROUTING_HEAD::m_RoutingLayersCount

Definition at line 113 of file autorout.h.

Referenced by DisplayRoutingMatrix(), TraceFilledCircle(), and TraceFilledRectangle().


The documentation for this class was generated from the following files: