pub struct LayoutGraph {
pub nodes: Vec<LayoutNode>,
pub edges: Vec<LayoutEdge>,
pub id_to_node: BTreeMap<String, usize>,
pub in_node: usize,
pub out_node: usize,
pub vcc_node: usize,
pub gnd_node: usize,
pub net_groups: Vec<NetGroup>,
pub monitor_ids: Vec<String>,
}Expand description
Directed graph built from the .pedal netlist for layout purposes.
Fields§
§nodes: Vec<LayoutNode>§edges: Vec<LayoutEdge>§id_to_node: BTreeMap<String, usize>Map from component ID to node index.
in_node: usizeIndex of the in anchor node.
out_node: usizeIndex of the out anchor node.
vcc_node: usizeIndex of the vcc anchor node.
gnd_node: usizeIndex of the gnd anchor node.
net_groups: Vec<NetGroup>Merged net groups: each group is a set of pins that are connected.
monitor_ids: Vec<String>Monitor component IDs from the pedal definition.
Implementations§
Source§impl LayoutGraph
impl LayoutGraph
Sourcepub fn from_pedal(pedal: &PedalDef) -> Self
pub fn from_pedal(pedal: &PedalDef) -> Self
Build a layout graph from a parsed pedal definition.
Sourcepub fn outgoing(&self, node_id: usize) -> Vec<&LayoutEdge>
pub fn outgoing(&self, node_id: usize) -> Vec<&LayoutEdge>
Get all outgoing edges from a node.
Sourcepub fn incoming(&self, node_id: usize) -> Vec<&LayoutEdge>
pub fn incoming(&self, node_id: usize) -> Vec<&LayoutEdge>
Get all incoming edges to a node.
Sourcepub fn neighbors(&self, node_id: usize) -> BTreeSet<usize>
pub fn neighbors(&self, node_id: usize) -> BTreeSet<usize>
Get all neighbors (both directions) of a node.
Sourcepub fn connects_to_vcc(&self, node_id: usize) -> bool
pub fn connects_to_vcc(&self, node_id: usize) -> bool
Check if a node connects to vcc (directly or through supply components).
Sourcepub fn connects_to_gnd(&self, node_id: usize) -> bool
pub fn connects_to_gnd(&self, node_id: usize) -> bool
Check if a node connects to gnd (directly or through ground components).
Sourcepub fn node_kind(&self, node_id: usize) -> Option<&dyn Component>
pub fn node_kind(&self, node_id: usize) -> Option<&dyn Component>
Get the component kind for a node, if it has one.
Sourcepub fn is_active_device(&self, node_id: usize) -> bool
pub fn is_active_device(&self, node_id: usize) -> bool
Check if a node is an active device (tube, transistor, op-amp).
Sourcepub fn is_passive(&self, node_id: usize) -> bool
pub fn is_passive(&self, node_id: usize) -> bool
Check if a component is a simple passive (R, C, L — not pot/transformer).