1 | module prt_cmp_m |
---|
2 | |
---|
3 | implicit none |
---|
4 | |
---|
5 | interface prt_cmp |
---|
6 | ! Used by "compare". |
---|
7 | module procedure prt_cmp_real, prt_cmp_double |
---|
8 | end interface prt_cmp |
---|
9 | |
---|
10 | private |
---|
11 | public prt_cmp |
---|
12 | |
---|
13 | contains |
---|
14 | |
---|
15 | subroutine prt_cmp_real(data_old, data_new, maxv, location) |
---|
16 | |
---|
17 | real, intent(in):: data_old, data_new, maxv |
---|
18 | integer, intent(in):: location(:) |
---|
19 | |
---|
20 | ! Variable local to the procedure: |
---|
21 | character(len=30) format_string |
---|
22 | |
---|
23 | !------------------------------------------------------ |
---|
24 | |
---|
25 | if (size(location) == 1) then |
---|
26 | format_string = "(a, i0, a)" |
---|
27 | else |
---|
28 | ! size(location) >= 2 |
---|
29 | write(unit=format_string, fmt="(a, i0, a)") "(a, ", & |
---|
30 | size(location) - 1, "(i0, 1x), i0, a)" |
---|
31 | end if |
---|
32 | |
---|
33 | print * |
---|
34 | print '("Maximum difference: ", 1pg8.1)', maxv |
---|
35 | !! print '("Maximum difference: ", 1pg9.2)', maxv |
---|
36 | print *, 'Occurring at:' |
---|
37 | |
---|
38 | write(unit=*, fmt=format_string, advance="no") 'data_old(', location, & |
---|
39 | ') = ' |
---|
40 | print *, data_old |
---|
41 | |
---|
42 | write(unit=*, fmt=format_string, advance="no") 'data_new(', location, & |
---|
43 | ') = ' |
---|
44 | print *, data_new |
---|
45 | |
---|
46 | end subroutine prt_cmp_real |
---|
47 | |
---|
48 | !*********************************************************** |
---|
49 | |
---|
50 | subroutine prt_cmp_double(data_old, data_new, maxv, location) |
---|
51 | |
---|
52 | double precision, intent(in):: data_old, data_new, maxv |
---|
53 | integer, intent(in):: location(:) |
---|
54 | |
---|
55 | ! Variable local to the procedure: |
---|
56 | character(len=30) format_string |
---|
57 | |
---|
58 | !------------------------------------------------------ |
---|
59 | |
---|
60 | if (size(location) == 1) then |
---|
61 | format_string = "(a, i0, a)" |
---|
62 | else |
---|
63 | ! size(location) >= 2 |
---|
64 | write(unit=format_string, fmt="(a, i0, a)") "(a, ", & |
---|
65 | size(location) - 1, "(i0, 1x), i0, a)" |
---|
66 | end if |
---|
67 | |
---|
68 | print * |
---|
69 | print '("Maximum difference: ", 1pg8.1)', maxv |
---|
70 | !! print '("Maximum difference: ", 1pg9.2)', maxv |
---|
71 | print *, 'Occurring at:' |
---|
72 | |
---|
73 | write(unit=*, fmt=format_string, advance="no") 'data_old(', location, & |
---|
74 | ') = ' |
---|
75 | print *, data_old |
---|
76 | |
---|
77 | write(unit=*, fmt=format_string, advance="no") 'data_new(', location, & |
---|
78 | ') = ' |
---|
79 | print *, data_new |
---|
80 | |
---|
81 | end subroutine prt_cmp_double |
---|
82 | |
---|
83 | end module prt_cmp_m |
---|