Skip to content

Commit

Permalink
Merge pull request #1466 from KLayout/wip2
Browse files Browse the repository at this point in the history
Wip2
  • Loading branch information
klayoutmatthias authored Sep 7, 2023
2 parents babd8cd + c6d7b3e commit be1be46
Show file tree
Hide file tree
Showing 48 changed files with 1,250 additions and 482 deletions.
4 changes: 2 additions & 2 deletions src/db/db/dbDeepRegion.cc
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ static void transform_deep_layer (db::DeepLayer &deep_layer, const Trans &t)

// Plain move

// build cell variants for different orientations
db::OrientationReducer same_orientation;
// build cell variants for different orientations and magnifications
db::MagnificationAndOrientationReducer same_orientation;

db::VariantsCollectorBase vars (&same_orientation);
vars.collect (deep_layer.layout (), deep_layer.initial_cell ());
Expand Down
27 changes: 16 additions & 11 deletions src/db/db/gsiDeclDbEdge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ struct edge_defs
"@return The scaled edge\n"
) +
method ("contains?", &C::contains, gsi::arg ("p"),
"@brief Test whether a point is on an edge.\n"
"@brief Tests whether a point is on an edge.\n"
"\n"
"A point is on a edge if it is on (or at least closer \n"
"than a grid point to) the edge.\n"
Expand All @@ -474,7 +474,7 @@ struct edge_defs
"@return True if the point is on the edge.\n"
) +
method ("contains_excl?", &C::contains_excl, gsi::arg ("p"),
"@brief Test whether a point is on an edge excluding the endpoints.\n"
"@brief Tests whether a point is on an edge excluding the endpoints.\n"
"\n"
"A point is on a edge if it is on (or at least closer \n"
"than a grid point to) the edge.\n"
Expand All @@ -494,15 +494,18 @@ struct edge_defs
"\n"
"@return True if the edges are coincident.\n"
) +
method ("intersect?", &C::intersect, gsi::arg ("e"),
method ("intersects?|#intersect?", &C::intersect, gsi::arg ("e"),
"@brief Intersection test. \n"
"\n"
"Returns true if the edges intersect. Two edges intersect if they share at least one point. \n"
"If the edges coincide, they also intersect.\n"
"For degenerated edges, the intersection is mapped to\n"
"point containment tests.\n"
"If one of the edges is degenerate (both points are identical), that point is "
"required to sit exaclty on the other edge. If both edges are degenerate, their "
"points are required to be identical.\n"
"\n"
"@param e The edge to test.\n"
"\n"
"The 'intersects' (with an 's') synonym has been introduced in version 0.28.12.\n"
) +
method_ext ("intersection_point", &intersect_point, gsi::arg ("e"),
"@brief Returns the intersection point of two edges. \n"
Expand Down Expand Up @@ -600,19 +603,21 @@ struct edge_defs
"This method has been introduced in version 0.23.\n"
) +
method ("crossed_by?", &C::crossed_by, gsi::arg ("e"),
"@brief Check, if an edge is cut by a line (given by an edge)\n"
"@brief Checks, if the line given by self is crossed by the edge e\n"
"\n"
"This method returns true if p1 is in one semispace \n"
"while p2 is in the other or one of them is on the line\n"
"through the edge \"e\"\n"
"self if considered an infinite line. This predicate renders true "
"if the edge e is cut by this line. In other words: "
"this method returns true if e.p1 is in one semispace of self \n"
"while e.p2 is in the other or one of them is exactly on self.\n"
"\n"
"@param e The edge representing the line that the edge must be crossing.\n"
) +
method_ext ("crossing_point", &crossing_point, gsi::arg ("e"),
"@brief Returns the crossing point on two edges. \n"
"\n"
"This method delivers the point where the given edge (self) crosses the line given "
"by the edge in argument \"e\". If self does not cross this line, the result is undefined. "
"This method delivers the point where the given line (self) crosses the edge given "
"by the argument \"e\". self is considered infinitely long and is required to cut "
"through the edge \"e\". If self does not cut this line, the result is undefined. "
"See \\crossed_by? for a description of the crossing predicate.\n"
"\n"
"@param e The edge representing the line that self must be crossing.\n"
Expand Down
14 changes: 10 additions & 4 deletions src/db/db/gsiDeclDbEdgePairs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -425,24 +425,30 @@ Class<db::EdgePairs> decl_EdgePairs (decl_dbShapeCollection, "db", "EdgePairs",
"\n"
"This method has been added in version 0.26."
) +
method ("+", &db::EdgePairs::operator+, gsi::arg ("other"),
method ("+|join", &db::EdgePairs::operator+, gsi::arg ("other"),
"@brief Returns the combined edge pair collection of self and the other one\n"
"\n"
"@return The resulting edge pair collection\n"
"\n"
"This operator adds the edge pairs of the other collection to self and returns a new combined set.\n"
"\n"
"This method has been introduced in version 0.24.\n"
) +
method ("+=", &db::EdgePairs::operator+=, gsi::arg ("other"),
"The 'join' alias has been introduced in version 0.28.12."
) +
method ("+=|join_with", &db::EdgePairs::operator+=, gsi::arg ("other"),
"@brief Adds the edge pairs of the other edge pair collection to self\n"
"\n"
"@return The edge pair collection after modification (self)\n"
"\n"
"This operator adds the edge pairs of the other collection to self.\n"
"\n"
"This method has been introduced in version 0.24.\n"
) +
"\n"
"Note that in Ruby, the '+=' operator actually does not exist, but is emulated by '+' followed by an assignment. "
"This is less efficient than the in-place operation, so it is recommended to use 'join_with' instead.\n"
"\n"
"The 'join_with' alias has been introduced in version 0.28.12."
) +
method_ext ("move", &move_p, gsi::arg ("p"),
"@brief Moves the edge pair collection\n"
"\n"
Expand Down
114 changes: 80 additions & 34 deletions src/db/db/gsiDeclDbEdges.cc
Original file line number Diff line number Diff line change
Expand Up @@ -769,25 +769,32 @@ Class<db::Edges> decl_Edges (decl_dbShapeCollection, "db", "Edges",
"Crossing edges are not merged.\n"
"In contrast to \\merge, this method does not modify the edge collection but returns a merged copy.\n"
) +
method ("&", (db::Edges (db::Edges::*)(const db::Edges &) const) &db::Edges::operator&, gsi::arg ("other"),
method ("&|and", (db::Edges (db::Edges::*)(const db::Edges &) const) &db::Edges::operator&, gsi::arg ("other"),
"@brief Returns the boolean AND between self and the other edge collection\n"
"\n"
"@return The result of the boolean AND operation\n"
"\n"
"The boolean AND operation will return all parts of the edges in this collection which "
"are coincident with parts of the edges in the other collection."
"The result will be a merged edge collection.\n"
) +
method ("&=", (db::Edges &(db::Edges::*)(const db::Edges &)) &db::Edges::operator&=, gsi::arg ("other"),
"@brief Performs the boolean AND between self and the other edge collection\n"
"\n"
"The 'and' alias has been introduced in version 0.28.12."
) +
method ("&=|and_with", (db::Edges &(db::Edges::*)(const db::Edges &)) &db::Edges::operator&=, gsi::arg ("other"),
"@brief Performs the boolean AND between self and the other edge collection in-place (modifying self)\n"
"\n"
"@return The edge collection after modification (self)\n"
"\n"
"The boolean AND operation will return all parts of the edges in this collection which "
"are coincident with parts of the edges in the other collection."
"The result will be a merged edge collection.\n"
) +
method ("&", (db::Edges (db::Edges::*)(const db::Region &) const) &db::Edges::operator&, gsi::arg ("other"),
"\n"
"Note that in Ruby, the '&=' operator actually does not exist, but is emulated by '&' followed by an assignment. "
"This is less efficient than the in-place operation, so it is recommended to use 'and_with' instead.\n"
"\n"
"The 'and_with' alias has been introduced in version 0.28.12."
) +
method ("&|and", (db::Edges (db::Edges::*)(const db::Region &) const) &db::Edges::operator&, gsi::arg ("other"),
"@brief Returns the parts of the edges inside the given region\n"
"\n"
"@return The edges inside the given region\n"
Expand All @@ -798,9 +805,10 @@ Class<db::Edges> decl_Edges (decl_dbShapeCollection, "db", "Edges",
"edges intersect.\n"
"\n"
"This method has been introduced in version 0.24."
) +
method ("&=", (db::Edges &(db::Edges::*)(const db::Region &)) &db::Edges::operator&=, gsi::arg ("other"),
"@brief Selects the parts of the edges inside the given region\n"
"The 'and' alias has been introduced in version 0.28.12."
) +
method ("&=|and_with", (db::Edges &(db::Edges::*)(const db::Region &)) &db::Edges::operator&=, gsi::arg ("other"),
"@brief Selects the parts of the edges inside the given region in-place (modifying self)\n"
"\n"
"@return The edge collection after modification (self)\n"
"\n"
Expand All @@ -810,26 +818,38 @@ Class<db::Edges> decl_Edges (decl_dbShapeCollection, "db", "Edges",
"edges intersect.\n"
"\n"
"This method has been introduced in version 0.24."
) +
method ("-", (db::Edges (db::Edges::*)(const db::Edges &) const) &db::Edges::operator-, gsi::arg ("other"),
"\n"
"Note that in Ruby, the '&=' operator actually does not exist, but is emulated by '&' followed by an assignment. "
"This is less efficient than the in-place operation, so it is recommended to use 'and_with' instead.\n"
"\n"
"The 'and_with' alias has been introduced in version 0.28.12."
) +
method ("-|not", (db::Edges (db::Edges::*)(const db::Edges &) const) &db::Edges::operator-, gsi::arg ("other"),
"@brief Returns the boolean NOT between self and the other edge collection\n"
"\n"
"@return The result of the boolean NOT operation\n"
"\n"
"The boolean NOT operation will return all parts of the edges in this collection which "
"are not coincident with parts of the edges in the other collection."
"The result will be a merged edge collection.\n"
) +
method ("-=", (db::Edges &(db::Edges::*)(const db::Edges &)) &db::Edges::operator-=, gsi::arg ("other"),
"@brief Performs the boolean NOT between self and the other edge collection\n"
"\n"
"The 'not' alias has been introduced in version 0.28.12."
) +
method ("-=|not_with", (db::Edges &(db::Edges::*)(const db::Edges &)) &db::Edges::operator-=, gsi::arg ("other"),
"@brief Performs the boolean NOT between self and the other edge collection in-place (modifying self)\n"
"\n"
"@return The edge collection after modification (self)\n"
"\n"
"The boolean NOT operation will return all parts of the edges in this collection which "
"are not coincident with parts of the edges in the other collection."
"The result will be a merged edge collection.\n"
) +
method ("-", (db::Edges (db::Edges::*)(const db::Region &) const) &db::Edges::operator-, gsi::arg ("other"),
"\n"
"Note that in Ruby, the '-=' operator actually does not exist, but is emulated by '-' followed by an assignment. "
"This is less efficient than the in-place operation, so it is recommended to use 'not_with' instead.\n"
"\n"
"The 'not_with' alias has been introduced in version 0.28.12."
) +
method ("-|not", (db::Edges (db::Edges::*)(const db::Region &) const) &db::Edges::operator-, gsi::arg ("other"),
"@brief Returns the parts of the edges outside the given region\n"
"\n"
"@return The edges outside the given region\n"
Expand All @@ -840,9 +860,10 @@ Class<db::Edges> decl_Edges (decl_dbShapeCollection, "db", "Edges",
"edges intersect.\n"
"\n"
"This method has been introduced in version 0.24."
) +
method ("-=", (db::Edges &(db::Edges::*)(const db::Region &)) &db::Edges::operator-=, gsi::arg ("other"),
"@brief Selects the parts of the edges outside the given region\n"
"The 'not' alias has been introduced in version 0.28.12."
) +
method ("-=|not_with", (db::Edges &(db::Edges::*)(const db::Region &)) &db::Edges::operator-=, gsi::arg ("other"),
"@brief Selects the parts of the edges outside the given region in-place (modifying self)\n"
"\n"
"@return The edge collection after modification (self)\n"
"\n"
Expand All @@ -851,8 +872,12 @@ Class<db::Edges> decl_Edges (decl_dbShapeCollection, "db", "Edges",
"As a side effect, the edges are made non-intersecting by introducing cut points where\n"
"edges intersect.\n"
"\n"
"Note that in Ruby, the '-=' operator actually does not exist, but is emulated by '-' followed by an assignment. "
"This is less efficient than the in-place operation, so it is recommended to use 'not_with' instead.\n"
"\n"
"This method has been introduced in version 0.24."
) +
"The 'not_with' alias has been introduced in version 0.28.12."
) +
method_ext ("andnot", &andnot_with_edges, gsi::arg ("other"),
"@brief Returns the boolean AND and NOT between self and the other edge set\n"
"\n"
Expand All @@ -873,56 +898,77 @@ Class<db::Edges> decl_Edges (decl_dbShapeCollection, "db", "Edges",
"\n"
"This method has been added in version 0.28.\n"
) +
method ("^", &db::Edges::operator^, gsi::arg ("other"),
method ("^|xor", &db::Edges::operator^, gsi::arg ("other"),
"@brief Returns the boolean XOR between self and the other edge collection\n"
"\n"
"@return The result of the boolean XOR operation\n"
"\n"
"The boolean XOR operation will return all parts of the edges in this and the other collection except "
"the parts where both are coincident.\n"
"The result will be a merged edge collection.\n"
) +
method ("^=", &db::Edges::operator^=, gsi::arg ("other"),
"@brief Performs the boolean XOR between self and the other edge collection\n"
"\n"
"The 'xor' alias has been introduced in version 0.28.12."
) +
method ("^=|xor_with", &db::Edges::operator^=, gsi::arg ("other"),
"@brief Performs the boolean XOR between self and the other edge collection in-place (modifying self)\n"
"\n"
"@return The edge collection after modification (self)\n"
"\n"
"The boolean XOR operation will return all parts of the edges in this and the other collection except "
"the parts where both are coincident.\n"
"The result will be a merged edge collection.\n"
) +
method ("\\|", &db::Edges::operator|, gsi::arg ("other"),
"\n"
"Note that in Ruby, the '^=' operator actually does not exist, but is emulated by '^' followed by an assignment. "
"This is less efficient than the in-place operation, so it is recommended to use 'xor_with' instead.\n"
"\n"
"The 'xor_with' alias has been introduced in version 0.28.12."
) +
method ("\\||or", &db::Edges::operator|, gsi::arg ("other"),
"@brief Returns the boolean OR between self and the other edge set\n"
"\n"
"@return The resulting edge collection\n"
"\n"
"The boolean OR is implemented by merging the edges of both edge sets. To simply join the edge collections "
"without merging, the + operator is more efficient."
) +
method ("\\|=", &db::Edges::operator|=, gsi::arg ("other"),
"@brief Performs the boolean OR between self and the other edge set\n"
"\n"
"The 'or' alias has been introduced in version 0.28.12."
) +
method ("\\|=|or_with", &db::Edges::operator|=, gsi::arg ("other"),
"@brief Performs the boolean OR between self and the other edge set in-place (modifying self)\n"
"\n"
"@return The edge collection after modification (self)\n"
"\n"
"The boolean OR is implemented by merging the edges of both edge sets. To simply join the edge collections "
"without merging, the + operator is more efficient."
) +
method ("+", &db::Edges::operator+, gsi::arg ("other"),
"\n"
"Note that in Ruby, the '|=' operator actually does not exist, but is emulated by '|' followed by an assignment. "
"This is less efficient than the in-place operation, so it is recommended to use 'or_with' instead.\n"
"\n"
"The 'or_with' alias has been introduced in version 0.28.12."
) +
method ("+|join", &db::Edges::operator+, gsi::arg ("other"),
"@brief Returns the combined edge set of self and the other one\n"
"\n"
"@return The resulting edge set\n"
"\n"
"This operator adds the edges of the other edge set to self and returns a new combined edge set. "
"This usually creates unmerged edge sets and edges may overlap. Use \\merge if you want to ensure the result edge set is merged.\n"
) +
method ("+=", &db::Edges::operator+=, gsi::arg ("other"),
"\n"
"The 'join' alias has been introduced in version 0.28.12."
) +
method ("+=|join_with", &db::Edges::operator+=, gsi::arg ("other"),
"@brief Adds the edges of the other edge collection to self\n"
"\n"
"@return The edge set after modification (self)\n"
"\n"
"This operator adds the edges of the other edge set to self. "
"This usually creates unmerged edge sets and edges may overlap. Use \\merge if you want to ensure the result edge set is merged.\n"
) +
"\n"
"Note that in Ruby, the '+=' operator actually does not exist, but is emulated by '+' followed by an assignment. "
"This is less efficient than the in-place operation, so it is recommended to use 'join_with' instead.\n"
"\n"
"The 'join_with' alias has been introduced in version 0.28.12."
) +
method ("interacting", (db::Edges (db::Edges::*) (const db::Edges &) const) &db::Edges::selected_interacting, gsi::arg ("other"),
"@brief Returns the edges of this edge collection which overlap or touch edges from the other edge collection\n"
"\n"
Expand Down
21 changes: 19 additions & 2 deletions src/db/db/gsiDeclDbLayout.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,22 @@ static void dtransform_cplx (db::Layout *layout, const db::DCplxTrans &trans)
layout->transform (dbu_trans.inverted () * trans * dbu_trans);
}

static db::LayerProperties get_properties (const db::Layout *layout, unsigned int index)
{
if (layout->is_valid_layer (index)) {
return layout->get_properties (index);
} else {
return db::LayerProperties ();
}
}

static void set_properties (db::Layout *layout, unsigned int index, const db::LayerProperties &props)
{
if (layout->is_valid_layer (index)) {
layout->set_properties (index, props);
}
}

Class<db::Layout> decl_Layout ("db", "Layout",
gsi::constructor ("new", &layout_ctor_with_manager, gsi::arg ("manager"),
"@brief Creates a layout object attached to a manager\n"
Expand Down Expand Up @@ -1667,11 +1683,12 @@ Class<db::Layout> decl_Layout ("db", "Layout",
"\n"
"See \\insert_special_layer for a description of special layers."
) +
gsi::method ("set_info", &db::Layout::set_properties, gsi::arg ("index"), gsi::arg ("props"),
gsi::method_ext ("set_info", &set_properties, gsi::arg ("index"), gsi::arg ("props"),
"@brief Sets the info structure for a specified layer\n"
) +
gsi::method ("get_info", &db::Layout::get_properties, gsi::arg ("index"),
gsi::method_ext ("get_info", &get_properties, gsi::arg ("index"),
"@brief Gets the info structure for a specified layer\n"
"If the layer index is not a valid layer index, an empty LayerProperties object will be returned."
) +
gsi::method ("cells", &db::Layout::cells,
"@brief Returns the number of cells\n"
Expand Down
Loading

0 comments on commit be1be46

Please sign in to comment.