Module fd4_globaldef_mod


Uses:
    module kinds_mod
Variables:
    integer, public :: fd4_wrnk
    character (len=11), public :: FD4_LINEHD
    integer, public, parameter :: fd4_out = 6
    integer (kind=i_k), public, parameter, dimension (2) :: fd4_incdec = (/ -1, 1 /)
Subroutines and functions:
    public subroutine fd4_print_kinds ()
    public logical function fd4_lerr (line, file, err, msg)
    public subroutine fd4_perr (line, file, msg)
    public function i2s (inum, zero) result (str)
    public function l2s (inum) result (str)
    public function p2s (p) result (str)
    public function iii2s (inum1, inum2, inum3) result (str)

Global definitions for FD4 and some helper routines.

Proprocessor options:

The subroutines fd4_lerr and fd4_perr should not be called directly, but used through the error handling interface defined in fd.h. Following verbose levels for error handling are defined:
   L1 =      output of basic and cheap error checks (default)
   L2 = L1 + some basic information
   L3 = L2 + expensive error checks (will hurt performance)
   L4 = L3 + verbose mode (tons of output)

L1 error checks will be always carried through (due to semantics of subroutines), but output of these error messages will only be enabled if FD4_VERBOSE_LEVEL >= 1. L3 error checks are only arried through if L3 is enabled.

The default verbose level is L1. Set the level with

  -DFD4_VERBOSE_LEVEL=[1|2|3|4]
when compiling the source file(s).

The error handling interface in fd.h defines the following preprocessor macros:

  FD4_L1_ASSERT(C,MSG)
  FD4_L1_ERROR(MSG)
  FD4_L1_WARN(MSG)
  FD4_L3_ASSERT(C,MSG)
  FD4_L4_INFO(MSG)
C is a logical expression, which should be true when an error condition occured. MSG is a character describing the error/warning/info.

Author: Matthias Lieber


Description of Subroutines and Functions

fd4_print_kinds

public subroutine fd4_print_kinds ()
end subroutine fd4_print_kinds
Print the kind values defined in kinds_mod.

See also: module kinds_mod


fd4_lerr

public logical function fd4_lerr (line, file, err, msg)
    integer, intent(in) :: line
    character (len=*), intent(in) :: file
    logical, intent(in) :: err
    character (len=*), intent(in) :: msg
end function fd4_lerr
Parameters:
line source code line of the error
file source code file of the error
err error condition
msg error message to print, if err == .true.
Print error message upon condition.

If err == .true. print error message and return true, else return false.


fd4_perr

public subroutine fd4_perr (line, file, msg)
    integer, intent(in) :: line
    character (len=*), intent(in) :: file
    character (len=*), intent(in) :: msg
end subroutine fd4_perr
Parameters:
line source code line of the error
file source code file of the error
msg error message to print
Print error message.

i2s

public function i2s (inum, zero) result (str)
    integer (kind=i_k), intent(in) :: inum
    logical, optional, intent(in) :: zero
    character (len=6) :: str
end function i2s
Parameters:
inum number to be converted to a character
zero fill with leading zeros (to avoid blanks)
convert number inum to character of length 6

l2s

public function l2s (inum) result (str)
    integer (kind=i8k), intent(in) :: inum
    character (len=12) :: str
end function l2s
Parameters:
inum number to be converted to a character
convert 8 byte integer inum to character of length 12

p2s

public function p2s (p) result (str)
    integer (kind=i_k), intent(in), dimension (3) :: p
    character (len=20) :: str
end function p2s
Parameters:
p position to be converted to a character
convert position pos to character of length 20

iii2s

public function iii2s (inum1, inum2, inum3) result (str)
    integer (kind=i_k), intent(in) :: inum1
    integer (kind=i_k), intent(in) :: inum2
    integer (kind=i_k), intent(in) :: inum3
    character (len=18) :: str
end function iii2s
Parameters:
inum1 integer to be converted to a character
inum2 integer to be converted to a character
inum3 integer to be converted to a character
convert integers inum1, inum2, inum3 to character of length 18