31
32
33
34#include "implicit_f.inc"
35
36
37
38 INTEGER NVERTS, NVMAX
40 . tri(3,*), box(3,*),
norm(3,*), poly(3,*)
41
42
43
44 INTEGER I, NPOUT, J
45 INTEGER JJ, NN, IFOUND, REDIR(NVMAX)
47 . a(3), n(3), polyout(3,nvmax)
49 . x1, y1, z1, x2, y2, z2, dd, tole
50 INTEGER P_REF(6)
51 DATA p_ref /1,5,1,2,3,4/
52#ifdef MYREAL8
53 tole=em10
54#else
55 tole=em5
56#endif
57
58 nverts=3
59 DO i=1,nverts
60 poly(1,i)=tri(1,i)
61 poly(2,i)=tri(2,i)
62 poly(3,i)=tri(3,i)
63 ENDDO
64
65 DO i=1,6
66 a(1)=box(1,p_ref(i))
67 a(2)=box(2,p_ref(i))
68 a(3)=box(3,p_ref(i))
72 CALL polclip(poly, nverts, a, n, polyout, npout)
73 nverts=npout
74 DO j=1,nverts
75 poly(1,j)=polyout(1,j)
76 poly(2,j)=polyout(2,j)
77 poly(3,j)=polyout(3,j)
78 ENDDO
79 ENDDO
80
81 nn=0
82 DO i=1,nverts
83 x1=poly(1,i)
84 y1=poly(2,i)
85 z1=poly(3,i)
86 ifound=0
87 DO j=1,nn
88 jj=redir(j)
89 x2=poly(1,jj)
90 y2=poly(2,jj)
91 z2=poly(3,jj)
92 dd=sqrt((x1-x2)**2+(y1-y2)**2+(z1-z2)**2)
93 IF (dd<=tole) ifound=j
94 ENDDO
95 IF (ifound==0) THEN
96 nn=nn+1
97 redir(nn)=i
98 ENDIF
99 ENDDO
100
101 nverts=nn
102 DO i=1,nverts
103 poly(1,i)=polyout(1,redir(i))
104 poly(2,i)=polyout(2,redir(i))
105 poly(3,i)=polyout(3,redir(i))
106 ENDDO
107
108 RETURN
norm(diag(diag(diag(inv(mat))) -id.SOL), 2) % destroy mumps instance id.JOB
subroutine polclip(polyin, npin, a, n, polyout, npout)