50 USE spmd_comm_world_mod,
ONLY : spmd_comm_world
51#include "implicit_f.inc"
65 INTEGER KXSP(NISP,*), WSP2SORT(*)
67 . x(3,*),bminmal(*), spbuf(nspbuf,*)
72 INTEGER P, KK, I, J, NOD, N, MSGTYP, , NBIRECV,
73 . IERROR, IERROR1, L, LEN, IDEB, INDEXI, NB,
75 . IX1, IX2, IY1, IY2, IZ1, IZ2, IX, IY, IZ,
76 . REQ_RB(NSPMD), REQ_SB(NSPMD), REQ_SD(NSPMD),
77 . REQ_RD(NSPMD), REQ_SD2(NSPMD), REQ_SC(NSPMD),
79 . IRINDEXI(NSPMD), ISINDEXI(NSPMD), NBO(NSPMD),
80 . INDEX(NSP2SORT), STATUS(MPI_STATUS_SIZE),
81 . ,MSGOFF2,MSGOFF3,MSGOFF4
83 . bminma(6,nspmd),alpha_marge,
84 . xmaxb,ymaxb,zmaxb,xminb,yminb,zminb,
86 TYPE(real_pointer),
DIMENSION(NSPMD) :: BUF
87 my_real,
dimension(:),
allocatable :: sbuf,rbuf
96 INTEGER :: RCV_SIZE_BMINMA,TOTAL_RCV_SIZE_BMINMA
98 INTEGER :: SEND_SIZE_CRVOX
99 INTEGER :: REQUEST_CRVOX
100 INTEGER :: RCV_SIZE_CRVOX,TOTAL_RCV_SIZE_CRVOX
101 INTEGER,
DIMENSION(0:LRVOXEL,0:LRVOXEL) :: CRVOXEL_LOC
103 INTEGER,
DIMENSION(:,:),
ALLOCATABLE :: INDEX_P
104 INTEGER,
DIMENSION(NSPMD) :: NB_P
105 INTEGER :: REQUEST_NBO
107 INTEGER,
DIMENSION(NSPMD) :: SEND_SIZE_SBUF,DISPLS_SBUF
108 INTEGER :: TOTAL_SEND_SIZE,TOTAL_RCV_SIZE_RBUF
109 INTEGER,
DIMENSION(NSPMD) :: RCV_SIZE_RBUF,DISPLS_RBUF
110 INTEGER :: REQUEST_SBUF
121 ALLOCATE( index_p(nsp2sort,nspmd) )
122 alpha_marge = sqrt(one +spasort)
131 bminma(1,loc_proc) = bminmal(1)
132 bminma(2,loc_proc) = bminmal(2)
133 bminma(3,loc_proc) = bminmal(3)
134 bminma(4,loc_proc) = bminmal(4)
135 bminma(5,loc_proc) = bminmal(5)
136 bminma(6,loc_proc) = bminmal(6)
142 total_rcv_size_bminma = 6*nspmd
147 . total_rcv_size_bminma,rcv_size_bminma,
148 . request_bminma,spmd_comm_world)
161 . total_rcv_size_crvox,rcv_size_crvox,
162 . request_crvox,spmd_comm_world)
176 CALL mpi_wait(request_bminma,status,ierror)
177 CALL mpi_wait(request_crvox,status,ierror)
188 if(p==loc_proc) cycle
201 aaa = spbuf(1,n)* alpha_marge
202 ix1=int(nbx*(x(1,nod)-xminb-aaa)/(xmaxb-xminb))
203 ix2=int(nbx*(x(1,nod)-xminb+aaa)/(xmaxb-xminb))
206 iy1=int(nby*(x(2,nod)-yminb-aaa)/(ymaxb-yminb))
207 iy2=int(nby*(x(2,nod)-yminb+aaa)/(ymaxb-yminb))
210 iz1=int(nbz*(x(3,nod)-zminb-aaa)/(zmaxb-zminb))
211 iz2=int(nbz*(x(3,nod)-zminb+aaa)/(zmaxb-zminb))
226 IF(btest(
crvoxel(iy,iz,p),ix))
THEN
227 nb_p(p) = nb_p(p) + 1
228 index_p(nb_p(p),p) = n
248 . nspmd,1,request_nbo,spmd_comm_world)
260 if(p==loc_proc) cycle
266 sbuf(l+2) = spbuf(1,n)
270 sbuf(l+6) = kxsp(8,n)
277 ! total number of particules to send
280 IF(loc_proc /=p)
THEN
290 IF(
ALLOCATED(dks))
DEALLOCATE(dks)
291 ALLOCATE(dks(
nsphs),stat=ierror1)
292 ierror = ierror1 + ierror
296 CALL ancmsg(msgid=20,anmode=aninfo)
305 IF(loc_proc /=p)
THEN
306#include "novectorize.inc"
309 lsphs(ideb) = sbuf(l+1) !buf(p)%P(l+1)
325 CALL mpi_wait(request_nbo,status,ierror)
344 send_size_sbuf(1:nspmd) = 0
345 displs_sbuf(1:nspmd) = 0
346 rcv_size_rbuf(1:nspmd) = 0
347 displs_rbuf(1:nspmd) = 0
350 send_size_sbuf(1) =
sizspt*nb_p(1)
351 total_send_size = send_size_sbuf(1)
353 send_size_sbuf(p) =
sizspt*nb_p(p)
354 displs_sbuf(p) = displs_sbuf(p-1) + send_size_sbuf(p-1)
355 total_send_size = total_send_size + send_size_sbuf(p)
359 total_rcv_size_rbuf = rcv_size_rbuf(1)
363 displs_rbuf(p) = displs_rbuf(p-1) + rcv_size_rbuf(p-1)
364 total_rcv_size_rbuf = total_rcv_size_rbuf + rcv_size_rbuf(p)
369 IF(
ALLOCATED(xsphr))
DEALLOCATE(xsphr)
371 ierror = ierror1 + ierror
373 IF(
ALLOCATED(dkr))
DEALLOCATE(dkr)
374 ALLOCATE(dkr(
nsphr),stat=ierror1)
375 ierror = ierror1 + ierror
378 CALL ancmsg(msgid=20,anmode=aninfo)
387 CALL spmd_ialltoallv(sbuf,xsphr,send_size_sbuf,total_send_size,displs_sbuf,
388 . total_rcv_size_rbuf,rcv_size_rbuf,displs_rbuf,
389 . request_sbuf,spmd_comm_world,nspmd)
393! -------------------------
399 CALL mpi_wait(request_sbuf,status,ierror)
404 DEALLOCATE( index_p )
subroutine ancmsg(msgid, msgtype, anmode, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, r1, r2, r3, r4, r5, r6, r7, r8, r9, c1, c2, c3, c4, c5, c6, c7, c8, c9, prmode)