38
39
40
43 USE intbufdef_mod
44
45
46
47 USE spmd_comm_world_mod, ONLY : spmd_comm_world
48#include "implicit_f.inc"
49
50
51
52#include "spmd.inc"
53
54
55
56#include "param_c.inc"
57#include "com04_c.inc"
58#include "task_c.inc"
59#include "com01_c.inc"
60
61
62
63 INTEGER IPARI(NPARI,*),ITAB(*),TAGPENE(*)
64
66 . mtf(14,*),a(3,*)
67
68 TYPE(INTBUF_STRUCT_) (*)
69
70
71
72#ifdef MPI
73 INTEGER STATUS(MPI_STATUS_SIZE),
74 * REQ_SI(NSPMD),REQ_RI(NSPMD)
75 INTEGER P,LENSD,LENRV,IADS(NSPMD+1),IADR(NSPMD+1),IERROR,
76 * SIZ,LOC_PROC,MSGTYP,MSGOFF,IDEB(NINTER)
77 INTEGER NIN,NTY,INACTI
78 INTEGER J,L,NB,NN,K,N,NOD,MODE,LEN,ALEN,ND
80 * DIMENSION(:), ALLOCATABLE :: bbufs, bbufr
81 DATA msgoff/150/
82
83
84
85 loc_proc = ispmd+1
86 iads = 0
87 iadr = 0
88 lensd = 0
89 lenrv = 0
90
91 alen=8
92
93 DO p=1,nspmd
94 iadr(p)=lenrv+1
95 DO nin=1,ninter
96 nty=ipari(7,nin)
97 inacti =ipari(22,nin)
98 IF((nty==7.and.ipari(34,nin)==-2.and.inacti==7).OR.
99 . (nty==22.and.ipari(34,nin)==-2.and.inacti==7)) THEN
100 lensd = lensd +
nsnsi(nin)%P(p)*alen
101 lenrv = lenrv +
nsnfi(nin)%P(p)*alen
102 ENDIF
103 ENDDO
104 ENDDO
105 iadr(nspmd+1)=lenrv+1
106
107 IF(lensd>0)THEN
108 ALLOCATE(bbufs(lensd),stat=ierror)
109 IF(ierror/=0) THEN
110 CALL ancmsg(msgid=20,anmode=aninfo)
112 ENDIF
113 ENDIF
114
115
116 IF(lenrv>0)THEN
117 ALLOCATE(bbufr(lenrv),stat=ierror)
118 IF(ierror/=0) THEN
119 CALL ancmsg(msgid=20,anmode=aninfo)
121 ENDIF
122 ENDIF
123
124
125 l=1
126 ideb = 0
127 DO p=1, nspmd
128 iads(p)=l
129 IF (p/= loc_proc) THEN
130 DO nin=1,ninter
131 nty =ipari(7,nin)
132 inacti =ipari(22,nin)
133 IF((nty==7.and.ipari(34,nin)==-2.and.inacti==7).OR.
134 . (nty==22.and.ipari(34,nin)==-2.and.inacti==7))THEN
136
137 DO nn=1,nb
138 nd =
nsvsi(nin)%P(ideb(nin)+nn)
139 nod=intbuf_tab(nin)%NSV(nd)
140 bbufs(l )=a(1,nod)
141 bbufs(l+1)=a(2,nod)
142 bbufs(l+2)=a(3,nod)
143 bbufs(l+3)=mtf(10,nod)
144 IF(tagpene(nod) == p)THEN
145 bbufs(l+4) = mtf(11,nod)
146 ELSE
147 bbufs(l+4) = -abs(mtf(11,nod)*(1-em6))
148 ENDIF
149
150 bbufs(l+5)=mtf(12,nod)
151 bbufs(l+6)=mtf(13,nod)
152 bbufs(l+7)=mtf(14,nod)
153 l=l+8
154 ENDDO
155 ENDIF
156 ideb(nin)=ideb(nin)+nb
157 ENDDO
158
159 siz = l-iads(p)
160 IF(siz>0)THEN
161 msgtyp = msgoff
162
164 . bbufs(iads(p)),siz,real ,it_spmd(p),msgtyp,
165 . spmd_comm_world,req_si(p),ierror )
166 ENDIF
167 ENDIF
168 ENDDO
169 iads(nspmd+1)=l
170
171 l=0
172 ideb = 0
173
174 DO p=1, nspmd
175 l=0
176 siz=iadr(p+1)-iadr(p)
177 IF (siz > 0) THEN
178 msgtyp = msgoff
179 CALL mpi_recv( bbufr(iadr(p)),siz,real,it_spmd(p),msgtyp,
180 * spmd_comm_world,status,ierror )
181 DO nin=1,ninter
182 nty =ipari(7,nin)
183 inacti =ipari(22,nin)
184
186
187 IF((nty==7.and.ipari(34,nin)==-2.and.inacti==7).OR.
188 . (nty==22.and.ipari(34,nin)==-2.and.inacti==7)) THEN
189
190 IF (nb > 0)THEN
191 DO k=1,nb
192 i18kafi(nin)%P(1,ideb(nin)+k)=bbufr(iadr(p)+l)
193 i18kafi(nin)%P(2,ideb(nin)+k)=bbufr(iadr(p)+l+1)
194 i18kafi(nin)%P(3,ideb(nin)+k)=bbufr(iadr(p)+l+2)
195 mtfi_pene(nin)%P(ideb(nin)+k)=bbufr(iadr(p)+l+3)
197 mtfi_n(nin)%P(1,ideb(nin)+k)=bbufr(iadr(p)+l+5)
198 mtfi_n(nin)%P(2,ideb(nin)+k)=bbufr(iadr(p)+l+6)
199 mtfi_n(nin)%P(3,ideb(nin)+k)=bbufr(iadr(p)+l+7)
200 l=l+8
201 ENDDO
202 ENDIF
203 ENDIF
204 ideb(nin)=ideb(nin)+nb
205 ENDDO
206 ENDIF
207 ENDDO
208
209
210 DO p = 1, nspmd
211 IF (p==nspmd)THEN
212 siz=lensd-iads(p)
213 ELSE
214 siz=iads(p+1)-iads(p)
215 ENDIF
216 IF(siz>0) THEN
217 CALL mpi_wait(req_si(p),status,ierror)
218 ENDIF
219 ENDDO
220
221 DO k=1,numnod
222 IF(tagpene(k)/=0)THEN
223 mtf(11,k)=mtf(11,k)*(1-em6)
224 ENDIF
225 ENDDO
226 IF (ALLOCATED(bbufs)) DEALLOCATE(bbufs)
227 IF (ALLOCATED(bbufr)) DEALLOCATE(bbufr)
228
229#endif
230 RETURN
subroutine mpi_recv(buf, cnt, datatype, source, tag, comm, status, ierr)
subroutine mpi_isend(buf, cnt, datatype, dest, tag, comm, ireq, ierr)
subroutine mpi_wait(ireq, status, ierr)
type(real_pointer2), dimension(:), allocatable i18kafi
type(int_pointer), dimension(:), allocatable nsvsi
type(real_pointer), dimension(:), allocatable mtfi_pene
type(int_pointer), dimension(:), allocatable nsnsi
type(real_pointer2), dimension(:), allocatable mtfi_n
type(real_pointer), dimension(:), allocatable mtfi_penemin
type(int_pointer), dimension(:), allocatable nsnfi
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)