pfio_nf90_get_var_string Function

public function pfio_nf90_get_var_string(ncid, varid, string, start, count) result(status)

Arguments

Type IntentOptional Attributes Name
integer(kind=C_INT), intent(in) :: ncid
integer(kind=C_INT), intent(in) :: varid
character(len=*), intent(inout), target :: string(:)
integer, intent(in), optional :: start(:)
integer, intent(in), optional :: count(:)

Return Value integer


Source Code

   function pfio_nf90_get_var_string(ncid, varid, string, start, count) result(status)
      integer :: status
      integer(kind=C_INT), intent(in)   :: ncid
      integer(kind=C_INT), intent(in)   :: varid
      character(*), target,intent(inout):: string(:)
      integer, optional,   intent(in)   :: start(:)
      integer, optional,   intent(in)   :: count(:)
      integer, target, allocatable :: start_(:), count_(:)
      integer :: str_len, str_size

      str_len  = len(string(1))
      str_size = size(string)
      if (.not. present(start) .or. .not. present(count)) then
        allocate(start_(1), count_(1))
        start_(1) = 1
        count_(1) = str_size
      else
        start_ = start
        count_ = count
      endif
      status = c_f_pfio_get_var_string(ncid, varid, c_loc(string), str_len,  c_loc(start_), c_loc(count_))
      deallocate(start_, count_)

   end function pfio_nf90_get_var_string