Obstructions

Gate and cell layouts expose persistent obstruction methods directly. Occupied tiles or cells remain obstructed regardless of manual assignments, and a gate layout also treats its existing signal connections as obstructed. A*, path enumeration, and Yen’s algorithm therefore route around the gates and wires placed on any gate layout. Connections are directed: blocking a to b does not block b to a.

Use standalone obstructions data for temporary search constraints. A*, path enumeration, and Yen’s algorithm combine this data with the layout’s obstructions without changing either input. The same data works with bare coordinate grids. Search data contains no layout or occupancy. foreach_obstructed_coordinate and foreach_obstructed_connection enumerate manual assignments. Python exposes these assignments through obstructed_coordinates() and obstructed_connections().

Header: fiction/layouts/obstructions.hpp

using grid = fiction::layouts::cartesian_layout;
grid lyt{{4, 4}};
fiction::layouts::obstructions blocked;
blocked.obstruct_coordinate({1, 1});
using path = fiction::physical_design::layout_coordinate_path;
auto paths = fiction::physical_design::path_finding::yen_k_shortest_paths<path>(
    lyt, {{0, 0}, {3, 3}}, 3, {}, blocked);
class obstructions

Layout-independent coordinate and directed-connection constraints for routing searches.

Gate layouts expose persistent obstruction methods directly. Routing algorithms accept this separate object for temporary constraints and combine it with the layout’s persistent obstructions and occupancy. Copies are independent. This object contains no layout or occupancy information.

Public Functions

inline void obstruct_coordinate(const layout_base::coordinate &c)

Marks the given coordinate as obstructed.

Parameters:

c – Coordinate to obstruct.

Throws:

std::bad_alloc – If allocation fails.

inline void obstruct_connection(const layout_base::coordinate &src, const layout_base::coordinate &tgt)

Marks the connection from coordinate src to coordinate tgt as obstructed.

Note

Coordinates marked this way will not be crossed with wires by path finding algorithms.

Parameters:
  • src – Source coordinate.

  • tgt – Target coordinate.

Throws:

std::bad_alloc – If allocation fails.

inline void clear_obstructed_coordinate(const layout_base::coordinate &c) noexcept

Clears the obstruction status of the given coordinate c if the obstruction was manually marked via obstruct_coordinate.

Parameters:

c – Coordinate to clear.

inline void clear_obstructed_connection(const layout_base::coordinate &src, const layout_base::coordinate &tgt) noexcept

Clears the obstruction status of the connection from coordinate src to coordinate tgt if the obstruction was manually marked via obstruct_connection.

Parameters:
  • src – Source coordinate.

  • tgt – Target coordinate.

inline void clear_obstructed_coordinates() noexcept

Clears all obstructed coordinates that were manually marked via obstruct_coordinate.

inline void clear_obstructed_connections() noexcept

Clears all obstructed connections that were manually marked via obstruct_connection.

inline bool is_obstructed_coordinate(const layout_base::coordinate &c) const noexcept

Checks if the given coordinate is obstructed of some sort.

Parameters:

c – Coordinate to check.

Returns:

true iff c is obstructed.

inline bool is_obstructed_connection(const layout_base::coordinate &src, const layout_base::coordinate &tgt) const noexcept

Checks if the given coordinate-coordinate connection is obstructed of some sort.

Parameters:
  • src – Source coordinate.

  • tgt – Target coordinate.

Returns:

true iff the connection from src to tgt is obstructed.

template<typename Fn>
inline void foreach_obstructed_coordinate(Fn &&fn) const

Visits explicitly obstructed coordinates in unspecified order.

Template Parameters:

Fn – Callable accepting one coordinate.

Parameters:

fn – Callback for each manual obstruction.

template<typename Fn>
inline void foreach_obstructed_connection(Fn &&fn) const

Visits explicitly obstructed directed connections in unspecified order.

Template Parameters:

Fn – Callable accepting source and target coordinates.

Parameters:

fn – Callback for each manual obstruction.

from mnt.pyfiction.layouts import cartesian_layout, obstructions
from mnt.pyfiction.physical_design.path_finding import yen_k_shortest_paths

lyt = cartesian_layout((4, 4))
blocked = obstructions()
blocked.obstruct_coordinate((1, 1))
paths = yen_k_shortest_paths(lyt, (0, 0), (3, 3), 3, obstructions=blocked)
class obstructions

Layout-independent coordinate and directed-connection constraints for routing searches.

Gate layouts expose persistent obstruction methods directly. Routing algorithms accept this separate object for temporary constraints and combine it with the layout’s persistent obstructions and occupancy. Copies are independent. This object contains no layout or occupancy information.

clear_obstructed_connection(src: coordinate | tuple[int, int] | tuple[int, int, int], tgt: coordinate | tuple[int, int] | tuple[int, int, int]) → None

Clears the obstruction status of the connection from coordinate src to coordinate tgt if the obstruction was manually marked via obstruct_connection.

Parameters:
  • src – Source coordinate.

  • tgt – Target coordinate.

clear_obstructed_connections() → None

Clears all obstructed connections that were manually marked via obstruct_connection.

clear_obstructed_coordinate(c: coordinate | tuple[int, int] | tuple[int, int, int]) → None

Clears the obstruction status of the given coordinate c if the obstruction was manually marked via obstruct_coordinate.

Parameters:

c – Coordinate to clear.

clear_obstructed_coordinates() → None

Clears all obstructed coordinates that were manually marked via obstruct_coordinate.

is_obstructed_connection(src: coordinate | tuple[int, int] | tuple[int, int, int], tgt: coordinate | tuple[int, int] | tuple[int, int, int]) → bool

Checks if the given coordinate-coordinate connection is obstructed of some sort.

Parameters:
  • src – Source coordinate.

  • tgt – Target coordinate.

Returns:

true iff the connection from src to tgt is obstructed.

is_obstructed_coordinate(c: coordinate | tuple[int, int] | tuple[int, int, int]) → bool

Checks if the given coordinate is obstructed of some sort.

Parameters:

c – Coordinate to check.

Returns:

true iff c is obstructed.

obstruct_connection(src: coordinate | tuple[int, int] | tuple[int, int, int], tgt: coordinate | tuple[int, int] | tuple[int, int, int]) → None

Marks the connection from coordinate src to coordinate tgt as obstructed.

Parameters:
  • src – Source coordinate.

  • tgt – Target coordinate.

Raises:

MemoryError – If allocation fails.

Note

Coordinates marked this way will not be crossed with wires by path finding algorithms.

obstruct_coordinate(c: coordinate | tuple[int, int] | tuple[int, int, int]) → None

Marks the given coordinate as obstructed.

Parameters:

c – Coordinate to obstruct.

Raises:

MemoryError – If allocation fails.

obstructed_connections() → list[tuple[coordinate, coordinate]]

Returns explicit directed-connection obstructions in unspecified order.

obstructed_coordinates() → list[coordinate]

Returns explicit coordinate obstructions in unspecified order.