Skip to content

Commit ab89856

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 1782b1a commit ab89856

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

src/post_process/m_data_output.fpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1542,19 +1542,16 @@ contains
15421542
counter = counter + 1
15431543
x_d1(counter) = x_cc(j)
15441544
y_d1(counter) = y_cc(k)
1545-
euc_d = sqrt((x_cc(j) - x_d1(i))**2 + (y_cc(k) - y_d1(i))**2)
1546-
tgp = sqrt(dx(j)**2 + dy(k)**2)
15471545
else
1548-
euc_d = sqrt((x_cc(j) - x_d1(i))**2 + (y_cc(k) - y_d1(i))**2)
15491546
tgp = sqrt(dx(j)**2 + dy(k)**2)
15501547
do i = 1, counter
1548+
euc_d = sqrt((x_cc(j) - x_d1(i))**2 + (y_cc(k) - y_d1(i))**2)
15511549
if (euc_d < tgp) then
1552-
cycle
1553-
elseif (euc_d > tgp .and. i == counter) then
1550+
exit
1551+
elseif (i == counter) then
15541552
counter = counter + 1
15551553
x_d1(counter) = x_cc(j)
15561554
y_d1(counter) = y_cc(k)
1557-
15581555
end if
15591556
end do
15601557
end if

0 commit comments

Comments
 (0)