mirror of https://github.com/KLayout/klayout.git
Some memory optimization potential with tiled processor to improve XOR memory footprint (box-like polygons stored as boxes, polygon references)
This commit is contained in:
parent
ffbcfc5490
commit
2166f2bb21
|
|
@ -47,6 +47,7 @@ public:
|
|||
virtual void finish (bool);
|
||||
|
||||
void keep_for_healing (const db::Polygon &poly);
|
||||
void keep_for_healing (const db::Box &box);
|
||||
|
||||
private:
|
||||
size_t *mp_count;
|
||||
|
|
@ -81,7 +82,7 @@ public:
|
|||
void operator() (const db::Box &box)
|
||||
{
|
||||
if (m_healing && ! box.inside (mp_tile->enlarged (db::Vector (-1, -1)))) {
|
||||
mp_receiver->keep_for_healing (db::Polygon (box));
|
||||
mp_receiver->keep_for_healing (box);
|
||||
} else {
|
||||
m_count += 1;
|
||||
}
|
||||
|
|
@ -119,6 +120,12 @@ HealingCountingReceiver::keep_for_healing (const db::Polygon &poly)
|
|||
m_for_healing.insert (poly);
|
||||
}
|
||||
|
||||
void
|
||||
HealingCountingReceiver::keep_for_healing (const db::Box &box)
|
||||
{
|
||||
m_for_healing.insert (box);
|
||||
}
|
||||
|
||||
void
|
||||
HealingCountingReceiver::finish (bool)
|
||||
{
|
||||
|
|
@ -141,7 +148,9 @@ public:
|
|||
void finish (bool /*success*/);
|
||||
|
||||
void keep_for_healing (const db::Polygon &poly);
|
||||
void keep_for_healing (const db::Box &box);
|
||||
void output (const db::Polygon &poly);
|
||||
void output (const db::Box &poly);
|
||||
|
||||
private:
|
||||
db::Layout *mp_layout;
|
||||
|
|
@ -179,9 +188,17 @@ public:
|
|||
void operator() (const db::Box &box)
|
||||
{
|
||||
if (m_healing && ! box.inside (mp_tile->enlarged (db::Vector (-1, -1)))) {
|
||||
mp_receiver->keep_for_healing (*mp_trans * db::Polygon (box));
|
||||
if (mp_trans->is_complex ()) {
|
||||
mp_receiver->keep_for_healing (*mp_trans * db::Polygon (box));
|
||||
} else {
|
||||
mp_receiver->keep_for_healing (*mp_trans * box);
|
||||
}
|
||||
} else {
|
||||
mp_receiver->output (*mp_trans * db::Polygon (box));
|
||||
if (mp_trans->is_complex ()) {
|
||||
mp_receiver->output (*mp_trans * db::Polygon (box));
|
||||
} else {
|
||||
mp_receiver->output (*mp_trans * box);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -229,12 +246,24 @@ HealingTileLayoutOutputReceiver::keep_for_healing (const db::Polygon &poly)
|
|||
m_for_healing.insert (poly);
|
||||
}
|
||||
|
||||
void
|
||||
HealingTileLayoutOutputReceiver::keep_for_healing (const db::Box &box)
|
||||
{
|
||||
m_for_healing.insert (box);
|
||||
}
|
||||
|
||||
void
|
||||
HealingTileLayoutOutputReceiver::output (const db::Polygon &poly)
|
||||
{
|
||||
mp_cell->shapes (m_layer).insert (poly);
|
||||
}
|
||||
|
||||
void
|
||||
HealingTileLayoutOutputReceiver::output (const db::Box &box)
|
||||
{
|
||||
mp_cell->shapes (m_layer).insert (box);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
struct ResultDescriptor
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ TEST(1A_Flat)
|
|||
reader.read (layout);
|
||||
}
|
||||
|
||||
db::compare_layouts (this, layout, au, db::NoNormalization);
|
||||
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));
|
||||
EXPECT_EQ (cap.captured_text (),
|
||||
"Layer 10/0 is not present in first layout, but in second\n"
|
||||
"Result summary (layers without differences are not shown):\n"
|
||||
|
|
@ -141,7 +141,7 @@ TEST(1A_Deep)
|
|||
reader.read (layout);
|
||||
}
|
||||
|
||||
db::compare_layouts (this, layout, au, db::NoNormalization);
|
||||
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));
|
||||
EXPECT_EQ (cap.captured_text (),
|
||||
"Layer 10/0 is not present in first layout, but in second\n"
|
||||
"Result summary (layers without differences are not shown):\n"
|
||||
|
|
@ -321,7 +321,7 @@ TEST(2_Flat)
|
|||
reader.read (layout);
|
||||
}
|
||||
|
||||
db::compare_layouts (this, layout, au, db::NoNormalization);
|
||||
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));
|
||||
EXPECT_EQ (cap.captured_text (),
|
||||
""
|
||||
);
|
||||
|
|
@ -354,7 +354,7 @@ TEST(2_Deep)
|
|||
reader.read (layout);
|
||||
}
|
||||
|
||||
db::compare_layouts (this, layout, au, db::NoNormalization);
|
||||
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));
|
||||
EXPECT_EQ (cap.captured_text (),
|
||||
""
|
||||
);
|
||||
|
|
@ -387,7 +387,7 @@ TEST(3_Flat)
|
|||
reader.read (layout);
|
||||
}
|
||||
|
||||
db::compare_layouts (this, layout, au, db::NoNormalization);
|
||||
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));
|
||||
EXPECT_EQ (cap.captured_text (),
|
||||
"Layer 10/0 is not present in first layout, but in second\n"
|
||||
);
|
||||
|
|
@ -453,7 +453,7 @@ TEST(3_FlatHeal)
|
|||
reader.read (layout);
|
||||
}
|
||||
|
||||
db::compare_layouts (this, layout, au, db::NoNormalization);
|
||||
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));
|
||||
EXPECT_EQ (cap.captured_text (),
|
||||
"Layer 10/0 is not present in first layout, but in second\n"
|
||||
);
|
||||
|
|
@ -520,7 +520,7 @@ TEST(3_Deep)
|
|||
reader.read (layout);
|
||||
}
|
||||
|
||||
db::compare_layouts (this, layout, au, db::NoNormalization);
|
||||
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));
|
||||
EXPECT_EQ (cap.captured_text (),
|
||||
"Layer 10/0 is not present in first layout, but in second\n"
|
||||
);
|
||||
|
|
@ -553,7 +553,7 @@ TEST(4_Flat)
|
|||
reader.read (layout);
|
||||
}
|
||||
|
||||
db::compare_layouts (this, layout, au, db::NoNormalization);
|
||||
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));
|
||||
EXPECT_EQ (cap.captured_text (),
|
||||
"Layer 10/0 is not present in first layout, but in second\n"
|
||||
);
|
||||
|
|
@ -586,7 +586,7 @@ TEST(4_FlatHeal)
|
|||
reader.read (layout);
|
||||
}
|
||||
|
||||
db::compare_layouts (this, layout, au, db::NoNormalization);
|
||||
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));
|
||||
EXPECT_EQ (cap.captured_text (),
|
||||
"Layer 10/0 is not present in first layout, but in second\n"
|
||||
);
|
||||
|
|
@ -619,7 +619,7 @@ TEST(4_Deep)
|
|||
reader.read (layout);
|
||||
}
|
||||
|
||||
db::compare_layouts (this, layout, au, db::NoNormalization);
|
||||
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));
|
||||
EXPECT_EQ (cap.captured_text (),
|
||||
"Layer 10/0 is not present in first layout, but in second\n"
|
||||
);
|
||||
|
|
@ -652,7 +652,7 @@ TEST(5_Flat)
|
|||
reader.read (layout);
|
||||
}
|
||||
|
||||
db::compare_layouts (this, layout, au, db::NoNormalization);
|
||||
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));
|
||||
EXPECT_EQ (cap.captured_text (),
|
||||
"Layer 10/0 is not present in first layout, but in second\n"
|
||||
);
|
||||
|
|
@ -685,7 +685,7 @@ TEST(5_Deep)
|
|||
reader.read (layout);
|
||||
}
|
||||
|
||||
db::compare_layouts (this, layout, au, db::NoNormalization);
|
||||
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));
|
||||
EXPECT_EQ (cap.captured_text (),
|
||||
"Layer 10/0 is not present in first layout, but in second\n"
|
||||
);
|
||||
|
|
@ -718,7 +718,7 @@ TEST(6_Flat)
|
|||
reader.read (layout);
|
||||
}
|
||||
|
||||
db::compare_layouts (this, layout, au, db::NoNormalization);
|
||||
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));
|
||||
EXPECT_EQ (cap.captured_text (),
|
||||
"Layer 10/0 is not present in first layout, but in second\n"
|
||||
);
|
||||
|
|
@ -751,7 +751,7 @@ TEST(6_Deep)
|
|||
reader.read (layout);
|
||||
}
|
||||
|
||||
db::compare_layouts (this, layout, au, db::NoNormalization);
|
||||
db::compare_layouts (this, layout, au, db::NormalizationMode (db::NoNormalization | db::AsPolygons));
|
||||
EXPECT_EQ (cap.captured_text (),
|
||||
"Layer 10/0 is not present in first layout, but in second\n"
|
||||
);
|
||||
|
|
|
|||
|
|
@ -52,6 +52,21 @@ public:
|
|||
mp_shapes->insert (t.transformed (m_trans));
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void operator() (const db::Polygon &t)
|
||||
{
|
||||
if (t.is_box () && ! m_trans.is_complex ()) {
|
||||
mp_shapes->insert (t.box ().transformed (m_trans));
|
||||
} else {
|
||||
if (mp_shapes->cell () && mp_shapes->cell ()->layout ()) {
|
||||
db::PolygonRef pr (mp_shapes->cell ()->layout ()->shape_repository (), t.transformed (m_trans));
|
||||
mp_shapes->insert (pr);
|
||||
} else {
|
||||
mp_shapes->insert (t.transformed (m_trans));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void operator() (const db::EdgePair &ep)
|
||||
{
|
||||
mp_shapes->insert (ep.normalized ().to_polygon (m_ep_sizing).transformed (m_trans));
|
||||
|
|
|
|||
Loading…
Reference in New Issue