datastructs_lists_dynamical_list_mod Module

This module implements a dynamical list, in which elements can be added or removed dynamically. It assumes that there is a maximum size, and elements can be added or removed up to that size. Example:

program test_dynamical_list
    use datastructs_fortran
    use kinds_mod
    implicit none
    type(dynamical_list_t) :: my_list
    integer(kind=i4) :: i
    call my_list%init(10)
    do i = 1, 10
        call my_list%add(i)
    end do
    call my_list%print()
    call my_list%remove(5)
    call my_list%print()
end program test_dynamical_list

Uses

  • module~~datastructs_lists_dynamical_list_mod~~UsesGraph module~datastructs_lists_dynamical_list_mod datastructs_lists_dynamical_list_mod module~datastructs_kinds_mod datastructs_kinds_mod module~datastructs_lists_dynamical_list_mod->module~datastructs_kinds_mod iso_fortran_env iso_fortran_env module~datastructs_kinds_mod->iso_fortran_env

Used by

  • module~~datastructs_lists_dynamical_list_mod~~UsedByGraph module~datastructs_lists_dynamical_list_mod datastructs_lists_dynamical_list_mod module~datastructs_lists_mod datastructs_lists_mod module~datastructs_lists_mod->module~datastructs_lists_dynamical_list_mod module~datastructs_mod datastructs_mod module~datastructs_mod->module~datastructs_lists_mod module~datastructs_samplers_rejection_maxheap_composition_mod datastructs_samplers_rejection_maxheap_composition_mod module~datastructs_samplers_rejection_maxheap_composition_mod->module~datastructs_lists_mod module~datastructs_samplers_rejection_maxheap_mod datastructs_samplers_rejection_maxheap_mod module~datastructs_samplers_rejection_maxheap_composition_mod->module~datastructs_samplers_rejection_maxheap_mod module~datastructs_samplers_rejection_maxheap_mod->module~datastructs_lists_mod module~datastructs_samplers_rejection_maxheap_two_classes_mod datastructs_samplers_rejection_maxheap_two_classes_mod module~datastructs_samplers_rejection_maxheap_two_classes_mod->module~datastructs_lists_mod module~datastructs_samplers_rejection_maxheap_two_classes_mod->module~datastructs_samplers_rejection_maxheap_mod module~datastructs_samplers_rejection_mod datastructs_samplers_rejection_mod module~datastructs_samplers_rejection_mod->module~datastructs_lists_mod module~datastructs_samplers_rejection_two_classes_mod datastructs_samplers_rejection_two_classes_mod module~datastructs_samplers_rejection_two_classes_mod->module~datastructs_lists_mod module~datastructs_samplers_rejection_two_classes_mod->module~datastructs_samplers_rejection_mod proc~choose_sampler choose_sampler proc~choose_sampler->module~datastructs_samplers_rejection_maxheap_composition_mod proc~choose_sampler->module~datastructs_samplers_rejection_maxheap_mod proc~choose_sampler->module~datastructs_samplers_rejection_maxheap_two_classes_mod proc~choose_sampler->module~datastructs_samplers_rejection_mod proc~choose_sampler->module~datastructs_samplers_rejection_two_classes_mod

Interfaces

public interface dynamical_list

Constructor for a dynamical list

  • private function dynamical_list_new(list) result(this)

    Create a new dynamical list Input: list - an array of integers Output: a new dynamical list

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=i4), intent(in) :: list(:)

    Return Value type(dynamical_list_t)


Derived Types

type, public ::  dynamical_list_t

List of integers with a given maximum fixed size The first index is always 1, and filled up to n_used It contains routines for managing the list

Components

Type Visibility Attributes Name Initial
integer(kind=i4), public :: n = 0
integer(kind=i4), public :: n_used = 0
integer(kind=i4), public, allocatable :: list(:)

Finalizations Procedures

final :: finalize_dynamical_list

Type-Bound Procedures

procedure, public :: init => dynamical_list_init
procedure, public :: reset => dynamical_list_reset
procedure, public :: print => dynamical_list_print
procedure, public :: expand => dynamical_list_expand
procedure, public :: trim => dynamical_list_trim
procedure, public :: last => dynamical_list_last
procedure, public :: count => dynamical_list_count
generic, public :: add => dynamical_list_add_element, dynamical_list_add_array
generic, public :: remove => dynamical_list_remove_position, dynamical_list_remove_position_array, dynamical_list_remove_position_range
generic, public :: assignment(=) => dynamical_list_create_from_array
procedure, public :: get => dynamical_list_get
procedure, public :: sum => dynamical_list_sum