67 CHARACTER(CHRLEN) :: RCSIdentString = &
68 '$RCSfile: PLAG_ModDataStruct.F90,v $ $Revision: 1.5 $'
118 TYPE(t_region
),
POINTER :: pregion
124 INTEGER :: errorflag,icg,icsr,iloc,ipcl
125 INTEGER,
DIMENSION(:),
POINTER :: npclspercell
127 TYPE(t_grid),
POINTER :: pgrid
128 TYPE(t_plag),
POINTER :: pplag
134 global => pregion%global
137 'PLAG_ModDataStruct.F90')
139 IF ( global%verbLevel > verbose_none )
THEN
140 WRITE(stdout,
'(A,1X,A)') solver_name,
'Building cell-to-particle list...'
141 WRITE(stdout,
'(A,3X,A,1X,I5.5)') solver_name,
'Global region:', &
142 pregion%iRegionGlobal
149 pgrid => pregion%grid
150 pplag => pregion%plag
152 pplag%nCellsNzPcl = 0
153 pplag%nCellsNzPclMax =
min(1000,pgrid%nCells)
162 DO ipcl = 1,pplag%nPcls
163 icg = pplag%aiv(aiv_plag_icells,ipcl)
165 IF ( pplag%nCellsNzPcl > 0 )
THEN
167 pplag%nCellsNzPcl,icg,iloc)
169 IF ( iloc == element_not_found )
THEN
170 IF ( pplag%nCellsNzPcl == pplag%nCellsNzPclMax )
THEN
174 pplag%nCellsNzPcl = pplag%nCellsNzPcl + 1
175 pplag%icgNzPcl(pplag%nCellsNzPcl) = icg
176 pplag%iPclPerCellCSRInfo(pplag%nCellsNzPcl) = 1
179 pplag%iPclPerCellCSRInfo(1:pplag%nCellsNzPcl),pplag%nCellsNzPcl)
181 pplag%iPclPerCellCSRInfo(iloc) = pplag%iPclPerCellCSRInfo(iloc) + 1
184 pplag%nCellsNzPcl = 1
185 pplag%icgNzPcl(1) = icg
186 pplag%iPclPerCellCSRInfo(1) = 1
190 IF ( global%verbLevel > verbose_low )
THEN
191 WRITE(stdout,
'(A,3X,A,1X,I6)') solver_name,
'Number of cells with '// &
192 'non-zero particles:',pplag%nCellsNzPcl
203 DO icg = 2,pplag%nCellsNzPcl
204 pplag%iPclPerCellCSRInfo(icg) = pplag%iPclPerCellCSRInfo(icg) &
205 + pplag%iPclPerCellCSRInfo(icg-1)
208 IF ( pplag%iPclPerCellCSRInfo(pplag%nCellsNzPcl) /= pplag%nPcls )
THEN
209 CALL
errorstop(global,err_plag_dstr_invalid,__line__)
212 ALLOCATE(npclspercell(pgrid%nCells),stat=errorflag)
213 global%error = errorflag
214 IF ( global%error /= err_none )
THEN
215 CALL
errorstop(global,err_allocate,__line__,
'nPclsPerCell')
218 DO icg = 1,pgrid%nCells
219 npclspercell(icg) = 0
222 DO ipcl = 1,pplag%nPcls
223 icg = pplag%aiv(aiv_plag_icells,ipcl)
226 pplag%nCellsNzPcl,icg,iloc)
228 IF ( iloc /= element_not_found )
THEN
229 npclspercell(icg) = npclspercell(icg) + 1
232 icsr = pplag%iPclPerCellCSRInfo(iloc-1) + 1
237 icsr = icsr + npclspercell(icg) - 1
239 IF ( icsr > pplag%nPcls )
THEN
240 CALL
errorstop(global,err_plag_dstr_invalid,__line__)
243 pplag%iPclPerCellCSR(icsr) = ipcl
245 CALL
errorstop(global,err_plag_dstr_invalid,__line__)
249 DEALLOCATE(npclspercell,stat=errorflag)
250 global%error = errorflag
251 IF ( global%error /= err_none )
THEN
252 CALL
errorstop(global,err_deallocate,__line__,
'nPclsPerCell')
259 IF ( global%verbLevel > verbose_none )
THEN
260 WRITE(stdout,
'(A,1X,A)') solver_name,
'Building cell-to-particle list done.'
303 INTEGER,
INTENT(IN) ::ipcl
305 TYPE(t_plag),
POINTER :: pplag,pplag2
318 'PLAG_ModDataStruct.F90')
324 pplag2%nPcls = pplag2%nPcls + 1
326 IF ( pplag2%nPcls > pplag2%nPclsMax )
THEN
327 CALL
errorstop(global,err_plag_memoverflow,__line__)
330 IF ( (lbound(pplag2%cv,1) /= lbound(pplag%cv,1)) .OR. &
331 (ubound(pplag2%cv,1) /= ubound(pplag%cv,1)) )
THEN
332 CALL
errorstop(global,err_lubound_mismatch,__line__)
335 IF ( (lbound(pplag2%arv,1) /= lbound(pplag%arv,1)) .OR. &
336 (ubound(pplag2%arv,1) /= ubound(pplag%arv,1)) )
THEN
337 CALL
errorstop(global,err_lubound_mismatch,__line__)
340 IF ( (lbound(pplag2%aiv,1) /= lbound(pplag%aiv,1)) .OR. &
341 (ubound(pplag2%aiv,1) /= ubound(pplag%aiv,1)) )
THEN
342 CALL
errorstop(global,err_lubound_mismatch,__line__)
349 DO ivar = 1,pplag2%nCv
350 pplag2%cv(ivar,pplag2%nPcls) = pplag%cv(ivar,ipcl)
353 DO ivar = 1,pplag2%nArv
354 pplag2%arv(ivar,pplag2%nPcls) = pplag%arv(ivar,ipcl)
357 DO ivar = 1,pplag2%nAiv
358 pplag2%aiv(ivar,pplag2%nPcls) = pplag%aiv(ivar,ipcl)
406 TYPE(t_plag),
POINTER :: pplag,pplag2
419 'PLAG_ModDataStruct.F90')
425 DO ipcl = 1,pplag%nPcls
470 TYPE(t_region
),
POINTER :: pregion
476 INTEGER :: errorflag,icg
478 TYPE(t_plag),
POINTER :: pplag
484 global => pregion%global
487 'PLAG_ModDataStruct.F90')
493 pplag => pregion%plag
495 ALLOCATE(pplag%icgNzPcl(pplag%nCellsNzPclMax),stat=errorflag)
496 global%error = errorflag
497 IF ( global%error /= err_none )
THEN
498 CALL
errorstop(global,err_allocate,__line__,
'pPlag%icgNzPcl')
501 ALLOCATE(pplag%iPclPerCellCSRInfo(pplag%nCellsNzPclMax),stat=errorflag)
502 global%error = errorflag
503 IF ( global%error /= err_none )
THEN
504 CALL
errorstop(global,err_allocate,__line__,
'pPlag%iPclPerCellCSRInfo')
507 DO icg = 1,pplag%nCellsNzPclMax
508 pplag%iPclPerCellCSRInfo(icg) = 0
552 TYPE(t_region
),
POINTER :: pregion
560 TYPE(t_plag),
POINTER :: pplag
566 global => pregion%global
569 'PLAG_ModDataStruct.F90')
575 pplag => pregion%plag
577 IF ( pplag%nPcls > 0 )
THEN
578 ALLOCATE(pplag%iPclPerCellCSR(pplag%nPcls),stat=errorflag)
579 global%error = errorflag
580 IF ( global%error /= err_none )
THEN
581 CALL
errorstop(global,err_allocate,__line__,
'pPlag%iPclPerCellCSR')
625 TYPE(t_region
),
POINTER :: pregion
633 TYPE(t_plag),
POINTER :: pplag
639 global => pregion%global
642 'PLAG_ModDataStruct.F90')
648 pplag => pregion%plag
650 DEALLOCATE(pplag%icgNzPcl,stat=errorflag)
651 global%error = errorflag
652 IF ( global%error /= err_none )
THEN
653 CALL
errorstop(global,err_deallocate,__line__,
'pPlag%icgNzPcl')
656 DEALLOCATE(pplag%iPclPerCellCSRInfo,stat=errorflag)
657 global%error = errorflag
658 IF ( global%error /= err_none )
THEN
659 CALL
errorstop(global,err_deallocate,__line__,
'pPlag%iPclPerCellCSRInfo')
702 TYPE(t_region
),
POINTER :: pregion
710 TYPE(t_plag),
POINTER :: pplag
716 global => pregion%global
719 'PLAG_ModDataStruct.F90')
725 pplag => pregion%plag
727 IF (
ASSOCIATED(pplag%iPclPerCellCSR) .EQV. .true. )
THEN
728 DEALLOCATE(pplag%iPclPerCellCSR,stat=errorflag)
729 global%error = errorflag
730 IF ( global%error /= err_none )
THEN
731 CALL
errorstop(global,err_deallocate,__line__,
'pPlag%iPclPerCellCSR')
778 TYPE(t_plag),
POINTER :: pplag,pplag2
779 TYPE(t_region
),
POINTER :: pregion
785 INTEGER :: icg,icg2,ipcl,npclsnew,npclsold
787 TYPE(t_grid),
POINTER :: pgrid
793 global => pregion%global
796 'PLAG_ModDataStruct.F90')
802 pgrid => pregion%grid
808 npclsold = pplag2%nPcls
812 npclsnew = pplag2%nPcls
814 DO ipcl = npclsold+1,npclsnew
815 icg2 = pplag2%aiv(aiv_plag_icells,ipcl)
816 icg = pgrid%pc2sc(icg2)
818 pplag2%aiv(aiv_plag_icells,ipcl) = icg
819 pplag2%aiv(aiv_plag_regini,ipcl) = pregion%iRegionGlobal
863 TYPE(t_region
),
POINTER :: pregion
869 INTEGER :: errorflag,icl
870 INTEGER,
DIMENSION(:),
POINTER :: temparray1,temparray2
872 TYPE(t_grid),
POINTER :: pgrid
873 TYPE(t_plag),
POINTER :: pplag
879 global => pregion%global
882 'PLAG_ModDataStruct.F90')
888 pgrid => pregion%grid
889 pplag => pregion%plag
891 ALLOCATE(temparray1(pplag%nCellsNzPcl),stat=errorflag)
892 global%error = errorflag
893 IF ( global%error /= err_none )
THEN
894 CALL
errorstop(global,err_allocate,__line__,
'tempArray1')
897 ALLOCATE(temparray2(pplag%nCellsNzPcl),stat=errorflag)
898 global%error = errorflag
899 IF ( global%error /= err_none )
THEN
900 CALL
errorstop(global,err_allocate,__line__,
'tempArray2')
903 DO icl = 1,pplag%nCellsNzPcl
904 temparray1(icl) = pplag%icgNzPcl(icl)
905 temparray2(icl) = pplag%iPclPerCellCSRInfo(icl)
914 pplag%nCellsNzPclMax =
min(2*pplag%nCellsNzPclMax,pgrid%nCells)
922 DO icl = 1,pplag%nCellsNzPcl
923 pplag%icgNzPcl(icl) = temparray1(icl)
924 pplag%iPclPerCellCSRInfo(icl) = temparray2(icl)
927 DEALLOCATE(temparray1,stat=errorflag)
928 global%error = errorflag
929 IF ( global%error /= err_none )
THEN
930 CALL
errorstop(global,err_deallocate,__line__,
'tempArray1')
933 DEALLOCATE(temparray2,stat=errorflag)
934 global%error = errorflag
935 IF ( global%error /= err_none )
THEN
936 CALL
errorstop(global,err_deallocate,__line__,
'tempArray2')
subroutine, public plag_dstr_destroypcllistcsr(pRegion)
subroutine plag_dstr_createcell2pcllist(pRegion)
subroutine registerfunction(global, funName, fileName)
subroutine binarysearchinteger(a, n, v, i, j)
subroutine, public plag_dstr_createpcllistcsr(pRegion)
subroutine plag_dstr_recreatecell2pcllist(pRegion)
subroutine plag_dstr_copyparticle(global, pPlag, pPlag2, iPcl)
subroutine quicksortintegerinteger(a, b, n)
subroutine, public plag_dstr_buildcell2pcllist(pRegion)
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
subroutine, public plag_dstr_mergeparticlewrapper(pRegion, pPlag, pPlag2)
subroutine errorstop(global, errorCode, errorLine, addMessage)
subroutine, public plag_dstr_destroycell2pcllist(pRegion)
subroutine deregisterfunction(global)
subroutine, public plag_dstr_copyparticlewrapper(global, pPlag, pPlag2)