sll_m_bsplines_base.F90 Source File


This file depends on

sourcefile~~sll_m_bsplines_base.f90~~EfferentGraph sourcefile~sll_m_bsplines_base.f90 sll_m_bsplines_base.F90 sourcefile~sll_m_assert.f90 sll_m_assert.F90 sourcefile~sll_m_bsplines_base.f90->sourcefile~sll_m_assert.f90 sourcefile~sll_m_working_precision.f90 sll_m_working_precision.F90 sourcefile~sll_m_bsplines_base.f90->sourcefile~sll_m_working_precision.f90 sourcefile~globals.f90 globals.F90 sourcefile~sll_m_assert.f90->sourcefile~globals.f90

Files dependent on this one

sourcefile~~sll_m_bsplines_base.f90~~AfferentGraph sourcefile~sll_m_bsplines_base.f90 sll_m_bsplines_base.F90 sourcefile~sll_m_bsplines.f90 sll_m_bsplines.F90 sourcefile~sll_m_bsplines.f90->sourcefile~sll_m_bsplines_base.f90 sourcefile~sll_m_bsplines_non_uniform.f90 sll_m_bsplines_non_uniform.F90 sourcefile~sll_m_bsplines.f90->sourcefile~sll_m_bsplines_non_uniform.f90 sourcefile~sll_m_bsplines_uniform.f90 sll_m_bsplines_uniform.F90 sourcefile~sll_m_bsplines.f90->sourcefile~sll_m_bsplines_uniform.f90 sourcefile~sll_m_bsplines_non_uniform.f90->sourcefile~sll_m_bsplines_base.f90 sourcefile~sll_m_bsplines_uniform.f90->sourcefile~sll_m_bsplines_base.f90 sourcefile~sll_m_spline_1d.f90 sll_m_spline_1d.F90 sourcefile~sll_m_spline_1d.f90->sourcefile~sll_m_bsplines_base.f90 sourcefile~sll_m_spline_interpolator_1d.f90 sll_m_spline_interpolator_1d.F90 sourcefile~sll_m_spline_interpolator_1d.f90->sourcefile~sll_m_bsplines_base.f90 sourcefile~sll_m_spline_interpolator_1d.f90->sourcefile~sll_m_spline_1d.f90 sourcefile~cubic_spline.f90 cubic_spline.F90 sourcefile~cubic_spline.f90->sourcefile~sll_m_bsplines.f90 sourcefile~rprofile_bspline.f90 rprofile_bspline.F90 sourcefile~rprofile_bspline.f90->sourcefile~sll_m_bsplines.f90 sourcefile~sbase.f90 sbase.F90 sourcefile~sbase.f90->sourcefile~sll_m_bsplines.f90 sourcefile~sbase.f90->sourcefile~sll_m_spline_interpolator_1d.f90 sourcefile~analyze.f90 analyze.F90 sourcefile~analyze.f90->sourcefile~cubic_spline.f90 sourcefile~vmec.f90 vmec.F90 sourcefile~analyze.f90->sourcefile~vmec.f90 sourcefile~vmec_readin.f90 vmec_readin.F90 sourcefile~analyze.f90->sourcefile~vmec_readin.f90 sourcefile~vmec_vars.f90 vmec_vars.F90 sourcefile~analyze.f90->sourcefile~vmec_vars.f90 sourcefile~mhd3d_vars.f90 mhd3d_vars.F90 sourcefile~analyze.f90->sourcefile~mhd3d_vars.f90 sourcefile~base.f90 base.F90 sourcefile~base.f90->sourcefile~sbase.f90 sourcefile~mhd3d.f90 mhd3d.F90 sourcefile~mhd3d.f90->sourcefile~cubic_spline.f90 sourcefile~mhd3d.f90->sourcefile~rprofile_bspline.f90 sourcefile~mhd3d.f90->sourcefile~analyze.f90 sourcefile~mhd3d.f90->sourcefile~base.f90 sourcefile~mhd3d.f90->sourcefile~vmec.f90 sourcefile~mhd3d.f90->sourcefile~vmec_readin.f90 sourcefile~mhd3d.f90->sourcefile~vmec_vars.f90 sourcefile~lambda_solve.f90 lambda_solve.F90 sourcefile~mhd3d.f90->sourcefile~lambda_solve.f90 sourcefile~mhd3d_evalfunc.f90 mhd3d_evalfunc.F90 sourcefile~mhd3d.f90->sourcefile~mhd3d_evalfunc.f90 sourcefile~mhd3d_minimize.f90 mhd3d_minimize.F90 sourcefile~mhd3d.f90->sourcefile~mhd3d_minimize.f90 sourcefile~mhd3d.f90->sourcefile~mhd3d_vars.f90 sourcefile~restart.f90 restart.F90 sourcefile~mhd3d.f90->sourcefile~restart.f90 sourcefile~readstate.f90 readstate.F90 sourcefile~readstate.f90->sourcefile~sbase.f90 sourcefile~readstate.f90->sourcefile~base.f90 sourcefile~readstate_vars.f90 readstate_vars.F90 sourcefile~readstate.f90->sourcefile~readstate_vars.f90 sourcefile~readstate_vars.f90->sourcefile~sbase.f90 sourcefile~readstate_vars.f90->sourcefile~base.f90 sourcefile~vmec.f90->sourcefile~cubic_spline.f90 sourcefile~vmec.f90->sourcefile~rprofile_bspline.f90 sourcefile~vmec.f90->sourcefile~vmec_readin.f90 sourcefile~vmec.f90->sourcefile~vmec_vars.f90 sourcefile~vmec_readin.f90->sourcefile~cubic_spline.f90 sourcefile~vmec_vars.f90->sourcefile~cubic_spline.f90 sourcefile~gvec_post.f90 gvec_post.F90 sourcefile~gvec_post.f90->sourcefile~analyze.f90 sourcefile~gvec_post.f90->sourcefile~mhd3d.f90 sourcefile~gvec_post.f90->sourcefile~readstate_vars.f90 sourcefile~gvec_post.f90->sourcefile~mhd3d_evalfunc.f90 sourcefile~gvec_post.f90->sourcefile~restart.f90 sourcefile~gvec_to_jorek.f90 gvec_to_jorek.F90 sourcefile~gvec_to_jorek.f90->sourcefile~base.f90 sourcefile~gvec_to_jorek.f90->sourcefile~readstate.f90 sourcefile~gvec_to_jorek.f90->sourcefile~readstate_vars.f90 sourcefile~gvec_to_jorek_vars.f90 gvec_to_jorek_vars.F90 sourcefile~gvec_to_jorek.f90->sourcefile~gvec_to_jorek_vars.f90 sourcefile~gvec_to_jorek_vars.f90->sourcefile~base.f90 sourcefile~lambda_solve.f90->sourcefile~base.f90 sourcefile~mhd3d_evalfunc.f90->sourcefile~base.f90 sourcefile~mhd3d_evalfunc.f90->sourcefile~mhd3d_vars.f90 sourcefile~mhd3d_minimize.f90->sourcefile~analyze.f90 sourcefile~mhd3d_minimize.f90->sourcefile~mhd3d_evalfunc.f90 sourcefile~mhd3d_minimize.f90->sourcefile~restart.f90 sourcefile~mhd3d_vars.f90->sourcefile~base.f90 sourcefile~restart.f90->sourcefile~base.f90 sourcefile~restart.f90->sourcefile~readstate.f90 sourcefile~restart.f90->sourcefile~readstate_vars.f90 sourcefile~restart.f90->sourcefile~mhd3d_evalfunc.f90 sourcefile~restart.f90->sourcefile~mhd3d_vars.f90 sourcefile~run.f90 run.F90 sourcefile~run.f90->sourcefile~analyze.f90 sourcefile~run.f90->sourcefile~restart.f90 sourcefile~rungvec.f90 rungvec.F90 sourcefile~run.f90->sourcefile~rungvec.f90 sourcefile~rungvec.f90->sourcefile~analyze.f90 sourcefile~rungvec.f90->sourcefile~mhd3d.f90 sourcefile~rungvec.f90->sourcefile~restart.f90 sourcefile~sfl_boozer.f90 sfl_boozer.F90 sourcefile~sfl_boozer.f90->sourcefile~base.f90 sourcefile~sfl_boozer.f90->sourcefile~lambda_solve.f90 sourcefile~state.f90 state.F90 sourcefile~state.f90->sourcefile~analyze.f90 sourcefile~state.f90->sourcefile~base.f90 sourcefile~state.f90->sourcefile~mhd3d.f90 sourcefile~state.f90->sourcefile~readstate_vars.f90 sourcefile~state.f90->sourcefile~mhd3d_vars.f90 sourcefile~state.f90->sourcefile~restart.f90 sourcefile~state.f90->sourcefile~sfl_boozer.f90 sourcefile~transform_sfl.f90 transform_sfl.F90 sourcefile~state.f90->sourcefile~transform_sfl.f90 sourcefile~transform_sfl.f90->sourcefile~base.f90 sourcefile~transform_sfl.f90->sourcefile~sfl_boozer.f90 sourcefile~convert_gvec_to_jorek.f90 convert_gvec_to_jorek.F90 sourcefile~convert_gvec_to_jorek.f90->sourcefile~gvec_to_jorek.f90 sourcefile~gvec.f90 gvec.F90 sourcefile~gvec.f90->sourcefile~rungvec.f90 sourcefile~gvec_to_castor3d_vars.f90 gvec_to_castor3d_vars.F90 sourcefile~gvec_to_castor3d_vars.f90->sourcefile~transform_sfl.f90 sourcefile~gvec_to_gene_vars.f90 gvec_to_gene_vars.F90 sourcefile~gvec_to_gene_vars.f90->sourcefile~transform_sfl.f90 sourcefile~gvec_to_hopr_vars.f90 gvec_to_hopr_vars.F90 sourcefile~gvec_to_hopr_vars.f90->sourcefile~transform_sfl.f90

Source Code

! Copyright (c) INRIA
! License: CECILL-B
!
!> @ingroup splines
!> @brief   Abstract class for B-splines of arbitrary degree
!> @author  Yaman Güçlü  - IPP Garching
!> @author  Edoardo Zoni - IPP Garching

module sll_m_bsplines_base
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#include "sll_assert.h"

  use sll_m_working_precision, only: f64

  implicit none

  public :: &
    sll_c_bsplines

  private
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

  !> Working precision
  integer, parameter :: wp = f64

  !> Abstract type, B-splines
  type, abstract :: sll_c_bsplines

    integer :: degree
    logical :: periodic
    logical :: uniform
    integer :: ncells
    integer :: nbasis
    integer :: offset

    real(wp) :: xmin
    real(wp) :: xmax

    real(wp), allocatable :: knots(:) ! Only used by non-uniform B-splines

  contains
    procedure(i_fun_find_cell              ), deferred :: find_cell
    procedure(i_sub_eval_basis             ), deferred :: eval_basis
    procedure(i_sub_eval_deriv             ), deferred :: eval_deriv
    procedure(i_sub_eval_basis_and_n_derivs), deferred :: eval_basis_and_n_derivs
    procedure(i_sub_free                   ), deferred :: free

  end type sll_c_bsplines

  abstract interface

    !---------------------------------------------------------------------------
    !> @brief     Find which grid cell contains the given point
    !> @param[in] self  B-splines object
    !> @param[in] x     point of interest
    !> results          cell index
    !---------------------------------------------------------------------------
    SLL_PURE function i_fun_find_cell( self, x ) result( icell )
     import sll_c_bsplines, wp
      class(sll_c_bsplines), intent(in) :: self
      real(wp)             , intent(in) :: x
      integer :: icell
    end function i_fun_find_cell

    !---------------------------------------------------------------------------
    !> Evaluate value at x of all basis functions with support in local cell
    !> values[j] = B_j(x) for jmin <= j <= jmin+degree
    !>
    !> @param[in]  self    B-splines object
    !> @param[in]  x       evaluation point
    !> @param[out] values  array of B-splines' values
    !> @param[out] jmin    index of first non-zero B-spline
    !---------------------------------------------------------------------------
    SLL_PURE subroutine i_sub_eval_basis( self, x, values, jmin )
     import sll_c_bsplines, wp
      class(sll_c_bsplines), intent(in   ) :: self
      real(wp)             , intent(in   ) :: x
      real(wp)             , intent(  out) :: values(:)
      integer              , intent(  out) :: jmin
    end subroutine i_sub_eval_basis

    !---------------------------------------------------------------------------
    !> Evaluate derivative at x of all basis functions with support in local cell
    !> derivs[j] = B_j'(x) for jmin <= j <= jmin+degree
    !>
    !> @param[in]  self    B-splines object
    !> @param[in]  x       evaluation point
    !> @param[out] derivs  array of B-splines' derivatives
    !> @param[out] jmin    index of first non-zero B-spline
    !---------------------------------------------------------------------------
    SLL_PURE subroutine i_sub_eval_deriv( self, x, derivs, jmin )
     import sll_c_bsplines, wp
      class(sll_c_bsplines), intent(in   ) :: self
      real(wp)             , intent(in   ) :: x
      real(wp)             , intent(  out) :: derivs(:)
      integer              , intent(  out) :: jmin
    end subroutine i_sub_eval_deriv

    !---------------------------------------------------------------------------
    !> Evaluate value and n derivatives at x of all basis functions with support in local cell
    !> derivs[i,j] = (d/dx)^i B_j(x) for 0 <= i <= n and jmin <= j <= jmin+degree
    !>
    !> @param[in]  self    B-splines object
    !> @param[in]  x       evaluation point
    !> @param[in]  n       number of required derivatives
    !> @param[out] derivs  array of B-splines' (multiple) derivatives
    !> @param[out] jmin    index of first non-zero B-spline
    !---------------------------------------------------------------------------
    SLL_PURE subroutine i_sub_eval_basis_and_n_derivs( self, x, n, derivs, jmin )
     import sll_c_bsplines, wp
      class(sll_c_bsplines), intent(in   ) :: self
      real(wp)             , intent(in   ) :: x
      integer              , intent(in   ) :: n
      real(wp)             , intent(  out) :: derivs(:,:)
      integer              , intent(  out) :: jmin
    end subroutine i_sub_eval_basis_and_n_derivs

    !---------------------------------------------------------------------------
    !> @brief        Free storage
    !> @param[inout] self  B-splines object
    !---------------------------------------------------------------------------
    subroutine i_sub_free( self )
     import sll_c_bsplines
      class(sll_c_bsplines), intent(inout) :: self
    end subroutine i_sub_free

  end interface

end module sll_m_bsplines_base