diagnostics_ascii.f90 Source File


Contents

Source Code


Source Code

! DO NOT EDIT THIS FILE
! This file has been automatically generated using generate_diagnostics_ascii.py

!> A module for managing text-based output files
!> for the new diagnostics module
module diagnostics_ascii

!> Holds integers corresponding to the
!> ascii output units
type diagnostics_ascii_type
  integer :: out
  integer :: phase
  integer :: heat
  integer :: heat2
  integer :: vres
  integer :: lpc
  integer :: vres2
  integer :: cres
  integer :: parity
  integer :: jext
  integer :: eigenfunc
  logical :: write_to_out = .false.
  logical :: write_to_phase = .false.
  logical :: write_to_heat = .false.
  logical :: write_to_heat2 = .false.
  logical :: write_to_vres = .false.
  logical :: write_to_lpc = .false.
  logical :: write_to_vres2 = .false.
  logical :: write_to_cres = .false.
  logical :: write_to_parity = .false.
  logical :: write_to_jext = .false.
  logical :: write_to_eigenfunc = .false.
end type diagnostics_ascii_type

contains

!> Opens all enabled ascii output files and records
!> file units.
subroutine init_diagnostics_ascii(ascii_files)
  use file_utils, only: open_output_file
  type(diagnostics_ascii_type), intent(in out) :: ascii_files

  if (ascii_files%write_to_out) call open_output_file(ascii_files%out, '.out')
  if (ascii_files%write_to_phase) call open_output_file(ascii_files%phase, '.phase')
  if (ascii_files%write_to_heat) call open_output_file(ascii_files%heat, '.heat')
  if (ascii_files%write_to_heat2) call open_output_file(ascii_files%heat2, '.heat2')
  if (ascii_files%write_to_vres) call open_output_file(ascii_files%vres, '.vres')
  if (ascii_files%write_to_lpc) call open_output_file(ascii_files%lpc, '.lpc')
  if (ascii_files%write_to_vres2) call open_output_file(ascii_files%vres2, '.vres2')
  if (ascii_files%write_to_cres) call open_output_file(ascii_files%cres, '.cres')
  if (ascii_files%write_to_parity) call open_output_file(ascii_files%parity, '.parity')
  if (ascii_files%write_to_jext) call open_output_file(ascii_files%jext, '.jext')
  if (ascii_files%write_to_eigenfunc) call open_output_file(ascii_files%eigenfunc, '.eigenfunc')

end subroutine init_diagnostics_ascii

!> Closes all enabled ascii output files as given
!> by recorded file units.
subroutine finish_diagnostics_ascii(ascii_files)
  use file_utils, only: close_output_file
  type(diagnostics_ascii_type), intent(in out) :: ascii_files

  if (ascii_files%write_to_out) call close_output_file(ascii_files%out)
  if (ascii_files%write_to_phase) call close_output_file(ascii_files%phase)
  if (ascii_files%write_to_heat) call close_output_file(ascii_files%heat)
  if (ascii_files%write_to_heat2) call close_output_file(ascii_files%heat2)
  if (ascii_files%write_to_vres) call close_output_file(ascii_files%vres)
  if (ascii_files%write_to_lpc) call close_output_file(ascii_files%lpc)
  if (ascii_files%write_to_vres2) call close_output_file(ascii_files%vres2)
  if (ascii_files%write_to_cres) call close_output_file(ascii_files%cres)
  if (ascii_files%write_to_parity) call close_output_file(ascii_files%parity)
  if (ascii_files%write_to_jext) call close_output_file(ascii_files%jext)
  if (ascii_files%write_to_eigenfunc) call close_output_file(ascii_files%eigenfunc)

end subroutine finish_diagnostics_ascii

!> Flushes all enabled ascii output files as given
!> by recorded file units.
subroutine flush_output_files(ascii_files)
  type(diagnostics_ascii_type), intent(in out) :: ascii_files

  if (ascii_files%write_to_out) flush(ascii_files%out)
  if (ascii_files%write_to_phase) flush(ascii_files%phase)
  if (ascii_files%write_to_heat) flush(ascii_files%heat)
  if (ascii_files%write_to_heat2) flush(ascii_files%heat2)
  if (ascii_files%write_to_vres) flush(ascii_files%vres)
  if (ascii_files%write_to_lpc) flush(ascii_files%lpc)
  if (ascii_files%write_to_vres2) flush(ascii_files%vres2)
  if (ascii_files%write_to_cres) flush(ascii_files%cres)
  if (ascii_files%write_to_parity) flush(ascii_files%parity)
  if (ascii_files%write_to_jext) flush(ascii_files%jext)
  if (ascii_files%write_to_eigenfunc) flush(ascii_files%eigenfunc)

end subroutine flush_output_files

end module diagnostics_ascii