33
34
35
36 USE spmd_comm_world_mod, ONLY : spmd_comm_world
37#include "implicit_f.inc"
38#include "spmd.inc"
39
40
41
42#include "com01_c.inc"
43#include "com04_c.inc"
44#include "scr14_c.inc"
45#include "task_c.inc"
46#include "spmd_c.inc"
47
48
49
51 . xnorm(3,*)
52 INTEGER WEIGHT(*),NODGLOB(*),NUM,SRECBUF
53
54
55
56#ifdef MPI
57 INTEGER STATUS(MPI_STATUS_SIZE),IERROR,
58 INTEGER SIZ,MSGTYP,I,K,NG,NREC,MSGOFF2
59
60 INTEGER, DIMENSION(:,:), ALLOCATABLE :: IBUF,RNGLOB
61 DATA msgoff/7030/
62 DATA msgoff2/7031/
63
64
66 . s3000,s,xn1,xn2,xn3,ixnn
67
68 ALLOCATE(ibuf(4,numnodm))
69 ALLOCATE(rnglob(3,num))
70
71 s3000 = three1000
72
73
74 ixnn = s3000
75 IF(fmt_ani==4)ixnn=0
76
77 IF (ispmd/=0) THEN
78
79 siz = 0
80 DO i=1,numnod
81 IF (weight(i)==1) THEN
82 siz = siz + 1
83 ibuf(1,siz) = nodglob(i)
84 s = sqrt(xnorm(1,i)**2 + xnorm(2,i)**2 + xnorm(3,i)**2)
85 IF(s/=zero)THEN
86 s = s3000 / s
87 xn1 = xnorm(1,i) * s
88 xn2 = xnorm(2,i) * s
89 xn3 = xnorm(3,i) * s
90 ibuf(2,siz) = xn1
91 ibuf(3,siz) = xn2
92 ibuf(4,siz) = xn3
93 ELSE
94 ibuf(2,siz) = 0
95 ibuf(3,siz) = 0
96 ibuf(4,siz) = ixnn
97 END IF
98 END IF
99 END DO
100
101
102
103
104
105 msgtyp = msgoff2
106 CALL mpi_send(ibuf,4*siz,mpi_integer,it_spmd(1),msgtyp,
107 . spmd_comm_world,ierror)
108
109 ELSE
110 DO i=1,numnod
111 IF (weight(i)==1) THEN
112 ng = nodglob(i)
113 s = sqrt(xnorm(1,i)**2 + xnorm(2,i)**2 + xnorm(3,i)**2)
114 IF(s/=zero)THEN
115 s = s3000 / s
116 xn1 = xnorm(1,i) * s
117 xn2 = xnorm(2,i) * s
118 xn3 = xnorm(3,i) * s
119 rnglob(1,ng) = xn1
120 rnglob(2,ng) = xn2
121 rnglob(3,ng) = xn3
122 ELSE
123 rnglob(1,ng) = 0
124 rnglob(2,ng) = 0
125 rnglob(3,ng) = ixnn
126 END IF
127 END IF
128 ENDDO
129
130 DO i=2,nspmd
131
132 msgtyp = msgoff2
133
135 . spmd_comm_world,status,ierror)
137
138 CALL mpi_recv(ibuf,siz,mpi_integer,it_spmd(i),msgtyp,
139 . spmd_comm_world,status,ierror)
140
141
142 nrec = siz/4
143
144 DO k = 1, nrec
145 ng = ibuf(1,k)
146 rnglob(1,ng) = ibuf(2,k)
147 rnglob(2,ng) = ibuf(3,k)
148 rnglob(3,ng) = ibuf(4,k)
149 ENDDO
150 ENDDO
151
153
154 ENDIF
155
156 DEALLOCATE(ibuf)
157 DEALLOCATE(rnglob)
158
159#endif
160 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_s_c(int *w, int *len)