gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
dc_message::messagenotify Interface Reference

Public Member Functions

subroutine messagenotifyc (level, where, message, i, r, d, l, n, c1, c2, c3, ca, rank_mpi)
subroutine messagenotifyi (number, where, message, i, r, d, l, n, c1, c2, c3, ca, rank_mpi)

Detailed Description

Definition at line 60 of file dc_message.f90.

Member Function/Subroutine Documentation

◆ messagenotifyc()

subroutine dc_message::messagenotify::messagenotifyc ( character(*), intent(in) level,
character(*), intent(in) where,
character(*), intent(in) message,
integer, dimension(:), intent(in), optional i,
real, dimension(:), intent(in), optional r,
real(dp), dimension(:), intent(in), optional d,
logical, dimension(:), intent(in), optional l,
integer, dimension(:), intent(in), optional n,
character(*), intent(in), optional c1,
character(*), intent(in), optional c2,
character(*), intent(in), optional c3,
character(*), dimension(:), intent(in), optional ca,
integer, intent(in), optional rank_mpi )

Output message or terminate with error

Use this subroutine when you want to output a message to standard output.

Give the character variable where as the program name (subroutine name) etc., indicating where in the program the message is output.

Give the character variable message the string you want to output. You can also add optional variables i, r, d, L, s, n, c1, c2, c3. See dc_string::CPrintf for details.

The character variable level determines the type of message to output:

  • "W" (or "Warning", etc. starting with "W") indicates a warning
  • "E" (or "Error", etc. starting with "E") indicates an error (program terminates after message output)
  • Other characters (usually "M" is expected) indicate a normal message

If "E" is given, the program is forcibly terminated after the message is output. The error code will be dc_error::USR_ERRNO.

Parameters
[in]levelMessage level ("E", "W", or "M")
[in]whereProgram name, procedure name
[in]messageMessage text
[in]iInteger values for formatting
[in]rReal values for formatting
[in]dDouble precision values for formatting
[in]LLogical values for formatting
[in]nInteger values for formatting
[in]c1Character string 1 for formatting
[in]c2Character string 2 for formatting
[in]c3Character string 3 for formatting
[in]caCharacter array for formatting
[in]rank_mpiWhen MPI is used, messages are output only on the node with this rank number. If a negative value is given, output is done on all nodes. This option is ignored if MPI is not used.

Definition at line 142 of file dc_message.f90.

144 use dc_types ,only: string, dp
145 use dc_string ,only: uchar, strhead, printf, cprintf
146 use dc_error ,only: storeerror, usr_errno
147 implicit none
148 character(*), intent(in) :: level
149 character(*), intent(in) :: where
150 character(*), intent(in) :: message
151 integer , intent(in), optional:: i(:), n(:)
152 real , intent(in), optional:: r(:)
153 real(DP) , intent(in), optional:: d(:)
154 logical , intent(in), optional:: L(:)
155 character(*), intent(in), optional:: c1, c2, c3
156 character(*), intent(in), optional:: ca(:)
157 integer , intent(in), optional:: rank_mpi
158 character(string) :: msg
159 continue
160 if ( invalid_rank_number( rank_mpi ) ) return
161 if ( strhead( 'ERROR', trim( uchar(level) ) ) ) then
162 msg = cprintf(message, &
163 & i=i, r=r, d=d, l=l, n=n, c1=c1, c2=c2, c3=c3, ca=ca)
164 call storeerror(usr_errno, where, cause_c=msg)
165 elseif ( strhead( 'WARNING', trim( uchar(level) ) ) ) then
166 msg = cprintf(message, &
167 & i=i, r=r, d=d, l=l, n=n, c1=c1, c2=c2, c3=c3, ca=ca)
168 msg=' *** WARNING [' // trim(where) // '] *** '// trim(msg)
169 call printf(fmt='%c', c1=msg)
170 else
171 msg = cprintf(message, &
172 & i=i, r=r, d=d, l=l, n=n, c1=c1, c2=c2, c3=c3, ca=ca)
173 msg=' *** MESSAGE [' // trim(where) // '] *** ' // trim(msg)
174 call printf(fmt='%c', c1=msg)
175 endif
176 return
Error handling module.
Definition dc_error.f90:454
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition dc_error.f90:891
integer, parameter, public usr_errno
-1000 or less: User-defined errors
Definition dc_error.f90:579
Handling character types.
Definition dc_string.f90:83
Provides kind type parameter values.
Definition dc_types.f90:55
integer, parameter, public string
Character length for string
Definition dc_types.f90:137
integer, parameter, public dp
Double Precision Real number
Definition dc_types.f90:92

References dc_types::dp, dc_error::storeerror(), dc_types::string, and dc_error::usr_errno.

Here is the call graph for this function:

◆ messagenotifyi()

subroutine dc_message::messagenotify::messagenotifyi ( integer, intent(in) number,
character(*), intent(in) where,
character(*), intent(in), optional message,
integer, dimension(:), intent(in), optional i,
real, dimension(:), intent(in), optional r,
real(dp), dimension(:), intent(in), optional d,
logical, dimension(:), intent(in), optional l,
integer, dimension(:), intent(in), optional n,
character(*), intent(in), optional c1,
character(*), intent(in), optional c2,
character(*), intent(in), optional c3,
character(*), dimension(:), intent(in), optional ca,
integer, intent(in), optional rank_mpi )

Output message or terminate with error (with error code)

Basically the same as the other MessageNotify (or dc_message::MessageNotifyC), but this one takes a numeric variable number as the first argument. This number is passed directly to dc_error::StoreError as an error code. See dc_error for error codes.

Parameters
[in]numberError code (see dc_error)
[in]whereProgram name, procedure name
[in]messageMessage text (optional)
[in]iInteger values for formatting
[in]rReal values for formatting
[in]dDouble precision values for formatting
[in]LLogical values for formatting
[in]nInteger values for formatting
[in]c1Character string 1 for formatting
[in]c2Character string 2 for formatting
[in]c3Character string 3 for formatting
[in]caCharacter array for formatting
[in]rank_mpiWhen MPI is used, messages are output only on the node with this rank number. If a negative value is given, output is done on all nodes. This option is ignored if MPI is not used.

Definition at line 227 of file dc_message.f90.

229 use dc_types ,only: dp
230 use dc_string ,only: cprintf
231 use dc_error ,only: storeerror
232 implicit none
233 integer, intent(in) :: number
234 character(*), intent(in) :: where
235 character(*), intent(in), optional:: message
236 integer , intent(in), optional:: i(:), n(:)
237 real , intent(in), optional:: r(:)
238 real(DP) , intent(in), optional:: d(:)
239 logical , intent(in), optional:: L(:)
240 character(*), intent(in), optional:: c1, c2, c3
241 character(*), intent(in), optional:: ca(:)
242 integer , intent(in), optional:: rank_mpi
243 continue
244 if ( invalid_rank_number( rank_mpi ) ) return
245 if (.not. present(message)) then
246 call storeerror(number, where)
247 else
248 call storeerror(number, where, &
249 & cause_c=cprintf( message, &
250 & i=i, r=r, d=d, l=l, n=n, c1=c1, c2=c2, c3=c3, ca=ca ) )
251 endif
252 return

References dc_types::dp, and dc_error::storeerror().

Here is the call graph for this function:

The documentation for this interface was generated from the following file: