Read a single entry of reductions from the lua file
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(flu_State), | intent(inout) | :: | conf |
handle for lua file |
||
character(len=labelLen), | intent(out) | :: | reduceType |
reduction type to be filled |
||
integer, | intent(in), | optional | :: | handle |
handle for reduce table |
|
character(len=*), | intent(in), | optional | :: | key |
which key to open |
|
integer, | intent(in), | optional | :: | pos |
position to load from in config file |
|
integer, | intent(out) | :: | iError |
error from aotus |
subroutine tem_load_reduction_single(conf, reduceType, handle, key, pos, &
& iError)
! ---------------------------------------------------------------------------
!> handle for lua file
type(flu_State),intent(inout) :: conf
!> reduction type to be filled
character(len=labelLen), intent(out) :: reduceType
!> handle for reduce table
integer, optional,intent(in) :: handle
!> which key to open
character(len=*),optional,intent(in) :: key
!> position to load from in config file
integer,optional,intent(in) :: pos
!> error from aotus
integer, intent(out) :: iError
! ---------------------------------------------------------------------------
if( present( key )) then
call aot_get_val( L = conf, &
& thandle = handle, &
& val = reduceType, &
& ErrCode = iError, &
& key = key )
elseif( present( pos ))then
call aot_get_val( L = conf, &
& thandle = handle, &
& val = reduceType, &
& ErrCode = iError, &
& pos = pos )
else
iError = ibset(iError,aoterr_NonExistent)
endif
! if reduceType is empty. can happen when reduceType is defined as table
if (trim(reduceType) == '' ) iError = ibset(iError,aoterr_NonExistent)
if(.not. btest(iError, aotErr_NonExistent)) then
! convert into lower case
reduceType = upper_to_lower( reduceType )
! Check the chosen reduceType
select case( trim(reduceType) )
case('sum')
case('average')
case('l2norm','l2_norm')
reduceType = 'l2norm'
case('l2normalized')
reduceType = 'l2normalized'
case('linfnorm', 'linf_norm', 'l_inf_norm')
reduceType = 'linfnorm'
case('max','maximum')
reduceType = 'max'
case('min','minimum')
reduceType = 'min'
case('weighted_sum', 'w_sum')
! result weighted by its volume factor
reduceType = 'weighted_sum'
case('none')
case default
write(logUnit(1),*)' Error: The chosen reduction '// &
& trim(reduceType)//' is not defined.'
call tem_abort()
end select
endif
end subroutine tem_load_reduction_single