mirror of https://github.com/KLayout/klayout.git
Refining solution for "blend-mode 0" enhancement
This commit is contained in:
parent
b95634edf3
commit
11bddc2914
|
|
@ -164,7 +164,7 @@ CommonReaderBase::rename_cell (db::Layout &layout, size_t id, const std::string
|
||||||
|
|
||||||
// Both cells already exist and are not identical: merge ID-declared cell into the name-declared one
|
// Both cells already exist and are not identical: merge ID-declared cell into the name-declared one
|
||||||
layout.force_update ();
|
layout.force_update ();
|
||||||
merge_cell (layout, iname->second.second, iid->second.second, true);
|
merge_cell (layout, iname->second.second, iid->second.second, true, false);
|
||||||
iid->second.second = iname->second.second;
|
iid->second.second = iname->second.second;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -239,12 +239,14 @@ CommonReaderBase::cell_for_instance (db::Layout &layout, const std::string &cn)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CommonReaderBase::merge_cell (db::Layout &layout, db::cell_index_type target_cell_index, db::cell_index_type src_cell_index, bool with_meta) const
|
CommonReaderBase::merge_cell (db::Layout &layout, db::cell_index_type target_cell_index, db::cell_index_type src_cell_index, bool with_meta, bool no_duplicate_instances) const
|
||||||
{
|
{
|
||||||
const db::Cell &src_cell = layout.cell (src_cell_index);
|
const db::Cell &src_cell = layout.cell (src_cell_index);
|
||||||
db::Cell &target_cell = layout.cell (target_cell_index);
|
db::Cell &target_cell = layout.cell (target_cell_index);
|
||||||
target_cell.set_ghost_cell (src_cell.is_ghost_cell () && target_cell.is_ghost_cell ());
|
target_cell.set_ghost_cell (src_cell.is_ghost_cell () && target_cell.is_ghost_cell ());
|
||||||
|
|
||||||
|
if (no_duplicate_instances) {
|
||||||
|
|
||||||
// avoid generating duplicates
|
// avoid generating duplicates
|
||||||
std::set<db::Instance, db::InstanceCompareFunction> current;
|
std::set<db::Instance, db::InstanceCompareFunction> current;
|
||||||
for (db::Cell::const_iterator i = target_cell.begin (); ! i.at_end (); ++i) {
|
for (db::Cell::const_iterator i = target_cell.begin (); ! i.at_end (); ++i) {
|
||||||
|
|
@ -252,13 +254,31 @@ CommonReaderBase::merge_cell (db::Layout &layout, db::cell_index_type target_cel
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy over the instances
|
// copy over the instances
|
||||||
|
// NOTE: need to do that in a two-step fashion as inserting instances may invalidate
|
||||||
|
// the existing ones.
|
||||||
|
std::vector<bool> selected;
|
||||||
for (db::Cell::const_iterator i = src_cell.begin (); ! i.at_end (); ++i) {
|
for (db::Cell::const_iterator i = src_cell.begin (); ! i.at_end (); ++i) {
|
||||||
// NOTE: cell indexed may be invalid because we delete subcells without update()
|
// NOTE: cell indexed may be invalid because we delete subcells without update()
|
||||||
if (layout.is_valid_cell_index (i->cell_index ()) && current.find (*i) == current.end ()) {
|
selected.push_back (layout.is_valid_cell_index (i->cell_index ()) && current.find (*i) == current.end ());
|
||||||
|
}
|
||||||
|
auto s = selected.begin ();
|
||||||
|
for (db::Cell::const_iterator i = src_cell.begin (); ! i.at_end (); ++i, ++s) {
|
||||||
|
if (*s) {
|
||||||
target_cell.insert (*i);
|
target_cell.insert (*i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
for (db::Cell::const_iterator i = src_cell.begin (); ! i.at_end (); ++i) {
|
||||||
|
// NOTE: cell indexed may be invalid because we delete subcells without update()
|
||||||
|
if (layout.is_valid_cell_index (i->cell_index ())) {
|
||||||
|
target_cell.insert (*i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
merge_cell_without_instances (layout, target_cell_index, src_cell_index, with_meta);
|
merge_cell_without_instances (layout, target_cell_index, src_cell_index, with_meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -391,7 +411,7 @@ CommonReaderBase::finish (db::Layout &layout)
|
||||||
|
|
||||||
layout.cell (ci_org).clear_shapes ();
|
layout.cell (ci_org).clear_shapes ();
|
||||||
|
|
||||||
merge_cell (layout, ci_org, ci_new, true);
|
merge_cell (layout, ci_org, ci_new, true, false);
|
||||||
|
|
||||||
} else if (m_cc_resolution == SkipNewCell && ! layout.cell (ci_org).is_ghost_cell ()) {
|
} else if (m_cc_resolution == SkipNewCell && ! layout.cell (ci_org).is_ghost_cell ()) {
|
||||||
|
|
||||||
|
|
@ -403,7 +423,7 @@ CommonReaderBase::finish (db::Layout &layout)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
merge_cell (layout, ci_org, ci_new, m_cc_resolution != SkipNewCell);
|
merge_cell (layout, ci_org, ci_new, m_cc_resolution != SkipNewCell, m_cc_resolution == AddToCell);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -242,7 +242,7 @@ protected:
|
||||||
/**
|
/**
|
||||||
* @brief Merge (and delete) the src_cell into target_cell
|
* @brief Merge (and delete) the src_cell into target_cell
|
||||||
*/
|
*/
|
||||||
void merge_cell (db::Layout &layout, db::cell_index_type target_cell_index, db::cell_index_type src_cell_index, bool with_meta) const;
|
void merge_cell (db::Layout &layout, db::cell_index_type target_cell_index, db::cell_index_type src_cell_index, bool with_meta, bool no_duplicate_instances) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Merge (and delete) the src_cell into target_cell without instances
|
* @brief Merge (and delete) the src_cell into target_cell without instances
|
||||||
|
|
|
||||||
|
|
@ -539,6 +539,11 @@ template class instance_iterator<OverlappingInstanceIteratorTraits>;
|
||||||
// -------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------
|
||||||
// NormalInstanceIteratorTraits implementation
|
// NormalInstanceIteratorTraits implementation
|
||||||
|
|
||||||
|
// TOOD: this class could use standard iterators instead of flat
|
||||||
|
// box tree ones. This potentially saves a sorting step when
|
||||||
|
// no box trees are needed and order will remain more stable in
|
||||||
|
// that case.
|
||||||
|
|
||||||
NormalInstanceIteratorTraits::NormalInstanceIteratorTraits ()
|
NormalInstanceIteratorTraits::NormalInstanceIteratorTraits ()
|
||||||
: mp_insts (0)
|
: mp_insts (0)
|
||||||
{ }
|
{ }
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue