60 TYPE(t_region
),
POINTER :: regions(:)
65 INTEGER :: ipatch, ibuff, icont
68 CHARACTER(CHRLEN) :: rcsidentstring
71 INTEGER :: statusplag(mpi_status_size)
74 INTEGER :: bctype, ilev, ipatchdes, ipatchsrc, iregsrc, &
75 naiv, narv, nbuffsizedes, ncont, ncv, ndimi, &
76 ndimr, ndv, npatches, nrecvbuffi, nrecvbuffr, &
77 ntv, procdes, procsrc, tagsrci, tagsrcr
79 INTEGER :: iaiv, iarv, iarvold, ibuffrecv, icv, icvold, &
82 INTEGER,
POINTER,
DIMENSION(:) :: pcvplagmass, precvbuffi
84 INTEGER,
POINTER,
DIMENSION(:,:) :: paivdes, paivolddes
86 REAL(RFREAL),
POINTER,
DIMENSION(:) :: precvbuffr
88 REAL(RFREAL),
POINTER,
DIMENSION(:,:) :: parvdes, parvolddes, &
89 pcvdes , pcvolddes , &
92 TYPE(t_patch),
POINTER :: ppatchsrc, ppatchdes
93 TYPE(t_plag),
POINTER :: pplag
98 rcsidentstring =
'$RCSfile: PLAG_BufferDataRecv.F90,v $ $Revision: 1.6 $'
100 global => regions(ireg)%global
103 'PLAG_BufferDataRecv.F90' )
109 ncont = regions(ireg)%plagInput%nCont
110 ncv = cv_plag_last + ncont
117 ndimr = 2*narv +4*ncv
119 ilev = regions(ireg)%currLevel
120 npatches = regions(ireg)%nPatches
122 pplag => regions(ireg)%levels(ilev)%plag
123 pcvplagmass => pplag%cvPlagMass
127 DO ipatch = 1, npatches
131 ppatchdes => regions(ireg)%levels(ilev)%patches(ipatch)
133 bctype = ppatchdes%bcType
134 iregsrc = ppatchdes%srcRegion
135 ipatchsrc = ppatchdes%srcPatch
139 IF ( (bctype>=bc_regionconf .AND. bctype<=bc_regionconf+bc_range) .OR. &
140 (bctype>=bc_regionint .AND. bctype<=bc_regionint +bc_range) .OR. &
141 (bctype>=bc_regnonconf .AND. bctype<=bc_regnonconf+bc_range) .OR. &
142 (bctype>=bc_tra_peri .AND. bctype<=bc_tra_peri +bc_range) .OR. &
143 (bctype>=bc_rot_peri .AND. bctype<=bc_rot_peri +bc_range) )
THEN
145 IF ( regions(iregsrc)%procid /= global%myProcid )
THEN
146 ppatchsrc => regions(iregsrc)%levels(ilev)%patches(ipatchsrc)
148 procdes = global%myProcid
152 paivdes => ppatchdes%bufferPlag%aiv
153 parvdes => ppatchdes%bufferPlag%arv
155 pcvdes => ppatchdes%bufferPlag%cv
156 prhsdes => ppatchdes%bufferPlag%rhs
157 prhssumdes => ppatchdes%bufferPlag%rhsSum
159 paivolddes => ppatchdes%bufferPlag%aivOld
160 parvolddes => ppatchdes%bufferPlag%arvOld
161 pcvolddes => ppatchdes%bufferPlag%cvOld
163 precvbuffi => ppatchdes%bufferPlag%recvBuffI
164 precvbuffr => ppatchdes%bufferPlag%recvBuffR
166 nbuffsizedes = ppatchdes%bufferPlag%nBuffSizeDes
170 IF ( nbuffsizedes == 0 ) goto 999
174 nrecvbuffi = ndimi * nbuffsizedes
175 nrecvbuffr = ndimr * nbuffsizedes
181 procsrc = regions(iregsrc)%procid
185 tagsrci = regions(ireg)%localNumber &
186 + plag_tag_shift +mpi_patchoff*ppatchsrc%srcPatch*ireg + procdes +1
188 IF(tagsrci .gt. global%mpiTagMax) tagsrci = mod(tagsrci,global%mpiTagMax)
189 CALL mpi_recv( precvbuffi, nrecvbuffi, mpi_integer, &
190 procsrc, tagsrci, global%mpiComm, &
191 statusplag, global%mpierr )
193 IF (global%mpierr /= err_none) &
194 CALL
errorstop( global,err_mpi_trouble,__line__ )
196 #ifdef PLAG_MPI_DEBUG
197 IF(nrecvbuffi /=0 ) &
198 WRITE(stdout,*)
' PLAG_BufferDataRecv-INT: iRegDes, iRegSrc, procSrc, tagSrcI, nRecvBuffI = ',&
199 ireg, iregsrc, procsrc,tagsrci, nrecvbuffi
204 tagsrcr = regions(ireg)%localNumber &
205 + plag_tag_shift +mpi_patchoff*ppatchsrc%srcPatch*ireg + procdes +2
207 IF(tagsrcr .gt. global%mpiTagMax) tagsrcr = mod(tagsrcr,global%mpiTagMax)
208 CALL mpi_recv( precvbuffr, nrecvbuffr, mpi_rfreal, &
209 procsrc, tagsrcr, global%mpiComm, &
210 statusplag,global%mpierr )
212 IF (global%mpierr /= err_none) &
213 CALL
errorstop( global,err_mpi_trouble,__line__ )
215 #ifdef PLAG_MPI_DEBUG
216 IF(nrecvbuffr /=0 ) &
217 WRITE(stdout,*)
' PLAG_BufferDataRecv-REAL: iRegDes, iRegSrc, procSrc, tagSrcR, nRecvBuffR = ',&
218 ireg, iregsrc, procsrc,tagsrcr, nrecvbuffr
227 DO ibuff = 1, nbuffsizedes
231 ibuffrecv = ndimi*(ibuff-1) +1
234 paivdes(aiv_plag_pidini,ibuff) = precvbuffi(iaiv )
235 paivdes(aiv_plag_regini,ibuff) = precvbuffi(iaiv+1)
236 paivdes(aiv_plag_regcrt,ibuff) = precvbuffi(iaiv+2)
237 paivdes(aiv_plag_icells,ibuff) = precvbuffi(iaiv+3)
238 paivdes(aiv_plag_indexi,ibuff) = precvbuffi(iaiv+4)
239 paivdes(aiv_plag_indexj,ibuff) = precvbuffi(iaiv+5)
240 paivdes(aiv_plag_indexk,ibuff) = precvbuffi(iaiv+6)
241 paivdes(aiv_plag_burnstat,ibuff) = precvbuffi(iaiv+7)
242 paivdes(aiv_plag_status,ibuff) = precvbuffi(iaiv+8)
244 paivolddes(aiv_plag_pidini,ibuff) = precvbuffi(iaiv )
245 paivolddes(aiv_plag_regini,ibuff) = precvbuffi(iaiv+1)
246 paivolddes(aiv_plag_regcrt,ibuff) = precvbuffi(iaiv+2)
247 paivolddes(aiv_plag_icells,ibuff) = precvbuffi(iaiv+3)
248 paivolddes(aiv_plag_indexi,ibuff) = precvbuffi(iaiv+4)
249 paivolddes(aiv_plag_indexj,ibuff) = precvbuffi(iaiv+5)
250 paivolddes(aiv_plag_indexk,ibuff) = precvbuffi(iaiv+6)
251 paivolddes(aiv_plag_burnstat,ibuff) = precvbuffi(iaiv+7)
252 paivolddes(aiv_plag_status,ibuff) = precvbuffi(iaiv+8)
254 #ifdef PLAG_MPI_DEBUG
255 IF(nbuffsizedes /=0 ) &
256 WRITE(stdout,*)
' PLAG_BufferDataRecv-INT: procDes, iBuff, iAiv, pAivDes = ',&
257 procdes, ibuff, iaiv, paivdes(:,ibuff)
264 DO ibuff = 1, nbuffsizedes
268 ibuffrecv = ndimr*(ibuff-1) +1
270 irhs = ibuffrecv +ncv
271 irhssum = ibuffrecv +2*ncv
272 icvold = ibuffrecv +3*ncv
273 iarv = ibuffrecv +4*ncv
274 iarvold = ibuffrecv +4*ncv +narv
276 #ifdef PLAG_MPI_DEBUG
277 IF(nbuffsizedes /=0 ) &
278 WRITE(stdout,*)
' PLAG_BufferDataRecv-REAL: procDes,iBuff, iBuffRecv, iCv, iRhs, iRhsSum, iCvOld, iArv, iArvOld = ',&
279 procdes, ibuff, ibuffrecv,icv, irhs, irhssum, icvold, iarv, iarvold
281 IF(nbuffsizedes /=0 ) &
282 WRITE(stdout,*)
' PLAG_BufferDataRecv-Entering CV:procDes, iReg, iBuff, pRecvBuffR(iCv)', &
283 procdes,ireg, ibuff,precvbuffr(icv:icv+ncv)
288 pcvdes(cv_plag_xmom,ibuff) = precvbuffr(icv )
289 pcvdes(cv_plag_ymom,ibuff) = precvbuffr(icv+1)
290 pcvdes(cv_plag_zmom,ibuff) = precvbuffr(icv+2)
291 pcvdes(cv_plag_ener,ibuff) = precvbuffr(icv+3)
292 pcvdes(cv_plag_xpos,ibuff) = precvbuffr(icv+4)
293 pcvdes(cv_plag_ypos,ibuff) = precvbuffr(icv+5)
294 pcvdes(cv_plag_zpos,ibuff) = precvbuffr(icv+6)
295 pcvdes(cv_plag_enervapor,ibuff) = precvbuffr(icv+7)
297 pcvdes(pcvplagmass(icont),ibuff) = precvbuffr(icv+(cv_plag_last-1)+icont)
300 #ifdef PLAG_MPI_DEBUG
301 IF(nbuffsizedes /=0 ) &
302 WRITE(stdout,*)
' PLAG_BufferDataRecv-Done with CV:procDes, iReg, iBuff, pCvDes', &
303 procdes,ireg, ibuff,pcvdes(:,ibuff)
309 prhsdes(cv_plag_xmom,ibuff) = precvbuffr(irhs )
310 prhsdes(cv_plag_ymom,ibuff) = precvbuffr(irhs+1)
311 prhsdes(cv_plag_zmom,ibuff) = precvbuffr(irhs+2)
312 prhsdes(cv_plag_ener,ibuff) = precvbuffr(irhs+3)
313 prhsdes(cv_plag_xpos,ibuff) = precvbuffr(irhs+4)
314 prhsdes(cv_plag_ypos,ibuff) = precvbuffr(irhs+5)
315 prhsdes(cv_plag_zpos,ibuff) = precvbuffr(irhs+6)
316 prhsdes(cv_plag_enervapor,ibuff) = precvbuffr(irhs+7)
318 prhsdes(pcvplagmass(icont),ibuff) = precvbuffr(irhs+(cv_plag_last-1)+icont)
321 #ifdef PLAG_MPI_DEBUG
322 IF(nbuffsizedes /=0 ) &
323 WRITE(stdout,*)
' PLAG_BufferDataRecv-Done with RhsSum:procDes, iReg, iBuff, pRhsDes', &
324 procdes,ireg, ibuff, prhsdes(:,ibuff)
330 prhssumdes(cv_plag_xmom,ibuff) = precvbuffr(irhssum )
331 prhssumdes(cv_plag_ymom,ibuff) = precvbuffr(irhssum+1)
332 prhssumdes(cv_plag_zmom,ibuff) = precvbuffr(irhssum+2)
333 prhssumdes(cv_plag_ener,ibuff) = precvbuffr(irhssum+3)
334 prhssumdes(cv_plag_xpos,ibuff) = precvbuffr(irhssum+4)
335 prhssumdes(cv_plag_ypos,ibuff) = precvbuffr(irhssum+5)
336 prhssumdes(cv_plag_zpos,ibuff) = precvbuffr(irhssum+6)
337 prhssumdes(cv_plag_enervapor,ibuff) = precvbuffr(irhssum+7)
339 prhssumdes(pcvplagmass(icont),ibuff) = precvbuffr(irhssum+(cv_plag_last-1)+icont)
342 #ifdef PLAG_MPI_DEBUG
343 IF(nbuffsizedes /=0 ) &
344 WRITE(stdout,*)
' PLAG_BufferDataRecv-Done with RhsSum:procDes, iReg, iBuff, pRhsSumDes', &
345 procdes,ireg, ibuff, prhssumdes(:,ibuff)
351 pcvolddes(cv_plag_xmom,ibuff) = precvbuffr(icvold )
352 pcvolddes(cv_plag_ymom,ibuff) = precvbuffr(icvold+1)
353 pcvolddes(cv_plag_zmom,ibuff) = precvbuffr(icvold+2)
354 pcvolddes(cv_plag_ener,ibuff) = precvbuffr(icvold+3)
355 pcvolddes(cv_plag_xpos,ibuff) = precvbuffr(icvold+4)
356 pcvolddes(cv_plag_ypos,ibuff) = precvbuffr(icvold+5)
357 pcvolddes(cv_plag_zpos,ibuff) = precvbuffr(icvold+6)
358 pcvolddes(cv_plag_enervapor,ibuff) = precvbuffr(icvold+7)
360 pcvolddes(pcvplagmass(icont),ibuff) = precvbuffr(icvold+(cv_plag_last-1)+icont)
363 #ifdef PLAG_MPI_DEBUG
364 IF(nbuffsizedes /=0 ) &
365 WRITE(stdout,*)
' PLAG_BufferDataRecv-Done with CVOld:procDes, iReg, iBuff, pCvDes', &
366 procdes,ireg, ibuff,pcvolddes(:,ibuff)
371 parvdes(arv_plag_spload,ibuff) = precvbuffr(iarv )
372 parvdes(arv_plag_distot,ibuff) = precvbuffr(iarv+1)
374 parvolddes(arv_plag_spload,ibuff) = precvbuffr(iarvold )
375 parvolddes(arv_plag_distot,ibuff) = precvbuffr(iarvold+1)
377 #ifdef PLAG_MPI_DEBUG
378 IF(nbuffsizedes /=0 ) &
379 WRITE(stdout,*)
' PLAG_BufferDataRecv-Done with Arv:procDes, iReg, iBuff, pArvDes', &
380 procdes,ireg, ibuff,parvdes(:,ibuff),parvolddes(:,ibuff)
subroutine registerfunction(global, funName, fileName)
subroutine plag_bufferdatarecv(regions, iReg)
subroutine errorstop(global, errorCode, errorLine, addMessage)
subroutine deregisterfunction(global)