program OWspline
use sep 
use OW_type
use OW_parms_areal
use base_spline_mod
use solver_tiny_mod

implicit none

real, allocatable                             :: velint(:)
double precision, allocatable                 :: vel(:),vel0(:)
integer                                       :: stat

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 call sep_init()
 call sep_begin_prog()
 call owparam()
 stat = base_spln2d_init(v%xm,v%z,axk,azk)
 allocate(velint(v%z%n*v%xm%n));velint=0
 allocate(vel(v%xm%n*v%z%n));vel=dble(0.)
 allocate(vel0(axk%n*azk%n));vel0=dble(0.)
!    stat = base_spln3d_init(img%xm,img%ym,img%z,axk,ayk,azk)
call sreed("vel",velint,v%z%n*v%xm%n*4)
stat = base_spln2d_oper(.true. , .false., vel0, dble(velint))
stat = base_spln2d_oper(.false. ,.false., vel0, vel)
call to_history("n1",v%xm%n,"vspl"); call to_history("d1",v%xm%d,"vspl"); call to_history("o1",v%xm%o,"vspl")  
call to_history("n2",1,"vspl") ; call to_history("d2",1.,"vspl") ; call to_history("o2",0.,"vspl")
call to_history("n3",v%z%n,"vspl") ; call to_history("d3",v%z%d,"vspl") ; call to_history("o3",v%z%o,"vspl")
call to_history("n4",1,"vspl"); call to_history("d4",1,"vspl"); call to_history("o4",0,"vspl")
call to_history("n5",1,"vspl"); call to_history("d5",1,"vspl"); call to_history("o5",0,"vspl")  
call to_history("esize",4,"vspl")
call srite("vspl",sngl(vel),4*v%z%n*v%xm%n)
if (allocated(vel)) deallocate(vel)
if (allocated(velint)) deallocate(velint)
if (allocated(vel0)) deallocate(vel0)
call sep_end_prog()
end program 
