utils.f90 929 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
! 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
Luca committed
10
! Funktion überprüfen! Tests schreiben!
11

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

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

Luca's avatar
init  
Luca committed
18 19
CONTAINS
  
20 21 22 23
  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
24
    end if
25
  end subroutine print
Luca's avatar
init  
Luca committed
26

27 28 29 30
  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
31
    end if
32
  end subroutine warn
Luca's avatar
init  
Luca committed
33 34 35

END MODULE utils