ROMS
Loading...
Searching...
No Matches
checkerror.F File Reference
#include "cppdefs.h"
Include dependency graph for checkerror.F:

Go to the source code of this file.

Functions/Subroutines

logical function checkerror (errorflag, source, routine, message)
 

Function/Subroutine Documentation

◆ checkerror()

logical function checkerror ( integer, intent(in) errorflag,
character (len=*), intent(in) source,
character (len=*), intent(in) routine,
character (len=*), intent(in) message )

Definition at line 2 of file checkerror.F.

3!
4!git $Id$
5!================================================== Hernan G. Arango ===
6! Copyright (c) 2002-2025 The ROMS Group !
7! Licensed under a MIT/X style license !
8! See License_ROMS.md !
9!=======================================================================
10! !
11! This function checks an error flag returned by a particular source !
12! code and prints the appropriate error message, if any. !
13! !
14!=======================================================================
15!
16#ifdef ESMF_LIB
17 USE esmf
18#endif
19 USE mod_param
20 USE mod_parallel
21 USE mod_iounits
22 USE mod_scalars
23!
24 implicit none
25!
26! Imported variable declarations.
27!
28 integer, intent(in) :: ErrorFlag
29
30 character (len=*), intent(in) :: source
31 character (len=*), intent(in) :: routine
32 character (len=*), intent(in) :: message
33!
34! Local variable declarations.
35!
36 logical :: CheckError
37!
38!-----------------------------------------------------------------------
39! Check error flag.
40!-----------------------------------------------------------------------
41!
42! First, initialize to no error.
43!
44 checkerror=.false.
45!
46! Check error flags according to source.
47!
48 SELECT CASE (trim(adjustl(source)))
49
50 CASE ('ROMS')
51 IF (errorflag.ne.noerror) THEN
52 checkerror=.true.
53 END IF
54#ifdef ESMF_LIB
55 CASE ('ESMF')
56 IF (errorflag.ne.esmf_success) THEN
57 checkerror=.true.
58 END IF
59#endif
60 CASE DEFAULT
61 checkerror=.false.
62
63 END SELECT
64!
65! Report error message.
66!
67 IF (checkerror) THEN
68 IF (master) THEN
69 WRITE (stdout,10) trim(adjustl(routine)), &
70 & trim(adjustl(source)), &
71 & trim(adjustl(message))
72 END IF
73 10 FORMAT(/,1x,a,' - ',a,': Error while ',a,'.'/)
74 END IF
75
76 RETURN
logical function checkerror(errorflag, source, routine, message)
Definition checkerror.F:3
integer stdout
logical master
integer noerror

References checkerror(), mod_parallel::master, mod_scalars::noerror, and mod_iounits::stdout.

Referenced by checkerror().

Here is the call graph for this function:
Here is the caller graph for this function: