subroutine IcGrid2D_FVM_new( &
  & cptr, &
  & glevel, ic_radius, mpi_flag &
  & ) bind(C, name='IcGrid2D_FVM_new')

  use, intrinsic :: iso_c_binding

  use dc_types, only: DP

  use IcGrid2D_FVM_Manager, only: &
    & IcGrid2D_FVM, IcGrid2D_FVM_Init

  use CBinding_Utility, only: c_f_logical

  implicit none
  type(c_ptr), intent(out) :: cptr
  integer(c_int), value :: glevel
  real(DP), value :: ic_radius
  logical(c_bool), value :: mpi_flag

  type(IcGrid2D_FVM), pointer :: ptr

  allocate(ptr)
  call IcGrid2D_FVM_Init(ptr, glevel, ic_radius, c_f_logical(mpi_flag))

  cptr = c_loc(ptr)

end subroutine IcGrid2D_FVM_new

subroutine IcGrid2D_FVM_del( &
  & cptr &
  & ) bind(C, name='IcGrid2D_FVM_del')

  use, intrinsic :: iso_c_binding

  use IcGrid2D_FVM_Manager, only: &
    & IcGrid2D_FVM, IcGrid2D_FVM_Final

  use dc_types, only: DP

  implicit none
  type(c_ptr), intent(inout) :: cptr

  type(IcGrid2D_FVM), pointer :: ptr

  call c_f_pointer(cptr, ptr)
  call IcGrid2D_FVM_Final(ptr)
  deallocate(ptr)

  cptr = c_null_ptr

end subroutine IcGrid2D_FVM_del

subroutine IcGrid2D_FVM_malloc_CV_array( &
  & cptr &
  & ) bind(C, name='IcGrid2D_FVM_malloc_CV_array')

  use, intrinsic :: iso_c_binding

  use IcGrid2D_FVM_Manager, only: &
    & IcGrid2D_FVM, malloc_CV_array

  implicit none
  type(c_ptr), value :: cptr
  type(IcGrid2D_FVM), pointer :: ptr

  call c_f_pointer(cptr, ptr)
  call malloc_CV_array(ptr)

end subroutine IcGrid2D_FVM_malloc_CV_array

subroutine IcGrid2D_FVM_malloc_GP_array( &
  & cptr &
  & ) bind(C, name='IcGrid2D_FVM_malloc_GP_array')

  use, intrinsic :: iso_c_binding

  use IcGrid2D_FVM_Manager, only: &
    & IcGrid2D_FVM, malloc_GP_array

  implicit none
  type(c_ptr), value :: cptr

  type(IcGrid2D_FVM), pointer :: ptr

  call c_f_pointer(cptr, ptr)
  call malloc_GP_array(ptr)

end subroutine IcGrid2D_FVM_malloc_GP_array

function IcGrid2D_FVM_get_glevel( &
  & cptr &
  & ) result(glevel) bind(C, name='IcGrid2D_FVM_get_glevel')

  use, intrinsic :: iso_c_binding

  use IcGrid2D_FVM_Manager, only: &
    & IcGrid2D_FVM, get_glevel

  implicit none
  type(c_ptr), value :: cptr
  integer(c_int) :: glevel

  type(IcGrid2D_FVM), pointer :: ptr

  call c_f_pointer(cptr, ptr)
  glevel = get_glevel(ptr)

end function IcGrid2D_FVM_get_glevel

function IcGrid2D_FVM_get_IcRadius( &
  & cptr &
  & ) result(ic_radius) bind(C, name='IcGrid2D_FVM_get_IcRadius')

  use, intrinsic :: iso_c_binding

  use IcGrid2D_FVM_Manager, only: &
    & IcGrid2D_FVM, get_IcRadius

  use dc_types, only: DP

  implicit none
  type(c_ptr), value :: cptr
  real(DP) :: ic_radius

  type(IcGrid2D_FVM), pointer :: ptr

  call c_f_pointer(cptr, ptr)
  ic_radius = get_IcRadius(ptr)

end function IcGrid2D_FVM_get_IcRadius

function IcGrid2D_FVM_get_IdMin( &
  & cptr &
  & ) result(idMin) bind(C, name='IcGrid2D_FVM_get_IdMin')

  use, intrinsic :: iso_c_binding

  use IcGrid2D_FVM_Manager, only: &
    & IcGrid2D_FVM, get_IdMin

  implicit none
  type(c_ptr), value :: cptr
  integer(c_int) :: idMin

  type(IcGrid2D_FVM), pointer :: ptr

  call c_f_pointer(cptr, ptr)
  idMin = get_IdMin(ptr)

end function IcGrid2D_FVM_get_IdMin

function IcGrid2D_FVM_get_IdMax( &
  & cptr &
  & ) result(idMax) bind(C, name='IcGrid2D_FVM_get_IdMax')

  use, intrinsic :: iso_c_binding

  use IcGrid2D_FVM_Manager, only: &
    & IcGrid2D_FVM, get_IdMax

  implicit none

  type(c_ptr), value :: cptr
  integer(c_int) :: idMax

  type(IcGrid2D_FVM), pointer :: ptr

  call c_f_pointer(cptr, ptr)
  idMax = get_IdMax(ptr)

end function IcGrid2D_FVM_get_IdMax

function IcGrid2D_FVM_get_EffSize_Min( &
  & cptr &
  & ) result(EMin) bind(C, name='IcGrid2D_FVM_get_EffSize_Min')

  use, intrinsic :: iso_c_binding

  use IcGrid2D_FVM_Manager, only: &
    & IcGrid2D_FVM, get_EffSize_Min

  implicit none
  type(c_ptr), value :: cptr
  integer(c_int) :: EMin

  type(IcGrid2D_FVM), pointer :: ptr

  call c_f_pointer(cptr, ptr)
  EMin = get_EffSize_Min(ptr)

end function IcGrid2D_FVM_get_EffSize_Min


function IcGrid2D_FVM_get_EffSize_Max( &
  & cptr &
  & ) result(EMax) bind(C, name='IcGrid2D_FVM_get_EffSize_Max')

  use, intrinsic :: iso_c_binding

  use IcGrid2D_FVM_Manager, only: &
    & IcGrid2D_FVM, get_EffSize_Max

  implicit none
  type(c_ptr), value :: cptr
  integer(c_int) ::  EMax

  type(IcGrid2D_FVM), pointer :: ptr

  call c_f_pointer(cptr, ptr)
  EMax = get_EffSize_Max(ptr)

end function IcGrid2D_FVM_get_EffSize_Max

function IcGrid2D_FVM_get_IcGridMeanInterval( &
  & cptr &
  & ) result(gridMeanInterval) bind(C, name='IcGrid2D_FVM_get_IcGridMeanInterval')

  use, intrinsic :: iso_c_binding

  use IcGrid2D_FVM_Manager, only: &
    & IcGrid2D_FVM, get_IcGridMeanInterval

  implicit none
  type(c_ptr), value :: cptr
  integer(c_int) ::  gridMeanInterval

  type(IcGrid2D_FVM), pointer :: ptr

  call c_f_pointer(cptr, ptr)
  gridMeanInterval = get_IcGridMeanInterval(ptr)

end function IcGrid2D_FVM_get_IcGridMeanInterval
