init_level_type Derived Type

type, private :: init_level_type

Define an type to represent an initialisation level. This uses a hack to approximate type extension without the boiler plate of extending an abstract type. Specifically, we offer a type bound change_level procedure which just calls a procedure pointer to implement the actual work to change the level, specific to each instance.


Contents

Source Code


Components

Type Visibility Attributes Name Initial
character(len=40), public :: name = 'init level name not set'
integer, public :: level = -1
integer, public :: debug_message_level = 1

Used to set the verbosity level at which this level reports debug messages.

procedure(change_level_specific_interface), private, pointer, nopass :: change_level_specific => null()
real, public, dimension(2) :: time_init = 0.

Type-Bound Procedures

procedure, public, :: generate_debug_message => init_level_generate_debug_message

  • private subroutine init_level_generate_debug_message(self, going_up)

    Produce the debug message associated with this level

    Arguments

    Type IntentOptional Attributes Name
    class(init_level_type), intent(in) :: self
    logical, intent(in) :: going_up

procedure, public, :: report_time => init_level_report_time

  • private subroutine init_level_report_time(self, unit)

    Report the time spent in init for this level

    Arguments

    Type IntentOptional Attributes Name
    class(init_level_type), intent(in) :: self
    integer, intent(in), optional :: unit

procedure, public, :: change_level => init_level_change_level

  • private function init_level_change_level(self, current, going_up) result(new_level)

    General wrapper to the init_level instance's specific change level method.

    Arguments

    Type IntentOptional Attributes Name
    class(init_level_type), intent(inout) :: self
    type(init_type), intent(in) :: current
    logical, intent(in) :: going_up

    Return Value integer

Source Code

  type :: init_level_type
     character(len=40) :: name = 'init level name not set'
     integer :: level = -1
     !> Used to set the verbosity level at which this
     !> level reports debug messages.
     integer :: debug_message_level = 1
     procedure(change_level_specific_interface), pointer, nopass, private :: change_level_specific => null()
     real, dimension(2) :: time_init = 0.
   contains
     procedure :: generate_debug_message => init_level_generate_debug_message
     procedure :: report_time => init_level_report_time
     procedure :: change_level => init_level_change_level
  end type init_level_type