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)
|
|
�����������§ã��, æ£ã���¤ã�����¹ã���±ã���¾ã��.
�¡å�¹ã�§ã�������証ã�������´å������,
�����¼ã���ºç�������¾ã��.
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.
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