mirror of https://github.com/KLayout/klayout.git
WIP: fixed unit tests, bug fix in DeepRegion -> and and not shall return a DeepRegion always.
This commit is contained in:
parent
33bb85e4f3
commit
37012efba0
|
|
@ -23,7 +23,6 @@
|
||||||
|
|
||||||
#include "dbDeepRegion.h"
|
#include "dbDeepRegion.h"
|
||||||
#include "dbDeepShapeStore.h"
|
#include "dbDeepShapeStore.h"
|
||||||
#include "dbEmptyRegion.h"
|
|
||||||
#include "dbEmptyEdgePairs.h"
|
#include "dbEmptyEdgePairs.h"
|
||||||
#include "dbRegion.h"
|
#include "dbRegion.h"
|
||||||
#include "dbRegionUtils.h"
|
#include "dbRegionUtils.h"
|
||||||
|
|
@ -462,10 +461,13 @@ DeepRegion::and_with (const Region &other) const
|
||||||
{
|
{
|
||||||
const DeepRegion *other_deep = dynamic_cast <const DeepRegion *> (other.delegate ());
|
const DeepRegion *other_deep = dynamic_cast <const DeepRegion *> (other.delegate ());
|
||||||
|
|
||||||
if (empty () || other.empty ()) {
|
if (empty ()) {
|
||||||
|
|
||||||
// Nothing to do
|
return clone ();
|
||||||
return new EmptyRegion ();
|
|
||||||
|
} else if (other.empty ()) {
|
||||||
|
|
||||||
|
return other.delegate ()->clone ();
|
||||||
|
|
||||||
} else if (! other_deep) {
|
} else if (! other_deep) {
|
||||||
|
|
||||||
|
|
@ -483,14 +485,8 @@ DeepRegion::not_with (const Region &other) const
|
||||||
{
|
{
|
||||||
const DeepRegion *other_deep = dynamic_cast <const DeepRegion *> (other.delegate ());
|
const DeepRegion *other_deep = dynamic_cast <const DeepRegion *> (other.delegate ());
|
||||||
|
|
||||||
if (empty ()) {
|
if (empty () || other.empty ()) {
|
||||||
|
|
||||||
// Nothing to do
|
|
||||||
return new EmptyRegion ();
|
|
||||||
|
|
||||||
} else if (other.empty ()) {
|
|
||||||
|
|
||||||
// Nothing to do
|
|
||||||
return clone ();
|
return clone ();
|
||||||
|
|
||||||
} else if (! other_deep) {
|
} else if (! other_deep) {
|
||||||
|
|
@ -1231,6 +1227,12 @@ DeepRegion::merged (bool min_coherence, unsigned int min_wc) const
|
||||||
RegionDelegate *
|
RegionDelegate *
|
||||||
DeepRegion::sized (coord_type d, unsigned int mode) const
|
DeepRegion::sized (coord_type d, unsigned int mode) const
|
||||||
{
|
{
|
||||||
|
if (empty ()) {
|
||||||
|
// Nothing to do - NOTE: don't return EmptyRegion because we want to
|
||||||
|
// maintain "deepness"
|
||||||
|
return clone ();
|
||||||
|
}
|
||||||
|
|
||||||
ensure_merged_polygons_valid ();
|
ensure_merged_polygons_valid ();
|
||||||
|
|
||||||
db::Layout &layout = m_merged_polygons.layout ();
|
db::Layout &layout = m_merged_polygons.layout ();
|
||||||
|
|
@ -1299,6 +1301,12 @@ struct XYAnisotropyAndMagnificationReducer
|
||||||
RegionDelegate *
|
RegionDelegate *
|
||||||
DeepRegion::sized (coord_type dx, coord_type dy, unsigned int mode) const
|
DeepRegion::sized (coord_type dx, coord_type dy, unsigned int mode) const
|
||||||
{
|
{
|
||||||
|
if (empty ()) {
|
||||||
|
// Nothing to do - NOTE: don't return EmptyRegion because we want to
|
||||||
|
// maintain "deepness"
|
||||||
|
return clone ();
|
||||||
|
}
|
||||||
|
|
||||||
if (dx == dy) {
|
if (dx == dy) {
|
||||||
return sized (dx, mode);
|
return sized (dx, mode);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -232,6 +232,13 @@ Region::Region (const RecursiveShapeIterator &si, DeepShapeStore &dss, const db:
|
||||||
mp_delegate = new DeepRegion (si, dss, trans, merged_semantics, area_ratio, max_vertex_count);
|
mp_delegate = new DeepRegion (si, dss, trans, merged_semantics, area_ratio, max_vertex_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Region::Region (DeepShapeStore &dss)
|
||||||
|
{
|
||||||
|
tl_assert (dss.is_singular ());
|
||||||
|
unsigned int layout_index = 0; // singular layout index
|
||||||
|
mp_delegate = new db::DeepRegion (db::DeepLayer (&dss, layout_index, dss.layout (layout_index).insert_layer ()));
|
||||||
|
}
|
||||||
|
|
||||||
const db::RecursiveShapeIterator &
|
const db::RecursiveShapeIterator &
|
||||||
Region::iter () const
|
Region::iter () const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -345,6 +345,12 @@ public:
|
||||||
*/
|
*/
|
||||||
explicit Region (const RecursiveShapeIterator &si, DeepShapeStore &dss, const db::ICplxTrans &trans, bool merged_semantics = true, double area_ratio = 3.0, size_t max_vertex_count = 16);
|
explicit Region (const RecursiveShapeIterator &si, DeepShapeStore &dss, const db::ICplxTrans &trans, bool merged_semantics = true, double area_ratio = 3.0, size_t max_vertex_count = 16);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Creates a new empty layer inside the dss
|
||||||
|
* This method requires the DSS to be singular.
|
||||||
|
*/
|
||||||
|
explicit Region (DeepShapeStore &dss);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gets the underlying delegate object
|
* @brief Gets the underlying delegate object
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1136,7 +1136,7 @@ TEST(5_ResAndCapWithBulkExtraction)
|
||||||
db::Region rmetal2_lbl (db::RecursiveShapeIterator (ly, tc, metal2_lbl), dss);
|
db::Region rmetal2_lbl (db::RecursiveShapeIterator (ly, tc, metal2_lbl), dss);
|
||||||
db::Region rcap (db::RecursiveShapeIterator (ly, tc, cap), dss);
|
db::Region rcap (db::RecursiveShapeIterator (ly, tc, cap), dss);
|
||||||
db::Region rres (db::RecursiveShapeIterator (ly, tc, res), dss);
|
db::Region rres (db::RecursiveShapeIterator (ly, tc, res), dss);
|
||||||
db::Region rbulk;
|
db::Region rbulk (dss);
|
||||||
|
|
||||||
// derived regions
|
// derived regions
|
||||||
|
|
||||||
|
|
@ -1409,7 +1409,7 @@ TEST(6_BJT3TransistorExtraction)
|
||||||
db::Region rmetal2_lbl (db::RecursiveShapeIterator (ly, tc, metal2_lbl), dss);
|
db::Region rmetal2_lbl (db::RecursiveShapeIterator (ly, tc, metal2_lbl), dss);
|
||||||
db::Region rpplus (db::RecursiveShapeIterator (ly, tc, pplus), dss);
|
db::Region rpplus (db::RecursiveShapeIterator (ly, tc, pplus), dss);
|
||||||
db::Region rnplus (db::RecursiveShapeIterator (ly, tc, nplus), dss);
|
db::Region rnplus (db::RecursiveShapeIterator (ly, tc, nplus), dss);
|
||||||
db::Region rbulk;
|
db::Region rbulk (dss);
|
||||||
|
|
||||||
// derived regions
|
// derived regions
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -400,7 +400,7 @@ module DRC
|
||||||
|
|
||||||
id = data.data_id
|
id = data.data_id
|
||||||
|
|
||||||
if @layers[id]
|
if @layers && @layers[id]
|
||||||
# already registered
|
# already registered
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ connect(metal2, metal2_lbl)
|
||||||
|
|
||||||
# Actually performs the extraction
|
# Actually performs the extraction
|
||||||
|
|
||||||
join_nets("{VDDZ,VSSZ,NEXT,FB}")
|
connect_implicit("{VDDZ,VSSZ,NEXT,FB}")
|
||||||
|
|
||||||
netlist = l2n_data.netlist
|
netlist = l2n_data.netlist
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue