source: dynamico_lmdz/simple_physics/phyparam/physics/read_param_mod.F90

Last change on this file was 4236, checked in by dubos, 6 years ago

simple_physics : some Python bindings

File size: 3.0 KB
RevLine 
[4221]1MODULE read_param_mod
[4230]2#include "use_logging.h"
[4221]3  IMPLICIT NONE
4  PRIVATE
5  SAVE
6
[4229]7  INTERFACE
[4221]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
[4226]34#ifndef XCODEML
35  ! Note compiler compatibility : see logging.F90
[4227]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
[4226]41#endif
[4221]42
43  INTERFACE read_param
[4226]44     PROCEDURE read_paramr, read_parami, read_paramb
[4236]45  END INTERFACE
[4221]46
[4227]47  PUBLIC :: read_param
[4221]48
49CONTAINS
50
[4226]51  SUBROUTINE read_paramr(name, defval, val, comment)
[4221]52    CHARACTER(*), INTENT(IN) :: name, comment
53    REAL, INTENT(IN)         :: defval
54    REAL, INTENT(OUT)        :: val
[4226]55#ifndef XCODEML
[4230]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
[4226]62#endif
[4230]63    WRITELOG(*,*) name, ' = ', val
64    LOG_INFO('read_param')
[4226]65  END SUBROUTINE read_paramr
[4221]66
[4226]67  SUBROUTINE read_parami(name, defval, val, comment)
[4221]68    CHARACTER(*), INTENT(IN) :: name, comment
69    INTEGER, INTENT(IN)      :: defval
70    INTEGER, INTENT(OUT)     :: val
[4226]71#ifndef XCODEML
[4230]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
[4226]78#endif
[4230]79    WRITELOG(*,*) name, ' = ', val
80    LOG_INFO('read_param')
[4226]81  END SUBROUTINE read_parami
[4229]82
[4226]83  SUBROUTINE read_paramb(name, defval, val, comment)
[4221]84    CHARACTER(*), INTENT(IN) :: name, comment
85    LOGICAL, INTENT(IN)      :: defval
86    LOGICAL, INTENT(OUT)     :: val
[4226]87#ifndef XCODEML
[4235]88    IF(.NOT.ASSOCIATED(read_paramb_plugin)) THEN
[4230]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
[4226]94#endif
[4230]95    WRITELOG(*,*) name, ' = ', val
96    LOG_INFO('read_param')
[4226]97  END SUBROUTINE read_paramb
[4233]98
[4221]99END MODULE read_param_mod
Note: See TracBrowser for help on using the repository browser.