Creates a variable map. Therefore it looks for the variables stored in varname in the varSys. If found, the name and the corresponding position in the varSys is added to the resultung varMap.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | varName(:) |
array of variable labels |
||
type(tem_varSys_type), | intent(in) | :: | varSys |
variable system to look for varName |
||
type(tem_varMap_type), | intent(out) | :: | varMap |
Contains position of varname in given varSys |
subroutine tem_create_varMap( varName, varSys, varMap )
! --------------------------------------------------------------------------
!> array of variable labels
character(len=*), intent(in) :: varName(:)
!> variable system to look for varName
type(tem_varSys_type), intent(in) :: varSys
!> Contains position of varname in given varSys
type(tem_varMap_type), intent(out) :: varMap
! --------------------------------------------------------------------------
integer :: varPos, iVar
! --------------------------------------------------------------------------
write(logUnit(10),*) 'Create varMap:'
call init(varMap%varName)
call init(varMap%varPos)
do iVar = 1, size(varName)
varPos = PositionOfVal( me = varSys%varName, &
& val = trim(varName(iVar)) )
if (varPos > 0) then
write(logUnit(10),"(A,I0)") 'Position of ' // trim(varName(iVar)) &
& // ': ', varPos
call append( me = varMap%varPos, val = varPos )
call append( me = varMap%varname, val = varName(iVar) )
else
write(logUnit(5),*) 'Variable ' // trim(varName(iVar)) // &
& ' not found in varSys'
end if
end do
call truncate(varMap%varName)
call truncate(varMap%varPos)
varMap%nScalars = sum( varSys%method%val( &
& varMap%varPos%val(:) )%nComponents )
write(logUnit(10),"(A,I0)") 'nScalars in varMap: ', varMap%nScalars
end subroutine tem_create_varMap