!= Program RandomSet
!
! Authors:: KITAMORI Taichi, ODAKA Masatsugu, SUGIYAMA Ko-ichiro
! Version: $Id: randomset_3d.f90,v 1.1 2007-10-01 08:51:49 odakker Exp $
! Tag Name: $Name:  $
! Copyright:: Copyright (C) GFD Dennou Club, 2006. All rights reserved.
! License::   See COPYRIGHT[link:../../COPYRIGHT]
!
!== Overview
!
!荵ｱ謨ｰ繝輔ぃ繧､繝ｫ繧堤函謌舌☆繧九◆繧√�繝｡繧､繝ｳ繝励Ο繧ｰ繝ｩ繝�
!
!== Error Handling
!
!== Known Bugs
!
!== Note
!
!== Future Plans
!
!

program randomset
  !
  !荵ｱ謨ｰ繝輔ぃ繧､繝ｫ繧堤函謌舌☆繧九◆繧√�繝｡繧､繝ｳ繝励Ο繧ｰ繝ｩ繝�
  !

  !繝｢繧ｸ繝･繝ｼ繝ｫ縺ｮ隱ｭ縺ｿ霎ｼ縺ｿ
  use gridset_3d, only: gridset_init,  & ! 蛻晄悄蛹悶Ν繝ｼ繝√Φ
       &             DimXMax, DimXMin, & ! X 譁ｹ蜷代�驟榊�隕∫ｴ�謨ｰ
       &             DimYMax, DimYMin    ! X 譁ｹ蜷代�驟榊�隕∫ｴ�謨ｰ

  !證鈴ｻ吶�蝙句ｮ｣險遖∵ｭ｢
  implicit none

  !螟画焚螳夂ｾｩ
  real(8)        :: random      ! 荵ｱ謨ｰ
  integer        :: i,j         ! 繝ｫ繝ｼ繝怜､画焚
  character(8)   :: Today       ! 譌･莉�
  character(17)  :: RandomFile  ! 荵ｱ謨ｰ繝輔ぃ繧､繝ｫ縺ｮ蜷榊燕
  character(80)  :: cfgfile

  ! I/O 繝輔ぃ繧､繝ｫ蜷阪�蛻晄悄蛹�
  !   蠑墓焚縺ｫ謖�ｮ壹＠縺� NAMELIST 繝輔ぃ繧､繝ｫ蜷阪ｒ蜿門ｾ励☆繧�.
  call getarg( 1, cfgfile )
  write(*,*) "Input NAMELIST file: ", cfgfile

  !譬ｼ蟄千せ諠��ｱ縺ｮ蛻晄悄蛹�
  !  NAMELIST 縺九ｉ諠��ｱ繧貞ｾ励※, 譬ｼ蟄千せ繧定ｨ育ｮ励☆繧�
  call gridset_init(cfgfile)

  call date_and_time(date = Today)

  RandomFile = "rand-" // Today // ".dat"

  open(10,file=RandomFile)

  do j = DimYMin, DimYMax
    do i = DimXMin, DimXMax
      call random_number(random)
      write(10,*) random
    end do
  end do

  close(10)

end program randomset