Skip to content

Commit

Permalink
Merge pull request #1541 from ExtremeFLOW/martin/fix/aabb_sort
Browse files Browse the repository at this point in the history
Add option to create aabb tree directly from aabb and fix sorting bug
  • Loading branch information
timfelle authored Nov 11, 2024
2 parents e33f49e + 22ef147 commit bbf0a12
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/mesh/aabb_tree.f90
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,9 @@ function sort(array) result(indices)
minidx = -1
do imin = 1, size(array)
if (.not. visited(imin) .and. minidx .eq. -1) minidx = imin

if (visited(imin) .and. array(imin) .lt. array(minidx)) minidx = imin
if (minidx .gt. -1) then
if (visited(imin) .and. array(imin) .lt. array(minidx)) minidx = imin
end if
end do

indices(i) = minidx
Expand Down Expand Up @@ -641,6 +642,7 @@ subroutine aabb_tree_query_overlaps(this, object, object_index, overlaps)
end if
end if
end do
call simple_stack%free()
end subroutine aabb_tree_query_overlaps

! -------------------------------------------------------------------------- !
Expand Down
2 changes: 2 additions & 0 deletions src/mesh/search_tree/aabb.f90
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ function get_aabb(object, padding) result(box)

select type(object)

type is (aabb_t)
call box%init(object%get_min(), object%get_max())
type is (tri_t)
box = get_aabb_element(object)
type is (hex_t)
Expand Down

0 comments on commit bbf0a12

Please sign in to comment.