|
CP2K 2.4 (Revision 12889)
|
describes a generic linked list template. Linked list are supposed to always use pointers to the nodes for basically everything: a pointer to the node is a list, an element of the list, an iterator between the elment of the list. An empty list is represented by an unassociated pointer. More...
Classes | |
| interface | cp_create |
| interface | cp_dealloc |
| interface | cp_dealloc_node |
| interface | cp_set |
| interface | cp_get |
| interface | cp_next |
| interface | cp_get_first_el |
| interface | cp_get_rest |
| interface | cp_get_empty |
| interface | cp_get_length |
| interface | cp_get_element_at |
| interface | cp_set_element_at |
| interface | cp_insert |
| interface | cp_insert_at |
| interface | cp_remove_el |
| interface | cp_remove_first_el |
| interface | cp_remove_all |
| interface | cp_to_array |
| struct | cp_sll_pw_type |
| represent a single linked list that stores pointers to the elements More... | |
| struct | cp_sll_pw_p_type |
| pointer to a linked list (to make arrays of pointers) More... | |
Functions | |
| subroutine, public | cp_sll_pw_create (sll, first_el, rest, error) |
| allocates and initializes a single linked list | |
| subroutine, public | cp_sll_pw_dealloc (sll, error) |
| deallocates the singly linked list starting at sll. Does not work if loops are present! | |
| subroutine, public | cp_sll_pw_dealloc_node (sll, error) |
| deallocates a node of a singly linked list (low level) | |
| subroutine, public | cp_sll_pw_set (sll, first_el, rest, error) |
| sets tha various attributes of a single linked list It is an error to set the rest of an empty list without setting the first_el (change and make it simply a sll=>rest ?) | |
| subroutine, public | cp_sll_pw_get (sll, first_el, rest, empty, length, error) |
| returns various attributes from the linked list | |
| TYPE(pw_type), pointer, public | cp_sll_pw_get_first_el (sll, error) |
| returns the first element stored in the list | |
| TYPE(cp_sll_pw_type), pointer, public | cp_sll_pw_get_rest (sll, iter, error) |
| returns the rest of the list | |
| LOGICAL, public | cp_sll_pw_get_empty (sll, error) |
| INTEGER, public | cp_sll_pw_get_length (sll, error) |
| returns the length of the list | |
| TYPE(pw_type), pointer, public | cp_sll_pw_get_el_at (sll, index, error) |
| returns the element at the given index | |
| subroutine, public | cp_sll_pw_set_el_at (sll, index, value, error) |
| sets the element at the given index | |
| LOGICAL, public | cp_sll_pw_next (iterator, el_att, error) |
| returns true if the actual element is valid (i.e. iterator ont at end) moves the iterator to the next element | |
| subroutine, public | cp_sll_pw_insert_el (sll, el, error) |
| insert an element at the beginning of the list | |
| subroutine, public | cp_sll_pw_rm_first_el (sll, error) |
| remove the first element of the linked list | |
| subroutine, public | cp_sll_pw_insert_el_at (sll, el, index, error) |
| inserts the element at the given index | |
| subroutine, public | cp_sll_pw_rm_el_at (sll, index, error) |
| removes the element at the given index | |
| subroutine, public | cp_sll_pw_rm_all_el (sll, error) |
| removes all the elements from the list | |
| TYPE(pw_p_type), dimension(:), pointer, public | cp_sll_pw_to_array (sll, error) |
| returns a newly allocated array with the same contents as the linked list | |
| TYPE(cp_sll_pw_type), pointer, public | cp_sll_pw_from_array (array, error) |
| returns a linked list with the same contents as the given array | |
| subroutine, public | cp_sll_pw_insert_ordered (sll, el, insert_equals, did_insert, pos, error) |
| insert an element mantaining the order | |
| subroutine, public | cp_sll_pw_insert_ordered2 (sll, el, compare_function, insert_equals, did_insert, pos, error) |
| insert an element mantaining the order defined by a user given function | |
| LOGICAL | cp_sll_pw_contains (sll, el, ordered, error) |
| returns true if the list contains the given element | |
| function | cp_sll_pw_contains2 (sll, el, compare_function, ordered, error) |
| returns true if the list contains the given element | |
Variables | |
| LOGICAL, parameter, private | debug_this_module = .TRUE. |
| CHARACTER(len=*), parameter, private | moduleN = 'cp_linked_list_pw' |
describes a generic linked list template. Linked list are supposed to always use pointers to the nodes for basically everything: a pointer to the node is a list, an element of the list, an iterator between the elment of the list. An empty list is represented by an unassociated pointer.
This is a template
**** DO NOT MODIFY THE .F FILES **** modify the .template and .instantition instead
| LOGICAL cp_linked_list_pw::cp_sll_pw_contains | ( | TYPE(cp_sll_pw_type),pointer | sll, |
| TYPE(pw_type),pointer | el, | ||
| LOGICAL,intent(in),optional | ordered, | ||
| TYPE(cp_error_type),intent(inout) | error | ||
| ) |
returns true if the list contains the given element
| sll | the linked list you want to control |
| el | the element to control |
| ordered | if true assumes that the list is ordered in growing order. (defaults to false) |
| error | variable to control error logging, stopping,... see module cp_error_handling |
Definition at line 1076 of file cp_linked_list_pw.f90.
References cp_sll_pw_next().
Here is the call graph for this function:| function cp_linked_list_pw::cp_sll_pw_contains2 | ( | TYPE(cp_sll_pw_type),pointer | sll, |
| TYPE(pw_type),pointer | el, | ||
| compare_function | compare_function, | ||
| LOGICAL,intent(in),optional | ordered, | ||
| TYPE(cp_error_type),intent(inout) | error | ||
| ) | [private] |
returns true if the list contains the given element
| sll | the linked list you want to control |
| el | the element to control |
| compare_function | a function used to compare two elements, it should return a negative number if the first argument is less than the second, 0 if they are equal, otherwise a positive number |
| ordered | if true assumes that the list is ordered in growing order. (defaults to false) |
| error | variable to control error logging, stopping,... see module cp_error_handling |
Definition at line 1131 of file cp_linked_list_pw.f90.
| subroutine,public cp_linked_list_pw::cp_sll_pw_create | ( | TYPE(cp_sll_pw_type),pointer | sll, |
| TYPE(pw_type),optional,pointer | first_el, | ||
| TYPE(cp_sll_pw_type),optional,pointer | rest, | ||
| TYPE(cp_error_type),intent(inout) | error | ||
| ) |
allocates and initializes a single linked list
| sll | the single linked list to initialize |
| first_el | the first element of this list |
| rest | the following elements (if not given: empty) |
| error | variable to control error logging, stopping,... see module cp_error_handling |
Definition at line 220 of file cp_linked_list_pw.f90.
References CPPostcondition.
Referenced by compare_function::compare_function(), cp_sll_pw_from_array(), cp_sll_pw_insert_el(), cp_sll_pw_insert_ordered(), and cp_sll_pw_set().
Here is the caller graph for this function:| subroutine,public cp_linked_list_pw::cp_sll_pw_dealloc | ( | TYPE(cp_sll_pw_type),pointer | sll, |
| TYPE(cp_error_type),intent(inout) | error | ||
| ) |
deallocates the singly linked list starting at sll. Does not work if loops are present!
| sll | the list to be deallocated |
| error | variable to control error logging, stopping,... see module cp_error_handling |
Definition at line 262 of file cp_linked_list_pw.f90.
References cp_sll_pw_rm_all_el().
Referenced by pw_pool_types::pw_pool_flush_cache().
Here is the call graph for this function:
Here is the caller graph for this function:| subroutine,public cp_linked_list_pw::cp_sll_pw_dealloc_node | ( | TYPE(cp_sll_pw_type),pointer | sll, |
| TYPE(cp_error_type),intent(inout) | error | ||
| ) |
deallocates a node of a singly linked list (low level)
| sll | the node to be deallocated |
| error | variable to control error logging, stopping,... see module cp_error_handling |
Definition at line 283 of file cp_linked_list_pw.f90.
References CPPostcondition.
Referenced by cp_sll_pw_rm_all_el(), and cp_sll_pw_rm_first_el().
Here is the caller graph for this function:| TYPE(cp_sll_pw_type),pointer,public cp_linked_list_pw::cp_sll_pw_from_array | ( | TYPE(pw_p_type),dimension(:),intent(in) | array, |
| TYPE(cp_error_type),intent(inout) | error | ||
| ) |
returns a linked list with the same contents as the given array
| array | the array you want to copy |
| error | variable to control error logging, stopping,... see module cp_error_handling |
Definition at line 876 of file cp_linked_list_pw.f90.
References cp_sll_pw_create().
Here is the call graph for this function:| subroutine,public cp_linked_list_pw::cp_sll_pw_get | ( | TYPE(cp_sll_pw_type),pointer | sll, |
| TYPE(pw_type),optional,pointer | first_el, | ||
| TYPE(cp_sll_pw_type),optional,pointer | rest, | ||
| LOGICAL,intent(out),optional | empty, | ||
| INTEGER,intent(out),optional | length, | ||
| TYPE(cp_error_type),intent(inout) | error | ||
| ) |
returns various attributes from the linked list
| sll | the single linked list to change |
| first_el | the first element of this list (can be unassociated) |
| rest | the rest of the list (can be unassociated) |
| length | the length of the list |
| error | variable to control error logging, stopping,... see module cp_error_handling |
Definition at line 351 of file cp_linked_list_pw.f90.
References cp_sll_pw_get_length().
Here is the call graph for this function:| TYPE(pw_type),pointer,public cp_linked_list_pw::cp_sll_pw_get_el_at | ( | TYPE(cp_sll_pw_type),pointer | sll, |
| INTEGER,intent(in) | index, | ||
| TYPE(cp_error_type),intent(inout) | error | ||
| ) |
returns the element at the given index
| sll | the list you get the element from |
| index | the position of the element (stating at 1) |
| error | variable to control error logging, stopping,... see module cp_error_handling |
Definition at line 538 of file cp_linked_list_pw.f90.
References cp_sll_pw_get_rest().
Here is the call graph for this function:| LOGICAL,public cp_linked_list_pw::cp_sll_pw_get_empty | ( | TYPE(cp_sll_pw_type),pointer | sll, |
| TYPE(cp_error_type),intent(inout) | error | ||
| ) |
| sll | the single linked list to get the rest from |
| error | variable to control error logging, stopping,... see module cp_error_handling |
Definition at line 475 of file cp_linked_list_pw.f90.
| TYPE(pw_type),pointer,public cp_linked_list_pw::cp_sll_pw_get_first_el | ( | TYPE(cp_sll_pw_type),pointer | sll, |
| TYPE(cp_error_type),intent(inout) | error | ||
| ) |
returns the first element stored in the list
| sll | the single linked list to get the element from |
| error | variable to control error logging, stopping,... see module cp_error_handling |
Definition at line 389 of file cp_linked_list_pw.f90.
| INTEGER,public cp_linked_list_pw::cp_sll_pw_get_length | ( | TYPE(cp_sll_pw_type),pointer | sll, |
| TYPE(cp_error_type),intent(inout) | error | ||
| ) |
returns the length of the list
| sll | the list you want to know the length of |
| error | variable to control error logging, stopping,... see module cp_error_handling |
Definition at line 501 of file cp_linked_list_pw.f90.
Referenced by cp_sll_pw_get(), and cp_sll_pw_to_array().
Here is the caller graph for this function:| TYPE(cp_sll_pw_type),pointer,public cp_linked_list_pw::cp_sll_pw_get_rest | ( | TYPE(cp_sll_pw_type),pointer | sll, |
| INTEGER,optional | iter, | ||
| TYPE(cp_error_type),intent(inout) | error | ||
| ) |
returns the rest of the list
| sll | the single linked list to get the rest from |
| iter | how many times the call to rest should be iterated, defaults to 1; -1 means till end of the list. |
| error | variable to control error logging, stopping,... see module cp_error_handling |
Definition at line 422 of file cp_linked_list_pw.f90.
Referenced by cp_sll_pw_get_el_at(), cp_sll_pw_insert_el_at(), cp_sll_pw_rm_el_at(), and cp_sll_pw_set_el_at().
Here is the caller graph for this function:| subroutine,public cp_linked_list_pw::cp_sll_pw_insert_el | ( | TYPE(cp_sll_pw_type),pointer | sll, |
| TYPE(pw_type),pointer | el, | ||
| TYPE(cp_error_type),intent(inout) | error | ||
| ) |
insert an element at the beginning of the list
| sll | the single linked list point at the beginning of which you want to add the element |
| el | the element to add |
| error | variable to control error logging, stopping,... see module cp_error_handling |
Definition at line 655 of file cp_linked_list_pw.f90.
References cp_sll_pw_create().
Referenced by compare_function::compare_function(), cp_sll_pw_insert_el_at(), and cp_sll_pw_insert_ordered().
Here is the call graph for this function:
Here is the caller graph for this function:| subroutine,public cp_linked_list_pw::cp_sll_pw_insert_el_at | ( | TYPE(cp_sll_pw_type),pointer | sll, |
| TYPE(pw_type),pointer | el, | ||
| INTEGER,intent(in) | index, | ||
| TYPE(cp_error_type),intent(inout) | error | ||
| ) |
inserts the element at the given index
| sll | the list you get the element from |
| index | the position of the element (stating at 1). If it is -1, it means at end |
| el | the new element |
| error | variable to control error logging, stopping,... see module cp_error_handling |
Definition at line 723 of file cp_linked_list_pw.f90.
References cp_sll_pw_get_rest(), and cp_sll_pw_insert_el().
Here is the call graph for this function:| subroutine,public cp_linked_list_pw::cp_sll_pw_insert_ordered | ( | TYPE(cp_sll_pw_type),pointer | sll, |
| TYPE(pw_type),pointer | el, | ||
| LOGICAL,intent(in),optional | insert_equals, | ||
| LOGICAL,intent(out),optional | did_insert, | ||
| TYPE(cp_sll_pw_type),optional,pointer | pos, | ||
| TYPE(cp_error_type),intent(inout) | error | ||
| ) |
insert an element mantaining the order
| sll | the list you want to insert in |
| el | the element that you want to insert |
| insert_equals | if equal elements should be inserted (defaults to false) |
| did_insert | true if it did insert the element |
| pos | node where the element has been inserted (or of the same element that was already in the list) |
| error | variable to control error logging, stopping,... see module cp_error_handling |
Definition at line 921 of file cp_linked_list_pw.f90.
References cp_sll_pw_create(), cp_sll_pw_insert_el(), cp_sll_pw_next(), CPAssert, CPInvariant, and error.
Here is the call graph for this function:| subroutine,public cp_linked_list_pw::cp_sll_pw_insert_ordered2 | ( | TYPE(cp_sll_pw_type),pointer | sll, |
| TYPE(pw_type),pointer | el, | ||
| compare_function | compare_function, | ||
| LOGICAL,intent(in),optional | insert_equals, | ||
| LOGICAL,intent(out),optional | did_insert, | ||
| TYPE(cp_sll_pw_type),optional,pointer | pos, | ||
| TYPE(cp_error_type),intent(inout) | error | ||
| ) |
insert an element mantaining the order defined by a user given function
| sll | the list you want to insert in |
| el | the element that you want to insert |
| compare_function | a function used to compare two elements, it should return a negative number if the first argument is less than the second, 0 if they are equal, otherwise a positive number |
| insert_equals | if equal elements should be inserted (defaults to false) |
| error | variable to control error logging, stopping,... see module cp_error_handling |
Definition at line 992 of file cp_linked_list_pw.f90.
References error.
| LOGICAL,public cp_linked_list_pw::cp_sll_pw_next | ( | TYPE(cp_sll_pw_type),pointer | iterator, |
| TYPE(pw_type),optional,pointer | el_att, | ||
| TYPE(cp_error_type),intent(inout) | error | ||
| ) |
returns true if the actual element is valid (i.e. iterator ont at end) moves the iterator to the next element
| iterator | iterator that moves along the list |
| error | variable to control error logging, stopping,... see module cp_error_handling |
| el_att | the actual element (valid only if the function returns true) |
Definition at line 618 of file cp_linked_list_pw.f90.
Referenced by compare_function::compare_function(), cp_sll_pw_contains(), cp_sll_pw_insert_ordered(), and cp_sll_pw_to_array().
Here is the caller graph for this function:| subroutine,public cp_linked_list_pw::cp_sll_pw_rm_all_el | ( | TYPE(cp_sll_pw_type),pointer | sll, |
| TYPE(cp_error_type),intent(inout) | error | ||
| ) |
removes all the elements from the list
| sll | the list that should be removed |
| error | variable to control error logging, stopping,... see module cp_error_handling |
Definition at line 807 of file cp_linked_list_pw.f90.
References cp_sll_pw_dealloc_node().
Referenced by cp_sll_pw_dealloc().
Here is the call graph for this function:
Here is the caller graph for this function:| subroutine,public cp_linked_list_pw::cp_sll_pw_rm_el_at | ( | TYPE(cp_sll_pw_type),pointer | sll, |
| INTEGER,intent(in) | index, | ||
| TYPE(cp_error_type),intent(inout) | error | ||
| ) |
removes the element at the given index
| sll | the list you get the element from |
| index | the position of the element (stating at 1) |
| el | the new element |
| error | variable to control error logging, stopping,... see module cp_error_handling |
Definition at line 765 of file cp_linked_list_pw.f90.
References cp_sll_pw_get_rest(), and cp_sll_pw_rm_first_el().
Here is the call graph for this function:| subroutine,public cp_linked_list_pw::cp_sll_pw_rm_first_el | ( | TYPE(cp_sll_pw_type),pointer | sll, |
| TYPE(cp_error_type),intent(inout) | error | ||
| ) |
remove the first element of the linked list
| sll | the list whose first element has to be removed |
| error | variable to control error logging, stopping,... see module cp_error_handling |
Definition at line 685 of file cp_linked_list_pw.f90.
References cp_sll_pw_dealloc_node().
Referenced by cp_sll_pw_rm_el_at().
Here is the call graph for this function:
Here is the caller graph for this function:| subroutine,public cp_linked_list_pw::cp_sll_pw_set | ( | TYPE(cp_sll_pw_type),pointer | sll, |
| TYPE(pw_type),optional,pointer | first_el, | ||
| TYPE(cp_sll_pw_type),optional,pointer | rest, | ||
| TYPE(cp_error_type),intent(inout) | error | ||
| ) |
sets tha various attributes of a single linked list It is an error to set the rest of an empty list without setting the first_el (change and make it simply a sll=>rest ?)
| sll | the single linked list to change |
| first_el | the element to replace the first element of this list |
| rest | the rest of the list (can be unassociated) |
| error | variable to control error logging, stopping,... see module cp_error_handling |
Definition at line 314 of file cp_linked_list_pw.f90.
References cp_sll_pw_create(), and CPAssert.
Here is the call graph for this function:| subroutine,public cp_linked_list_pw::cp_sll_pw_set_el_at | ( | TYPE(cp_sll_pw_type),pointer | sll, |
| INTEGER,intent(in) | index, | ||
| TYPE(pw_type),pointer | value, | ||
| TYPE(cp_error_type),intent(inout) | error | ||
| ) |
sets the element at the given index
| sll | the list you get the element from |
| index | the position of the element (stating at 1) -1 means at the end |
| value | the new element |
| error | variable to control error logging, stopping,... see module cp_error_handling |
Definition at line 580 of file cp_linked_list_pw.f90.
References cp_sll_pw_get_rest().
Here is the call graph for this function:| TYPE(pw_p_type),dimension(:),pointer,public cp_linked_list_pw::cp_sll_pw_to_array | ( | TYPE(cp_sll_pw_type),pointer | sll, |
| TYPE(cp_error_type),intent(inout) | error | ||
| ) |
returns a newly allocated array with the same contents as the linked list
| sll | the list to trasform in array |
| error | variable to control error logging, stopping,... see module cp_error_handling |
Definition at line 839 of file cp_linked_list_pw.f90.
References cp_sll_pw_get_length(), cp_sll_pw_next(), CPAssert, and CPPostcondition.
Here is the call graph for this function:| LOGICAL,parameter,private cp_linked_list_pw::debug_this_module = .TRUE. |
Definition at line 58 of file cp_linked_list_pw.f90.
| CHARACTER(len=*),parameter,private cp_linked_list_pw::moduleN = 'cp_linked_list_pw' |
Definition at line 59 of file cp_linked_list_pw.f90.
1.7.3