writeFValsAsInt Subroutine

public subroutine writeFValsAsInt(fvals, j)

Arguments

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

Contents

Source Code


Source Code

    subroutine writeFValsAsInt(fvals, j)
        implicit none
        integer(n_int), intent(inout) :: fvals(:)
        integer, intent(in) :: j
        integer :: k

        ! Write the acc. and tot. spawns in a contiguous integer array of size (2*inum_runs)
        ! This is useful for HDF5 subroutines which currently only accept integer arrays

        if (size(fvals) >= 2 * inum_runs) then
            do k = 1, inum_runs
                fvals(k) = transfer(get_acc_spawns(j, k), fvals(k))
            end do
            do k = 1, inum_runs
                fvals(k + inum_runs) = transfer(get_tot_spawns(j, k), fvals(k))
            end do
        else
            ! the buffer has unsuitable size, print a warning
            print *, "WARNING: Dimension mismatch in writeFValsAsInt. Writing 0"
            fvals = 0
        end if
    end subroutine writeFValsAsInt