mirror of https://codeberg.org/topola/topola.git
feat(specctra-core/mesadata, layout): make `Layout` clonable
This change also propagates to `SpecctraMesadata`, which is a bit unfortunate, because the code that needs this will never mutate the mesadata, wrapping it in an `Arc` would be a possible alternative.
This commit is contained in:
parent
22460c75f7
commit
e20c9aa3d6
|
|
@ -37,7 +37,7 @@ pub trait AccessMesadata: AccessRules {
|
||||||
fn netname_net(&self, netname: &str) -> Option<usize>;
|
fn netname_net(&self, netname: &str) -> Option<usize>;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Clone, Debug)]
|
||||||
/// [`SpecctraRule`] represents the basic routing constraints used by an auto-router, such as
|
/// [`SpecctraRule`] represents the basic routing constraints used by an auto-router, such as
|
||||||
/// the Topola auto-router, in a PCB design process. This struct defines two key design
|
/// the Topola auto-router, in a PCB design process. This struct defines two key design
|
||||||
/// rules: the width of the trace and the minimum clearance between electrical features.
|
/// rules: the width of the trace and the minimum clearance between electrical features.
|
||||||
|
|
@ -62,7 +62,7 @@ impl SpecctraRule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Clone, Debug)]
|
||||||
/// [`SpecctraMesadata`] holds the metadata required by the Specctra auto-router to
|
/// [`SpecctraMesadata`] holds the metadata required by the Specctra auto-router to
|
||||||
/// understand and enforce design rules across various net classes and layers in a PCB layout.
|
/// understand and enforce design rules across various net classes and layers in a PCB layout.
|
||||||
/// This struct encapsulates information about rules for individual nets, net classes,
|
/// This struct encapsulates information about rules for individual nets, net classes,
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ pub type DrawingEdit<CW> = GeometryEdit<
|
||||||
BendIndex,
|
BendIndex,
|
||||||
>;
|
>;
|
||||||
|
|
||||||
#[derive(Debug, Getters)]
|
#[derive(Clone, Debug, Getters)]
|
||||||
pub struct Drawing<CW, R> {
|
pub struct Drawing<CW, R> {
|
||||||
recording_geometry_with_rtree: RecordingGeometryWithRtree<
|
recording_geometry_with_rtree: RecordingGeometryWithRtree<
|
||||||
PrimitiveWeight,
|
PrimitiveWeight,
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,17 @@ pub struct Geometry<PW, DW, SW, BW, CW, PI, DI, SI, BI> {
|
||||||
bend_index_marker: PhantomData<BI>,
|
bend_index_marker: PhantomData<BI>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<PW: Clone, DW, SW, BW, CW: Clone, PI, DI, SI, BI> Clone
|
||||||
|
for Geometry<PW, DW, SW, BW, CW, PI, DI, SI, BI>
|
||||||
|
{
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
Self {
|
||||||
|
graph: self.graph.clone(),
|
||||||
|
..Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<PW, DW, SW, BW, CW, PI, DI, SI, BI> Default for Geometry<PW, DW, SW, BW, CW, PI, DI, SI, BI> {
|
impl<PW, DW, SW, BW, CW, PI, DI, SI, BI> Default for Geometry<PW, DW, SW, BW, CW, PI, DI, SI, BI> {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::new()
|
Self::new()
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,16 @@ pub struct RecordingGeometryWithRtree<PW, DW, SW, BW, CW, PI, DI, SI, BI> {
|
||||||
geometry_with_rtree: GeometryWithRtree<PW, DW, SW, BW, CW, PI, DI, SI, BI>,
|
geometry_with_rtree: GeometryWithRtree<PW, DW, SW, BW, CW, PI, DI, SI, BI>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<PW: Clone, DW, SW, BW, CW: Clone, PI: Clone, DI, SI, BI> Clone
|
||||||
|
for RecordingGeometryWithRtree<PW, DW, SW, BW, CW, PI, DI, SI, BI>
|
||||||
|
{
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
Self {
|
||||||
|
geometry_with_rtree: self.geometry_with_rtree.clone(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<
|
impl<
|
||||||
PW: GetWidth + GetLayer + TryInto<DW> + TryInto<SW> + TryInto<BW> + Retag<Index = PI> + Copy,
|
PW: GetWidth + GetLayer + TryInto<DW> + TryInto<SW> + TryInto<BW> + Retag<Index = PI> + Copy,
|
||||||
DW: AccessDotWeight + Into<PW> + GetLayer,
|
DW: AccessDotWeight + Into<PW> + GetLayer,
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,18 @@ pub struct GeometryWithRtree<PW, DW, SW, BW, CW, PI, DI, SI, BI> {
|
||||||
layer_count: usize,
|
layer_count: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<PW: Clone, DW, SW, BW, CW: Clone, PI: Clone, DI, SI, BI> Clone
|
||||||
|
for GeometryWithRtree<PW, DW, SW, BW, CW, PI, DI, SI, BI>
|
||||||
|
{
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
Self {
|
||||||
|
geometry: self.geometry.clone(),
|
||||||
|
rtree: self.rtree.clone(),
|
||||||
|
layer_count: self.layer_count,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[debug_invariant(self.test_envelopes())]
|
#[debug_invariant(self.test_envelopes())]
|
||||||
#[debug_invariant(self.geometry.graph().node_count() == self.rtree.size())]
|
#[debug_invariant(self.geometry.graph().node_count() == self.rtree.size())]
|
||||||
impl<
|
impl<
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ pub enum CompoundWeight {
|
||||||
pub type NodeIndex = GenericNode<PrimitiveIndex, GenericIndex<CompoundWeight>>;
|
pub type NodeIndex = GenericNode<PrimitiveIndex, GenericIndex<CompoundWeight>>;
|
||||||
pub type LayoutEdit = DrawingEdit<CompoundWeight>;
|
pub type LayoutEdit = DrawingEdit<CompoundWeight>;
|
||||||
|
|
||||||
#[derive(Debug, Getters)]
|
#[derive(Clone, Debug, Getters)]
|
||||||
/// Structure for managing the Layout design
|
/// Structure for managing the Layout design
|
||||||
pub struct Layout<R> {
|
pub struct Layout<R> {
|
||||||
drawing: Drawing<CompoundWeight, R>,
|
drawing: Drawing<CompoundWeight, R>,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue