discretize.TreeMesh.refine_image#
- TreeMesh.refine_image(self, image, finalize=True, diagonal_balance=None)#
Refine using an ND image, ensuring that each cell contains exactly one unique value.
This function takes an N-dimensional image, defined on the underlying fine tensor mesh, and recursively subdivides each cell if that cell contains more than 1 unique value in the image. This is useful when using the TreeMesh to represent an exact compressed form of an input model.
- Parameters:
- image(
shape_cells)numpy.ndarray Must have the same shape as the base tensor mesh (TreeMesh.shape_cells), as if every cell on this mesh was refined to it’s maximum level.
- finalizebool,
optional Whether to finalize after inserting point(s)
- diagonal_balancebool or
None,optional Whether to balance cells diagonally in the refinement, None implies using the same setting used to instantiate the TreeMesh.
- image(