get_voxel Function

private function get_voxel(this, pos) result(res)

get current voxel the photon packet is in

Type Bound

cart_grid

Arguments

Type IntentOptional Attributes Name
class(cart_grid) :: this

grid class

type(vector), intent(in) :: pos

current vector position of photon packet

Return Value integer, (3)


Source Code

    function get_voxel(this, pos) result(res)
        !! get current voxel the photon packet is in
        use vector_class
        
        !> grid class
        class(cart_grid)         :: this
        !> current vector position of photon packet
        type(vector), intent(IN) :: pos
    
        integer :: res(3)

        res(1) = int(this%nxg*(pos%x+this%xmax)/(2._wp*this%xmax))+1
        res(2) = int(this%nyg*(pos%y+this%ymax)/(2._wp*this%ymax))+1
        res(3) = int(this%nzg*(pos%z+this%zmax)/(2._wp*this%zmax))+1

    end function get_voxel