13 integer :: Morton_no, recv_igrid, recv_ipe, send_igrid, send_ipe, igrid, ipe
15 integer :: itag, irecv, isend
16 integer,
dimension(:),
allocatable :: recvrequest, sendrequest
17 integer,
dimension(:,:),
allocatable :: recvstatus, sendstatus
20 integer,
dimension(:),
allocatable :: recvrequest_stg, sendrequest_stg
21 integer,
dimension(:,:),
allocatable :: recvstatus_stg, sendstatus_stg
43 recvrequest=mpi_request_null
44 sendrequest=mpi_request_null
49 recvrequest_stg=mpi_request_null
50 sendrequest_stg=mpi_request_null
56 send_igrid=
sfc(1,morton_no)
57 send_ipe=
sfc(2,morton_no)
59 if (recv_ipe/=send_ipe)
then
67 if (send_ipe==
mype)
call lb_send
69 if (recv_ipe==
mype)
then
70 if (recv_ipe==send_ipe)
then
79 call mpi_waitall(irecv,recvrequest,recvstatus,ierrmpi)
80 if(stagger_grid)
call mpi_waitall(irecv,recvrequest_stg,recvstatus_stg,ierrmpi)
83 call mpi_waitall(isend,sendrequest,sendstatus,ierrmpi)
84 if(stagger_grid)
call mpi_waitall(isend,sendrequest_stg,sendstatus_stg,ierrmpi)
87 deallocate(recvstatus,recvrequest,sendstatus,sendrequest)
88 if(stagger_grid)
deallocate(recvstatus_stg,recvrequest_stg,sendstatus_stg,sendrequest_stg)
91 do ipe=0,npe-1;
do morton_no=morton_start(ipe),morton_stop(ipe)
94 send_igrid=sfc(1,morton_no)
95 send_ipe=sfc(2,morton_no)
97 if (recv_ipe/=send_ipe)
then
99 call putnode(send_igrid,send_ipe)
102 {
#IFDEF EVOLVINGBOUNDARY
104 do morton_no=morton_start(mype),morton_stop(mype)
105 igrid=sfc_to_igrid(morton_no)
106 if (phyboundblock(igrid)) sfc_phybound(morton_no)=1
108 call mpi_allreduce(mpi_in_place,sfc_phybound,nleafs,mpi_integer,&
109 mpi_sum,icomm,ierrmpi)
113 call amr_morton_order()
124 {
#IFDEF EVOLVINGBOUNDARY
125 if (phyboundblock(recv_igrid))
then
126 call mpi_irecv(ps(recv_igrid)%w,1,type_block,send_ipe,itag, &
127 icomm,recvrequest(irecv),ierrmpi)
129 call mpi_irecv(ps(recv_igrid)%w,1,type_block_io,send_ipe,itag, &
130 icomm,recvrequest(irecv),ierrmpi)
132 }{
#IFNDEF EVOLVINGBOUNDARY
133 call mpi_irecv(ps(recv_igrid)%w,1,type_block_io,send_ipe,itag, &
134 icomm,recvrequest(irecv),ierrmpi)
136 if(stagger_grid)
then
137 itag=recv_igrid+max_blocks
138 call mpi_irecv(ps(recv_igrid)%ws,1,type_block_io_stg,send_ipe,itag, &
139 icomm,recvrequest_stg(irecv),ierrmpi)
148 {
#IFDEF EVOLVINGBOUNDARY
149 if (phyboundblock(send_igrid))
then
150 call mpi_isend(ps(send_igrid)%w,1,type_block,recv_ipe,itag, &
151 icomm,sendrequest(isend),ierrmpi)
153 call mpi_isend(ps(send_igrid)%w,1,type_block_io,recv_ipe,itag, &
154 icomm,sendrequest(isend),ierrmpi)
156 }{
#IFNDEF EVOLVINGBOUNDARY
157 call mpi_isend(ps(send_igrid)%w,1,type_block_io,recv_ipe,itag, &
158 icomm,sendrequest(isend),ierrmpi)
160 if(stagger_grid)
then
161 itag=recv_igrid+max_blocks
162 call mpi_isend(ps(send_igrid)%ws,1,type_block_io_stg,recv_ipe,itag, &
163 icomm,sendrequest_stg(isend),ierrmpi)
166 end subroutine lb_send