1 | ! |
---|
2 | ! $Id: getparam.F90 1279 2009-12-10 09:02:56Z ymeurdesoif $ |
---|
3 | ! |
---|
4 | MODULE getparam |
---|
5 | #ifdef CPP_IOIPSL |
---|
6 | USE IOIPSL |
---|
7 | #else |
---|
8 | ! if not using IOIPSL, we still need to use (a local version of) getin |
---|
9 | USE ioipsl_getincom |
---|
10 | #endif |
---|
11 | |
---|
12 | INTERFACE getpar |
---|
13 | MODULE PROCEDURE ini_getparam,fin_getparam,getparamr,getparami,getparaml |
---|
14 | END INTERFACE |
---|
15 | |
---|
16 | INTEGER, PARAMETER :: out_eff=99 |
---|
17 | |
---|
18 | CONTAINS |
---|
19 | SUBROUTINE ini_getparam(fichier) |
---|
20 | USE parallel |
---|
21 | ! |
---|
22 | IMPLICIT NONE |
---|
23 | ! |
---|
24 | CHARACTER*(*) :: fichier |
---|
25 | IF (mpi_rank==0) OPEN(out_eff,file=fichier,status='unknown',form='formatted') |
---|
26 | |
---|
27 | END SUBROUTINE ini_getparam |
---|
28 | |
---|
29 | SUBROUTINE fin_getparam |
---|
30 | USE parallel |
---|
31 | ! |
---|
32 | IMPLICIT NONE |
---|
33 | ! |
---|
34 | IF (mpi_rank==0) CLOSE(out_eff) |
---|
35 | |
---|
36 | END SUBROUTINE fin_getparam |
---|
37 | |
---|
38 | SUBROUTINE getparamr(TARGET,def_val,ret_val,comment) |
---|
39 | USE parallel |
---|
40 | ! |
---|
41 | IMPLICIT NONE |
---|
42 | ! |
---|
43 | ! Get a real scalar. We first check if we find it |
---|
44 | ! in the database and if not we get it from the run.def |
---|
45 | ! |
---|
46 | ! getinr1d and getinr2d are written on the same pattern |
---|
47 | ! |
---|
48 | CHARACTER*(*) :: TARGET |
---|
49 | REAL :: def_val |
---|
50 | REAL :: ret_val |
---|
51 | CHARACTER*(*) :: comment |
---|
52 | |
---|
53 | ret_val=def_val |
---|
54 | call getin(TARGET,ret_val) |
---|
55 | |
---|
56 | IF (mpi_rank==0) THEN |
---|
57 | write(out_eff,*) '######################################' |
---|
58 | write(out_eff,*) '#### ',comment,' #####' |
---|
59 | write(out_eff,*) TARGET,'=',ret_val |
---|
60 | ENDIF |
---|
61 | |
---|
62 | END SUBROUTINE getparamr |
---|
63 | |
---|
64 | SUBROUTINE getparami(TARGET,def_val,ret_val,comment) |
---|
65 | USE parallel |
---|
66 | ! |
---|
67 | IMPLICIT NONE |
---|
68 | ! |
---|
69 | ! Get a real scalar. We first check if we find it |
---|
70 | ! in the database and if not we get it from the run.def |
---|
71 | ! |
---|
72 | ! getinr1d and getinr2d are written on the same pattern |
---|
73 | ! |
---|
74 | CHARACTER*(*) :: TARGET |
---|
75 | INTEGER :: def_val |
---|
76 | INTEGER :: ret_val |
---|
77 | CHARACTER*(*) :: comment |
---|
78 | |
---|
79 | ret_val=def_val |
---|
80 | call getin(TARGET,ret_val) |
---|
81 | |
---|
82 | IF (mpi_rank==0) THEN |
---|
83 | write(out_eff,*) '######################################' |
---|
84 | write(out_eff,*) '#### ',comment,' #####' |
---|
85 | write(out_eff,*) comment |
---|
86 | write(out_eff,*) TARGET,'=',ret_val |
---|
87 | ENDIF |
---|
88 | |
---|
89 | END SUBROUTINE getparami |
---|
90 | |
---|
91 | SUBROUTINE getparaml(TARGET,def_val,ret_val,comment) |
---|
92 | USE parallel |
---|
93 | ! |
---|
94 | IMPLICIT NONE |
---|
95 | ! |
---|
96 | ! Get a real scalar. We first check if we find it |
---|
97 | ! in the database and if not we get it from the run.def |
---|
98 | ! |
---|
99 | ! getinr1d and getinr2d are written on the same pattern |
---|
100 | ! |
---|
101 | CHARACTER*(*) :: TARGET |
---|
102 | LOGICAL :: def_val |
---|
103 | LOGICAL :: ret_val |
---|
104 | CHARACTER*(*) :: comment |
---|
105 | |
---|
106 | ret_val=def_val |
---|
107 | call getin(TARGET,ret_val) |
---|
108 | |
---|
109 | IF (mpi_rank==0) THEN |
---|
110 | write(out_eff,*) '######################################' |
---|
111 | write(out_eff,*) '#### ',comment,' #####' |
---|
112 | write(out_eff,*) TARGET,'=',ret_val |
---|
113 | ENDIF |
---|
114 | |
---|
115 | END SUBROUTINE getparaml |
---|
116 | |
---|
117 | |
---|
118 | END MODULE getparam |
---|