41
42
43
44
45
46
47
48
49
50
51
56
57
58
59#include "implicit_f.inc"
60#include "comlock.inc"
61
62
63
64#include "mvsiz_p.inc"
65
66
67
68#include "task_c.inc"
69
70
71
72
73
74
75
76 INTEGER CAND_B(NCAND),CAND_E(NCAND), NCAND, ,
77 . ITASK, NBRIC, ITAB(*),
78 . BUFBRIC(NBRIC), IXS(NIXS,*), II_STOK
80
81
82
83 INTEGER NB_NCN,NB_NCN1,NB_ECN,I,J,K,L,DIR,NB_NC,NB_EC,
84 . N1,N2,N3,N4,NN,NE,NCAND_PROV,J_STOK,II,JJ,TT,
85 . NSNF, NSNL, TANGENT(12),
86 . PROV_B(2*MVSIZ), PROV_E(2*MVSIZ), LAST_NE,
87 . VOXBND(2*MVSIZ,0:1,1:3)
88
90 . dx,dy,dz,xs,ys,zs,xx,sx,sy,sz,s2,
91 . xmin, xmax,ymin,
ymax,zmin, zmax, tz, gapsmx, gapl,
92 . d1x,d1y,d1z,d2x,d2y,d2z,dd1,dd2,d2,a2,gs, point(3),point2(3),d_1,d_2,d_3,
93 . on1(3),n1n2(3)
94
95 INTEGER IX,IY,IZ,NEXT,M(8),
96 . IX1,IY1,IZ1,IX2,IY2,IZ2,IBUG,IBUG2,I_LOC,
97 . BIX1(NBRIC),BIY1(NBRIC),BIZ1(NBRIC),
98 . BIX2(NBRIC),BIY2(NBRIC),BIZ2(NBRIC),
99 . FIRST_ADD, , LCHAIN_ADD, I_STOK , idb_ID
100
101 INTEGER, DIMENSION(1) :: SHELL_ADD
102
103 INTEGER :: NC, I_STOK_BAK, IPA,IPB
105 . xminb,yminb,zminb,xmaxb,ymaxb,zmaxb,
106 . dxb,dyb,dzb,
107 . aaa, basisconst2,ns,
108 . power(8), cutcoor,cutcoor2,cut(2),
109 . pow(2), old_cutcoor, old_cutshell, cutnode(2)
110
111 LOGICAL :: IsSH3N
112
113 LOGICAL, DIMENSION(NBRIC) :: COUNT
114
115 LOGICAL :: BOOL(NIRECT_L)
116 INTEGER NBCUT, NBCUT2,DEJA, ISONSHELL, ISONSH3N
117 INTEGER :: COUNTER, NEDGE, NFACE, NODES8(8), COUNTER_BRICK(NBRIC)
118
119 INTEGER :: iN(2), iN1a, iN2a, iN1b, iN2b , iN3, iN4
120 INTEGER :: POS, , IADE, IB ,IBG , NBF, NBL
121 INTEGER :: I_12bits, nbits, npqts, pqts(4), SOM, SECTION
122 INTEGER :: I_bits(12), MAX_ADD, IMIN_LOC, IMAX_LOC
123
124 my_real :: aeradiag, debugtab(24*ncand,3)
125 LOGICAL db_FLAG, TAGnode(8), debug_outp
126
127 CHARACTER*12 :: sectype
128 CHARACTER*12 ::filename
129 LOGICAL :: IsSecDouble
130
131 CHARACTER(LEN=1) filenum
132
133 INTEGER ::
134 . MIN_IX_LOC, MIN_IY_LOC, MIN_IZ_LOC,
135 . MAX_IX_LOC, , MAX_IZ_LOC
136
137 INTEGER :: ISHIFT, IDX
138
139 my_real,
dimension(:),
allocatable :: powb
140
141 INTEGER :: A(5), IE, N_CUT_EDGE
142
143 INTEGER :: TAG_INDEX(NBRIC), I8(8,NBRIC),IFLG_DB
145
146 TYPE(LIST_SECND) :: OLD_SECND_LIST
147
148
149 a(1:5)=((/1,2,3,4,1/))
150
151 idb_id = 0
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
179 nbf = 1+itask*
nb/nthread
180 nbl = (itask+1)*
nb/nthread
181 nin = 1
182
183 cutcoor = -ep30
184
185
186
187
188
189
190
191
192
193 debug_outp = .false.
196 do ib=nbf,nbl
199 debug_outp=.true.
200 exit
201 endif
202 enddo
204 debug_outp = .true.
205 endif
206 endif
207 if(itask==0.AND.debug_outp)then
208 print *, ""
209 print *, "================================="
210 print *, "==== BRICK INTERSECTIONS ====="
211 print *, "================================="
212 endif
213
215 nbf = 1+itask*
nb/nthread
216 nbl = (itask+1)*
nb/nthread
217 nin = 1
218
219 IF (itask==0)THEN
221 ALLOCATE(basisconst(
ncande,4))
228 END IF
230
231
232
233
234
235
236 DO i=nbf, nbl
238 d_1 = zero
239 d_2 = zero
240 d_3 = zero
241 DO j=1,12
242 k=(i-1)*12+j
251 END DO
253 END DO
255
256 if(itask==0 .AND. debug_outp)print *, ""
257
258
259
260
261
262
263
264
265
266
267
268
269
270 nbf = 1+itask*
ncande/nthread
271 nbl = (itask+1)*
ncande/nthread
272
273 DO i=nbf,nbl
275 m(3:4)=irect_l(3:4,ne)
276 IF(m(3)==m(4))THEN
277 issh3n=.true.
279 ELSE
280 issh3n=.false.
282 END IF
283 IF(.NOT.issh3n)THEN
284
285 ptz(i,1)=fourth*sum( irect_l( 05:08,ne) )
286 ptz(i,
287 ptz(i,3)=fourth*sum( irect_l( 13:16,ne) )
288 ELSE
289
290 ptz(i,1)=irect_l(08,ne)
291 ptz(i,2)=irect_l(12,ne)
292 ptz(i,3)=irect_l(16,ne)
293 END IF
295 ipa=a(tt)
296 ipb=a(tt+1)
297
298
299 pta(i,1:3,tt) = irect_l((/4,8,12/)+ipa,ne)
300 vza(i,1:3,tt) = irect_l((/4,8,12/)+ipa,ne)-ptz(i,1:3)
301 vzb(i,1:3,tt) = irect_l((/4,8,12/)+ipb,ne)-ptz(i,1:3)
302 vne(i,1:3,tt) = vza(i,(/2,3,1/),tt)*vzb(i,(/3,1,2/),tt) -
303 . vza(i,(/3,1,2/),tt)*vzb(i,(/2,3,1/),tt)
304
305 norm = vne(i,1,tt)*vne(i,1,tt)+vne(i,2,tt)*vne(i,2,tt)+vne(i,3,tt)*vne(i,3,tt)
308 vne(i,1,tt) = vne(i,1,tt) /
norm
309 vne(i,2,tt) = vne(i,2,tt) /
norm
310 vne(i,3,tt) = vne(i,3,tt) /
norm
311 ENDIF
312 basisconst(i,tt) = sum(ptz(i,1:3)*vne(i,1:3,tt))
313
314
315
316
317 END DO
318 END DO
319
321
322
323
324
325 if(itask==0 .AND. debug_outp)then
326 print *," Calcul des Intersections sur Proc=", itask+1
327 endif
328
329
330 nbf = 1+itask*
ncandb/nthread
331 nbl = (itask+1)*
ncandb/nthread
332
333
334
335 DO i=nbf,nbl
339
340
342 ibg = bufbric(ib)
343 tagnode=.false.
344 tangent(1:12) = 0
345
347 print *, "idb_ID====="
348 print *,
"CAND_E =", cand_e(
iadf(i):
iadl(i))
349 endif
350
351
352
353
354
356 ie = cand_e(iad)
357 IF(ie<=0)cycle
359
360
361
362
363
364
365
366
367
368
370 power(1:8)=(/(sum(vne(iade,1:3,tt) * x(1:3,ixs(ii,ibg)))- basisconst(iade,tt),ii=2,9)/)
371 n_cut_edge = 0
372 DO j=1,12
373 k = (i-1)*12+j
377 nbcut = -1
378 nbcut2 = -1
379
381 print *, "J=", j, itab(in(1:2))
382 write(*,fmt='(A,4I20)') "shell N1-N2-N3 :",int(irect_l(01:04,ie))
383 write(*,fmt='(A,3F20.12)') " shell N1 :",irect_l( (/05,09,13/),ie)
384 write(*,fmt='(A,3F20.12)') " shell N2 :",irect_l( (/06,10,14/),ie)
385 write(*,fmt='(A,3F20.12)') " shell N3 :",irect_l( (/07,11,15/),ie)
386 write(*,fmt='(A,2F40.20)')" POW(1:2)=", pow(1:2)
387 print *,""
388 endif
389
390 if (ixs(11,
brick_list(nin,i)%id)==idb_id )
then
391 print *, "idb_ID====="
392 write(*,fmt='(A,4I20)') "shell N1-N2-N3-N4 :",int(irect_l
393 print *, "IE =", ie
394 print *, "TT =", tt
395 print *, "J =", j
396 print *, "POW1,POW2", pow(1:2)
397 endif
398
399
400
401
402
403
404
405
406
407 tolcrit = em06
408 tol = (one+em04)*tolcrit*
diag22(i)
409
410 IF((abs(pow(1))<=tol).AND.(abs(pow(2))<=tol))THEN
411 tangent(j) = 1
412
413 cycle
414 ENDIF
415 IF(deja==2)cycle
416 IF( ((pow(1)<-tol).AND.(pow(2)>tol)) .OR.((pow(1)>tol).AND.(pow(2)<-tol)) )THEN
417 on1(1:3) = x(1:3,in(1))
419 denom = sum( vne(iade,1:3,tt) * n1n2(1:3) )
420 IF(abs(denom)>em12)THEN
421 cutcoor = ( basisconst(iade,tt) - sum( vne(iade,1:3,tt) * on1(1:3) ) ) / denom
422 ELSE
423
424 cutcoor = half
426 ENDIF
427
428 IF((cutcoor<=one+tol).AND.(cutcoor>=-tol))THEN
429 cutcoor =
min(one-em06,cutcoor)
430 cutcoor =
max(em06 ,cutcoor)
431 point(1:3)=on1(1:3) + cutcoor * n1n2(1:3)
432 ELSE
433 print *, " CUTCOOR =", cutcoor
435 END IF
436
437 nbcut2 = 0
438 ELSEIF((abs(pow(1))<=tol).AND.(abs(pow(2))<=tol))THEN
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455 tangent(j) = 1
456 ELSEIF (abs(pow(1))<=tol)THEN
457
458
459 on1(1:3) = x(1:3,in(1))
461 cutcoor = em06
462 point(1:3) = on1(1:3) + zero * n1n2(1:3)
463 nbcut2 = 0
464
465
466
467
468
469
470
471
472
473
474
475
476 ELSEIF (abs(pow(2))<=tol)THEN
477
478
479 on1(1:3) = x(1:3,in(1))
481 cutcoor = one-em06
482 point(1:3) = on1(1:3) + one * n1n2(1:3)
483 nbcut2 = 0
484
485
486
487
488
489
490
491
492
493
494
495
496 ELSE
497 nbcut = 0
498 nbcut2 = 0
499 END IF
500
501 if (ixs(11,
brick_list(nin,i)%id)==idb_id )
then
502 print *, "cutcoor=", cutcoor
503 iflg_db=1
504 else
505 iflg_db=0
506 endif
507
508 IF(nbcut==-1) nbcut =
isonsh3n( ptz(iade,1:3),pta(iade,1:3,tt),vza(iade,1:3,tt),vzb(iade,1:3,tt),point(1:3) ,iflg_db)
509 IF(nbcut2==-1)nbcut2=
isonsh3n( ptz(iade,1:3),pta(iade,1:3,tt),vza(iade,1:3,tt),vzb(iade,1:3,tt),point2(1:3),iflg_db)
510
512 print *, "NBCUT, NBCUT2=", nbcut,nbcut2
513 endif
514
515
516
517
518 IF(nbcut>0) THEN
519 IF(deja==0)THEN
520
521 nbcut=1
524 ELSEIF (deja==1)THEN
525 old_cutcoor =
edge_list(nin,k)%CUTCOOR(1)
526 old_cutshell =
edge_list(nin,k)%CUTSHELL(1)
527 IF (abs(cutcoor-old_cutcoor)>em6) THEN
528 nbcut=2
529 IF(cutcoor>old_cutcoor)THEN
530 edge_list(nin,k)%CUTCOOR(1) = old_cutcoor
532 edge_list(nin,k)%CUTSHELL(1) = old_cutshell
534
535 ELSEIF(cutcoor<old_cutcoor)THEN
537 edge_list(nin,k)%CUTCOOR(2) = old_cutcoor
539 edge_list(nin,k)%CUTSHELL(2) = old_cutshell
540
541 ELSE
542
543 nbcut=1
544 END IF
545 END IF
546 ELSEIF(deja==2)THEN
547 if(itask==0 .AND. debug_outp)then
549 print *, "THREE INTERSECTION SUR UNE ARRETE - STOP"
551 endif
552 endif
553 END IF
555 edge_list(nin,k)%LEN = sqrt(n1n2(1)*n1n2(1)+n1n2(2)*n1n2(2)+n1n2(3)*n1n2(3))
556 END IF
557
558 IF(nbcut2>0 .AND. deja==0)THEN
559 nbcut=2
562 if(itask==0 .AND. debug_outp)then
564 print *, "edge fully on intersection plane",j
565 endif
566 endif
570 ENDIF
571
572 END DO
573 END DO
574 END DO
575
576 if (ixs(11,
brick_list(nin,i)%id)==idb_id )print *,
"TANGENT 1-12=", tangent(1:12)
577
578 DO j=1,12
579 IF(tangent(j)==1)THEN
580 k =(i-1)*12+j
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602 IF(nbcut>=1)THEN
604 IF(cutcoor==em06 .OR. cutcoor==one-em06)THEN
609 IF(nbcut==1)THEN
612 ENDIF
613 ENDIF
614 ENDIF
615
618 IF(nbcut==1 .AND. cutcoor>em06 .AND. cutcoor<one-em06)THEN
622 ENDIF
623
624
625 ENDIF
626 ENDDO
627
628 END DO
629
630
631
632
633
634
636
638
639 if(debug_outp)then
640 print *, " ===== intersection_nodes.txt ======="
641 endif
642 ipa = 100+ispmd
643 filename(1:12) = "cut_nod0.txt"
644 write(filename(8:8),'(i1.1)')ispmd+1
645
646 open( unit=ipa, file = filename(1:12) )
647
648
649 som=0
651
653 write (unit=ipa,fmt=
'(A,I10)')
"cell ID = ", ixs(11,
brick_list(nin,i)%id)
654 write (* ,fmt=
'(A,I10)')
"cell ID = ", ixs(11,
brick_list(nin,i)%id)
655 endif
656 DO j=1,12
657 iad = (i-1)*12+j
659 cut(1:2) =
edge_list(nin,iad)%CUTCOOR(1:2)
661 n1n2(1:3) =
edge_list(nin,iad)%VECTOR(1:3)
662 on1(1:3) = x(1:3,in(1))
663 DO k=1,nbcut
664
665 point(1:3)= on1(1:3) + cut(k) * n1n2(1:3)
666
667
669 write(unit=ipa,
670 . fmt='(A12,F20.14,A1,F20.14,A1,F20.14,A13)')"*createnode ",point(1) ," ", point(2)," ",point(3)," 0 0 0 "
671 write(*,
672 . fmt='(a12,f20.14,a1,f20.14,a1,f20.14,a13)')"*createnode ",POINT(1) ," ", POINT(2)," ",POINT(3)," 0 0 0 "
673 endif
674 !===script HM=====!
675
676 db_FLAG=.true.
677 if (som>0)then
678 do L=1,SOM
679 if(SUM(ABS(point(1:3)-debugTab(L,1:3)))<EM06)
680 . db_FLAG=.false.
681 end do
682 end if
683 if(db_FLAG)then
684 som=som+1 !debug
685 debugTab(som,1:3) =point(1:3)
686 end if
687
688 END DO ! (DO K=1,NBCUT <=> NBCUT>0)
689 END DO !next J=1,12
690 END DO! next I=1,NB
691 !===script HM=====!
692 CLOSE(IPA)
693 !===script HM=====!
694 end if !ITASK==0
695
696! if(debug_outp)then
697! print *, ""
698! print *, " |--------i22intersect.F---------|"
699! print *, " | WRITE : SCRIPT HM NODES |"
700! print *, " |-------------------------------|"
701! print *, SOM , "nodes written"
702! do L=1,SOM
703! print *, debugTAB(L,1:3)
704! end do
705! print *, ""
706! endif
707
708
709
710
711
712 if(debug_outp)then
713 if(itask==0)then
714 print *, ""
715 print *, " |--------i22intersect.F---------|"
716 print *, " | EDGES |"
717 print *, " |-------------------------------|"
718 print *, 12*NB , " edges (12*NBRIC)"
719 DO I=1, NB ! 1,NB fractionne sur les differents threads
720.and. if(ibug22_intersect/=-1 ibug22_intersect/=ixs(11,brick_list(nin,i)%id))cycle
721 print *, " ** CELL **", IXS(11,BRICK_LIST(NIN,I)%ID)
722 DO J=1,12
723 K=(I-1)*12+J
724 IF( EDGE_LIST(NIN,K)%NBCUT==0)THEN
725 WRITE(*,FMT='(a10,i10,a1,i12,i12,a8)') " edge ",K,":",
726 . ITAB(EDGE_LIST(NIN,K)%NODE(1)),
727 . ITAB(EDGE_LIST(NIN,K)%NODE(2))," "
728 ELSEIF( EDGE_LIST(NIN,K)%NBCUT==1)THEN
729 WRITE(*,FMT='(a10,i10,a1,i12,i12,a8,1f30.16)') " edge ",K,":",
730 . ITAB(EDGE_LIST(NIN,K)%NODE(1)),
731 . ITAB(EDGE_LIST(NIN,K)%NODE(2))," CUTTED :" ,EDGE_LIST(NIN,K)%CUTCOOR(1)
732 ELSE
733 WRITE(*,FMT='(a10,i10,a1,i12,i12,a8,2f30.16)') " edge ",K,":",
734 . ITAB(EDGE_LIST(NIN,K)%NODE(1)),
735 . ITAB(EDGE_LIST(NIN,K)%NODE(2))," 2CUTTED :" ,EDGE_LIST(NIN,K)%CUTCOOR(1:2)
736 END IF
737 END DO
738 END DO
739 end if
740 end if
741
742
743
744
745
746
747 IF (ITASK==0)THEN
748 DEALLOCATE(vNE)
749 DEALLOCATE(BasisCONST)
750 DEALLOCATE(NbSubTriangles)
751 DEALLOCATE(ptZ)
752 DEALLOCATE(vZA)
753 DEALLOCATE(vZB)
754 DEALLOCATE(ptA)
755 DEALLOCATE(diag22)
756 END IF
757
758
759
760 RETURN
norm(diag(diag(diag(inv(mat))) -id.SOL), 2) % destroy mumps instance id.JOB
integer function isonsh3n(z, a, za, zb, p, iflg_db)
subroutine ymax(idn, fac, npc, pld, stiffmin, stiffmax, stiffini, stiffavg)
type(edge_entity), dimension(:,:), allocatable, target edge_list
type(brick_entity), dimension(:,:), allocatable, target brick_list
type(int22_buf_t) int22_buf
integer, dimension(:), allocatable list_e
integer, dimension(:), allocatable iadf
integer, dimension(:), allocatable get_list_e_pos_from_cand_e_pos
integer ibug22_outp_intpoint
integer, dimension(:), allocatable iadl
integer, dimension(:), allocatable diag22
integer, dimension(:), allocatable nbsubtriangles
integer, dimension(:), allocatable list_b