magnet.generate.structured_tria#

magnet.generate.structured_tria(output_path: str, bounds: tuple[int, int] = (4, 25))#

Generate a structured mesh of triangles.

Generates a structured mesh of the unit square made of identical triangles. The number of triangles 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 number of triangles per edge is sampled (default is (4, 25)).

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.