getHeader Function

public function getHeader(varSys, varPos, nDofs, isReduce) result(buffer)

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.

Arguments

Type IntentOptional 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

Return Value character(len=OutLen)

buffer containing first column of the header


Calls

proc~~getheader~~CallsGraph proc~getheader getHeader proc~tem_abort tem_abort proc~getheader->proc~tem_abort mpi_abort mpi_abort proc~tem_abort->mpi_abort

Called by

proc~~getheader~~CalledByGraph proc~getheader getHeader proc~hvs_ascii_open hvs_ascii_open proc~hvs_ascii_open->proc~getheader proc~hvs_asciispatial_open hvs_asciiSpatial_open proc~hvs_asciispatial_open->proc~getheader proc~hvs_ascii_init hvs_ascii_init proc~hvs_ascii_init->proc~hvs_ascii_open proc~hvs_output_open hvs_output_open proc~hvs_output_open->proc~hvs_asciispatial_open proc~hvs_output_init hvs_output_init proc~hvs_output_init->proc~hvs_ascii_init proc~tem_tracker tem_tracker proc~tem_tracker->proc~hvs_output_open proc~tem_init_tracker tem_init_tracker proc~tem_init_tracker->proc~hvs_output_init

Contents

Source Code


Source Code

  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