ERROR: Rewrite module a bit and the way messages are printed.
Subroutine print_error() does not stop the execution anymore. This should be controlled by the code. Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
parent
1e7cb2a72c
commit
2ad980142b
@ -27,30 +27,44 @@
|
||||
!
|
||||
module error
|
||||
|
||||
! module variables are not implicit by default
|
||||
!
|
||||
implicit none
|
||||
|
||||
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
!
|
||||
contains
|
||||
!
|
||||
!===============================================================================
|
||||
!
|
||||
! print_error: subroutine prints error
|
||||
! subroutine PRINT_ERROR:
|
||||
! ----------------------
|
||||
!
|
||||
! Subroutine prints an error message with the module/subroutine where
|
||||
! the error occured.
|
||||
!
|
||||
! Arguments:
|
||||
!
|
||||
! loc - string informing about the place where the error occured
|
||||
! (for example 'module name::subroutine name:[line]');
|
||||
! msg - string of the actual error message;
|
||||
!
|
||||
!===============================================================================
|
||||
!
|
||||
subroutine print_error(position, text)
|
||||
subroutine print_error(loc, msg)
|
||||
|
||||
! local variables are not implicit by default
|
||||
!
|
||||
implicit none
|
||||
|
||||
! input arguments
|
||||
! subroutine arguments
|
||||
!
|
||||
character(len=*), intent(in) :: position, text
|
||||
character(len=*), intent(in) :: loc, msg
|
||||
!
|
||||
!-------------------------------------------------------------------------------
|
||||
!
|
||||
write(*,*)
|
||||
write(*,"('[error in ', a, ']: ', a)") trim(position), trim(text)
|
||||
write(*,*)
|
||||
stop
|
||||
write(*,"('[ERROR in ', a, ']: ', a)") trim(loc), trim(msg)
|
||||
|
||||
!-------------------------------------------------------------------------------
|
||||
!
|
||||
@ -58,23 +72,34 @@ module error
|
||||
!
|
||||
!===============================================================================
|
||||
!
|
||||
! print_warning: subroutine prints warning
|
||||
! subroutine PRINT_WARNING:
|
||||
! ------------------------
|
||||
!
|
||||
! Subroutine prints a warning message with the module/subroutine where
|
||||
! the warning occured.
|
||||
!
|
||||
! Arguments:
|
||||
!
|
||||
! loc - string informing about the place where the warning occured
|
||||
! (for example 'module name::subroutine name:[line]');
|
||||
! msg - string of the actual warning message;
|
||||
!
|
||||
!===============================================================================
|
||||
!
|
||||
subroutine print_warning(position, text)
|
||||
subroutine print_warning(loc, msg)
|
||||
|
||||
! local variables are not implicit by default
|
||||
!
|
||||
implicit none
|
||||
|
||||
! input arguments
|
||||
! subroutine arguments
|
||||
!
|
||||
character(len=*), intent(in) :: position, text
|
||||
character(len=*), intent(in) :: loc, msg
|
||||
!
|
||||
!-------------------------------------------------------------------------------
|
||||
!
|
||||
write(*,*)
|
||||
write(*,"('[warning in ', a, ']: ', a)") trim(position), trim(text)
|
||||
write(*,*)
|
||||
write(*,"('[WARNING in ', a, ']: ', a)") trim(loc), trim(msg)
|
||||
|
||||
!-------------------------------------------------------------------------------
|
||||
!
|
||||
@ -82,27 +107,38 @@ module error
|
||||
!
|
||||
!===============================================================================
|
||||
!
|
||||
! print_info: subroutine prints information
|
||||
! subroutine PRINT_NOTIFICATION:
|
||||
! -----------------------------
|
||||
!
|
||||
! Subroutine prints a notification message with the module/subroutine where
|
||||
! the notification occured.
|
||||
!
|
||||
! Arguments:
|
||||
!
|
||||
! loc - string informing about the place where the notification occured
|
||||
! (for example 'module name::subroutine name:[line]');
|
||||
! msg - string of the actual notification message;
|
||||
!
|
||||
!===============================================================================
|
||||
!
|
||||
subroutine print_info(position, text)
|
||||
subroutine print_notification(loc, msg)
|
||||
|
||||
! local variables are not implicit by default
|
||||
!
|
||||
implicit none
|
||||
|
||||
! input arguments
|
||||
! subroutine arguments
|
||||
!
|
||||
character(len=*), intent(in) :: position, text
|
||||
character(len=*), intent(in) :: loc, msg
|
||||
!
|
||||
!-------------------------------------------------------------------------------
|
||||
!
|
||||
write(*,*)
|
||||
write(*,"('[info in ', a, ']: ', a)") trim(position), trim(text)
|
||||
write(*,*)
|
||||
write(*,"('[NOTIFICATION in ', a, ']: ', a)") trim(loc), trim(msg)
|
||||
|
||||
!-------------------------------------------------------------------------------
|
||||
!
|
||||
end subroutine print_info
|
||||
end subroutine print_notification
|
||||
|
||||
!===============================================================================
|
||||
!
|
||||
|
@ -1180,7 +1180,7 @@ module io
|
||||
use coordinates, only : nn, ng, in, jn, kn, maxlev, toplev, ir, jr, kr
|
||||
use coordinates, only : initialize_coordinates, finalize_coordinates
|
||||
use coordinates, only : xmin, xmax, ymin, ymax, zmin, zmax
|
||||
use error , only : print_error, print_warning
|
||||
use error , only : print_error
|
||||
use evolution, only : step, time, dt, dtn
|
||||
use hdf5 , only : hid_t, hsize_t
|
||||
use hdf5 , only : h5gopen_f, h5gclose_f, h5aget_num_attrs_f &
|
||||
|
@ -462,7 +462,7 @@ module mesh
|
||||
use blocks , only : get_mblocks, get_nleafs
|
||||
use coordinates , only : minlev, maxlev, res
|
||||
use domains , only : setup_domain
|
||||
use error , only : print_info, print_error
|
||||
use error , only : print_error
|
||||
use mpitools , only : master, nproc, nprocs
|
||||
use problems , only : setup_problem
|
||||
use refinement , only : check_refinement_criterion
|
||||
@ -787,7 +787,7 @@ module mesh
|
||||
use blocks , only : append_datablock, remove_datablock, link_blocks
|
||||
use coordinates , only : minlev, maxlev, toplev, im, jm, km, res
|
||||
use equations , only : nv
|
||||
use error , only : print_info, print_error
|
||||
use error , only : print_error
|
||||
#ifdef MPI
|
||||
use mpitools , only : master, nprocs, nproc
|
||||
use mpitools , only : reduce_sum_integer_array
|
||||
|
Loading…
x
Reference in New Issue
Block a user