evaluate the n-th derivative of the bsplProfile at position s
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(t_cubspl), | intent(in) | :: | sf |
self |
||
| real(kind=wp), | intent(in) | :: | xpos(:) |
position |
||
| integer, | intent(in) | :: | deriv |
derivative (=0: no derivative) |
FUNCTION cubspl_eval( sf, xpos, deriv ) RESULT(y) ! MODULES !----------------------------------------------------------------------------------------------------------------------------------- ! INPUT VARIABLES CLASS(t_cubspl), INTENT(IN) :: sf !! self REAL(wp) , INTENT(IN) :: xpos(:) !! position INTEGER , INTENT(IN) :: deriv !! derivative (=0: no derivative) !----------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES REAL(wp) :: y(size(xpos)) !----------------------------------------------------------------------------------------------------------------------------------- ! LOCAL VARIABLES REAL(wp) :: deriv_values(0:deriv,0:sf%bspl%degree) !! values of the (deg+1) B-splines that contribute at s_pos INTEGER :: i,first_non_zero_bspl !! index offset for the coefficients !=================================================================================================================================== IF(deriv.EQ.0)THEN DO i=1,size(xpos) CALL sf%bspl%eval_basis(xpos(i),deriv_values(0,0:sf%bspl%degree),first_non_zero_bspl) y(i) = SUM(sf%coefs(first_non_zero_bspl:first_non_zero_bspl+sf%bspl%degree)*deriv_values(0,0:sf%bspl%degree)) END DO ELSEIF(deriv.LE.sf%bspl%degree) THEN DO i=1,size(xpos) CALL sf%bspl%eval_basis_and_n_derivs(xpos(i),deriv,deriv_values,first_non_zero_bspl) y(i) = SUM(sf%coefs(first_non_zero_bspl:first_non_zero_bspl+sf%bspl%degree)*deriv_values(deriv,0:sf%bspl%degree)) END DO ELSE y = 0.0_wp END IF END FUNCTION cubspl_eval