Class namelist_util
In: setup/namelist_util.f90

NAMELIST ���¡ã�¤ã���¥å�����¢ã�������¼ã���£ã������

Utilities for NAMELIST file input

Note that Japanese and English are described in parallel.

Variables List

namelist_filename :NAMELIST ���¡ã�¤ã������ç§�.
MaxNmlArySize :NAMELIST ����読�込����������大���.
———— :————
namelist_filename :NAMELIST file name
MaxNmlArySize :Maximum size of arrays loaded from NAMELIST

Procedures List

NmlutilInit :NAMELIST ���¡ã�¤ã������¨­å®�
NmlutilMsg :NAMELIST ���¡ã�¤ã���¥å�����¢ã�����¡ã���»ã�¼ã�¸è¡¨ç¤�
NmlutilAryValid :NAMELIST ���¡ã�¤ã������読ã�¿è¾¼�������������¹æ�§ã�����§ã����
———— :————
NmlutilInit :Settings of NAMELIST file name
NmlutilMsg :Print messages about NAMELIST file input
NmlutilAryValid :Check validation of arrays loaded from NAMELIST file

Methods

Included Modules

dc_types dc_message dc_iounit

Public Instance methods

MaxNmlArySize
Constant :
MaxNmlArySize = 256 :integer, parameter, public
: NAMELIST ����読�込����������大���. Maximum size of arrays loaded from NAMELIST
Subroutine :
name :character(*), intent(in)
: �����µã�����¼ã���³ã���¼ã�³å�ºã���¢ã�¸ã�¥ã�¼ã������ç§�. Module name calling this subroutine
array(:) :real(DP), intent(in)
: æ¤�証ã���¹ã���������¼ã��. Checked array data
array_name :character(*), intent(in)
: æ¤�証ã���¹ã���������¼ã�¿ã������. Name of checked array data
need_num :integer, intent(in)
: å¿�è¦������¼ã�¿æ��. 0 ������°ã��ä¸������������¼ã�������¾ã��.

Number of needed data. If number less than 0, an error is occurred.

need_num_name :character(*), intent(in)
: å¿�è¦������¼ã�¿æ�°ã��示ã��å¤��°ã������. Name of a variable that indicates number of needed data
valid_limit :real(DP), intent(in), optional
: ���¹ä����� (������������ 0.0). Lower limit of validation (defalt is 0.0)

NAMELIST ����読ã�¿è¾¼�������������¼ã�¿ã��¦¥å½��§ã�� ���§ã�������¾ã��.

�����������§ã��, æ­£ã���¤ã�����¹ã���±ã���¾ã��. �¡å�¹ã�§ã�������証ã�������´å������, �����¼ã���ºç�������¾ã��.

Check validation of array data loaded from NAMELIST.

By defaut, positive values are treated as valid values. If invalidation is checked, an error is occurred.

[Source]

  subroutine NmlutilAryValid( name, array, array_name, need_num, need_num_name, valid_limit )
    !
    ! NAMELIST ����読ã�¿è¾¼�������������¼ã�¿ã��¦¥å½��§ã��
    ! ���§ã�������¾ã��. 
    ! 
    ! �����������§ã��, æ­£ã���¤ã�����¹ã���±ã���¾ã��. 
    ! �¡å�¹ã�§ã�������証ã�������´å������, �����¼ã���ºç�������¾ã��. 
    ! 
    ! Check validation of array data loaded from NAMELIST. 
    !
    ! By defaut, positive values are treated as valid values.
    ! If invalidation is checked, an error is occurred. 
    ! 

    ! �¢ã�¸ã�¥ã�¼ã����� ; USE statements
    !

    ! ç¨��¥å�������¡ã��
    ! Kind type parameter
    !
    use dc_types, only: DP      ! ��精度å®��°å��. Double precision. 

    ! 宣�� ; Declaration statements
    !
    implicit none
    character(*), intent(in):: name
                              ! �����µã�����¼ã���³ã���¼ã�³å�ºã���¢ã�¸ã�¥ã�¼ã������ç§�. 
                              ! Module name calling this subroutine
    real(DP), intent(in):: array(:)
                              ! æ¤�証ã���¹ã���������¼ã��. 
                              ! Checked array data 
    character(*), intent(in):: array_name
                              ! æ¤�証ã���¹ã���������¼ã�¿ã������. 
                              ! Name of checked array data 
    integer, intent(in):: need_num
                              ! å¿�è¦������¼ã�¿æ��. 
                              ! 0 ������°ã��ä¸������������¼ã�������¾ã��. 
                              ! 
                              ! Number of needed data. 
                              ! If number less than 0, an error is occurred. 
    character(*), intent(in):: need_num_name
                              ! å¿�è¦������¼ã�¿æ�°ã��示ã��å¤��°ã������. 
                              ! Name of a variable that indicates number of needed data
    real(DP), intent(in), optional:: valid_limit
                              ! ���¹ä����� (������������ 0.0). 
                              ! Lower limit of validation (defalt is 0.0) 

    ! �業��
    ! Work variables
    !
    real(DP):: valid_limit_work
                              ! ���¹ä����� (������������ 0.0). 
                              ! Lower limit of validation (defalt is 0.0) 
    integer:: valid_count     ! �������¼ã�¿ã�����¹å�¤ã����. 
                              ! Number of valid values in an array
    integer:: size_array      ! �������¼ã�¿ã���µã�¤ã��
                              ! Size of array data

    ! ���� ; Executable statement
    !

    ! need_num ��è²��§ã���������������§ã����
    ! Check that "need_num" is not negative 
    !
    if ( need_num < 0 ) then
      call MessageNotify( 'E', name, '%c=<%d> must not be negative.', c1 = trim(need_num_name), i = (/ need_num /) )
    end if

    ! array ���µã�¤ã�ºã�������§ã�������������§ã����
    ! Check that size of "array" is enough
    !
    size_array = size(array)
    if ( need_num > size_array ) then
      call MessageNotify( 'E', name, 'Maximum size=<%d> of "%c" is too smaller than %c=<%d>. ' // 'Please search for a statement "MaxNmlArySize = %d" in ' // '"namelist_util.f90", and change it into "MaxNmlArySize = %d".', i = (/ size_array, need_num, MaxNmlArySize, need_num /), c1 = trim(array_name), c2 = trim(need_num_name) )
    end if

    ! array �����§ã����
    ! Check "array"
    !
    if ( need_num > 0 ) then
      valid_limit_work = 0.0_DP
      if ( present( valid_limit ) ) valid_limit_work = valid_limit

      if ( any( array(1:need_num) < valid_limit_work ) ) then
        valid_count = count( .not. ( array(1:need_num) < valid_limit_work ) )
        if ( valid_count > 0 ) then
          call MessageNotify( 'E', name, 'Number of valid data of %c=<%*f> is %d. ' // 'Valid data is %c=<%d> necessary.', c1 = trim( array_name ), c2 = trim( need_num_name ), d = array(1:valid_count), n = (/ valid_count /), i = (/ valid_count, need_num /) )
        else
          call MessageNotify( 'E', name, 'Valid data of %c is nothing. ' // 'Valid data is %c=<%d> necessary.', c1 = trim( array_name ), c2 = trim( need_num_name ), i = (/ need_num /) )
        end if
      end if
    end if

  end subroutine NmlutilAryValid
Subroutine :
namelist_filename_in :character(*), intent(in )
: NAMELIST ���¡ã�¤ã������ç§�. NAMELIST file name

namelist_util �¢ã�¸ã�¥ã�¼ã��������設å���è¡����¾ã��.

Initialize "namelist_util" module.

[Source]

  subroutine NmlutilInit( namelist_filename_in )
    !
    ! namelist_util �¢ã�¸ã�¥ã�¼ã��������設å���è¡����¾ã��. 
    !
    ! Initialize "namelist_util" module. 
    !

    ! �¢ã�¸ã�¥ã�¼ã����� ; USE statements
    !

    ! ���¡ã�¤ã���¥å�ºå��è£���
    ! File I/O support
    !
    use dc_iounit, only: FileOpen

    ! 宣�� ; Declaration statements
    !
    implicit none

    character(*), intent(in ) :: namelist_filename_in
                              ! NAMELIST ���¡ã�¤ã������ç§�. 
                              ! NAMELIST file name

!!$    integer:: unit_nml        ! NAMELIST ���¡ã�¤ã�����¼ã���³ç���ç½����. 
!!$                              ! Unit number for NAMELIST file open
!!$    integer:: iostat_nml      ! NAMELIST 読ã�¿è¾¼�¿æ���� IOSTAT. 
!!$                              ! IOSTAT of NAMELIST read

    ! ���� ; Executable statement
    !

    if ( namelist_util_inited ) return
    namelist_filename = namelist_filename_in

    ! NAMELIST ����¿è¾¼��
    ! NAMELIST is input
    !
!!$    call FileOpen( unit_nml, &          ! (out)
!!$      & namelist_filename, mode = 'r' ) ! (in)
!!$
!!$    rewind( unit_nml )
!!$    read( unit_nml, &               ! (in)
!!$      & nml = namelist_util_nml, &  ! (out)
!!$      & iostat = iostat_nml )       ! (out)
!!$    close( unit_nml )
!!$
!!$    call NmlutilMsg( iostat_nml, module_name ) ! (in)

    ! �°å� ; Print
    !
    call MessageNotify( 'M', module_name, '----- Initialization Messages -----' )
    call MessageNotify( 'M', module_name, '  MaxNmlArySize = %d', i = (/ MaxNmlArySize /) )
    call MessageNotify( 'M', module_name, '-- version = %c', c1 = trim(version) )

    namelist_util_inited = .true.
  end subroutine NmlutilInit
Subroutine :
iostat :integer, intent(in)
: NAMELIST 読ã�¿è¾¼�¿æ�����¹ã���¼ã�¿ã��. Status of NAMELIST loading
name :character(*), intent(in)
: �¢ã�¸ã�¥ã�¼ã������ç§�. Module name

NAMELIST ���¡ã�¤ã���¥å���¹ã���¼ã�¿ã�¹ã���� �������¡ã���»ã�¼ã�¸ã��è¡�¤º���¾ã��.

Appropriate messages are output from status of NAMELIST file loading.

[Source]

  subroutine NmlutilMsg( iostat, name )
    !
    ! NAMELIST ���¡ã�¤ã���¥å���¹ã���¼ã�¿ã�¹ã����
    ! �������¡ã���»ã�¼ã�¸ã��è¡�¤º���¾ã��. 
    !
    ! Appropriate messages are output from 
    ! status of NAMELIST file loading. 
    !

    implicit none
    integer, intent(in):: iostat
                              ! NAMELIST 読ã�¿è¾¼�¿æ�����¹ã���¼ã�¿ã��. 
                              ! Status of NAMELIST loading
    character(*), intent(in):: name
                              ! �¢ã�¸ã�¥ã�¼ã������ç§�. 
                              ! Module name

    ! ���� ; Executable statement
    !

    if ( iostat == 0 ) then
      call MessageNotify( 'M', name, 'NAMELIST group "%c" is loaded from "%c".', c1 = trim(name) // '_nml', c2 = trim(namelist_filename) )
    else if ( iostat > 0 ) then
      call MessageNotify( 'E', name, 'NAMELIST group "%c" has something wrong in "%c" (iostat=%d).', c1 = trim(name) // '_nml', c2 = trim(namelist_filename), i = (/iostat/) )
    else
      call MessageNotify( 'W', name, 'NAMELIST group "%c" is not found in "%c" (iostat=%d).', c1 = trim(name) // '_nml', c2 = trim(namelist_filename), i = (/iostat/) )
    end if

  end subroutine NmlutilMsg
namelist_filename
Variable :
namelist_filename = ’’ :character(STRING), save, public
: NAMELIST ���¡ã�¤ã������ç§�. NAMELIST file name
namelist_util_inited
Variable :
namelist_util_inited = .false. :logical, save, public
: ����設������. Initialization flag

Private Instance methods

module_name
Constant :
module_name = ‘namelist_util :character(*), parameter
: �¢ã�¸ã�¥ã�¼ã������ç§�. Module name
version
Constant :
version = ’$Name: $’ // ’$Id: namelist_util.f90,v 1.4 2013/09/21 14:40:07 yot Exp $’ :character(*), parameter
: �¢ã�¸ã�¥ã�¼ã�������¼ã�¸ã�§ã�� Module version