Returns the coordinates of the cell that contains the position p, inclusive of ghost cells.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(block_obj), | intent(in) | :: | this |
A block object |
||
| real(kind=wp), | intent(in) | :: | p(3) |
Position to locate |
Cell coordinates
pure function block_obj_GetOwningCellWGC(this,p) result (cell) !> Returns the coordinates of the cell that contains ! the position p, inclusive of ghost cells. implicit none class(block_obj), intent(in) :: this !! A block object real(wp), intent(in) :: p(3) !! Position to locate integer :: cell(3) !! Cell coordinates ! Work variables integer :: c_hi(3),c_lo(3) integer :: dir c_lo = this%lo - this%ngc c_hi = this%hi+1 + this%ngc do dir =1,3 ! Sandwich xp between x(c) and x(c+1) do while (c_hi(dir)-c_lo(dir).ge.2) ! Compute a mid-point cell(dir)= (c_hi(dir)+c_lo(dir))/2 if (p(dir).ge.this%axis(dir)%x(cell(dir))) then c_lo(dir)=cell(dir) else c_hi(dir)=cell(dir) end if end do ! xm(c) lies between x(c) and x(c+1) cell(dir)= c_lo(dir) end do return end function block_obj_GetOwningCellWGC