19 PUBLIC :: write_res_des
20 PUBLIC :: write_res_parray
21 PUBLIC :: write_res_carray
24 INTERFACE write_res_des
25 MODULE PROCEDURE write_res_des_0i, write_res_des_1i
26 MODULE PROCEDURE write_res_des_0d, write_res_des_1d
27 MODULE PROCEDURE write_res_des_0l, write_res_des_1l
31 INTERFACE write_res_parray
32 MODULE PROCEDURE write_res_parray_1b
39 INTERFACE write_res_carray
45 INTEGER,
PARAMETER :: rdes_unit = 901
48 INTEGER :: prootcnt, pproccnt
50 INTEGER,
allocatable :: pgather(:)
51 INTEGER,
allocatable :: pdispls(:)
54 INTEGER :: crootcnt, cproccnt
56 INTEGER,
allocatable :: cgather(:)
57 INTEGER,
allocatable :: cdispls(:)
66 SUBROUTINE open_res_des(BASE)
70 CHARACTER(len=*),
INTENT(IN) :: base
71 CHARACTER(len=32) :: lfname
74 WRITE(lfname,
'(A,I4.4,A)') base//
'_DES_',mype,
'.RES' 75 OPEN(convert=
'BIG_ENDIAN',unit=rdes_unit, file=lfname, form=
'UNFORMATTED' 76 'UNKNOWN', access=
'DIRECT', recl=
open_n1)
78 ELSEIF(mype ==
pe_io)
THEN 79 WRITE(lfname,
'(A,A)') base//
'_DES.RES' 80 OPEN(convert=
'BIG_ENDIAN',unit=rdes_unit, file=lfname, form=
'UNFORMATTED' 81 'UNKNOWN', access=
'DIRECT', recl=
open_n1)
84 END SUBROUTINE open_res_des
96 use discretelement
, only: pip, ighost_cnt
97 use discretelement
, only: neighbors, neighbor_index, neigh_num
100 CHARACTER(len=*),
INTENT(IN) :: BASE
101 DOUBLE PRECISION,
INTENT(IN) :: lVERSION
102 INTEGER,
INTENT(OUT) :: lNEXT_REC
107 INTEGER :: lGHOST_CNT
109 INTEGER :: lGatherCnts(0:
numpes-1)
113 CALL open_res_des(base)
115 allocate(pgather(0:
numpes-1))
116 allocate(pdispls(0:
numpes-1))
118 allocate(cgather(0:
numpes-1))
119 allocate(cdispls(0:
numpes-1))
126 lghost_cnt = ighost_cnt
134 pproccnt = pip - ighost_cnt
147 lgathercnts(mype) = pproccnt
154 pdispls(lproc) = pdispls(lproc-1) + pgather(lproc-1)
162 DO lc1 = 1, neigh_num
163 IF (0 .eq. neighbors(lc1))
EXIT 164 IF (lc1.eq.neighbor_index(part))
THEN 167 IF(.NOT.is_nonexistent(part) .AND. .NOT.is_nonexistent(neighbors
THEN 168 cproccnt = cproccnt +1
181 lgathercnts(mype) = cproccnt
188 cdispls(lproc) = cdispls(lproc-1) + cgather(lproc-1)
195 CALL write_res_des(lnext_rec, lversion)
196 CALL write_res_des(lnext_rec, prootcnt)
197 CALL write_res_des(lnext_rec, lghost_cnt)
198 CALL write_res_des(lnext_rec, crootcnt)
217 if(
allocated(pgather))
deallocate(pgather)
218 if(
allocated(pdispls))
deallocate(pdispls)
220 if(
allocated(cgather))
deallocate(cgather)
221 if(
allocated(cdispls))
deallocate(cdispls)
231 SUBROUTINE write_res_des_0i(lNEXT_REC, INPUT_I)
233 INTEGER,
INTENT(INOUT) :: lNEXT_REC
234 INTEGER,
INTENT(IN) :: INPUT_I
237 WRITE(rdes_unit, rec=lnext_rec) input_i
239 lnext_rec = lnext_rec + 1
242 END SUBROUTINE write_res_des_0i
250 SUBROUTINE write_res_des_1i(lNEXT_REC, INPUT_I)
252 INTEGER,
INTENT(INOUT) :: lNEXT_REC
253 INTEGER,
INTENT(IN) :: INPUT_I(:)
257 lsize =
size(input_i)
263 END SUBROUTINE write_res_des_1i
270 SUBROUTINE write_res_des_0d(lNEXT_REC, INPUT_D)
272 INTEGER,
INTENT(INOUT) :: lNEXT_REC
273 DOUBLE PRECISION,
INTENT(IN) :: INPUT_D
276 WRITE(rdes_unit, rec=lnext_rec) input_d
278 lnext_rec = lnext_rec + 1
281 END SUBROUTINE write_res_des_0d
289 SUBROUTINE write_res_des_1d(lNEXT_REC, INPUT_D)
291 INTEGER,
INTENT(INOUT) :: lNEXT_REC
292 DOUBLE PRECISION,
INTENT(IN) :: INPUT_D(:)
296 lsize =
size(input_d)
299 CALL out_bin_512(rdes_unit, input_d, lsize, lnext_rec)
302 END SUBROUTINE write_res_des_1d
309 SUBROUTINE write_res_des_0l(lNEXT_REC, INPUT_L)
311 INTEGER,
INTENT(INOUT) :: lNEXT_REC
312 LOGICAL,
INTENT(IN) :: INPUT_L
316 input_i = merge(1,0,input_l)
319 WRITE(rdes_unit, rec=lnext_rec) input_i
321 lnext_rec = lnext_rec + 1
324 END SUBROUTINE write_res_des_0l
332 SUBROUTINE write_res_des_1l(lNEXT_REC, INPUT_L)
334 INTEGER,
INTENT(INOUT) :: lNEXT_REC
335 LOGICAL,
INTENT(IN) :: INPUT_L(:)
337 INTEGER,
ALLOCATABLE :: INPUT_I(:)
339 INTEGER :: lSIZE, LC1
341 lsize =
size(input_l)
342 ALLOCATE(input_i(lsize))
345 input_i(lc1) = merge(1,0,input_l(lc1))
351 IF(
allocated(input_i))
deallocate(input_i)
354 END SUBROUTINE write_res_des_1l
361 SUBROUTINE write_res_parray_1b(lNEXT_REC, INPUT_B, pLOC2GLB)
364 use discretelement
, only: max_pip, pip
365 use discretelement
, only: iglobal_id
368 INTEGER,
INTENT(INOUT) :: lNEXT_REC
369 INTEGER(KIND=1),
INTENT(IN) :: INPUT_B(:)
370 LOGICAL,
INTENT(IN),
OPTIONAL :: pLOC2GLB
372 INTEGER,
ALLOCATABLE :: INPUT_I(:)
378 IF(
present(ploc2glb)) lloc2glb = ploc2glb
381 allocate(irootbuf(prootcnt))
383 allocate(input_i(
size(input_b)))
385 input_i(:) = input_b(:)
388 igath_sendcnt = psend
389 igathercnts = pgather
396 IF(is_nonexistent(lc1)) cycle
397 iprocbuf(lc1) = iglobal_id(input_i(lc2))
403 IF(is_nonexistent(lc1)) cycle
413 CALL out_bin_512i(rdes_unit,irootbuf, prootcnt, lnext_rec)
421 END SUBROUTINE write_res_parray_1b
431 use discretelement
, only: max_pip, pip
432 use discretelement
, only: iglobal_id
435 INTEGER,
INTENT(INOUT) :: lNEXT_REC
436 INTEGER,
INTENT(IN) :: INPUT_I(:)
437 LOGICAL,
INTENT(IN),
OPTIONAL :: pLOC2GLB
444 IF(
present(ploc2glb)) lloc2glb = ploc2glb
447 allocate(irootbuf(prootcnt))
450 igath_sendcnt = psend
451 igathercnts = pgather
459 IF(is_nonexistent(lc1)) cycle
460 iprocbuf(lc1) = iglobal_id(input_i(lc2))
466 IF(is_nonexistent(lc1)) cycle
476 CALL out_bin_512i(rdes_unit,irootbuf, prootcnt, lnext_rec)
492 use discretelement
, only: max_pip, pip
497 INTEGER,
INTENT(INOUT) :: lNEXT_REC
498 DOUBLE PRECISION,
INTENT(IN) :: INPUT_D(:)
515 IF(is_nonexistent(lc1)) cycle
540 use discretelement
, only: max_pip, pip
543 INTEGER,
INTENT(INOUT) :: lNEXT_REC
544 LOGICAL,
INTENT(IN) :: INPUT_L(:)
550 allocate(irootbuf(prootcnt))
553 igath_sendcnt = psend
554 igathercnts = pgather
560 IF(is_nonexistent(lc1)) cycle
561 iprocbuf(lc1) = merge(1,0,input_l(lc2))
568 CALL out_bin_512i(rdes_unit,irootbuf, prootcnt, lnext_rec)
585 use discretelement
, only: neighbors, neighbor_index, neigh_num
587 use discretelement
, only: iglobal_id
589 INTEGER,
INTENT(INOUT) :: lNEXT_REC
590 INTEGER,
INTENT(IN) :: INPUT_I(:)
591 LOGICAL,
INTENT(IN),
OPTIONAL :: pLOC2GLB
595 INTEGER :: LC1, LC2, part
598 IF(
present(ploc2glb)) lloc2glb = ploc2glb
601 allocate(irootbuf(crootcnt))
604 igath_sendcnt = csend
605 igathercnts = cgather
610 DO lc1 = 1, neigh_num
611 IF (0 .eq. neighbors(lc1))
EXIT 612 IF (lc1.eq.neighbor_index(part))
THEN 615 IF(.NOT.is_nonexistent(part) .AND. .NOT.is_nonexistent(neighbors
THEN 617 iprocbuf(lc2) = iglobal_id(input_i(lc1))
631 CALL out_bin_512i(rdes_unit,irootbuf, crootcnt, lnext_rec)
649 use discretelement
, only: neighbors, neighbor_index, neigh_num
652 INTEGER,
INTENT(INOUT) :: lNEXT_REC
653 DOUBLE PRECISION,
INTENT(IN) :: INPUT_D(:)
656 INTEGER :: LC1, LC2, part
658 allocate(dprocbuf(cproccnt))
662 igath_sendcnt = csend
663 igathercnts = cgather
667 DO lc1 = 1, neigh_num
668 IF (0 .eq. neighbors(lc1))
EXIT 669 IF (lc1.eq.neighbor_index(part))
THEN 672 IF(.NOT.is_nonexistent(part) .AND. .NOT.is_nonexistent(neighbors
THEN 673 dprocbuf(lc2) = input_d(lc1)
679 CALL out_bin_512(rdes_unit, dprocbuf, cproccnt, lnext_rec)
702 use discretelement
, only: neighbors, neighbor_index, neigh_num
705 INTEGER,
INTENT(INOUT) :: lNEXT_REC
706 LOGICAL,
INTENT(IN) :: INPUT_L(:)
709 INTEGER :: LC1, LC2, part
712 allocate(irootbuf(crootcnt))
715 igath_sendcnt = csend
716 igathercnts = cgather
721 DO lc1 = 1, neigh_num
722 IF (0 .eq. neighbors(lc1))
EXIT 723 IF (lc1.eq.neighbor_index(part))
THEN 726 IF(.NOT.is_nonexistent(part) .AND. .NOT.is_nonexistent(neighbors
THEN 727 iprocbuf(lc2) = merge(1,0,input_l(lc1))
738 CALL out_bin_512i(rdes_unit,irootbuf, crootcnt, lnext_rec)
integer, dimension(:), allocatable igathercnts
subroutine write_res_carray_1l(lNEXT_REC, INPUT_L)
double precision, dimension(:), allocatable dprocbuf
subroutine, public init_write_res_des(BASE, lVERSION, lNEXT_REC)
subroutine desmpi_gatherv(ptype, pdebug)
subroutine write_res_parray_1d(lNEXT_REC, INPUT_D)
integer, dimension(:), allocatable irootbuf
subroutine write_res_parray_1i(lNEXT_REC, INPUT_I, pLOC2GLB)
subroutine write_res_parray_1l(lNEXT_REC, INPUT_L)
integer, dimension(:), allocatable iprocbuf
subroutine out_bin_512(IUNIT, ARRAY, N, NEXT_REC)
subroutine write_res_carray_1d(lNEXT_REC, INPUT_D)
subroutine write_res_carray_1i(lNEXT_REC, INPUT_I, pLOC2GLB)
integer, dimension(:), allocatable idispls
double precision, dimension(:), allocatable drootbuf
subroutine out_bin_512i(IUNIT, ARRAY, N, NEXT_REC)
subroutine, public finl_write_res_des