Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions simpeg_drivers/utils/nested.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,13 @@ def create_simulation(
# For DCIP-2D, create a projection from the global active cells to
# the local active cells
else:
# Map the line_ids to the mesh parts (assumes sequential numbering)
line_number = np.unique(local_survey.line_ids)
active_mesh_part = np.isin(simulation.mesh.parts, line_number)
# Map the line_ids to the mesh parts
in_cell = np.searchsorted(
simulation.mesh.cell_centers_x, local_survey.locations_a[:, 0]
)
unique_parts = np.unique(simulation.mesh.parts[in_cell])
active_mesh_part = np.isin(simulation.mesh.parts, unique_parts)
Comment thread
domfournier marked this conversation as resolved.
Outdated

n_actives = simulation.active_cells.sum()
activate_ind = np.zeros(simulation.mesh.n_cells, dtype=int)
activate_ind[np.where(simulation.active_cells)[0]] = np.arange(n_actives)
Expand Down
11 changes: 10 additions & 1 deletion simpeg_drivers/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,17 @@ def get_drape_model(
distances = compute_alongline_distance(xyz_smooth)
x_interp = interp1d(distances[:, 0], xyz_smooth[:, 0], fill_value="extrapolate")
y_interp = interp1d(distances[:, 0], xyz_smooth[:, 1], fill_value="extrapolate")

# Round the values for mesh creation to avoid issue with floor (int) rounding
limits = np.vstack(
[
np.floor(distances.min(axis=0)),
np.ceil(distances.max(axis=0)),
]
)

mesh = mesh_utils.mesh_builder_xyz(
distances,
limits,
h,
padding_distance=[
[pads[0], pads[1]],
Expand Down
Loading