WSJT-X/lib/plotsave.f90
Joe Taylor 9381a13388 Deallocate the sw array on program exit.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@8417 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2018-01-17 17:56:01 +00:00

35 lines
709 B
Fortran

subroutine plotsave(swide,nw,nh,irow)
real, dimension(:,:), allocatable :: sw
real swide(0:nw-1)
data nw0/-1/,nh0/-1/
save nw0,nh0,sw
if(irow.eq.-99) then
if(allocated(sw)) deallocate(sw)
return
endif
if(nw.ne.nw0 .or. nh.ne.nh0) then
if(nw0.ne.-1) deallocate(sw)
allocate(sw(0:nw-1,0:nh-1))
sw=0.
nw0=nw
nh0=nh
endif
df=12000.0/16384
if(irow.lt.0) then
! Push a new row of data into sw
do j=nh-1,1,-1
sw(0:nw-1,j)=sw(0:nw-1,j-1)
enddo
sw(0:nw-1,0)=swide
else
! Return the saved "irow" as swide(), for a waterfall replot.
swide=sw(0:nw-1,irow)
endif
return
end subroutine plotsave