mirror of https://github.com/KLayout/klayout.git
WIP
This commit is contained in:
parent
dfe67178dc
commit
6c90da8007
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
#include "gsiDecl.h"
|
||||
#include "pexRExtractor.h"
|
||||
#include "pexSquareCountingRExtractor.h"
|
||||
|
||||
namespace gsi
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,10 +10,12 @@ SOURCES = \
|
|||
pexForceLink.cc \
|
||||
pexRExtractor.cc \
|
||||
gsiDeclRExtractor.cc \
|
||||
pexSquareCountingRExtractor.cc
|
||||
|
||||
HEADERS = \
|
||||
pexForceLink.h \
|
||||
pexRExtractor.h \
|
||||
pexSquareCountingRExtractor.h
|
||||
|
||||
RESOURCES = \
|
||||
|
||||
|
|
|
|||
|
|
@ -196,36 +196,4 @@ RExtractor::~RExtractor ()
|
|||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
|
||||
SquareCountingRExtractor::SquareCountingRExtractor (double dbu)
|
||||
{
|
||||
m_dbu = dbu;
|
||||
|
||||
m_decomp_param.split_edges = true;
|
||||
m_decomp_param.with_segments = false;
|
||||
}
|
||||
|
||||
void
|
||||
SquareCountingRExtractor::extract (const db::Polygon &polygon, const std::vector<db::Point> &vertex_ports, const std::vector<db::Polygon> &polygon_ports, RNetwork &rnetwork)
|
||||
{
|
||||
db::CplxTrans trans = db::CplxTrans (m_dbu) * db::ICplxTrans (db::Trans (db::Point () - polygon.box ().center ()));
|
||||
auto inv_trans = trans.inverted ();
|
||||
|
||||
db::plc::Graph plc;
|
||||
|
||||
db::plc::ConvexDecomposition decomp (&plc);
|
||||
decomp.decompose (polygon, vertex_ports, m_decomp_param, trans);
|
||||
|
||||
std::vector<std::pair<db::Polygon, db::plc::Polygon *> > decomp_polygons;
|
||||
for (auto p = plc.begin (); p != plc.end (); ++p) {
|
||||
// @@@decomp_polygons.push_back (db::Polygon ());
|
||||
// @@@decomp_polygons.back ().first = inv_trans * p->polygon ();
|
||||
}
|
||||
|
||||
// @@@ use box_scanner to find interactions between polygon_ports and decomp_polygons
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -27,8 +27,6 @@
|
|||
|
||||
#include "dbPolygon.h"
|
||||
#include "dbPLC.h"
|
||||
#include "dbPLCConvexDecomposition.h" // @@@
|
||||
#include "dbPLCTriangulation.h" // @@@
|
||||
#include "tlList.h"
|
||||
|
||||
#include <string>
|
||||
|
|
@ -168,35 +166,6 @@ public:
|
|||
virtual void extract (const db::Polygon &polygon, const std::vector<db::Point> &vertex_ports, const std::vector<db::Polygon> &polygon_ports, RNetwork &rnetwork) = 0;
|
||||
};
|
||||
|
||||
// @@@
|
||||
class PEX_PUBLIC SquareCountingRExtractor
|
||||
: public RExtractor
|
||||
{
|
||||
public:
|
||||
SquareCountingRExtractor (double dbu);
|
||||
|
||||
db::plc::ConvexDecompositionParameters &decomposition_parameters ()
|
||||
{
|
||||
return m_decomp_param;
|
||||
}
|
||||
|
||||
void set_dbu (double dbu)
|
||||
{
|
||||
m_dbu = dbu;
|
||||
}
|
||||
|
||||
double dbu () const
|
||||
{
|
||||
return m_dbu;
|
||||
}
|
||||
|
||||
virtual void extract (const db::Polygon &polygon, const std::vector<db::Point> &vertex_ports, const std::vector<db::Polygon> &polygon_ports, RNetwork &rnetwork);
|
||||
|
||||
private:
|
||||
db::plc::ConvexDecompositionParameters m_decomp_param;
|
||||
double m_dbu;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -0,0 +1,60 @@
|
|||
|
||||
/*
|
||||
|
||||
KLayout Layout Viewer
|
||||
Copyright (C) 2006-2025 Matthias Koefferlein
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "pexSquareCountingRExtractor.h"
|
||||
|
||||
namespace pex
|
||||
{
|
||||
|
||||
SquareCountingRExtractor::SquareCountingRExtractor (double dbu)
|
||||
{
|
||||
m_dbu = dbu;
|
||||
|
||||
m_decomp_param.split_edges = true;
|
||||
m_decomp_param.with_segments = false;
|
||||
}
|
||||
|
||||
void
|
||||
SquareCountingRExtractor::extract (const db::Polygon &polygon, const std::vector<db::Point> &vertex_ports, const std::vector<db::Polygon> &polygon_ports, RNetwork &rnetwork)
|
||||
{
|
||||
db::CplxTrans trans = db::CplxTrans (m_dbu) * db::ICplxTrans (db::Trans (db::Point () - polygon.box ().center ()));
|
||||
auto inv_trans = trans.inverted ();
|
||||
|
||||
db::plc::Graph plc;
|
||||
|
||||
db::plc::ConvexDecomposition decomp (&plc);
|
||||
decomp.decompose (polygon, vertex_ports, m_decomp_param, trans);
|
||||
|
||||
std::vector<std::pair<db::Polygon, db::plc::Polygon *> > decomp_polygons;
|
||||
for (auto p = plc.begin (); p != plc.end (); ++p) {
|
||||
// @@@decomp_polygons.push_back (db::Polygon ());
|
||||
// @@@decomp_polygons.back ().first = inv_trans * p->polygon ();
|
||||
}
|
||||
|
||||
// @@@ use box_scanner to find interactions between polygon_ports and decomp_polygons
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
|
||||
/*
|
||||
|
||||
KLayout Layout Viewer
|
||||
Copyright (C) 2006-2025 Matthias Koefferlein
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*/
|
||||
|
||||
#ifndef HDR_pexSquareCountingRExtractor
|
||||
#define HDR_pexSquareCountingRExtractor
|
||||
|
||||
#include "pexCommon.h"
|
||||
#include "pexRExtractor.h"
|
||||
|
||||
#include "dbPLCConvexDecomposition.h"
|
||||
|
||||
namespace pex
|
||||
{
|
||||
|
||||
// @@@ doc
|
||||
class PEX_PUBLIC SquareCountingRExtractor
|
||||
: public RExtractor
|
||||
{
|
||||
public:
|
||||
SquareCountingRExtractor (double dbu);
|
||||
|
||||
db::plc::ConvexDecompositionParameters &decomposition_parameters ()
|
||||
{
|
||||
return m_decomp_param;
|
||||
}
|
||||
|
||||
void set_dbu (double dbu)
|
||||
{
|
||||
m_dbu = dbu;
|
||||
}
|
||||
|
||||
double dbu () const
|
||||
{
|
||||
return m_dbu;
|
||||
}
|
||||
|
||||
virtual void extract (const db::Polygon &polygon, const std::vector<db::Point> &vertex_ports, const std::vector<db::Polygon> &polygon_ports, RNetwork &rnetwork);
|
||||
|
||||
private:
|
||||
db::plc::ConvexDecompositionParameters m_decomp_param;
|
||||
double m_dbu;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
|
||||
/*
|
||||
|
||||
KLayout Layout Viewer
|
||||
Copyright (C) 2006-2025 Matthias Koefferlein
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "pexSquareCountingRExtractor.h"
|
||||
#include "tlUnitTest.h"
|
||||
|
||||
TEST(basic)
|
||||
{
|
||||
db::Point contour[] = {
|
||||
db::Point (0, 0),
|
||||
db::Point (0, 100),
|
||||
db::Point (1000, 100),
|
||||
db::Point (1000, 1000),
|
||||
db::Point (1100, 1000),
|
||||
db::Point (1100, 100),
|
||||
db::Point (1700, 100),
|
||||
db::Point (1700, 0)
|
||||
};
|
||||
|
||||
db::Polygon poly;
|
||||
poly.assign_hull (contour + 0, contour + sizeof (contour) / sizeof (contour[0]));
|
||||
|
||||
double dbu = 0.001;
|
||||
|
||||
pex::RNetwork rn;
|
||||
pex::SquareCountingRExtractor rex (dbu);
|
||||
|
||||
std::vector<db::Point> vertex_ports;
|
||||
vertex_ports.push_back (db::Point (0, 50));
|
||||
vertex_ports.push_back (db::Point (1650, 50));
|
||||
|
||||
std::vector<db::Polygon> polygon_ports;
|
||||
polygon_ports.push_back (db::Polygon (db::Box (1000, 900, 1100, 1000)));
|
||||
|
||||
rex.extract (poly, vertex_ports, polygon_ports, rn);
|
||||
|
||||
EXPECT_EQ (rn.to_string (),
|
||||
""
|
||||
)
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@ include($$PWD/../../lib_ut.pri)
|
|||
|
||||
SOURCES = \
|
||||
pexRExtractorTests.cc \
|
||||
pexSquareCountingRExtractorTests.cc
|
||||
|
||||
INCLUDEPATH += $$TL_INC $$DB_INC $$GSI_INC $$PEX_INC
|
||||
DEPENDPATH += $$TL_INC $$DB_INC $$GSI_INC $$PEX_INC
|
||||
|
|
|
|||
Loading…
Reference in New Issue