subroutine splitpoly0(npts,mcause0,iseq0,jcause, x mpts,mcause,iseq,iotmsg) c split a polygon (with causeways) into two subpolygons c input: c number of segments in input polygon 1 integer npts c causeway id of segment ii integer mcause0(1) c input array - segment positions of polygon including causeways integer iseq0(1) c id of causeway to remove (normally 1) integer jcause c no of pts in subpolygons 1 and 2 integer mpts(1) c output array - causeway ids of subpolygons integer mcause(900,1) c output array - segment positions of subpolygons integer iseq(900,1) c logical unit of output integer iotmsg c following statement merely avoids annoying message in compilation ijunk=iotmsg c detach polygon associated with causeway jcause c first causeway segment not yet found ifound=0 c second causeway segment not yet found ifinish=0 c pts in subpolygon 1 iused=0 c pts in subpolygon 2 iremain=0 c initially ii=npts,...1 do 1722 ii=1,npts c collect consecutive segments between the two c segments of causeway jcause, provided a different c causeway does not intervene if ((ifound.eq.0.or.ifinish.ne.0) x .and.mcause0(ii).ne.jcause) then c ordinary segment not in subpolygon 1 c add to subpolygon 2 iremain=iremain+1 mpts(2)=iremain iseq(iremain,2)=iseq0(ii) mcause(iremain,2)=mcause0(ii) else if (mcause0(ii).eq.jcause.and.ifound.eq.0) then c 0th segment of subpolygon 1 ifound=1 mpts(1)=0 else if (ifound.ne.0.and.ifinish.eq.0 x .and.mcause0(ii).ne.jcause) then c ordinary segment in subpolygon 1 iused=iused+1 mpts(1)=iused iseq(iused,1)=iseq0(ii) mcause(iused,1)=mcause0(ii) else if (mcause0(ii).eq.jcause.and.ifound.ne.0 x .and.ifinish.eq.0) then c last+1 segment of subpolygon 1 ifinish=1 else c should never happen endif c end of point loop ii 1722 continue c write(iotmsg,200) c write(iotmsg,200) npts c write(iotmsg,200) (iseq0(kk),kk=1,npts) c write(iotmsg,200) (mcause0(kk),kk=1,npts) c write(iotmsg,200) (iseq(kk,1), kk=1,iused) c write(iotmsg,200) (mcause(kk,1),kk=1,iused) c write(iotmsg,200) (iseq(kk,2), kk=1,iremain) c write(iotmsg,200) (mcause(kk,2),kk=1,iremain) 200 format (1x,'0',25i3) return end