tem_varSys_out_single Subroutine

public subroutine tem_varSys_out_single(me, conf, dumpVarPos, level)

Write the system of variables description into a Lua file. use the aotus_out functions for doing so, in order to obtain a neatly formatted lua file

Arguments

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

Variable system to write out

type(aot_out_type), intent(inout) :: conf

Aotus type handling the output to the file in lua format

integer, intent(in), optional :: dumpVarPos(:)

Position of variables to dump

integer, intent(in), optional :: level

to dump varSys with key or without key


Calls

proc~~tem_varsys_out_single~~CallsGraph proc~tem_varsys_out_single tem_varSys_out_single proc~aot_out_open_table aot_out_open_table proc~tem_varsys_out_single->proc~aot_out_open_table proc~aot_out_val aot_out_val proc~tem_varsys_out_single->proc~aot_out_val proc~aot_out_close_table aot_out_close_table proc~tem_varsys_out_single->proc~aot_out_close_table

Called by

proc~~tem_varsys_out_single~~CalledByGraph proc~tem_varsys_out_single tem_varSys_out_single proc~tem_varsys_out_vector tem_varSys_out_vector proc~tem_varsys_out_vector->proc~tem_varsys_out_single interface~tem_varsys_out tem_varSys_out interface~tem_varsys_out->proc~tem_varsys_out_single interface~tem_varsys_out->proc~tem_varsys_out_vector proc~tem_varsys_dump_single tem_varSys_dump_single proc~tem_varsys_dump_single->proc~tem_varsys_out_single proc~tem_varsys_dump_vector tem_varSys_dump_vector proc~tem_varsys_dump_vector->proc~tem_varsys_out_vector interface~tem_varsys_dump tem_varSys_dump interface~tem_varsys_dump->proc~tem_varsys_dump_single interface~tem_varsys_dump->proc~tem_varsys_dump_vector proc~hvs_ascii_write_header hvs_ascii_write_header proc~hvs_ascii_write_header->interface~tem_varsys_out proc~tem_restart_writeheader tem_restart_writeHeader proc~tem_restart_writeheader->interface~tem_varsys_out proc~tem_restart_readheader tem_restart_readHeader proc~tem_restart_readheader->interface~tem_varsys_dump proc~hvs_asciispatial_init hvs_asciiSpatial_init proc~hvs_asciispatial_init->proc~hvs_ascii_write_header proc~hvs_ascii_init hvs_ascii_init proc~hvs_ascii_init->proc~hvs_ascii_write_header proc~tem_restart_closewrite tem_restart_closeWrite proc~tem_restart_closewrite->proc~tem_restart_writeheader proc~tem_restart_openwrite tem_restart_openWrite proc~tem_restart_openwrite->proc~tem_restart_writeheader proc~tem_load_restart tem_load_restart proc~tem_load_restart->proc~tem_restart_readheader proc~hvs_output_open hvs_output_open proc~hvs_output_open->proc~tem_restart_openwrite proc~hvs_output_close hvs_output_close proc~hvs_output_close->proc~tem_restart_closewrite proc~hvs_output_init hvs_output_init proc~hvs_output_init->proc~hvs_asciispatial_init proc~hvs_output_init->proc~hvs_ascii_init

Contents

Source Code


Source Code

  subroutine tem_varSys_out_single(me, conf, dumpVarPos, level)
    ! ---------------------------------------------------------------------------
    !> Variable system to write out
    type(tem_varSys_type), intent(in) :: me

    !> Aotus type handling the output to the file in lua format
    type(aot_out_type), intent(inout) :: conf

    !> Position of variables to dump
    integer, optional, intent(in) :: dumpVarPos(:)

    !> to dump varSys with key or without key
    integer, optional, intent(in) :: level
    ! ---------------------------------------------------------------------------
    integer :: iVar
    ! number of variables to be dumped (nVals or nVars)
    integer :: nVarDump, pos, level_loc, nScalars, nStateVars
    integer, allocatable :: dumpVarPos_loc(:)
    ! --------------------------------------------------------------------------
    if (present(level)) then
      level_loc = level
    else
      level_loc = 0
    end if

    ! dumpVarPos is present, then dump only variable at this position in varSys
    if (present(dumpVarPos)) then
      nVarDump = size(dumpVarPos)
      allocate(dumpVarPos_loc(nVarDump))
      dumpVarPos_loc = dumpVarPos
      nStateVars = nVarDump
      nScalars = sum(me%method%val(dumpVarPos_loc(:))%nComponents)
    else
      nVarDump = me%varname%nVals
      allocate(dumpVarPos_loc(nVarDump))
      dumpVarPos_loc = me%method%val(1:nVarDump)%myPos
      nStateVars = me%nStateVars
      nScalars = me%nScalars
    end if


    if( level_loc == 0) then
      call aot_out_open_table( put_conf = conf, tname = 'varsys' )
    else
      call aot_out_open_table( put_conf = conf )
    end if

    call aot_out_val( put_conf = conf, val = trim(me%SystemName),              &
      &               vname = 'systemname')

    call aot_out_open_table( put_conf = conf, tname = 'variable' )
    do iVar = 1, nVarDump
      call aot_out_open_table( put_conf = conf )

      pos = dumpVarPos_loc(iVar)

      call aot_out_val( put_conf = conf,                                       &
        &               val      = trim(me%varname%val(pos)),                  &
        &               vname    = 'name' )
      call aot_out_val( put_conf = conf,                                       &
        &               val      = me%method%val(pos)%nComponents,             &
        &               vname    = 'ncomponents' )

      !call aot_out_val( put_conf = conf,                                       &
      !  &               val      = me%method%val(pos)%myPos,                   &
      !  &               vname    = 'mypos' )

      if (allocated(me%method%val(pos)%state_varPos)) then
        if (size(me%method%val(pos)%state_varPos)>0) then
          call aot_out_val( put_conf = conf,                                   &
            &               val      = me%method%val(pos)%state_varPos,        &
            &               vname    = 'state_varpos' )
        end if
      end if

      !if (me%method%val(pos)%nInputs > 0) then
      !  call aot_out_val( put_conf = conf,                                    &
      !    &               val      = me%method%val(pos)%input_varPos,         &
      !    &               vname    = 'input_varPos' )
      !end if

      call aot_out_close_table( put_conf = conf )
    end do

    call aot_out_close_table( put_conf = conf )
    call aot_out_val( put_conf = conf, val = nScalars, vname = 'nScalars' )
    call aot_out_val( put_conf = conf, val = nStateVars, vname = 'nStateVars' )
    call aot_out_val( put_conf = conf, val = me%nAuxScalars, &
      & vname = 'nAuxScalars' )
    call aot_out_val( put_conf = conf, val = me%nAuxVars, vname = 'nAuxVars' )
    call aot_out_close_table( put_conf = conf )

  end subroutine tem_varSys_out_single