in_boundary Function

public function in_boundary(bplane, p) result(in_b)

Indicator function for determining if a point on a plane is within the plane boundary

Arguments

Type IntentOptional AttributesName
type(BoundedPlane), intent(in) :: bplane

Plane with boundary

real(kind=Float64), intent(in), dimension(3):: p

Point on plane

Return Value logical


Called by

proc~~in_boundary~~CalledByGraph proc~in_boundary in_boundary proc~hit_npa_detector hit_npa_detector proc~hit_npa_detector->proc~in_boundary proc~gyro_range gyro_range proc~gyro_range->proc~in_boundary proc~pnpa_f pnpa_f proc~pnpa_f->proc~hit_npa_detector proc~npa_gyro_range npa_gyro_range proc~pnpa_f->proc~npa_gyro_range proc~npa_gyro_range->proc~gyro_range proc~pnpa_mc pnpa_mc proc~pnpa_mc->proc~hit_npa_detector proc~pnpa_mc->proc~npa_gyro_range proc~make_diagnostic_grids make_diagnostic_grids proc~make_diagnostic_grids->proc~hit_npa_detector proc~npa_f npa_f proc~npa_f->proc~hit_npa_detector proc~npa_f->proc~npa_gyro_range proc~npa_mc npa_mc proc~npa_mc->proc~hit_npa_detector proc~npa_mc->proc~npa_gyro_range proc~npa_weights npa_weights proc~npa_weights->proc~hit_npa_detector program~fidasim fidasim program~fidasim->proc~pnpa_f program~fidasim->proc~pnpa_mc program~fidasim->proc~make_diagnostic_grids program~fidasim->proc~npa_f program~fidasim->proc~npa_mc program~fidasim->proc~npa_weights

Contents

Source Code


Source Code

function in_boundary(bplane, p) result(in_b)
    !+ Indicator function for determining if a point on a plane is within the plane boundary
    type(BoundedPlane), intent(in)          :: bplane
        !+ Plane with boundary
    real(Float64), dimension(3), intent(in) :: p
        !+ Point on plane
    logical :: in_b

    real(Float64), dimension(3) :: pp
    real(Float64) :: hh, hw

    hh = bplane%hh
    hw = bplane%hw
    pp = matmul(bplane%inv_basis, p - bplane%origin)
    in_b = .False.
    SELECT CASE (bplane%shape)
        CASE (1) !Rectangular boundary
            if((abs(pp(1)).le.hw).and. &
               (abs(pp(2)).le.hh)) then
                in_b = .True.
            endif
        CASE (2) !Circular/Ellipsoidal boundary
            if(((hh*pp(1))**2 + (hw*pp(2))**2).le.((hh*hw)**2)) then
                in_b = .True.
            endif
        CASE DEFAULT
            if(inputs%verbose.ge.0) then
                write(*,'("IN_BOUNDARY: Unknown boundary shape: ",i2)') bplane%shape
            endif
            stop
    END SELECT

end function in_boundary