42
43
44
45
46
47
48
49
50
51
52
57 use element_mod , only : nixs
58
59
60
61#include "implicit_f.inc"
62#include "comlock.inc"
63
64
65
66#include "mvsiz_p.inc"
67
68
69
70#include "task_c.inc"
71
72
73
74
75
76
77
78 INTEGER CAND_B(NCAND),CAND_E(NCAND), NCAND, NIN,
79 . ITASK, NBRIC, ITAB(*),
80 . BUFBRIC(NBRIC), IXS(NIXS,*), II_STOK
82
83
84
85 INTEGER ,NB_NCN1,NB_ECN,I,J,K,L,DIR,NB_NC,NB_EC,
86 . N1,N2,N3,N4,
87 . NSNF, NSNL, (12),
88 . PROV_B(2*MVSIZ), PROV_E(2
89
90
92 . dx,dy,dz,xs,ys,zs,xx,sx,sy,sz,s2,
93 . xmin, xmax,ymin,
ymax,zmin, zmax, tz, gapsmx, gapl,
94 . d1x,d1y,d1z,d2x,d2y,d2z,dd1,dd2,d2
95 . on1(3),n1n2(3)
96
97 INTEGER IX,IY,IZ,NEXT,M(8),
98 . IX1,IY1,IZ1,IX2,IY2,IZ2,IBUG,IBUG2,I_LOC,
99 . BIX1(NBRIC),BIY1(NBRIC),BIZ1(NBRIC),
100 . BIX2(NBRIC),BIY2(NBRIC),BIZ2(NBRIC),
101 . FIRST_ADD, PREV_ADD, LCHAIN_ADD, I_STOK , idb_ID
102
103 INTEGER, DIMENSION(1) :: SHELL_ADD
104
105 INTEGER :: NC, I_STOK_BAK, IPA,IPB
107 . xminb,yminb,zminb,xmaxb,ymaxb,zmaxb,
108 . dxb,dyb,dzb,
109 . aaa, basisconst2,ns,
110 . power(8), cutcoor,cutcoor2,cut(2),
111 . pow(2), old_cutcoor, old_cutshell, cutnode(2)
112
113 LOGICAL :: IsSH3N
114
115 LOGICAL, DIMENSION(NBRIC) :: COUNT
116
117 LOGICAL :: BOOL(NIRECT_L)
118 INTEGER NBCUT, NBCUT2,DEJA, ISONSHELL, ISONSH3N
119 INTEGER :: COUNTER, NEDGE, NFACE, NODES8(8), COUNTER_BRICK(NBRIC)
120
121 INTEGER :: iN(2), iN1a, iN2a, iN1b, iN2b , iN3, iN4
122 INTEGER :: POS, IAD, IADE, IB ,IBG , NBF, NBL
123 INTEGER :: I_12bits, nbits, npqts, pqts(4), SOM, SECTION
124 INTEGER :: I_bits(12), MAX_ADD, IMIN_LOC, IMAX_LOC
125
126 my_real :: aeradiag, debugtab(24*ncand,3)
127 LOGICAL db_FLAG, TAGnode(8), debug_outp
128
129 CHARACTER*12 :: sectype
130 CHARACTER*12 ::filename
131 LOGICAL :: IsSecDouble
132
133 CHARACTER(LEN=1) filenum
134
135 INTEGER ::
136 . MIN_IX_LOC, MIN_IY_LOC, MIN_IZ_LOC,
137 . MAX_IX_LOC, MAX_IY_LOC, MAX_IZ_LOC
138
139 INTEGER :: ISHIFT, IDX
140
141 my_real,
dimension(:),
allocatable :: powb
142
143 INTEGER :: A(5), IE, N_CUT_EDGE
144
145 INTEGER :: TAG_INDEX(NBRIC), I8(8,NBRIC),IFLG_DB
147
148 TYPE(LIST_SECND) :: OLD_SECND_LIST
149
150
151 a(1:5)=((/1,2,3,4,1/))
152
153 idb_id = 0
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
181 nbf = 1+itask*
nb/nthread
182 nbl = (itask+1)*
nb/nthread
183 nin = 1
184
185 cutcoor = -ep30
186
187
188
189
190
191
192
193
194
195 debug_outp = .false.
198 do ib=nbf,nbl
201 debug_outp=.true.
202 exit
203 endif
204 enddo
206 debug_outp = .true.
207 endif
208 endif
209 if(itask==0.AND.debug_outp)then
210 print *, ""
211 print *, "================================="
212 print *, "==== BRICK INTERSECTIONS ====="
213 print *, "================================="
214 endif
215
217 nbf = 1+itask*
nb/nthread
218 nbl = (itask+1)*
nb/nthread
219 nin = 1
220
221 IF (itask==0)THEN
223 ALLOCATE(basisconst(
ncande,4))
230 END IF
232
233
234
235
236
237
238 DO i=nbf, nbl
240 d_1 = zero
241 d_2 = zero
242 d_3 = zero
243 DO j=1,12
244 k=(i-1)*12+j
253 END DO
255 END DO
257
258 if(itask==0 .AND. debug_outp)print *, ""
259
260
261
262
263
264
265
266
267
268
269
270
271
272 nbf = 1+itask*
ncande/nthread
273 nbl = (itask+1)*
ncande/nthread
274
275 DO i=nbf,nbl
277 m(3:4)=irect_l(3:4,ne)
278 IF(m(3)==m(4))THEN
279 issh3n=.true.
281 ELSE
282 issh3n=.false.
284 END IF
285 IF(.NOT.issh3n)THEN
286
287 ptz(i,1)=fourth*sum( irect_l( 05:08,ne) )
288 ptz(i,2)=fourth*sum( irect_l( 09:12,ne) )
289 ptz(i,3)=fourth*sum( irect_l( 13:16,ne) )
290 ELSE
291
292 ptz(i,1)=irect_l(08,ne)
293 ptz(i,2)=irect_l(12,ne)
294 ptz(i,3)=irect_l(16,ne)
295 END IF
297 ipa=a(tt)
298 ipb=a(tt+1)
299
300
301 pta(i,1:3,tt) = irect_l((/4,8,12/)+ipa,ne)
302 vza(i,1:3,tt) = irect_l((/4,8,12/)+ipa,ne)-ptz(i,1:3)
303 vzb(i,1:3,tt) = irect_l((/4,8,12/)+ipb,ne)-ptz(i,1:3)
304 vne(i,1:3,tt) = vza(i,(/2,3,1/),tt)*vzb(i,(/3,1,2/),tt) -
305 . vza(i,(/3,1,2/),tt)*vzb(i,(/2,3,1/),tt)
306
307 norm = vne(i,1,tt)*vne(i,1,tt)+vne
310 vne(i,1,tt) = vne(i,1,tt) /
norm
311 vne(i,2,tt) = vne(i,2,tt) /
norm
312 vne(i,3,tt) = vne(i,3,tt) /
norm
313 ENDIF
314 basisconst(i,tt) = sum(ptz(i,1:3)*vne(i,1:3,tt))
315
316
317
318
319 END DO
320 END DO
321
323
324
325
326
327 if(itask==0 .AND. debug_outp)then
328 print *," Calcul des Intersections sur Proc=", itask+1
329 endif
330
331
332 nbf = 1+itask*
ncandb/nthread
333 nbl = (itask+1)*
ncandb/nthread
334
335
336
337 DO i=nbf,nbl
341
342
344 ibg = bufbric(ib)
345 tagnode=.false.
346 tangent(1:12) = 0
347
349 print *, "idb_ID====="
350 print *,
"CAND_E =", cand_e(
iadf(i):
iadl(i))
351 endif
352
353
354
355
356
358 ie = cand_e(iad)
359 IF(ie<=0)cycle
361
362
363
364
365
366
367
368
369
370
372 power(1:8)=(/(sum(vne(iade,1:3,tt) * x(1:3,ixs(ii,ibg)))- basisconst(iade,tt),ii=2,9)/)
373 n_cut_edge = 0
374 DO j=1,12
375 k = (i-1)*12+j
379 nbcut = -1
380 nbcut2 = -1
381
383 print *, "J=", j, itab(in(1:2))
384 write(*,fmt='(A,4I20)') "shell N1-N2-N3 :",int(irect_l(01:04,ie))
385 write(*,fmt='(A,3F20.12)') " shell N1 :",irect_l( (/05,09,13/),ie)
386 write(*,fmt='(A,3F20.12)') " shell N2 :",irect_l( (/06,10,14/),ie)
387 write(*,fmt='(A,3F20.12)') " shell N3 :",irect_l( (/07,11,15/),ie)
388 write(*,fmt='(A,2F40.20)')" POW(1:2)=", pow(1:2)
389 print *,""
390 endif
391
392 if (ixs(11,
brick_list(nin,i)%id)==idb_id )
then
393 print *, "idb_ID====="
394 write(*,fmt='(A,4I20)') "shell N1-N2-N3-N4 :",int(irect_l(01:04,ie))
395 print *, "IE =", ie
396 print *, "TT =", tt
397 print *, "J =", j
398 print *, "POW1,POW2", pow(1:2)
399 endif
400
401
402
403
404
405
406
407
408
409 tolcrit = em06
410 tol = (one+em04)*tolcrit*
diag22(i)
411
412 IF((abs(pow(1))<=tol).AND.(abs(pow(2))<=tol))THEN
413 tangent(j) = 1
414
415 cycle
416 ENDIF
417 IF(deja==2)cycle
418 IF( ((pow(1)<-tol).AND.(pow(2)>tol)) .OR.((pow(1)>tol).AND.(pow(2)<-tol)) )THEN
419 on1(1:3) = x(1:3,in(1))
421 denom = sum( vne(iade,1:3,tt) * n1n2(1:3) )
422 IF(abs(denom)>em12)THEN
423 cutcoor = ( basisconst(iade,tt) - sum( vne(iade,1:3,tt) * on1(1:3) ) ) / denom
424 ELSE
425
426 cutcoor = half
428 ENDIF
429
430 IF((cutcoor<=one+tol).AND.(cutcoor>=-tol))THEN
431 cutcoor =
min(one-em06,cutcoor)
432 cutcoor =
max(em06 ,cutcoor)
433 point(1:3)=on1(1:3) + cutcoor * n1n2(1:3)
434 ELSE
435 print *, " CUTCOOR =", cutcoor
437 END IF
438
439 nbcut2 = 0
440 ELSEIF((abs(pow(1))<=tol).AND.(abs(pow(2))<=tol))THEN
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457 tangent(j) = 1
458 ELSEIF (abs(pow(1))<=tol)THEN
459
460
461 on1(1:3) = x(1:3,in(1))
463 cutcoor = em06
464 point(1:3) = on1(1:3) + zero * n1n2(1:3)
465 nbcut2 = 0
466
467
468
469
470
471
472
473
474
475
476
477
478 ELSEIF (abs(pow(2))<=tol)THEN
479
480
481 on1(1:3) = x(1:3,in(1))
483 cutcoor = one-em06
484 point(1:3) = on1(1:3) + one * n1n2(1:3)
485 nbcut2 = 0
486
487
488
489
490
491
492
493
494
495
496
497
498 ELSE
499 nbcut = 0
500 nbcut2 = 0
501 END IF
502
503 if (ixs(11,
brick_list(nin,i)%id)==idb_id )
then
504 print *, "cutcoor=", cutcoor
505 iflg_db=1
506 else
507 iflg_db=0
508 endif
509
510 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)
511 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)
512
513 if (ixs(11,
brick_list(nin,i)%id)==idb_id )
then
514 print *, "NBCUT, NBCUT2=", nbcut,nbcut2
515 endif
516
517
518
519
520 IF(nbcut>0) THEN
521 IF(deja==0)THEN
522
523 nbcut=1
526 ELSEIF (deja==1)THEN
527 old_cutcoor =
edge_list(nin,k)%CUTCOOR(1)
528 old_cutshell =
edge_list(nin,k)%CUTSHELL(1)
529 IF (abs(cutcoor-old_cutcoor)>em6) THEN
530 nbcut=2
531 IF(cutcoor>old_cutcoor)THEN
532 edge_list(nin,k)%CUTCOOR(1) = old_cutcoor
534 edge_list(nin,k)%CUTSHELL(1) = old_cutshell
536
537 ELSEIF(cutcoor<old_cutcoor)THEN
539 edge_list(nin,k)%CUTCOOR(2) = old_cutcoor
541 edge_list(nin,k)%CUTSHELL(2) = old_cutshell
542
543 ELSE
544
545 nbcut=1
546 END IF
547 END IF
548 ELSEIF(deja==2)THEN
549 if(itask==0 .AND. debug_outp)then
551 print *, "THREE INTERSECTION SUR UNE ARRETE - STOP"
553 endif
554 endif
555 END IF
557 edge_list(nin,k)%LEN = sqrt(n1n2(1)*n1n2(1)+n1n2
558 END IF
559
560 IF(nbcut2>0 .AND. deja==0)THEN
561 nbcut=2
564 if(itask==0 .AND. debug_outp)then
566 print *, "edge fully on intersection plane",j
567 endif
568 endif
572 ENDIF
573
574 END DO
575 END DO
576 END DO
577
578 if (ixs(11,
brick_list(nin,i)%id)==idb_id )print *,
"TANGENT 1-12=", tangent(1:12)
579
580 DO j=1,12
581 IF(tangent(j)==1)THEN
582 k =(i-1)*12+j
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604 IF(nbcut>=1)THEN
606 IF(cutcoor==em06 .OR. cutcoor==one-em06)THEN
611 IF(nbcut==1)THEN
614 ENDIF
615 ENDIF
616 ENDIF
617
620 IF(nbcut==1 .AND. cutcoor>em06 .AND. cutcoor<one-em06)THEN
624 ENDIF
625
626
627 ENDIF
628 ENDDO
629
630 END DO
631
632
633
634
635
636
638
640
641 if(debug_outp)then
642 print *, " ===== intersection_nodes.txt ======="
643 endif
644 ipa = 100+ispmd
645 filename(1:12) = "cut_nod0.txt"
646 write(filename(8:8),'(i1.1)')ispmd+1
647
648 open( unit=ipa, file = filename(1:12) )
649
650
651 som=0
653
655 write (unit=ipa,fmt=
'(A,I10)')
"cell ID = ", ixs(11,
brick_list(nin,i)%id)
656 write (* ,fmt=
'(A,I10)')
"cell ID = ", ixs(11,
brick_list(nin,i)%id)
657 endif
658 DO j=1,12
659 iad = (i-1)*12+j
661 cut(1:2) =
edge_list(nin,iad)%CUTCOOR(1:2)
663 n1n2(1:3) =
edge_list(nin,iad)%VECTOR(1:3)
664 on1(1:3) = x(1:3,in(1))
665 DO k=1,nbcut
666
667 point(1:3)= on1(1:3) + cut(k) * n1n2(1:3)
668
669
671 write(unit=ipa,
672 . fmt='(A12,F20.14,A1,F20.14,A1,F20.14,A13)')"*createnode ",point(1) ," ", point(2)," ",point(3)," 0 0 0 "
673 write(*,
674 . fmt='(A12,F20.14,A1,F20.14,A1,F20.14,A13)')"*createnode ",point(1) ," ", point(2)," ",point(3)," 0 0 0 "
675 endif
676
677
678 db_flag=.true.
679 if (som>0)then
680 do l=1,som
681 if(sum(abs(point(1:3)-debugtab(l,1:3)))<em06)
682 . db_flag=.false.
683 end do
684 end if
685 if(db_flag)then
686 som=som+1
687 debugtab(som,1:3) =point(1:3)
688 end if
689
690 END DO
691 END DO
692 END do
693
694 CLOSE(ipa)
695
696 end if
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714 if(debug_outp)then
715 if(itask==0)then
716 print *, ""
717 print *, " |--------i22intersect.F---------|"
718 print *, " | EDGES |"
719 print *, " |-------------------------------|"
720 print *, 12*
nb ,
" edges (12*NBRIC)"
723 print *,
" ** CELL **", ixs(11,
brick_list(nin,i)%ID)
724 DO j=1,12
725 k=(i-1)*12+j
727 WRITE(*,fmt='(A10,I10,A1,I12,I12,A8)') " edge ",k,":",
731 WRITE(*,fmt='(A10,I10,A1,I12,I12,A8,1F30.16)') " edge ",k,":",
734 ELSE
735 WRITE(*,fmt='(A10,I10,A1,I12,I12,A8,2F30.16)') " edge ",k,":",
738 END IF
739 END DO
740 END DO
741 end if
742 end if
743
744
745
746
747
748
749 IF (itask==0)THEN
750 DEALLOCATE(vne)
751 DEALLOCATE(basisconst)
753 DEALLOCATE(ptz)
754 DEALLOCATE(vza)
755 DEALLOCATE(vzb)
756 DEALLOCATE(pta)
758 END IF
759
760
761
762 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