tem_varSys_load_vector Subroutine

public subroutine tem_varSys_load_vector(me, conf, parent, key)

Load variable system(s) from a lua file

Arguments

Type IntentOptional Attributes Name
type(tem_varSys_type), intent(out), allocatable :: me(:)

The variable system to read in

type(flu_State) :: conf

Lua handle connected to the script to read the table from

integer, intent(in), optional :: parent

A parent table handle in which to look the current variables up

character(len=*), intent(in), optional :: key

load from this key


Calls

proc~~tem_varsys_load_vector~~CallsGraph proc~tem_varsys_load_vector tem_varSys_load_vector aot_table_close aot_table_close proc~tem_varsys_load_vector->aot_table_close aot_table_length aot_table_length proc~tem_varsys_load_vector->aot_table_length aot_table_open aot_table_open proc~tem_varsys_load_vector->aot_table_open proc~tem_abort tem_abort proc~tem_varsys_load_vector->proc~tem_abort proc~tem_varsys_load_single tem_varSys_load_single proc~tem_varsys_load_vector->proc~tem_varsys_load_single mpi_abort mpi_abort proc~tem_abort->mpi_abort proc~tem_varsys_load_single->aot_table_close proc~tem_varsys_load_single->aot_table_length proc~tem_varsys_load_single->aot_table_open proc~tem_varsys_load_single->proc~tem_abort aot_get_val aot_get_val proc~tem_varsys_load_single->aot_get_val interface~append~29 append proc~tem_varsys_load_single->interface~append~29 interface~init~29 init proc~tem_varsys_load_single->interface~init~29 proc~append_da_label append_da_label interface~append~29->proc~append_da_label proc~append_da_veclabel append_da_veclabel interface~append~29->proc~append_da_veclabel proc~init_da_label init_da_label interface~init~29->proc~init_da_label interface~expand~27 expand proc~append_da_label->interface~expand~27 interface~sortedposofval~5 sortedposofval proc~append_da_label->interface~sortedposofval~5 proc~append_da_veclabel->interface~expand~27

Called by

proc~~tem_varsys_load_vector~~CalledByGraph proc~tem_varsys_load_vector tem_varSys_load_vector interface~tem_varsys_load tem_varSys_load interface~tem_varsys_load->proc~tem_varsys_load_vector proc~tem_restart_readheader tem_restart_readHeader proc~tem_restart_readheader->interface~tem_varsys_load proc~tem_load_restart tem_load_restart proc~tem_load_restart->proc~tem_restart_readheader

Source Code

  subroutine tem_varSys_load_vector( me, conf, parent, key )
    ! ---------------------------------------------------------------------------
    !> The variable system to read in
    type(tem_varSys_type), intent(out), allocatable :: me(:)
    !> Lua handle connected to the script to read the table from
    type(flu_State) :: conf
    !> A parent table handle in which to look the current variables up
    integer, intent(in), optional :: parent
    !> load from this key
    character(len=*), optional, intent(in) :: key
    ! ---------------------------------------------------------------------------
    integer :: thandle, subhandle
    integer :: nSys, iSys
    character(len=LabelLen) :: local_key
    ! ---------------------------------------------------------------------------

    if( present( key )) then
      local_key = key
    else
      local_key = 'varsys'
    endif

    call aot_table_open( L       = conf,           &
      &                  parent  = parent,         &
      &                  thandle = thandle,        &
      &                  key     = trim(local_key) )
    !varsys table is present, load variable system
    if( thandle > 0 ) then
      ! Now the 'varsys' table is opened. Let's first check, if
      ! there is a single variable system directly inside, or if there are
      ! several, so we have to open a table first and check whether it has
      ! another table
      call aot_table_open( L       = conf,      &
        &                  parent  = thandle,   &
        &                  thandle = subhandle, &
        &                  pos     = 1          )
      ! more than one varSys
      if ( subhandle > 0 ) then
        call aot_table_close( L = conf, thandle = subhandle )
        nSys = aot_table_length( L = conf, thandle = thandle )
        allocate(me(nSys))
        ! load each varSys
        do iSys = 1, nSys
          call aot_table_open( L       = conf,      &
            &                  parent  = thandle,   &
            &                  thandle = subhandle, &
            &                  pos     = iSys       )
          call tem_varSys_load_single( me        = me(iSys),  &
            &                          conf      = conf,      &
            &                          parent    = subhandle, &
            &                          openTable = .false.    )
          call aot_table_close( L = conf, thandle = subhandle )
        end do
      else !single varSys
        nSys = 1
        allocate(me(nSys))
        call tem_varSys_load_single( me        = me(1),   &
          &                          conf      = conf,    &
          &                          parent    = thandle, &
          &                          openTable = .false.  )
      end if
    else
      write(logUnit(1),*) 'Error: Failed to load varsys table'
      call tem_abort()
    end if

    call aot_table_close( L = conf, thandle = thandle )

  end subroutine tem_varSys_load_vector