bsplProfile_antiderivative Function

public function bsplProfile_antiderivative(sf) result(antideriv)

get the exact spline antiderivative, with respect to rho2 the knotspan is increased by an extra multiplicity on both ends, and the new coefficients are computed as beta(i) = beta(i-1) + alpha(i)*(t(i+degree+1)-t(i))/(degree+1) From deBoor, "A practical guide to Splines", p.128

Type Bound

t_rProfile_bspl

Arguments

Type IntentOptional Attributes Name
class(t_rProfile_bspl), intent(in) :: sf

self

Return Value class(c_rProfile), ALLOCATABLE


Source Code

  FUNCTION bsplProfile_antiderivative(sf) RESULT(antideriv)
  ! MODULES
  !-----------------------------------------------------------------------------------------------------------------------------------
  ! INPUT VARIABLES
    CLASS(t_rProfile_bspl), INTENT(IN)  :: sf !! self
  !-----------------------------------------------------------------------------------------------------------------------------------
  ! OUTPUT VARIABLES
    CLASS(c_rProfile),ALLOCATABLE :: antideriv
  !-----------------------------------------------------------------------------------------------------------------------------------
  ! LOCAL VARIABLES
    REAL(wp) :: coefs(sf%n_coefs+1), knots(sf%n_knots+2), intermid
    INTEGER :: i, n_coefs, n_knots, deg
  !===================================================================================================================================
    coefs = 0.0_wp
    knots = -42.0_wp

    n_coefs = sf%n_coefs+1
    n_knots = sf%n_knots+2
    deg = sf%deg+1
    ! increase multiplicity at the edges
    knots(2:n_knots-1) = sf%knots
    knots(1) = sf%knots(1)
    knots(n_knots) = sf%knots(sf%n_knots)

    DO i=1,sf%n_coefs
      intermid = sf%coefs(i)*(sf%knots(i+deg)-sf%knots(i))/deg
      coefs(i+1) = coefs(i) + intermid
    END DO
    antideriv = t_rProfile_bspl(knots,  coefs)
  END FUNCTION bsplProfile_antiderivative