writeAPValsAsInt Subroutine

public subroutine writeAPValsAsInt(apvals, j)

Arguments

Type IntentOptional Attributes Name
integer(kind=n_int), intent(inout) :: apvals(:)
integer, intent(in) :: j

Contents

Source Code


Source Code

    subroutine writeAPValsAsInt(apvals, j)
        implicit none
        integer(n_int), intent(inout) :: apvals(:)
        integer, intent(in) ::j
        integer :: k

        ! Write the accumlated population values (pops_sum and pop_iter)
        ! in a contiguous integer array of size (lenof_sing+1).
        ! This is useful for HDF5 subroutines which currently only accept integer arrays

        if (size(apvals, dim=1) >= lenof_sign + 1) then
            do k = 1, lenof_sign
                apvals(k) = transfer(get_pops_sum(j, k), apvals(k))
            end do
            apvals(lenof_sign + 1) = transfer(get_pops_iter(j), apvals(k))
        else
            ! the buffer has unsuitable size, print a warning
            print *, "WARNING: Dimension mismatch in writeAPValsAsInt. Writing 0"
            apvals = 0
        end if

    end subroutine writeAPValsAsInt