hvs_vtk_write_varSys Subroutine

public subroutine hvs_vtk_write_varSys(vtk_file, varsys, varpos)

Convert the provided variable system data into celldata description in the given vtk files.

Arguments

Type IntentOptional Attributes Name
type(hvs_vtk_file_type), intent(inout) :: vtk_file

Output info for vtu_output.

type(tem_varSys_type), intent(in) :: varsys

Description of the available variable system to get the given varnames from.

integer, intent(in) :: varpos(:)

List of variable positions that should be written into the vtk output.

If this is not provided, all variables from the varsys will be written to the vtk file.


Calls

proc~~hvs_vtk_write_varsys~2~~CallsGraph proc~hvs_vtk_write_varsys~2 hvs_vtk_write_varSys proc~hvs_vtk_write_cd_header hvs_vtk_write_cd_Header proc~hvs_vtk_write_varsys~2->proc~hvs_vtk_write_cd_header

Contents

Source Code


Source Code

  subroutine hvs_vtk_write_varSys(vtk_file, varsys, varpos)
    !> Output info for vtu_output.
    type(hvs_vtk_file_type), intent(inout) :: vtk_file

    !> Description of the available variable system to get the given varnames
    !! from.
    type(tem_varSys_type), intent(in) :: varsys

    !> List of variable positions that should be written into the vtk output.
    !!
    !! If this is not provided, all variables from the varsys will be written
    !! to the vtk file.
    integer, intent(in) :: varpos(:)
    ! ----------------------------------------------------------------------!
    character :: linebreak
    character(len=PathLen) :: scalars
    character(len=PathLen) :: vectors
    integer :: scal_count, vect_count
    integer :: iVar, ipos
    ! ----------------------------------------------------------------------!

    linebreak = new_line('x')

    scalars = ''
    vectors = ''
    scal_count = 0
    vect_count = 0

    do iVar=1,size(varpos)
      ipos = varpos(iVar)
      if (varsys%method%val(ipos)%nComponents == 1) then
        write(scalars, '(a)') adjustl(trim(scalars)//' ' &
          &                   // trim(varSys%varname%val(iPos)))
        scal_count = scal_count + 1
      else
        write(vectors, '(a)') adjustl(trim(vectors)//' ' &
          &                   // trim(varSys%varname%val(iPos)))
        vect_count = vect_count + 1
      end if
    end do

    if (scal_count > 0) then
      write(scalars, '(a)') ' Scalars="'//trim(scalars)//'"'
    end if
    if (vect_count > 0) then
      write(vectors, '(a)') ' Vectors="'//trim(vectors)//'"'
    end if

    if (scal_count+vect_count > 0) then
      call hvs_vtk_write_cd_Header( vtk_file     = vtk_file,        &
        &                           celldata_str = trim(scalars)    &
        &                                          // trim(vectors) )

      vtk_file%has_celldata = .true.
    end if

  end subroutine hvs_vtk_write_varSys