mirror of https://github.com/KLayout/klayout.git
WIP - experimental feature to resolve sparse cell arrays
This commit is contained in:
parent
108baa4d79
commit
92143ef543
|
|
@ -396,13 +396,52 @@ HierarchyBuilder::new_inst (const RecursiveShapeIterator *iter, const db::CellIn
|
|||
|
||||
// for new cells, create this instance
|
||||
if (m_cell_stack.back ().first || m_cm_new_entry) {
|
||||
db::CellInstArray new_inst (inst, &mp_target->array_repository ());
|
||||
new_inst.object () = db::CellInst (new_cell);
|
||||
new_inst.transform (always_apply);
|
||||
new_inst.transform_into (m_trans);
|
||||
for (std::vector<db::Cell *>::const_iterator c = m_cell_stack.back ().second.begin (); c != m_cell_stack.back ().second.end (); ++c) {
|
||||
(*c)->insert (new_inst);
|
||||
|
||||
// @@@
|
||||
// check if the cell array is "sparse"
|
||||
bool resolve = false;
|
||||
if (m_source.layout () && inst.size () > 1) {
|
||||
db::box_convert<db::CellInst> bc (*m_source.layout ());
|
||||
auto a1 = bc (inst.object ()).area ();
|
||||
auto aa = inst.bbox (bc).area ();
|
||||
double area_ratio = 10.0; // @@@
|
||||
if (a1 * area_ratio < aa) {
|
||||
resolve = true;
|
||||
}
|
||||
}
|
||||
// @@@
|
||||
|
||||
if (resolve) {
|
||||
|
||||
// resolve the instances of the array
|
||||
for (auto i = inst.begin (); !i.at_end (); ++i) {
|
||||
|
||||
db::CellInstArray new_inst;
|
||||
if (inst.is_complex ()) {
|
||||
new_inst = db::CellInstArray (db::CellInst (new_cell), inst.complex_trans (*i));
|
||||
} else {
|
||||
new_inst = db::CellInstArray (db::CellInst (new_cell), *i);
|
||||
}
|
||||
new_inst.transform (always_apply);
|
||||
new_inst.transform_into (m_trans);
|
||||
for (std::vector<db::Cell *>::const_iterator c = m_cell_stack.back ().second.begin (); c != m_cell_stack.back ().second.end (); ++c) {
|
||||
(*c)->insert (new_inst);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
db::CellInstArray new_inst (inst, &mp_target->array_repository ());
|
||||
new_inst.object () = db::CellInst (new_cell);
|
||||
new_inst.transform (always_apply);
|
||||
new_inst.transform_into (m_trans);
|
||||
for (std::vector<db::Cell *>::const_iterator c = m_cell_stack.back ().second.begin (); c != m_cell_stack.back ().second.end (); ++c) {
|
||||
(*c)->insert (new_inst);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// To see the cell once, use NI_single. If we did see the cell already, skip the whole instance array.
|
||||
|
|
|
|||
|
|
@ -259,6 +259,9 @@ Class<db::DeepShapeStore> decl_dbDeepShapeStore ("db", "DeepShapeStore",
|
|||
"\n"
|
||||
"This method has been added in version 0.26.1\n"
|
||||
) +
|
||||
gsi::method ("layout", static_cast<db::Layout &(db::DeepShapeStore::*) (unsigned int)> (&db::DeepShapeStore::layout), gsi::arg ("index"),
|
||||
"@hide"
|
||||
) +
|
||||
gsi::method ("push_state", &db::DeepShapeStore::push_state,
|
||||
"@brief Pushes the store's state on the state state\n"
|
||||
"This will save the stores state (\\threads, \\max_vertex_count, \\max_area_ratio, breakout cells ...) on "
|
||||
|
|
|
|||
Loading…
Reference in New Issue