Changeset 4578 for palm/trunk/SOURCE/message.f90
- Timestamp:
- Jun 25, 2020 3:43:32 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/message.f90
r4536 r4578 20 20 ! Current revisions: 21 21 ! ----------------- 22 ! 23 ! 22 ! 23 ! 24 24 ! Former revisions: 25 25 ! ----------------- 26 26 ! $Id$ 27 ! bugfix : do not save input values from last call of routines debug_message and location_message 28 ! changes: layout changes according to PALM coding standards 29 ! 30 ! 4536 2020-05-17 17:24:13Z raasch 27 31 ! location message format changed 28 ! 32 ! 29 33 ! 4360 2020-01-07 11:25:50Z suehring 30 34 ! Corrected "Former revisions" section 31 ! 35 ! 32 36 ! 4097 2019-07-15 11:59:11Z suehring 33 37 ! Avoid overlong lines - limit is 132 characters per line 34 ! 38 ! 35 39 ! 3987 2019-05-22 09:52:13Z kanani 36 40 ! Improved formatting of job logfile output, 37 41 ! changed output of DEBUG file 38 ! 42 ! 39 43 ! 3885 2019-04-11 11:29:34Z kanani 40 ! Changes related to global restructuring of location messages and introduction 44 ! Changes related to global restructuring of location messages and introduction 41 45 ! of additional debug messages 42 ! 46 ! 43 47 ! 3655 2019-01-07 16:51:22Z knoop 44 48 ! Minor formating changes … … 60 64 SUBROUTINE message( routine_name, message_identifier, requested_action, & 61 65 message_level, output_on_pe, file_id, flush_file ) 62 66 63 67 USE control_parameters, & 64 68 ONLY: abort_mode, message_string … … 121 125 header_string_2 = 'ID: ' // message_identifier // & 122 126 ' generated by routine: ' // TRIM( routine_name ) 123 127 124 128 information_string_1 = 'Further information can be found at' 125 129 IF(message_identifier(1:2) == 'NC') THEN … … 130 134 '/app/errmsg#' // message_identifier 131 135 ENDIF 132 136 133 137 134 138 ! … … 173 177 WRITE( *, '(20X,A)' ) TRIM( message_string ) 174 178 WRITE( *, '(20X,A)' ) '' 175 WRITE( *, '(20X,A)' ) TRIM( information_string_1 ) 176 WRITE( *, '(20X,A)' ) TRIM( information_string_2 ) 179 WRITE( *, '(20X,A)' ) TRIM( information_string_1 ) 180 WRITE( *, '(20X,A)' ) TRIM( information_string_2 ) 177 181 WRITE( *, '(20X,A)' ) '' 178 182 … … 193 197 WRITE( file_id, '(4X,A)' ) TRIM( message_string ) 194 198 WRITE( file_id, '(4X,A)' ) '' 195 WRITE( file_id, '(4X,A)' ) TRIM( information_string_1 ) 196 WRITE( file_id, '(4X,A)' ) TRIM( information_string_2 ) 199 WRITE( file_id, '(4X,A)' ) TRIM( information_string_1 ) 200 WRITE( file_id, '(4X,A)' ) TRIM( information_string_2 ) 197 201 WRITE( file_id, '(4X,A)' ) '' 198 202 ! … … 227 231 !> Prints out the given location on stdout 228 232 !--------------------------------------------------------------------------------------------------! 229 230 233 SUBROUTINE location_message( location, message_type ) 231 232 234 233 235 USE, INTRINSIC :: ISO_FORTRAN_ENV, & 234 236 ONLY: OUTPUT_UNIT 235 237 236 USE pegrid 238 USE pegrid, & 239 ONLY: myid 237 240 238 241 USE pmc_interface, & … … 241 244 IMPLICIT NONE 242 245 243 CHARACTER(LEN=*) :: location !< text to be output on stdout 244 CHARACTER(LEN=60) :: location_string = ' ' !< 245 CHARACTER(LEN=*) :: message_type !< attribute marking 'start' or 'end' of routine 246 CHARACTER(LEN=11) :: message_type_string = ' ' !< 247 CHARACTER(LEN=10) :: system_time !< system clock time 248 CHARACTER(LEN=10) :: time 246 CHARACTER(LEN=*) :: location !< text to be output on stdout 247 CHARACTER(LEN=60) :: location_trimmed !< trimmed text to be output on stdout 248 CHARACTER(LEN=*) :: message_type !< type of message; supported values: 'start', 'finished' 249 CHARACTER(LEN=10) :: message_type_string !< formatted message-type string for output 250 CHARACTER(LEN=8) :: system_time !< formatted system clock time 251 CHARACTER(LEN=10) :: time !< current time of system 252 249 253 ! 250 254 !-- Output for nested runs only on the root domain … … 254 258 ! 255 259 !-- Get system time for debug info output (helpful to estimate the required computing time for 256 !-- specific parts of code 260 !-- specific parts of code) 257 261 CALL date_and_time( TIME=time ) 258 system_time = time(1:2)//':'//time(3:4)//':'//time(5:6) 259 ! 260 !-- Write pre-string depending on message_type 261 IF ( TRIM( message_type ) == 'start' ) WRITE( message_type_string, * ) '-', TRIM( message_type ), '----' 262 IF ( TRIM( message_type ) == 'finished' ) WRITE( message_type_string, * ) '-', TRIM( message_type ), '-' 263 ! 264 !-- Write dummy location_string in order to allow left-alignment of text despite the fixed (=A60) 265 !-- format. 266 WRITE( location_string, * ) TRIM( location ) 262 system_time = time(1:2) // ':' // time(3:4) // ':' // time(5:6) 263 ! 264 !-- Write message-type string depending on message_type 265 message_type_string = REPEAT( '-', 10 ) 266 IF ( TRIM( message_type ) == 'start' ) & 267 message_type_string(2:) = TRIM( message_type ) // '----' 268 IF ( TRIM( message_type ) == 'finished' ) & 269 message_type_string(2:) = TRIM( message_type ) // '-' 270 ! 271 !-- Trim location text to a maximum of 60 chars 272 !-- Note: if the length is set within the write format, the string is right-aligned; to trim and 273 !-- left-align the output, we need to use this detour 274 WRITE( location_trimmed, '(A)' ) ADJUSTL( TRIM( location ) ) 267 275 ! 268 276 !-- Write and flush debug location or info message to file 269 WRITE( OUTPUT_UNIT, 200 ) TRIM( system_time ), TRIM( message_type_string ), & 270 TRIM( location_string ) 277 WRITE( OUTPUT_UNIT, 200 ) system_time, message_type_string, TRIM( location_trimmed ) 271 278 FLUSH( OUTPUT_UNIT ) 272 279 ! 273 280 !-- Message formats 274 200 FORMAT ( 3X, A, 3x, A, 2X, A )281 200 FORMAT ( 3X, A, 3x, A, 3X, A ) 275 282 276 283 ENDIF … … 285 292 !> for each PE on each domain. 286 293 !--------------------------------------------------------------------------------------------------! 287 288 294 SUBROUTINE debug_message( debug_string, message_type ) 289 290 295 291 296 USE control_parameters, & … … 294 299 IMPLICIT NONE 295 300 296 297 CHARACTER(LEN=*) :: debug_string !< debug message to be output on unit 9 298 CHARACTER(LEN=*) :: message_type !< 'start', 'end', 'info' 299 CHARACTER(LEN=10) :: message_type_string = ' ' !< 300 CHARACTER(LEN=10) :: system_time !< system clock time 301 CHARACTER(LEN=10) :: time 301 CHARACTER(LEN=*) :: debug_string !< debug message to be output to debug_output_unit 302 CHARACTER(LEN=*) :: message_type !< type of message; supported values: 'start', 'end', 'info' 303 CHARACTER(LEN=7) :: message_type_string !< formatted message-type string for output 304 CHARACTER(LEN=8) :: system_time !< formatted system clock time 305 CHARACTER(LEN=10) :: time !< current time of system 302 306 303 307 INTEGER, PARAMETER :: debug_output_unit = 9 … … 305 309 ! 306 310 !-- Get system time for debug info output (helpful to estimate the required computing time for 307 !-- specific parts of code 311 !-- specific parts of code) 308 312 CALL date_and_time( TIME=time ) 309 system_time = time(1:2)//':'//time(3:4)//':'//time(5:6) 310 ! 311 !-- Write pre-string depending on message_type 312 IF ( TRIM( message_type ) == 'start' ) WRITE( message_type_string, * ) '-', TRIM( message_type ), '-' 313 IF ( TRIM( message_type ) == 'end' ) WRITE( message_type_string, * ) '-', TRIM( message_type ), '---' 314 IF ( TRIM( message_type ) == 'info' ) WRITE( message_type_string, * ) '-', TRIM( message_type ), '--' 313 system_time = time(1:2) // ':' // time(3:4) // ':' // time(5:6) 314 ! 315 !-- Write message-type string depending on message_type 316 message_type_string = REPEAT( '-', 7 ) 317 IF ( TRIM( message_type ) == 'start' ) message_type_string(2:) = TRIM( message_type ) // '-' 318 IF ( TRIM( message_type ) == 'end' ) message_type_string(2:) = TRIM( message_type ) // '---' 319 IF ( TRIM( message_type ) == 'info' ) message_type_string(2:) = TRIM( message_type ) // '--' 315 320 ! 316 321 !-- Write and flush debug location or info message to file 317 WRITE( debug_output_unit, 201 ) TRIM( system_time ), time_since_reference_point, &318 TRIM( message_type_string ), TRIM( debug_string )322 WRITE( debug_output_unit, 201 ) system_time, time_since_reference_point, & 323 message_type_string, TRIM( debug_string ) 319 324 FLUSH( debug_output_unit ) 320 321 325 ! 322 326 !-- Message formats 323 327 201 FORMAT ( 'System time: ', A, ' | simulated time (s): ', F12.3, ' | ', A, ' ', A ) 324 325 328 326 329 END SUBROUTINE debug_message … … 332 335 !> Abort routine for failures durin reading of namelists 333 336 !------------------------------------------------------------------------------! 334 335 337 SUBROUTINE parin_fail_message( location, line ) 336 338
Note: See TracChangeset
for help on using the changeset viewer.