key_morton Derived Type

type, public, extends(key_base) :: key_morton

type~~key_morton~~InheritsGraph type~key_morton key_morton type~key_base key_base type~key_base->type~key_morton
Help


Morton (Z-order) key class to identify a node.


Source Code


Components

TypeVisibility AttributesNameInitial
integer(kind=I8P), public :: key =0_I8P

The key.


Type-Bound Procedures

procedure, public, pass(self) :: hash

Hash the key.

  • private elemental function hash(self, buckets_number) result(bucket)

    Hash the key.

    Arguments

    Type IntentOptional AttributesName
    class(key_base), intent(in) :: self

    The key.

    integer(kind=I4P), intent(in) :: buckets_number

    Buckets number.

    Return Value integer(kind=I4P)

    Bucket index corresponding to the key.

procedure, public, pass(self) :: id

Return the id.

  • private elemental function id(self)

    Return the id.

    Arguments

    Type IntentOptional AttributesName
    class(key_base), intent(in) :: self

    The key.

    Return Value integer(kind=I8P)

    Unique key id.

procedure, public, nopass :: is_key_allowed

Typeguard for used key.

  • public elemental function is_key_allowed(key)

    Typeguard for used key.

    Arguments

    Type IntentOptional AttributesName
    class(*), intent(in) :: key

    The key ID.

    Return Value logical

    Check result.

procedure, public, pass(self) :: set

Set the key.

  • private elemental subroutine set(self, key, buckets_number)

    Set the key.

    Arguments

    Type IntentOptional AttributesName
    class(key_base), intent(inout) :: self

    The key.

    class(*), intent(in) :: key

    The key value.

    integer(kind=I4P), intent(in), optional :: buckets_number

    Buckets number.

generic, public :: operator(==) => is_equal

Overloading == operator.

  • private elemental function is_equal(lhs, rhs)

    Implement == operator.

    Arguments

    Type IntentOptional AttributesName
    class(key_morton), intent(in) :: lhs

    Left hand side.

    class(*), intent(in) :: rhs

    Rigth hand side.

    Return Value logical

procedure, public, pass(self) :: destroy

Destroy the key.

  • private elemental subroutine destroy(self)

    Destroy the key.

    Arguments

    Type IntentOptional AttributesName
    class(key_morton), intent(inout) :: self

    The key.

procedure, public, pass(self) :: stringify

Return a string representation of the key.

  • private pure function stringify(self) result(str_key)

    Return a string representation of the key.

    Arguments

    Type IntentOptional AttributesName
    class(key_morton), intent(in) :: self

    The key.

    Return Value character(len=:), allocatable

    The key stringified.

procedure, private, pass(lhs) :: is_equal

Implement == operator.

  • private elemental function is_equal(lhs, rhs)

    Implement == operator.

    Arguments

    Type IntentOptional AttributesName
    class(key_morton), intent(in) :: lhs

    Left hand side.

    class(*), intent(in) :: rhs

    Rigth hand side.

    Return Value logical

Source Code

type, extends(key_base) :: key_morton
  !< Morton (Z-order) **key** class to identify a node.
  integer(I8P) :: key=0_I8P !< The key.
  contains
    ! public deferred methods
    procedure, pass(self) :: destroy   !< Destroy the key.
    procedure, pass(self) :: stringify !< Return a string representation of the key.
    ! private deferred methods
    procedure, pass(lhs), private :: is_equal !< Implement `==` operator.
endtype key_morton