Skip to content

Commit

Permalink
Merge pull request #1916 from KLayout/maybe-pex-support
Browse files Browse the repository at this point in the history
Some add-ons for potential application in the PEX context
  • Loading branch information
klayoutmatthias authored Nov 28, 2024
2 parents 66d97bb + ce4dc08 commit ec21809
Show file tree
Hide file tree
Showing 22 changed files with 2,250 additions and 11 deletions.
3 changes: 3 additions & 0 deletions src/db/db/db.pro
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ SOURCES = \
dbCommonReader.cc \
dbCompoundOperation.cc \
dbEdge.cc \
dbEdgeNeighborhood.cc \
dbEdgePair.cc \
dbEdgePairFilters.cc \
dbEdgePairRelations.cc \
Expand Down Expand Up @@ -119,6 +120,7 @@ SOURCES = \
gsiDeclDbCommonStreamOptions.cc \
gsiDeclDbCompoundOperation.cc \
gsiDeclDbEdge.cc \
gsiDeclDbEdgeNeighborhood.cc \
gsiDeclDbEdgePair.cc \
gsiDeclDbEdgePairs.cc \
gsiDeclDbEdgeProcessor.cc \
Expand Down Expand Up @@ -249,6 +251,7 @@ HEADERS = \
dbCommonReader.h \
dbCompoundOperation.h \
dbEdge.h \
dbEdgeNeighborhood.h \
dbEdgePair.h \
dbEdgePairFilters.h \
dbEdgePairRelations.h \
Expand Down
30 changes: 20 additions & 10 deletions src/db/db/dbCompoundOperation.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ class DB_PUBLIC CompoundRegionOperationNode
virtual db::Coord computed_dist () const = 0;

virtual std::string generated_description () const;
virtual bool wants_caching () const { return true; }

private:
std::string m_description;
Expand All @@ -276,23 +277,32 @@ class DB_PUBLIC CompoundRegionOperationNode
{
// TODO: confine caching to those nodes which need it.

std::pair<bool, std::vector<std::unordered_set<TR> > *> cp = cache->get<TR> (this);
if (wants_caching ()) {

if (! cp.first) {
std::pair<bool, std::vector<std::unordered_set<TR> > *> cp = cache->get<TR> (this);

std::vector<std::unordered_set<TR> > uncached_results;
uncached_results.resize (results.size ());
if (! cp.first) {

do_compute_local (cache, layout, cell, interactions, uncached_results, proc);
std::vector<std::unordered_set<TR> > uncached_results;
uncached_results.resize (results.size ());

cp.second->swap (uncached_results);
do_compute_local (cache, layout, cell, interactions, uncached_results, proc);

}
cp.second->swap (uncached_results);

}

tl_assert (results.size () == cp.second->size ());
for (size_t r = 0; r < results.size (); ++r) {
results[r].insert ((*cp.second)[r].begin (), (*cp.second)[r].end ());
}

} else {

do_compute_local (cache, layout, cell, interactions, results, proc);

tl_assert (results.size () == cp.second->size ());
for (size_t r = 0; r < results.size (); ++r) {
results[r].insert ((*cp.second)[r].begin (), (*cp.second)[r].end ());
}

}
};

Expand Down
Loading

0 comments on commit ec21809

Please sign in to comment.