← Back to team overview

kicad-developers team mailing list archive

[PATCH] Remove write-only member variables from PNS router.

 

Hi,

I'm reading the Kicad source code trying to wrap my head around how
clearance between items is determined, and ran across a few related things
which have become disused unless I'm missing something.

I attach a patch to remove the disused member variables and related methods.

Best regards,
Joakim
From 00151d4ab30a280ced4c62237d994cbbeef18244 Mon Sep 17 00:00:00 2001
From: Joakim Asplund <joakimas@xxxxxx>
Date: Mon, 3 Oct 2016 23:14:51 +0200
Subject: [PATCH] Remove write-only member variables from PNS router.

The last references to the m_override* variables were removed in commit
fe4056742644ab57180f4a7e96405cafad81c5aa on 2015-03-02.

The last references to m_useDpGap were removed in commit
9c8bdcc894fc3ee99eca3a4f678be3cd1772ad15 on 2016-08-15.
---
 pcbnew/router/pns_diff_pair_placer.cpp |  4 ----
 pcbnew/router/pns_kicad_iface.cpp      | 20 --------------------
 pcbnew/router/pns_node.h               |  2 --
 3 files changed, 26 deletions(-)

diff --git a/pcbnew/router/pns_diff_pair_placer.cpp b/pcbnew/router/pns_diff_pair_placer.cpp
index 1cbc27c..626e2c6 100644
--- a/pcbnew/router/pns_diff_pair_placer.cpp
+++ b/pcbnew/router/pns_diff_pair_placer.cpp
@@ -164,9 +164,6 @@ bool DIFF_PAIR_PLACER::attemptWalk( NODE* aNode, DIFF_PAIR* aCurrent,
     WALKAROUND walkaround( aNode, Router() );
     WALKAROUND::WALKAROUND_STATUS wf1;
 
-    Router()->GetRuleResolver()->OverrideClearance( true,
-            aCurrent->NetP(), aCurrent->NetN(), aCurrent->Gap() );
-
     walkaround.SetSolidsOnly( aSolidsOnly );
     walkaround.SetIterationLimit( Settings().WalkaroundIterationLimit() );
 
@@ -233,7 +230,6 @@ bool DIFF_PAIR_PLACER::attemptWalk( NODE* aNode, DIFF_PAIR* aCurrent,
         return false;
 
     aWalk.SetShape( cur.CP(), cur.CN() );
-    Router()->GetRuleResolver()->OverrideClearance( false );
 
     return true;
 }
diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp
index 67340d0..c9411a4 100644
--- a/pcbnew/router/pns_kicad_iface.cpp
+++ b/pcbnew/router/pns_kicad_iface.cpp
@@ -68,8 +68,6 @@ public:
     virtual ~PNS_PCBNEW_RULE_RESOLVER();
 
     virtual int Clearance( const PNS::ITEM* aA, const PNS::ITEM* aB ) override;
-    virtual void OverrideClearance( bool aEnable, int aNetA = 0, int aNetB = 0, int aClearance = 0 ) override;
-    virtual void UseDpGap( bool aUseDpGap ) override { m_useDpGap = aUseDpGap; }
     virtual int DpCoupledNet( int aNet ) override;
     virtual int DpNetPolarity( int aNet ) override;
     virtual bool DpNetPair( PNS::ITEM* aItem, int& aNetP, int& aNetN ) override;
@@ -89,10 +87,6 @@ private:
 
     std::vector<CLEARANCE_ENT> m_clearanceCache;
     int m_defaultClearance;
-    bool m_overrideEnabled;
-    int m_overrideNetA, m_overrideNetB;
-    int m_overrideClearance;
-    bool m_useDpGap;
 };
 
 
@@ -125,11 +119,7 @@ PNS_PCBNEW_RULE_RESOLVER::PNS_PCBNEW_RULE_RESOLVER( BOARD* aBoard, PNS::ROUTER*
         wxLogTrace( "PNS", "Add net %u netclass %s clearance %d", i, netClassName.mb_str(), clearance );
     }
 
-    m_overrideEnabled = false;
     m_defaultClearance = Millimeter2iu( 0.254 );    // m_board->m_NetClasses.Find ("Default clearance")->GetClearance();
-    m_overrideNetA = 0;
-    m_overrideNetB = 0;
-    m_overrideClearance = 0;
 }
 
 
@@ -173,16 +163,6 @@ int PNS_PCBNEW_RULE_RESOLVER::Clearance( const PNS::ITEM* aA, const PNS::ITEM* a
 }
 
 
-// fixme: ugly hack to make the optimizer respect gap width for currently routed differential pair.
-void PNS_PCBNEW_RULE_RESOLVER::OverrideClearance( bool aEnable, int aNetA, int aNetB , int aClearance )
-{
-    m_overrideEnabled = aEnable;
-    m_overrideNetA = aNetA;
-    m_overrideNetB = aNetB;
-    m_overrideClearance = aClearance;
-}
-
-
 int PNS_PCBNEW_RULE_RESOLVER::matchDpSuffix( wxString aNetName, wxString& aComplementNet, wxString& aBaseDpName )
 {
     int rv = 0;
diff --git a/pcbnew/router/pns_node.h b/pcbnew/router/pns_node.h
index e584e0c..7ac933e 100644
--- a/pcbnew/router/pns_node.h
+++ b/pcbnew/router/pns_node.h
@@ -59,8 +59,6 @@ public:
     virtual ~RULE_RESOLVER() {}
 
     virtual int Clearance( const ITEM* aA, const ITEM* aB ) = 0;
-    virtual void OverrideClearance( bool aEnable, int aNetA = 0, int aNetB = 0, int aClearance = 0 ) = 0;
-    virtual void UseDpGap( bool aUseDpGap ) = 0;
     virtual int DpCoupledNet( int aNet ) = 0;
     virtual int DpNetPolarity( int aNet ) = 0;
     virtual bool DpNetPair( ITEM* aItem, int& aNetP, int& aNetN ) = 0;
-- 
1.9.1


Follow ups