subroutine Derivate_Field_IcGrid2D_new( &
  & cptr, cptr_icgrid2d &
  & ) bind(C, name='Derivate_Field_IcGrid2D_new')

  use, intrinsic :: iso_c_binding

  use Derivate_Field_IcGrid2D_Manager, only: &
    & Derivate_Field_IcGrid2D, Derivate_Field_IcGrid2D_Init

  use IcGrid2D_FVM_Manager, only: &
    & IcGrid2D_FVM

  implicit none
  type(c_ptr), intent(out) :: cptr
  type(c_ptr), value :: cptr_icgrid2d

  type(Derivate_Field_IcGrid2D), pointer :: ptr
  type(IcGrid2D_FVM), pointer :: ptr_icgrid2d

  call c_f_pointer(cptr_icgrid2d, ptr_icgrid2d)

  allocate(ptr)
  call Derivate_Field_IcGrid2D_Init(ptr, ptr_icgrid2d)

  cptr = c_loc(ptr)

end subroutine Derivate_Field_IcGrid2D_new

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

  use, intrinsic :: iso_c_binding

  use Derivate_Field_IcGrid2D_Manager, only: &
    & Derivate_Field_IcGrid2D, Derivate_Field_IcGrid2D_Final

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

  type(Derivate_Field_IcGrid2D), pointer :: ptr

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

  cptr = c_null_ptr

end subroutine Derivate_Field_IcGrid2D_del

subroutine Derivate_Field_IcGrid2D_divergence_op( &
  & cptr, cptr_vec_field, cptr_ret_div_field &
  & )  bind(C, name='Derivate_Field_IcGrid2D_divergence_op')

  use, intrinsic :: iso_c_binding

  use Derivate_Field_IcGrid2D_Manager, only: &
    & Derivate_Field_IcGrid2D, divergence_op

  use Field_IcGrid2D_Manager, only: &
    & Field_IcGrid2D

  implicit none

  type(c_ptr), value :: cptr
  type(c_ptr), value :: cptr_vec_field
  type(c_ptr), value :: cptr_ret_div_field

  type(Derivate_Field_IcGrid2D), pointer :: ptr
  type(Field_IcGrid2D), pointer :: ptr_vec_field
  type(Field_IcGrid2D), pointer :: ptr_ret_div_field

  call c_f_pointer(cptr, ptr)
  call c_f_pointer(cptr_vec_field, ptr_vec_field)
  call c_f_pointer(cptr_ret_div_field, ptr_ret_div_field)

  call divergence_op(ptr, ptr_vec_field, ptr_ret_div_field)

end subroutine Derivate_Field_IcGrid2D_divergence_op

subroutine Derivate_Field_IcGrid2D_gradient_op( &
  & cptr, cptr_scalar_field, cptr_ret_vector_field &
  & )  bind(C, name='Derivate_Field_IcGrid2D_gradient_op')

  use, intrinsic :: iso_c_binding

  use Derivate_Field_IcGrid2D_Manager, only: &
    & Derivate_Field_IcGrid2D, divergence_op

  use Field_IcGrid2D_Manager, only: &
    & Field_IcGrid2D

  implicit none

  type(c_ptr), value :: cptr
  type(c_ptr), value :: cptr_scalar_field
  type(c_ptr), value :: cptr_ret_vector_field

  type(Derivate_Field_IcGrid2D), pointer :: ptr
  type(Field_IcGrid2D), pointer :: ptr_scalar_field
  type(Field_IcGrid2D), pointer :: ptr_ret_vector_field

  call c_f_pointer(cptr, ptr)
  call c_f_pointer(cptr_scalar_field, ptr_scalar_field)
  call c_f_pointer(cptr_ret_vector_field, ptr_ret_vector_field)

  call divergence_op(ptr, ptr_scalar_field, ptr_ret_vector_field)

end subroutine Derivate_Field_IcGrid2D_gradient_op

subroutine Derivate_Field_IcGrid2D_vertical_curl_op( &
  & cptr, cptr_vec_field, cptr_ret_scalar_field &
  & ) bind(C, name='Derivate_Field_IcGrid2D_vertical_curl_op')

  use, intrinsic :: iso_c_binding

  use Derivate_Field_IcGrid2D_Manager, only: &
    & Derivate_Field_IcGrid2D, vertical_curl_op

  use Field_IcGrid2D_Manager, only: &
    & Field_IcGrid2D

  implicit none

  type(c_ptr), value :: cptr
  type(c_ptr), value :: cptr_vec_field
  type(c_ptr), value :: cptr_ret_scalar_field

  type(Derivate_Field_IcGrid2D), pointer :: ptr
  type(Field_IcGrid2D), pointer :: ptr_vec_field
  type(Field_IcGrid2D), pointer :: ptr_ret_scalar_field

  call c_f_pointer(cptr, ptr)
  call c_f_pointer(cptr_vec_field, ptr_vec_field)
  call c_f_pointer(cptr_ret_scalar_field, ptr_ret_scalar_field)

  call vertical_curl_op(ptr, ptr_vec_field, ptr_ret_scalar_field)

end subroutine Derivate_Field_IcGrid2D_vertical_curl_op
