mirror of https://github.com/KLayout/klayout.git
Merge remote-tracking branch 'remotes/origin/master' into add-testcase
This commit is contained in:
commit
ad00b4a9bf
|
|
@ -1406,8 +1406,8 @@ private:
|
||||||
struct InteractionKeyForClustersType
|
struct InteractionKeyForClustersType
|
||||||
: public InstanceToInstanceInteraction
|
: public InstanceToInstanceInteraction
|
||||||
{
|
{
|
||||||
InteractionKeyForClustersType (db::cell_index_type _ci1, db::cell_index_type _ci2, const db::ICplxTrans &_t21, const box_type &_box)
|
InteractionKeyForClustersType (db::cell_index_type _ci1, db::cell_index_type _ci2, const db::ICplxTrans &_t1, const db::ICplxTrans &_t21, const box_type &_box)
|
||||||
: InstanceToInstanceInteraction (_ci1, 0, _ci2, 0, _t21), box (_box)
|
: InstanceToInstanceInteraction (_ci1, 0, _ci2, 0, _t1, _t21), box (_box)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
bool operator== (const InteractionKeyForClustersType &other) const
|
bool operator== (const InteractionKeyForClustersType &other) const
|
||||||
|
|
@ -1482,18 +1482,22 @@ private:
|
||||||
|
|
||||||
InstanceToInstanceInteraction ii_key;
|
InstanceToInstanceInteraction ii_key;
|
||||||
db::ICplxTrans i1t, i2t;
|
db::ICplxTrans i1t, i2t;
|
||||||
|
bool fill_cache = false;
|
||||||
|
|
||||||
|
// Cache is only used for single instances, non-iterated, simple or regular arrays.
|
||||||
|
if ((! i1element.at_end () || i1.size () == 1 || ! i1.is_iterated_array ()) &&
|
||||||
|
(! i2element.at_end () || i2.size () == 1 || ! i2.is_iterated_array ())) {
|
||||||
|
|
||||||
{
|
|
||||||
i1t = i1element.at_end () ? i1.complex_trans () : i1.complex_trans (*i1element);
|
i1t = i1element.at_end () ? i1.complex_trans () : i1.complex_trans (*i1element);
|
||||||
db::ICplxTrans tt1 = t1 * i1t;
|
db::ICplxTrans tt1 = t1 * i1t;
|
||||||
|
|
||||||
i2t = i2element.at_end () ? i2.complex_trans () : i2.complex_trans (*i2element);
|
i2t = i2element.at_end () ? i2.complex_trans () : i2.complex_trans (*i2element);
|
||||||
db::ICplxTrans tt2 = t2 * i2t;
|
db::ICplxTrans tt2 = t2 * i2t;
|
||||||
|
|
||||||
db::ICplxTrans tt21 = tt1.inverted () * tt2;
|
db::ICplxTrans cache_norm = tt1.inverted ();
|
||||||
ii_key = InstanceToInstanceInteraction (i1.cell_index (), (! i1element.at_end () || i1.size () == 1) ? 0 : i1.cell_inst ().delegate (),
|
ii_key = InstanceToInstanceInteraction (i1.cell_index (), (! i1element.at_end () || i1.size () == 1) ? 0 : i1.cell_inst ().delegate (),
|
||||||
i2.cell_index (), (! i2element.at_end () || i2.size () == 1) ? 0 : i2.cell_inst ().delegate (),
|
i2.cell_index (), (! i2element.at_end () || i2.size () == 1) ? 0 : i2.cell_inst ().delegate (),
|
||||||
tt21);
|
cache_norm, cache_norm * tt2);
|
||||||
|
|
||||||
instance_interaction_cache_type::iterator ii = mp_instance_interaction_cache->find (ii_key);
|
instance_interaction_cache_type::iterator ii = mp_instance_interaction_cache->find (ii_key);
|
||||||
if (ii != mp_instance_interaction_cache->end ()) {
|
if (ii != mp_instance_interaction_cache->end ()) {
|
||||||
|
|
@ -1511,6 +1515,9 @@ private:
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fill_cache = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// array interactions
|
// array interactions
|
||||||
|
|
@ -1611,7 +1618,9 @@ private:
|
||||||
// return the list of unique interactions
|
// return the list of unique interactions
|
||||||
interacting_clusters.insert (interacting_clusters.end (), sorted_interactions.begin (), sorted_interactions.end ());
|
interacting_clusters.insert (interacting_clusters.end (), sorted_interactions.begin (), sorted_interactions.end ());
|
||||||
|
|
||||||
// normalize transformations in cache
|
if (fill_cache) {
|
||||||
|
|
||||||
|
// normalize transformations for cache
|
||||||
db::ICplxTrans i1ti = i1t.inverted (), i2ti = i2t.inverted ();
|
db::ICplxTrans i1ti = i1t.inverted (), i2ti = i2t.inverted ();
|
||||||
for (std::vector<std::pair<ClusterInstance, ClusterInstance> >::iterator i = sorted_interactions.begin (); i != sorted_interactions.end (); ++i) {
|
for (std::vector<std::pair<ClusterInstance, ClusterInstance> >::iterator i = sorted_interactions.begin (); i != sorted_interactions.end (); ++i) {
|
||||||
i->first.transform (i1ti);
|
i->first.transform (i1ti);
|
||||||
|
|
@ -1620,6 +1629,8 @@ private:
|
||||||
|
|
||||||
cluster_instance_pair_list_type &cached = (*mp_instance_interaction_cache) [ii_key];
|
cluster_instance_pair_list_type &cached = (*mp_instance_interaction_cache) [ii_key];
|
||||||
cached.insert (cached.end (), sorted_interactions.begin (), sorted_interactions.end ());
|
cached.insert (cached.end (), sorted_interactions.begin (), sorted_interactions.end ());
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1641,7 +1652,7 @@ private:
|
||||||
|
|
||||||
box_type common2 = common.transformed (t2i);
|
box_type common2 = common.transformed (t2i);
|
||||||
|
|
||||||
InteractionKeyForClustersType ikey (ci1, ci2, t21, common2);
|
InteractionKeyForClustersType ikey (ci1, ci2, t1i, t21, common2);
|
||||||
|
|
||||||
typename std::map<InteractionKeyForClustersType, std::vector<std::pair<size_t, size_t> > >::const_iterator ici = m_interaction_cache_for_clusters.find (ikey);
|
typename std::map<InteractionKeyForClustersType, std::vector<std::pair<size_t, size_t> > >::const_iterator ici = m_interaction_cache_for_clusters.find (ikey);
|
||||||
if (ici != m_interaction_cache_for_clusters.end ()) {
|
if (ici != m_interaction_cache_for_clusters.end ()) {
|
||||||
|
|
|
||||||
|
|
@ -762,13 +762,71 @@ inline bool less_array_delegates (const db::ArrayBase *a, const db::ArrayBase *b
|
||||||
*/
|
*/
|
||||||
struct InstanceToInstanceInteraction
|
struct InstanceToInstanceInteraction
|
||||||
{
|
{
|
||||||
InstanceToInstanceInteraction (db::cell_index_type _ci1, const db::ArrayBase *_array1, db::cell_index_type _ci2, const db::ArrayBase *_array2, const db::ICplxTrans &_t21)
|
InstanceToInstanceInteraction (db::cell_index_type _ci1, const db::ArrayBase *_array1, db::cell_index_type _ci2, const db::ArrayBase *_array2, const db::ICplxTrans &_tn, const db::ICplxTrans &_t21)
|
||||||
: ci1 (_ci1), ci2 (_ci2), array1 (_array1), array2 (_array2), t21 (_t21)
|
: ci1 (_ci1), ci2 (_ci2), array1 (0), array2 (0), t21 (_t21)
|
||||||
{ }
|
{
|
||||||
|
if (_array1) {
|
||||||
|
array1 = _array1->basic_clone ();
|
||||||
|
static_cast<db::basic_array<db::Coord> *> (array1)->transform (_tn);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_array2) {
|
||||||
|
array2 = _array2->basic_clone ();
|
||||||
|
static_cast<db::basic_array<db::Coord> *> (array2)->transform (_tn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
InstanceToInstanceInteraction ()
|
InstanceToInstanceInteraction ()
|
||||||
: ci1 (0), ci2 (0), array1 (0), array2 (0)
|
: ci1 (0), ci2 (0), array1 (0), array2 (0)
|
||||||
{ }
|
{
|
||||||
|
// .. nothing yet ..
|
||||||
|
}
|
||||||
|
|
||||||
|
InstanceToInstanceInteraction (const InstanceToInstanceInteraction &other)
|
||||||
|
: ci1 (other.ci1), ci2 (other.ci2),
|
||||||
|
array1 (other.array1 ? other.array1->basic_clone () : 0),
|
||||||
|
array2 (other.array2 ? other.array2->basic_clone () : 0),
|
||||||
|
t21 (other.t21)
|
||||||
|
{
|
||||||
|
// .. nothing yet ..
|
||||||
|
}
|
||||||
|
|
||||||
|
InstanceToInstanceInteraction &operator= (const InstanceToInstanceInteraction &other)
|
||||||
|
{
|
||||||
|
if (this != &other) {
|
||||||
|
|
||||||
|
ci1 = other.ci1;
|
||||||
|
ci2 = other.ci2;
|
||||||
|
|
||||||
|
if (array1) {
|
||||||
|
delete array1;
|
||||||
|
}
|
||||||
|
array1 = other.array1 ? other.array1->basic_clone () : 0;
|
||||||
|
|
||||||
|
if (array2) {
|
||||||
|
delete array2;
|
||||||
|
}
|
||||||
|
array2 = other.array2 ? other.array2->basic_clone () : 0;
|
||||||
|
|
||||||
|
t21 = other.t21;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
~InstanceToInstanceInteraction ()
|
||||||
|
{
|
||||||
|
if (array1) {
|
||||||
|
delete array1;
|
||||||
|
}
|
||||||
|
array1 = 0;
|
||||||
|
|
||||||
|
if (array2) {
|
||||||
|
delete array2;
|
||||||
|
}
|
||||||
|
array2 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool operator== (const InstanceToInstanceInteraction &other) const
|
bool operator== (const InstanceToInstanceInteraction &other) const
|
||||||
{
|
{
|
||||||
|
|
@ -797,7 +855,7 @@ struct InstanceToInstanceInteraction
|
||||||
}
|
}
|
||||||
|
|
||||||
db::cell_index_type ci1, ci2;
|
db::cell_index_type ci1, ci2;
|
||||||
const db::ArrayBase *array1, *array2;
|
db::ArrayBase *array1, *array2;
|
||||||
db::ICplxTrans t21;
|
db::ICplxTrans t21;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue