Skip to content

Commit c7ffcdb

Browse files
sbryngelsonclaude
andcommitted
Fix s_write_intf_data_file using wrong loop index for distance check
euc_d was computed outside the inner loop using the outer variable i (stale from a previous loop) instead of the current stored-point index. Moved distance computation inside the do-loop over stored points and changed cycle to exit for correct early termination when a candidate point is too close to any existing point. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3781b98 commit c7ffcdb

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/post_process/m_data_output.fpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,19 +1546,16 @@ contains
15461546
counter = counter + 1
15471547
x_d1(counter) = x_cc(j)
15481548
y_d1(counter) = y_cc(k)
1549-
euc_d = sqrt((x_cc(j) - x_d1(i))**2 + (y_cc(k) - y_d1(i))**2)
1550-
tgp = sqrt(dx(j)**2 + dy(k)**2)
15511549
else
1552-
euc_d = sqrt((x_cc(j) - x_d1(i))**2 + (y_cc(k) - y_d1(i))**2)
15531550
tgp = sqrt(dx(j)**2 + dy(k)**2)
15541551
do i = 1, counter
1552+
euc_d = sqrt((x_cc(j) - x_d1(i))**2 + (y_cc(k) - y_d1(i))**2)
15551553
if (euc_d < tgp) then
1556-
cycle
1557-
elseif (euc_d > tgp .and. i == counter) then
1554+
exit
1555+
elseif (i == counter) then
15581556
counter = counter + 1
15591557
x_d1(counter) = x_cc(j)
15601558
y_d1(counter) = y_cc(k)
1561-
15621559
end if
15631560
end do
15641561
end if

0 commit comments

Comments
 (0)