subroutine output_BasicState( &
  & cfileName, cptr_RhoBasic, cptr_PressBasic &
  & )

  ! モジュール引用 ; Use statements
  !

  use, intrinsic :: iso_c_binding

  !* gtool *************************
  !*
  
	use dc_types, only: &
		& STRING
	
  use gtool_history, only: &
    & HistoryCreate, &
    & HistoryAddVariable, HistoryPut

  use dc_string, only: &
    & StoA

  !* IGMBaseLib *************************
  !*

  use Field_Grid1D_Manager, only: &
    & Field_Grid1D, &
    & get_field1D_name, get_long_field1D_name, &
    & get_field1D_units
	
	use CBinding_Utility, only: &
		& c_f_string

  ! 宣言文 ; Declaration statements
  !
  implicit none

  character(len=1, kind=c_char), intent(in) :: cfileName(*)
  type(c_ptr), value :: cptr_RhoBasic
  type(c_ptr), value :: cptr_PressBasic

	! 作業変数
	! Work variables
	!
  character(STRING) :: fileName
  
  type :: Field1DList
  	type(Field_Grid1D), pointer :: ptr	
  end type Field1DList

  type(Field1DList) :: list(2)
  type(Field_Grid1D), pointer :: ptr_RhoBasic	
  type(Field_Grid1D), pointer :: ptr_PressBasic	

  integer :: gridSize, fieldID

	! 実行文 ; Executable statements
	!

  call c_f_pointer(cptr_RhoBasic, ptr_RhoBasic)
  call c_f_pointer(cptr_PressBasic, ptr_PressBasic)
	call c_f_string(cfileName, fileName)
	
	list(1)%ptr => ptr_RhoBasic
	list(2)%ptr => ptr_PressBasic
	
  gridSize = size(list(1)%ptr%grid1D)

  call HistoryCreate( &
    & file=fileName, title='Basic State of field', &
    & source=' ', institution='GFD Dennou Club IGModel Project', &
    & dims=StoA('z'), dimsizes=(/ gridSize /), &
    & longnames=StoA('altitude'), &
    & units=StoA('m') )

  call HistoryPut('z', list(1)%ptr%grid1D(1:gridSize))

  do fieldID=1,2

    call HistoryAddvariable( &
      & varname=get_field1D_name(list(fieldID)%ptr), &
      & dims=StoA('z'), &
      & longname=get_long_field1D_name(list(fieldID)%ptr), &
      & units=get_field1D_units(list(fieldID)%ptr), xtype='double' &
      & )

    call HistoryPut( &
      & get_field1D_name(list(fieldID)%ptr),  &
      & list(fieldID)%ptr%val(1:gridSize, 1)  &
      & )

  end do

end subroutine output_BasicState
