linalg_error_handling 子程序

public pure subroutine linalg_error_handling(ierr, ierr_out)

流程控制:输出标志存在,返回它;否则,在出错时停止

参数

类型 意图可选 属性 名称
type(linalg_state_type), intent(in) :: ierr
type(linalg_state_type), intent(out), optional :: ierr_out

源代码

     pure subroutine linalg_error_handling(ierr,ierr_out)
         type(linalg_state_type),intent(in) :: ierr
         type(linalg_state_type),optional,intent(out) :: ierr_out

         character(len=:),allocatable :: err_msg

         if (present(ierr_out)) then
             ! Return error flag
             ierr_out = ierr
         elseif (ierr%error()) then
             err_msg = ierr%print()
             error stop err_msg
         end if

     end subroutine linalg_error_handling