Initialize the type for VTK format
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(hvs_vtk_file_type), | intent(inout) | :: | vtk_file |
The file description to open. |
||
type(hvs_vtk_config_type), | intent(in) | :: | vtk_config |
User specified settings for the output |
||
character(len=*), | intent(in) | :: | basename |
Basename for the output file, rank and suffix will be appended as needed. |
||
type(tem_comm_env_type), | intent(in) | :: | proc |
Parallel environment to use for the output. |
subroutine hvs_vtk_init(vtk_file, vtk_config, basename, proc) ! --------------------------------------------------------------------------! !> The file description to open. type(hvs_vtk_file_type), intent(inout) :: vtk_file !> User specified settings for the output type(hvs_vtk_config_type), intent(in) :: vtk_config !> Basename for the output file, rank and suffix will be appended as !! needed. character(len=*), intent(in) :: basename !> Parallel environment to use for the output. type(tem_comm_env_type), intent(in) :: proc ! --------------------------------------------------------------------------! character(len=PathLen) :: headerline character :: linebreak character(len=labelLen) :: byte_order logical :: pvd_opened_already ! --------------------------------------------------------------------------! ! Copy the dataform for later usage without the vtk_config. vtk_file%dataform = vtk_config%dataform ! Assume no cell data, until actual celldata has been written. vtk_file%has_celldata = .false. ! Store the basename for later retrieval. vtk_file%basename = basename if ( isLittleEndian ) then byte_order = 'LittleEndian' else byte_order = 'BigEndian' end if ! Write pvtu file only when nProc > 1 vtk_file%write_pvtu = ( (proc%comm_size > 1) & & .and. (proc%rank == 0) ) ! Write PVD file header from root and only if it is not ! deactivated in output table vtk_file%write_pvd = (proc%rank == 0) .and. vtk_config%write_pvd if ( vtk_file%write_pvd ) then inquire( file = trim(basename)//'.pvd', & & opened = pvd_opened_already ) if (.not. pvd_opened_already) then ! Only need to open pvd file if it was not already opened ! before call tem_open( newunit = vtk_file%pvdunit, & & file = trim(basename)//'.pvd', & & action = 'write', & & status = 'replace', & & form = 'unformatted', & & access = 'stream' ) linebreak = new_line('x') write(headerline,'(a)') '<?xml version="1.0"?>' write(vtk_file%pvdunit) trim(headerline)//linebreak write(headerline,'(a)') '<VTKFile type="Collection" ' & & // 'version="0.1" byte_order="'& & //trim(byte_order)//'">' write(vtk_file%pvdunit) trim(headerline)//linebreak write(headerline,'(a)') '<Collection>' write(vtk_file%pvdunit) trim(headerline)//linebreak flush(vtk_file%pvdunit) else ! PVD file already opened, get the unit it is connected to. inquire( file = trim(basename)//'.pvd', & & number = vtk_file%pvdunit ) end if end if end subroutine hvs_vtk_init