29 subroutine fast_fit(mpl,n,iz,dist,raw,fit_r)
35 integer,
intent(in) :: n
36 integer,
intent(in) :: iz
37 real(kind_real),
intent(in) :: dist(n)
38 real(kind_real),
intent(in) :: raw(n)
39 real(kind_real),
intent(out) :: fit_r
42 integer :: di,i,im,
ip,iter
43 real(kind_real) :: th,thinv,dthinv,thtest
44 real(kind_real) :: fit_rm,fit_rp
45 real(kind_real) :: raw_tmp(n)
48 if (any(dist<0.0))
call mpl%abort(
'negative distance in fast_fit')
57 if (
inf(raw(i),raw(iz))) raw_tmp(i) = raw(i)
65 if (raw_tmp(i)>0.0) valid = .true.
71 if (
inf(minval(raw_tmp/raw_tmp(iz),mask=(raw_tmp>0.0)),0.5_kind_real))
then 74 thinv = 0.33827292796125663
77 th = minval(raw_tmp/raw_tmp(iz),mask=(raw_tmp>0.0))+1.0e-6
83 thtest =
gc99(mpl,thinv)
84 if (
sup(th,thtest))
then 98 if (
ismsr(fit_rm))
then 105 if (raw_tmp(im)>0.0)
then 107 if (
inf(raw_tmp(im),th*raw_tmp(iz)))
then 109 fit_rm = dist(im)+(dist(
ip)-dist(im))*(th*raw_tmp(iz)-raw_tmp(im))/(raw_tmp(
ip)-raw_tmp(im))
124 if (
ismsr(fit_rp))
then 131 if (raw_tmp(
ip)>0.0)
then 133 if (
inf(raw_tmp(
ip),th*raw_tmp(iz)))
then 135 fit_rp = dist(im)+(dist(
ip)-dist(im))*(th*raw_tmp(iz)-raw_tmp(im))/(raw_tmp(
ip)-raw_tmp(im))
147 fit_r = 0.5*(fit_rm+fit_rp)
155 if (
isnotmsr(fit_r)) fit_r = fit_r/thinv
158 if (
inf(fit_r,0.0_kind_real))
then 159 call mpl%warning(
'negative fit_r in fast_fit')
187 integer,
intent(in) :: n
188 real(kind_real),
intent(in) :: x(n)
189 real(kind_real),
intent(in) :: rv
190 real(kind_real),
intent(inout) :: profile(n)
194 real(kind_real) :: kernel(n,n),distnorm,profile_init(n),norm
196 if (rv<0.0)
call mpl%abort(
'negative filtering support radius in ver_smooth')
205 distnorm = abs(x(j)-x(i))/rv
206 kernel(i,j) =
gc99(mpl,distnorm)
212 profile_init = profile
217 profile(i) = profile(i)+kernel(i,j)*profile_init(j)
218 norm = norm+kernel(i,j)
221 profile(i) = profile(i)/norm
234 subroutine ver_fill(mpl,n,x,profile)
240 integer,
intent(in) :: n
241 real(kind_real),
intent(in) :: x(n)
242 real(kind_real),
intent(inout) :: profile(n)
245 integer :: i,j,iinf,isup
246 real(kind_real) :: profile_init(n)
250 profile_init = profile
261 do while ((j<=n).and.(
ismsi(isup)))
262 if (
isnotmsr(profile_init(j))) isup = j
268 profile(i) = profile_init(iinf)+(x(i)-x(iinf))*(profile_init(isup)-profile_init(iinf))/(x(isup)-x(iinf))
271 profile(i) = profile(isup)
274 profile(i) = profile(iinf)
276 call mpl%abort(
'ver_fill failed')
integer, parameter, public ip
integer, parameter, public kind_real