KiCad PCB EDA Suite
|
Handle the matrix routing that describes the actual board. More...
#include <ar_matrix.h>
Public Types | |
enum | CELL_OP { WRITE_CELL = 0 , WRITE_OR_CELL = 1 , WRITE_XOR_CELL = 2 , WRITE_AND_CELL = 3 , WRITE_ADD_CELL = 4 } |
typedef unsigned char | MATRIX_CELL |
typedef int | DIST_CELL |
Public Member Functions | |
AR_MATRIX () | |
~AR_MATRIX () | |
void | WriteCell (int aRow, int aCol, int aSide, MATRIX_CELL aCell) |
VECTOR2I | GetBrdCoordOrigin () |
bool | ComputeMatrixSize (const BOX2I &aBoundingBox) |
Calculate the number of rows and columns of dimensions of aPcb for routing and automatic calculation of area. | |
int | InitRoutingMatrix () |
Initialize the data structures. | |
void | UnInitRoutingMatrix () |
void | SetCellOperation (CELL_OP 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) |
void | TraceSegmentPcb (PCB_SHAPE *aShape, int aColor, int aMargin, AR_MATRIX::CELL_OP op_logic) |
void | CreateKeepOutRectangle (int ux0, int uy0, int ux1, int uy1, int marge, int aKeepOut, LSET aLayerMask) |
Function CreateKeepOutRectangle builds the cost map: Cells ( in Dist map ) inside the rect x0,y0 a x1,y1 are incremented by value aKeepOut Cell outside this rectangle, but inside the rectangle x0,y0 -marge to x1,y1 + marge are incremented by a decreasing value (aKeepOut ... 0). | |
void | PlacePad (PAD *aPad, int color, int marge, AR_MATRIX::CELL_OP op_logic) |
void | TraceFilledRectangle (int ux0, int uy0, int ux1, int uy1, double angle, LSET aLayerMask, int color, AR_MATRIX::CELL_OP op_logic) |
void | TraceFilledRectangle (int ux0, int uy0, int ux1, int uy1, LSET aLayerMask, int color, AR_MATRIX::CELL_OP op_logic) |
Public Attributes | |
MATRIX_CELL * | m_BoardSide [AR_MAX_ROUTING_LAYERS_COUNT] |
DIST_CELL * | m_DistSide [AR_MAX_ROUTING_LAYERS_COUNT] |
int | m_RoutingLayersCount |
int | m_GridRouting |
BOX2I | m_BrdBox |
int | m_Nrows |
int | m_Ncols |
int | m_MemSize |
int | m_RouteCount |
PCB_LAYER_ID | m_routeLayerTop |
PCB_LAYER_ID | m_routeLayerBottom |
Private Member Functions | |
void | drawSegmentQcq (int ux0, int uy0, int ux1, int uy1, int lg, int layer, int color, CELL_OP op_logic) |
void | traceCircle (int ux0, int uy0, int ux1, int uy1, int lg, int layer, int color, AR_MATRIX::CELL_OP op_logic) |
void | traceFilledCircle (int cx, int cy, int radius, LSET aLayerMask, int color, AR_MATRIX::CELL_OP op_logic) |
void | traceArc (int ux0, int uy0, int ux1, int uy1, const EDA_ANGLE &arcAngle, int lg, int layer, int color, AR_MATRIX::CELL_OP op_logic) |
Private Attributes | |
void(AR_MATRIX::* | m_opWriteCell )(int aRow, int aCol, int aSide, MATRIX_CELL aCell) |
Handle the matrix routing that describes the actual board.
Definition at line 47 of file ar_matrix.h.
typedef int AR_MATRIX::DIST_CELL |
Definition at line 51 of file ar_matrix.h.
typedef unsigned char AR_MATRIX::MATRIX_CELL |
Definition at line 50 of file ar_matrix.h.
enum AR_MATRIX::CELL_OP |
Enumerator | |
---|---|
WRITE_CELL | |
WRITE_OR_CELL | |
WRITE_XOR_CELL | |
WRITE_AND_CELL | |
WRITE_ADD_CELL |
Definition at line 53 of file ar_matrix.h.
AR_MATRIX::AR_MATRIX | ( | ) |
Definition at line 37 of file ar_matrix.cpp.
References B_Cu, F_Cu, m_BoardSide, m_DistSide, m_GridRouting, m_MemSize, m_Ncols, m_Nrows, m_opWriteCell, m_RouteCount, m_routeLayerBottom, m_routeLayerTop, and m_RoutingLayersCount.
AR_MATRIX::~AR_MATRIX | ( | ) |
Definition at line 55 of file ar_matrix.cpp.
void AR_MATRIX::AddCell | ( | int | aRow, |
int | aCol, | ||
int | aSide, | ||
MATRIX_CELL | aCell | ||
) |
Definition at line 225 of file ar_matrix.cpp.
References m_BoardSide, and m_Ncols.
Referenced by SetCellOperation().
void AR_MATRIX::AndCell | ( | int | aRow, |
int | aCol, | ||
int | aSide, | ||
MATRIX_CELL | aCell | ||
) |
Definition at line 214 of file ar_matrix.cpp.
References m_BoardSide, and m_Ncols.
Referenced by SetCellOperation().
bool AR_MATRIX::ComputeMatrixSize | ( | const BOX2I & | aBoundingBox | ) |
Calculate the number of rows and columns of dimensions of aPcb for routing and automatic calculation of area.
aPcb | is the physical board. |
aUseBoardEdgesOnly | set to true to use board edges only or false to use the full board bounding box (default). |
Definition at line 62 of file ar_matrix.cpp.
References BOX2< Vec >::GetEnd(), BOX2< Vec >::GetHeight(), BOX2< Vec >::GetWidth(), BOX2< Vec >::GetX(), BOX2< Vec >::GetY(), m_BrdBox, m_GridRouting, m_Ncols, m_Nrows, BOX2< Vec >::SetEnd(), BOX2< Vec >::SetX(), BOX2< Vec >::SetY(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by AR_AUTOPLACER::genPlacementRoutingMatrix().
void AR_MATRIX::CreateKeepOutRectangle | ( | int | ux0, |
int | uy0, | ||
int | ux1, | ||
int | uy1, | ||
int | marge, | ||
int | aKeepOut, | ||
LSET | aLayerMask | ||
) |
Function CreateKeepOutRectangle builds the cost map: Cells ( in Dist map ) inside the rect x0,y0 a x1,y1 are incremented by value aKeepOut Cell outside this rectangle, but inside the rectangle x0,y0 -marge to x1,y1 + marge are incremented by a decreasing value (aKeepOut ... 0).
The decreasing value depends on the distance to the first rectangle Therefore the cost is high in rect x0,y0 to x1,y1, and decrease outside this rectangle
Definition at line 795 of file ar_matrix.cpp.
References AR_SIDE_BOTTOM, AR_SIDE_TOP, GetDist(), BOX2< Vec >::GetX(), BOX2< Vec >::GetY(), m_BrdBox, m_GridRouting, m_Ncols, m_Nrows, m_routeLayerBottom, m_routeLayerTop, m_RoutingLayersCount, and SetDist().
Referenced by AR_AUTOPLACER::genModuleOnRoutingMatrix().
|
private |
Definition at line 286 of file ar_matrix.cpp.
References m_GridRouting, m_Ncols, m_Nrows, OP_CELL, RotatePoint(), and SetCellOperation().
Referenced by traceArc(), traceCircle(), and TraceSegmentPcb().
|
inline |
Definition at line 74 of file ar_matrix.h.
References BOX2< Vec >::GetOrigin(), and m_BrdBox.
Referenced by AR_AUTOPLACER::fillMatrix(), traceFilledCircle(), TraceFilledRectangle(), and TraceSegmentPcb().
AR_MATRIX::MATRIX_CELL AR_MATRIX::GetCell | ( | int | aRow, |
int | aCol, | ||
int | aSide | ||
) |
Definition at line 170 of file ar_matrix.cpp.
References m_BoardSide, and m_Ncols.
Referenced by AR_AUTOPLACER::testRectangle().
AR_MATRIX::DIST_CELL AR_MATRIX::GetDist | ( | int | aRow, |
int | aCol, | ||
int | aSide | ||
) |
Definition at line 235 of file ar_matrix.cpp.
References m_DistSide, and m_Ncols.
Referenced by AR_AUTOPLACER::calculateKeepOutArea(), and CreateKeepOutRectangle().
int AR_MATRIX::InitRoutingMatrix | ( | ) |
Initialize the data structures.
Definition at line 92 of file ar_matrix.cpp.
References AR_SIDE_BOTTOM, AR_SIDE_TOP, m_BoardSide, m_DistSide, m_MemSize, m_Ncols, m_Nrows, m_RouteCount, and m_RoutingLayersCount.
Referenced by AR_AUTOPLACER::genPlacementRoutingMatrix().
void AR_MATRIX::OrCell | ( | int | aRow, |
int | aCol, | ||
int | aSide, | ||
MATRIX_CELL | aCell | ||
) |
Definition at line 192 of file ar_matrix.cpp.
References m_BoardSide, and m_Ncols.
Referenced by SetCellOperation().
void AR_MATRIX::PlacePad | ( | PAD * | aPad, |
int | color, | ||
int | marge, | ||
AR_MATRIX::CELL_OP | op_logic | ||
) |
Definition at line 900 of file ar_matrix.cpp.
References ANGLE_270, ANGLE_90, EDA_ANGLE::AsTenthsOfADegree(), color, PAD::GetDelta(), PAD::GetLayerSet(), PAD::GetOrientation(), PAD::GetShape(), PAD::GetSize(), EDA_ANGLE::IsCardinal(), PAD::ShapePos(), traceFilledCircle(), TraceFilledRectangle(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by AR_AUTOPLACER::genModuleOnRoutingMatrix().
void AR_MATRIX::SetCell | ( | int | aRow, |
int | aCol, | ||
int | aSide, | ||
MATRIX_CELL | aCell | ||
) |
Definition at line 181 of file ar_matrix.cpp.
References m_BoardSide, and m_Ncols.
Referenced by AR_AUTOPLACER::fillMatrix(), and SetCellOperation().
void AR_MATRIX::SetCellOperation | ( | AR_MATRIX::CELL_OP | aLogicOp | ) |
Definition at line 154 of file ar_matrix.cpp.
References AddCell(), AndCell(), m_opWriteCell, OrCell(), SetCell(), WRITE_ADD_CELL, WRITE_AND_CELL, WRITE_CELL, WRITE_OR_CELL, WRITE_XOR_CELL, and XorCell().
Referenced by drawSegmentQcq(), traceFilledCircle(), and TraceFilledRectangle().
void AR_MATRIX::SetDist | ( | int | aRow, |
int | aCol, | ||
int | aSide, | ||
DIST_CELL | x | ||
) |
Definition at line 245 of file ar_matrix.cpp.
References m_DistSide, and m_Ncols.
Referenced by CreateKeepOutRectangle().
|
private |
Definition at line 560 of file ar_matrix.cpp.
References std::abs(), EDA_ANGLE::AsDegrees(), color, EDA_ANGLE::Cos(), drawSegmentQcq(), KiROUND(), and EDA_ANGLE::Normalize().
Referenced by TraceSegmentPcb().
|
private |
Definition at line 401 of file ar_matrix.cpp.
References ANGLE_360, color, EDA_ANGLE::Cos(), drawSegmentQcq(), KiROUND(), and EDA_ANGLE::Sin().
Referenced by TraceSegmentPcb().
|
private |
Definition at line 439 of file ar_matrix.cpp.
References AR_SIDE_BOTTOM, AR_SIDE_TOP, color, GetBrdCoordOrigin(), m_GridRouting, m_Ncols, m_Nrows, m_routeLayerBottom, m_routeLayerTop, m_RoutingLayersCount, SetCellOperation(), WriteCell(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by PlacePad().
void AR_MATRIX::TraceFilledRectangle | ( | int | ux0, |
int | uy0, | ||
int | ux1, | ||
int | uy1, | ||
double | angle, | ||
LSET | aLayerMask, | ||
int | color, | ||
AR_MATRIX::CELL_OP | op_logic | ||
) |
Definition at line 603 of file ar_matrix.cpp.
References AR_SIDE_BOTTOM, AR_SIDE_TOP, color, GetBrdCoordOrigin(), KiROUND(), m_GridRouting, m_Ncols, m_Nrows, m_routeLayerBottom, m_routeLayerTop, m_RoutingLayersCount, RotatePoint(), SetCellOperation(), TENTHS_OF_A_DEGREE_T, WriteCell(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by AR_AUTOPLACER::genModuleOnRoutingMatrix(), and PlacePad().
void AR_MATRIX::TraceFilledRectangle | ( | int | ux0, |
int | uy0, | ||
int | ux1, | ||
int | uy1, | ||
LSET | aLayerMask, | ||
int | color, | ||
AR_MATRIX::CELL_OP | op_logic | ||
) |
Definition at line 691 of file ar_matrix.cpp.
References AR_SIDE_BOTTOM, AR_SIDE_TOP, color, GetBrdCoordOrigin(), m_GridRouting, m_Ncols, m_Nrows, m_routeLayerBottom, m_routeLayerTop, m_RoutingLayersCount, SetCellOperation(), WriteCell(), VECTOR2< T >::x, and VECTOR2< T >::y.
void AR_MATRIX::TraceSegmentPcb | ( | PCB_SHAPE * | aShape, |
int | aColor, | ||
int | aMargin, | ||
AR_MATRIX::CELL_OP | op_logic | ||
) |
Definition at line 753 of file ar_matrix.cpp.
References drawSegmentQcq(), EDA_SHAPE::GetArcAngle(), GetBrdCoordOrigin(), PCB_SHAPE::GetCenter(), EDA_SHAPE::GetEnd(), EDA_SHAPE::GetShape(), EDA_SHAPE::GetStart(), PCB_SHAPE::GetWidth(), traceArc(), traceCircle(), UNDEFINED_LAYER, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by AR_AUTOPLACER::genPlacementRoutingMatrix().
void AR_MATRIX::UnInitRoutingMatrix | ( | ) |
Definition at line 129 of file ar_matrix.cpp.
References AR_MAX_ROUTING_LAYERS_COUNT, m_BoardSide, m_DistSide, m_Ncols, and m_Nrows.
Referenced by AR_AUTOPLACER::AutoplaceFootprints(), and AR_AUTOPLACER::genPlacementRoutingMatrix().
|
inline |
Definition at line 65 of file ar_matrix.h.
References m_opWriteCell.
Referenced by traceFilledCircle(), and TraceFilledRectangle().
void AR_MATRIX::XorCell | ( | int | aRow, |
int | aCol, | ||
int | aSide, | ||
MATRIX_CELL | aCell | ||
) |
Definition at line 203 of file ar_matrix.cpp.
References m_BoardSide, and m_Ncols.
Referenced by SetCellOperation().
MATRIX_CELL* AR_MATRIX::m_BoardSide[AR_MAX_ROUTING_LAYERS_COUNT] |
Definition at line 138 of file ar_matrix.h.
Referenced by AddCell(), AndCell(), AR_MATRIX(), AR_AUTOPLACER::genPlacementRoutingMatrix(), GetCell(), InitRoutingMatrix(), OrCell(), SetCell(), UnInitRoutingMatrix(), and XorCell().
BOX2I AR_MATRIX::m_BrdBox |
Definition at line 143 of file ar_matrix.h.
Referenced by AR_AUTOPLACER::AutoplaceFootprints(), AR_AUTOPLACER::calculateKeepOutArea(), ComputeMatrixSize(), CreateKeepOutRectangle(), AR_AUTOPLACER::genModuleOnRoutingMatrix(), GetBrdCoordOrigin(), AR_AUTOPLACER::getOptimalFPPlacement(), AR_AUTOPLACER::nearestPad(), and AR_AUTOPLACER::testRectangle().
DIST_CELL* AR_MATRIX::m_DistSide[AR_MAX_ROUTING_LAYERS_COUNT] |
Definition at line 139 of file ar_matrix.h.
Referenced by AR_MATRIX(), GetDist(), InitRoutingMatrix(), SetDist(), and UnInitRoutingMatrix().
int AR_MATRIX::m_GridRouting |
Definition at line 142 of file ar_matrix.h.
Referenced by AR_MATRIX(), AR_AUTOPLACER::AutoplaceFootprints(), AR_AUTOPLACER::buildFpAreas(), AR_AUTOPLACER::calculateKeepOutArea(), ComputeMatrixSize(), CreateKeepOutRectangle(), drawSegmentQcq(), AR_AUTOPLACER::fillMatrix(), AR_AUTOPLACER::genModuleOnRoutingMatrix(), AR_AUTOPLACER::genPlacementRoutingMatrix(), AR_AUTOPLACER::getOptimalFPPlacement(), AR_AUTOPLACER::testFootprintOnBoard(), AR_AUTOPLACER::testRectangle(), traceFilledCircle(), and TraceFilledRectangle().
int AR_MATRIX::m_MemSize |
Definition at line 145 of file ar_matrix.h.
Referenced by AR_MATRIX(), and InitRoutingMatrix().
int AR_MATRIX::m_Ncols |
Definition at line 144 of file ar_matrix.h.
Referenced by AddCell(), AndCell(), AR_MATRIX(), AR_AUTOPLACER::calculateKeepOutArea(), ComputeMatrixSize(), CreateKeepOutRectangle(), drawSegmentQcq(), AR_AUTOPLACER::fillMatrix(), AR_AUTOPLACER::genPlacementRoutingMatrix(), GetCell(), GetDist(), InitRoutingMatrix(), OrCell(), SetCell(), SetDist(), AR_AUTOPLACER::testRectangle(), traceFilledCircle(), TraceFilledRectangle(), UnInitRoutingMatrix(), and XorCell().
int AR_MATRIX::m_Nrows |
Definition at line 144 of file ar_matrix.h.
Referenced by AR_MATRIX(), AR_AUTOPLACER::calculateKeepOutArea(), ComputeMatrixSize(), CreateKeepOutRectangle(), drawSegmentQcq(), AR_AUTOPLACER::fillMatrix(), AR_AUTOPLACER::genPlacementRoutingMatrix(), InitRoutingMatrix(), AR_AUTOPLACER::testRectangle(), traceFilledCircle(), TraceFilledRectangle(), and UnInitRoutingMatrix().
|
private |
Definition at line 153 of file ar_matrix.h.
Referenced by AR_MATRIX(), SetCellOperation(), and WriteCell().
int AR_MATRIX::m_RouteCount |
Definition at line 146 of file ar_matrix.h.
Referenced by AR_MATRIX(), and InitRoutingMatrix().
PCB_LAYER_ID AR_MATRIX::m_routeLayerBottom |
Definition at line 149 of file ar_matrix.h.
Referenced by AR_MATRIX(), CreateKeepOutRectangle(), AR_AUTOPLACER::genPlacementRoutingMatrix(), traceFilledCircle(), and TraceFilledRectangle().
PCB_LAYER_ID AR_MATRIX::m_routeLayerTop |
Definition at line 148 of file ar_matrix.h.
Referenced by AR_MATRIX(), CreateKeepOutRectangle(), AR_AUTOPLACER::genPlacementRoutingMatrix(), traceFilledCircle(), and TraceFilledRectangle().
int AR_MATRIX::m_RoutingLayersCount |
Definition at line 141 of file ar_matrix.h.
Referenced by AR_MATRIX(), CreateKeepOutRectangle(), AR_AUTOPLACER::genPlacementRoutingMatrix(), AR_AUTOPLACER::getOptimalFPPlacement(), InitRoutingMatrix(), traceFilledCircle(), and TraceFilledRectangle().