standard_header_type Derived Type

type, public :: standard_header_type

A header for files and output.

This is a type rather than a function so that we can use a consistent date/time and UUID across different files by reusing the same object.

Call standard_header_type::to_string to get the header as text.


Source Code


Type Visibility Attributes Name Initial
character(len=:), public, allocatable :: date_time
character(len=uuid_len), public :: run_uuid


public interface standard_header_type

  • public function make_standard_header() result(this)

    Constructor for standard_header_type.

    Stores the date using date_is08601 and the UUID using simulation_run_uuid. Note that this may involve collective communication, so all processors should be involved in construction.



    Return Value type(standard_header_type)

Type-Bound Procedures

procedure, public, :: to_string => standard_header_to_string

  • public function standard_header_to_string(this, comment_character, file_description) result(header)

    Return a multiline string with a standard header of the form:

    Created by GS2 at 2021-02-02T15:01:26.370Z+00:00
    Run UUID: 36310A48-6A73-4941-9366-410C5731027A
    GK_SYSTEM: ubuntu
    Compiler: gfortran
    <optional file description>

    If \p comment_character is passed, it is prepended to the start of each line. Note that it is used as-is, including any whitespace.


    Type IntentOptional Attributes Name
    class(standard_header_type), intent(in) :: this
    character(len=*), intent(in), optional :: comment_character

    Optional character(s) to start each line. Whitespace is not stripped or added. Default is empty string

    character(len=*), intent(in), optional :: file_description

    Optional file description. Treated as a single line, that is, new lines in this string will not begin with comment_character

    Return Value character(len=:), allocatable

Source Code

  type :: standard_header_type
    character(:), allocatable :: date_time
    character(len=uuid_len) :: run_uuid
    procedure :: to_string => standard_header_to_string
  end type standard_header_type