magnet.generate.generate_cube_portion#
- magnet.generate.generate_cube_portion(output_path: str, bounds: tuple[float, float] = (0.03, 0.08))#
Generate a mesh of a portion of the unit cube.
Generates a tetrahedral mesh of a randomly selected portion of the unit cube. The size of the elements is also 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.03, 0.08)).
- 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.
Notes
The random portion of the unit cube is generated by randomly taking a vertex in each of the 8 sectors of the cube. Beacuase of this, sometimes the geometry is self intersecting and so we start over.