This routine loads table of spacetime functions from the given key or pos
NOTE: If any of the entries in the table can not be interpreted as a space-time function, none will be returne at all, and an error code of -1 will be set. "Me" will be deallocated in this case. The routine first attempts to read the given key as a single space-time function definition, only if that fails, it tries to read it as a table of functions.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_spacetime_fun_type), | intent(out), | allocatable | :: | me(:) |
spacetime fun information |
|
type(flu_State) | :: | conf |
lua state handle |
|||
integer, | intent(inout), | optional | :: | parent |
aotus parent handle |
|
character(len=*), | intent(in) | :: | key |
name of the variable which is defined as spacetime function |
||
integer, | intent(in), | optional | :: | nComp |
number of components of the variable |
|
integer, | intent(out), | optional | :: | errCode |
errCode /=0, space time function fails use errCode to abort code outside this routine call |
subroutine tem_load_spacetime_table( me, conf, parent, key, nComp, &
& errCode )
! -------------------------------------------------------------------- !
!> spacetime fun information
type(tem_spacetime_fun_type), allocatable, intent(out) :: me(:)
!> lua state handle
type(flu_State) :: conf
!> aotus parent handle
integer, intent(inout), optional :: parent
!> name of the variable which is defined as spacetime function
character(len=*), intent(in) :: key
!> number of components of the variable
integer, intent(in), optional :: nComp
!> errCode /=0, space time function fails
!! use errCode to abort code outside this routine call
integer, optional, intent(out) :: errCode
! -------------------------------------------------------------------- !
!> aotus table handle
integer :: thandle
! counter variables
integer :: nSt, iSt
integer :: errCode_loc
character(len=labelLen) :: buffer
type(tem_st_fun_listElem_type), pointer :: current
! -------------------------------------------------------------------- !
current => NULL()
nSt = 1
allocate(me(nSt))
! read in a single spacetime function with given key
call tem_load_spacetime_single( me = me(1), &
& conf = conf, &
& parent = parent, &
& key = key, &
& nComp = nComp, &
& errCode = errCode_loc )
if (errCode_loc /= 0) then
write(logUnit(3),*) 'Error loading spacetime function from key ' &
& // trim(key)
write(logUnit(3),*) 'Try to load it from table'
! Error loading spacetime function directly via key
! Try opening as table of space time functions
call aot_table_open( L = conf, &
& thandle = thandle, &
& parent = parent, &
& key = trim(key) )
nSt = aot_table_length( L=conf, thandle=thandle )
write(logUnit(3),*) 'Multiple spacetime functions are defined'
write(buffer,'(i3)') nSt
write(logUnit(3),*) 'Number of spacetime fun tables '//trim(buffer)
deallocate(me)
allocate(me(nSt))
do iSt = 1, nSt
write(buffer,'(i3)') iSt
write(logUnit(3),*)
write(logUnit(3),*) 'loading space time function at pos: '//trim(buffer)
call tem_load_spacetime_single( me = me(iSt), &
& conf = conf, &
& parent = thandle, &
& pos = iSt, &
& nComp = nComp, &
& errCode = errCode_loc )
if (errCode_loc /= 0) then
write(logUnit(3),*) 'Error loading spacetime function at pos ' &
& //trim(buffer)
write(logUnit(3),*) 'Aborting the attempt to more functions '
EXIT
else
end if
end do
call aot_table_close( L = conf, thandle = thandle )
end if
if (errCode_loc /= 0) then
deallocate(me)
else
write(logUnit(1),*) 'Space-time function for key '//trim(key)//':'
do iSt=1,nSt
write(logUnit(1),*) ' pos ', iSt, &
& ' is defined as ' // trim(me(iSt)%fun_kind)
end do
end if
if (present(errCode)) errCode = errCode_loc
end subroutine tem_load_spacetime_table