My Project
Data Types | Functions/Subroutines
linked_list Module Reference

Data Types

type  link_list
 
type  link_node
 

Functions/Subroutines

subroutine node_delete (links, obj, found)
 
subroutine delete_not_mine (links, ME)
 
subroutine delete_not_found (links)
 
subroutine node_insert (links, obj)
 
logical function empty_list (links)
 
type(link_list) function new_list ()
 
subroutine print_list (links)
 
subroutine print_data (links)
 
subroutine print_id_list (links)
 
subroutine shift_pos_list (links)
 
integer function listsize (links)
 
subroutine set_not_found (links)
 

Function/Subroutine Documentation

◆ delete_not_found()

subroutine linked_list::delete_not_found ( type(link_list), intent(inout)  links)

Definition at line 116 of file linklist.f90.

116  implicit none
117  type(link_list), intent(inout) :: links
118  type(link_node), pointer :: previous,current
119 
120  !find location of obj
121  previous => links%first
122  current => previous%next
123 
124  do
125  if(.not. associated (current)) return
126  if(.not. current%v%found)then
127  previous%next => current%next
128  deallocate(current)
129  else
130  previous => previous%next
131  current => current%next
132  endif
133  end do !find location of node with obj
134 

◆ delete_not_mine()

subroutine linked_list::delete_not_mine ( type(link_list), intent(inout)  links,
integer, intent(in)  ME 
)

Definition at line 91 of file linklist.f90.

91  implicit none
92  type(link_list), intent(inout) :: links
93  integer, intent(in) :: ME
94  type(link_node), pointer :: previous,current
95 
96  !find location of obj
97  previous => links%first
98  current => previous%next
99 
100 
101  do
102  if(.not. associated (current)) return
103  if(myid /= current%v%PID)then
104  previous%next => current%next
105  deallocate(current)
106  current => previous%next
107  else
108  previous => previous%next
109  current => current%next
110  endif
111  end do !find location of node with obj
112 
integer myid
Definition: mod_main.f90:67

◆ empty_list()

logical function linked_list::empty_list ( type(link_list), intent(in)  links)

Definition at line 160 of file linklist.f90.

160  type(link_list), intent(in) :: links
161  logical :: t_or_f
162  t_or_f = .not. associated (links%first%next)

◆ listsize()

integer function linked_list::listsize ( type(link_list), intent(in)  links)

Definition at line 240 of file linklist.f90.

240  type(link_list), intent(in) :: links
241  type(link_node), pointer :: current
242  integer :: counter
243  counter = 0
244  current => links%first%next
245 
246  do
247  if(.not. associated(current) ) exit
248  counter = counter + 1
249  current => current%next
250  end do

◆ new_list()

type(link_list) function linked_list::new_list ( )

Definition at line 166 of file linklist.f90.

166  type(link_list) :: OBJ
167  integer :: status
168  allocate ( obj%first, stat=status)
169  if(status/=0) CALL fatal_error("LinkList: Could not allocate new linklist")
170  nullify(obj%first%next)
subroutine fatal_error(ER1, ER2, ER3, ER4)
Definition: mod_utils.f90:230

◆ node_delete()

subroutine linked_list::node_delete ( type(link_list), intent(inout)  links,
type(particle), intent(in)  obj,
logical, intent(out)  found 
)

Definition at line 62 of file linklist.f90.

62  implicit none
63  type(link_list), intent(inout) :: links
64  type(particle), intent(in) :: obj
65  logical , intent(out) :: found
66  type(link_node), pointer :: previous,current
67 
68  !find location of obj
69  previous => links%first
70  current => previous%next
71  found = .false.
72 
73  do
74  if(found .or. (.not. associated (current))) return
75  if(obj == current%v)then
76  found = .true. ; exit
77  else
78  previous => previous%next
79  current => current%next
80  endif
81  end do !find location of node with obj
82 
83  if (found) then
84  previous%next => current%next
85  deallocate(current)
86  endif
87 

◆ node_insert()

subroutine linked_list::node_insert ( type(link_list), intent(inout)  links,
type(particle), intent(in)  obj 
)

Definition at line 138 of file linklist.f90.

138  type(link_list), intent(inout) :: links
139  type(particle), intent(in) :: obj
140  type(link_node), pointer :: previous,current
141 
142  previous => links%first
143  current => previous%next
144 
145  do
146  if( .not. associated (current) )exit
147  if( obj < current%v ) exit
148  previous => current
149  current => current%next
150  end do
151 
152  !insert before current
153  allocate(previous%next) !new node space
154  previous%next%v = obj !new object inserted
155  previous%next%next => current !new next pointer
156 

◆ print_data()

subroutine linked_list::print_data ( type(link_list), intent(in)  links)

Definition at line 192 of file linklist.f90.

192  type(link_list), intent(in) :: links
193  type(link_node), pointer :: current
194  current => links%first%next
195  do
196  if(.not. associated(current) ) exit
197  call particle_print(current%v)
198  current => current%next
199  end do
Here is the call graph for this function:

◆ print_id_list()

subroutine linked_list::print_id_list ( type(link_list), intent(in)  links)

Definition at line 215 of file linklist.f90.

215  type(link_list), intent(in) :: links
216  type(link_node), pointer :: current
217  current => links%first%next
218  do
219  if(.not. associated(current) ) exit
220  write(*,*)current%v%id
221  current => current%next
222  end do

◆ print_list()

subroutine linked_list::print_list ( type(link_list), intent(in)  links)

Definition at line 174 of file linklist.f90.

174  type(link_list), intent(in) :: links
175  type(link_node), pointer :: current
176  logical :: headprint
177  integer :: count
178  current => links%first%next
179  headprint = .true.
180  count = 0
181  do
182  if(.not. associated(current) ) exit
183  call screen_write(current%v,headprint)
184  current => current%next
185  headprint = .false.
186  count = count +1
187  end do
188  write(ipt,*) "! PROC:",myid,"; # of local particles:", count
integer myid
Definition: mod_main.f90:67
integer ipt
Definition: mod_main.f90:922
Here is the call graph for this function:

◆ set_not_found()

subroutine linked_list::set_not_found ( type(link_list), intent(in)  links)

Definition at line 254 of file linklist.f90.

254  type(link_list), intent(in) :: links
255  type(link_node), pointer :: current
256 
257  current => links%first%next
258  do
259  if(.not. associated(current) ) exit
260  current%v%found = .false.
261  current => current%next
262  end do

◆ shift_pos_list()

subroutine linked_list::shift_pos_list ( type(link_list), intent(in)  links)

Definition at line 226 of file linklist.f90.

226  type(link_list), intent(in) :: links
227  type(link_node), pointer :: current
228  logical :: headprint
229  current => links%first%next
230  headprint = .true.
231  do
232  if(.not. associated(current) ) exit
233  call shift_pos(current%v)
234  current => current%next
235  end do
Here is the call graph for this function: