ReadGeometry Subroutine

private subroutine ReadGeometry(iniDB, k, reserv)

read geometry table

Arguments

Type IntentOptional Attributes Name
type(IniList), intent(in) :: iniDB
integer(kind=short), intent(in) :: k
type(Reservoir), intent(inout), POINTER :: reserv

Variables

Type Visibility Attributes Name Initial
integer(kind=short), public, ALLOCATABLE :: doy(:)
integer(kind=short), public :: i
logical, public :: isString
integer(kind=short), public :: j
integer(kind=short), public :: nDOY
integer(kind=short), public :: shortInt
character(len=300), public :: string

Source Code

SUBROUTINE ReadGeometry &
  !
  (iniDB, k, reserv)

IMPLICIT NONE

!Arguments with intent(in):
TYPE(IniList), INTENT (IN) :: iniDB
INTEGER (KIND = short), INTENT (IN) :: k

!Arguemnts with intent (inout):
TYPE(Reservoir), POINTER, INTENT(INOUT) :: reserv 


!local declarations
CHARACTER (LEN = 300)          :: string
INTEGER (KIND = short)         :: nDOY
INTEGER (KIND = short)         :: shortInt 
INTEGER (KIND = short)         :: i, j
INTEGER(KIND = short), ALLOCATABLE :: doy (:)
LOGICAL                       :: isString

!---------------------------end of declarations--------------------------------

string = IniReadString ('geometry', iniDB, section = ToString(k))
CALL TableNew (string, reserv % geometry)

nDOY = reserv % geometry % noCols - 3
ALLOCATE ( doy ( nDOY ) )

j = 0
DO i = 1, reserv % geometry % noCols
    shortInt = StringToShort ( reserv % geometry % col ( i ) % header, isString )
    
    IF ( .NOT. isString ) THEN !number detected
        j = j + 1
        doy ( j ) = shortInt
    END IF
    
END DO

!set  when (doy day of year) geometry table changes
reserv % geometryDOY (:) = MAXVAL (doy)
       !
DO i = 1, nDOY
    DO j = doy (i), 365
        reserv % geometryDOY (j) = doy (i)
    END DO
END DO
       
DEALLOCATE (doy)

RETURN
END SUBROUTINE ReadGeometry