From 1025c3c4d348e1a67825f962efbde2d853da5cce Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 16 Jun 2008 10:39:22 +0200 Subject: [PATCH] eliminate .OpenFOAM-VERSION references in dotFoam and other files --- bin/mpirunDebug | 23 +++++++------- src/OSspecific/Unix/Unix.C | 20 +++---------- src/OpenFOAM/include/OSspecific.H | 2 -- wmake/wmakeLockScheduler | 50 +++++++++++++++++-------------- wmake/wmakeScheduler | 13 +++----- 5 files changed, 49 insertions(+), 59 deletions(-) diff --git a/bin/mpirunDebug b/bin/mpirunDebug index b0a53cdc63..eec1513439 100755 --- a/bin/mpirunDebug +++ b/bin/mpirunDebug @@ -80,27 +80,25 @@ $ECHO "Choose running method: 1)gdb+xterm 2)gdb 3)log 4)xterm+valgrind: \c" read method if [ "$method" -ne 1 -a "$method" -ne 2 -a "$method" -ne 3 -a "$method" -ne 4 ]; then printUsage - exit 1 + exit 1 fi $ECHO "Run all processes local or distributed? 1)local 2)remote: \c" read spawn if [ "$spawn" -ne 1 -a "$spawn" -ne 2 ]; then printUsage - exit 1 + exit 1 fi -# check ~/.OpenFOAM-VERSION -# check /etc -# check /.OpenFOAM-VERSION +# check ~/.$WM_PROJECT/$WM_PROJECT_VERSION/ +# check ~/.$WM_PROJECT/ +# check /etc/ if [ "$WM_PROJECT" ]; then - : ${FOAM_DOT_DIR:=.$WM_PROJECT-$WM_PROJECT_VERSION} - for i in \ - $HOME/$FOAM_DOT_DIR \ + $HOME/.WM_PROJECT/$WM_PROJECT_VERSION \ + $HOME/.WM_PROJECT \ $WM_PROJECT_DIR/etc \ - $WM_PROJECT_DIR/$FOAM_DOT_DIR \ ; do if [ -f "$i/bashrc" ]; then @@ -112,7 +110,12 @@ fi # Construct test string for remote execution. # Source OpenFOAM settings if OpenFOAM environment not set. -sourceFoam='[ "$WM_PROJECT" ] || . '"$sourceFoam" +# attempt to preserve the installation directory 'FOAM_INST_DIR' +if [ "$FOAM_INST_DIR" ]; then + sourceFoam='[ "$WM_PROJECT" ] || '"FOAM_INST_DIR=$FOAM_INST_DIR . $sourceFoam" +else + sourceFoam='[ "$WM_PROJECT" ] || '". $sourceFoam" +fi echo "**sourceFoam:$sourceFoam" diff --git a/src/OSspecific/Unix/Unix.C b/src/OSspecific/Unix/Unix.C index e50444a236..b2c89395e5 100644 --- a/src/OSspecific/Unix/Unix.C +++ b/src/OSspecific/Unix/Unix.C @@ -213,25 +213,13 @@ bool Foam::chDir(const fileName& dir) Foam::fileName Foam::dotFoam(const fileName& name) { - // Search for file 'name' in: - // 1) ~/.OpenFOAM-VERSION/, ~/.OpenFOAM/VERSION/ or ~/.OpenFOAM/ - // 2) $WM_PROJECT_INST_DIR/site/VERSION or $WM_PROJECT_INST_DIR/site/ - // 3) $WM_PROJECT_DIR/etc/ - // Search user files: // ~~~~~~~~~~~~~~~~~~ - // Check for user file in ~/.OpenFOAM-VERSION/ - fileName fullName = home()/(word(".OpenFOAM-") + FOAMversion)/name; - if (exists(fullName)) - { - return fullName; - } - fileName searchDir = home()/".OpenFOAM"; if (dir(searchDir)) { // Check for user file in ~/.OpenFOAM/VERSION - fullName = searchDir/FOAMversion/name; + fileName fullName = searchDir/FOAMversion/name; if (exists(fullName)) { return fullName; @@ -252,7 +240,7 @@ Foam::fileName Foam::dotFoam(const fileName& name) if (dir(searchDir)) { // Check for site file in $WM_PROJECT_INST_DIR/site/VERSION - fullName = searchDir/"site"/FOAMversion/name; + fileName fullName = searchDir/"site"/FOAMversion/name; if (exists(fullName)) { return fullName; @@ -272,14 +260,14 @@ Foam::fileName Foam::dotFoam(const fileName& name) if (dir(searchDir)) { // Check for shipped OpenFOAM file in $WM_PROJECT_DIR/etc - fullName = searchDir/"etc"/name; + fileName fullName = searchDir/"etc"/name; if (exists(fullName)) { return fullName; } } - // Nothing found + // Not found return fileName::null; } diff --git a/src/OpenFOAM/include/OSspecific.H b/src/OpenFOAM/include/OSspecific.H index d071cf6cd0..33e474cdf3 100644 --- a/src/OpenFOAM/include/OSspecific.H +++ b/src/OpenFOAM/include/OSspecific.H @@ -89,8 +89,6 @@ bool chDir(const fileName& dir); //- Search for @em name in the following hierarchy: // -# personal settings: -// - ~/.OpenFOAM-\ -// (old style) // - ~/.OpenFOAM/\/ // for version-specific files // - ~/.OpenFOAM/ diff --git a/wmake/wmakeLockScheduler b/wmake/wmakeLockScheduler index b8db7492f7..8182ad4b76 100755 --- a/wmake/wmakeLockScheduler +++ b/wmake/wmakeLockScheduler @@ -37,7 +37,8 @@ # Sources the relevant cshrc/bashrc if not set. # # WM_PROJECT_DIR, WM_PROJECT and WM_PROJECT_VERSION will have been set -# before calling this routine +# before calling this routine. +# FOAM_INST_DIR may possibly have been set (to find installation) # # Usage # wmakeScheduler COMMAND @@ -45,7 +46,7 @@ # # wmakeScheduler -count # count the total number of slots available in WM_HOSTS -# eg, WM_NCOMPPROCS=$(wmakeScheduler -count) +# eg, export WM_NCOMPPROCS=$(wmakeScheduler -count) # #------------------------------------------------------------------------------- lockDir=$HOME/.wmakeScheduler @@ -81,35 +82,40 @@ case $SHELL in ;; esac -# check ~/.$WM_PROJECT-$WM_PROJECT_VERSION/ # check ~/.$WM_PROJECT/$WM_PROJECT_VERSION/ # check ~/.$WM_PROJECT/ # check /etc/ -# check /dev/null; then # Set colour colour=${colours[$colourIndex]} - #echo "** host=$host colourIndex=$colourIndex colour=$colour" + ## echo "** host=$host colourIndex=$colourIndex colour=$colour" if [ "$host" = "$HOST" ]; then if [ "$colour" ]; then diff --git a/wmake/wmakeScheduler b/wmake/wmakeScheduler index 1be15abd87..14f4d90402 100755 --- a/wmake/wmakeScheduler +++ b/wmake/wmakeScheduler @@ -37,7 +37,8 @@ # Sources the relevant cshrc/bashrc if not set. # # WM_PROJECT_DIR, WM_PROJECT and WM_PROJECT_VERSION will have been set -# before calling this routine +# before calling this routine. +# FOAM_INST_DIR may possibly have been set (to find installation) # # Usage # wmakeScheduler COMMAND @@ -45,7 +46,7 @@ # # wmakeScheduler -count # count the total number of slots available in WM_HOSTS -# eg, WM_NCOMPPROCS=$(wmakeScheduler -count) +# eg, export WM_NCOMPPROCS=$(wmakeScheduler -count) # #------------------------------------------------------------------------------- lockDir=$HOME/.wmakeScheduler @@ -81,21 +82,15 @@ case $SHELL in ;; esac -# check ~/.$WM_PROJECT-$WM_PROJECT_VERSION/ # check ~/.$WM_PROJECT/$WM_PROJECT_VERSION/ # check ~/.$WM_PROJECT/ # check /etc/ -# check