2424! **************************************************************************************************
2525module fitpack_curves_c
2626 use fitpack_curves, only: fitpack_curve
27- use fitpack_core, only: FP_SIZE, FP_REAL, FP_FLAG, FP_BOOL
27+ use fitpack_core, only: FP_SIZE, FP_REAL, FP_FLAG, FP_BOOL, &
28+ OUTSIDE_EXTRAPOLATE, OUTSIDE_ZERO, OUTSIDE_NOT_ALLOWED, OUTSIDE_NEAREST_BND
2829 use , intrinsic :: iso_c_binding
2930 implicit none
3031 private
@@ -48,6 +49,8 @@ module fitpack_curves_c
4849 public :: fitpack_curve_c_smoothing
4950 public :: fitpack_curve_c_mse
5051 public :: fitpack_curve_c_degree
52+ public :: fitpack_curve_c_set_bc
53+ public :: fitpack_curve_c_get_bc
5154
5255 ! > Opaque-pointer C derived type
5356 type, public , bind(C) :: fitpack_curve_c
@@ -358,5 +361,36 @@ integer(FP_SIZE) function fitpack_curve_c_degree(this) bind(c,name='fitpack_curv
358361
359362 end function fitpack_curve_c_degree
360363
364+ ! > Set spline behavior outside the support
365+ subroutine fitpack_curve_c_set_bc (this , bc ) bind(c,name= ' fitpack_curve_c_set_bc' )
366+ type (fitpack_curve_c), intent (inout ) :: this
367+ integer (FP_FLAG), intent (in ), value :: bc
368+
369+ type (fitpack_curve), pointer :: fcurve
370+
371+ ! > Get object; allocate it in case
372+ call fitpack_curve_c_pointer(this,fcurve)
373+
374+ ! > Validate extrapolation behavior value
375+ if (bc /= OUTSIDE_EXTRAPOLATE .and. bc /= OUTSIDE_ZERO .and. &
376+ bc /= OUTSIDE_NOT_ALLOWED .and. bc /= OUTSIDE_NEAREST_BND) return
377+
378+ fcurve% bc = bc
379+
380+ end subroutine fitpack_curve_c_set_bc
381+
382+ ! > Get spline behavior outside the support
383+ integer (FP_FLAG) function fitpack_curve_c_get_bc(this) bind(c,name= ' fitpack_curve_c_get_bc' )
384+ type (fitpack_curve_c), intent (inout ) :: this
385+
386+ type (fitpack_curve), pointer :: fcurve
387+
388+ ! > Get object; allocate it in case
389+ call fitpack_curve_c_pointer(this,fcurve)
390+
391+ fitpack_curve_c_get_bc = fcurve% bc
392+
393+ end function fitpack_curve_c_get_bc
394+
361395
362396end module fitpack_curves_c
0 commit comments