Axis-aligned bounding box of each element. The box is taken over the element's boundary nodes (geometry%x%boundary), which are evaluated at the element edges (reference coordinate = +/-1) and therefore reach the true element boundary and corners. Using the interior nodes alone is not sufficient: for Gauss quadrature the interior nodes are strictly inside [-1,1], so a box built from them under-covers the element by a fixed fraction of its size and rejects points lying on element edges/corners. The boundary nodes give the correct extent for both Gauss and Gauss-Lobatto node sets.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(SEMQuad), | intent(in) | :: | geometry | |||
| integer, | intent(in) | :: | N | |||
| integer, | intent(in) | :: | nElem | |||
| real(kind=prec), | intent(out) | :: | bbMin(1:2,1:nElem) | |||
| real(kind=prec), | intent(out) | :: | bbMax(1:2,1:nElem) |
subroutine BuildElementBBoxes_2D(geometry,N,nElem,bbMin,bbMax)
!! Axis-aligned bounding box of each element. The box is taken over the
!! element's boundary nodes (geometry%x%boundary), which are evaluated at
!! the element edges (reference coordinate = +/-1) and therefore reach the
!! true element boundary and corners. Using the interior nodes alone is not
!! sufficient: for Gauss quadrature the interior nodes are strictly inside
!! [-1,1], so a box built from them under-covers the element by a fixed
!! fraction of its size and rejects points lying on element edges/corners.
!! The boundary nodes give the correct extent for both Gauss and
!! Gauss-Lobatto node sets.
implicit none
type(SEMQuad),intent(in) :: geometry
integer,intent(in) :: N,nElem
real(prec),intent(out) :: bbMin(1:2,1:nElem),bbMax(1:2,1:nElem)
! Local
integer :: iEl,i,iSide
real(prec) :: xv,yv
do iEl = 1,nElem
bbMin(1,iEl) = huge(1.0_prec)
bbMin(2,iEl) = huge(1.0_prec)
bbMax(1,iEl) = -huge(1.0_prec)
bbMax(2,iEl) = -huge(1.0_prec)
do iSide = 1,4
do i = 1,N+1
xv = geometry%x%boundary(i,iSide,iEl,1,1)
yv = geometry%x%boundary(i,iSide,iEl,1,2)
if(xv < bbMin(1,iEl)) bbMin(1,iEl) = xv
if(yv < bbMin(2,iEl)) bbMin(2,iEl) = yv
if(xv > bbMax(1,iEl)) bbMax(1,iEl) = xv
if(yv > bbMax(2,iEl)) bbMax(2,iEl) = yv
enddo
enddo
enddo
endsubroutine BuildElementBBoxes_2D