Assign an arbitrary length vector of reals to variable
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(inout) | :: | buffer |
Input buffer |
||
| real(kind=real32), | intent(out), | dimension(:) | :: | variable |
Variable to assign data to |
|
| integer, | intent(inout) | :: | found |
Count for finding variable |
||
| character(len=*), | intent(in), | optional | :: | keyword |
Keyword to start from |
|
| character(len=1), | intent(in), | optional | :: | fs |
Field separator |
subroutine assignRvec(buffer, variable, found, keyword, fs) !! Assign an arbitrary length vector of reals to variable implicit none ! Arguments character(*), intent(inout) :: buffer !! Input buffer real(real32), dimension(:), intent(out) :: variable !! Variable to assign data to integer, intent(inout) :: found !! Count for finding variable character(*), optional, intent(in) :: keyword !! Keyword to start from character(1), optional, intent(in) :: fs !! Field separator ! Local variables integer :: i !! Loop index character(1024) :: buffer2 !! Temporary buffer character(1) :: fs_ !! Field separator fs_ = '=' if(present(fs)) fs_ = fs if(present(keyword)) buffer = buffer(index(buffer, keyword):) if(scan(buffer, fs_) .ne. 0) buffer2 = get_val(buffer, fs_) if(trim(adjustl(buffer2)) .ne. '')then found = found + 1 if(icount(buffer2) .eq. 1 .and. icount(buffer2) .ne. size(variable))then read(buffer2, *) variable(1) variable = variable(1) else read(buffer2, *) (variable(i), i = 1, size(variable)) end if end if end subroutine assignRvec