# discretize.TreeMesh.refine_points#

Refine the mesh at given points to the prescribed level.

This function refines the tree mesh around the points. It will refine the tree mesh for each level given. It also optionally radially pads around each point at each level with the number of padding cells given.

Parameters:
points(`N`, `dim`) array_like

The points to be refined around.

level`int`, `optional`

The level of the tree mesh to refine to. Negative values index tree levels backwards, (e.g. -1 is max_level).

padding_cells_by_level`None`, `int`, (`n_level`) array_like, `optional`

The number of cells to pad the bounding box at each level of refinement. If a single number, each level below `level` will be padded with those number of cells. If array_like, n_level`s below ``level` will be padded. None implies no padding.

finalizebool, `optional`

Whether to finalize the mesh after the call.

diagonal_balance`None` or bool, `optional`

Whether to balance cells diagonally in the refinement, None implies using the same setting used to instantiate the TreeMesh`.

Examples

Given a set of points, we want to refine the tree mesh around these points to a prescribed level with a certain amount of padding.

```>>> import discretize
>>> import matplotlib.pyplot as plt
>>> import matplotlib.patches as patches
>>> mesh = discretize.TreeMesh([32, 32])
```

Now we want to refine to the maximum level with 1 cell padding around the point, and then refine at the second highest level with at least 3 cells beyond that.

```>>> points = np.array([[0.1, 0.3], [0.6, 0.8]])
```
```>>> ax = mesh.plot_grid()
>>> ax.scatter(*points.T, color='C1')
>>> plt.show()
```