1 | SUBROUTINE local_getenv( var, ivar, value, ivalue ) |
---|
2 | |
---|
3 | !--------------------------------------------------------------------------------! |
---|
4 | ! This file is part of PALM. |
---|
5 | ! |
---|
6 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
7 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
8 | ! either version 3 of the License, or (at your option) any later version. |
---|
9 | ! |
---|
10 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
11 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
12 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
13 | ! |
---|
14 | ! You should have received a copy of the GNU General Public License along with |
---|
15 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
16 | ! |
---|
17 | ! Copyright 1997-2014 Leibniz Universitaet Hannover |
---|
18 | !--------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! Former revisions: |
---|
24 | ! ----------------- |
---|
25 | ! $Id: local_getenv.f90 1321 2014-03-20 09:40:40Z maronga $ |
---|
26 | ! |
---|
27 | ! 1320 2014-03-20 08:40:49Z raasch $ |
---|
28 | ! ONLY-attribute added to USE-statements, |
---|
29 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
30 | ! kinds are defined in new module kinds, |
---|
31 | ! revision history before 2012 removed, |
---|
32 | ! comment fields (!:) to be used for variable explanations added to |
---|
33 | ! all variable declaration statements |
---|
34 | ! |
---|
35 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
36 | ! code put under GPL (PALM 3.9) |
---|
37 | ! |
---|
38 | ! Revision 1.1 1997/08/11 06:21:01 raasch |
---|
39 | ! Initial revision |
---|
40 | ! |
---|
41 | ! |
---|
42 | ! Description: |
---|
43 | ! ------------ |
---|
44 | ! Getting the values of environment-variabls (for different operating-systems) |
---|
45 | !------------------------------------------------------------------------------! |
---|
46 | |
---|
47 | USE kinds |
---|
48 | |
---|
49 | #if defined( __lcmuk ) |
---|
50 | USE pegrid |
---|
51 | #endif |
---|
52 | CHARACTER (LEN=*) :: value !: |
---|
53 | CHARACTER (LEN=*) :: var !: |
---|
54 | |
---|
55 | INTEGER(iwp) :: ivalue !: |
---|
56 | INTEGER(iwp) :: ivar !: |
---|
57 | #if defined( __lcmuk ) |
---|
58 | INTEGER(iwp) :: i !: |
---|
59 | INTEGER(iwp) :: ia(20) !: |
---|
60 | #endif |
---|
61 | |
---|
62 | CALL GETENV( var(1:ivar), value ) |
---|
63 | ivalue = LEN_TRIM( value ) |
---|
64 | |
---|
65 | #if defined( __lcmuk ) && defined( __parallel ) |
---|
66 | ia = IACHAR( ' ' ) |
---|
67 | IF ( myid == 0 ) THEN |
---|
68 | DO i = 1, ivalue |
---|
69 | ia(i) = IACHAR( value(i:i) ) |
---|
70 | ENDDO |
---|
71 | ENDIF |
---|
72 | CALL MPI_BCAST( ia(1), 20, MPI_INTEGER, 0, comm2d, ierr ) |
---|
73 | DO i = 1, 20 |
---|
74 | IF ( ACHAR( ia(i) ) /= ' ' ) value(i:i) = ACHAR( ia(i) ) |
---|
75 | ENDDO |
---|
76 | ivalue = LEN_TRIM( value ) |
---|
77 | #endif |
---|
78 | END SUBROUTINE local_getenv |
---|