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~2~~CallsGraph proc~tem_varsys_out_single~2 tem_varSys_out_single proc~aot_out_open_table aot_out_open_table proc~tem_varsys_out_single~2->proc~aot_out_open_table proc~aot_out_val aot_out_val proc~tem_varsys_out_single~2->proc~aot_out_val proc~aot_out_close_table aot_out_close_table proc~tem_varsys_out_single~2->proc~aot_out_close_table

Called by

proc~~tem_varsys_out_single~2~~CalledByGraph proc~tem_varsys_out_single~2 tem_varSys_out_single proc~tem_varsys_out_vector~2 tem_varSys_out_vector proc~tem_varsys_out_vector~2->proc~tem_varsys_out_single~2 interface~tem_varsys_out~2 tem_varSys_out interface~tem_varsys_out~2->proc~tem_varsys_out_single~2 interface~tem_varsys_out~2->proc~tem_varsys_out_vector~2 proc~tem_varsys_dump_single~2 tem_varSys_dump_single proc~tem_varsys_dump_single~2->proc~tem_varsys_out_single~2 proc~tem_varsys_dump_vector~2 tem_varSys_dump_vector proc~tem_varsys_dump_vector~2->proc~tem_varsys_out_vector~2 interface~tem_varsys_dump~2 tem_varSys_dump interface~tem_varsys_dump~2->proc~tem_varsys_dump_single~2 interface~tem_varsys_dump~2->proc~tem_varsys_dump_vector~2

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