KLayout 0.29.8 (2024-10-28 63dd591e5) [master]

API reference - Class NetTracer

Notation used in Ruby API documentation

Module: db

Description: The net tracer feature

The net tracer class provides an interface to the net tracer feature. It is accompanied by the NetElement and NetTracerTechnology classes. The latter will provide the technology definition for the net tracer while the NetElement objects represent a piece of the net after it has been extracted.

The technology definition is optional. The net tracer can be used with a predefined technology as well. The basic scheme of using the net tracer is to instantiate a net tracer object and run the extraction through the NetTracer#trace method. After this method was executed successfully, the resulting net can be obtained from the net tracer object by iterating over the NetElement objects of the net tracer.

Here is some sample code:

ly = RBA::CellView::active.layout

tracer = RBA::NetTracer::new

tech = RBA::NetTracerConnectivity::new
tech.connection("1/0", "2/0", "3/0")

tracer.trace(tech, ly, ly.top_cell, RBA::Point::new(7000, 1500), ly.find_layer(1, 0))

tracer.each_element do |e|
  puts e.shape.polygon.transformed(e.trans)
end

This class has been introduced in version 0.25. With version 0.28, the NetTracerConnectivity class replaces the 'NetTracerTechnology' class.

Public constructors

new NetTracer ptrnewCreates a new object of this class

Public methods

[const]NetTracer ptr_const_castReturns a non-const reference to self.
void_createEnsures the C++ object is created
void_destroyExplicitly destroys the object
[const]bool_destroyed?Returns a value indicating whether the object was already destroyed
[const]bool_is_const_object?Returns a value indicating whether the reference is a const reference
void_manageMarks the object as managed by the script side.
void_unmanageMarks the object as no longer owned by the script side.
voidassign(const NetTracer other)Assigns another object to self
voidclearClears the data from the last extraction
[const]new NetTracer ptrdupCreates a copy of self
[const,iter]NetElementeach_elementIterates over the elements found during extraction
[const]boolincomplete?Returns a value indicating whether the net is incomplete
[const]stringnameReturns the name of the net found during extraction
[const]unsigned longnum_elementsReturns the number of elements found during extraction
voidtrace(const NetTracerConnectivity tech,
const Layout layout,
const Cell cell,
const Point start_point,
unsigned int start_layer)
Runs a net extraction
voidtrace(const NetTracerConnectivity tech,
const Layout layout,
const Cell cell,
const Point start_point,
unsigned int start_layer,
const Point stop_point,
unsigned int stop_layer)
Runs a path extraction
voidtrace(string tech,
const Layout layout,
const Cell cell,
const Point start_point,
unsigned int start_layer)
Runs a net extraction taking a predefined technology
voidtrace(string tech,
string connectivity_name,
const Layout layout,
const Cell cell,
const Point start_point,
unsigned int start_layer)
Runs a net extraction taking a predefined technology
voidtrace(string tech,
const Layout layout,
const Cell cell,
const Point start_point,
unsigned int start_layer,
const Point stop_point,
unsigned int stop_layer)
Runs a path extraction taking a predefined technology
voidtrace(string tech,
string connectivity_name,
const Layout layout,
const Cell cell,
const Point start_point,
unsigned int start_layer,
const Point stop_point,
unsigned int stop_layer)
Runs a path extraction taking a predefined technology
[const]unsigned longtrace_depthgets the trace depth
voidtrace_depth=(unsigned long n)Sets the trace depth (shape limit)

Deprecated methods (protected, public, static, non-static and constructors)

voidcreateUse of this method is deprecated. Use _create instead
voiddestroyUse of this method is deprecated. Use _destroy instead
[const]booldestroyed?Use of this method is deprecated. Use _destroyed? instead
[const]boolis_const_object?Use of this method is deprecated. Use _is_const_object? instead

Detailed description

_const_cast

Signature: [const] NetTracer ptr _const_cast

Description: Returns a non-const reference to self.

Basically, this method allows turning a const object reference to a non-const one. This method is provided as last resort to remove the constness from an object. Usually there is a good reason for a const object reference, so using this method may have undesired side effects.

This method has been introduced in version 0.29.6.

_create

Signature: void _create

Description: Ensures the C++ object is created

Use this method to ensure the C++ object is created, for example to ensure that resources are allocated. Usually C++ objects are created on demand and not necessarily when the script object is created.

_destroy

Signature: void _destroy

Description: Explicitly destroys the object

Explicitly destroys the object on C++ side if it was owned by the script interpreter. Subsequent access to this object will throw an exception. If the object is not owned by the script, this method will do nothing.

_destroyed?

Signature: [const] bool _destroyed?

Description: Returns a value indicating whether the object was already destroyed

This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself.

_is_const_object?

Signature: [const] bool _is_const_object?

Description: Returns a value indicating whether the reference is a const reference

This method returns true, if self is a const reference. In that case, only const methods may be called on self.

_manage

Signature: void _manage

Description: Marks the object as managed by the script side.

After calling this method on an object, the script side will be responsible for the management of the object. This method may be called if an object is returned from a C++ function and the object is known not to be owned by any C++ instance. If necessary, the script side may delete the object if the script's reference is no longer required.

Usually it's not required to call this method. It has been introduced in version 0.24.

_unmanage

Signature: void _unmanage

Description: Marks the object as no longer owned by the script side.

Calling this method will make this object no longer owned by the script's memory management. Instead, the object must be managed in some other way. Usually this method may be called if it is known that some C++ object holds and manages this object. Technically speaking, this method will turn the script's reference into a weak reference. After the script engine decides to delete the reference, the object itself will still exist. If the object is not managed otherwise, memory leaks will occur.

Usually it's not required to call this method. It has been introduced in version 0.24.

assign

Signature: void assign (const NetTracer other)

Description: Assigns another object to self

clear

Signature: void clear

Description: Clears the data from the last extraction

create

Signature: void create

Description: Ensures the C++ object is created

Use of this method is deprecated. Use _create instead

Use this method to ensure the C++ object is created, for example to ensure that resources are allocated. Usually C++ objects are created on demand and not necessarily when the script object is created.

destroy

Signature: void destroy

Description: Explicitly destroys the object

Use of this method is deprecated. Use _destroy instead

Explicitly destroys the object on C++ side if it was owned by the script interpreter. Subsequent access to this object will throw an exception. If the object is not owned by the script, this method will do nothing.

destroyed?

Signature: [const] bool destroyed?

Description: Returns a value indicating whether the object was already destroyed

Use of this method is deprecated. Use _destroyed? instead

This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself.

dup

Signature: [const] new NetTracer ptr dup

Description: Creates a copy of self

Python specific notes:
This method also implements '__copy__' and '__deepcopy__'.

each_element

Signature: [const,iter] NetElement each_element

Description: Iterates over the elements found during extraction

The elements are available only after the extraction has been performed.

incomplete?

Signature: [const] bool incomplete?

Description: Returns a value indicating whether the net is incomplete

A net may be incomplete if the extraction has been stopped by the user for example. This attribute is useful only after the extraction has been performed.

is_const_object?

Signature: [const] bool is_const_object?

Description: Returns a value indicating whether the reference is a const reference

Use of this method is deprecated. Use _is_const_object? instead

This method returns true, if self is a const reference. In that case, only const methods may be called on self.

name

Signature: [const] string name

Description: Returns the name of the net found during extraction

The net name is extracted from labels found during the extraction. This attribute is useful only after the extraction has been performed.

new

Signature: [static] new NetTracer ptr new

Description: Creates a new object of this class

Python specific notes:
This method is the default initializer of the object.

num_elements

Signature: [const] unsigned long num_elements

Description: Returns the number of elements found during extraction

This attribute is useful only after the extraction has been performed.

trace

(1) Signature: void trace (const NetTracerConnectivity tech, const Layout layout, const Cell cell, const Point start_point, unsigned int start_layer)

Description: Runs a net extraction

tech:The connectivity definition
layout:The layout on which to run the extraction
cell:The cell on which to run the extraction (child cells will be included)
start_point:The start point from which to start extraction of the net
start_layer:The layer from which to start extraction

This method runs an extraction with the given parameters. To make the extraction successful, a shape must be present at the given start point on the start layer. The start layer must be a valid layer mentioned within the technology specification.

This version runs a single extraction - i.e. it will extract all elements connected to the given seed point. A path extraction version is provided as well which will extract one (the presumably shortest) path between two points.

(2) Signature: void trace (const NetTracerConnectivity tech, const Layout layout, const Cell cell, const Point start_point, unsigned int start_layer, const Point stop_point, unsigned int stop_layer)

Description: Runs a path extraction

tech:The connectivity definition
layout:The layout on which to run the extraction
cell:The cell on which to run the extraction (child cells will be included)
start_point:The start point from which to start extraction of the net
start_layer:The layer from which to start extraction
stop_point:The stop point at which to stop extraction of the net
stop_layer:The layer at which to stop extraction

This method runs an path extraction with the given parameters. To make the extraction successful, a shape must be present at the given start point on the start layer and at the given stop point at the given stop layer. The start and stop layers must be a valid layers mentioned within the technology specification.

This version runs a path extraction and will deliver elements forming one path leading from the start to the end point.

(3) Signature: void trace (string tech, const Layout layout, const Cell cell, const Point start_point, unsigned int start_layer)

Description: Runs a net extraction taking a predefined technology

This method behaves identical as the version with a technology object, except that it will look for a technology with the given name to obtain the extraction setup. The technology is looked up by technology name. A version of this method exists where it is possible to specify the name of the particular connectivity to use in case there are multiple definitions available.

(4) Signature: void trace (string tech, string connectivity_name, const Layout layout, const Cell cell, const Point start_point, unsigned int start_layer)

Description: Runs a net extraction taking a predefined technology

This method behaves identical as the version with a technology object, except that it will look for a technology with the given name to obtain the extraction setup. This version allows specifying the name of the connecvitiy setup.

This method variant has been introduced in version 0.28.

(5) Signature: void trace (string tech, const Layout layout, const Cell cell, const Point start_point, unsigned int start_layer, const Point stop_point, unsigned int stop_layer)

Description: Runs a path extraction taking a predefined technology

This method behaves identical as the version with a technology object, except that it will look for a technology with the given name to obtain the extraction setup.

(6) Signature: void trace (string tech, string connectivity_name, const Layout layout, const Cell cell, const Point start_point, unsigned int start_layer, const Point stop_point, unsigned int stop_layer)

Description: Runs a path extraction taking a predefined technology

This method behaves identical as the version with a technology object, except that it will look for a technology with the given name to obtain the extraction setup.This version allows specifying the name of the connecvitiy setup.

This method variant has been introduced in version 0.28.

trace_depth

Signature: [const] unsigned long trace_depth

Description: gets the trace depth

See trace_depth= for a description of this property.

This method has been introduced in version 0.26.4.

Python specific notes:
The object exposes a readable attribute 'trace_depth'. This is the getter.

trace_depth=

Signature: void trace_depth= (unsigned long n)

Description: Sets the trace depth (shape limit)

Set this value to limit the maximum number of shapes delivered. Upon reaching this count, the tracer will stop and report the net as 'incomplete' (see incomplete?). Setting a trace depth if 0 is equivalent to 'unlimited'. The actual number of shapes delivered may be a little less than the depth because of internal marker shapes which are taken into account, but are not delivered.

This method has been introduced in version 0.26.4.

Python specific notes:
The object exposes a writable attribute 'trace_depth'. This is the setter.