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

Last change on this file since 1745 was 1683, checked in by knoop, 9 years ago

last commit documented

  • Property svn:keywords set to Id
File size: 2.5 KB
Line 
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!
22!
23! Former revisions:
24! -----------------
25! $Id: local_getenv.f90 1683 2015-10-07 23:57:51Z gronemeier $
26!
27! 1682 2015-10-07 23:56:08Z knoop
28! Code annotations made doxygen readable
29! 1320 2014-03-20 08:40:49Z raasch $
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
36!
37! 1036 2012-10-22 13:43:42Z raasch
38! code put under GPL (PALM 3.9)
39!
40! Revision 1.1  1997/08/11 06:21:01  raasch
41! Initial revision
42!
43!
44! Description:
45! ------------
46!> Getting the values of environment-variabls (for different operating-systems)
47!------------------------------------------------------------------------------!
48 SUBROUTINE local_getenv( var, ivar, value, ivalue )
49 
50
51    USE kinds
52       
53#if defined( __lcmuk )
54    USE pegrid
55#endif
56    CHARACTER (LEN=*) ::  value  !<
57    CHARACTER (LEN=*) ::  var    !<
58   
59    INTEGER(iwp)      ::  ivalue !<
60    INTEGER(iwp)      ::  ivar   !<
61#if defined( __lcmuk )
62    INTEGER(iwp)      ::  i      !<
63    INTEGER(iwp)      ::  ia(20) !<
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   
Note: See TracBrowser for help on using the repository browser.