intersection with triangle plane for miss
[OpenFOAM-1.5.x.git] / etc / bashrc
blob313f8a66d0eed025e539e07adb7cfabd710efb73
1 #----------------------------------*-sh-*--------------------------------------
2 # =========                 |
3 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4 #  \\    /   O peration     |
5 #   \\  /    A nd           | Copyright (C) 1991-2008 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 the
13 #     Free Software Foundation; either version 2 of the License, or (at your
14 #     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, write to the Free Software Foundation,
23 #     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 # Script
26 #     etc/bashrc
28 # Description
29 #     Startup file for OpenFOAM
30 #     Sourced from ~/.profile or ~/.bashrc
31 #     Should be usable by any POSIX-compliant shell (eg, ksh)
33 #------------------------------------------------------------------------------
35 export WM_PROJECT=OpenFOAM
36 export WM_PROJECT_VERSION=1.5.x
38 #!!User:
39 #    either set $FOAM_INST_DIR before sourcing this file or set
40 #    $foamInstall below to where OpenFOAM is installed
42 # Location of FOAM installation
43 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
44 foamInstall=$HOME/$WM_PROJECT
45 # foamInstall=~$WM_PROJECT
46 # foamInstall=/usr/local/$WM_PROJECT
47 # foamInstall=/opt/$WM_PROJECT
49 : ${FOAM_INST_DIR:=$foamInstall}; export FOAM_INST_DIR
52 # Location of site/user files
53 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~
54 export WM_PROJECT_INST_DIR=$FOAM_INST_DIR
55 export WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/$WM_PROJECT-$WM_PROJECT_VERSION
56 export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
59 # Location of third-party software
60 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
61 export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/ThirdParty
64 # Operating System/Platform
65 # ~~~~~~~~~~~~~~~~~~~~~~~~~
66 # WM_OS = Unix | ????
67 : ${WM_OS:=Unix}; export WM_OS
70 # Compiler: set to Gcc, Gcc42 or Icc (for Intel's icc)
71 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72 : ${WM_COMPILER:=Gcc}; export WM_COMPILER
74 export WM_COMPILER_ARCH=
75 export WM_COMPILER_LIB_ARCH=
78 # Compilation options (architecture, precision, optimised, debug or profiling)
79 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
80 # WM_ARCH_OPTION = 32 | 64
81 : ${WM_ARCH_OPTION:=64}; export WM_ARCH_OPTION
83 # WM_PRECISION_OPTION = DP | SP
84 : ${WM_PRECISION_OPTION:=DP}; export WM_PRECISION_OPTION
86 # WM_COMPILE_OPTION = Opt | Debug | Prof
87 : ${WM_COMPILE_OPTION:=Opt}; export WM_COMPILE_OPTION
89 # WM_JAVAC_OPTION = Opt | Debug
90 : ${WM_JAVAC_OPTION:=Opt}; export WM_JAVAC_OPTION
92 # WM_MPLIB = | OPENMPI| LAM | MPICH | MPICH-GM | HPMPI | GAMMA | MPI | QSMPI
93 : ${WM_MPLIB:=OPENMPI}; export WM_MPLIB
96 # Run options (floating-point signal handling and memory initialisation)
97 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
98 export FOAM_SIGFPE=
99 # export FOAM_SETNAN=
102 # Detect system type and set environment variables appropriately
103 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
104 export WM_ARCH=`uname -s`
106 case $WM_ARCH in
107 Linux)
108     WM_ARCH=linux
110     # compiler specifics
111     case `uname -m` in
112     i686)
113         ;;
115     x86_64)
116         case $WM_ARCH_OPTION in
117         32)
118             export WM_COMPILER_ARCH='-64'
119             export WM_CC='gcc'
120             export WM_CXX='g++'
121             export WM_CFLAGS='-m32 -fPIC'
122             export WM_CXXFLAGS='-m32 -fPIC'
123             export WM_LDFLAGS='-m32'
124             ;;
125         64)
126             WM_ARCH=linux64
127             export WM_COMPILER_LIB_ARCH=64
128             export WM_CC='gcc'
129             export WM_CXX='g++'
130             export WM_CFLAGS='-m64 -fPIC'
131             export WM_CXXFLAGS='-m64 -fPIC'
132             export WM_LDFLAGS='-m64'
133             ;;
134         *)
135             echo Unknown WM_ARCH_OPTION $WM_ARCH_OPTION, should be 32 or 64
136             ;;
137         esac
138         ;;
140     ia64)
141         WM_ARCH=linuxIA64
142         export WM_COMPILER=I64
143         ;;
145     mips64)
146         WM_ARCH=SiCortex64
147         export WM_COMPILER_LIB_ARCH=64
148         export WM_CC='gcc'
149         export WM_CXX='g++'
150         export WM_CFLAGS='-mabi=64 -fPIC'
151         export WM_CXXFLAGS='-mabi=64 -fPIC'
152         export WM_LDFLAGS='-mabi=64 -G0'
153         export WM_MPLIB=MPI
154         ;;
156     ppc64)
157         WM_ARCH=linuxPPC64
158         export WM_COMPILER_LIB_ARCH=64
159         export WM_CC='gcc'
160         export WM_CXX='g++'
161         export WM_CFLAGS='-m64 -fPIC'
162         export WM_CXXFLAGS='-m64 -fPIC'
163         export WM_LDFLAGS='-m64'
164         ;;
166     *)
167         echo Unknown processor type `uname -m` for Linux
168         ;;
170     esac
171     ;;
173 SunOS)
174     WM_ARCH=SunOS64
175     export WM_COMPILER_LIB_ARCH=64
176     export WM_CC='gcc'
177     export WM_CXX='g++'
178     export WM_CFLAGS='-mabi=64 -fPIC'
179     export WM_CXXFLAGS='-mabi=64 -fPIC'
180     export WM_LDFLAGS='-mabi=64 -G0'
181     export WM_MPLIB=FJMPI
182     ;;
184 *)      # an unsupported operating system
185     cat <<USAGE
187     Your "$WM_ARCH" operating system is not supported by this release
188     of OpenFOAM. For further assistance, please contact www.openfoam.org
190 USAGE
191     ;;
192 esac
195 # Clean standard environment variables (PATH, MANPATH, LD_LIBRARY_PATH)
196 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
197 cleanProg=$WM_PROJECT_DIR/bin/foamCleanPath
199 # Remove anything under top-level foam directory
200 wildCards="$WM_PROJECT_INST_DIR $HOME/$WM_PROJECT/$USER"
202 #- Clean path/PATH
203 cleanPath=`$cleanProg "$PATH" "$wildCards"` && PATH="$cleanPath"
205 #- Clean LD_LIBRARY_PATH
206 cleanPath=`$cleanProg "$LD_LIBRARY_PATH" "$wildCards"` && LD_LIBRARY_PATH="$cleanPath"
208 #- Clean MANPATH
209 cleanPath=`$cleanProg "$MANPATH" "$wildCards"` && MANPATH="$cleanPath"
211 export PATH LD_LIBRARY_PATH MANPATH
213 # Source project setup files
214 # ~~~~~~~~~~~~~~~~~~~~~~~~~~
215 _foamSource()
217    while [ $# -ge 1 ]
218    do
219       [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "Sourcing: $1"
220       . $1
221       shift
222    done
226 _foamSource $WM_PROJECT_DIR/etc/settings.sh
227 _foamSource $WM_PROJECT_DIR/etc/aliases.sh
230 # Source user setup files for optional packages
231 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
232 # _foamSource $WM_PROJECT_DIR/etc/apps/paraview/bashrc
233 _foamSource $WM_PROJECT_DIR/etc/apps/paraview3/bashrc
234 # _foamSource $WM_PROJECT_DIR/etc/apps/ensightFoam/bashrc
235 _foamSource $WM_PROJECT_DIR/etc/apps/cint/bashrc
238 # Again clean environment (path, PATH, MANPATH, LD_LIBRARY_PATH)
239 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
240 #- Clean path/PATH. Only remove duplicates
241 cleanPath=`$cleanProg "$PATH"` && PATH="$cleanPath"
243 #- Clean LD_LIBRARY_PATH
244 cleanPath=`$cleanProg "$LD_LIBRARY_PATH"` && LD_LIBRARY_PATH="$cleanPath"
246 #- Clean MANPATH
247 cleanPath=`$cleanProg "$MANPATH"` && MANPATH="$cleanPath:"
249 export PATH LD_LIBRARY_PATH MANPATH
251 #- Clean LD_PRELOAD
252 if [ "$LD_PRELOAD" != "" ]; then
253     cleanPath=`$cleanProg "$LD_PRELOAD"` && LD_PRELOAD="$cleanPath"
254     export LD_PRELOAD
258 # cleanup environment:
259 # ~~~~~~~~~~~~~~~~~~~~
260 unset cleanPath cleanProg foamInstall
261 unset _foamSource
263 # -----------------------------------------------------------------------------