27 type(
nbor_t),
pointer:: next => null()
36 type(
nbor_t),
pointer:: head => null()
37 type(
nbor_t),
pointer:: tail => null()
40 procedure:: add_by_rank
47 SUBROUTINE update (self, task_list)
51 type(
link_t),
pointer:: link
52 type(
nbor_t),
pointer:: nbor, next, prev
53 logical,
save:: first_time=.true.
57 call trace%begin (
'nbor_list_t%update')
59 do while (
associated(nbor))
60 nbor%present = .false.
66 link => task_list%head
67 do while (
associated(link))
68 if (link%task%rank /= mpi%rank) &
69 call self%add_by_rank (link%task%rank)
77 if (first_time.and.io%master) &
78 print *,
'nbors to rank', mpi%rank,
':' 79 do while (
associated(nbor))
81 if (.not.nbor%present)
then 82 if (
associated(prev))
then 89 if (first_time.and.io%master) &
90 print *,
'nbor rank:', nbor%rank
100 SUBROUTINE add_by_rank (self, rank)
104 type(
nbor_t),
pointer:: this, nbor
106 call trace%begin (
'nbor_list_t%add_by_rank')
108 if (
associated(this))
then 112 if (rank < this%rank)
then 113 nbor => new_nbor(rank)
119 do while (
associated(this))
123 if (rank == this%rank)
then 124 this%present = .true.
126 else if (
associated(this%next))
then 127 if (rank > this%rank .and. rank < this%next%rank)
then 128 nbor => new_nbor(rank)
129 nbor%next => this%next
137 else if (rank > this%rank)
then 138 nbor => new_nbor(rank)
153 nbor => new_nbor(rank)
161 function new_nbor (rank)
163 type(
nbor_t),
pointer:: new_nbor
167 new_nbor%present = .true.
169 END SUBROUTINE add_by_rank
201 SUBROUTINE update (self, task_list)
205 call self%nbor_list%update (task_list)
207 END SUBROUTINE update
213 SUBROUTINE send (self, buffer)
215 integer,
pointer:: buffer(:)
216 type(
nbor_t),
pointer:: nbor
218 nbor => self%nbor_list%head
219 do while (
associated(nbor))
220 if (.not.
allocated(nbor%out%buffer))
then 221 allocate (nbor%out%buffer(
size(buffer)))
222 nbor%out%buffer = buffer
223 call nbor%out%send (nbor%rank, 111)
225 if (nbor%out%sent ())
then 226 nbor%out%buffer = buffer
227 call nbor%out%send (nbor%rank, 111)
236 SUBROUTINE recv (self, buffer, process)
238 integer,
pointer:: buffer(:)
239 procedure(template):: process
241 type(
nbor_t),
pointer:: nbor
245 nbor => self%nbor_list%head
246 do while (
associated(nbor))
247 if (.not.
allocated(nbor%in%buffer))
then 248 allocate (nbor%in%buffer(
size(buffer)))
250 if (nbor%in%recv (nbor%rank, 111))
then 251 call process (nbor%in%buffer)
260 SUBROUTINE template (buffer)
262 END SUBROUTINE template
Data type to keep and maintain information on MPI processes.
Task list data type, with methods for startup and updates. Message handling is inherited from the tas...
Data type to keep and maintain information on MPI processes. The process data type maintains a list o...
Module with list handling for generic class task_t objects.
Simple module for sending / receiving packages to / from other ranks.