-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_json.f90
70 lines (55 loc) · 2.72 KB
/
test_json.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
program test_json
use json
implicit none
integer, parameter :: dp = selected_real_kind(15, 300)
json_pretty_print = .true.
call open_dbg_out("test.json")
print *, "add int arrays..."
call add_int("a", 42)
call add_int_1d("b", 3, (/ 1, 2, 3 /) )
call add_int_2d("c", 3, 2, (/ (/ 1, 2, 3 /), &
(/ 4, 5, 6 /) /) )
call add_int_3d("d", 3, 2, 2, (/ &
(/ (/ 1, 2, 3 /), &
(/ 4, 5, 6 /) /), &
(/ (/ 7, 8, 9 /), &
(/ 10, 11, 12 /) /) &
/) )
call add_int_4d("e", 3, 2, 2, 1, (/ (/ &
(/ (/ 1, 2, 3 /), &
(/ 4, 5, 6 /) /), &
(/ (/ 7, 8, 9 /), &
(/ 10, 11, 12 /) /) &
/) /) )
call add_int_5d("f", 3, 2, 2, 1, 1, (/ (/ (/ &
(/ (/ 1, 2, 3 /), &
(/ 4, 5, 6 /) /), &
(/ (/ 7, 8, 9 /), &
(/ 10, 11, 12 /) /) &
/) /) /) )
print *, "add real arrays..."
call add_real("A", 42.0_dp)
call add_real_1d("B", 3, (/ 1.0_dp, 2.0_dp, 3.0_dp /) )
call add_real_2d("C", 3, 2, (/ (/ 1.0_dp, 2.0_dp, 3.0_dp /), &
(/ 4.0_dp, 5.0_dp, 6.0_dp /) /) )
call add_real_3d("D", 3, 2, 2, (/ &
(/ (/ 1.0_dp, 2.0_dp, 3.0_dp /), &
(/ 4.0_dp, 5.0_dp, 6.0_dp /) /), &
(/ (/ 7.0_dp, 8.0_dp, 9.0_dp /), &
(/ 10.0_dp, 11.0_dp, 12.0_dp /) /) &
/) )
call add_real_4d("E", 3, 2, 2, 1, (/ (/ &
(/ (/ 1.0_dp, 2.0_dp, 3.0_dp /), &
(/ 4.0_dp, 5.0_dp, 6.0_dp /) /), &
(/ (/ 7.0_dp, 8.0_dp, 9.0_dp /), &
(/ 10.0_dp, 11.0_dp, 12.0_dp /) /) &
/) /) )
call add_real_5d("F", 3, 2, 2, 1, 1, (/ (/ (/ &
(/ (/ 1.0_dp, 2.0_dp, 3.0_dp /), &
(/ 4.0_dp, 5.0_dp, 6.0_dp /) /), &
(/ (/ 7.0_dp, 8.0_dp, 9.0_dp /), &
(/ 10.0_dp, 11.0_dp, 12.0_dp /) /) &
/) /) /) )
print *, "done"
call close_dbg_out()
end program