magnet.generate.generate_cube#

magnet.generate.generate_cube(output_path: str, bounds: tuple[float, float] = (0.05, 0.2))#

Generate a mesh of the unit cube.

Generates a tetrahedral mesh of the unit cube. The size of the elements 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 mesh size parameter is sampled. The smaller this parameter, the smaller the elements of the mesh will be (default is (0.05, 0.20)).

Returns:

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

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

  • Volumes (np.ndarray of float) – Volumes of the cells.