This commit is contained in:
Matthias Koefferlein 2021-10-26 23:10:29 +02:00
parent 7881c0953c
commit 596080669d
4 changed files with 28 additions and 71 deletions

View File

@ -1697,7 +1697,7 @@ struct array
* an appropriate basic_array object using a complex transformation.
*/
array (const Obj &obj, const complex_trans_type &ct, const vector_type &a, const vector_type &b, unsigned long amax, unsigned long bmax)
: m_obj (obj), m_trans (ct), mp_base (new regular_complex_array <coord_type> (ct.rcos (), ct.mag (), a, b, amax, bmax))
: m_obj (obj), m_trans (ct), mp_base (ct.is_complex () ? new regular_complex_array <coord_type> (ct.rcos (), ct.mag (), a, b, amax, bmax) : new regular_array <coord_type> (a, b, amax, bmax))
{
// .. nothing yet ..
}
@ -1725,7 +1725,7 @@ struct array
* it's own storage.
*/
array (const Obj &obj, const complex_trans_type &ct, ArrayRepository &rep, const vector_type &a, const vector_type &b, unsigned long amax, unsigned long bmax)
: m_obj (obj), m_trans (ct), mp_base (rep.insert (regular_complex_array <coord_type> (ct.rcos (), ct.mag (), a, b, amax, bmax)))
: m_obj (obj), m_trans (ct), mp_base (ct.is_complex () ? rep.insert (regular_complex_array <coord_type> (ct.rcos (), ct.mag (), a, b, amax, bmax)) : rep.insert (regular_array <coord_type> (a, b, amax, bmax)))
{
// .. nothing yet ..
}
@ -1764,7 +1764,7 @@ struct array
*/
template <class Iter>
array (const Obj &obj, const complex_trans_type &ct, Iter from, Iter to)
: m_obj (obj), m_trans (ct), mp_base (new iterated_complex_array <coord_type> (ct.rcos (), ct.mag (), from, to))
: m_obj (obj), m_trans (ct), mp_base (ct.is_complex () ? new iterated_complex_array <coord_type> (ct.rcos (), ct.mag (), from, to) : new iterated_array <coord_type> (from, to))
{
// .. nothing yet ..
}
@ -1777,7 +1777,7 @@ struct array
*/
explicit
array (const Obj &obj, const complex_trans_type &ct)
: m_obj (obj), m_trans (ct), mp_base (new single_complex_inst <coord_type> (ct.rcos (), ct.mag ()))
: m_obj (obj), m_trans (ct), mp_base (ct.is_complex () ? new single_complex_inst <coord_type> (ct.rcos (), ct.mag ()) : 0)
{
// .. nothing yet ..
}
@ -1807,7 +1807,7 @@ struct array
*/
explicit
array (const Obj &obj, const complex_trans_type &ct, ArrayRepository &rep)
: m_obj (obj), m_trans (ct), mp_base (rep.insert (single_complex_inst <coord_type> (ct.rcos (), ct.mag ())))
: m_obj (obj), m_trans (ct), mp_base (ct.is_complex () ? rep.insert (single_complex_inst <coord_type> (ct.rcos (), ct.mag ())) : 0)
{
// .. nothing yet ..
}
@ -1888,17 +1888,13 @@ struct array
array_iterator <coord_type, Trans> begin_touching (const box_type &b, const BoxConv &bc) const
{
if (b.empty ()) {
if (mp_base) {
return array_iterator <coord_type, Trans> (m_trans, mp_base->begin_touching (box_type ()));
} else {
return array_iterator <coord_type, Trans> (m_trans, true);
}
return array_iterator <coord_type, Trans> (m_trans, true);
} else if (b == box_type::world ()) {
return begin ();
} else if (mp_base) {
box_type ob (bc (m_obj));
if (ob.empty ()) {
return array_iterator <coord_type, Trans> (m_trans, mp_base->begin_touching (box_type ()));
return array_iterator <coord_type, Trans> (m_trans, true);
} else {
if (mp_base->is_complex ()) {
complex_trans_type ct = mp_base->complex_trans (simple_trans_type (m_trans));

View File

@ -1076,6 +1076,9 @@ printf("@@@ check instance interactions %s (#%d, %s) <-> %s (#%d, %s)\n",
std::unordered_map<db::ICplxTrans, std::list<std::pair<db::cell_index_type, db::ICplxTrans> > > interactions_cache;
#if 0
printf("@@@ -> #%d\n", int(inst1->size()));
#endif
for (db::CellInstArray::iterator n = inst1->begin (); ! n.at_end (); ++n) {
db::ICplxTrans tn1 = inst1->complex_trans (*n);
@ -1131,51 +1134,8 @@ printf("@@@ check instance interactions %s (#%d, %s) <-> %s (#%d, %s)\n",
}
}
// @@@
bool has_intruder_tree_interactions (const db::Cell &subject_cell, const db::Cell &intruder_cell, const db::ICplxTrans &tni1, const db::ICplxTrans &tn21, const db::Box &cbox)
{
db::ICplxTrans tni2 = tn21.inverted () * tni1;
db::Box tbox2 = safe_box_enlarged (tni2 * cbox, -1, -1);
if (! intruder_cell.shapes (m_intruder_layer).begin_touching (tbox2, ShapeIterator::All).at_end ()) {
// we're overlapping with shapes from the intruder - do not recursive further
return true;
}
for (db::Cell::touching_iterator i = intruder_cell.begin_touching (tbox2); ! i.at_end (); ++i) {
const db::Cell &ic = mp_intruder_layout->cell (i->cell_index ());
for (db::CellInstArray::iterator ia = i->begin_touching (tbox2, mp_intruder_layout); ! ia.at_end (); ++ia) {
db::ICplxTrans it = i->complex_trans (*ia);
db::Box ibox2 = tni2.inverted () * it * ic.bbox (m_intruder_layer).enlarged (db::Vector (m_dist, m_dist));
db::Box ccbox = cbox & ibox2;
if (! ccbox.empty () && ! db::RecursiveShapeIterator (*mp_subject_layout, subject_cell, m_subject_layer, safe_box_enlarged (tni1 * ccbox, -1, -1), false).at_end ()) {
if (has_intruder_tree_interactions (subject_cell, ic, tni1, tn21 * it, ccbox)) {
return true;
}
}
}
}
return false;
}
// @@@
void collect_intruder_tree_interactions (const db::Cell &subject_cell, const db::Cell &intruder_cell, const db::ICplxTrans &tni1, const db::ICplxTrans &tn21, const db::Box &cbox, std::list<std::pair<db::cell_index_type, db::ICplxTrans> > &interactions)
{
#if 0
if (has_intruder_tree_interactions (subject_cell, intruder_cell, tni1, tn21, cbox)) {
interactions.push_back (std::make_pair (intruder_cell.cell_index (), tn21));
}
#elif 1
db::ICplxTrans tni2 = tn21.inverted () * tni1;
db::Box tbox2 = safe_box_enlarged (tni2 * cbox, -1, -1);
@ -1205,20 +1165,6 @@ printf("@@@ check instance interactions %s (#%d, %s) <-> %s (#%d, %s)\n",
}
}
#else
// not very strong, but already useful: the cells interact if there is a layer1 in cell1
// in the common box and a layer2 in the cell2 in the common box
// NOTE: don't use overlap mode for the RecursiveShapeIterator as this would not capture dot-like
// objects like texts. Instead safe-shrink the search box and use touching mode ("false" for the last
// argument)
db::ICplxTrans tni2 = tn21.inverted () * tni1;
bool interacts = (! db::RecursiveShapeIterator (*mp_subject_layout, subject_cell, m_subject_layer, safe_box_enlarged (tni1 * cbox, -1, -1), false).at_end () &&
! db::RecursiveShapeIterator (*mp_intruder_layout, intruder_cell, m_intruder_layer, safe_box_enlarged (tni2 * cbox, -1, -1), false).at_end ());
if (interacts) {
interactions.push_back (std::make_pair (intruder_cell.cell_index (), tn21));
}
#endif
}
};
@ -1669,8 +1615,6 @@ printf("@@@ --- compute_contexts (%s @ %s)\n", mp_subject_layout->cell_name (sub
}
std::list<db::CellInstArray> instance_heap;
for (std::set<db::CellInstArray>::const_iterator i = intruders.first.begin (); i != intruders.first.end (); ++i) {
if (! inst_bci (*i).empty ()) {
scanner.insert2 (i.operator-> (), ++id);

View File

@ -2011,6 +2011,15 @@ public:
m_mag = m_mag < 0.0 ? -m : m;
}
/**
* @brief Returns a value indicating whether the transformation is a complex one
* The transformation can safely be converted to a simple transformation if this value is false.
*/
bool is_complex () const
{
return is_mag () || ! is_ortho ();
}
/**
* @brief Test, if the transformation is mirroring
*/

View File

@ -916,7 +916,7 @@ struct cplx_trans_defs
"@brief Gets the magnification\n"
) +
method ("is_mag?", &C::is_mag,
"@brief Test, if the transformation is a magnifying one\n"
"@brief Tests, if the transformation is a magnifying one\n"
"\n"
"This is the recommended test for checking if the transformation represents\n"
"a magnification.\n"
@ -925,6 +925,14 @@ struct cplx_trans_defs
"@brief Sets the magnification\n"
"@param m The new magnification"
) +
method ("is_complex?", &C::is_complex,
"@brief Return true if the transformation is a complex one\n"
"\n"
"If this value is false, the transformation can safely be converted to a simple transformation.\n"
"The return value is equivalent to 'is_mag || !is_ortho'.\n"
"\n"
"This method has been introduced in version 0.27.5."
) +
method ("R0", &trans_r0,
"@brief A constant giving \"unrotated\" (unit) transformation\n"
"The previous integer constant has been turned into a transformation in version 0.25."