discretize.TreeMesh.insert_cells#

TreeMesh.insert_cells(self, points, levels, finalize=True, diagonal_balance=None)#

Insert cells into the TreeMesh that contain given points.

Insert cell(s) into the TreeMesh that contain the given point(s) at the assigned level(s).

Parameters:
points(N, dim) array_like

Array with coordinates of points on which cells will be inserted.

levelsint or (N) array_like of int

Integer indicating the refinement level for every point in points, or array of integers specifying the refinement level for each one of the points.

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`.

Examples

>>> from discretize import TreeMesh
>>> mesh = TreeMesh([32,32])
>>> mesh.insert_cells([0.5, 0.5], mesh.max_level)
>>> mesh
QuadTreeMesh: 3.91%% filled
Level : Number of cells               Mesh Extent               Cell Widths
-----------------------           min     ,     max            min   ,   max
  2   :       12             ---------------------------   --------------------
  3   :       13          x:      0.0     ,     1.0         0.03125  ,    0.25
  4   :       11          y:      0.0     ,     1.0         0.03125  ,    0.25
  5   :        4
-----------------------
Total :       40