Hbuild Subroutine

private subroutine Hbuild(Ha, Hj, Hk, N, Nk, hops)

Arguments

Type IntentOptional Attributes Name
real(kind=rp), intent(inout) :: Ha(N)
integer(kind=ip), intent(inout) :: Hj(N)
integer(kind=ip), intent(inout) :: Hk(Nk)
integer(kind=ip), intent(in) :: N
integer(kind=ip), intent(in) :: Nk
integer(kind=ip), intent(out) :: hops

Calls

proc~~hbuild~~CallsGraph proc~hbuild lusol::Hbuild proc~hinsert lusol::Hinsert proc~hbuild->proc~hinsert proc~hup lusol::Hup proc~hinsert->proc~hup

Called by

proc~~hbuild~~CalledByGraph proc~hbuild lusol::Hbuild proc~lu1fad lusol::lu1fad proc~lu1fad->proc~hbuild proc~lu1fac lusol::lu1fac proc~lu1fac->proc~lu1fad proc~solve lusol_ez_module::solve proc~solve->proc~lu1fac proc~test_1 main::test_1 proc~test_1->proc~solve proc~test_2 main::test_2 proc~test_2->proc~solve program~main~2 main program~main~2->proc~test_1 program~main~2->proc~test_2

Source Code

  subroutine Hbuild( Ha, Hj, Hk, N, Nk, hops )

    integer(ip),   intent(in)    :: N, Nk
    integer(ip),   intent(inout) :: Hj(N), Hk(Nk)
    integer(ip),   intent(out)   :: hops
    real(rp),      intent(inout) :: Ha(N)

    !==================================================================
    ! Hbuild initializes the heap by inserting each element of Ha.
    ! Input:  Ha, Hj.
    ! Output: Ha, Hj, Hk, hops.
    !
    ! 01 May 2002: Use k for new length of heap, not k-1 for old length.
    ! 05 May 2002: Use kk in call to stop loop variable k being altered.
    !              (Actually Hinsert no longer alters that parameter.)
    ! 07 May 2002: ftnchek wants us to protect Nk, Ha(k), Hj(k) too.
    ! 07 May 2002: Current version of Hbuild.
    ! 12 Dec 2011: First f90 version.
    !==================================================================

    integer(ip) :: h, jv, k, kk, Nkk
    real(rp)    :: v

    Nkk  = Nk
    hops = 0
    do k = 1, N
       kk    = k
       v     = Ha(k)
       jv    = Hj(k)
       call Hinsert( Ha, Hj, Hk, kk, Nkk, v, jv, h )
       hops  = hops + h
    end do

  end subroutine Hbuild