1 | MODULE read_param_mod |
---|
2 | #include "use_logging.h" |
---|
3 | IMPLICIT NONE |
---|
4 | PRIVATE |
---|
5 | SAVE |
---|
6 | |
---|
7 | INTERFACE |
---|
8 | |
---|
9 | ! each of these plugins reads a parameter of a certain type and stores the value in 'val' |
---|
10 | ! a typical implementation reads from a configuration file containing 'name = value' statements |
---|
11 | ! if 'name' is not present in the config file, defval is used as default value |
---|
12 | ! 'comment' can be used for logging purposes |
---|
13 | |
---|
14 | SUBROUTINE plugin_read_paramr(name, defval, val, comment) |
---|
15 | CHARACTER(*), INTENT(IN) :: name, comment |
---|
16 | REAL, INTENT(IN) :: defval |
---|
17 | REAL, INTENT(OUT) :: val |
---|
18 | END SUBROUTINE plugin_read_paramr |
---|
19 | |
---|
20 | SUBROUTINE plugin_read_parami(name, defval, val, comment) |
---|
21 | CHARACTER(*), INTENT(IN) :: name, comment |
---|
22 | INTEGER, INTENT(IN) :: defval |
---|
23 | INTEGER, INTENT(OUT) :: val |
---|
24 | END SUBROUTINE plugin_read_parami |
---|
25 | |
---|
26 | SUBROUTINE plugin_read_paramb(name, defval, val, comment) |
---|
27 | CHARACTER(*), INTENT(IN) :: name, comment |
---|
28 | LOGICAL, INTENT(IN) :: defval |
---|
29 | LOGICAL, INTENT(OUT) :: val |
---|
30 | END SUBROUTINE plugin_read_paramb |
---|
31 | |
---|
32 | END INTERFACE |
---|
33 | |
---|
34 | #ifndef XCODEML |
---|
35 | ! Note compiler compatibility : see logging.F90 |
---|
36 | |
---|
37 | PROCEDURE(plugin_read_paramr), POINTER, PUBLIC :: read_paramr_plugin => NULL() |
---|
38 | PROCEDURE(plugin_read_parami), POINTER, PUBLIC :: read_parami_plugin => NULL() |
---|
39 | PROCEDURE(plugin_read_paramb), POINTER, PUBLIC :: read_paramb_plugin => NULL() |
---|
40 | |
---|
41 | #endif |
---|
42 | |
---|
43 | INTERFACE read_param |
---|
44 | PROCEDURE read_paramr, read_parami, read_paramb |
---|
45 | END INTERFACE |
---|
46 | |
---|
47 | PUBLIC :: read_param |
---|
48 | |
---|
49 | CONTAINS |
---|
50 | |
---|
51 | SUBROUTINE read_paramr(name, defval, val, comment) |
---|
52 | CHARACTER(*), INTENT(IN) :: name, comment |
---|
53 | REAL, INTENT(IN) :: defval |
---|
54 | REAL, INTENT(OUT) :: val |
---|
55 | #ifndef XCODEML |
---|
56 | IF(.NOT.ASSOCIATED(read_paramr_plugin)) THEN |
---|
57 | CALL missing_plugin('read_paramr','read_param_mod') |
---|
58 | val = defval |
---|
59 | ELSE |
---|
60 | CALL read_paramr_plugin(name, defval, val, comment) |
---|
61 | END IF |
---|
62 | #endif |
---|
63 | WRITELOG(*,*) name, ' = ', val |
---|
64 | LOG_INFO('read_param') |
---|
65 | END SUBROUTINE read_paramr |
---|
66 | |
---|
67 | SUBROUTINE read_parami(name, defval, val, comment) |
---|
68 | CHARACTER(*), INTENT(IN) :: name, comment |
---|
69 | INTEGER, INTENT(IN) :: defval |
---|
70 | INTEGER, INTENT(OUT) :: val |
---|
71 | #ifndef XCODEML |
---|
72 | IF(.NOT.ASSOCIATED(read_parami_plugin)) THEN |
---|
73 | CALL missing_plugin('read_parami','read_param_mod') |
---|
74 | val = defval |
---|
75 | ELSE |
---|
76 | CALL read_parami_plugin(name, defval, val, comment) |
---|
77 | END IF |
---|
78 | #endif |
---|
79 | WRITELOG(*,*) name, ' = ', val |
---|
80 | LOG_INFO('read_param') |
---|
81 | END SUBROUTINE read_parami |
---|
82 | |
---|
83 | SUBROUTINE read_paramb(name, defval, val, comment) |
---|
84 | CHARACTER(*), INTENT(IN) :: name, comment |
---|
85 | LOGICAL, INTENT(IN) :: defval |
---|
86 | LOGICAL, INTENT(OUT) :: val |
---|
87 | #ifndef XCODEML |
---|
88 | IF(.NOT.ASSOCIATED(read_paramb_plugin)) THEN |
---|
89 | CALL missing_plugin('read_paramb','read_param_mod') |
---|
90 | val = defval |
---|
91 | ELSE |
---|
92 | CALL read_paramb_plugin(name, defval, val, comment) |
---|
93 | END IF |
---|
94 | #endif |
---|
95 | WRITELOG(*,*) name, ' = ', val |
---|
96 | LOG_INFO('read_param') |
---|
97 | END SUBROUTINE read_paramb |
---|
98 | |
---|
99 | END MODULE read_param_mod |
---|