50
51
52
53
54
55
56
57
62 use element_mod , only : nixs
63
64
65
66#include "implicit_f.inc"
67#include "comlock.inc"
68
69
70
71#include "mvsiz_p.inc"
72
73
74
75#include "com01_c.inc"
76#include "param_c.inc"
77#include "task_c.inc"
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125 INTEGER I_MEM,ESHIFT,NSN,ISZNSNR,NSHEL_T,,ITASK,
126 . MULNSN,NOINT,NSHELR_L,IGAP,NBX,NBY,NBZ,NBRIC,
127 . NSV(*),CAND_B(*),CAND_E(*),RENUM(*),
128 . IRECT(4,*), IXS(NIXS,*),
129 . BUFBRIC(NBRIC),
130 . VOXEL(NBX+2,NBY+2,NBZ+2),ITAB(*),NSHEL_L,II_STOK
131
133 . ,TARGET :: x(3,*)
134
136 . bminma(6),cand_p(*), stf(*),stfn(*),
137 . tzinf,marge
138
139 my_real,
DIMENSION(SIZ_XREM, NSHEL_T+1: NSHEL_T+NSHELR_L) ::
140 . xrem
141
142
143
144
145 INTEGER NB_NCN,NB_NCN1,NB_ECN,I,J,K,L,DIR,NB_NC,NB_EC,
146 . N1,N2,N3,N4,NN,NE,NS,NCAND_PROV,J_STOK,II,JJ,TT,
147 . OLDNUM(ISZNSNR), NSNF, NSNL,
148 . PROV_B(2*MVSIZ), PROV_E(2*MVSIZ), LAST_NE,
149 . VOXBND(2*MVSIZ,0:1,1:3)
150
152 . dx,dy,dz,xs,ys,zs,sx,sy,sz,s2,
153 . xmin, xmax,ymin,
ymax,zmin, zmax, tz, gapsmx, gapl,
154 . d1x,d1y,d1z,d2x,d2y,d2z,dd1,dd2,d2,a2,gs, point(3),
155 . on1(3),n1n2(3)
156
157 INTEGER IX,IY,IZ,NEXT,M1,M2,M3,M4,M5,M6,M7,M8,
158 . IX1,IY1,IZ1,IX2,IY2,IZ2,IBUG,IBUG2,I_LOC,
159 . BIX1(NBRIC),BIY1(NBRIC),BIZ1(NBRIC),
160 . BIX2(NBRIC),BIY2(NBRIC),BIZ2(NBRIC),
161 . FIRST_ADD, PREV_ADD, LCHAIN_ADD, I_STOK
162
163 INTEGER :: NC, I_STOK_BAK, IPA,IPB
165 . xminb,yminb,zminb,xmaxb,ymaxb,zmaxb,
166 . dxb,dyb,dzb,
167 . aaa, daaa, dmax
168
169 LOGICAL, DIMENSION(NBRIC) :: TAGB
170
171 LOGICAL :: BOOL(NIRECT_L)
172 INTEGER NBCUT, DEJA, ISONSHELL, ISONSH3N
173 INTEGER :: COUNTER, NEDGE, NFACE, NODES8(8), COUNTER_BRICK(NBRIC)
174
175
176
177 INTEGER :: iN1, iN2, iN1a, iN2a, iN1b, iN2b , iN3, iN4
178 INTEGER :: POS, IAD, IB , NBF, NBL
179 INTEGER :: I_12bits, nbits, npqts, pqts(4), SUM, SECTION
180 INTEGER :: I_bits(12), MAX_ADD, IMIN_LOC, IMAX_LOC
181
183 . aeradiag,xx(8),yy(8),zz(8),diag(4)
184
185 CHARACTER*12 :: sectype
186 LOGICAL :: IsSecDouble, IsSTO
187
188 CHARACTER(LEN=1) filenum
189
190 INTEGER ::
191 . MIN_IX_LOC, MIN_IY_LOC, MIN_IZ_LOC,
192 . MAX_IX_LOC, MAX_IY_LOC, MAX_IZ_LOC
193
194 INTEGER, ALLOCATABLE, DIMENSION(:) :: order, VALUE
195
196 INTEGER R2,MIN2
197
198
199
200
201
202
203
204
205
206
207
209 print *, " i22trivox:entering routine"
210 print *, ""
211 print *, "------------------BRICKS DOMAIN--------------------"
212 print *, " BMINMAL_I22TRIVOX=", bminma(4:6),bminma(1:3)
213 print *, " NBX,NBY,NBZ=", nbx,nby,nbz
214 print *, "---------------------------------------------------"
215 print *, ""
216 print *, ""
217 print *, " |-----------i22trivox.F---------|"
218 print *, " | DOMAIN INFORMATION |"
219 print *, " |-------------------------------|"
220 print *, " MPI =",ispmd +1
221 print *, " NT =",itask+1
222 print *, " NCYCLE =", ncycle
223 print *, " ITASK =", itask
225 print *, " local bricks :", nbric
226 print *, " tableau briques du domaine local :"
227 print *, ixs(11,bufbric(1:nbric))
228 print *, " local faces :",nshel_l
229 print *, " tableau facettes du domaine local :"
231 print *, i,nint(irect_l(1:4, i))
232 END DO
233 print *, " +remotes:"
235 print *, i,irect_l(1:4, i)
236 END DO
237 print *, " |-------------------------------|"
238 print *, ""
239 print *, " |-----i22trivox.F--------|"
240 print *, " | THREAD INFORMATION |"
241 print *, " |------------------------|"
242
243 print *, " cple candidats max : ", mulnsn
244 print *, " ESHIFT=", eshift
245 print *, " |------------------------|"
246 print *, ""
247 end if
249
250
251
252
253
254
255 max_add = mulnsn
256 aaa = zero
257
258
259
260
261
262
263
264 IF(itask == 0)THEN
265
277 END IF
278 IF(itask==nthread-1)THEN
287 END IF
288
290
291
292
293
294
295
296
297 xminb = bminma(4)
298 yminb = bminma(5)
299 zminb = bminma(6)
300 xmaxb = bminma(1)
301 ymaxb = bminma(2)
302 zmaxb = bminma(3)
303 aaa = tzinf
304
305 xminb = xminb - aaa
306 yminb = yminb - aaa
307 zminb = zminb - aaa
308 xmaxb = xmaxb + aaa
309 ymaxb = ymaxb + aaa
310 zmaxb = zmaxb + aaa
311
312 dxb = xmaxb-xminb
313 dyb = ymaxb-yminb
314 dzb = zmaxb-zminb
315
316 !If aaa=0 then voxel domain can be degenerated. example : 1shell in plane xy => dzb=0
317 daaa = ( (bminma(1)-bminma(4))+(bminma(2)-bminma(5))+
318 . (bminma(3)-bminma(6)) ) / three/hundred
319 dmax =
max(
max(dxb,dyb),dzb)
320
321 IF(dxb/dmax<em06)dxb=daaa
322 IF(dyb/dmax<em06)dyb=daaa
323 IF(dzb/dmax<em06)dzb=daaa
324
325
328
329
330
331
332 DO ne=nbf,nbl
333 IF(irect_l(23,ne)==zero)cycle
334 IF(((xmaxe(ne)< xminb).OR.(xmine(ne)>xmaxb)).OR.
335 . ((ymaxe(ne)< yminb).OR.(ymine(ne)>ymaxb)).OR.
336 . ((zmaxe(ne)< zminb).OR.(zmine(ne)>zmaxb)))THEN
337 irect_l(23,ne)=zero
338
339 cycle
340 END IF
341
342 ! voxel occupied by
the brick
343
344
345 ix1=int(nbx*(irect_l(17,ne)-aaa-xminb)/dxb)
346 iy1=int(nby*(irect_l(18,ne)-aaa-yminb)/dyb)
347 iz1=int(nbz*(irect_l(19,ne)-aaa-zminb)/dzb)
351
352 ix2=int(nbx*(irect_l(20,ne)+aaa-xminb)/dxb)
353 iy2=int(nby*(irect_l(21,ne)+aaa-yminb)/dyb)
354 iz2=int(nbz*(irect_l(22,ne)+aaa-zminb)/dzb)
358 END DO
359
360
361
362
369
370
371
372#include "lockon.inc"
379#include "lockoff.inc"
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419 IF(itask==0)THEN
421 IF(irect_l(23,ne)==zero)cycle
422
424 print *, " traitement shell",nint(irect_l((/1,3/),ne)),
426 print *, " xmin/xmax=", irect_l((/17,20/),ne)
427 print *, " ymin/ymax=", irect_l((/18,21/),ne)
428 print *, " zmin/zmax=", irect_l((/19,22/),ne)
429 end if
430
434 first_add = voxel(ix,iy,iz)
435 IF(first_add == 0)THEN
436
441 ELSE
442
448 ENDIF
451
452
453 max_add = 2 * max_add
458 ENDIF
459 ENDDO
460 ENDDO
461 ENDDO
462 END DO
463 END IF
465
466
468 .print *, " i22trivox:voxel filled"
469
470
471
472
473
474
475
476 nc = 0
477 i_stok = 0
478 last_ne = 0
479 nbf = 1+itask*nbric/nthread
480 nbl = (itask+1)*nbric/nthread
481
482 DO i=nbf,nbl
483
484
485
486
487
488
489
490 ix1=int(nbx*(xmins(i)-xminb)/dxb)
491 iy1=int(nby*(ymins(i)-yminb)/dyb)
492 iz1=int(nbz*(zmins(i)-zminb)/dzb)
493 bix1(i)=
max(1,2+
min(nbx,ix1))
494 biy1(i)=
max(1,2+
min(nby,iy1))
495 biz1(i)=
max(1,2+
min(nbz,iz1))
496
497 ix2=int(nbx*(xmaxs(i)-xminb)/dxb)
498 iy2=int(nby*(ymaxs(i)-yminb)/dyb)
499 iz2=int(nbz*(zmaxs(i)-zminb)/dzb)
500 bix2(i)=
max(1,2+
min(nbx,ix2))
501 biy2(i)=
max(1,2+
min(nby,iy2))
502 biz2(i)=
max(1,2+
min(nbz,iz2))
503
504
505
506
507
508
509
510
511 DO iz = biz1(i),biz2(i)
512 DO iy = biy1(i),biy2(i)
513 DO ix = bix1(i),bix2(i)
514 lchain_add = voxel(ix,iy,iz)
515 DO WHILE(lchain_add /= 0)
517 bool(ne)=.false.
519 ENDDO
520 ENDDO
521 ENDDO
522 ENDDO
523
524 issto = .false.
525
526 DO iz = biz1(i),biz2(i)
527 DO iy = biy1(i),biy2(i)
528 DO ix = bix1(i),bix2(i)
529 lchain_add = voxel(ix,iy,iz)
530 DO WHILE(lchain_add /= 0)
532
533
534 IF(bool(ne))THEN
536 cycle
537 END IF
538 j = ne
539 ns = bufbric(i)
540 xx(1:8) = x(1,ixs(2:9,ns))
541 yy(1:8) = x(2,ixs(2:9,ns))
542 zz(1:8) = x(3,ixs(2:9,ns))
543 diag(1) = sqrt((xx(1)-xx(7))**2 + (yy(1)-yy(7))**2 + (zz(1)-zz(7))**2)
544 diag(2) = sqrt((xx(3)-xx(5))**2 + (yy(3)-yy(5))**2 + (zz(3)-zz(5))**2)
545 diag(3) = sqrt((xx(2)-xx(8))**2 + (yy(2)-yy(8))**2 + (zz(2)-zz(8))**2)
546 diag(4) = sqrt((xx(4)-xx(6))**2 + (yy(4)-yy(6))**2 + (zz(4)-zz(6))**2)
547 aaa = 1.2d00*maxval(diag(1:4),1)
548
549
550 IF( (irect_l(17,ne)-aaa>xmaxs(i)).OR.
551 . (irect_l(20,ne)+aaa<xmins(i)).OR.
552 . (irect_l(18,ne)-aaa>ymaxs(i)).OR.
553 . (irect_l(21,ne)+aaa<ymins(i)).OR.
554 . (irect_l(19,ne)-aaa>zmaxs(i)).OR.
555 . (irect_l(22,ne)+aaa<zmins(i)) ) THEN
557 cycle
558 END IF
559 bool(ne) =.true.
560 i_stok = i_stok + 1
561 prov_b(i_stok) = i
562 prov_e(i_stok) = ne
564 tagb(i) = .true.
565
566 IF( (irect_l(17,ne) >xmaxs(i)).OR.
567 . (irect_l(20,ne) <xmins(i)).OR.
568 . (irect_l(18,ne) >ymaxs(i)).OR.
569 . (irect_l(21,ne) <ymins(i)).OR.
570 . (irect_l(19,ne) >zmaxs(i)).OR.
571 . (irect_l(22,ne) <zmins(i)) ) prov_e(i_stok) = -prov_e(i_stok)
572
573
574
575 IF(i_stok>=nvsiz)THEN
576
577
578
579
581 1 i_stok ,irect ,x , ii_stok, cand_b,
582 2 cand_e ,mulnsn ,noint , marge , i_mem ,
583 3 prov_b ,prov_e ,eshift , itask , nc ,
584 4 ixs ,bufbric ,nbric , issto )
585 i_stok = 0
586 IF(i_mem==2) THEN
588 print *, " i22trivox.F:too much candidates on thread=",
589 . itask+1
590 print *, " i22trivox.F:II_STOK=", ii_stok,mulnsn
591 end if
592 GOTO 1000
594 endif
595
596 ENDDO
597 ENDDO
598 ENDDO
599 ENDDO
600
601
602
603 IF(i_stok/=0)THEN
604
605
607 1 i_stok ,irect ,x , ii_stok ,cand_b,
608 2 cand_e ,mulnsn ,noint , marge ,i_mem ,
609 3 prov_b ,prov_e ,eshift , itask ,nc ,
610 4 ixs ,bufbric ,nbric , issto )
611 i_stok = 0
612 IF(i_mem==2) THEN
613
614
615
616
617
618 GOTO 1000
620 END IF
621
622
623
624
625 IF(issto)THEN
626
627
628#include "lockoff.inc"
629
630 END IF
631
632 END DO
633
634
635
636
637
638
639
640
641
642 1000 CONTINUE
643
644 CALL my_barrier ! all threads need to finish its work with
common voxel before resetting it.
645
647 . " i22trivox.F:nb de candidats:" , ii_stok, itask
648
649 IF(itask==0)THEN
650
654 voxel(i,j,k) = 0
655 END DO
656 END DO
657 END DO
658 ENDIF
659
660
661
662
663
664
665 IF(itask == 0)THEN
669 ENDIF
670
671
674 DO ix=1,(nbx+2)
675 DO iy=1,(nby+2)
676 DO iz=1,(nbz+2)
677 if (voxel(ix,iy,iz)/=0) then
678 print *, " i22trivox.F:error raz voxel",voxel(ix,iy,iz)
679 print *, " i22trivox.F:ix,iy,iz=", ix,iy,iz
680 stop
681 end if
682 END DO
683 END DO
684 END DO
685 print *, " i22trivox.F:raz voxel ok."
686 end if
687 if(i_mem==2)then
689 . print *,
690 . " i22trivox.F:returning i22buce (too much candidate)"
691 GOTO 2000
692 end if
694 . print *, " i22trivox.F:fin recherche des candidats, nb=",
695 . ii_stok
696
698 allocate(order(ii_stok) ,value(ii_stok))
699 min2 = minval(abs(cand_e(1:ii_stok)))
700 r2 = maxval(abs(cand_e(1:ii_stok))) - min2
701 DO i=1,ii_stok
702 value(i) = cand_b(i)*(r2+1)+abs(cand_e(i))-min2
703 ENDDO
704 order=0
705
706
707
708
709 print *, " II_STOK=", ii_stok
710 print *, " IXS(11,BUFBRIC(CAND_B)) ) =", ixs(11, bufbric(cand_b(order(1:ii_stok))))
711 print *, " BUFBRIC(CAND_B) =", bufbric(cand_b(order(1:ii_stok)))
712 print *, " CAND_B =", cand_b(order(1:ii_stok))
713 print *, " CAND_E =", cand_e(order(1:ii_stok))
714
715 deallocate(order,VALUE)
716 endif
717
718
719
720
721
722
723 2000 CONTINUE
725
726 RETURN
if(complex_arithmetic) id
end diagonal values have been computed in the(sparse) matrix id.SOL
subroutine i22sto(j_stok, irect, x, ii_stok, cand_b, cand_e, mulnsn, noint, marge, i_mem, prov_b, prov_e, eshift, itask, nc, ixs, bufbric, nbric, issto)
subroutine ymax(idn, fac, npc, pld, stiffmin, stiffmax, stiffini, stiffavg)
integer, dimension(:), pointer lchain_next
integer, dimension(:), pointer lchain_elem
integer, dimension(:), allocatable eiz2
integer, dimension(:), allocatable eiz1
integer, dimension(:), pointer lchain_last
integer, dimension(:), allocatable eiy2
integer, dimension(:), allocatable eix2
integer, dimension(:), allocatable eix1
integer, dimension(:), allocatable eiy1
integer function, dimension(:), pointer ireallocate(ptr, new_size)