Skip to content

Commit 925cd7d

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 1136e3d commit 925cd7d

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
@@ -1548,19 +1548,16 @@ contains
15481548
counter = counter + 1
15491549
x_d1(counter) = x_cc(j)
15501550
y_d1(counter) = y_cc(k)
1551-
euc_d = sqrt((x_cc(j) - x_d1(i))**2 + (y_cc(k) - y_d1(i))**2)
1552-
tgp = sqrt(dx(j)**2 + dy(k)**2)
15531551
else
1554-
euc_d = sqrt((x_cc(j) - x_d1(i))**2 + (y_cc(k) - y_d1(i))**2)
15551552
tgp = sqrt(dx(j)**2 + dy(k)**2)
15561553
do i = 1, counter
1554+
euc_d = sqrt((x_cc(j) - x_d1(i))**2 + (y_cc(k) - y_d1(i))**2)
15571555
if (euc_d < tgp) then
1558-
cycle
1559-
elseif (euc_d > tgp .and. i == counter) then
1556+
exit
1557+
elseif (i == counter) then
15601558
counter = counter + 1
15611559
x_d1(counter) = x_cc(j)
15621560
y_d1(counter) = y_cc(k)
1563-
15641561
end if
15651562
end do
15661563
end if

0 commit comments

Comments
 (0)