-
Notifications
You must be signed in to change notification settings - Fork 0
/
debugger.f90
87 lines (69 loc) · 2.31 KB
/
debugger.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
! __________________________________________________________________
! _______________SUBROUTINE FOR DEBUGGING REAL______________________
! __________________________________________________________________
subroutine debugger_real(matrix,n,m,matrix_name,line,output)
IMPLICIT NONE
! -----------------------INTEGER VARIABLES--------------------------
integer :: i,j
integer, intent(in):: n,m,output,line
! ------------------------REAL VARIABLES----------------------------
real(kind=8), intent(in) :: matrix(n,m)
! -----------------------CHARACTER VARIABLES------------------------
character(len=*) :: matrix_name
! NO FORMATING DEPENDING ON COMPILER
if (output==0) then; write(6,*) '-------------'
write(6,*) line, matrix_name
write (6,*) matrix(:,:)
end if
! SCIENTIFIC FORMATING
if (output==1) then
write(6,*) '-------------'
write(6,*) line, matrix_name
do i=1, n
write (6,'(10ES15.6)') matrix(i,:)
end do
end if
! FOR NON INTEL COMPILERS SCIENTIFIC FORMATING
if (output==2) then
write(6,*) '-------------'
write(6,*) line, matrix_name
do i=1, n
write (6,'(10ES15.6)') (matrix(i,j),j=1,m)
end do
end if
return
end subroutine
! __________________________________________________________________
! ______________SUBROUTINE FOR DEBUGGING INTEGER____________________
! __________________________________________________________________
subroutine debugger_integer(matrix,n,m,matrix_name,line,output)
IMPLICIT NONE
! -----------------------INTEGER VARIABLES--------------------------
integer :: i,j
integer, intent(in):: n,m,output,line,matrix(n,m)
! -----------------------CHARACTER VARIABLES------------------------
character(len=*) :: matrix_name
! NO FORMATING DEPENDING ON COMPILER
if (output==0) then
write(6,*) '-------------'
write(6,*) line, matrix_name
write (6,*) matrix(:,:)
end if
! SCIENTIFIC FORMATING
if (output==1) then
write(6,*) '-------------'
write(6,*) line, matrix_name
do i=1, n
write (6,'(10I4)') matrix(i,:)
end do
end if
! FOR NON INTEL COMPILERS SCIENTIFIC FORMATING
if (output==2) then
write(6,*) '-------------'
write(6,*) line, matrix_name
do i=1, n
write (6,'(10I4)') (matrix(i,j),j=1,m)
end do
end if
return
end subroutine