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