hex_coordinates Module

Defining special 3D coordinates for honeycomb lattices


Uses

  • module~~hex_coordinates~~UsesGraph module~hex_coordinates hex_coordinates assert_m assert_m module~hex_coordinates->assert_m

Used by

  • module~~hex_coordinates~~UsedByGraph module~hex_coordinates hex_coordinates module~hex_geometries hex_geometries module~hex_geometries->module~hex_coordinates module~hex_neighbors hex_neighbors module~hex_neighbors->module~hex_coordinates module~honeyplots honeyplots module~honeyplots->module~hex_coordinates module~honeyplots->module~hex_neighbors module~xy_coordinates xy_coordinates module~honeyplots->module~xy_coordinates module~xy_neighbors xy_neighbors module~honeyplots->module~xy_neighbors module~honeytools honeytools module~honeytools->module~hex_coordinates module~honeytools->module~hex_geometries module~honeytools->module~hex_neighbors module~honeytools->module~xy_coordinates module~honeytools->module~xy_neighbors module~xy_coordinates->module~hex_coordinates module~xy_neighbors->module~xy_coordinates

Interfaces

public interface hex

constructor override

  • private pure function new_hex_cubic(q, r, s) result(H)

    Safe cubic constructor for the hex type featuring an assertion on input coordinates before the initialization of the object

    Arguments

    Type IntentOptional Attributes Name
    integer, intent(in) :: q
    integer, intent(in) :: r
    integer, intent(in) :: s

    Return Value type(hex)

  • private pure function new_hex_axial(q, r) result(H)

    Axial cubic constructor for the hex type [s would be computed internally]

    Arguments

    Type IntentOptional Attributes Name
    integer, intent(in) :: q
    integer, intent(in) :: r

    Return Value type(hex)

public interface operator(==)

equality overload

  • private pure elemental function eq_hex(A, B) result(isequal)

    Equality overload for hex type

    Arguments

    Type IntentOptional Attributes Name
    type(hex), intent(in) :: A
    type(hex), intent(in) :: B

    Return Value logical

public interface operator(/=)

inequality overload

  • private pure elemental function neq_hex(A, B) result(notequal)

    Inequality overload for hex type

    Arguments

    Type IntentOptional Attributes Name
    type(hex), intent(in) :: A
    type(hex), intent(in) :: B

    Return Value logical

public interface operator(+)

addition overload

  • private pure elemental function add_hex(A, B) result(C)

    Addition overload for hex type

    Arguments

    Type IntentOptional Attributes Name
    type(hex), intent(in) :: A
    type(hex), intent(in) :: B

    Return Value type(hex)

public interface operator(-)

subtraction overload

  • private pure elemental function sub_hex(A, B) result(C)

    Subtraction overload for hex type

    Arguments

    Type IntentOptional Attributes Name
    type(hex), intent(in) :: A
    type(hex), intent(in) :: B

    Return Value type(hex)

public interface operator(*)

product overload

  • private pure elemental function rhs_hex(A, k) result(C)

    Right scale overload for hex type

    Arguments

    Type IntentOptional Attributes Name
    type(hex), intent(in) :: A
    integer, intent(in) :: k

    Return Value type(hex)

  • private pure elemental function lhs_hex(k, B) result(C)

    Left scale overload for hex type

    Arguments

    Type IntentOptional Attributes Name
    integer, intent(in) :: k
    type(hex), intent(in) :: B

    Return Value type(hex)

  • private pure elemental function dot_hex(A, B) result(C)

    Dot overload for hex type

    Arguments

    Type IntentOptional Attributes Name
    type(hex), intent(in) :: A
    type(hex), intent(in) :: B

    Return Value integer


Derived Types

type, public ::  hex

cubic coordinates for hexagonal tiles

Components

Type Visibility Attributes Name Initial
integer, public :: q

constrained by q+r+s==0

integer, public :: r

constrained by q+r+s==0

integer, public :: s

constrained by q+r+s==0

Constructor

constructor override

private pure function new_hex_cubic (q, r, s)

Safe cubic constructor for the hex type featuring an assertion on input coordinates before the initialization of the object

private pure function new_hex_axial (q, r)

Axial cubic constructor for the hex type [s would be computed internally]


Functions

public pure function hex_norm(H) result(n)

Taxicab norm from hex coordinates

Arguments

Type IntentOptional Attributes Name
type(hex), intent(in) :: H

Return Value integer

public pure function hex_distance(A, B) result(d)

Taxicab distance of hex coordinates

Arguments

Type IntentOptional Attributes Name
type(hex), intent(in) :: A
type(hex), intent(in) :: B

Return Value integer

private pure function new_hex_cubic(q, r, s) result(H)

Safe cubic constructor for the hex type featuring an assertion on input coordinates before the initialization of the object

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: q
integer, intent(in) :: r
integer, intent(in) :: s

Return Value type(hex)

private pure function new_hex_axial(q, r) result(H)

Axial cubic constructor for the hex type [s would be computed internally]

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: q
integer, intent(in) :: r

Return Value type(hex)

private pure elemental function eq_hex(A, B) result(isequal)

Equality overload for hex type

Arguments

Type IntentOptional Attributes Name
type(hex), intent(in) :: A
type(hex), intent(in) :: B

Return Value logical

private pure elemental function neq_hex(A, B) result(notequal)

Inequality overload for hex type

Arguments

Type IntentOptional Attributes Name
type(hex), intent(in) :: A
type(hex), intent(in) :: B

Return Value logical

private pure elemental function add_hex(A, B) result(C)

Addition overload for hex type

Arguments

Type IntentOptional Attributes Name
type(hex), intent(in) :: A
type(hex), intent(in) :: B

Return Value type(hex)

private pure elemental function sub_hex(A, B) result(C)

Subtraction overload for hex type

Arguments

Type IntentOptional Attributes Name
type(hex), intent(in) :: A
type(hex), intent(in) :: B

Return Value type(hex)

private pure elemental function rhs_hex(A, k) result(C)

Right scale overload for hex type

Arguments

Type IntentOptional Attributes Name
type(hex), intent(in) :: A
integer, intent(in) :: k

Return Value type(hex)

private pure elemental function lhs_hex(k, B) result(C)

Left scale overload for hex type

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: k
type(hex), intent(in) :: B

Return Value type(hex)

private pure elemental function dot_hex(A, B) result(C)

Dot overload for hex type

Arguments

Type IntentOptional Attributes Name
type(hex), intent(in) :: A
type(hex), intent(in) :: B

Return Value integer


Subroutines

public impure elemental subroutine hex_print(H, unit, quiet)

Pretty print of hex coordinates

Arguments

Type IntentOptional Attributes Name
type(hex), intent(in) :: H
integer, intent(in), optional :: unit

default = $stdout

logical, intent(in), optional :: quiet

default = .false.