74 via->SetPosition( viaPos );
78 via->SetNetCode( aNetCode );
99 std::vector<LENGTH_DELAY_CALCULATION_ITEM> items;
104 BOOST_REQUIRE_EQUAL( items.size(), 5 );
107 .OptimiseVias =
true, .MergeTracks =
true, .OptimiseTracesInPads =
true, .InferViaInPad =
false
110 std::vector<size_t> order( items.size() );
111 std::iota( order.begin(), order.end(), 0 );
113 std::set<int64_t> lengths;
118 std::vector<LENGTH_DELAY_CALCULATION_ITEM> ordered;
119 ordered.reserve( order.size() );
121 for(
size_t idx : order )
122 ordered.emplace_back( items[idx] );
124 lengths.insert( calc->
CalculateLength( ordered, drcOpts,
nullptr,
nullptr ) );
125 }
while( std::next_permutation( order.begin(), order.end() ) );
127 BOOST_CHECK_MESSAGE( lengths.size() == 1,
"net length depends on item order: "
128 << lengths.size() <<
" different lengths, spread "
129 << ( *lengths.rbegin() - *lengths.begin() ) / 1e6 <<
" mm" );
constexpr EDA_IU_SCALE pcbIUScale
virtual bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
Information pertinent to a Pcbnew printed circuit board.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
LENGTH_DELAY_CALCULATION * GetLengthCalculation() const
Returns the track length calculator.
const TRACKS & Tracks() const
Class which calculates lengths (and associated routing statistics) in a BOARD context.
int64_t CalculateLength(std::vector< LENGTH_DELAY_CALCULATION_ITEM > &aItems, PATH_OPTIMISATIONS aOptimisations, const PAD *aStartPad=nullptr, const PAD *aEndPad=nullptr) const
Calculates the electrical length of the given items.
LENGTH_DELAY_CALCULATION_ITEM GetLengthCalculationItem(const BOARD_CONNECTED_ITEM *aBoardItem) const
Return a LENGTH_CALCULATION_ITEM constructed from the given BOARD_CONNECTED_ITEM.
Handle the data for a net.
void SetEnd(const VECTOR2I &aEnd)
void SetStart(const VECTOR2I &aStart)
virtual void SetWidth(int aWidth)
PCB_LAYER_ID
A quick note on layer IDs:
Struct to control which optimisations the length calculation code runs on the given path objects.
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_CASE(LengthIsIndependentOfItemOrder)
static void addTrack(BOARD &aBoard, int aNetCode, PCB_LAYER_ID aLayer, const VECTOR2I &aStart, const VECTOR2I &aEnd)
static void buildViaTransition(BOARD &aBoard, int aNetCode)
static VECTOR2I mmPoint(double aX, double aY)
BOOST_AUTO_TEST_SUITE_END()
VECTOR2< int32_t > VECTOR2I