Skip to content

Commit aade70a

Browse files
authored
Merge pull request #648 from dlgeorge/parse_values_error
error when nw==11
2 parents a8aeb8c + 634c6dd commit aade70a

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

src/2d/shallow/qinit_module.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ subroutine read_force_dry(fname)
265265
use utility_module, only: parse_values
266266
character(len=*), intent(in) :: fname
267267
integer :: iunit,i,j,n
268-
real(kind=8) :: values(10), nodata_value
268+
real(kind=8) :: values(16), nodata_value
269269
character(len=80) :: str
270270

271271
iunit = 8

src/2d/shallow/test_parse_values.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ program test_parse_values
1212
implicit none
1313
character(len=150) str,fname
1414
integer :: n,i,topo_type,mx,my
15-
real(kind=8) :: values(10), xll,yll,xhi,yhi,dx,dy
15+
real(kind=8) :: values(16), xll,yll,xhi,yhi,dx,dy
1616

1717
if (.true.) then
1818
write(6,*) 'input line with mix of character strings and numbers...'

src/2d/shallow/topo_module.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ subroutine read_topo_file(mx,my,topo_type,fname,xll,yll,topo)
434434
logical, parameter :: maketype2 = .false.
435435
integer :: missing,status,n
436436
real(kind=8) :: no_data_value,x,y,topo_temp
437-
real(kind=8) :: values(10)
437+
real(kind=8) :: values(16)
438438
character(len=80) :: str
439439
integer(kind=8) :: i, j, mtot
440440

@@ -730,7 +730,7 @@ subroutine read_topo_header(fname,topo_type,mx,my,xll,yll,xhi,yhi,dx,dy)
730730
integer :: topo_size, status, n
731731
real(kind=8) :: x,y,z,nodata_value
732732
logical :: found_file
733-
real(kind=8) :: values(10)
733+
real(kind=8) :: values(16)
734734
character(len=80) :: str
735735
logical :: verbose
736736
logical :: xll_registered, yll_registered

src/2d/shallow/utility_module.f90

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ subroutine parse_values(str, n, values)
6363

6464
character(len=*), intent(in) :: str
6565
integer, intent(out) :: n
66-
real(kind=8), intent(out) :: values(10)
66+
real(kind=8), intent(out) :: values(16)
6767

6868
integer :: pos2,nw,i,e
69-
character(len=80) :: word(10), str2
69+
character(len=80) :: word(16), str2
7070
real(kind=8) :: x
7171

7272
! First break into words / tokens based on white space.
@@ -84,13 +84,14 @@ subroutine parse_values(str, n, values)
8484
endif
8585

8686
nw = nw + 1
87-
word(nw) = trim(adjustl(str2(1:pos2-1)))
88-
str2 = trim(adjustl(str2(pos2+1:)))
89-
if (nw == 10) then
87+
if (nw == 17) then
9088
write(6,*) '*** too many words on line, str = '
9189
write(6,*) str
9290
stop
9391
endif
92+
word(nw) = trim(adjustl(str2(1:pos2-1)))
93+
str2 = trim(adjustl(str2(pos2+1:)))
94+
9495
enddo
9596

9697
! now extract numerical values:

0 commit comments

Comments
 (0)