34
35
36
38
39
40
41 USE spmd_comm_world_mod, ONLY : spmd_comm_world
42#include "implicit_f.inc"
43
44
45
46#include "spmd.inc"
47
48
49
50#include "com01_c.inc"
51#include "scr14_c.inc"
52#include "task_c.inc"
53
54
55
56 INTEGER NODGLOB(*)
57 INTEGER ,IDPLY,EMPSIZPL
59 . xnorm(3,*)
60 REAL
61
62
63
64#ifdef MPI
65 INTEGER MSGOFF,MSGOFF2,STAT(MPI_STATUS_SIZE,NSPMD-1), IERR
66 INTEGER I,N,ND,EMPL,P,ITAG,INORM(3),K,IXNN
67
68 INTEGER PLYSIZ
70 . s3000,s
71
72 INTEGER, DIMENSION(:,:), ALLOCATABLE :: WRTBUF
73 INTEGER, DIMENSION(:,:), ALLOCATABLE :: FSENDBUF,FRECBUF
74 INTEGER, DIMENSION(:), ALLOCATABLE :: ISENDBUF,IRECBUF
75
76 DATA msgoff/7058/
77 DATA msgoff2/7059/
78
79 s3000 = three1000
80 ixnn = s3000
81 IF(fmt_ani==4)ixnn=0
82
83 IF (ispmd ==0) THEN
84 plysiz =
plynod(iply)%PLYNUMNODS
85 ALLOCATE(wrtbuf(3,
plysizg(iply)))
86
87
88 DO nd=1,plysiz
90 empl =
plynod(iply)%PLYNODID(nd)-empsizpl
91
92 s = sqrt(xnorm(1,i)**2 + xnorm(2,i)**2 + xnorm(3,i)**2)
93 IF(s/=zero)THEN
94 s = s3000 / s
95 inorm(1) = xnorm(1,i) * s
96 inorm(2) = xnorm(2,i) * s
97 inorm(3) = xnorm(3,i) * s
98 ELSE
99 inorm(1) = 0
100 inorm(2) = 0
101 inorm(3) = ixnn
102 END IF
103
104 wrtbuf(1,empl)= inorm(1)
105 wrtbuf(2,empl)= inorm(2)
106 wrtbuf(3,empl)= inorm(3)
107 END DO
108
109 DO p=2,nspmd
112
113 itag=msgoff
114
116 . it_spmd(p),itag, spmd_comm_world, stat, ierr)
117
118 itag=msgoff2
120 . it_spmd(p),itag, spmd_comm_world, stat, ierr)
121
123 empl = irecbuf(i)-empsizpl
124 wrtbuf(1,empl)=frecbuf(1,i)
125 wrtbuf(2,empl)=frecbuf(2,i)
126 wrtbuf(3,empl)=frecbuf(3,i)
127 ENDDO
128 DEALLOCATE(irecbuf,frecbuf)
129 ENDDO
130
132 DEALLOCATE(wrtbuf)
133 empsizpl=empsizpl+
plysizg(iply)
134
135 ELSE
136 plysiz =
plynod(iply)%PLYNUMNODS
137 ALLOCATE (fsendbuf(3,plysiz))
138 ALLOCATE (isendbuf(plysiz))
139
140 DO nd=1,plysiz
141 i =
plynod(iply)%NODES(nd)
142
143 s = sqrt(xnorm(1,i)**2 + xnorm(2,i)**2 + xnorm(3,i)**2)
144 IF(s/=zero)THEN
145 s = s3000 / s
146 inorm(1) = xnorm(1,i) * s
147 inorm(2) = xnorm(2,i) * s
148 inorm(3) = xnorm(3,i) * s
149 ELSE
150 inorm(1) = 0
151 inorm(2) = 0
152 inorm(3) = ixnn
153 END IF
154
155 fsendbuf(1,nd) = inorm(1)
156 fsendbuf(2,nd) = inorm(2)
157 fsendbuf(3,nd) = inorm(3)
158
159 isendbuf(nd) =
plynod(iply)%PLYNODID(nd)
160 END DO
161
162 itag=msgoff
163 CALL mpi_send(isendbuf,plysiz,mpi_integer,it_spmd(1),
164 . itag,spmd_comm_world,ierr)
165
166 itag=msgoff2
167 CALL mpi_send(fsendbuf,plysiz*3,mpi_integer,it_spmd(1),
168 . itag,spmd_comm_world,ierr)
169
170 DEALLOCATE(isendbuf,fsendbuf)
171 ENDIF
172
173#endif
174 RETURN
subroutine mpi_recv(buf, cnt, datatype, source, tag, comm, status, ierr)
subroutine mpi_send(buf, cnt, datatype, dest, tag, comm, ierr)
type(plynods), dimension(:), allocatable plynod
integer, dimension(:), allocatable plysizg
integer, dimension(:,:), allocatable plyiadnod
void write_s_c(int *w, int *len)