Skip to content

Commit 62e86be

Browse files
committed
Avoid -1 in the neighbours
1 parent be5688c commit 62e86be

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

simpeg_drivers/components/topography.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,16 @@ def expand_actives(
164164
neighbours = get_neighbouring_cells(mesh.mesh, containing_cells)
165165
neighbours_xy = np.r_[neighbours[0] + neighbours[1]]
166166

167+
neighbours_xy = neighbours_xy[neighbours_xy != -1]
167168
# Make sure the new actives are connected to the old actives
168169
new_actives = ~active_cells[neighbours_xy]
169170
if np.any(new_actives):
170171
neighbours = get_neighbouring_cells(
171172
mesh.mesh, neighbours_xy[new_actives]
172173
)
173-
active_cells[np.r_[neighbours[2][0]]] = True # z-axis neighbours
174+
neighbours_z = np.r_[neighbours[2][0]]
175+
neighbours_z = neighbours_z[neighbours_z != -1]
176+
active_cells[neighbours_z] = True # z-axis neighbours
174177

175178
active_cells[neighbours_xy] = True # xy-axis neighbours
176179

0 commit comments

Comments
 (0)