This routine write variable labels into buffer and this buffer is written into the second line of ascii result file for spatial (asciiSpatial) and transient (ascii) tracking.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_varSys_type), | intent(in) | :: | varSys |
solver-provided variable systems |
||
integer, | intent(in) | :: | varPos(:) |
Position of variables to dump in varSys |
||
integer, | intent(in) | :: | nDofs |
The number of dofs for each scalar variable of the equation system |
||
logical, | intent(in) | :: | isReduce |
is spatial Reduction active |
buffer containing first column of the header
function getHeader( varSys, varPos, nDofs, isReduce ) result(buffer)
! ---------------------------------------------------------------------------
!> solver-provided variable systems
type(tem_varSys_type), intent(in) :: varSys
!> Position of variables to dump in varSys
integer, intent(in) :: varPos(:)
!> The number of dofs for each scalar variable of the equation system
integer, intent(in) :: nDofs
!> is spatial Reduction active
logical, intent(in) :: isReduce
!> buffer containing first column of the header
character(len=OutLen) :: buffer
! ---------------------------------------------------------------------------
!local variable
character(len=pathLen) :: buffer2
integer :: iVar, iComp, iDof
character(len=4) :: reduceChar
! ---------------------------------------------------------------------------
buffer = ''
! If reduction is applied to this variable, append a ending to its label
if( isReduce ) then
reduceChar = '_red'
else
reduceChar = ''
end if
do iVar = 1, size(varPos)
if (nDofs == 1 .or. isReduce) then
if ( varSys%method%val( varPos(iVar) )%nComponents > 1 ) then
! when variable has more that one componenets, append icomp to the end
! of its label
do iComp = 1, varSys%method%val( varPos(iVar) )%nComponents
write( buffer2, '(a,i2.2)' ) &
& trim(varSys%varName%val(varPos(iVar)))//trim(reduceChar)//'_',&
& iComp
if ( len(trim(buffer)) + 25 > OutLen ) then
call tem_abort( errorMsg = &
& 'max char length for header exceeded, use vtk or '// &
& 'harvester for tracking. Restarting will result in '// &
& 'res file without header.' )
end if
write(buffer, '(a,1x,a24)') trim(buffer), trim(buffer2)
end do
else
write(buffer, '(a,1x,a24)') trim(buffer), &
& trim(varSys%varName%val(varPos(iVar)))//trim(reduceChar)
end if
else
do iDof = 1, nDofs
if ( varSys%method%val( varPos(iVar) )%nComponents > 1 ) then
! when variable has more that one componenets, append icomp to the end
! of its label
do iComp = 1, varSys%method%val( varPos(iVar) )%nComponents
write( buffer2, '(a,i3.3,a,i2.2)' ) &
& trim(varSys%varName%val(varPos(iVar)))//trim(reduceChar) &
& //'_d', iDof, '_c', iComp
write(buffer, '(a,1x,a24)') trim(buffer), trim(buffer2)
end do
else
write(buffer, '(a,1x,a24,i3.3)') trim(buffer), &
& trim(varSys%varName%val(varPos(iVar)))//trim(reduceChar) &
& //'_d', iDof
end if
end do
end if
end do
end function getHeader