35
36
37
38 USE spmd_comm_world_mod, ONLY : spmd_comm_world
39#include "implicit_f.inc"
40#include "spmd.inc"
41
42
43
44#include "com01_c.inc"
45#include "com04_c.inc"
46#include "task_c.inc"
47#include "spmd_c.inc"
48
49
50
52 . x(3,*)
53 INTEGER WEIGHT(*),NODGLOB(*),NUM,SRECBUF
54
55
56
57#ifdef MPI
58 INTEGER STATUS(MPI_STATUS_SIZE),IERROR,MSGOFF
59 INTEGER SIZ,MSGTYP,I,K,NG,NREC,MSGOFF2
60
61 DATA msgoff/7003/
62 DATA msgoff2/7004/
63 REAL, DIMENSION(:,:) , ALLOCATABLE :: BUFSR
64 INTEGER, DIMENSION(:), ALLOCATABLE :: IBUF
65
66 REAL, DIMENSION(:,:), ALLOCATABLE :: XGLOB
67
68 ALLOCATE(bufsr(3,numnodm), ibuf(numnodm))
69 ALLOCATE(xglob(3,num))
70
71 IF (ispmd/=0) THEN
72
73 siz = 0
74 DO i=1,numnod
75 IF (weight(i)==1) THEN
76 siz = siz + 1
77 ibuf(siz) = nodglob(i)
78 bufsr(1,siz) = x(1,i)
79 bufsr(2,siz) = x(2,i)
80 bufsr(3,siz) = x(3,i)
81 END IF
82 END DO
83
84
85
86
87
88 msgtyp = msgoff2
89 CALL mpi_send(ibuf,siz,mpi_integer,it_spmd(1),msgtyp,
90 . spmd_comm_world,ierror)
91
92 msgtyp = msgoff
93 CALL mpi_send(bufsr,3*siz,mpi_real,it_spmd(1),msgtyp,
94 . spmd_comm_world,ierror)
95
96 ELSE
97 DO i=1,numnod
98 IF (weight(i)==1) THEN
99 ng = nodglob(i)
100 xglob(1,ng) = x(1,i)
101 xglob(2,ng) = x(2,i)
102 xglob(3,ng) = x(3,i)
103 ENDIF
104 ENDDO
105
106 DO i=2,nspmd
107
108
109 msgtyp = msgoff2
110
112 . spmd_comm_world,status,ierror)
114
115 CALL mpi_recv(ibuf,siz,mpi_integer,it_spmd(i),msgtyp,
116 . spmd_comm_world,status,ierror)
117
118
119
120 msgtyp = msgoff
121 CALL mpi_recv(bufsr,3*siz,mpi_real,it_spmd(i),msgtyp,
122 . spmd_comm_world,status,ierror)
123
124 nrec = siz
125
126 DO k = 1, nrec
127 ng = ibuf(k)
128 xglob(1,ng) = bufsr(1,k)
129 xglob(2,ng) = bufsr(2,k)
130 xglob(3,ng) = bufsr(3,k)
131 ENDDO
132 ENDDO
134
135 ENDIF
136 DEALLOCATE (bufsr,ibuf,xglob)
137
138#endif
139 RETURN
subroutine mpi_recv(buf, cnt, datatype, source, tag, comm, status, ierr)
subroutine mpi_get_count(status, datatype, cnt, ierr)
subroutine mpi_send(buf, cnt, datatype, dest, tag, comm, ierr)
subroutine mpi_probe(source, tag, comm, status, ierr)
void write_r_c(float *w, int *len)