off-by-one issue fixed

This commit is contained in:
Martin Diehl 2020-06-05 14:44:31 +02:00
parent a9e0e93213
commit 9cd9ee71c5
2 changed files with 3 additions and 3 deletions

View File

@ -94,7 +94,7 @@ function IO_readlines(fileName) result(fileContent)
startPos = 1 startPos = 1
l = 1 l = 1
do while (l <= N_lines) do while (l <= N_lines)
endPos = merge(startPos + scan(rawData(startPos:),IO_EOL) - 2,len(rawData),l /= N_lines) endPos = merge(startPos + scan(rawData(startPos:),IO_EOL) - 2,len(rawData)-1,l /= N_lines)
if (endPos - startPos > pStringLen-1) then if (endPos - startPos > pStringLen-1) then
line = rawData(startPos:startPos+pStringLen-1) line = rawData(startPos:startPos+pStringLen-1)
if (.not. warned) then if (.not. warned) then
@ -106,7 +106,7 @@ function IO_readlines(fileName) result(fileContent)
endif endif
startPos = endPos + 2 ! jump to next line start startPos = endPos + 2 ! jump to next line start
fileContent(l) = line fileContent(l) = trim(line)//''
l = l + 1 l = l + 1
enddo enddo

View File

@ -119,7 +119,7 @@ subroutine discretization_mesh_init(restart)
call MPI_Bcast(mesh_boundaries,mesh_Nboundaries,MPI_INTEGER,0,PETSC_COMM_WORLD,ierr) call MPI_Bcast(mesh_boundaries,mesh_Nboundaries,MPI_INTEGER,0,PETSC_COMM_WORLD,ierr)
if (worldrank == 0) then if (worldrank == 0) then
fileContent = IO_read_ASCII(geometryFile) fileContent = IO_readlines(geometryFile)
l = 0 l = 0
do do
l = l + 1 l = l + 1