init_gdata_io Subroutine

private subroutine init_gdata_io(this, t_aas, t_ms, t_ap, fvals_size_in, max_ratio_size_in, apvals_size_in)

Type Bound

gdata_io_t

Arguments

Type IntentOptional Attributes Name
class(gdata_io_t) :: this
logical, intent(in) :: t_aas
logical, intent(in) :: t_ms
logical, intent(in) :: t_ap
integer, intent(in) :: fvals_size_in
integer, intent(in) :: max_ratio_size_in
integer, intent(in) :: apvals_size_in

Contents

Source Code


Source Code

    subroutine init_gdata_io(this, t_aas, t_ms, t_ap, fvals_size_in, max_ratio_size_in, apvals_size_in)
        ! Initialize a gdata_io_t object. This sets the read/write ranges for buffers
        ! and the size of required buffers
        ! Input: t_aas - Is auto adaptive shift data read/written (acc. rates)?
        !        t_ms - Is scale bloom data read/written (hij/pgen ratios)?
        !        t_ap - Is accumplated populations data read/written?
        !        fvals_size - Size of the aas data (only referenced when t_aas is true)
        !        max_ratio_size - size of the ms data (only referenced when t_ms is true)
        !        apvals_size - size of the accumlated populations data (only referenced when t_apvals is true)
        class(gdata_io_t) :: this
        logical, intent(in) :: t_aas, t_ms, t_ap
        integer, intent(in) :: fvals_size_in, max_ratio_size_in, apvals_size_in
        integer :: fvals_size, max_ratio_size, apvals_size

        ! how much data is to be read?
        this%gdata_size = 0

        if (.not. t_aas) then
            fvals_size = 0
        else
            fvals_size = fvals_size_in
        end if
        if (.not. t_ms) then
            max_ratio_size = 0
        else
            max_ratio_size = max_ratio_size_in
        end if
        if (.not. t_ap) then
            apvals_size = 0
        else
            apvals_size = apvals_size_in
        end if

        ! set the range of each section
        this%fvals_start = 1
        this%fvals_end = this%fvals_start + fvals_size - 1
        this%gdata_size = this%gdata_size + fvals_size

        this%max_ratio_start = this%fvals_start + fvals_size
        this%max_ratio_end = this%max_ratio_start + max_ratio_size - 1
        this%gdata_size = this%gdata_size + max_ratio_size

        this%apvals_start = this%max_ratio_end + max_ratio_size
        this%apvals_end = this%apvals_start + apvals_size - 1
        this%gdata_size = this%gdata_size + apvals_size

    end subroutine init_gdata_io