24 subroutine addnod ( mpl, nst, k, x, y, z, list, lptr, lend, lnew, ier )
112 real ( kind_real ) b1
113 real ( kind_real ) b2
114 real ( kind_real ) b3
135 real ( kind_real ) p(3)
137 real ( kind_real ) x(k)
138 real ( kind_real ) y(k)
139 real ( kind_real ) z(k)
145 write ( *,
'(a)' )
' ' 146 write ( *,
'(a)' )
'ADDNOD - Fatal error!' 147 write ( *,
'(a)' )
' K < 4.' 148 call mpl%abort(
'stop in stripack')
168 call trfind ( ist, p, km1, x, y, z, list, lptr, lend, b1, b2, b3, &
175 write ( *,
'(a)' )
' ' 176 write ( *,
'(a)' )
'ADDNOD - Fatal error!' 177 write ( *,
'(a)' )
' The nodes are coplanar.' 178 call mpl%abort(
'stop in stripack')
185 if (
eq(p(1),x(l)) .and.
eq(p(2),y(l)) .and.
eq(p(3),z(l)) )
then 187 write ( *,
'(a)' )
' ' 188 write ( *,
'(a)' )
'ADDNOD - Fatal error!' 189 write ( *,
'(a,i8,a,i8)' )
' Node ', l,
' is equal to node ', k
190 call mpl%abort(
'stop in stripack')
195 if (
eq(p(1),x(l)) .and.
eq(p(2),y(l)) .and.
eq(p(3),z(l)) )
then 197 write ( *,
'(a)' )
' ' 198 write ( *,
'(a)' )
'ADDNOD - Fatal error!' 199 write ( *,
'(a,i8,a,i8)' )
' Node ', l,
' is equal to node ', k
200 call mpl%abort(
'stop in stripack')
204 if (
eq(p(1),x(l)) .and.
eq(p(2),y(l)) .and.
eq(p(3),z(l)) )
then 206 write ( *,
'(a)' )
' ' 207 write ( *,
'(a)' )
'ADDNOD - Fatal error!' 208 write ( *,
'(a,i8,a,i8)' )
' Node ', l,
' is equal to node ', k
209 call mpl%abort(
'stop in stripack')
212 call intadd ( kk, i1, i2, i3, list, lptr, lend, lnew )
217 call bdyadd ( kk, i1,i2, list, lptr, lend, lnew )
219 call covsph ( kk, i1, list, lptr, lend, lnew )
232 io1 = abs( list(lpo1) )
238 call lstptr ( lend(io1), io2, list, lptr, lp )
240 if ( 0 <= list(lp) )
then 243 in1 = abs( list(lp) )
250 call swptst ( in1, kk, io1, io2, x, y, z, output )
251 if ( .not. output )
then 253 if ( lpo1 == lpf .or. list(lpo1) < 0 )
then 259 io1 = abs( list(lpo1) )
264 call swap ( in1, kk, io1, io2, list, lptr, lend, lpo1 )
270 if ( lpo1 /= 0 )
then 281 if ( lpo1 == lpf .or. list(lpo1) < 0 )
then 287 io1 = abs( list(lpo1) )
293 function areas ( v1, v2, v3 )
349 real ( kind_real ) a1
350 real ( kind_real ) a2
351 real ( kind_real ) a3
352 real ( kind_real ) areas 353 real ( kind_real ) ca1
354 real ( kind_real ) ca2
355 real ( kind_real ) ca3
356 real ( kind_real ) dv1(3)
357 real ( kind_real ) dv2(3)
358 real ( kind_real ) dv3(3)
359 real ( kind_real ) s12
360 real ( kind_real ) s23
361 real ( kind_real ) s31
362 real ( kind_real ) u12(3)
363 real ( kind_real ) u23(3)
364 real ( kind_real ) u31(3)
365 real ( kind_real ) v1(3)
366 real ( kind_real ) v2(3)
367 real ( kind_real ) v3(3)
375 u12(1) = dv1(2) * dv2(3) - dv1(3) * dv2(2)
376 u12(2) = dv1(3) * dv2(1) - dv1(1) * dv2(3)
377 u12(3) = dv1(1) * dv2(2) - dv1(2) * dv2(1)
379 u23(1) = dv2(2) * dv3(3) - dv2(3) * dv3(2)
380 u23(2) = dv2(3) * dv3(1) - dv2(1) * dv3(3)
381 u23(3) = dv2(1) * dv3(2) - dv2(2) * dv3(1)
383 u31(1) = dv3(2) * dv1(3) - dv3(3) * dv1(2)
384 u31(2) = dv3(3) * dv1(1) - dv3(1) * dv1(3)
385 u31(3) = dv3(1) * dv1(2) - dv3(2) * dv1(1)
389 s12 = dot_product( u12(1:3), u12(1:3) )
390 s23 = dot_product( u23(1:3), u23(1:3) )
391 s31 = dot_product( u31(1:3), u31(1:3) )
395 if ( .not.(abs(s12)>0.0) .or. .not.(abs(s23)>0.0) .or. .not.(abs(s31)>0.0) )
then 396 areas = 0.0_kind_real
404 u12(1:3) = u12(1:3) / s12
405 u23(1:3) = u23(1:3) / s23
406 u31(1:3) = u31(1:3) / s31
413 ca1 = - dot_product( u12(1:3), u31(1:3) )
414 ca2 = - dot_product( u23(1:3), u12(1:3) )
415 ca3 = - dot_product( u31(1:3), u23(1:3) )
417 ca1 =
max( ca1, -1.0_kind_real )
418 ca1 =
min( ca1, +1.0_kind_real )
419 ca2 =
max( ca2, -1.0_kind_real )
420 ca2 =
min( ca2, +1.0_kind_real )
421 ca3 =
max( ca3, -1.0_kind_real )
422 ca3 =
min( ca3, +1.0_kind_real )
430 areas = a1 + a2 + a3 - acos( -1.0_kind_real )
432 if (
areas < 0.0_kind_real )
then 433 areas = 0.0_kind_real
438 subroutine bdyadd ( kk, i1, i2, list, lptr, lend, lnew )
540 call insert ( k, lp, list, lptr, lnew )
542 if ( next == n2 )
then 555 lptr(lnew) = lnew + 1
561 if ( next == n2 )
then 566 lptr(lnew) = lnew + 1
580 subroutine bnodes ( n, list, lptr, lend, nodes, nb, na, nt )
646 integer list(6*(n-2))
648 integer lptr(6*(n-2))
667 if ( list(lp) < 0 )
then 699 if ( n0 == nst )
then 716 subroutine circum ( v1, v2, v3, c, ier )
769 real (kind_real) c(3)
770 real (kind_real) cnorm
771 real (kind_real) cu(3)
772 real (kind_real) e1(3)
773 real (kind_real) e2(3)
775 real (kind_real) v1(3)
776 real (kind_real) v2(3)
777 real (kind_real) v3(3)
781 e1(1:3) = v2(1:3) - v1(1:3)
782 e2(1:3) = v3(1:3) - v1(1:3)
786 cu(1) = e1(2) * e2(3) - e1(3) * e2(2)
787 cu(2) = e1(3) * e2(1) - e1(1) * e2(3)
788 cu(3) = e1(1) * e2(2) - e1(2) * e2(1)
790 cnorm = sqrt( sum( cu(1:3)**2 ) )
794 if ( .not.(abs(cnorm)>0.0) )
then 799 c(1:3) = cu(1:3) / cnorm
803 subroutine covsph ( kk, n0, list, lptr, lend, lnew )
883 call insert ( k, lp, list, lptr, lnew )
887 if ( next == nst )
then 901 lptr(lnew) = lnew + 1
905 if ( next == nst )
then 916 subroutine det ( x1, y1, z1, x2, y2, z2, x0, y0, z0, output )
929 real ( kind_real ) x1
930 real ( kind_real ) y1
931 real ( kind_real ) z1
932 real ( kind_real ) x2
933 real ( kind_real ) y2
934 real ( kind_real ) z2
935 real ( kind_real ) x0
936 real ( kind_real ) y0
937 real ( kind_real ) z0
938 real ( kind_real ) t1
939 real ( kind_real ) t2
940 real ( kind_real ) t3
941 real ( kind_real ) output
943 t1 = x0*(y1*z2-y2*z1)
944 t2 = y0*(x1*z2-x2*z1)
945 t3 = z0*(x1*y2-x2*y1)
946 output = t1 - t2 + t3
951 subroutine crlist ( n, ncol, x, y, z, list, lend, lptr, lnew, &
952 ltri, listc, nb, xc, yc, zc, rc, ier )
1110 real (kind_real) c(3)
1125 integer list(6*(n-2))
1126 integer listc(6*(n-2))
1131 integer lptr(6*(n-2))
1132 integer ltri(6,ncol)
1142 real (kind_real) rc(2*n-4)
1145 real (kind_real) v1(3)
1146 real (kind_real) v2(3)
1147 real (kind_real) v3(3)
1148 real (kind_real) x(n)
1149 real (kind_real) xc(2*n-4)
1150 real (kind_real) y(n)
1151 real (kind_real) yc(2*n-4)
1152 real (kind_real) z(n)
1153 real (kind_real) zc(2*n-4)
1171 if ( list(lend(n1)) < 0 )
then 1202 if ( nt <= ncol )
then 1215 if ( n2 == n3 )
then 1223 if ( ncol < nt )
then 1246 kt2 = ltri(i3+3,kt1)
1248 if ( kt2 <= kt1 )
then 1258 else if ( i3 == 2 )
then 1272 if ( ltri(4,kt2) == kt1 )
then 1274 else if ( ltri(5,kt2 ) == kt1 )
then 1286 call swptst ( n1, n2, n3, n4, x, y, z, output )
1287 if ( .not. output )
then 1295 kt11 = ltri(i1+3,kt1)
1296 kt12 = ltri(i2+3,kt1)
1301 else if ( i4 == 2 )
then 1309 kt21 = ltri(i1+3,kt2)
1310 kt22 = ltri(i2+3,kt2)
1326 if ( kt11 /= 0 )
then 1328 if ( ltri(4,kt11) /= kt1 )
then 1330 if ( ltri(5,kt11) /= kt1 ) i4 = 6
1335 if ( kt22 /= 0 )
then 1337 if ( ltri(4,kt22) /= kt2 )
then 1339 if ( ltri(5,kt22) /= kt2 )
then 1350 if ( .not. swp )
then 1376 call circum ( v1, v2, v3, c, ierr )
1378 if ( ierr /= 0 )
then 1389 t = dot_product( v1(1:3), c(1:3) )
1390 t =
max( t, -1.0_kind_real )
1391 t =
min( t, +1.0_kind_real )
1422 n3 = abs( list(lp) )
1424 if ( n1 < n2 .and. n1 < n3 )
then 1440 call circum ( v1, v2, v3, c, ierr )
1442 if ( ierr /= 0 )
then 1453 t = dot_product( v1(1:3), c(1:3) )
1454 t =
max( t, -1.0_kind_real )
1455 t =
min( t, +1.0_kind_real )
1463 call lstptr ( lpl, n2, list, lptr, lpn )
1465 call lstptr ( lend(n2), n3, list, lptr, lpn )
1467 call lstptr ( lend(n3), n1, list, lptr, lpn )
1472 if ( lp == lpl )
then 1495 if ( ltri(4,kt1) == 0 )
then 1500 else if ( ltri(5,kt1) == 0 )
then 1505 else if ( ltri(6,kt1) == 0 )
then 1535 kt2 = ltri(i2+3,kt1)
1537 if ( kt2 == 0 )
then 1552 if ( ltri(1,kt1) == n1 )
then 1556 else if ( ltri(2,kt1) == n1 )
then 1577 if ( n1 == n0 )
then 1592 subroutine insert ( k, lp, list, lptr, lnew )
1651 function inside ( p, lv, xv, yv, zv, nv, listv, ier )
1796 real ( kind_real ) b(3)
1797 real ( kind_real ) bp
1798 real ( kind_real ) bq
1799 real ( kind_real ) cn(3)
1800 real ( kind_real ) d
1801 real ( kind_real ),
parameter :: eps = 0.001_kind_real
1816 real ( kind_real ) p(3)
1818 real ( kind_real ) pn(3)
1819 real ( kind_real ) q(3)
1821 real ( kind_real ) qn(3)
1822 real ( kind_real ) qnrm
1823 real ( kind_real ) v1(3)
1824 real ( kind_real ) v2(3)
1825 real ( kind_real ) vn(3)
1826 real ( kind_real ) vnrm
1827 real ( kind_real ) xv(lv)
1828 real ( kind_real ) yv(lv)
1829 real ( kind_real ) zv(lv)
1842 if ( n < 3 .or. imx < n )
then 1852 if ( i1 < 1 .or. imx < i1 )
then 1878 if ( i2 < 1 .or. imx < i2 )
then 1883 vn(1) = yv(i1) * zv(i2) - zv(i1) * yv(i2)
1884 vn(2) = zv(i1) * xv(i2) - xv(i1) * zv(i2)
1885 vn(3) = xv(i1) * yv(i2) - yv(i1) * xv(i2)
1886 vnrm = sqrt( sum( vn(1:3)**2 ) )
1888 if ( .not.(abs(vnrm)>0.0) )
then 1892 q(1) = xv(i1) + xv(i2) + eps * vn(1) / vnrm
1893 q(2) = yv(i1) + yv(i2) + eps * vn(2) / vnrm
1894 q(3) = zv(i1) + zv(i2) + eps * vn(3) / vnrm
1896 qnrm = sqrt( sum( q(1:3)**2 ) )
1904 cn(1) = q(2) * p(3) - q(3) * p(2)
1905 cn(2) = q(3) * p(1) - q(1) * p(3)
1906 cn(3) = q(1) * p(2) - q(2) * p(1)
1908 if ( .not.(abs(cn(1))>0.0) .and. .not.(abs(cn(2))>0.0) .and. .not.(abs(cn(2))>0.0) )
then 1912 pn(1) = p(2) * cn(3) - p(3) * cn(2)
1913 pn(2) = p(3) * cn(1) - p(1) * cn(3)
1914 pn(3) = p(1) * cn(2) - p(2) * cn(1)
1915 qn(1) = cn(2) * q(3) - cn(3) * q(2)
1916 qn(2) = cn(3) * q(1) - cn(1) * q(3)
1917 qn(3) = cn(1) * q(2) - cn(2) * q(1)
1929 if ( i2 < 1 .or. imx < i2 )
then 1934 lft2 = 0.0_kind_real < cn(1) * xv(i2) + cn(2) * yv(i2) + cn(3) * zv(i2)
1944 if ( i2 < 1 .or. imx < i2 )
then 1949 lft2 = ( 0.0_kind_real < cn(1) * xv(i2) + cn(2) * yv(i2) + cn(3) * zv(i2) )
1951 if ( lft1 .eqv. lft2 )
then 1966 call intrsc ( v1, v2, cn, b, ierr )
1972 if ( 0.0_kind_real < dot_product( b(1:3), qn(1:3) ) .and. &
1973 0.0_kind_real < dot_product( b(1:3), pn(1:3) ) )
then 1978 d = dot_product( b(1:3), q(1:3) )
1985 d = dot_product( b(1:3), p(1:3) )
1998 if ( ni /= 2 * ( ni / 2 ) .or. .not. qinr )
then 2004 if ( pinr .neqv. even )
then 2014 subroutine intadd ( kk, i1, i2, i3, list, lptr, lend, lnew )
2094 call lstptr ( lend(n1), n2, list, lptr, lp )
2095 call insert ( k, lp, list, lptr, lnew )
2097 call lstptr ( lend(n2), n3, list, lptr, lp )
2098 call insert ( k, lp, list, lptr, lnew )
2100 call lstptr ( lend(n3), n1, list, lptr, lp )
2101 call insert ( k, lp, list, lptr, lnew )
2108 lptr(lnew) = lnew + 1
2109 lptr(lnew+1) = lnew + 2
2116 subroutine intrsc ( p1, p2, cn, p, ier )
2180 real ( kind_real ) cn(3)
2181 real ( kind_real ) d1
2182 real ( kind_real ) d2
2184 real ( kind_real ) p(3)
2185 real ( kind_real ) p1(3)
2186 real ( kind_real ) p2(3)
2187 real ( kind_real ) pp(3)
2188 real ( kind_real ) ppn
2189 real ( kind_real ) t
2191 d1 = dot_product( cn(1:3), p1(1:3) )
2192 d2 = dot_product( cn(1:3), p2(1:3) )
2194 if ( .not.(abs(d1-d2)>0.0) )
then 2201 t = d1 / ( d1 - d2 )
2203 pp(1:3) = p1(1:3) + t * ( p2(1:3) - p1(1:3) )
2205 ppn = dot_product( pp(1:3), pp(1:3) )
2209 if ( .not.(abs(ppn)>0.0) )
then 2218 p(1:3) = pp(1:3) / ppn
2224 subroutine jrand ( n, ix, iy, iz, output )
2274 real ( kind_real ) u
2275 real ( kind_real ) x
2277 ix = mod( 171 * ix, 30269 )
2278 iy = mod( 172 * iy, 30307 )
2279 iz = mod( 170 * iz, 30323 )
2281 x = (
real ( ix, kind_real ) / 30269.0_kind_real ) &
2282 + (
real ( iy, kind_real ) / 30307.0_kind_real ) &
2283 + (
real ( iz, kind_real ) / 30323.0_kind_real )
2286 output = int(
real ( n, kind_real ) * u ) + 1
2289 end subroutine jrand 2290 subroutine left ( x1, y1, z1, x2, y2, z2, x0, y0, z0, output )
2334 real ( kind_real ) x0
2335 real ( kind_real ) x1
2336 real ( kind_real ) x2
2337 real ( kind_real ) y0
2338 real ( kind_real ) y1
2339 real ( kind_real ) y2
2340 real ( kind_real ) z0
2341 real ( kind_real ) z1
2342 real ( kind_real ) z2
2343 real ( kind_real ) zz
2348 call det ( x1, y1, z1, x2, y2, z2, x0, y0, z0, zz )
2349 output = zz > 0.0_kind_real
2353 subroutine lstptr ( lpl, nb, list, lptr, output )
2418 if ( nd == nb )
then 2424 if ( lp == lpl )
then 2434 function nbcnt ( lpl, lptr )
2498 if ( lp == lpl )
then 2510 function nearnd ( p, ist, n, x, y, z, list, lptr, lend, al )
2606 integer ( kind = 4 ),
parameter :: lmax = 25
2609 real ( kind_real ) al
2610 real ( kind_real ) b1
2611 real ( kind_real ) b2
2612 real ( kind_real ) b3
2613 real ( kind_real ) ds1
2614 real ( kind_real ) dsr
2615 real ( kind_real ) dx1
2616 real ( kind_real ) dx2
2617 real ( kind_real ) dx3
2618 real ( kind_real ) dy1
2619 real ( kind_real ) dy2
2620 real ( kind_real ) dy3
2621 real ( kind_real ) dz1
2622 real ( kind_real ) dz2
2623 real ( kind_real ) dz3
2630 integer list(6*(n-2))
2636 integer lptr(6*(n-2))
2645 real ( kind_real ) p(3)
2646 real ( kind_real ) x(n)
2647 real ( kind_real ) y(n)
2648 real ( kind_real ) z(n)
2663 if ( nst < 1 .or. nn < nst )
then 2670 call trfind ( nst, p, n, x, y, z, list, lptr, lend, b1, b2, b3, i1, i2, i3 )
2714 if ( n1 == i2 .or. lmax <= lp1 )
then 2740 call lstptr ( lend(n1), n2, list, lptr, lp )
2742 if ( 0 <= list(lp) )
then 2745 n3 = abs( list(lp) )
2749 if ( l == lmax )
then 2768 if ( dx3 * ( dy2 * dz1 - dy1 * dz2 ) - &
2769 dy3 * ( dx2 * dz1 - dx1 * dz2 ) + &
2770 dz3 * ( dx2 * dy1 - dx1 * dy2 ) > 0.0_kind_real )
then 2787 if ( lp1 == 1 )
then 2807 dsr = -( x(nr) * p(1) + y(nr) * p(2) + z(nr) * p(3) )
2817 ds1 = -( x(n1) * p(1) + y(n1) * p(2) + z(n1) * p(3) )
2819 if ( ds1 < dsr )
then 2827 dsr =
min( dsr, 1.0_kind_real )
2834 subroutine scoord ( px, py, pz, plat, plon, pnrm )
2876 real(kind_real) plat
2877 real(kind_real) plon
2878 real(kind_real) pnrm
2883 pnrm = sqrt( px * px + py * py + pz * pz )
2885 if ( abs(px)>0.0 .or. abs(py)>0.0 )
then 2886 plon = atan2( py, px )
2891 if ( abs(pnrm)>0.0 )
then 2892 plat = asin( pz / pnrm )
2899 subroutine swap ( in1, in2, io1, io2, list, lptr, lend, lp21 )
2966 call lstptr ( lend(in1), in2, list, lptr, lp )
2968 if ( abs( list(lp) ) == in2 )
then 2975 call lstptr ( lend(io1), in2, list, lptr, lp )
2977 lptr(lp) = lptr(lph)
2981 if ( lend(io1) == lph )
then 2987 call lstptr ( lend(in1), io1, list, lptr, lp )
2995 call lstptr ( lend(io2), in1, list, lptr, lp )
2997 lptr(lp) = lptr(lph)
3001 if ( lend(io2) == lph )
then 3007 call lstptr ( lend(in2), io2, list, lptr, lp )
3016 subroutine swptst ( n1, n2, n3, n4, x, y, z, output )
3071 real ( kind_real ) dx1
3072 real ( kind_real ) dx2
3073 real ( kind_real ) dx3
3074 real ( kind_real ) dy1
3075 real ( kind_real ) dy2
3076 real ( kind_real ) dy3
3077 real ( kind_real ) dz1
3078 real ( kind_real ) dz2
3079 real ( kind_real ) dz3
3085 real ( kind_real ) x(*)
3086 real ( kind_real ) x4
3087 real ( kind_real ) y(*)
3088 real ( kind_real ) y4
3089 real ( kind_real ) z(*)
3090 real ( kind_real ) z4
3091 real ( kind_real ) zz
3111 call det ( dx2, dy2, dz2, dx1, dy1, dz1, dx3, dy3, dz3, zz )
3112 output = zz > 0.0_kind_real
3116 subroutine trans ( n, rlat, rlon, x, y, z )
3170 real ( kind_real ) cosphi
3173 real ( kind_real ) phi
3174 real ( kind_real ) rlat(n)
3175 real ( kind_real ) rlon(n)
3176 real ( kind_real ) theta
3177 real ( kind_real ) x(n)
3178 real ( kind_real ) y(n)
3179 real ( kind_real ) z(n)
3187 x(i) = cosphi * cos( theta )
3188 y(i) = cosphi * sin( theta )
3193 end subroutine trans 3194 subroutine trfind ( nst, p, n, x, y, z, list, lptr, lend, b1, b2, b3, i1, &
3292 real ( kind_real ) b1
3293 real ( kind_real ) b2
3294 real ( kind_real ) b3
3295 real ( kind_real ) output
3296 real ( kind_real ) eps
3300 integer ( kind = 4 ),
save :: ix = 1
3301 integer ( kind = 4 ),
save :: iy = 2
3302 integer ( kind = 4 ),
save :: iz = 3
3304 integer list(6*(n-2))
3306 integer lptr(6*(n-2))
3318 real ( kind_real ) p(3)
3319 real ( kind_real ) ptn1
3320 real ( kind_real ) ptn2
3321 real ( kind_real ) q(3)
3322 real ( kind_real ) s12
3323 real ( kind_real ) tol
3324 real ( kind_real ) x(n)
3325 real ( kind_real ) xp
3326 real ( kind_real ) y(n)
3327 real ( kind_real ) yp
3328 real ( kind_real ) z(n)
3329 real ( kind_real ) zp
3338 if ( n0 < 1 .or. n < n0 )
then 3339 call jrand ( n, ix, iy, iz, n0 )
3344 eps = epsilon( eps )
3345 tol = 100.0_kind_real * eps
3366 call det(x(n0),y(n0),z(n0),x(n1),y(n1),z(n1),xp,yp,zp,output)
3367 if ( output < 0.0_kind_real )
then 3370 if ( n1 == nl )
then 3383 call det(x(n0),y(n0),z(n0),x(nf),y(nf),z(nf), xp,yp,zp,output)
3384 if ( output < 0.0_kind_real )
then 3392 call det(x(nl),y(nl),z(nl),x(n0),y(n0),z(n0),xp,yp,zp,output)
3393 if ( output < 0.0_kind_real )
then 3407 n2 = abs( list(lp) )
3409 call det(x(n0),y(n0),z(n0),x(n2),y(n2),z(n2),xp,yp,zp,output)
3410 if ( output < 0.0_kind_real )
then 3416 if ( n1 /= nl )
then 3420 call det ( x(n0), y(n0), z(n0), x(nf), y(nf), z(nf), xp, yp, zp, output )
3421 if ( output < 0.0_kind_real )
then 3428 if ( abs( x(n0 ) * xp + y(n0) * yp + z(n0) * zp) < 1.0_kind_real - 4.0_kind_real * eps )
then 3436 call det(x(n1),y(n1),z(n1),x(n0),y(n0),z(n0),xp,yp,zp,output)
3437 if ( output < 0.0_kind_real )
then 3442 n1 = abs( list(lp) )
3444 if ( n1 == nl )
then 3480 call det ( x(n1),y(n1),z(n1),x(n2),y(n2),z(n2),xp,yp,zp,b3 )
3482 if ( b3 < 0.0_kind_real )
then 3487 call lstptr ( lend(n2), n1, list, lptr, lp )
3489 if ( list(lp) < 0 )
then 3494 n4 = abs( list(lp) )
3498 call det ( x(n0),y(n0),z(n0),x(n4),y(n4),z(n4),xp,yp,zp,output )
3499 if ( output < 0.0_kind_real )
then 3503 if ( n2 /= n2s .and. n2 /= n0 )
then 3510 if ( n1 /= n1s .and. n1 /= n0 )
then 3519 call jrand ( n, ix, iy, iz, n0 )
3527 if ( .not.(b3 < eps) )
then 3531 call det(x(n2),y(n2),z(n2),x(n3),y(n3),z(n3),xp,yp,zp,b1)
3532 call det(x(n3),y(n3),z(n3),x(n1),y(n1),z(n1),xp,yp,zp,b2)
3536 if ( b1 < -tol .or. b2 < -tol )
then 3537 call jrand ( n, ix, iy, iz, n0 )
3547 s12 = x(n1) * x(n2) + y(n1) * y(n2) + z(n1) * z(n2)
3548 ptn1 = xp * x(n1) + yp * y(n1) + zp * z(n1)
3549 ptn2 = xp * x(n2) + yp * y(n2) + zp * z(n2)
3550 b1 = ptn1 - s12 * ptn2
3551 b2 = ptn2 - s12 * ptn1
3555 if ( b1 < -tol .or. b2 < -tol )
then 3556 call jrand ( n, ix, iy, iz, n0 )
3567 b1 =
max( b1, 0.0_kind_real )
3568 b2 =
max( b2, 0.0_kind_real )
3589 call det(x(n2),y(n2),z(n2),x(next),y(next),z(next),xp,yp,zp,output)
3590 if ( .not.(output < 0.0_kind_real) )
then 3595 s12 = x(n1) * x(n2) + y(n1) * y(n2) + z(n1) * z(n2)
3597 q(1) = x(n1) - s12 * x(n2)
3598 q(2) = y(n1) - s12 * y(n2)
3599 q(3) = z(n1) - s12 * z(n2)
3601 if ( .not.(xp * q(1) + yp * q(2) + zp * q(3) < 0.0_kind_real) )
then 3605 if ( .not.(x(next) * q(1) + y(next) * q(2) + z(next) * q(3) < 0.0_kind_real) )
then 3620 if ( n2 /= n1s )
then 3652 call det ( x(next), y(next), z(next), x(n1), y(n1), z(n1), xp, yp, zp, output )
3653 if ( .not.(output < 0.0_kind_real) )
then 3658 s12 = x(n1) * x(n2) + y(n1) * y(n2) + z(n1) * z(n2)
3659 q(1) = x(n2) - s12 * x(n1)
3660 q(2) = y(n2) - s12 * y(n1)
3661 q(3) = z(n2) - s12 * z(n1)
3663 if ( .not.(xp * q(1) + yp * q(2) + zp * q(3) < 0.0_kind_real) )
then 3667 if ( .not.(x(next) * q(1) + y(next) * q(2) + z(next) * q(3) < 0.0_kind_real) )
then 3682 if ( n1 /= n1s )
then 3709 subroutine trlist ( n, list, lptr, lend, nrow, nt, ltri, ier )
3810 integer list(6*(n-2))
3815 integer lptr(6*(n-2))
3816 integer ltri(nrow,*)
3825 if ( n < 3 .or. ( nrow /= 6 .and. nrow /= 9 ) )
then 3858 n3 = abs( list(lp) )
3860 if ( n2 < n1 .or. n3 < n1 )
then 3879 else if ( i == 2 )
then 3896 if ( list(lp) == i2 )
then 3902 if ( lp == lpl )
then 3911 if ( abs( list(lp) ) /= i2 )
then 3922 if ( list(lp) < 0 )
then 3932 i3 = abs( list(lp) )
3937 if ( i1 < i2 .and. i1 < i3 )
then 3939 else if ( i2 < i3 )
then 3963 if ( ltri(1,kn) == i1 .and. &
3964 ltri(2,kn) == i2 .and. &
3965 ltri(3,kn) == i3 )
then 3998 if ( lp2 /= lpln1 )
then 4009 subroutine trmesh ( mpl, n, x, y, z, list, lptr, lend, lnew, near, next, dist, ier )
4195 real ( kind_real ) d
4196 real ( kind_real ) d1
4197 real ( kind_real ) d2
4198 real ( kind_real ) d3
4199 real ( kind_real ) dist(n)
4205 logical output_1, output_2
4207 integer list(6*(n-2))
4211 integer lptr(6*(n-2))
4216 real ( kind_real ) x(n)
4217 real ( kind_real ) y(n)
4218 real ( kind_real ) z(n)
4224 write ( *,
'(a)' )
' ' 4225 write ( *,
'(a)' )
'TRMESH - Fatal error!' 4226 write ( *,
'(a)' )
' N < 3.' 4227 call mpl%abort(
'stop in stripack')
4238 call left (x(1),y(1),z(1),x(2),y(2),z(2),x(3),y(3),z(3),output_1)
4239 call left (x(2),y(2),z(2),x(1),y(1),z(1),x(3),y(3),z(3),output_2)
4241 if ( .not. output_1 )
then 4263 else if ( .not. output_2 )
then 4291 write ( *,
'(a)' )
' ' 4292 write ( *,
'(a)' )
'TRMESH - Fatal error!' 4293 write ( *,
'(a)' )
' The first 3 nodes are collinear.' 4294 write ( *,
'(a)' )
' Try reordering the data.' 4295 call mpl%abort(
'stop in stripack')
4340 d1 = -( x(k) * x(1) + y(k) * y(1) + z(k) * z(1) )
4341 d2 = -( x(k) * x(2) + y(k) * y(2) + z(k) * z(2) )
4342 d3 = -( x(k) * x(3) + y(k) * y(3) + z(k) * z(3) )
4344 if (
inf(d1,d2) .and.
inf(d1,d3) )
then 4349 else if (
inf(d2,d1) .and.
inf(d2,d3) )
then 4366 call addnod ( mpl, near(k), k, x, y, z, list, lptr, lend, lnew, ier )
4368 if ( ier /= 0 )
then 4369 write ( *,
'(a)' )
' ' 4370 write ( *,
'(a)' )
'TRMESH - Fatal error!' 4371 write ( *,
'(a,i8)' )
' ADDNOD returned error code IER = ', ier
4372 call mpl%abort(
'stop in stripack')
4380 if ( near(i) == k )
then 4434 d = - ( x(i) * x(k) + y(i) * y(k) + z(i) * z(k) )
4435 if (
inf(d,dist(i)) )
then 4444 if ( i == near(j) )
then 4462 if ( lp /= lpl )
then
integer, parameter, public kind_real