read configuration file
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(flu_State) | :: | conf |
handle for lua file |
|||
type(tem_reduction_spatial_config_type), | intent(out) | :: | redSpatial_config |
the reduction file to fill |
||
integer, | intent(in), | optional | :: | parent |
handle for reduce table |
|
character(len=*), | intent(in), | optional | :: | key |
which key to open |
subroutine tem_load_reduction_spatial(conf, redSpatial_config, parent, key) ! --------------------------------------------------------------------------- !> handle for lua file type(flu_State) :: conf !> the reduction file to fill type(tem_reduction_spatial_config_type),intent(out) :: redSpatial_config !> handle for reduce table integer, optional,intent(in) :: parent !> which key to open character(len=*),optional,intent(in) :: key ! --------------------------------------------------------------------------- integer :: nEntries, handle, iPos character(len=labelLen) :: localKey integer, allocatable :: vErr(:) !, vErr_NonExistent(:) ! --------------------------------------------------------------------------- if( present( key )) then localKey = key else localKey = 'reduction' endif allocate( redSpatial_config%reduceType(1) ) allocate( vErr(1) ) redSpatial_config%reduceType(1) = '' ! load reduction as scalar if failed then try to load as table call tem_load_reduction_single( conf = conf, & & handle = parent, & & reduceType = redSpatial_config & & %reduceType(1), & & key = localKey, & & iError = vErr(1) ) ! try loading it as table if(btest(vErr(1), aoterr_NonExistent)) then ! write(logUnit(1),"(A)") 'Try load reduction as a table' call aot_table_open( L = conf, & & thandle = handle, & & parent = parent, & & key = localKey ) ! reduction defined as table if ( handle /= 0 ) then ! load entry inside a table nEntries = aot_table_length( L = conf, thandle = handle ) ! write(logUnit(1),"(A,I0)") 'Table has entries: ', nEntries deallocate( redSpatial_config%reduceType ) deallocate( vErr ) allocate( redSpatial_config%reduceType( nEntries ) ) allocate( vErr( nEntries ) ) do iPos = 1, nEntries redSpatial_config%reduceType(iPos) = '' call tem_load_reduction_single( conf = conf, & & handle = handle, & & reduceType = redSpatial_config & & %reduceType(iPos), & & pos = iPos, & & iError = vErr(iPos) ) enddo redSpatial_config%active = .true. end if call aot_table_close(conf, handle) else ! write(logUnit(1),"(A)") 'Reduction is a single entry' redSpatial_config%active = .true. nEntries = 1 endif if ( redSpatial_config%active ) then write(logUnit(3),"(A, I0)") ' Number of reductions loaded: ', nEntries write(logUnit(5),"(A)") ' their reduceTypes are:' do iPos = 1, nEntries write(logUnit(5),"(A)") ' '//trim(redSpatial_config & & %reduceType(iPos)) end do else deallocate( redSpatial_config%reduceType ) allocate( redSpatial_config%reduceType(0) ) end if end subroutine tem_load_reduction_spatial