11#include "../base/base_uses.f90"
30 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .true.
93 INTERFACE cp_insert_at
168 type(
cp_fm_type),
pointer,
OPTIONAL :: first_el
171 IF (.NOT.
PRESENT(first_el))
THEN
173 IF (
PRESENT(rest)) sll => rest
176 sll%first_el =>first_el
178 IF (
PRESENT(rest)) sll%rest => rest
208 SUBROUTINE cp_sll_fm_dealloc_node(sll)
212 END SUBROUTINE cp_sll_fm_dealloc_node
245 INTEGER,
OPTIONAL :: iter
251 IF (.NOT.
ASSOCIATED(sll))
THEN
254 IF (
PRESENT(iter))
THEN
257 IF (
ASSOCIATED(res%rest))
THEN
260 cpabort(
"tried to go past end")
265 IF (.NOT.
ASSOCIATED(res%rest))
EXIT
294 IF (
ASSOCIATED(iterator))
THEN
296 iterator => iterator%rest
317 INTEGER,
INTENT(in) :: index
321 IF (index == -1)
THEN
326 cpassert(
ASSOCIATED(pos))
346 INTEGER,
INTENT(in) :: index
350 IF (index == -1)
THEN
355 cpassert(
ASSOCIATED(pos))
377 IF (
ASSOCIATED(iterator))
THEN
379 if (
present(el_att)) el_att =>iterator%first_el
380 iterator => iterator%rest
427 IF (
ASSOCIATED(sll))
THEN
429 CALL cp_sll_fm_dealloc_node(node_to_rm)
431 cpabort(
"tried to remove first el of an empty list")
449 INTEGER,
INTENT(in) :: index
457 IF (index == -1)
THEN
462 cpassert(
ASSOCIATED(pos))
479 INTEGER,
INTENT(in)::index
486 IF (index == -1)
THEN
491 cpassert(
ASSOCIATED(pos))
512 IF (.NOT.
ASSOCIATED(actual_node))
EXIT
513 next_node => actual_node%rest
514 CALL cp_sll_fm_dealloc_node(actual_node)
515 actual_node => next_node
541 res(i) %matrix=>iter%first_el
543 cpassert(ok .OR. i == len)
represent a full matrix distributed on many processors
integer function, public cp_sll_fm_get_length(sll)
returns the length of the list
subroutine, public cp_sll_fm_insert_el(sll, el)
insert an element at the beginning of the list
subroutine, public cp_sll_fm_rm_el_at(sll, index)
removes the element at the given index
subroutine, public cp_sll_fm_rm_all_el(sll)
removes all the elements from the list
subroutine, public cp_sll_fm_create(sll, first_el, rest)
allocates and initializes a single linked list
type(cp_sll_fm_type) function, pointer, public cp_sll_fm_get_rest(sll, iter)
returns the rest of the list
logical function, public cp_sll_fm_next(iterator, el_att)
returns true if the actual element is valid (i.e. iterator ont at end) moves the iterator to the next...
subroutine, public cp_sll_fm_insert_el_at(sll, el, index)
inserts the element at the given index
type(cp_fm_p_type) function, dimension(:), pointer, public cp_sll_fm_to_array(sll)
returns a newly allocated array with the same contents as the linked list
type(cp_fm_type) function, pointer, public cp_sll_fm_get_first_el(sll)
returns the first element stored in the list
subroutine, public cp_sll_fm_dealloc(sll)
deallocates the singly linked list starting at sll. Does not work if loops are present!
type(cp_fm_type) function, pointer, public cp_sll_fm_get_el_at(sll, index)
returns the element at the given index
subroutine, public cp_sll_fm_set_el_at(sll, index, value)
sets the element at the given index
subroutine, public cp_sll_fm_rm_first_el(sll)
remove the first element of the linked list
An array-based list which grows on demand. When the internal array is full, a new array of twice the ...
just to build arrays of pointers to matrices
pointer to a linked list (to make arrays of pointers)
represent a single linked list that stores pointers to the elements