(git:0de0cc2)
list.F
Go to the documentation of this file.
1 !--------------------------------------------------------------------------------------------------!
2 ! CP2K: A general program to perform molecular dynamics simulations !
3 ! Copyright 2000-2024 CP2K developers group <https://cp2k.org> !
4 ! !
5 ! SPDX-License-Identifier: GPL-2.0-or-later !
6 !--------------------------------------------------------------------------------------------------!
7 
8 ! **************************************************************************************************
9 !> \brief An array-based list which grows on demand.
10 !> When the internal array is full, a new array of twice the size will be
11 !> allocated and the items are copied over.
12 !>
13 !> This list can also be used as a stack.
14 !> Have look at list_push(), list_pop() and list_peek().
15 !> \note it's not possible to put all templates in a single module because this would lead to circular
16 !> dependencies (timer_env_type contains list_routinestat_type and list_callstackentry_type, and
17 !> list_timerenv_type contains timer_env_type)
18 !> \par History
19 !> 12.2012 first version [ole]
20 !> \author Ole Schuett
21 ! **************************************************************************************************
22 
23 
24 MODULE list
25 
26  USE timings_base_type, ONLY: callstack_entry_type, routine_report_type, routine_stat_type
27  USE list_callstackentry, ONLY: list_callstackentry_type, list_callstackentry_init, list_callstackentry_push,&
31  USE list_routinereport, ONLY: list_routinereport_type, list_routinereport_init, list_routinereport_push,&
41 
42 #include "../base/base_uses.f90"
43  IMPLICIT NONE
44 
45  PRIVATE
46  CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'list'
47 
48  PUBLIC :: list_init, list_isready, list_push, list_pop, list_peek, &
49  list_get, list_size, list_destroy
50 
51  PUBLIC :: list_timerenv_type
52  PUBLIC :: list_routinestat_type
53  PUBLIC :: list_routinereport_type
54  PUBLIC :: list_callstackentry_type
55 
56  INTERFACE list_init
57  MODULE PROCEDURE list_timerenv_init
58  MODULE PROCEDURE list_routinestat_init
59  MODULE PROCEDURE list_routinereport_init
60  MODULE PROCEDURE list_callstackentry_init
61  END INTERFACE
62 
63  INTERFACE list_isready
64  MODULE PROCEDURE list_timerenv_isready
65  MODULE PROCEDURE list_routinestat_isready
66  MODULE PROCEDURE list_routinereport_isready
67  MODULE PROCEDURE list_callstackentry_isready
68  END INTERFACE
69 
70  INTERFACE list_push
71  MODULE PROCEDURE list_timerenv_push
72  MODULE PROCEDURE list_routinestat_push
73  MODULE PROCEDURE list_routinereport_push
74  MODULE PROCEDURE list_callstackentry_push
75  END INTERFACE
76 
77  INTERFACE list_pop
78  MODULE PROCEDURE list_timerenv_pop
79  MODULE PROCEDURE list_routinestat_pop
80  MODULE PROCEDURE list_routinereport_pop
81  MODULE PROCEDURE list_callstackentry_pop
82  END INTERFACE
83 
84  INTERFACE list_peek
85  MODULE PROCEDURE list_timerenv_peek
86  MODULE PROCEDURE list_routinestat_peek
87  MODULE PROCEDURE list_routinereport_peek
88  MODULE PROCEDURE list_callstackentry_peek
89  END INTERFACE
90 
91  INTERFACE list_insert
92  MODULE PROCEDURE list_timerenv_insert
93  MODULE PROCEDURE list_routinestat_insert
94  MODULE PROCEDURE list_routinereport_insert
95  MODULE PROCEDURE list_callstackentry_insert
96  END INTERFACE
97 
98  INTERFACE list_set
99  MODULE PROCEDURE list_timerenv_set
100  MODULE PROCEDURE list_routinestat_set
101  MODULE PROCEDURE list_routinereport_set
102  MODULE PROCEDURE list_callstackentry_set
103  END INTERFACE
104 
105  INTERFACE list_get
106  MODULE PROCEDURE list_timerenv_get
107  MODULE PROCEDURE list_routinestat_get
108  MODULE PROCEDURE list_routinereport_get
109  MODULE PROCEDURE list_callstackentry_get
110  END INTERFACE
111 
112  INTERFACE list_del
113  MODULE PROCEDURE list_timerenv_del
114  MODULE PROCEDURE list_routinestat_del
115  MODULE PROCEDURE list_routinereport_del
116  MODULE PROCEDURE list_callstackentry_del
117  END INTERFACE
118 
119  INTERFACE list_clear
120  MODULE PROCEDURE list_timerenv_clear
121  MODULE PROCEDURE list_routinestat_clear
122  MODULE PROCEDURE list_routinereport_clear
123  MODULE PROCEDURE list_callstackentry_clear
124  END INTERFACE
125 
126  INTERFACE list_size
127  MODULE PROCEDURE list_timerenv_size
128  MODULE PROCEDURE list_routinestat_size
129  MODULE PROCEDURE list_routinereport_size
130  MODULE PROCEDURE list_callstackentry_size
131  END INTERFACE
132 
133  INTERFACE list_destroy
134  MODULE PROCEDURE list_timerenv_destroy
135  MODULE PROCEDURE list_routinestat_destroy
136  MODULE PROCEDURE list_routinereport_destroy
137  MODULE PROCEDURE list_callstackentry_destroy
138  END INTERFACE
139 
140 END MODULE list
An array-based list which grows on demand. When the internal array is full, a new array of twice the ...
subroutine, public list_callstackentry_push(list, value)
Appends the given value at the end of the list.
subroutine, public list_callstackentry_set(list, value, pos)
Assings the given value to the given position in the list. Thereby, the former value at that position...
subroutine, public list_callstackentry_del(list, pos)
Removes the value at the given position from the list.
integer function, public list_callstackentry_size(list)
Returns the current size of the list.
type(callstack_entry_type) function, public list_callstackentry_get(list, pos)
Returns the value at the given position from the list.
subroutine, public list_callstackentry_destroy(list)
Deallocated the internal data-structures of the given list. Caution: If the stored values are pointer...
subroutine, public list_callstackentry_insert(list, value, pos)
Inserts the given value at the givenn position within the list. Values which lay behind the insertion...
subroutine, public list_callstackentry_init(list, initial_capacity)
Allocates the internal data-structures of the given list. This has to be called before any of the oth...
type(callstack_entry_type) function, public list_callstackentry_pop(list)
Returns the last element in the list and removes it. Is equivialent to: value = list_callstackentry_g...
subroutine, public list_callstackentry_clear(list)
Removes all values from the list. The list itself is not deallocated.
type(callstack_entry_type) function, public list_callstackentry_peek(list)
Returns the last element in the list. Is equivalent to: list_callstackentry_get(list,...
logical function, public list_callstackentry_isready(list)
Test if the given list has been initialized.
An array-based list which grows on demand. When the internal array is full, a new array of twice the ...
subroutine, public list_routinereport_destroy(list)
Deallocated the internal data-structures of the given list. Caution: If the stored values are pointer...
integer function, public list_routinereport_size(list)
Returns the current size of the list.
logical function, public list_routinereport_isready(list)
Test if the given list has been initialized.
type(routine_report_type) function, pointer, public list_routinereport_peek(list)
Returns the last element in the list. Is equivalent to: list_routinereport_get(list,...
type(routine_report_type) function, pointer, public list_routinereport_pop(list)
Returns the last element in the list and removes it. Is equivialent to: value = list_routinereport_ge...
subroutine, public list_routinereport_clear(list)
Removes all values from the list. The list itself is not deallocated.
subroutine, public list_routinereport_set(list, value, pos)
Assings the given value to the given position in the list. Thereby, the former value at that position...
subroutine, public list_routinereport_init(list, initial_capacity)
Allocates the internal data-structures of the given list. This has to be called before any of the oth...
subroutine, public list_routinereport_del(list, pos)
Removes the value at the given position from the list.
subroutine, public list_routinereport_push(list, value)
Appends the given value at the end of the list.
subroutine, public list_routinereport_insert(list, value, pos)
Inserts the given value at the givenn position within the list. Values which lay behind the insertion...
type(routine_report_type) function, pointer, public list_routinereport_get(list, pos)
Returns the value at the given position from the list.
An array-based list which grows on demand. When the internal array is full, a new array of twice the ...
subroutine, public list_routinestat_init(list, initial_capacity)
Allocates the internal data-structures of the given list. This has to be called before any of the oth...
integer function, public list_routinestat_size(list)
Returns the current size of the list.
subroutine, public list_routinestat_set(list, value, pos)
Assings the given value to the given position in the list. Thereby, the former value at that position...
logical function, public list_routinestat_isready(list)
Test if the given list has been initialized.
subroutine, public list_routinestat_insert(list, value, pos)
Inserts the given value at the givenn position within the list. Values which lay behind the insertion...
subroutine, public list_routinestat_clear(list)
Removes all values from the list. The list itself is not deallocated.
type(routine_stat_type) function, pointer, public list_routinestat_pop(list)
Returns the last element in the list and removes it. Is equivialent to: value = list_routinestat_get(...
subroutine, public list_routinestat_push(list, value)
Appends the given value at the end of the list.
subroutine, public list_routinestat_destroy(list)
Deallocated the internal data-structures of the given list. Caution: If the stored values are pointer...
subroutine, public list_routinestat_del(list, pos)
Removes the value at the given position from the list.
type(routine_stat_type) function, pointer, public list_routinestat_peek(list)
Returns the last element in the list. Is equivalent to: list_routinestat_get(list,...
type(routine_stat_type) function, pointer, public list_routinestat_get(list, pos)
Returns the value at the given position from the list.
An array-based list which grows on demand. When the internal array is full, a new array of twice the ...
Definition: list_timerenv.F:20
integer function, public list_timerenv_size(list)
Returns the current size of the list.
type(timer_env_type) function, pointer, public list_timerenv_get(list, pos)
Returns the value at the given position from the list.
subroutine, public list_timerenv_init(list, initial_capacity)
Allocates the internal data-structures of the given list. This has to be called before any of the oth...
Definition: list_timerenv.F:78
logical function, public list_timerenv_isready(list)
Test if the given list has been initialized.
Definition: list_timerenv.F:62
type(timer_env_type) function, pointer, public list_timerenv_pop(list)
Returns the last element in the list and removes it. Is equivialent to: value = list_timerenv_get(lis...
subroutine, public list_timerenv_set(list, value, pos)
Assings the given value to the given position in the list. Thereby, the former value at that position...
subroutine, public list_timerenv_insert(list, value, pos)
Inserts the given value at the givenn position within the list. Values which lay behind the insertion...
subroutine, public list_timerenv_clear(list)
Removes all values from the list. The list itself is not deallocated.
subroutine, public list_timerenv_push(list, value)
Appends the given value at the end of the list.
subroutine, public list_timerenv_del(list, pos)
Removes the value at the given position from the list.
subroutine, public list_timerenv_destroy(list)
Deallocated the internal data-structures of the given list. Caution: If the stored values are pointer...
type(timer_env_type) function, pointer, public list_timerenv_peek(list)
Returns the last element in the list. Is equivalent to: list_timerenv_get(list, list_timerenv_size(li...
An array-based list which grows on demand. When the internal array is full, a new array of twice the ...
Definition: list.F:24
Types used by timings.F and timings_report.F The types in this module are used within dict or list,...