Removed dependency on objectRegistry in constructor
[foam-extend-3.0.git] / etc / cshrc
blobc2a760d8b5ee47969b7c5429687054da71eb78a4
1 #----------------------------------*-sh-*--------------------------------------
2 # =========                 |
3 # \\      /  F ield         | foam-extend: Open Source CFD
4 #  \\    /   O peration     |
5 #   \\  /    A nd           | For copyright notice see file Copyright
6 #    \\/     M anipulation  |
7 #------------------------------------------------------------------------------
8 # License
9 #     This file is part of foam-extend.
11 #     foam-extend 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 3 of the License, or (at your
14 #     option) any later version.
16 #     foam-extend is distributed in the hope that it will be useful, but
17 #     WITHOUT ANY WARRANTY; without even the implied warranty of
18 #     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 #     General Public License for more details.
21 #     You should have received a copy of the GNU General Public License
22 #     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 # Script
25 #     etc/cshrc
27 # Description
28 #     Startup file for OpenFOAM
29 #     Sourced from ~/.login or ~/.cshrc
31 #------------------------------------------------------------------------------
33 setenv WM_PROJECT foam
34 setenv WM_FORK extend
35 setenv WM_PROJECT_VERSION 3.0
37 # helps to easily write #ifdefs to detect a foam-extend version
38 setenv FOAM_DEV 1
40 ###############################################################################
41 # USER EDITABLE PART
43 #    either setenv FOAM_INST_DIR before sourcing this file or set
44 #    foamInstall below to where FOAM is installed
46 # Location of FOAM installation
47 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
48 set foamInstall = $HOME/$WM_PROJECT
49 # set foamInstall = ~$WM_PROJECT
50 # set foamInstall = /usr/local/$WM_PROJECT
51 # set foamInstall = /opt/$WM_PROJECT
53 # END OF (NORMAL) USER EDITABLE PART
54 ###############################################################################
56 # note the location for later use (eg, in job scripts)
57 if ( ! $?FOAM_INST_DIR ) setenv FOAM_INST_DIR $foamInstall
59 # The old dirs to be cleaned from the various environment variables
60 # - remove anything under top-level directory.
61 # NB: the WM_PROJECT_INST_DIR might not be identical between versions
62 set foamOldDirs="$FOAM_INST_DIR $HOME/$WM_PROJECT/$LOGNAME"
64 # Location of site/user files
65 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~
66 setenv WM_PROJECT_INST_DIR $FOAM_INST_DIR
67 setenv WM_PROJECT_DIR $WM_PROJECT_INST_DIR/$WM_PROJECT-$WM_FORK-$WM_PROJECT_VERSION
68 setenv WM_PROJECT_USER_DIR $HOME/$WM_PROJECT/$LOGNAME-$WM_PROJECT_VERSION
71 # Location of third-party software
72 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73 #setenv WM_THIRD_PARTY_DIR $WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION
74 setenv WM_THIRD_PARTY_DIR $WM_PROJECT_DIR/ThirdParty
76 # Source files, possibly with some verbosity
77 alias _foamSource 'if ($?FOAM_VERBOSE && $?prompt) echo "Sourcing: \!*"; source \!*'
79 # Add in preset user or site preferences:
80 if ( -e $WM_PROJECT_DIR/etc/prefs.csh ) then
81     _foamSource $WM_PROJECT_DIR/etc/prefs.csh
82 else
83     if ($?FOAM_VERBOSE && $?prompt) echo "No prefs.csh found"
84 endif
86 # Evaluate command-line parameters
87 while ( $#argv > 0 )
88     switch ($argv[1])
89     case *=:
90         # name=       -> unsetenv name
91         eval "unsetenv $argv[1]:s/=//"
92         breaksw
93     case *=*:
94         # name=value  -> setenv name value
95         eval "setenv $argv[1]:s/=/ /"
96         breaksw
97     endsw
98     shift
99 end
102 # Operating System/Platform
103 # ~~~~~~~~~~~~~~~~~~~~~~~~~
104 # WM_OSTYPE = POSIX | ????
105 if ( ! $?WM_OSTYPE ) setenv WM_OSTYPE POSIX
108 # Compiler: set to Gcc, Gcc43 or Icc (for Intel's icc)
109 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
110 if ( ! $?WM_COMPILER ) setenv WM_COMPILER Gcc
111 #setenv WM_COMPILER Gcc
112 #setenv WM_COMPILER Icc
114 setenv WM_COMPILER_ARCH
115 setenv WM_COMPILER_LIB_ARCH
118 # Compilation options (architecture, precision, optimised, debug or profiling)
119 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
120 # WM_ARCH_OPTION = 32 | 64
121 if ( ! $?WM_ARCH_OPTION ) setenv WM_ARCH_OPTION 64
123 # WM_PRECISION_OPTION = DP | SP
124 if ( ! $?WM_PRECISION_OPTION ) setenv WM_PRECISION_OPTION DP
126 # WM_COMPILE_OPTION = Opt | Debug | Prof
127 if ( ! $?WM_COMPILE_OPTION ) setenv WM_COMPILE_OPTION Opt
128 #setenv WM_COMPILE_OPTION Opt
129 #setenv WM_COMPILE_OPTION Debug
131 # WM_MPLIB = SYSTEMOPENMPI | OPENMPI | MPICH | MPICH-GM | HPMPI | GAMMA | MPI | QSMPI
132 if ( ! $?WM_MPLIB ) setenv WM_MPLIB OPENMPI
134 # WM_NCOMPPROCS = <number of processes to use>
135 # Warning: Need to use a complete path for foamGetSystemInfo because the PATH
136 # environment variable is not properly initialized yet.
137 if ( ! $?WM_NCOMPPROCS ) setenv WM_NCOMPPROCS `$WM_PROJECT_DIR/bin/foamGetSystemInfo -nbrCores`
139 # Run options (floating-point signal handling and memory initialisation)
140 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
141 setenv FOAM_SIGFPE
142 # setenv FOAM_SETNAN
145 # Detect system type and set environment variables
146 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
147 setenv WM_ARCH `uname -s`
149 switch ($WM_ARCH)
150 case Linux:
151     setenv WM_ARCH linux
153     switch (`uname -m`)
154     case i686:
155         breaksw
157     case x86_64:
158         switch ($WM_ARCH_OPTION)
159         case 32:
160             setenv WM_ARCH linux
161             setenv WM_COMPILER_ARCH '-64'
162             setenv WM_CFLAGS '-m32 -fPIC'
163             setenv WM_CXXFLAGS '-m32 -fPIC'
164             setenv WM_LDFLAGS '-m32'
165             breaksw
167         case 64:
168             setenv WM_ARCH linux64
169             setenv WM_COMPILER_LIB_ARCH 64
170             setenv WM_CFLAGS '-m64 -fPIC'
171             setenv WM_CXXFLAGS '-m64 -fPIC'
172             setenv WM_LDFLAGS '-m64'
173             breaksw
175         default:
176             echo Unknown WM_ARCH_OPTION $WM_ARCH_OPTION, should be 32 or 64
177             breaksw
179         endsw
180         breaksw
182     case ia64:
183         setenv WM_ARCH linuxIA64
184         setenv WM_COMPILER I64
185         breaksw
187     case mips64:
188         setenv WM_ARCH SiCortex64
189         setenv WM_COMPILER_LIB_ARCH 64
190         setenv WM_CFLAGS '-mabi=64 -fPIC'
191         setenv WM_CXXFLAGS '-mabi=64 -fPIC'
192         setenv WM_LDFLAGS '-mabi=64 -G0'
193         setenv WM_MPLIB MPI
194         ;;
196     case ppc64:
197         setenv WM_ARCH linuxPPC64
198         setenv WM_COMPILER_LIB_ARCH 64
199         setenv WM_CFLAGS '-m64 -fPIC'
200         setenv WM_CXXFLAGS '-m64 -fPIC'
201         setenv WM_LDFLAGS '-m64'
202         breaksw
204     default:
205         echo Unknown processor type `uname -m` for Linux
206         breaksw
208     endsw
209     breaksw
211 case Darwin:
212     # this makes certain things easier
213     setenv WM_ARCH_BASE darwin
215     # Remove limit on number of open files
216     ulimit -n 1000
218     switch (`uname -p`)
219     case powerpc:
220         setenv WM_ARCH darwinPpc
221         breaksw
222     case i386:
223         setenv WM_ARCH darwinIntel
224         breaksw
225     default:
226         echo "This seems to be an Intel-Mac please tell me the output of 'uname -p'. Bernhard."
227         setenv WM_ARCH darwinIntel
228         breaksw
229     endsw
230     switch ($WM_ARCH_OPTION)
231     case 32:
232         setenv WM_CFLAGS '-m32 -fPIC'
233         setenv WM_CXXFLAGS '-m32 -fPIC'
234         setenv WM_LDFLAGS '-m32'
235         breaksw;
236     case 64:
237         setenv WM_ARCH ${WM_ARCH}64
238         setenv WM_CFLAGS '-m64 -fPIC'
239         setenv WM_CXXFLAGS '-m64 -fPIC'
240         setenv WM_LDFLAGS '-m64'
241         breaksw;
242     default:
243         echo "Unknown WM_ARCH_OPTION $WM_ARCH_OPTION, should be 32 or 64"
244         breaksw
245     endsw
247     # Make sure that binaries use the best features of the used OS-Version
248     # We need to get rid of the revision number from this string. eg turn "10.7.5" into "10.7"
249     set v=`sw_vers -productVersion | sed 's/\./ /g'`
250     setenv MACOSX_DEPLOYMENT_TARGET "$v[1].$v[2]"
252     # Use Mac-Ports-Compiler instead of Apple-gcc-4.2
253     if ( ! $?compilerInstall ) setenv compilerInstall System
254     if ( $compilerInstall == "System" ) then
255     switch ($WM_COMPILER)
256     case Gcc43:
257         setenv WM_CC 'gcc-mp-4.3'
258         setenv WM_CXX 'g++-mp-4.3'
259         breaksw;
260     case Gcc44:
261         setenv WM_CC 'gcc-mp-4.4'
262         setenv WM_CXX 'g++-mp-4.4'
263         breaksw;
264     case Gcc45:
265         setenv WM_CC 'gcc-mp-4.5'
266         setenv WM_CXX 'g++-mp-4.5'
267         breaksw;
268     endsw
269         #setenv WM_COMPILER ""
270     endif
272     breaksw
274 case SunOS:
275     setenv WM_ARCH SunOS64
276     setenv WM_COMPILER_LIB_ARCH 64
277     setenv WM_CFLAGS '-mabi=64 -fPIC'
278     setenv WM_CXXFLAGS '-mabi=64 -fPIC'
279     setenv WM_LDFLAGS '-mabi=64 -G0'
280     setenv WM_MPLIB FJMPI
281     breaksw
283 default:
284     echo
285     echo "Your '$WM_ARCH' operating system is not supported by this release"
286     echo "of OpenFOAM. For further assistance, please contact www.OpenFOAM.org"
287     echo
288     breaksw
290 endsw
293 # Clean standard environment variables (path/PATH, LD_LIBRARY_PATH, MANPATH)
294 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
295 set cleanProg=$WM_PROJECT_DIR/bin/foamCleanPath
297 if (! $?LD_LIBRARY_PATH ) then
298     setenv LD_LIBRARY_PATH ''
299 endif
300 if (! $?MANPATH) then
301     setenv MANPATH ''
302 endif
304 #- Clean path/PATH
305 set colonPath=`echo "$path" | sed -e 's/ /:/g'`
306 set cleanEnv=`$cleanProg "$colonPath" "$foamOldDirs"`
307 if ( $status == 0 ) then
308     set path=`echo "$cleanEnv" | sed -e 's/:/ /g'`
309 endif
311 #- Clean LD_LIBRARY_PATH
312 setenv LD_LIBRARY_PATH `$cleanProg "$LD_LIBRARY_PATH" "$foamOldDirs"`
314 #- Clean MANPATH
315 setenv MANPATH `$cleanProg "$MANPATH" "$foamOldDirs"`
318 # Source project setup files
319 # ~~~~~~~~~~~~~~~~~~~~~~~~~~
320 _foamSource $WM_PROJECT_DIR/etc/settings.csh
321 _foamSource $WM_PROJECT_DIR/etc/aliases.csh
323 # Source user setup files for optional packages
324 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
325 # _foamSource $WM_PROJECT_DIR/etc/apps/paraview/cshrc
326 #_foamSource $WM_PROJECT_DIR/etc/apps/paraview3/cshrc
327 # _foamSource $WM_PROJECT_DIR/etc/apps/ensight/cshrc
330 # Clean environment paths again. Only remove duplicates
331 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
332 #- Clean path/PATH
333 set colonPath=`echo "$path" | sed -e 's/ /:/g'`
334 set cleanEnv=`$cleanProg "$colonPath"`
335 if ( $status == 0 ) then
336     set path=`echo "$cleanEnv" | sed -e 's/:/ /g'`
337 endif
339 #- Clean LD_LIBRARY_PATH
340 setenv LD_LIBRARY_PATH `$cleanProg "$LD_LIBRARY_PATH"`
342 #- Clean MANPATH
343 setenv MANPATH `$cleanProg "$MANPATH"`:
345 #- Clean LD_PRELOAD
346 if ( $?LD_PRELOAD ) then
347     setenv LD_PRELOAD `$cleanProg "$LD_PRELOAD"`
348 endif
350 #- Clean DYLD_LIBRARY_PATH
351 if ( $?DYLD_LIBRARY_PATH ) then
352     setenv DYLD_LIBRARY_PATH `$cleanProg "$DYLD_LIBRARY_PATH"`
353 endif
355 # cleanup environment:
356 # ~~~~~~~~~~~~~~~~~~~~
357 unset cleanEnv cleanProg colonPath foamInstall foamOldDirs
358 unalias _foamSource
360 # -----------------------------------------------------------------------------