TraceMaker
C++ API of the engine
Loading...
Searching...
No Matches
layer_limits.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-3.0-or-later
2#pragma once
3// Which copper layers may carry new tracks, and what a track costs on each (doc 05 §29): the user's
4// `--no-tracks-on` and `--layer-cost` lists turned into the numbers RouterOptions holds.
5#include <cstdint>
6#include <string>
7#include <vector>
8
9#include "model/board.hpp"
10
11namespace tmk::route {
12
14 model::LayerMask no_track_layers = 0; // copper layers that get no new tracks
15 std::vector<std::int32_t> layer_cost_pm; // per copper index: track cost per mille (1000 = normal); empty = all normal
16};
17
18inline constexpr double kMaxLayerCost = 1000.0;
19
20// `no_tracks_on`: copper layer names. `layer_costs`: "NAME=FACTOR" entries with 1 <= FACTOR <= kMaxLayerCost.
21// Names are the board's canonical names ("In1.Cu"), the names written in the file, or the user's layer names.
22// Throws std::invalid_argument on an unknown layer, a malformed entry, a factor out of range, or when no layer
23// would be left for tracks: a limit the router cannot apply as written must stop the run, not be dropped.
24LayerLimits layer_limits(const model::Board& b, const std::vector<std::string>& no_tracks_on, const std::vector<std::string>& layer_costs);
25
26} // namespace tmk::route
The board model (design doc 02 §3): every object TraceMaker reads from a .kicad_pcb,...
std::uint64_t LayerMask
bit i = copper layer i in stack order (0 = F.Cu, last = B.Cu)
Definition board.hpp:22
LayerLimits layer_limits(const model::Board &b, const std::vector< std::string > &no_tracks_on, const std::vector< std::string > &layer_costs)
no_tracks_on: copper layer names.
constexpr double kMaxLayerCost
std::vector< std::int32_t > layer_cost_pm
per copper index: track cost per mille (1000 = normal); empty = all normal
model::LayerMask no_track_layers
copper layers that get no new tracks