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
Type | Intent | Optional | 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 |
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