bsplProfile_new Function

public function bsplProfile_new(knots, coefs) result(sf)

initialize the rProfile of type bspline

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: knots(:)

knots of the B-Spline with repeated start and end points

real(kind=wp), intent(in) :: coefs(:)

B-Spline coefficients

Return Value type(t_rProfile_bspl)

self


Calls

proc~~bsplprofile_new~~CallsGraph proc~bsplprofile_new bsplProfile_new proc~sll_s_bsplines_new sll_s_bsplines_new proc~bsplprofile_new->proc~sll_s_bsplines_new init init proc~sll_s_bsplines_new->init

Called by

proc~~bsplprofile_new~~CalledByGraph proc~bsplprofile_new bsplProfile_new interface~t_rprofile_bspl t_rProfile_bspl interface~t_rprofile_bspl->proc~bsplprofile_new

Source Code

  FUNCTION bsplProfile_new(knots,  coefs) RESULT(sf)
    ! INPUT VARIABLES -------------------------!
    REAL(wp),    INTENT(IN) :: knots(:)  !! knots of the B-Spline with repeated start and end points
    REAL(wp),    INTENT(IN) :: coefs(:)  !! B-Spline coefficients
    ! OUTPUT VARIABLES -------------------------!
    TYPE(t_rProfile_bspl) :: sf !! self
    ! LOCAL VARIABLES -------------------------!
    INTEGER :: n_knots, n_coefs
    ! CODE --------------------------------------------------------------------------------------------------------------------------!
    n_knots=SIZE(knots)
    n_coefs=SIZE(coefs)
    sf%deg   = COUNT((ABS(knots-knots(1)).LE.1E-12))-1 ! multiplicity of the first knot determines the degree
    IF(COUNT((ABS(knots-knots(n_knots)).LE.1E-12)).NE.sf%deg+1) THEN
      CALL abort(__STAMP__, &
                 "The Bspline knot sequence need the same multiplicity at the beginning and end (=degree+1).")
    END IF
    IF (n_coefs .NE. n_knots-sf%deg-1) THEN
      CALL abort(__STAMP__, &
                 "Number of Bspline coeffcients must be number of knots - (degree+1)!")
    END IF
    sf%n_knots = n_knots
    sf%n_coefs = n_coefs
    ALLOCATE(sf%knots(1:n_knots), sf%coefs(1:n_coefs))
    sf%knots = knots
    sf%coefs = coefs
    IF (sf%deg>0) THEN
      CALL sll_s_bsplines_new(sf%bspl, sf%deg, .FALSE., &
                              sf%knots(1),sf%knots(n_knots),&
                              size(sf%knots(sf%deg+1:n_knots-sf%deg))-1 , & ! number of knots handed to the library
                              sf%knots(sf%deg+1:n_knots-sf%deg)) ! remove repeated edge knots
    END IF
  END FUNCTION bsplProfile_new