utils.f90 887 Bytes
Newer Older
Luca's avatar
init  
Luca committed
1 2 3

! Contains some functions that might be useful later

4 5 6 7 8 9 10
! Write your own print function with ability to suppress print
! Muss immer alle prints und warnings ausschalten können
! Test Programm schreiben mit exit codes -> gfortran 'test.f90' und dann 'echo $?'
! Define GPL infinity
! Mach n optional
! Kommentar schreiben zu anderer Notation 

Luca's avatar
init  
Luca committed
11 12 13
MODULE utils
  implicit none

14 15 16
  logical :: print_enabled = .true.
  logical :: warnings_enabled = .true.

Luca's avatar
init  
Luca committed
17 18
CONTAINS
  
19 20 21 22
  subroutine print(s1,s2,s3,s4,s5)
    character(len = *), intent(in), optional :: s1, s2, s3, s4, s5
    if(print_enabled) then
      print*, s1, s2, s3, s4, s5
Luca's avatar
init  
Luca committed
23
    end if
24
  end subroutine print
Luca's avatar
init  
Luca committed
25

26 27 28 29
  subroutine warn(s1,s2,s3,s4,s5)
    character(len = *), intent(in), optional :: s1, s2, s3, s4, s5
    if(warnings_enabled) then
      print*, 'Warning: ', s1, s2, s3, s4, s5
Luca's avatar
init  
Luca committed
30
    end if
31
  end subroutine warn
Luca's avatar
init  
Luca committed
32 33 34

END MODULE utils