hvs_output_open Subroutine

public subroutine hvs_output_open(out_file, mesh, varsys, time, subtree)

Open the output for a given mesh.

This writes the mesh data to the output files. Subsequently it can then be enriched by restart information.

Arguments

Type IntentOptional Attributes Name
type(hvs_output_file_type), intent(inout) :: out_file
type(treelmesh_type), intent(in) :: mesh

Mesh of the data to visualize.

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

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

type(tem_time_type), intent(in), optional :: time

Time information.

If this is present, the filename will be built with a time stamp and the time point information is written into the vtu file.

type(tem_subTree_type), intent(inout), optional :: subtree

Optional restriction of the elements to output.


Source Code

  subroutine hvs_output_open(out_file, mesh, varsys, time, subtree )
    ! --------------------------------------------------------------------------!
    type(hvs_output_file_type), intent(inout) :: out_file

    !> Mesh of the data to visualize.
    type(treelmesh_type), intent(in) :: mesh

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

    !> Optional restriction of the elements to output.
    type(tem_subtree_type), optional, intent(inout) :: subtree

    !> Time information.
    !!
    !! If this is present, the filename will be built with a time stamp and
    !! the time point information is written into the vtu file.
    type(tem_time_type), intent(in), optional :: time
    ! ----------------------------------------------------------------------!
    integer :: nElems
    ! ----------------------------------------------------------------------!
    if (present(subtree)) then
      nElems = subtree%nElems
    else
      nElems = mesh%nElems
    end if

    if (present(time)) then
      out_file%time = time
    else
      call tem_time_reset(out_file%time)
    end if

    select case(out_file%vis_kind)
    case(hvs_AsciiSpatial)
      call hvs_asciiSpatial_open( asciiSpatial = out_file%asciiSpatial, &
        &                         outProc      = out_file%proc,         &
        &                         time         = out_file%time,         &
        &                         varsys       = varsys,                &
        &                         varpos       = out_file%varpos,       &
        &                         nDofs        = out_file%nDofs         )
    case(hvs_Internal)
      ! prepare the header differently for using global tree and tracking
      ! subTree. For harvester format, prepare the header.
      if( present(subTree) ) then
        ! For harvester format, prepare the header
        ! Here we pass the tracking subTree and the global tree to the header
        ! In tem_restart_openWrite the subTree will be written to disk

        ! update the property bits according to the global mesh if this has
        ! changed
        call tem_updatePropertyBits( mesh, subTree )

        call tem_restart_openWrite(me      = out_file%restart,             &
          &                        tree    = mesh,                         &
          &                        timing  = out_file%time,                &
          &                        varSys  = varSys,                     &
          &                        subTree = subTree,                      &
          &                        label   = trim(out_file%basename)//'_'  )
      else
        call tem_restart_openWrite( me     = out_file%restart, &
          &                         tree   = mesh,             &
          &                         timing = out_file%time,    &
          &                         varSys = varSys          )
      end if ! present subTree
    case(hvs_VTK)
      call hvs_vtk_open( vtk_file = out_file%vtk,      &
        &                timeform = out_file%timeform, &
        &                proc     = out_file%proc,     &
        &                time     = out_file%time      )

      call hvs_vtk_write_meshdata( vtk_file = out_file%vtk,  &
        &                          vrtx     = out_file%vrtx, &
        &                          nElems   = nElems         )

      call hvs_vtk_write_varSys( vtk_file = out_file%vtk,   &
        &                        varsys   = varsys,         &
        &                        varpos   = out_file%varpos )
    end select

  end subroutine hvs_output_open