Read the tracker configuration from the main lua file
Setup the values for the tracking entities
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_tracking_type), | intent(out) | :: | me |
list of the trackingeentities to create |
||
type(flu_State) | :: | conf |
handle of the lua config file |
|||
integer, | optional | :: | parent |
if the tracking table is a child-table of some other table, use the parent as a reference |
subroutine tem_load_tracking(me, conf, parent)
! -------------------------------------------------------------------- !
!> list of the trackingeentities to create
type( tem_tracking_type ), intent(out) :: me
!> handle of the lua config file
type( flu_state ) :: conf
!> if the tracking table is a child-table of some other table,
!! use the parent as a reference
integer, optional :: parent
! -------------------------------------------------------------------- !
integer :: tc_handle, sub_handle
integer :: iTrack, nTracks
! -------------------------------------------------------------------- !
! Read the number of trackings in the lua file
call aot_table_open( L = conf, &
& thandle = tc_handle, &
& key = 'tracking', &
& parent = parent )
if (tc_handle == 0) then
write(logUnit(1),*) 'No Tracking entities found!'
call aot_table_close(L=conf, thandle=tc_handle)
call tem_horizontalSpacer(fUnit=logUnit(1))
me%control%nActive = 0
me%control%nDefined = 0
allocate( me%config(0) )
allocate( me%instance(0) )
return
else ! track entity exists.
me%control%active = .true.
end if
write(logUnit(1),*) 'Loading tracking ...'
! Check whether tracking had a subtable
! If no, then it is a single table, load single tracking entry
! else load multiple tables, open tracking subtable
call aot_table_open( L = conf, &
& parent = tc_handle, &
& thandle = sub_handle, &
& pos = 1 )
! Only single table
if (sub_handle == 0) then
nTracks = 1
write(logUnit(1),*) 'Tracking is a single table'
allocate( me%config(1) )
call tem_load_trackingConfig( conf = conf, &
& sub_handle = tc_handle, &
& config = me%config(1) )
call aot_table_close(L=conf, thandle=sub_handle)
else ! Multiple table
call aot_table_close(L=conf, thandle=sub_handle)
nTracks = aot_table_length(L=conf, thandle=tc_handle)
! Allocate the defined number of tracking entities
allocate( me%config( nTracks ))
write(logUnit(1),"(A,I0)") 'Number of Tracking entities: ', nTracks
! Loop over all the definitions and assign the variables from the lua
! file on the tem_tracking_type.
! Inside this routine it will open tracking subtable. Each subtable
! contains one or more tracking variables the stuff is done in the
! routine tem_load_trackingConfig
do iTrack = 1, nTracks
write(logUnit(1),"(A,I0)") 'Loading tracker: ', iTrack
call aot_table_open( L = conf, &
& parent = tc_handle, &
& thandle = sub_handle, &
& pos = iTrack )
call tem_load_trackingConfig( conf = conf, &
& sub_handle = sub_handle, &
& config = me%config(iTrack) )
call aot_table_close(L=conf, thandle=sub_handle)
write(logUnit(1),"(A,I0)") 'Done tracker ', iTrack
end do
end if ! sub_handle
! me%control%nActive = nTracks
me%control%nDefined = nTracks
allocate(me%instance(nTracks))
call aot_table_close(L=conf, thandle=tc_handle) ! close tracking table
call tem_horizontalSpacer(fUnit=logUnit(1))
end subroutine tem_load_tracking