magnet.generate.structured_quads#

magnet.generate.structured_quads(output_path: str, bounds: tuple[int, int] = (5, 60))#

Generate a structured mesh of rectangles.

Generates a structured mesh of the unit square made of identical rectangles. The number of rectangles is selected randomly.

Parameters:
  • output_path (str) – File path where the mesh will be saved.

  • bounds (tuple[float, float], optional) – Bounds of the uniform distribution from which the numbers of elements per edge are sampled (default is (5, 60)).

Returns:

  • adjacency (sparse.csr_matrix of np.uint8) – Adjacency matrix describing the mesh.

  • centroids (np.ndarray of float) – Centroid coordinates of each cell of the mesh.

  • areas (np.ndarray of float) – Areas of the cells.