[1682] | 1 | !> @file local_getenv.f90 |
---|
[1036] | 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 | ! |
---|
[1310] | 16 | ! Copyright 1997-2014 Leibniz Universitaet Hannover |
---|
[1036] | 17 | !--------------------------------------------------------------------------------! |
---|
| 18 | ! |
---|
[484] | 19 | ! Current revisions: |
---|
[1] | 20 | ! ----------------- |
---|
[1683] | 21 | ! |
---|
| 22 | ! |
---|
[1321] | 23 | ! Former revisions: |
---|
| 24 | ! ----------------- |
---|
| 25 | ! $Id: local_getenv.f90 1683 2015-10-07 23:57:51Z gronemeier $ |
---|
| 26 | ! |
---|
[1683] | 27 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 28 | ! Code annotations made doxygen readable |
---|
[1321] | 29 | ! 1320 2014-03-20 08:40:49Z raasch $ |
---|
[1320] | 30 | ! ONLY-attribute added to USE-statements, |
---|
| 31 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 32 | ! kinds are defined in new module kinds, |
---|
| 33 | ! revision history before 2012 removed, |
---|
| 34 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 35 | ! all variable declaration statements |
---|
[1] | 36 | ! |
---|
[1037] | 37 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 38 | ! code put under GPL (PALM 3.9) |
---|
| 39 | ! |
---|
[1] | 40 | ! Revision 1.1 1997/08/11 06:21:01 raasch |
---|
| 41 | ! Initial revision |
---|
| 42 | ! |
---|
| 43 | ! |
---|
| 44 | ! Description: |
---|
| 45 | ! ------------ |
---|
[1682] | 46 | !> Getting the values of environment-variabls (for different operating-systems) |
---|
[3] | 47 | !------------------------------------------------------------------------------! |
---|
[1682] | 48 | SUBROUTINE local_getenv( var, ivar, value, ivalue ) |
---|
| 49 | |
---|
[1] | 50 | |
---|
[1320] | 51 | USE kinds |
---|
| 52 | |
---|
[1] | 53 | #if defined( __lcmuk ) |
---|
| 54 | USE pegrid |
---|
| 55 | #endif |
---|
[1682] | 56 | CHARACTER (LEN=*) :: value !< |
---|
| 57 | CHARACTER (LEN=*) :: var !< |
---|
[1320] | 58 | |
---|
[1682] | 59 | INTEGER(iwp) :: ivalue !< |
---|
| 60 | INTEGER(iwp) :: ivar !< |
---|
[1] | 61 | #if defined( __lcmuk ) |
---|
[1682] | 62 | INTEGER(iwp) :: i !< |
---|
| 63 | INTEGER(iwp) :: ia(20) !< |
---|
[1] | 64 | #endif |
---|
| 65 | |
---|
| 66 | CALL GETENV( var(1:ivar), value ) |
---|
| 67 | ivalue = LEN_TRIM( value ) |
---|
| 68 | |
---|
| 69 | #if defined( __lcmuk ) && defined( __parallel ) |
---|
| 70 | ia = IACHAR( ' ' ) |
---|
| 71 | IF ( myid == 0 ) THEN |
---|
| 72 | DO i = 1, ivalue |
---|
| 73 | ia(i) = IACHAR( value(i:i) ) |
---|
| 74 | ENDDO |
---|
| 75 | ENDIF |
---|
| 76 | CALL MPI_BCAST( ia(1), 20, MPI_INTEGER, 0, comm2d, ierr ) |
---|
| 77 | DO i = 1, 20 |
---|
| 78 | IF ( ACHAR( ia(i) ) /= ' ' ) value(i:i) = ACHAR( ia(i) ) |
---|
| 79 | ENDDO |
---|
| 80 | ivalue = LEN_TRIM( value ) |
---|
| 81 | #endif |
---|
| 82 | END SUBROUTINE local_getenv |
---|