subroutine set_field_data(cptr_field)

  ! Use statements
  !
  use, intrinsic :: iso_c_binding

  use dc_types, only: DP

  use igmcore_math, only: &
    & toRadians

  use IcGrid2D_FVM_Manager, only: &
    & IcGrid2D_FVM, &
    & get_IcRadius


  use Field_IcGrid2D_Manager, only: &
    & Field_IcGrid2D, &
    & get_icgrid

  use Field_Pattern_Builder, only: &
    & create_cosine_bell_field

  implicit none

  ! Declaration statements
  !
  type(c_ptr), value :: cptr_field

  ! Work variables
  !
  !
  type(Field_IcGrid2D), pointer :: ptr_field
  real(DP) :: ic_radius

  ! Executable statements
  !

  call c_f_pointer(cptr_field, ptr_field)
  ic_radius = get_IcRadius(get_icgrid(ptr_field))

  call create_cosine_bell_field( &
    & ptr_field, toRadians(0.0d0), toRadians(0.0d0), &
    & ic_radius / 3.0d0, 1000d0 &
    & )

end subroutine set_field_data

function compare_field_data( &
  & cptr_fieldA, cptr_fieldB &
  & ) result(ret)

  ! Use statements
  !
  use, intrinsic :: iso_c_binding

  use dc_types, only: DP

  use IcGrid2D_FVM_Manager, only: &
    & IcGrid2D_FVM, &
    & get_LocalProcRectInfo

  ! 正二十面格子における広域矩形領域のサブドメインである局所矩形領域(各 MPI プロセスと対応)の情報管理
  ! Manager of information about a local rectangle region (corresponding to each MPI process)
  !
  use LocalProcRect_Manager, only: &
    & LocalProcRectInfo, &
    & get_InteriorRegion_IndexInfo

  use Field_IcGrid2D_Manager, only: &
    & Field_IcGrid2D, &
    & get_icgrid

  implicit none

  ! Declaration statements
  !
  type(c_ptr), value :: cptr_fieldA
  type(c_ptr), value :: cptr_fieldB
  logical(c_bool) :: ret

  ! Work variables
  !
  !
  type(Field_IcGrid2D), pointer :: fieldA, fieldB
  type(IcGrid2D_FVM), pointer :: icgrid2D

  integer :: iEMin, iEMax, jEMin, jEMax, rcIDMin, rcIDMax
  type(LocalProcRectInfo), pointer :: lcRCInfo

  integer :: rcID, i, j

  ! Executable statements
  !


  call c_f_pointer(cptr_fieldA, fieldA)
  call c_f_pointer(cptr_fieldB, fieldB)

  icgrid2D => get_icgrid(fieldA)
  lcRCInfo => get_LocalProcRectInfo(icgrid2D)

  call get_InteriorRegion_IndexInfo( &
    & lcRCInfo,            &                         ! (in)
    & iEMin, iEMax, jEMin, jEMax, rcIDMin, rcIDMax ) ! (out)
	
  do rcID=rcIDMin, rcIDMax
    do j=jEMin, jEMax
      do i=iEMin, iEMax
        if( fieldA%val(1, i,j,rcID) /= fieldB%val(1, i,j,rcID) ) then
          write(*,*) '(rcID,i,j)=', rcID, i,j
          write(*,*) 'fieldA=', fieldA%val(1, i,j,rcID), 'fieldB=', fieldB%val(1, i,j,rcID)
          ret = .false.
          return
        end if
      end do
    end do
  end do

  ret = .true.

end function compare_field_data
