real32_to_base64 Subroutine

public subroutine real32_to_base64(indata, iplen, outfile)

this routine encodes data of type real32 to base64 format

Arguments

Type IntentOptional Attributes Name
real(kind=c_float), intent(in), target :: indata(iplen)

data to be encoded

integer, intent(in) :: iplen

size of data to be encoded

integer, intent(in) :: outfile

output file unit


Calls

proc~~real32_to_base64~~CallsGraph proc~real32_to_base64 real32_to_base64 interface~convert_to_base64_single convert_to_Base64_single proc~real32_to_base64->interface~convert_to_base64_single interface~encodeindex EncodeIndex proc~real32_to_base64->interface~encodeindex interface~encodeblock EncodeBlock proc~real32_to_base64->interface~encodeblock proc~real64_to_base64_single real64_to_base64_single interface~convert_to_base64_single->proc~real64_to_base64_single proc~int8_to_base64_single int8_to_base64_single interface~convert_to_base64_single->proc~int8_to_base64_single proc~int64_to_base64_single int64_to_base64_single interface~convert_to_base64_single->proc~int64_to_base64_single proc~real32_to_base64_single real32_to_base64_single interface~convert_to_base64_single->proc~real32_to_base64_single proc~char_to_base64_single char_to_base64_single interface~convert_to_base64_single->proc~char_to_base64_single proc~int32_to_base64_single int32_to_base64_single interface~convert_to_base64_single->proc~int32_to_base64_single proc~real64_to_base64_single->interface~encodeindex proc~real64_to_base64_single->interface~encodeblock proc~int8_to_base64_single->interface~encodeindex proc~int8_to_base64_single->interface~encodeblock proc~int64_to_base64_single->interface~encodeindex proc~int64_to_base64_single->interface~encodeblock proc~real32_to_base64_single->interface~encodeindex proc~real32_to_base64_single->interface~encodeblock proc~char_to_base64_single->interface~encodeindex proc~char_to_base64_single->interface~encodeblock proc~int32_to_base64_single->interface~encodeindex proc~int32_to_base64_single->interface~encodeblock

Called by

proc~~real32_to_base64~~CalledByGraph proc~real32_to_base64 real32_to_base64 interface~convert_to_base64 convert_to_Base64 interface~convert_to_base64->proc~real32_to_base64 proc~hvs_vtk_write_meshdata~2 hvs_vtk_write_meshdata proc~hvs_vtk_write_meshdata~2->interface~convert_to_base64 proc~hvs_vtk_dump_data~2 hvs_vtk_dump_data proc~hvs_vtk_dump_data~2->interface~convert_to_base64 proc~hvs_dump_debug_array hvs_dump_debug_array proc~hvs_dump_debug_array->interface~convert_to_base64 proc~hvs_dump_debug_array->proc~hvs_vtk_write_meshdata~2

Contents

Source Code


Source Code

  subroutine real32_to_base64( indata, iplen, outfile )
    ! ---------------------------------------------------------------------------
    !> size of data to be encoded
    integer, intent(in) :: iplen
    !> data to be encoded
    real(kind=c_float), target, intent(in) :: indata(iplen)
    !> output file unit
    integer, intent(in) :: outfile
    ! ---------------------------------------------------------------------------
    integer(kind=c_int) :: baserc
    integer(kind=c_int) :: insize, outsize, ipindex, min_iplen
    integer :: ind
    type(c_ptr) :: base64_out
    type(c_ptr) :: base64_in
    type(c_ptr) :: encoder_in
    character, target :: base64_string(encoderlen), encoder_str(encoderblocklen)
    ! ---------------------------------------------------------------------------

    base64_in = c_loc(indata)

    insize = int(c_sizeof(indata(1))*iplen, kind=4)

    ! write insize i.e bit size in the beginning of the string
    call convert_to_base64_single( insize, outfile )

    outsize = ceiling(insize/3._rk)*4

    base64_out = c_loc(base64_string)

    encoder_in = c_loc(encoder_str)

    ipindex = 0
    do
      do ind = 0, 2
        baserc = encodeindex( base64_in, encoder_in, insize, ind, ipindex )
        ipindex = ipindex + 1
      end do
      min_iplen = min(insize - ipindex + 3, 3)
      baserc = encodeblock( encoder_in, base64_out, min_iplen, outsize )
      write(outfile) base64_string
      if (ipindex >= insize) exit
    end do

  end subroutine real32_to_base64