!c Description:
!c  計算状態をチェックし, うまくいっていない場合にはストップさせる
!c
!c Current Code Owner: 
!c   sugiyama@gfd-dennou.org
!c
!c Histry: 
!c   Version    Date          Comment
!c   -------    ----------    --------
!c   1.0        2003-02-05    作成
!c
!c Copyright (C) SUGIYAMA Ko-ichiro, 2003, All rights reserved

module interface_stop
  interface stop

     subroutine stop_ssl2(icon, char)
       integer, intent(in)   :: icon
       character(*), intent(in) :: char
     end subroutine stop_ssl2
     
     subroutine stop_var_int(var, char1, char2)
       integer, intent(in)      :: var
       character(*), intent(in) :: char1
       character(*), intent(in) :: char2
     end subroutine stop_var_int

     subroutine stop_var_real(var, char)
       real(8), intent(in)      :: var
       character(*), intent(in) :: char
     end subroutine stop_var_real
     
     subroutine stop_var1d_real(var, char)
       real(8), intent(in)      :: var(:)
       character(*), intent(in) :: char
     end subroutine stop_var1d_real
     
     subroutine stop_char(char)
       character(*), intent(in) :: char
     end subroutine stop_char
     
  end interface
end module interface_stop



subroutine stop_ssl2(icon, char)
  implicit none
  integer, intent(in)   :: icon
  character(*), intent(in) :: char
  
  if (icon /= 0) then 
     write(*,*) trim(char), " is wrong condition: ", icon
     stop
  end if
  
end subroutine stop_ssl2


subroutine stop_var_int(var, char1, char2)
  implicit none
  integer, intent(in)      :: var
  character(*), intent(in) :: char1
  character(*), intent(in) :: char2

  write(*,*) trim(char1), " is wrong condition: ", char2
  write(*,*) var
  stop
  
end subroutine stop_var_int


subroutine stop_var_real(var, char)
  implicit none
  real(8), intent(in)      :: var
  character(*), intent(in) :: char

  write(*,*) trim(char), " is wrong condition: "
  write(*,*) var
  stop

end subroutine stop_var_real


subroutine stop_var1d_real(var, char)
  implicit none
  real(8), intent(in)      :: var(:)
  character(*), intent(in) :: char

  write(*,*) trim(char), " is wrong condition: "
  write(*,*) var
  stop

end subroutine stop_var1d_real


subroutine stop_char(char)
  implicit none
  character(*), intent(in) :: char
  
  write(*,*) char
  stop
  
end subroutine stop_char


