44 . ITAB,NODES,GEO,ADDCNEL,CNEL,
45 . IXS,IXC,IXT,IXP,IXR,IXTG,
46 . SIZE_ADDCNEL,SIZE_CNEL,
47 . numelsg,numelqg,numelcg,numeltrg,numelpg,
48 . numelrg,numeltgg,ixs10 )
70 use init_hashtable_for_neighbour_segment_mod ,
only : init_hashtable_for_neighbour_segment
71 use get_hashtable_for_neighbour_segment_mod ,
only : get_hashtable_for_neighbour_segment
72 use element_mod ,
only : nixs,nixc,nixq,nixt,nixp,nixr,nixtg
76 USE spmd_comm_world_mod,
ONLY : spmd_comm_world
77#include "implicit_f.inc"
88#include "tabsiz_c.inc"
93 INTEGER,
INTENT(in) :: SIZE_ADDCNEL,SIZE_CNEL
94 integer,
intent(in) :: numelsg
95 integer,
intent(in) :: numelqg
96 integer,
intent(in) :: numelcg
97 integer,
intent(in) :: numeltrg
98 integer,
intent(in) :: numelpg
99 integer,
intent(in) :: numelrg
100 integer,
intent(in) :: numeltgg
101 INTEGER,
DIMENSION(NPARI,NINTER),
INTENT(in) :: IPARI
102 INTEGER,
DIMENSION(2,NSPMD+1),
INTENT(in) :: IAD_ELEM
103 INTEGER,
DIMENSION(SFR_ELEM),
INTENT(in) :: FR_ELEM
104 TYPE(shooting_node_type),
INTENT(inout) :: SHOOT_STRUCT
105 TYPE(intbuf_struct_),
DIMENSION(NINTER),
INTENT(inout) :: INTBUF_TAB
106 INTEGER,
DIMENSION(NUMNOD),
INTENT(in) :: ITAB
107 type(nodal_arrays_),
INTENT(INOUT) :: NODES
108 my_real,
DIMENSION(NPROPG,NUMGEO),
INTENT(in) :: geo
109 INTEGER,
DIMENSION(0:SIZE_ADDCNEL),
INTENT(in) :: ADDCNEL
110 INTEGER,
DIMENSION(0:SIZE_CNEL),
INTENT(in) :: CNEL
111 INTEGER,
DIMENSION(NIXS,NUMELS),
TARGET,
INTENT(in) :: IXS
112 INTEGER,
DIMENSION(NIXC,NUMELC),
TARGET,
INTENT(in) :: IXC
113 INTEGER,
DIMENSION(NIXT,NUMELT),
TARGET,
INTENT(in) :: IXT
114 INTEGER,
DIMENSION(NIXP,NUMELP),
TARGET,
INTENT(in) :: IXP
115 INTEGER,
DIMENSION(NIXR,NUMELR),
TARGET,
INTENT(in) :: IXR
116 INTEGER,
DIMENSION(NIXTG,NUMELTG),
TARGET,
INTENT(in) :: IXTG
117 INTEGER,
DIMENSION(6,NUMELS10),
INTENT(in) :: IXS10
121 LOGICAL :: TYPE_INTER
122 INTEGER :: NIN,ITY,NSN,NMN,NRTM,NRTS,IDEL,IDELKEEP,NRTMG
124 INTEGER :: NODE_ID,SHIFT,SHIFT_INTER,NEXT_INTER
125 INTEGER :: TMP_,MY_ERROR,NB_PROC,NB_NODE_SURF,NB_SURF,NB_REAL_NODE
126 INTEGER :: NB_EDGE,NB_EDGE_2
127 INTEGER :: N1,N2,N3,N4
128 INTEGER :: MAX_NB_NODE_PER_SURFACE
130 INTEGER,
DIMENSION(4) :: LIST_NODE_ID
131 INTEGER,
DIMENSION(4) :: GLOBAL_NODE_ID
132 INTEGER,
DIMENSION(:),
ALLOCATABLE :: WORK_ARRAY,WORK_ARRAY_2,WORK_ARRAY_3
133 INTEGER,
DIMENSION(:),
ALLOCATABLE :: SORT_ARRAY,PERM
135 TYPE(
array_type),
DIMENSION(:),
ALLOCATABLE :: BUFFER_SECOND,BUFFER_MAIN
136 TYPE(
array_type),
DIMENSION(:),
ALLOCATABLE :: R_BUFFER_SECOND,R_BUFFER_MAIN
138 INTEGER,
DIMENSION(MPI_STATUS_SIZE) :: STATU
139 INTEGER :: MSGTYP,MSGOFF1,IERROR
141 INTEGER,
DIMENSION(NSPMD) :: ,REQUEST_R
142 INTEGER,
DIMENSION(NSPMD) :: REQUEST_S2,REQUEST_R2
143 INTEGER,
DIMENSION(NSPMD) :: ,REQUEST_R3
145 INTEGER :: SIZ,OLD_SIZE
147 INTEGER :: NB_PROC_1,NB_PROC_2,NB_RESULT_INTERSECT,SHIFT_INTER2
148 INTEGER,
DIMENSION(:),
ALLOCATABLE :: INTERSECT_1,INTERSECT_2,RESULT_INTERSECT
149 INTEGER,
DIMENSION(2,NSPMD) :: S_BUFFER_2_INT,R_BUFFER_2_INT
150 INTEGER,
DIMENSION(NSPMD) :: SIZE_BUFFER_MAIN
151INTEGER,
DIMENSION(NSPMD) :: R_SIZE_BUFFER_MAIN,R_SIZE_BUFFER_SECOND
153 integer :: erosion_state
161 shoot_struct%offset_elem%sol_low_bound = 0
162 shoot_struct%offset_elem%sol_up_bound = numelsg
164 shoot_struct%offset_elem%quad_low_bound = shoot_struct%offset_elem%sol_up_bound + 1
165 shoot_struct%offset_elem%quad_up_bound = shoot_struct%offset_elem%sol_up_bound + numelqg
167 shoot_struct%offset_elem%shell_low_bound = shoot_struct%offset_elem%quad_up_bound + 1
168 shoot_struct%offset_elem%shell_up_bound = shoot_struct%offset_elem%quad_up_bound + numelcg
170 shoot_struct%offset_elem%truss_low_bound = shoot_struct%offset_elem%shell_up_bound + 1
171 shoot_struct%offset_elem%truss_up_bound = shoot_struct%offset_elem%shell_up_bound + numeltrg
173 shoot_struct%offset_elem%beam_low_bound = shoot_struct%offset_elem%truss_up_bound +
174 shoot_struct%offset_elem%beam_up_bound = shoot_struct%offset_elem%truss_up_bound + numelpg
176 shoot_struct%offset_elem%spring_low_bound = shoot_struct%offset_elem%truss_up_bound + 1
177 shoot_struct%offset_elem%spring_up_bound = shoot_struct%offset_elem%truss_up_bound + numelrg
179 shoot_struct%offset_elem%shell3n_low_bound = shoot_struct%offset_elem%spring_up_bound + 1
180 shoot_struct%offset_elem%shell3n_up_bound = shoot_struct%offset_elem%spring_up_bound + numeltgg
184 ALLOCATE( buffer_second(nspmd) )
185 ALLOCATE( buffer_main(nspmd) )
186 ALLOCATE( r_buffer_second(nspmd) )
187 ALLOCATE( r_buffer_main(nspmd) )
189 buffer_second(1:nspmd)%SIZE_INT_ARRAY_1D = 0
190 buffer_main(1:nspmd)%SIZE_INT_ARRAY_1D = 0
191 r_buffer_second(1:nspmd)%SIZE_INT_ARRAY_1D = 0
192 r_buffer_main(1:nspmd)%SIZE_INT_ARRAY_1D = 0
200 IF(
ALLOCATED(shoot_struct%SHIFT_S_NODE) )
DEALLOCATE( shoot_struct%SHIFT_S_NODE )
201 ALLOCATE( shoot_struct%SHIFT_S_NODE(numnod+1) )
202 shoot_struct%SHIFT_S_NODE(1:numnod+1) = 0
207 idelkeep = ipari(61,nin)
208 IF((ity==7.OR.ity==10.OR.ity==22.OR.ity==24.OR.ity==25).AND.idel>=1.AND.idelkeep/=1)
THEN
211 node_id = intbuf_tab(nin)%NSV(i)
213 IF(node_id<=numnod) shoot_struct%SHIFT_S_NODE(node_id+1) = shoot_struct%SHIFT_S_NODE
218 shoot_struct%SIZE_SEC_NODE = 0
220 shoot_struct%SHIFT_S_NODE(i+1) = shoot_struct%SHIFT_S_NODE(i+1) + shoot_struct%SHIFT_S_NODE(i)
223 shoot_struct%SIZE_SEC_NODE = shoot_struct%SHIFT_S_NODE(numnod+1)
226 IF(
ALLOCATED(shoot_struct%INTER_SEC_NODE) )
DEALLOCATE( shoot_struct%INTER_SEC_NODE )
227 ALLOCATE( shoot_struct%INTER_SEC_NODE(shoot_struct%SIZE_SEC_NODE) )
228 IF(
ALLOCATED(shoot_struct%SEC_NODE_ID) )
DEALLOCATE( shoot_struct%SEC_NODE_ID
229 ALLOCATE( shoot_struct%SEC_NODE_ID(shoot_struct%SIZE_SEC_NODE) )
232 ALLOCATE( work_array(numnod) )
233 work_array(1:numnod) = 0
238 idelkeep = ipari(61,nin)
239 IF((ity==7.OR.ity==10.OR.ity==22.OR.ity==24.OR.ity==25).AND.idel>=1.AND.idelkeep/=1)
THEN
241 node_id = intbuf_tab(nin)%NSV(i)
242 IF(node_id<=numnod)
THEN
243 work_array(node_id) = work_array(node_id) + 1
244 shift = work_array(node_id) + shoot_struct%SHIFT_S_NODE(node_id)
245 shoot_struct%INTER_SEC_NODE( shift ) = nin
246 shoot_struct%SEC_NODE_ID( shift ) = i
252 DEALLOCATE( work_array )
259 IF(
ALLOCATED(shoot_struct%SHIFT_M_NODE_PROC) )
DEALLOCATE( shoot_struct%SHIFT_M_NODE_PROC )
260 ALLOCATE( shoot_struct%SHIFT_M_NODE_PROC(numnod+1) )
261 shoot_struct%SHIFT_M_NODE_PROC(2:numnod+1) = 1
262 shoot_struct%SHIFT_M_NODE_PROC(1) = 0
268 DO j=iad_elem(1,i),iad_elem(1,i+1)-1
270 shoot_struct%SHIFT_M_NODE_PROC(node_id+1) = shoot_struct%SHIFT_M_NODE_PROC(node_id+1) + 1
274 shoot_struct%SHIFT_M_NODE_PROC(i+1) = shoot_struct%SHIFT_M_NODE_PROC(i+1) + shoot_struct%SHIFT_M_NODE_PROC(i)
277 shoot_struct%SIZE_M_NODE_PROC = shoot_struct%SHIFT_M_NODE_PROC(numnod+1)
282 IF(
ALLOCATED(shoot_struct%M_NODE_PROC) )
DEALLOCATE( shoot_struct%M_NODE_PROC )
283 ALLOCATE( shoot_struct%M_NODE_PROC( shoot_struct%SIZE_M_NODE_PROC ) )
284 shoot_struct%M_NODE_PROC(1:shoot_struct%SIZE_M_NODE_PROC) = -1
285 ALLOCATE( work_array(numnod) )
286 work_array(1:numnod) = 0
290 work_array(i) = work_array(i) + 1
291 shift = work_array(i) + shoot_struct%SHIFT_M_NODE_PROC(i
292 shoot_struct%M_NODE_PROC( shift ) = ispmd+1
296 DO j=iad_elem(1,i),iad_elem(1,i+1)-1
298 work_array(node_id) = work_array(node_id) + 1
299 shift = work_array(node_id) + shoot_struct%SHIFT_M_NODE_PROC(node_id)
300 shoot_struct%M_NODE_PROC( shift ) = i !
save the processor
id
304 shoot_struct%MAX_PROC_NB = 0
306 shift = shoot_struct%SHIFT_M_NODE_PROC(i)
307 nb_proc = shoot_struct%SHIFT_M_NODE_PROC(i+1) - shoot_struct%SHIFT_M_NODE_PROC
308 shoot_struct%MAX_PROC_NB =
max(shoot_struct%MAX_PROC_NB,nb_proc)
310 ALLOCATE( sort_array(nb_proc),perm(nb_proc) )
311 sort_array(1:nb_proc) = shoot_struct%M_NODE_PROC( shift+1:shift+nb_proc )
312 CALL myqsort_int(nb_proc, sort_array, perm, my_error)
313 shoot_struct%M_NODE_PROC( shift+1:shift+nb_proc ) = sort_array(1:nb_proc)
314 DEALLOCATE( sort_array,perm )
315 ELSEIF(nb_proc==2)
THEN
316 IF(shoot_struct%M_NODE_PROC(shift+1)>shoot_struct%M_NODE_PROC(shift+2))
THEN
317 tmp_ = shoot_struct%M_NODE_PROC(shift+2)
318 shoot_struct%M_NODE_PROC(shift+2) = shoot_struct%M_NODE_PROC(shift+1)
319 shoot_struct%M_NODE_PROC(shift+1) = tmp_
327 IF(
ALLOCATED(shoot_struct%SHIFT_M_NODE_SURF) )
DEALLOCATE( shoot_struct%SHIFT_M_NODE_SURF
328 ALLOCATE( shoot_struct%SHIFT_M_NODE_SURF(numnod+1) )
329 shoot_struct%SHIFT_M_NODE_SURF(1:numnod+1) = 0
330 IF(
ALLOCATED(shoot_struct%SHIFT_M_NODE_EDGE) )
DEALLOCATE( shoot_struct%SHIFT_M_NODE_EDGE )
332 shoot_struct%SHIFT_M_NODE_EDGE(1:numnod+1) = 0
333 IF(
ALLOCATED(shoot_struct%SHIFT_S_NODE_EDGE) )
DEALLOCATE( shoot_struct%SHIFT_S_NODE_EDGE )
334 ALLOCATE( shoot_struct%SHIFT_S_NODE_EDGE(numnod+1) )
335 shoot_struct%SHIFT_S_NODE_EDGE(1:numnod+1) = 0
344 IF((ity==7.OR.ity==10.OR.ity==22.OR.ity==24.OR.ity==25).AND.idel>=1)
THEN
347 n1 = intbuf_tab(nin)%IRECTM((i-1)*4+1)
348 n2 = intbuf_tab(nin)%IRECTM((i-1)*4+2)
349 n3 = intbuf_tab(nin)%IRECTM((i-1)*4+3)
350 n4 = intbuf_tab(nin)%IRECTM((i-1)*4+4)
351 shoot_struct%SHIFT_M_NODE_SURF(n1+1) = shoot_struct%SHIFT_M_NODE_SURF(n1+1) + 1
352 shoot_struct%SHIFT_M_NODE_SURF(n2+1) = shoot_struct%SHIFT_M_NODE_SURF(n2+1) + 1
353 shoot_struct%SHIFT_M_NODE_SURF(n3+1) = shoot_struct%SHIFT_M_NODE_SURF(n3+1) + 1
354 IF(n3/=n4) shoot_struct%SHIFT_M_NODE_SURF
356 ! -----------------------------
358 ELSEIF(ity == 11)
THEN
362 n1 = intbuf_tab(nin)%IRECTM((i-1)*2+1)
363 n2 = intbuf_tab(nin)%IRECTM((i-1)*2+2)
364 shoot_struct%SHIFT_M_NODE_EDGE(n1+1) = shoot_struct%SHIFT_M_NODE_EDGE(n1+1) + 1
365 shoot_struct%SHIFT_M_NODE_EDGE(n2+1) = shoot_struct%SHIFT_M_NODE_EDGE(n2+1) + 1
371 n1 = intbuf_tab(nin)%IRECTS((i-1)*2+1)
372 n2 = intbuf_tab(nin)%IRECTS((i-1)*2+2)
373 shoot_struct%SHIFT_S_NODE_EDGE(n1+1) = shoot_struct%SHIFT_S_NODE_EDGE(n1+1) + 1
374 shoot_struct%SHIFT_S_NODE_EDGE(n2+1) = shoot_struct%SHIFT_S_NODE_EDGE(n2+1) + 1
382 shoot_struct%SHIFT_M_NODE_SURF(i+1) = shoot_struct%SHIFT_M_NODE_SURF(i+1) + shoot_struct%SHIFT_M_NODE_SURF(i)
383 shoot_struct%SHIFT_M_NODE_EDGE(i+1) = shoot_struct%SHIFT_M_NODE_EDGE(i+1) + shoot_struct%SHIFT_M_NODE_EDGE(i)
384 shoot_struct%SHIFT_S_NODE_EDGE(i+1) = shoot_struct%SHIFT_S_NODE_EDGE(i+1) + shoot_struct%SHIFT_S_NODE_EDGE(i)
386 shoot_struct%SIZE_M_NODE_SURF = shoot_struct%SHIFT_M_NODE_SURF(numnod+1)
387 IF(
ALLOCATED(shoot_struct%M_NODE_SURF) )
DEALLOCATE( shoot_struct%M_NODE_SURF )
388 ALLOCATE( shoot_struct%M_NODE_SURF( shoot_struct%SIZE_M_NODE_SURF) )
389 IF(
ALLOCATED(shoot_struct%M_NODE_EDGE) )
DEALLOCATE( shoot_struct%M_NODE_EDGE )
390 shoot_struct%SIZE_M_NODE_EDGE = shoot_struct%SHIFT_M_NODE_EDGE(numnod+1)
391 ALLOCATE( shoot_struct%M_NODE_EDGE( shoot_struct%SIZE_M_NODE_EDGE) )
392 shoot_struct%SIZE_S_NODE_EDGE = shoot_struct%SHIFT_S_NODE_EDGE(numnod+1)
393 IF(
ALLOCATED(shoot_struct%S_NODE_EDGE) )
DEALLOCATE( shoot_struct%S_NODE_EDGE )
394 ALLOCATE( shoot_struct%S_NODE_EDGE( shoot_struct%SIZE_S_NODE_EDGE) )
397 shoot_struct%MAX_SURF_NB = 0
398 shoot_struct%MAX_EDGE_NB = 0
400 nb_surf = shoot_struct%SHIFT_M_NODE_SURF(i+1) - shoot_struct%SHIFT_M_NODE_SURF(i)
401 shoot_struct%MAX_SURF_NB =
max(shoot_struct%MAX_SURF_NB,nb_surf)
403 nb_edge = shoot_struct%SHIFT_M_NODE_EDGE(i+1) - shoot_struct%SHIFT_M_NODE_EDGE(i)
404 nb_edge_2 = shoot_struct%SHIFT_S_NODE_EDGE(i+1) - shoot_struct%SHIFT_S_NODE_EDGE(i)
405 nb_edge =
max(nb_edge,nb_edge_2)
406 shoot_struct%MAX_EDGE_NB =
max(shoot_struct%MAX_EDGE_NB,nb_edge)
410 work_array(1:numnod) = 0
411 ALLOCATE( work_array_2(numnod) )
412 work_array_2(1:numnod) = 0
413 ALLOCATE( work_array_3(numnod) )
414 work_array_3(1:numnod) = 0
415 IF(
ALLOCATED(shoot_struct%SHIFT_INTERFACE) )
DEALLOCATE( shoot_struct%SHIFT_INTERFACE )
416 IF(
ALLOCATED(shoot_struct%SHIFT_INTERFACE2) )
DEALLOCATE( shoot_struct%SHIFT_INTERFACE2 )
417 ALLOCATE( shoot_struct%SHIFT_INTERFACE(ninter+1,2) )
418 ALLOCATE( shoot_struct%SHIFT_INTERFACE2(ninter) )
428 nrtmg = ipari(74,nin)
430 IF((ity==7.OR.ity==10.OR.ity==22.OR.ity==24.OR.ity==25).AND.idel>=1)
THEN
433 n3 = intbuf_tab(nin)%IRECTM((i-1)*4+3)
434 n4 = intbuf_tab(nin)%IRECTM((i-1)*4+4)
436 IF(n3==n4) nb_node_surf = 3
438 node_id = intbuf_tab(nin)%IRECTM((i-1)*4+j)
439 work_array(node_id) = work_array(node_id) + 1
440 shift = work_array(node_id) + shoot_struct%SHIFT_M_NODE_SURF(node_id)
441 shoot_struct%M_NODE_SURF( shift ) = shift_inter - 1 + i
450 node_id = intbuf_tab(nin)%IRECTM((i-1)*2+j)
451 work_array_2(node_id) = work_array_2(node_id) + 1
452 shift = work_array_2(node_id) + shoot_struct%SHIFT_M_NODE_EDGE(node_id)
453 shoot_struct%M_NODE_EDGE( shift ) = shift_inter - 1 + i
462 node_id = intbuf_tab(nin)%IRECTS((i-1)*2+j)
463 work_array_3(node_id) = work_array_3(node_id) + 1
464 shift = work_array_3(node_id) + shoot_struct%SHIFT_S_NODE_EDGE(node_id)
465 shoot_struct%S_NODE_EDGE( shift ) = shift_inter - 1 + i
472 next_inter = next_inter + 1
473 shoot_struct%SHIFT_INTERFACE(next_inter,1) = shift_inter
474 shoot_struct%SHIFT_INTERFACE(next_inter,2) = nin
476 IF(nrtmg>0.AND.(ity==25.AND.ipari(100,nin)/=0))
THEN
477 shoot_struct%SHIFT_INTERFACE2(nin) = shift_inter2
478 shift_inter2 = shift_inter2 + nrtmg
481 shift_inter = shift_inter + nrtm + nrts
483 shoot_struct%SHIFT_INTERFACE(next_inter+1,1) = shift_inter + 1
484 shoot_struct%SHIFT_INTERFACE(ninter+1,1) = shift_inter + 1
485 shoot_struct%SHIFT_INTERFACE(ninter+1,2) = next_inter
488 DEALLOCATE( work_array )
490 ALLOCATE( intersect_1(nspmd) )
491 ALLOCATE( intersect_2(nspmd) )
492 ALLOCATE( result_intersect(nspmd) )
494 size_buffer_main(1:nspmd) = 0
495 size_buffer_second(1:nspmd) = 0
496 max_nb_node_per_surface = 4
497 chunk = 2 + max_nb_node_per_surface
504 type_inter = (ity==7.OR.ity==10.OR.ity==11.OR.ity==22.OR.ity==24)
505 type_inter = (type_inter.OR.(ity==25.AND.ipari(100,nin)==0))
506 type_inter = (type_inter.AND.(idel==1))
508 IF((type_inter.AND.(idel==1)).OR.(ity==25.AND.ipari(100,nin)/=0))
THEN
509 IF(.NOT.
ALLOCATED(shoot_struct%INTER))
ALLOCATE(shoot_struct%INTER(ninter))
510 IF(
ALLOCATED(shoot_struct%INTER(nin)%REMOTE_ELM_M
DEALLOCATE
511 IF(.NOT.
ALLOCATED(shoot_struct%INTER(nin)%REMOTE_ELM_M))
THEN
512 ALLOCATE( shoot_struct%INTER(nin)%REMOTE_ELM_M(nrtm) )
514 shoot_struct%INTER(nin)%REMOTE_ELM_M(1:nrtm) = 0
516 IF(.NOT.
ALLOCATED(shoot_struct%INTER(nin)%REMOTE_ELM_S))
THEN
517 ALLOCATE( shoot_struct%INTER(nin)%REMOTE_ELM_S(nrts) )
519 shoot_struct%INTER(nin)%REMOTE_ELM_S(1:nrts) = 0
520 IF(ity==25.AND.ipari(100,nin)/=0)
THEN
521 IF(.NOT.
ALLOCATED(shoot_struct%INTER))
ALLOCATE(shoot_struct%INTER(ninter))
522 ALLOCATE( shoot_struct%INTER(nin)%NB_ELM_M(nrtm) )
523 shoot_struct%INTER(nin)%NB_ELM_M(1:nrtm) = 0
529 IF( (type_inter.OR.(ity==25.AND.ipari(100,nin)/=0)).AND.nspmd>1 )
THEN
531 IF(.NOT.
ALLOCATED(buffer_second(i)%INT_ARRAY_1D))
THEN
532 buffer_second(i)%SIZE_INT_ARRAY_1D = numnod/4+1
536 IF(.NOT.
ALLOCATED(buffer_main(i)%INT_ARRAY_1D))
THEN
542 IF(ity==11) nb_node_surf = 2
546 list_node_id(1) = intbuf_tab(nin)%IRECTM((i-1)*nb_node_surf+1)
547 list_node_id(2) = intbuf_tab(nin)%IRECTM((i-1)*nb_node_surf+2)
550 global_node_id(1) = itab(list_node_id(1))
551 global_node_id(2) = itab(list_node_id(2))
552 global_node_id(3) = 0
553 global_node_id(4) = 0
556 IF(ity==7.OR.ity==10.OR.ity==22.OR.ity
THEN
557 list_node_id(3) = intbuf_tab(nin)%IRECTM((i-1)*nb_node_surf+3)
558 list_node_id(4) = intbuf_tab(nin)%IRECTM((i-1)*nb_node_surf+4)
559 global_node_id(3) = itab(list_node_id(3))
560 global_node_id(4) = itab(list_node_id(4))
562 IF(list_node_id(3)==list_node_id(4)) nb_real_node = 3
565 nb_proc_1 = shoot_struct%SHIFT_M_NODE_PROC(list_node_id(1)+1)
566 . - shoot_struct%SHIFT_M_NODE_PROC(list_node_id(1))
567 nb_proc_2 = shoot_struct%SHIFT_M_NODE_PROC(list_node_id(2)+1)
568 . - shoot_struct%SHIFT_M_NODE_PROC(list_node_id(2))
569 nb_result_intersect = 0
572 shift = shoot_struct%SHIFT_M_NODE_PROC(list_node_id(1))
573 intersect_1(1:nb_proc_1) = shoot_struct%M_NODE_PROC( shift+1:shift+nb_proc_1
576 DO j = 1,nb_real_node-1
577 IF(nb_proc_1>1.AND.nb_proc_2>1)
THEN
579 shift = shoot_struct%SHIFT_M_NODE_PROC(list_node_id(j+1))
580 nb_proc_2 = shoot_struct%SHIFT_M_NODE_PROC(list_node_id(j+1)+1)
581 . - shoot_struct%SHIFT_M_NODE_PROC(list_node_id(j+1))
582 intersect_2(1:nb_proc_2) = shoot_struct%M_NODE_PROC( shift+1:shift+nb_proc_2 )
584 CALL intersect_2_sorted_sets( intersect_1,nb_proc_1,
585 . intersect_2,nb_proc_2,
586 . result_intersect,nb_result_intersect )
588 nb_proc_1 = nb_result_intersect
589 intersect_1(1:nb_result_intersect) = result_intersect(1:nb_result_intersect)
591 nb_result_intersect = 0
597 IF(nb_result_intersect>1)
THEN
600 DO j=1,nb_result_intersect
601 proc_id = result_intersect(j)
602 IF(proc_id/=ispmd+1)
THEN
603 IF(size_buffer_main(proc_id)+chunk>buffer_main(proc_id)%SIZE_INT_ARRAY_1D
THEN
604 old_size = buffer_main(proc_id)%SIZE_INT_ARRAY_1D
605 ALLOCATE( work_array(old_size) )
606 work_array(1:old_size) =
607 . buffer_main(proc_id)%INT_ARRAY_1D(1:old_size)
609 buffer_main(proc_id)%SIZE_INT_ARRAY_1D = chunk * (old_size +
611 buffer_main(proc_id)%INT_ARRAY_1D(1:old_size) = work_array(1:old_size
612 DEALLOCATE( work_array )
615 size_buffer_main(proc_id) = size_buffer_main(proc_id
616 buffer_main(proc_id)%INT_ARRAY_1D( size_buffer_main(proc_id) ) = nin
618 size_buffer_main(proc_id) = size_buffer_main(proc_id) + 1
619 buffer_main(proc_id)%INT_ARRAY_1D( size_buffer_main(proc_id) ) = i
621 size_buffer_main(proc_id) = size_buffer_main(proc_id
622 buffer_main(proc_id)%INT_ARRAY_1D( size_buffer_main(proc_id) ) = global_node_id(1)
624 size_buffer_main(proc_id) = size_buffer_main(proc_id) + 1
625 buffer_main(proc_id)%INT_ARRAY_1D( size_buffer_main(proc_id) ) = global_node_id(2)
627 size_buffer_main(proc_id) = size_buffer_main(proc_id) + 1
628 buffer_main(proc_id)%INT_ARRAY_1D( size_buffer_main(proc_id) ) = global_node_id(3)
630 size_buffer_main(proc_id) = size_buffer_main(proc_id
631 buffer_main(proc_id)%INT_ARRAY_1D( size_buffer_main(proc_id
642 n1 = intbuf_tab(nin)%IRECTS((i-1)*2+1)
643 n2 = intbuf_tab(nin)%IRECTS((i-1)*2+2)
644 nb_proc_1 = shoot_struct%SHIFT_M_NODE_PROC(n1+1) - shoot_struct%SHIFT_M_NODE_PROC(n1)
645 nb_proc_2 = shoot_struct%SHIFT_M_NODE_PROC(n2+1) - shoot_struct%SHIFT_M_NODE_PROC(n2)
646 IF(nb_proc_1>1.AND.nb_proc_2>1)
THEN
647 shift = shoot_struct%SHIFT_M_NODE_PROC(n1)
648 intersect_1(1:nb_proc_1) = shoot_struct%M_NODE_PROC( shift+1:shift+nb_proc_1 )
649 shift = shoot_struct%SHIFT_M_NODE_PROC(n2)
650 intersect_2(1:nb_proc_2) = shoot_struct%M_NODE_PROC( shift+1:shift+nb_proc_2 )
652 nb_result_intersect = 0
653 CALL intersect_2_sorted_sets( intersect_1,nb_proc_1,
654 . intersect_2,nb_proc_2,
655 . result_intersect,nb_result_intersect )
657 IF(nb_result_intersect>1)
THEN
658 DO j=1,nb_result_intersect
659 proc_id = result_intersect(j)
660 IF(proc_id/=ispmd+1)
THEN
661 IF(size_buffer_second(proc_id)+chunk>buffer_second(proc_id)%SIZE_INT_ARRAY_1D)
THEN
662 old_size = buffer_second(proc_id)%SIZE_INT_ARRAY_1D
663 ALLOCATE( work_array(old_size) )
664 work_array(1:old_size) =
665 . buffer_second(proc_id)%INT_ARRAY_1D(1:old_size)
667 buffer_second(proc_id)%SIZE_INT_ARRAY_1D =
668 . chunk * (buffer_second(proc_id)%SIZE_INT_ARRAY_1D + chunk)
670 buffer_second(proc_id)%INT_ARRAY_1D(1:old_size) = work_array(1:old_size)
671 DEALLOCATE( work_array )
674 size_buffer_second(proc_id) = size_buffer_second(proc_id) + 1
675 buffer_second(proc_id)%INT_ARRAY_1D( size_buffer_second(proc_id) ) = nin
677 size_buffer_second(proc_id) = size_buffer_second(proc_id) + 1
678 buffer_second(proc_id)%INT_ARRAY_1D( size_buffer_second(proc_id) ) = i
680 size_buffer_second(proc_id) = size_buffer_second(proc_id) + 1
681 buffer_second(proc_id)%INT_ARRAY_1D( size_buffer_second(proc_id) ) = itab(n1)
683 size_buffer_second(proc_id) = size_buffer_second(proc_id
684 buffer_second(proc_id)%INT_ARRAY_1D( size_buffer_second(proc_id) ) = itab(n2)
686 size_buffer_second(proc_id) = size_buffer_second(proc_id) + 1
687 buffer_second(proc_id)%INT_ARRAY_1D( size_buffer_second(proc_id) ) = 0
689 size_buffer_second(proc_id) = size_buffer_second(proc_id) + 1
690 buffer_second(proc_id)%INT_ARRAY_1D( size_buffer_second
703 IF(ity==25.AND.ipari(100,nin)/=0)
THEN
706 IF(intbuf_tab(nin)%STFM(i)<zero)
THEN
707 shoot_struct%INTER(nin)%NB_ELM_M(i) = shoot_struct%INTER(nin)%NB_ELM_M(i) + 1
708 IF(intbuf_tab(nin)%IELEM_M(2*(i-1)+2)/=0)
THEN
709 shoot_struct%INTER(nin)%NB_ELM_M(i) = shoot_struct%INTER(nin)%NB_ELM_M(i) + 1
721 r_size_buffer_main(i) = 0
722 r_size_buffer_second(i) = 0
723 siz = iad_elem(1,i+1)-iad_elem(1,i)
724 IF(i/=ispmd+1.AND.siz>0)
THEN
725 s_buffer_2_int(1,i) = size_buffer_main(i)
726 s_buffer_2_int(2,i) = size_buffer_second(i)
727 CALL mpi_isend(s_buffer_2_int(1,i),2,mpi_integer,it_spmd(i),msgtyp,spmd_comm_world,request_s(i),ierror)
729 IF(i/=ispmd+1.AND.siz>0)
THEN
730 CALL mpi_irecv(r_buffer_2_int(1,i),2,mpi_integer,it_spmd(i),msgtyp,spmd_comm_world,request_r
735 siz = iad_elem(1,i+1)-iad_elem(1,i)
736 IF(i/=ispmd+1.AND.siz>0)
THEN
737 CALL mpi_wait(request_s(i),statu,ierror)
738 CALL mpi_wait(request_r(i),statu,ierror)
739 r_size_buffer_main(i) = r_buffer_2_int(1,i)
740 r_size_buffer_second(i) = r_buffer_2_int(2,i)
744 IF(r_size_buffer_main(i)>0)
THEN
745 r_buffer_main(i)%SIZE_INT_ARRAY_1D = r_size_buffer_main(i)
747 CALL mpi_irecv( r_buffer_main(i)%INT_ARRAY_1D,r_buffer_main(i)%SIZE_INT_ARRAY_1D,
748 . mpi_integer,it_spmd(i),msgtyp,spmd_comm_world,request_r2(i),ierror )
750 IF(r_size_buffer_second(i)>0)
THEN
751 r_buffer_second(i)%SIZE_INT_ARRAY_1D = r_size_buffer_second(i)
753 CALL mpi_irecv( r_buffer_second(i)%INT_ARRAY_1D,r_buffer_second(i)%SIZE_INT_ARRAY_1D,
754 . mpi_integer,it_spmd(i),msgtyp,spmd_comm_world,request_r3(i),ierror )
756 IF(size_buffer_main(i)>0)
THEN
757 CALL mpi_isend( buffer_main(i)%INT_ARRAY_1D,size_buffer_main(i),
758 . mpi_integer,it_spmd(i),msgtyp,spmd_comm_world,request_s2(i),ierror )
760 IF(size_buffer_second(i)>0)
THEN
761 CALL mpi_isend( buffer_second(i)%INT_ARRAY_1D,size_buffer_second(i),
762 . mpi_integer,it_spmd(i),msgtyp,spmd_comm_world,request_s3(i),ierror )
766 siz = iad_elem(1,i+1)-iad_elem(1,i)
767 IF(size_buffer_main(i)>0)
CALL mpi_wait(request_s2(i),statu,ierror)
768 IF(r_size_buffer_main(i)>0)
CALL mpi_wait(request_r2(i),statu,ierror)
769 IF(size_buffer_second(i)>0)
CALL mpi_wait(request_s3(i),statu,ierror)
770 IF(r_size_buffer_second(i)>0)
CALL mpi_wait(request_r3(i),statu,ierror)
773 IF(r_buffer_main(i)%SIZE_INT_ARRAY_1D>0)
THEN
775 . geo,ixs,ixc,ixt,ixp,ixr,ixtg
776 CALL mpi_isend( r_buffer_main(i)%INT_ARRAY_1D,r_buffer_main(i)%SIZE_INT_ARRAY_1D,
777 . mpi_integer,it_spmd(i),msgtyp,spmd_comm_world,request_s2(i),ierror )
780 IF(r_buffer_second(i)%SIZE_INT_ARRAY_1D>0)
THEN
782 . geo,ixs,ixc,ixt,ixp,ixr,ixtg,addcnel,nodes,cnel,chunk,ixs10 )
783 CALL mpi_isend( r_buffer_second(i)%INT_ARRAY_1D,r_buffer_second(i)%SIZE_INT_ARRAY_1D,
784 . mpi_integer,it_spmd(i),msgtyp,spmd_comm_world,request_s3(i),ierror
786 IF(size_buffer_main(i)>0)
THEN
787 CALL mpi_irecv( buffer_main(i)%INT_ARRAY_1D,size_buffer_main(i),
788 . mpi_integer,it_spmd(i),msgtyp,spmd_comm_world,request_r2(i),ierror )
790 IF(size_buffer_second(i)>0)
THEN
791 CALL mpi_irecv( buffer_second(i)%INT_ARRAY_1D,size_buffer_second(i),
792 . mpi_integer,it_spmd(i),msgtyp,spmd_comm_world,request_r3(i),ierror )
796 siz = iad_elem(1,i+1)-iad_elem(1,i)
797 IF(r_buffer_main(i)%SIZE_INT_ARRAY_1D>0)
THEN
798 CALL mpi_wait(request_s2(i),statu,ierror)
801 IF(size_buffer_main(i)>0)
THEN
802 CALL mpi_wait(request_r2(i),statu,ierror)
803 CALL count_nb_elem_edge( 1,size_buffer_main(i),buffer_main(i)%INT_ARRAY_1D,shoot_struct,chunk)
806 IF(r_buffer_second(i)%SIZE_INT_ARRAY_1D>0)
THEN
807 CALL mpi_wait(request_s3(i),statu,ierror)
810 IF(size_buffer_second(i)>0)
THEN
811 CALL mpi_wait(request_r3(i),statu,ierror)
812 CALL count_nb_elem_edge( 2,size_buffer_second(i),buffer_second(i)%INT_ARRAY_1D,shoot_struct,chunk)
820 DEALLOCATE( work_array_2 )
821 DEALLOCATE( work_array_3 )
823 DEALLOCATE( intersect_1 )
824 DEALLOCATE( intersect_2 )
825 DEALLOCATE( result_intersect )
827 DEALLOCATE( buffer_second )
828 DEALLOCATE( buffer_main )
829 DEALLOCATE( r_buffer_second )
830 DEALLOCATE( r_buffer_main )
834 IF(.NOT.
ALLOCATED(shoot_struct%GLOBAL_NB_ELEM_OFF))
THEN
835 ALLOCATE( shoot_struct%GLOBAL_NB_ELEM_OFF(nthread) )
840 shoot_struct%NUMBER_REMOTE_SURF = 0
841 shoot_struct%SIZE_REMOTE_SURF = 0
842 IF(
ALLOCATED(shoot_struct%REMOTE_SURF))
DEALLOCATE( shoot_struct%REMOTE_SURF )
843 ALLOCATE( shoot_struct%REMOTE_SURF( shoot_struct%SIZE_REMOTE_SURF ) )
848 shoot_struct%NUMBER_NEW_SURF = 0
849 shoot_struct%SIZE_NEW_SURF = 0
850 IF(
ALLOCATED(shoot_struct%NEW_SURF))
DEALLOCATE( shoot_struct%NEW_SURF )
851 ALLOCATE( shoot_struct%NEW_SURF( shoot_struct%SIZE_NEW_SURF ) )
857 call init_hashtable_for_neighbour_segment( npari,ninter,ipari,shoot_struct )
861 erosion_state = ipari(100,nin)
862 if(ity==25.and.(idel/=0.or.erosion_state/=0))
then
863 call get_hashtable_for_neighbour_segment( nin,npari,ninter,ipari,intbuf_tab,shoot_struct )