40 . IAD_ELEM,FR_ELEM,X,V,MS,TEMP,KINET,NODNX_SMS,ITAB,INTBUF_TAB,IPARI,NIN,REMOTE_PROC_ID,
41 . ALREADY_SEND,INDEX_ALREADY_SEND,SORT_COMM,NODNX_SMS_SIZ,TEMP_SIZE)
66 USE spmd_comm_world_mod,
ONLY : spmd_comm_world
67#include "implicit_f.inc"
80#include "tabsiz_c.inc"
84 INTEGER,
INTENT(in) :: NIN
85 INTEGER,
INTENT(in) :: REMOTE_PROC_ID
86 INTEGER,
INTENT(in) :: NODNX_SMS_SIZ
87 INTEGER,
INTENT(in) :: TEMP_SIZE
88 INTEGER,
DIMENSION(NPARI,NINTER),
INTENT(in) :: IPARI
89 INTEGER,
DIMENSION(NINTER+1,NSPMD+1),
INTENT(in) :: ISENDTO,IRCVFROM
90 INTEGER,
DIMENSION(NUMNOD),
INTENT(inout) :: WEIGHT
91 INTEGER,
DIMENSION(2,NSPMD+1),
INTENT(in) :: IAD_ELEM
92 INTEGER,
DIMENSION(SFR_ELEM),
INTENT(in) :: FR_ELEM
93 my_real,
DIMENSION(3,NUMNOD),
INTENT(in) :: x,v
94 my_real,
DIMENSION(NUMNOD),
INTENT(in) :: ms
95 my_real,
DIMENSION(TEMP_SIZE),
INTENT(in) :: temp
96 INTEGER,
DIMENSION(NUMNOD),
INTENT(in) :: ITAB
97 INTEGER,
DIMENSION(NUMNOD),
INTENT(in) :: KINET
98 INTEGER,
DIMENSION(NODNX_SMS_SIZ),
INTENT(in) :: NODNX_SMS
99 TYPE(intbuf_struct_),
DIMENSION(NINTER),
INTENT(in) :: INTBUF_TAB
100 LOGICAL,
DIMENSION(NB_CELL_X,NB_CELL_Y,NB_CELL_Z),
INTENT(inout) :: ALREADY_SEND
101 INTEGER,
DIMENSION(NB_CELL_X*NB_CELL_Y*NB_CELL_Z),
INTENT(inout) :: INDEX_ALREADY_SEND
107 INTEGER :: I,J,NOD,L,L2,IJK,KJI
111 INTEGER :: NSN,NMN,IGAP,INTTH,INTFRIC,ITYP,ITIED
112 INTEGER :: IFQ,INACTI
118 INTEGERDIMENSION(:)ALLOCATABLE
119INTEGER :: ISHIFT,RSHIFT
121 INTEGER :: MSGOFF, MSGOFF2, MSGOFF3, MSGOFF4, MSGOFF5
124 INTEGER :: ERROR_SORT
125 INTEGER,
DIMENSION(:),
ALLOCATABLE :: INDEX_2,ITRI
126 INTEGER,
DIMENSION(:),
ALLOCATABLE :: WORK
127 INTEGER :: CELL_X_ID,CELL_Y_ID,CELL_Z_ID
130 INTEGER :: NB_INDEX_ALREADY_SEND,
VALUE,NB_SAVE
139 rsiz = sort_comm(nin)%RSIZ
140 isiz = sort_comm(nin)%ISIZ
143 intth = ipari(47,nin)
144 intfric = ipari(72,nin)
146 itied = ipari(85,nin)
149 inacti = ipari(22,nin)
151 nb_index_already_send= 0
153 IF(ircvfrom(nin,loc_proc)/=0.OR.isendto(nin,loc_proc)/=0)
THEN
156 IF(isendto(nin,loc_proc)/=0)
THEN
158 p=sort_comm(nin)%PROC_LIST(remote_proc_id)
161 DO j = iad_elem(1,p), iad_elem(1,p+1)-1
163 weight(nod) = weight(nod)*(-1)
167 sort_comm(nin)%NB(p) = 0
169 ALLOCATE(index(2*numnod))
171 IF(itied/=0.AND.ityp==7)
THEN
174 nod = intbuf_tab(nin)%NSV(i)
175 IF(weight(nod)==1)
THEN
176 IF(
candf_si(nin)%P(i)/=0.AND.intbuf_tab(nin)%STFNS(i)>zero)
THEN
185 displ = sort_comm(nin)%RCV_DISPLS_CELL(remote_proc_id)
186 shift_ = sort_comm(nin)%NB_CELL_PROC(remote_proc_id)
188 DO kji=1,sort_comm(nin)%NB_CELL_PROC(remote_proc_id)
192 VALUE = sort_comm(nin)%CELL( displ + ijk )
193 cell_z_id = (
VALUE - mod(
VALUE,1000000) ) / 1000000
194 VALUE =
VALUE - cell_z_id * 1000000
195 cell_y_id = (
VALUE - mod(
VALUE,1000) ) / 1000
196 VALUE =
VALUE - cell_y_id * 1000
199 IF(.NOT.already_send(cell_x_id,cell_y_id,cell_z_id))
THEN
200 nb_index_already_send = nb_index_already_send + 1
201 index_already_send(nb_index_already_send) = cell_x_id+cell_y_id*1000+cell_z_id*1000000
202 already_send(cell_x_id,cell_y_id,cell_z_id) = .true.
206 i = sort_comm(nin)%VOXEL(cell_x_id,cell_y_id,cell_z_id)
208 nod = intbuf_tab(nin)%NSV(i)
209 IF(weight(nod)==1)
THEN
210 IF(intbuf_tab(nin)%STFNS(i)>zero)
THEN
215 i = sort_comm(nin)%NEXT_NOD(i)
222 DO i=1,nb_index_already_send
223 VALUE = index_already_send(i)
224 cell_z_id = (
VALUE - mod(
VALUE,1000000) ) / 1000000
225 VALUE =
VALUE - cell_z_id * 1000000
226 cell_y_id = (
VALUE - mod(
VALUE,1000) ) / 1000
227 VALUE =
VALUE - cell_y_id * 1000
229 already_send(cell_x_id,cell_y_id,cell_z_id) = .false.
234 IF(nb_save>1600)
THEN
235 ALLOCATE( work(70000) )
236 ALLOCATE( itri(nb_save) )
237 ALLOCATE( index_2(2*nb_save) )
242 CALL my_orders(0,work,itri,index_2,nb_save,1)
244 index(nb) = itri(index_2(1))
246 IF(itri(index_2(i-1))/=itri(index_2(i)))
THEN
248 index(nb) = itri(index_2(i))
253 DEALLOCATE( index_2 )
254 ELSEIF(nb_save>0)
THEN
255 ALLOCATE( index_2(nb_save) )
256 CALL myqsort_int(nb_save, index, index_2, error_sort)
257 index_2(1:nb_save) = index(1:nb_save)
260 IF(index(i)/=index(i-1))
THEN
262 index_2(nb) = index(i)
265 index(1:nb) = index_2(1:nb)
266 DEALLOCATE( index_2 )
270 sort_comm(nin)%NB(p) = nb
274 DO j = iad_elem(1,p), iad_elem(1,p+1)-1
276 weight(nod) = weight(nod)*(-1)
281 ! send
the number of secondary nodes
283 sort_comm(nin)%NBSEND_NB=sort_comm(nin)%NBSEND_NB+1
284 sort_comm(nin)%SEND_NB(sort_comm(nin)%NBSEND_NB)=p
285 CALL mpi_isend(sort_comm(nin)%NB(p),1,mpi_integer,it_spmd(p),msgtyp,
286 . spmd_comm_world,sort_comm(nin)%REQUEST_NB_S(sort_comm(nin)%NBSEND_NB),ierror)
291 ALLOCATE( sort_comm(nin)%DATA_PROC(p)%RBUF(rsiz*nb),stat=ierror)
292 ALLOCATE( sort_comm(nin)%DATA_PROC(p)%IBUF(isiz*nb),stat=ierror)
294 CALL ancmsg(msgid=20,anmode=aninfo)
301#include "vectorize.inc"
304 nod = intbuf_tab(nin)%NSV(i)
305 sort_comm(nin)%DATA_PROC(p)%RBUF(l+1) = x(1,nod)
306 sort_comm(nin)%DATA_PROC(p)%RBUF(l+2) = x(2,nod)
307 sort_comm(nin)%DATA_PROC(p)%RBUF(l+3) = x(3,nod)
308 sort_comm(nin)%DATA_PROC(p)%RBUF(l+4) = v(1,nod)
309 sort_comm(nin)%DATA_PROC(p)%RBUF(l+5) = v(2,nod)
310 sort_comm(nin)%DATA_PROC(p)%RBUF(l+6) = v(3,nod)
311 sort_comm(nin)%DATA_PROC(p)%RBUF(l+7) = ms(nod)
312 sort_comm(nin)%DATA_PROC(p)%RBUF(l+8) = intbuf_tab(nin)%STFNS(i)
313 sort_comm(nin)%DATA_PROC(p)%IBUF(l2+1) = i
314 sort_comm(nin)%DATA_PROC(p)%IBUF(l2+2) = itab(nod)
315 sort_comm(nin)%DATA_PROC(p)%IBUF(l2+3) = kinet(nod)
317 sort_comm(nin)%DATA_PROC(p)%IBUF(l2+4) = 0
318 sort_comm(nin)%DATA_PROC(p)%IBUF(l2+5) = 0
319 sort_comm(nin)%DATA_PROC(p)%IBUF(l2+6) = 0
331 IF(igap==1 .OR. igap==2)
THEN
334#include "vectorize.inc"
337 sort_comm(nin)%DATA_PROC(p)%RBUF(l+rshift)= intbuf_tab(nin)%GAP_S(i)
345#include "vectorize.inc"
348 sort_comm(nin)%DATA_PROC(p)%RBUF(l+rshift) = intbuf_tab(nin)%GAP_S(i)
349 sort_comm(nin)%DATA_PROC(p)%RBUF(l+rshift+1)= intbuf_tab(nin)%GAP_SL(i)
359#include "vectorize.inc"
362 nod = intbuf_tab(nin)%NSV(i)
363 sort_comm(nin)%DATA_PROC(p)%RBUF(l+rshift) = temp(nod)
364 sort_comm(nin)%DATA_PROC(p)%RBUF(l+rshift+1) = intbuf_tab(nin)%AREAS(i)
365 sort_comm(nin)%DATA_PROC(p)%IBUF(l2+ishift) = intbuf_tab(nin)%IELEC(i)
375#include "vectorize.inc"
378 sort_comm(nin)%DATA_PROC(p)%IBUF(l2+ishift) = intbuf_tab(nin)%IPARTFRICS(i)
386#include "vectorize.inc"
389 nod = intbuf_tab(nin)%NSV(i)
390 sort_comm(nin)%DATA_PROC(p)%IBUF(l2+ishift) = nodnx_sms(nod)
391 sort_comm(nin)%DATA_PROC(p)%IBUF(l2+ishift+1)= nod
396 ELSEIF(idtmins_int/=0)
THEN
398#include "vectorize.inc"
401 nod = intbuf_tab(nin)%NSV(i)
402 sort_comm(nin)%DATA_PROC(p)%IBUF(l2+ishift)= nod
409#include "vectorize.inc"
412 nod = intbuf_tab(nin)%NSV(i)
414 sort_comm(nin)%DATA_PROC(p)%IBUF(l2+4) =
igapxremp
415 sort_comm(nin)%DATA_PROC(p)%IBUF(l2+5) =
i24xremp
416 sort_comm(nin)%DATA_PROC(p)%IBUF(l2+6) =
i24iremp
subroutine ancmsg(msgid, msgtype, anmode, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, r1, r2, r3, r4, r5, r6, r7, r8, r9, c1, c2, c3, c4, c5, c6, c7, c8, c9, prmode)