Skip to content
Merged
Changes from all 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
11 changes: 7 additions & 4 deletions src/gen_topo.f90
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,6 @@ subroutine make_topo_gen(topo_in, x_in, y_in, topo_out, x_out, y_out, topo_all_o
tree => kdtree2_create(possie, sort =.false., rearrange =.true.)

num_max = 20000000
allocate(t_s(num_max), t_s_all(num_max))

allocate(results(num_max))
do j = 1, jm
Expand Down Expand Up @@ -610,14 +609,16 @@ subroutine make_topo_gen(topo_in, x_in, y_in, topo_out, x_out, y_out, topo_all_o
cycle
end if

num_found = min(num_found, num_max)

allocate(t_s(num_found), t_s_all(num_found), source=0.0)

wet_in_poly = 0
in_poly = 0
t_s = 0
t_s_all = 0

bndsx = [x_out(i, j), x_out(i+1, j), x_out(i+1, j+1), x_out(i, j+1)]
bndsy = [y_out(i, j), y_out(i+1, j), y_out(i+1, j+1), y_out(i, j+1)]
do n = 1, min(num_found, num_max)
do n = 1, num_found
ib = idx(results(n)%idx)
jb = jdx(results(n)%idx)
!if (topo_in(ib, jb) > 0.0) cycle
Expand Down Expand Up @@ -645,6 +646,8 @@ subroutine make_topo_gen(topo_in, x_in, y_in, topo_out, x_out, y_out, topo_all_o
call quicksort(t_s, frst, lst)
topo_med_out(i, j) = t_s(max(wet_in_poly/2, 1))
end if

deallocate(t_s, t_s_all)
end do
end do

Expand Down