63 TYPE(t_region
),
POINTER :: regions(:)
68 INTEGER :: ipatch, ibuff, icont
71 CHARACTER(CHRLEN) :: rcsidentstring
74 INTEGER :: statusplag(mpi_status_size)
77 INTEGER :: bctype, ilev, ipatchdes, iregdes, &
78 irequestplag, narv, naiv, nbuffsizesrc, ncont, &
79 ncv, ndimi, ndimr, ndv, npatches, nsendbuffi, &
80 nsendbuffr, ntv, procdes, tagdesi, tagdesr
82 INTEGER :: ibegsrc, iendsrc, jbegsrc, jendsrc, kbegsrc, kendsrc, &
83 idirsrc, jdirsrc, kdirsrc, icoffsrc, ijcoffsrc, &
84 ibegdes, ienddes, jbegdes, jenddes, kbegdes, kenddes, &
85 idirdes, jdirdes, kdirdes, icoffdes, ijcoffdes, ilevdes
87 INTEGER :: lbsrc, lbdes, l1desdir, l2desdir, mapmat(3,4), &
88 ndumcellssrc, ndumcellsdes
90 INTEGER :: indexisrc, indexjsrc, indexksrc, icellssrc, &
91 indexides, indexjdes, indexkdes, icellsdes
93 INTEGER :: iaiv, iarv, iarvold, ibuffsend, icv, icvold, irhs, irhssum
95 INTEGER,
POINTER,
DIMENSION(:) :: pcvplagmass, psendbuffi
97 INTEGER,
POINTER,
DIMENSION(:,:) :: paivsrc
99 LOGICAL :: alignsrc, aligndes
101 REAL(RFREAL),
POINTER,
DIMENSION(:) :: psendbuffr
103 REAL(RFREAL),
POINTER,
DIMENSION(:,:) :: parvsrc, parvoldsrc, &
104 pcvsrc , pcvoldsrc , &
107 TYPE(t_patch),
POINTER :: ppatchsrc, ppatchdes
108 TYPE(t_plag),
POINTER :: pplag
109 TYPE(t_region
),
POINTER :: pregionsrc, pregiondes
114 rcsidentstring =
'$RCSfile: PLAG_BufferDataSend.F90,v $ $Revision: 1.6 $'
116 global => regions(ireg)%global
119 'PLAG_BufferDataSend.F90' )
123 ncont = regions(ireg)%plagInput%nCont
124 ncv = cv_plag_last + ncont
131 ndimr = 2*narv +4*ncv
135 pregionsrc => regions(ireg)
137 ilev = pregionsrc%currLevel
138 npatches = pregionsrc%nPatches
140 ndumcellssrc = pregionsrc%nDumCells
142 pplag => pregionsrc%levels(ilev)%plag
143 pcvplagmass => pplag%cvPlagMass
147 DO ipatch = 1, npatches
151 ppatchsrc => regions(ireg)%levels(ilev)%patches(ipatch)
153 bctype = ppatchsrc%bcType
154 iregdes = ppatchsrc%srcRegion
155 ipatchdes = ppatchsrc%srcPatch
160 jbegsrc,jendsrc,kbegsrc,kendsrc )
166 IF ( (bctype>=bc_regionconf .AND. bctype<=bc_regionconf+bc_range) .OR. &
167 (bctype>=bc_regionint .AND. bctype<=bc_regionint +bc_range) .OR. &
168 (bctype>=bc_regnonconf .AND. bctype<=bc_regnonconf+bc_range) .OR. &
169 (bctype>=bc_tra_peri .AND. bctype<=bc_tra_peri +bc_range) .OR. &
170 (bctype>=bc_rot_peri .AND. bctype<=bc_rot_peri +bc_range) )
THEN
172 IF ( regions(iregdes)%procid /= global%myProcid )
THEN
173 pregiondes => regions(iregdes)
174 ppatchdes => pregiondes%levels(ilev)%patches(ipatchdes)
178 paivsrc => ppatchsrc%bufferPlag%aiv
179 parvsrc => ppatchsrc%bufferPlag%arv
181 pcvsrc => ppatchsrc%bufferPlag%cv
182 prhssrc => ppatchsrc%bufferPlag%rhs
183 prhssumsrc => ppatchsrc%bufferPlag%rhsSum
185 parvoldsrc => ppatchsrc%bufferPlag%arvOld
186 pcvoldsrc => ppatchsrc%bufferPlag%cvOld
188 psendbuffi => ppatchsrc%bufferPlag%sendBuffI
189 psendbuffr => ppatchsrc%bufferPlag%sendBuffR
191 nbuffsizesrc = ppatchsrc%bufferPlag%nBuffSize
195 IF ( nbuffsizesrc == 0 ) goto 999
197 nsendbuffi = ndimi * nbuffsizesrc
198 nsendbuffr = ndimr * nbuffsizesrc
200 ppatchsrc%bufferPlag%nSendBuffI = nsendbuffi
201 ppatchsrc%bufferPlag%nSendBuffR = nsendbuffr
203 irequestplag = ppatchsrc%bufferPlag%iRequest
205 procdes = pregiondes%procid
207 #ifdef PLAG_MPI_DEBUG
208 IF( nbuffsizesrc /=0 )&
209 WRITE(stdout,*)
' PLAG_BufferSizeSend: iReg, nBuffSizeSrc, nDimI, nDimR, nSendBuffI, nSendBuffR, iRequestPlag = ',&
210 ireg, nbuffsizesrc, ndimi, ndimr, nsendbuffi, nsendbuffr, irequestplag
215 ilevdes = pregiondes%currLevel
216 ndumcellsdes = pregiondes%nDumCells
218 jbegdes,jenddes,kbegdes,kenddes )
222 #ifdef PLAG_MPI_DEBUG
223 IF( nbuffsizesrc /=0 )&
224 WRITE(stdout,*)
' PLAG_BufferDataSend: iReg,ibegSrc,iendSrc,jbegSrc,jendSrc,kbegSrc,kendSrc = ',&
225 ireg,ibegsrc,iendsrc,jbegsrc,jendsrc,kbegsrc,kendsrc
227 IF( nbuffsizesrc /=0 )&
228 WRITE(stdout,*)
' PLAG_BufferDataSend: iRegDes,ibegDes,iendDes,jbegDes,jendDes,kbegDes,kendDes = ',&
229 iregdes,ibegdes,ienddes,jbegdes,jenddes,kbegdes,kenddes
235 IF (ppatchsrc%srcL1beg > ppatchsrc%srcL1end) l1desdir = -1
237 IF (ppatchsrc%srcL2beg > ppatchsrc%srcL2end) l2desdir = -1
239 lbsrc = ppatchsrc%lbound
240 lbdes = ppatchsrc%srcLbound
241 alignsrc = ppatchsrc%align
244 idirsrc,jdirsrc,kdirsrc, &
245 idirdes,jdirdes,kdirdes, &
246 ibegsrc,iendsrc,jbegsrc,jendsrc, &
248 ibegdes,ienddes,jbegdes,jenddes, &
249 kbegdes,kenddes,mapmat )
255 DO ibuff = 1, nbuffsizesrc
259 ibuffsend = ndimi*(ibuff-1) +1
263 icellssrc = paivsrc(aiv_plag_icells,ibuff)
264 indexisrc = paivsrc(aiv_plag_indexi,ibuff)
265 indexjsrc = paivsrc(aiv_plag_indexj,ibuff)
266 indexksrc = paivsrc(aiv_plag_indexk,ibuff)
270 icellsdes =
indijkmap( indexisrc,indexjsrc,indexksrc, &
271 mapmat,icoffdes,ijcoffdes )
272 CALL
getijk( icellsdes,icoffdes,ijcoffdes,ndumcellsdes,&
273 indexides,indexjdes,indexkdes)
278 psendbuffi(iaiv ) = paivsrc(aiv_plag_pidini,ibuff)
279 psendbuffi(iaiv+1) = paivsrc(aiv_plag_regini,ibuff)
280 psendbuffi(iaiv+2) = iregdes
281 psendbuffi(iaiv+3) = icellsdes
282 psendbuffi(iaiv+4) = indexides
283 psendbuffi(iaiv+5) = indexjdes
284 psendbuffi(iaiv+6) = indexkdes
285 psendbuffi(iaiv+7) = paivsrc(aiv_plag_burnstat,ibuff)
286 psendbuffi(iaiv+8) = paivsrc(aiv_plag_status,ibuff)
288 #ifdef PLAG_MPI_DEBUG
289 IF( nbuffsizesrc /=0 )&
290 WRITE(stdout,*)
' PLAG_BufferDataSend-INT: procDes, iBuff, iAiv, iCellsDes, indexIDes, indexJDes, indexKDes = ',&
291 procdes, ibuff, iaiv, icellsdes, indexides, indexjdes, indexkdes
298 DO ibuff = 1, nbuffsizesrc
302 ibuffsend = ndimr*(ibuff-1) +1
304 irhs = ibuffsend +ncv
305 irhssum = ibuffsend +2*ncv
306 icvold = ibuffsend +3*ncv
307 iarv = ibuffsend +4*ncv
308 iarvold = ibuffsend +4*ncv +narv
310 #ifdef PLAG_MPI_DEBUG
311 IF( nbuffsizesrc /=0 )&
312 WRITE(stdout,*)
' PLAG_BufferDataSend-REAL: procDes,iBuff, iBuffSend, iCv, iRhs, iRhsSum, iCvOld, iArv, iArvOld = ',&
313 procdes,ibuff, ibuffsend, icv, irhs, irhssum, icvold, iarv, iarvold
318 psendbuffr(icv ) = pcvsrc(cv_plag_xmom,ibuff)
319 psendbuffr(icv+1) = pcvsrc(cv_plag_ymom,ibuff)
320 psendbuffr(icv+2) = pcvsrc(cv_plag_zmom,ibuff)
321 psendbuffr(icv+3) = pcvsrc(cv_plag_ener,ibuff)
322 psendbuffr(icv+4) = pcvsrc(cv_plag_xpos,ibuff)
323 psendbuffr(icv+5) = pcvsrc(cv_plag_ypos,ibuff)
324 psendbuffr(icv+6) = pcvsrc(cv_plag_zpos,ibuff)
325 psendbuffr(icv+7) = pcvsrc(cv_plag_enervapor,ibuff)
327 psendbuffr(icv+(cv_plag_last-1)+icont) = pcvsrc(pcvplagmass(icont),ibuff)
332 psendbuffr(irhs ) = prhssrc(cv_plag_xmom,ibuff)
333 psendbuffr(irhs+1) = prhssrc(cv_plag_ymom,ibuff)
334 psendbuffr(irhs+2) = prhssrc(cv_plag_zmom,ibuff)
335 psendbuffr(irhs+3) = prhssrc(cv_plag_ener,ibuff)
336 psendbuffr(irhs+4) = prhssrc(cv_plag_xpos,ibuff)
337 psendbuffr(irhs+5) = prhssrc(cv_plag_ypos,ibuff)
338 psendbuffr(irhs+6) = prhssrc(cv_plag_zpos,ibuff)
339 psendbuffr(irhs+7) = prhssrc(cv_plag_enervapor,ibuff)
341 psendbuffr(irhs+(cv_plag_last-1)+icont) = prhssrc(pcvplagmass(icont),ibuff)
346 psendbuffr(irhssum ) = prhssumsrc(cv_plag_xmom,ibuff)
347 psendbuffr(irhssum+1) = prhssumsrc(cv_plag_ymom,ibuff)
348 psendbuffr(irhssum+2) = prhssumsrc(cv_plag_zmom,ibuff)
349 psendbuffr(irhssum+3) = prhssumsrc(cv_plag_ener,ibuff)
350 psendbuffr(irhssum+4) = prhssumsrc(cv_plag_xpos,ibuff)
351 psendbuffr(irhssum+5) = prhssumsrc(cv_plag_ypos,ibuff)
352 psendbuffr(irhssum+6) = prhssumsrc(cv_plag_zpos,ibuff)
353 psendbuffr(irhssum+7) = prhssumsrc(cv_plag_enervapor,ibuff)
355 psendbuffr(irhssum+(cv_plag_last-1)+icont) = prhssumsrc(pcvplagmass(icont),ibuff)
360 psendbuffr(icvold ) = pcvoldsrc(cv_plag_xmom,ibuff)
361 psendbuffr(icvold+1) = pcvoldsrc(cv_plag_ymom,ibuff)
362 psendbuffr(icvold+2) = pcvoldsrc(cv_plag_zmom,ibuff)
363 psendbuffr(icvold+3) = pcvoldsrc(cv_plag_ener,ibuff)
364 psendbuffr(icvold+4) = pcvoldsrc(cv_plag_xpos,ibuff)
365 psendbuffr(icvold+5) = pcvoldsrc(cv_plag_ypos,ibuff)
366 psendbuffr(icvold+6) = pcvoldsrc(cv_plag_zpos,ibuff)
367 psendbuffr(icvold+7) = pcvoldsrc(cv_plag_enervapor,ibuff)
369 psendbuffr(icvold+(cv_plag_last-1)+icont) = pcvoldsrc(pcvplagmass(icont),ibuff)
374 psendbuffr(iarv ) = parvsrc(arv_plag_spload,ibuff)
375 psendbuffr(iarv+1) = parvsrc(arv_plag_distot,ibuff)
379 psendbuffr(iarvold ) = parvoldsrc(arv_plag_spload,ibuff)
380 psendbuffr(iarvold+1) = parvoldsrc(arv_plag_distot,ibuff)
388 tagdesi = regions(iregdes)%localNumber &
389 + plag_tag_shift +mpi_patchoff*ipatchdes*iregdes + procdes +1
391 IF(tagdesi .gt. global%mpiTagMax) tagdesi = mod(tagdesi,global%mpiTagMax)
392 #ifdef PLAG_MPI_DEBUG
393 IF( nbuffsizesrc /=0 )&
394 WRITE(stdout,*)
' PLAG_BufferDataSend-Integer: iReg, iRegDes, procDes, tagDesI = ',&
395 ireg, iregdes, procdes,tagdesi
398 CALL mpi_isend( psendbuffi,nsendbuffi,mpi_integer, &
399 procdes,tagdesi,global%mpiComm, &
400 pplag%requestsI(irequestplag),global%mpierr )
402 IF (global%mpierr /= err_none) &
403 CALL
errorstop( global,err_mpi_trouble,__line__ )
407 tagdesr = regions(iregdes)%localNumber &
408 + plag_tag_shift +mpi_patchoff*ipatchdes*iregdes + procdes +2
410 IF(tagdesr .gt. global%mpiTagMax) tagdesr = mod(tagdesr,global%mpiTagMax)
411 #ifdef PLAG_MPI_DEBUG
412 IF( nbuffsizesrc /=0 )&
413 WRITE(stdout,*)
' PLAG_BufferDataSend-Real: iReg, iRegDes, procDes, tagDesR = ',&
414 ireg, iregdes, procdes,tagdesr
417 CALL mpi_isend( psendbuffr,nsendbuffr,mpi_rfreal, &
418 procdes,tagdesr,global%mpiComm, &
419 pplag%requestsR(irequestplag),global%mpierr )
421 IF (global%mpierr /= err_none) &
422 CALL
errorstop( global,err_mpi_trouble,__line__ )
subroutine rflo_getpatchdirection(patch, idir, jdir, kdir)
INTEGER function indijkmap(i, j, k, mapMat, iOffset, ijOffset)
subroutine plag_bufferdatasend(regions, iReg)
subroutine registerfunction(global, funName, fileName)
subroutine rflo_getpatchindices(region, patch, iLev, ibeg, iend, jbeg, jend, kbeg, kend)
subroutine rflo_getcelloffset(region, iLev, iCellOffset, ijCellOffset)
subroutine errorstop(global, errorCode, errorLine, addMessage)
subroutine rflo_getpatchmapping(lb, lbs, l1SrcDir, l2SrcDir, align, idir, jdir, kdir, idirSrc, jdirSrc, kdirSrc, ibeg, iend, jbeg, jend, kbeg, kend, ibegSrc, iendSrc, jbegSrc, jendSrc, kbegSrc, kendSrc, mapMat)
subroutine deregisterfunction(global)
subroutine getijk(ijk, iOffset, ijOffset, nDumCells, i, j, k)