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 64 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 147 of file dc_message.f90.

149 use dc_types ,only: string, dp
150 use dc_string ,only: uchar, strhead, printf, cprintf
151 use dc_error ,only: storeerror, usr_errno
152 implicit none
153 character(*), intent(in) :: level
154 character(*), intent(in) :: where
155 character(*), intent(in) :: message
156 integer , intent(in), optional:: i(:), n(:)
157 real , intent(in), optional:: r(:)
158 real(DP) , intent(in), optional:: d(:)
159 logical , intent(in), optional:: L(:)
160 character(*), intent(in), optional:: c1, c2, c3
161 character(*), intent(in), optional:: ca(:)
162 integer , intent(in), optional:: rank_mpi
163 character(string) :: msg
164 continue
165 if ( invalid_rank_number( rank_mpi ) ) return
166 if ( strhead( 'ERROR', trim( uchar(level) ) ) ) then
167 msg = cprintf(message, &
168 & i=i, r=r, d=d, l=l, n=n, c1=c1, c2=c2, c3=c3, ca=ca)
169 call storeerror(usr_errno, where, cause_c=msg)
170 elseif ( strhead( 'WARNING', trim( uchar(level) ) ) ) then
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=' *** WARNING [' // trim(where) // '] *** '// trim(msg)
174 call printf(fmt='%c', c1=msg)
175 else
176 msg = cprintf(message, &
177 & i=i, r=r, d=d, l=l, n=n, c1=c1, c2=c2, c3=c3, ca=ca)
178 msg=' *** MESSAGE [' // trim(where) // '] *** ' // trim(msg)
179 call printf(fmt='%c', c1=msg)
180 endif
181 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 232 of file dc_message.f90.

234 use dc_types ,only: dp
235 use dc_string ,only: cprintf
236 use dc_error ,only: storeerror
237 implicit none
238 integer, intent(in) :: number
239 character(*), intent(in) :: where
240 character(*), intent(in), optional:: message
241 integer , intent(in), optional:: i(:), n(:)
242 real , intent(in), optional:: r(:)
243 real(DP) , intent(in), optional:: d(:)
244 logical , intent(in), optional:: L(:)
245 character(*), intent(in), optional:: c1, c2, c3
246 character(*), intent(in), optional:: ca(:)
247 integer , intent(in), optional:: rank_mpi
248 continue
249 if ( invalid_rank_number( rank_mpi ) ) return
250 if (.not. present(message)) then
251 call storeerror(number, where)
252 else
253 call storeerror(number, where, &
254 & cause_c=cprintf( message, &
255 & i=i, r=r, d=d, l=l, n=n, c1=c1, c2=c2, c3=c3, ca=ca ) )
256 endif
257 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: