BUG: directMappedPatchBase : split off nearInfo class
[OpenFOAM-1.7.x.git] / etc / bashrc
blobe0d9b73fee52d3e4ea31e0e710f49eec445bb8de
1 #----------------------------------*-sh-*--------------------------------------
2 # =========                 |
3 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4 #  \\    /   O peration     |
5 #   \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
6 #    \\/     M anipulation  |
7 #------------------------------------------------------------------------------
8 # License
9 #     This file is part of OpenFOAM.
11 #     OpenFOAM is free software: you can redistribute it and/or modify it
12 #     under the terms of the GNU General Public License as published by
13 #     the Free Software Foundation, either version 3 of the License, or
14 #     (at your option) any later version.
16 #     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 #     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 #     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19 #     for more details.
21 #     You should have received a copy of the GNU General Public License
22 #     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
24 # File
25 #     etc/bashrc
27 # Description
28 #     Startup file for OpenFOAM
29 #     Sourced from ~/.profile or ~/.bashrc
30 #     Should be usable by any POSIX-compliant shell (eg, ksh)
32 #------------------------------------------------------------------------------
34 export WM_PROJECT=OpenFOAM
35 export WM_PROJECT_VERSION=1.7.x
37 ################################################################################
38 # USER EDITABLE PART. Note changes made here may be lost with the next upgrade
40 # either set $FOAM_INST_DIR before sourcing this file or set
41 #    $foamInstall below to where OpenFOAM is installed
43 # Location of the OpenFOAM installation
44 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45 foamInstall=$HOME/$WM_PROJECT
46 # foamInstall=~$WM_PROJECT
47 # foamInstall=/usr/local/$WM_PROJECT
48 # foamInstall=/opt/$WM_PROJECT
50 # END OF (NORMAL) USER EDITABLE PART
51 ################################################################################
53 # note the location for later use (eg, in job scripts)
54 : ${FOAM_INST_DIR:=$foamInstall}; export FOAM_INST_DIR
56 # The old dirs to be cleaned from the various environment variables
57 # - remove anything under top-level directory.
58 # NB: the WM_PROJECT_INST_DIR might not be identical between versions
59 foamOldDirs="$FOAM_INST_DIR $HOME/$WM_PROJECT/$USER"
60 if [ "$WM_PROJECT_INST_DIR" != "$FOAM_INST_DIR" ]
61 then
62     foamOldDirs="$WM_PROJECT_INST_DIR $foamOldDirs"
66 # Location of site/user files
67 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~
68 export WM_PROJECT_INST_DIR=$FOAM_INST_DIR
69 export WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/$WM_PROJECT-$WM_PROJECT_VERSION
70 export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
72 # Location of third-party software
73 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
74 export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION
77 # Source files, possibly with some verbosity
78 _foamSource()
80    while [ $# -ge 1 ]
81    do
82       [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "Sourcing: $1"
83       . $1
84       shift
85    done
89 # Add in preset user or site preferences:
90 foamPrefs=`$WM_PROJECT_DIR/bin/foamEtcFile prefs.sh` && _foamSource $foamPrefs
91 unset foamPrefs
93 # Evaluate command-line parameters
94 while [ $# -gt 0 ]
96     case "$1" in
97     *=)
98         # name=       -> unset name
99         eval "unset ${1%=}"
100         ;;
101     *=*)
102         # name=value  -> export name=value
103         eval "export $1"
104         ;;
105     esac
106     shift
107 done
110 # Operating System/Platform
111 # ~~~~~~~~~~~~~~~~~~~~~~~~~
112 # WM_OSTYPE = POSIX | ????
113 : ${WM_OSTYPE:=POSIX}; export WM_OSTYPE
116 # Compiler: set to Gcc, Gcc43, Gcc44, or Icc (for Intel's icc)
117 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
118 : ${WM_COMPILER:=Gcc}; export WM_COMPILER
120 unset WM_COMPILER_ARCH WM_COMPILER_LIB_ARCH
123 # Compilation options (architecture, precision, optimised, debug or profiling)
124 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
125 # WM_ARCH_OPTION = 32 | 64
126 : ${WM_ARCH_OPTION:=64}; export WM_ARCH_OPTION
128 # WM_PRECISION_OPTION = DP | SP
129 : ${WM_PRECISION_OPTION:=DP}; export WM_PRECISION_OPTION
131 # WM_COMPILE_OPTION = Opt | Debug | Prof
132 : ${WM_COMPILE_OPTION:=Opt}; export WM_COMPILE_OPTION
134 # WM_MPLIB = SYSTEMOPENMPI | OPENMPI | MPICH | MPICH-GM | HPMPI | MPI | QSMPI
135 : ${WM_MPLIB:=OPENMPI}; export WM_MPLIB
138 # Run options (floating-point signal handling and memory initialisation)
139 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
140 export FOAM_SIGFPE=
141 # export FOAM_SETNAN=
144 # Detect system type and set environment variables appropriately
145 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
146 export WM_ARCH=`uname -s`
148 case $WM_ARCH in
149 Linux)
150     WM_ARCH=linux
152     # compiler specifics
153     case `uname -m` in
154     i686)
155         ;;
157     x86_64)
158         case $WM_ARCH_OPTION in
159         32)
160             export WM_COMPILER_ARCH='-64'
161             export WM_CC='gcc'
162             export WM_CXX='g++'
163             export WM_CFLAGS='-m32 -fPIC'
164             export WM_CXXFLAGS='-m32 -fPIC'
165             export WM_LDFLAGS='-m32'
166             ;;
167         64)
168             WM_ARCH=linux64
169             export WM_COMPILER_LIB_ARCH=64
170             export WM_CC='gcc'
171             export WM_CXX='g++'
172             export WM_CFLAGS='-m64 -fPIC'
173             export WM_CXXFLAGS='-m64 -fPIC'
174             export WM_LDFLAGS='-m64'
175             ;;
176         *)
177             echo "Unknown WM_ARCH_OPTION '$WM_ARCH_OPTION', should be 32 or 64"
178             ;;
179         esac
180         ;;
182     ia64)
183         WM_ARCH=linuxIA64
184         export WM_COMPILER=I64
185         ;;
187     mips64)
188         WM_ARCH=SiCortex64
189         export WM_COMPILER_LIB_ARCH=64
190         export WM_CC='gcc'
191         export WM_CXX='g++'
192         export WM_CFLAGS='-mabi=64 -fPIC'
193         export WM_CXXFLAGS='-mabi=64 -fPIC'
194         export WM_LDFLAGS='-mabi=64 -G0'
195         export WM_MPLIB=MPI
196         ;;
198     ppc64)
199         WM_ARCH=linuxPPC64
200         export WM_COMPILER_LIB_ARCH=64
201         export WM_CC='gcc'
202         export WM_CXX='g++'
203         export WM_CFLAGS='-m64 -fPIC'
204         export WM_CXXFLAGS='-m64 -fPIC'
205         export WM_LDFLAGS='-m64'
206         ;;
208     *)
209         echo Unknown processor type `uname -m` for Linux
210         ;;
211     esac
212     ;;
214 SunOS)
215     WM_ARCH=SunOS64
216     export WM_COMPILER_LIB_ARCH=64
217     export WM_CC='gcc'
218     export WM_CXX='g++'
219     export WM_CFLAGS='-mabi=64 -fPIC'
220     export WM_CXXFLAGS='-mabi=64 -fPIC'
221     export WM_LDFLAGS='-mabi=64 -G0'
222     export WM_MPLIB=FJMPI
223     ;;
225 *)    # an unsupported operating system
226     cat <<USAGE
228     Your "$WM_ARCH" operating system is not supported by this release
229     of OpenFOAM. For further assistance, please contact www.OpenFOAM.com
231 USAGE
232     ;;
233 esac
236 # Clean standard environment variables (PATH, LD_LIBRARY_PATH, MANPATH)
237 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
238 foamClean=$WM_PROJECT_DIR/bin/foamCleanPath
240 #- Clean PATH
241 cleaned=`$foamClean "$PATH" "$foamOldDirs"` && PATH="$cleaned"
243 #- Clean LD_LIBRARY_PATH
244 cleaned=`$foamClean "$LD_LIBRARY_PATH" "$foamOldDirs"` && LD_LIBRARY_PATH="$cleaned"
246 #- Clean MANPATH
247 cleaned=`$foamClean "$MANPATH" "$foamOldDirs"` && MANPATH="$cleaned"
249 export PATH LD_LIBRARY_PATH MANPATH
252 # Source project setup files
253 # ~~~~~~~~~~~~~~~~~~~~~~~~~~
254 _foamSource $WM_PROJECT_DIR/etc/settings.sh
255 _foamSource $WM_PROJECT_DIR/etc/aliases.sh
258 # Source user setup files for optional packages
259 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
260 paraview3=`$WM_PROJECT_DIR/bin/foamEtcFile apps/paraview3/bashrc` \
261     && _foamSource $paraview3
262 unset paraview3
264 ensight=`$WM_PROJECT_DIR/bin/foamEtcFile apps/ensight/bashrc` \
265     && _foamSource $ensight
266 unset ensight
269 # Clean environment paths again. Only remove duplicates
270 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
271 #- Clean PATH
272 cleaned=`$foamClean "$PATH"` && PATH="$cleaned"
274 #- Clean LD_LIBRARY_PATH
275 cleaned=`$foamClean "$LD_LIBRARY_PATH"` && LD_LIBRARY_PATH="$cleaned"
277 #- Clean MANPATH (trailing ':' to find system pages)
278 cleaned=`$foamClean "$MANPATH"`: && MANPATH="$cleaned"
280 export PATH LD_LIBRARY_PATH MANPATH
282 #- Clean LD_PRELOAD
283 if [ -n "$LD_PRELOAD" ]
284 then
285     cleaned=`$foamClean "$LD_PRELOAD"` && LD_PRELOAD="$cleaned"
286     export LD_PRELOAD
290 # cleanup environment:
291 # ~~~~~~~~~~~~~~~~~~~~
292 unset cleaned foamClean foamInstall foamOldDirs
293 unset _foamSource
295 # ----------------------------------------------------------------- end-of-file