c c Copyright (C) 2003-2007 California Institute of Technology c Ralf Deiterding, ralf@amroc.net c c ===================================================== double precision function distseg(x0,y0,vnx,vny,vl, & x,y,ifac) c ===================================================== implicit double precision (a-h,o-z) c x1 = x0-vl*vny y1 = y0+vl*vnx distseg = 1.d37 if (-vny*(x-x0)+vnx*(y-y0).ge.0.d0.and. & vny*(x-x1)-vnx*(y-y1).ge.0.d0) & distseg = ifac*(vnx*(x-x0) + vny*(y-y0)) return end c c ===================================================== double precision function distarc(x0,y0,vnx1,vny1, & vnx2,vny2,vr,x,y,ifac) c ===================================================== implicit double precision (a-h,o-z) c distarc = 1.d37 x1 = x-x0 y1 = y-y0 if (vnx1*x1+vny1*y1.ge.0.d0.and.vnx2*x1+vny2*y1.ge.0.d0) & distarc = ifac*(dsqrt(x1*x1+y1*y1) - vr) return end c c Signed distance for the wedges. c c ===================================================== subroutine ls(maxmx,maxmy,mbc,mx,my,x,y,dx,dy,phi,t) c ===================================================== implicit double precision (a-h,o-z) c include "cuser.i" c dimension phi(1-mbc:maxmx+mbc, 1-mbc:maxmy+mbc) dimension x(1-mbc:maxmx+mbc),y(1-mbc:maxmy+mbc) c do 60 i = 1-mbc, mx+mbc do 60 j = 1-mbc, my+mbc phi(i,j) = 1.d37 do n = 1, Nsegs phih = distseg(xs(1,n),xs(2,n), & vns(1,n),vns(2,n),vls(n),x(i),y(j),ifs(n)) if (dabs(phih).lt.dabs(phi(i,j))) phi(i,j) = phih enddo do n = 1, Narcs phih = distarc(xa(1,n),xa(2,n),vna(1,1,n),vna(2,1,n), & vna(1,2,n),vna(2,2,n),vra(n),x(i),y(j),ifa(n)) if (dabs(phih).lt.dabs(phi(i,j))) phi(i,j) = phih enddo 60 continue c return end c