straightened out logic and variable naming
This commit is contained in:
parent
999d0d774e
commit
0e4379f7ec
|
@ -10,19 +10,19 @@ module linked_list
|
||||||
implicit none
|
implicit none
|
||||||
private
|
private
|
||||||
type, private :: tPartitionedString
|
type, private :: tPartitionedString
|
||||||
character(len=:), allocatable :: val
|
character(len=:), allocatable :: val
|
||||||
integer(pInt), dimension(:), allocatable :: pos
|
integer(pInt), dimension(:), allocatable :: pos
|
||||||
end type tPartitionedString
|
end type tPartitionedString
|
||||||
|
|
||||||
type, public :: tPartitionedStringList
|
type, public :: tPartitionedStringList
|
||||||
type(tPartitionedString) :: string
|
type(tPartitionedString) :: string
|
||||||
type(tPartitionedStringList), pointer :: next => null()
|
type(tPartitionedStringList), pointer :: next => null()
|
||||||
type(tPartitionedStringList), pointer :: prev => null()
|
type(tPartitionedStringList), pointer :: prev => null()
|
||||||
contains
|
contains
|
||||||
procedure :: add => add
|
procedure :: add => add
|
||||||
procedure :: show => show
|
procedure :: show => show
|
||||||
|
|
||||||
procedure :: keyExists => keyExists
|
procedure :: keyExists => exist
|
||||||
procedure :: countKeys => countKeyAppearances
|
procedure :: countKeys => countKeyAppearances
|
||||||
procedure :: getStringsRaw => strings
|
procedure :: getStringsRaw => strings
|
||||||
|
|
||||||
|
@ -59,19 +59,19 @@ subroutine add(this,string)
|
||||||
implicit none
|
implicit none
|
||||||
class(tPartitionedStringList), target, intent(in) :: this
|
class(tPartitionedStringList), target, intent(in) :: this
|
||||||
character(len=*), intent(in) :: string
|
character(len=*), intent(in) :: string
|
||||||
type(tPartitionedStringList), pointer :: new, list_tmp
|
type(tPartitionedStringList), pointer :: new, item
|
||||||
|
|
||||||
if (IO_isBlank(string)) return
|
if (IO_isBlank(string)) return
|
||||||
|
|
||||||
allocate(new)
|
allocate(new)
|
||||||
new%string%val=IO_lc(trim(string))
|
new%string%val = IO_lc (trim(string))
|
||||||
new%string%pos=IO_stringPos(trim(string))
|
new%string%pos = IO_stringPos(trim(string))
|
||||||
|
|
||||||
list_tmp => this
|
item => this
|
||||||
do while (associated(list_tmp%next))
|
do while (associated(item%next))
|
||||||
list_tmp => list_tmp%next
|
item => item%next
|
||||||
enddo
|
enddo
|
||||||
list_tmp%next => new
|
item%next => new
|
||||||
|
|
||||||
end subroutine add
|
end subroutine add
|
||||||
|
|
||||||
|
@ -84,13 +84,12 @@ subroutine show(this)
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
class(tPartitionedStringList) :: this
|
class(tPartitionedStringList) :: this
|
||||||
type(tPartitionedStringList), pointer :: list_tmp
|
type(tPartitionedStringList), pointer :: item
|
||||||
|
|
||||||
list_tmp => this%next
|
item => this%next
|
||||||
do
|
do while (associated(item))
|
||||||
if (.not. associated(list_tmp)) exit
|
write(6,'(a)') trim(item%string%val)
|
||||||
write(6,'(a)') trim(list_tmp%string%val)
|
item => item%next
|
||||||
list_tmp => list_tmp%next
|
|
||||||
end do
|
end do
|
||||||
|
|
||||||
end subroutine show
|
end subroutine show
|
||||||
|
@ -103,15 +102,15 @@ end subroutine show
|
||||||
! subroutine free_all()
|
! subroutine free_all()
|
||||||
! implicit none
|
! implicit none
|
||||||
!
|
!
|
||||||
! type(node), pointer :: list_tmp
|
! type(node), pointer :: item
|
||||||
!
|
!
|
||||||
! do
|
! do
|
||||||
! list_tmp => first
|
! item => first
|
||||||
!
|
!
|
||||||
! if (associated(list_tmp) .eqv. .FALSE.) exit
|
! if (associated(item) .eqv. .FALSE.) exit
|
||||||
!
|
!
|
||||||
! first => first%next
|
! first => first%next
|
||||||
! deallocate(list_tmp)
|
! deallocate(item)
|
||||||
! end do
|
! end do
|
||||||
! end subroutine free_all
|
! end subroutine free_all
|
||||||
|
|
||||||
|
@ -119,28 +118,24 @@ end subroutine show
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief reports wether a given key (string value at first position) exists in the list
|
!> @brief reports wether a given key (string value at first position) exists in the list
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
logical function keyExists(this,key)
|
logical function exist(this,key)
|
||||||
use IO, only: &
|
use IO, only: &
|
||||||
IO_stringValue
|
IO_stringValue
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
class(tPartitionedStringList), intent(in) :: this
|
class(tPartitionedStringList), intent(in) :: this
|
||||||
character(len=*), intent(in) :: key
|
character(len=*), intent(in) :: key
|
||||||
type(tPartitionedStringList), pointer :: list_tmp
|
type(tPartitionedStringList), pointer :: item
|
||||||
|
|
||||||
keyExists = .false.
|
exist = .false.
|
||||||
|
|
||||||
list_tmp => this%next
|
item => this%next
|
||||||
do
|
do while (associated(item) .and. .not. exist)
|
||||||
if (.not. associated(list_tmp)) exit
|
exist = trim(IO_stringValue(item%string%val,item%string%pos,1)) == trim(key)
|
||||||
if (trim(IO_stringValue(list_tmp%string%val,list_tmp%string%pos,1))==trim(key)) then
|
item => item%next
|
||||||
keyExists = .true.
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
list_tmp => list_tmp%next
|
|
||||||
end do
|
end do
|
||||||
|
|
||||||
end function keyExists
|
end function exist
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
@ -155,18 +150,17 @@ integer(pInt) function countKeyAppearances(this,key)
|
||||||
|
|
||||||
class(tPartitionedStringList), intent(in) :: this
|
class(tPartitionedStringList), intent(in) :: this
|
||||||
character(len=*), intent(in) :: key
|
character(len=*), intent(in) :: key
|
||||||
type(tPartitionedStringList), pointer :: list_tmp
|
type(tPartitionedStringList), pointer :: item
|
||||||
integer(pInt) :: i
|
integer(pInt) :: i
|
||||||
|
|
||||||
countKeyAppearances = 0_pInt
|
countKeyAppearances = 0_pInt
|
||||||
|
|
||||||
list_tmp => this%next
|
item => this%next
|
||||||
do
|
do while (associated(item))
|
||||||
if (.not. associated(list_tmp)) exit
|
if (trim(IO_stringValue(item%string%val,item%string%pos,1)) == trim(key)) then
|
||||||
if (trim(IO_stringValue(list_tmp%string%val,list_tmp%string%pos,1))==trim(key)) then
|
|
||||||
countKeyAppearances = countKeyAppearances + 1_pInt
|
countKeyAppearances = countKeyAppearances + 1_pInt
|
||||||
endif
|
endif
|
||||||
list_tmp => list_tmp%next
|
item => item%next
|
||||||
end do
|
end do
|
||||||
|
|
||||||
end function countKeyAppearances
|
end function countKeyAppearances
|
||||||
|
@ -184,23 +178,21 @@ function strings(this)
|
||||||
implicit none
|
implicit none
|
||||||
class(tPartitionedStringList), intent(in) :: this
|
class(tPartitionedStringList), intent(in) :: this
|
||||||
character(len=65536), dimension(:), allocatable :: strings
|
character(len=65536), dimension(:), allocatable :: strings
|
||||||
character(len=65536) :: string_tmp
|
character(len=65536) :: string
|
||||||
type(tPartitionedStringList), pointer :: list_tmp
|
type(tPartitionedStringList), pointer :: item
|
||||||
|
|
||||||
list_tmp => this%next
|
item => this%next
|
||||||
do
|
do while (associated(item))
|
||||||
if (.not. associated(list_tmp)) then
|
string = item%string%val
|
||||||
if(size(strings) < 0_pInt) call IO_error(142_pInt)
|
GfortranBug86033: if (.not. allocated(strings)) then
|
||||||
exit
|
allocate(strings(1),source=string)
|
||||||
endif
|
else GfortranBug86033
|
||||||
string_tmp = list_tmp%string%val
|
strings = [strings,string]
|
||||||
GfortranBug86033: if (.not. allocated(strings)) then
|
endif GfortranBug86033
|
||||||
allocate(strings(1),source=string_tmp)
|
item => item%next
|
||||||
else GfortranBug86033
|
|
||||||
strings = [strings,string_tmp]
|
|
||||||
endif GfortranBug86033
|
|
||||||
list_tmp => list_tmp%next
|
|
||||||
end do
|
end do
|
||||||
|
if (size(strings) < 0_pInt) call IO_error(142_pInt)
|
||||||
|
|
||||||
end function strings
|
end function strings
|
||||||
|
|
||||||
|
|
||||||
|
@ -218,18 +210,21 @@ subroutine getRaw(this,key,string,stringPos)
|
||||||
character(len=*), intent(in) :: key
|
character(len=*), intent(in) :: key
|
||||||
integer(pInt), dimension(:), allocatable, intent(out) :: stringPos
|
integer(pInt), dimension(:), allocatable, intent(out) :: stringPos
|
||||||
character(len=*), intent(out) :: string
|
character(len=*), intent(out) :: string
|
||||||
type(tPartitionedStringList), pointer :: list_tmp
|
type(tPartitionedStringList), pointer :: item
|
||||||
|
logical :: found
|
||||||
list_tmp => this%next
|
|
||||||
do
|
found = .false.
|
||||||
if (.not. associated(list_tmp)) call IO_error(140_pInt,ext_msg=key)
|
item => this%next
|
||||||
foundKey: if (trim(IO_stringValue(list_tmp%string%val,list_tmp%string%pos,1))==trim(key)) then
|
do while (associated(item) .and. .not. found)
|
||||||
stringPos = list_tmp%string%pos
|
found = trim(IO_stringValue(item%string%val,item%string%pos,1)) == trim(key)
|
||||||
string = list_tmp%string%val
|
if (found) then
|
||||||
exit
|
stringPos = item%string%pos
|
||||||
endif foundKey
|
string = item%string%val
|
||||||
list_tmp => list_tmp%next
|
endif
|
||||||
|
item => item%next
|
||||||
end do
|
end do
|
||||||
|
if (.not. found) call IO_error(140_pInt,ext_msg=key)
|
||||||
|
|
||||||
end subroutine getRaw
|
end subroutine getRaw
|
||||||
|
|
||||||
|
|
||||||
|
@ -252,31 +247,31 @@ subroutine getRaws(this,key,string,stringPos)
|
||||||
character(len=65536) :: string_tmp
|
character(len=65536) :: string_tmp
|
||||||
integer(pInt) :: posSize
|
integer(pInt) :: posSize
|
||||||
integer(pInt), dimension(:), allocatable :: stringPosFlat
|
integer(pInt), dimension(:), allocatable :: stringPosFlat
|
||||||
type(tPartitionedStringList), pointer :: list_tmp
|
type(tPartitionedStringList), pointer :: item
|
||||||
|
|
||||||
posSize = -1_pInt
|
posSize = -1_pInt
|
||||||
list_tmp => this%next
|
item => this%next
|
||||||
do
|
do
|
||||||
if (.not. associated(list_tmp)) then
|
if (.not. associated(item)) then
|
||||||
if(posSize < 0_pInt) call IO_error(140_pInt,ext_msg=key)
|
if(posSize < 0_pInt) call IO_error(140_pInt,ext_msg=key)
|
||||||
stringPos = reshape(stringPosFlat,[posSize,size(string)])
|
stringPos = reshape(stringPosFlat,[posSize,size(string)])
|
||||||
exit
|
exit
|
||||||
endif
|
endif
|
||||||
foundKey: if (trim(IO_stringValue(list_tmp%string%val,list_tmp%string%pos,1))==trim(key)) then
|
foundKey: if (trim(IO_stringValue(item%string%val,item%string%pos,1))==trim(key)) then
|
||||||
if (posSize < 0_pInt) then
|
if (posSize < 0_pInt) then
|
||||||
posSize = size(list_tmp%string%pos)
|
posSize = size(item%string%pos)
|
||||||
stringPosFlat = list_tmp%string%pos
|
stringPosFlat = item%string%pos
|
||||||
allocate(string(1))
|
allocate(string(1))
|
||||||
string(1) = list_tmp%string%val
|
string(1) = item%string%val
|
||||||
else
|
else
|
||||||
if (size(list_tmp%string%pos) /= posSize) &
|
if (size(item%string%pos) /= posSize) &
|
||||||
call IO_error(141_pInt,ext_msg=trim(list_tmp%string%val),el=posSize)
|
call IO_error(141_pInt,ext_msg=trim(item%string%val),el=posSize)
|
||||||
stringPosFlat = [stringPosFlat,list_tmp%string%pos]
|
stringPosFlat = [stringPosFlat,item%string%pos]
|
||||||
string_tmp = list_tmp%string%val
|
string_tmp = item%string%val
|
||||||
string = [string,string_tmp]
|
string = [string,string_tmp]
|
||||||
endif
|
endif
|
||||||
endif foundKey
|
endif foundKey
|
||||||
list_tmp => list_tmp%next
|
item => item%next
|
||||||
end do
|
end do
|
||||||
|
|
||||||
end subroutine getRaws
|
end subroutine getRaws
|
||||||
|
@ -296,26 +291,24 @@ real(pReal) function getFloat(this,key,defaultVal)
|
||||||
class(tPartitionedStringList), intent(in) :: this
|
class(tPartitionedStringList), intent(in) :: this
|
||||||
character(len=*), intent(in) :: key
|
character(len=*), intent(in) :: key
|
||||||
real(pReal), intent(in), optional :: defaultVal
|
real(pReal), intent(in), optional :: defaultVal
|
||||||
type(tPartitionedStringList), pointer :: list_tmp
|
type(tPartitionedStringList), pointer :: item
|
||||||
logical :: found
|
logical :: found
|
||||||
|
|
||||||
found = present(defaultVal)
|
|
||||||
if (present(defaultVal)) getFloat = defaultVal
|
if (present(defaultVal)) getFloat = defaultVal
|
||||||
list_tmp => this%next
|
found = .false.
|
||||||
|
item => this%next
|
||||||
|
|
||||||
do
|
do while (associated(item) .and. .not. found)
|
||||||
endOfList: if (.not. associated(list_tmp)) then
|
found = trim(IO_stringValue(item%string%val,item%string%pos,1)) == trim(key)
|
||||||
if(.not. found) call IO_error(140_pInt,ext_msg=key)
|
if (found) then
|
||||||
exit
|
if (item%string%pos(1) < 2_pInt) call IO_error(143_pInt,ext_msg=key)
|
||||||
endif endOfList
|
getFloat = IO_FloatValue(item%string%val,item%string%pos,2)
|
||||||
foundKey: if (trim(IO_stringValue(list_tmp%string%val,list_tmp%string%pos,1))==trim(key)) then
|
endif
|
||||||
found = .true.
|
item => item%next
|
||||||
if (list_tmp%string%pos(1) < 2_pInt) call IO_error(143_pInt,ext_msg=key)
|
|
||||||
getFloat = IO_FloatValue(list_tmp%string%val,list_tmp%string%pos,2)
|
|
||||||
endif foundKey
|
|
||||||
list_tmp => list_tmp%next
|
|
||||||
end do
|
end do
|
||||||
|
|
||||||
|
if (.not. found .and. .not. present(defaultVal)) call IO_error(140_pInt,ext_msg=key)
|
||||||
|
|
||||||
end function getFloat
|
end function getFloat
|
||||||
|
|
||||||
|
|
||||||
|
@ -333,26 +326,24 @@ integer(pInt) function getInt(this,key,defaultVal)
|
||||||
class(tPartitionedStringList), intent(in) :: this
|
class(tPartitionedStringList), intent(in) :: this
|
||||||
character(len=*), intent(in) :: key
|
character(len=*), intent(in) :: key
|
||||||
integer(pInt), intent(in), optional :: defaultVal
|
integer(pInt), intent(in), optional :: defaultVal
|
||||||
type(tPartitionedStringList), pointer :: list_tmp
|
type(tPartitionedStringList), pointer :: item
|
||||||
logical :: found
|
logical :: found
|
||||||
|
|
||||||
found = present(defaultVal)
|
|
||||||
if (present(defaultVal)) getInt = defaultVal
|
if (present(defaultVal)) getInt = defaultVal
|
||||||
list_tmp => this%next
|
found = .false.
|
||||||
|
item => this%next
|
||||||
|
|
||||||
do
|
do while (associated(item) .and. .not. found)
|
||||||
endOfList: if (.not. associated(list_tmp)) then
|
found = trim(IO_stringValue(item%string%val,item%string%pos,1)) == trim(key)
|
||||||
if(.not. found) call IO_error(140_pInt,ext_msg=key)
|
if (found) then
|
||||||
exit
|
if (item%string%pos(1) < 2_pInt) call IO_error(143_pInt,ext_msg=key)
|
||||||
endif endOfList
|
getInt = IO_IntValue(item%string%val,item%string%pos,2)
|
||||||
foundKey: if (trim(IO_stringValue(list_tmp%string%val,list_tmp%string%pos,1))==trim(key)) then
|
endif
|
||||||
found = .true.
|
item => item%next
|
||||||
if (list_tmp%string%pos(1) < 2_pInt) call IO_error(143_pInt,ext_msg=key)
|
|
||||||
getInt = IO_IntValue(list_tmp%string%val,list_tmp%string%pos,2)
|
|
||||||
endif foundKey
|
|
||||||
list_tmp => list_tmp%next
|
|
||||||
end do
|
end do
|
||||||
|
|
||||||
|
if (.not. found .and. .not. present(defaultVal)) call IO_error(140_pInt,ext_msg=key)
|
||||||
|
|
||||||
end function getInt
|
end function getInt
|
||||||
|
|
||||||
|
|
||||||
|
@ -370,35 +361,39 @@ character(len=65536) function getString(this,key,defaultVal,raw)
|
||||||
character(len=*), intent(in) :: key
|
character(len=*), intent(in) :: key
|
||||||
character(len=65536), intent(in), optional :: defaultVal
|
character(len=65536), intent(in), optional :: defaultVal
|
||||||
logical, intent(in), optional :: raw
|
logical, intent(in), optional :: raw
|
||||||
type(tPartitionedStringList), pointer :: list_tmp
|
type(tPartitionedStringList), pointer :: item
|
||||||
logical :: split
|
logical :: split
|
||||||
logical :: found
|
logical :: found
|
||||||
|
|
||||||
found = present(defaultVal)
|
found = present(defaultVal)
|
||||||
if (present(defaultVal)) getString = defaultVal
|
if (present(defaultVal)) getString = defaultVal
|
||||||
split = merge(raw,.true.,present(raw))
|
split = merge(raw,.true.,present(raw))
|
||||||
list_tmp => this%next
|
item => this%next
|
||||||
|
|
||||||
do
|
do
|
||||||
endOfList: if (.not. associated(list_tmp)) then
|
endOfList: if (.not. associated(item)) then
|
||||||
if(.not. found) call IO_error(140_pInt,ext_msg=key)
|
if(.not. found) call IO_error(140_pInt,ext_msg=key)
|
||||||
exit
|
exit
|
||||||
endif endOfList
|
endif endOfList
|
||||||
foundKey: if (trim(IO_stringValue(list_tmp%string%val,list_tmp%string%pos,1))==trim(key)) then
|
foundKey: if (trim(IO_stringValue(item%string%val,item%string%pos,1)) == trim(key)) then
|
||||||
found = .true.
|
found = .true.
|
||||||
if (split) then
|
if (split) then
|
||||||
if (list_tmp%string%pos(1) < 2_pInt) call IO_error(143_pInt,ext_msg=key)
|
if (item%string%pos(1) < 2_pInt) call IO_error(143_pInt,ext_msg=key)
|
||||||
getString = IO_StringValue(list_tmp%string%val,list_tmp%string%pos,2)
|
getString = IO_StringValue(item%string%val,item%string%pos,2)
|
||||||
else
|
else
|
||||||
getString = trim(list_tmp%string%val(list_tmp%string%pos(4):))
|
getString = trim(item%string%val(item%string%pos(4):))
|
||||||
endif
|
endif
|
||||||
endif foundKey
|
endif foundKey
|
||||||
list_tmp => list_tmp%next
|
item => item%next
|
||||||
end do
|
end do
|
||||||
|
|
||||||
end function getString
|
end function getString
|
||||||
|
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
!> @brief ...
|
||||||
|
!> @details ...
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
function getStrings(this,key)
|
function getStrings(this,key)
|
||||||
use IO
|
use IO
|
||||||
|
|
||||||
|
@ -447,14 +442,14 @@ function getIntArray(this,key,defaultVal)
|
||||||
integer(pInt), dimension(:), allocatable :: getIntArray
|
integer(pInt), dimension(:), allocatable :: getIntArray
|
||||||
class(tPartitionedStringList), intent(in) :: this
|
class(tPartitionedStringList), intent(in) :: this
|
||||||
character(len=*), intent(in) :: key
|
character(len=*), intent(in) :: key
|
||||||
integer(pInt),dimension(:), intent(in), optional :: defaultVal
|
integer(pInt), dimension(:), intent(in), optional :: defaultVal
|
||||||
type(tPartitionedStringList), pointer :: list_tmp
|
type(tPartitionedStringList), pointer :: item
|
||||||
integer(pInt) :: i
|
integer(pInt) :: i
|
||||||
logical :: found
|
logical :: found
|
||||||
logical :: cumulative
|
logical :: cumulative
|
||||||
|
|
||||||
cumulative = (key(1:1) == '(' .and. key(len_trim(key):len_trim(key)) == ')')
|
cumulative = (key(1:1) == '(' .and. key(len_trim(key):len_trim(key)) == ')')
|
||||||
found = present(defaultVal)
|
found = .false.
|
||||||
|
|
||||||
if (present(defaultVal)) then
|
if (present(defaultVal)) then
|
||||||
getIntArray = defaultVal
|
getIntArray = defaultVal
|
||||||
|
@ -462,25 +457,24 @@ function getIntArray(this,key,defaultVal)
|
||||||
allocate(getIntArray(0))
|
allocate(getIntArray(0))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
list_tmp => this%next
|
item => this%next
|
||||||
do
|
do while (associated(item) .and. (.not. found .or. cumulative))
|
||||||
endOfList: if (.not. associated(list_tmp)) then
|
found = trim(IO_stringValue(item%string%val,item%string%pos,1)) == trim(key)
|
||||||
if(.not. found) call IO_error(140_pInt,ext_msg=key)
|
if (found) then
|
||||||
exit
|
|
||||||
endif endOfList
|
|
||||||
foundKey: if (trim(IO_stringValue(list_tmp%string%val,list_tmp%string%pos,1))==trim(key)) then
|
|
||||||
if (.not. cumulative) then
|
if (.not. cumulative) then
|
||||||
deallocate(getIntArray) ! use here rhs allocation with empty list
|
deallocate(getIntArray) ! use here rhs allocation with empty list
|
||||||
allocate(getIntArray(0))
|
allocate(getIntArray(0))
|
||||||
endif
|
endif
|
||||||
found = .true.
|
if (item%string%pos(1) < 2_pInt) call IO_error(143_pInt,ext_msg=key)
|
||||||
if (list_tmp%string%pos(1) < 2_pInt) call IO_error(143_pInt,ext_msg=key)
|
do i = 2_pInt, item%string%pos(1)
|
||||||
do i = 2_pInt, list_tmp%string%pos(1)
|
getIntArray = [getIntArray,IO_IntValue(item%string%val,item%string%pos,i)]
|
||||||
getIntArray = [getIntArray,IO_IntValue(list_tmp%string%val,list_tmp%string%pos,i)]
|
|
||||||
enddo
|
enddo
|
||||||
endif foundKey
|
endif
|
||||||
list_tmp => list_tmp%next
|
item => item%next
|
||||||
end do
|
end do
|
||||||
|
|
||||||
|
if (.not. found .and. .not. present(defaultVal)) call IO_error(140_pInt,ext_msg=key)
|
||||||
|
|
||||||
end function getIntArray
|
end function getIntArray
|
||||||
|
|
||||||
|
|
||||||
|
@ -499,31 +493,33 @@ function getFloatArray(this,key,defaultVal)
|
||||||
real(pReal), dimension(:), allocatable :: getFloatArray
|
real(pReal), dimension(:), allocatable :: getFloatArray
|
||||||
class(tPartitionedStringList), intent(in) :: this
|
class(tPartitionedStringList), intent(in) :: this
|
||||||
character(len=*), intent(in) :: key
|
character(len=*), intent(in) :: key
|
||||||
real(pReal),dimension(:), intent(in), optional :: defaultVal
|
real(pReal), dimension(:), intent(in), optional :: defaultVal
|
||||||
type(tPartitionedStringList), pointer :: list_tmp
|
type(tPartitionedStringList), pointer :: item
|
||||||
integer(pInt) :: i
|
integer(pInt) :: i
|
||||||
|
logical :: found
|
||||||
|
|
||||||
allocate(getFloatArray(0))
|
found = .false.
|
||||||
|
|
||||||
list_tmp => this%next
|
if (present(defaultVal)) then
|
||||||
do
|
getFloatArray = defaultVal
|
||||||
endOfList: if (.not. associated(list_tmp)) then
|
else
|
||||||
if(present(defaultVal)) then
|
allocate(getFloatArray(0))
|
||||||
getFloatArray = defaultVal
|
endif
|
||||||
exit
|
|
||||||
else
|
item => this%next
|
||||||
call IO_error(140_pInt,ext_msg=key)
|
do while (associated(item) .and. .not. found)
|
||||||
endif
|
found = trim(IO_stringValue(item%string%val,item%string%pos,1)) == trim(key)
|
||||||
endif endOfList
|
if (found) then
|
||||||
foundKey: if (trim(IO_stringValue(list_tmp%string%val,list_tmp%string%pos,1))==trim(key)) then
|
if (item%string%pos(1) < 2_pInt) call IO_error(143_pInt,ext_msg=key)
|
||||||
if (list_tmp%string%pos(1) < 2_pInt) call IO_error(143_pInt,ext_msg=key)
|
do i = 2_pInt, item%string%pos(1)
|
||||||
do i = 2_pInt, list_tmp%string%pos(1)
|
getFloatArray = [getFloatArray,IO_FloatValue(item%string%val,item%string%pos,i)]
|
||||||
getFloatArray = [getFloatArray,IO_FloatValue(list_tmp%string%val,list_tmp%string%pos,i)]
|
|
||||||
enddo
|
enddo
|
||||||
exit
|
endif
|
||||||
endif foundKey
|
item => item%next
|
||||||
list_tmp => list_tmp%next
|
|
||||||
end do
|
end do
|
||||||
|
|
||||||
|
if (.not. found .and. .not. present(defaultVal)) call IO_error(140_pInt,ext_msg=key)
|
||||||
|
|
||||||
end function getFloatArray
|
end function getFloatArray
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue