Skip to content

Commit

Permalink
update treemesh balancing option in more places.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcapriot committed Dec 17, 2024
1 parent fee12b5 commit ee43487
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion discretize/mixins/mpl_mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -2149,7 +2149,7 @@ def __plot_slice_tree(
normal[normalInd] = 1

# create a temporary TreeMesh with the slice through
temp_mesh = discretize.TreeMesh(h2d, x2d)
temp_mesh = discretize.TreeMesh(h2d, x2d, diagonal_balance=False)
level_diff = self.max_level - temp_mesh.max_level

# get list of cells which intersect the slicing plane
Expand Down
2 changes: 1 addition & 1 deletion discretize/tree_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ def equals(self, other): # NOQA D102

def __reduce__(self):
"""Return the necessary items to reconstruct this object's state."""
return TreeMesh, (self.h, self.origin), self.__getstate__()
return TreeMesh, (self.h, self.origin, False), self.__getstate__()

cellGrad = deprecate_property(
"cell_gradient", "cellGrad", removal_version="1.0.0", error=True
Expand Down
6 changes: 5 additions & 1 deletion discretize/utils/mesh_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ def mesh_builder_xyz(
depth_core=None,
expansion_factor=1.3,
mesh_type="tensor",
tree_diagonal_balance=None,
):
"""Generate a tensor or tree mesh using a cloud of points.
Expand Down Expand Up @@ -428,6 +429,9 @@ def mesh_builder_xyz(
Expansion factor for padding cells. Ignored if *mesh_type* = *tree*
mesh_type : {'tensor', 'tree'}
Specify output mesh type
tree_diagonal_balance : bool, optional
Whether to diagonally balance the tree mesh, `None` will use the `TreeMesh`
default behavoir.
Returns
-------
Expand Down Expand Up @@ -521,7 +525,7 @@ def expand(dx, pad):
h_dim += [np.ones(2**maxLevel) * h[ii]]

# Define the mesh and origin
mesh = discretize.TreeMesh(h_dim)
mesh = discretize.TreeMesh(h_dim, diagonal_balance=tree_diagonal_balance)

for ii, _cc in enumerate(nC):
core = limits[ii][0] - limits[ii][1]
Expand Down

0 comments on commit ee43487

Please sign in to comment.