source: palm/trunk/SOURCE/local_getenv.f90 @ 1036

Last change on this file since 1036 was 1036, checked in by raasch, 9 years ago

code has been put under the GNU General Public License (v3)

  • Property svn:keywords set to Id
File size: 2.2 KB
Line 
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-2012  Leibniz University Hannover
18!--------------------------------------------------------------------------------!
19!
20! Current revisions:
21! -----------------
22!
23!
24! Former revisions:
25! -----------------
26! $Id: local_getenv.f90 1036 2012-10-22 13:43:42Z raasch $
27!
28! 82 2007-04-16 15:40:52Z raasch
29! Preprocessor directives for old systems removed
30!
31! RCS Log replace by Id keyword, revision history cleaned up
32!
33! Revision 1.5  2003/05/09 14:37:07  raasch
34! On the MUK cluster, only PE0 is able to read environment variables.
35! Therefore, they have to be communicated via broadcast to the other PEs.
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
46#if defined( __lcmuk )
47    USE pegrid
48#endif
49    CHARACTER (LEN=*) ::  var, value
50    INTEGER           ::  ivalue, ivar
51#if defined( __lcmuk )
52    INTEGER            ::  i, ia(20)
53#endif
54
55    CALL GETENV( var(1:ivar), value )
56    ivalue = LEN_TRIM( value )
57
58#if defined( __lcmuk )  &&  defined( __parallel )
59    ia = IACHAR( ' ' )
60    IF ( myid == 0 )  THEN
61       DO  i = 1, ivalue
62          ia(i) = IACHAR( value(i:i) )
63       ENDDO
64    ENDIF
65    CALL MPI_BCAST( ia(1), 20, MPI_INTEGER, 0, comm2d, ierr )
66    DO  i = 1, 20
67       IF ( ACHAR( ia(i) ) /= ' ' )  value(i:i) = ACHAR( ia(i) )
68    ENDDO
69    ivalue = LEN_TRIM( value )
70#endif
71 END SUBROUTINE local_getenv   
Note: See TracBrowser for help on using the repository browser.