species_registry_t Derived Type

type, public :: species_registry_t

Object-oriented species registry container for cleaner access.


Components

Type Visibility Attributes Name Initial
character(len=name_len), public, allocatable :: name(:)
integer, public :: nspecies = 0

Type-Bound Procedures

procedure, public :: index_of => registry_index_of

  • private function registry_index_of(this, target) result(idx)

    Bound procedure to find the index of a species from the registry instance.

    Arguments

    Type IntentOptional Attributes Name
    class(species_registry_t), intent(in) :: this

    The species registry instance.

    character(len=*), intent(in) :: target

    The target species name to lookup.

    Return Value integer

procedure, public :: require_index => registry_require_index

  • private function registry_require_index(this, target, owner) result(idx)

    Bound procedure to find the index of a species, raising a fatal error if it is missing.

    Arguments

    Type IntentOptional Attributes Name
    class(species_registry_t), intent(in) :: this

    The species registry instance.

    character(len=*), intent(in) :: target

    The target species name to require.

    character(len=*), intent(in) :: owner

    The calling subsystem module name.

    Return Value integer

Source Code

   type :: species_registry_t
      integer :: nspecies = 0                            !< Number of registered species.
      character(len=name_len), allocatable :: name(:)    !< Array of registered species names.
   contains
      procedure :: index_of => registry_index_of
      procedure :: require_index => registry_require_index
   end type species_registry_t