From 583905fdebf8a2efbf0215d869a1068c361be718 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 6 Aug 2020 17:50:44 +0200 Subject: [PATCH 1/7] BUG: directory information spoils "wmake -show-cxx" (fixes #1799) - the various information queries MUST be executed with the '--no-print-directory' or risk polluting values in the information queries. This is mostly seen with the 'canCompile' test for tutorials running in parallel. --- wmake/wmake | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/wmake/wmake b/wmake/wmake index 89f0fcd061..572fea8256 100755 --- a/wmake/wmake +++ b/wmake/wmake @@ -177,6 +177,8 @@ die() # Default make is the "make" in the path make="make" +# Print compiler/system information (serial only) +printInfo() { make --no-print-directory -f "$WM_DIR"/makefiles/info "$@"; } #------------------------------------------------------------------------------ @@ -268,11 +270,11 @@ do -show-api | -show-ext-so | \ -show-compile-c | -show-c | -show-cflags | -show-cflags-arch | \ -show-compile-cxx | -show-cxx | -show-cxxflags | -show-cxxflags-arch ) - $make -f $WM_DIR/makefiles/info "${1#-show-}" + printInfo "${1#-show-}" optShow=true ;; -show-path-c | -show-path-cxx ) - command -v $($make -f $WM_DIR/makefiles/info "${1#-show-path-}") + command -v $(printInfo "${1#-show-path-}") optShow=true ;; -a | -all | all) @@ -323,7 +325,7 @@ do : "${optAll:=all}" # implies 'all', unless previously set ;; -version | --version) - $make -f $WM_DIR/makefiles/info api + printInfo api optShow=true break; ;; From dd1c2edb6b744553b6f4a706b590fd4514e7cf09 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 12 Aug 2020 12:15:27 +0200 Subject: [PATCH 2/7] COMP: wmake findObjectDir fails for non-project directories (fixes #1807) - experienced while reusing src/Pstream/Allwmake-mpi to create additional mpi-layers after installation. Since the copied sources are not located within the OpenFOAM source-tree (and/or the source-tree is non-writable), it should not and does not use the central build/WM_OPTIONS directory. However, when exploring for the appropriate local Make directory, it searched for the current '.' directory instead of checking for the resolved directory. This fails, since there is no src/Pstream/Make directory. Must check for src/Pstream/mpi/Make directory first! - Adjust wclean to always remove a local build directory (Make/WM_OPTIONS) for additional safety. After which, attempt to remove central build/WM_OPTIONS version too. --- wmake/scripts/wmakeFunctions | 17 +++++++++++------ wmake/wclean | 20 +++++++++++--------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/wmake/scripts/wmakeFunctions b/wmake/scripts/wmakeFunctions index 72322448f6..89134c835a 100644 --- a/wmake/scripts/wmakeFunctions +++ b/wmake/scripts/wmakeFunctions @@ -173,13 +173,18 @@ findObjectDir() # Default (local) build directory if [ -z "$objectsDir" ] then - relativeDir="$absdir" - appDir=. - [ -d Make ] || appDir=$(findTarget .) || exit 1 # Fatal - absdir=$(expandPath "$appDir"/.) + if [ -d "$absdir/Make" ] + then + objectsDir="${absdir}/Make/${WM_OPTIONS}" + else + relativeDir="$absdir" + appDir=. + [ -d Make ] || appDir=$(findTarget .) || exit 1 # Fatal + absdir=$(expandPath "$appDir"/.) - relativeDir="${relativeDir#${absdir}}" - objectsDir="${appDir}/Make/${WM_OPTIONS}${relativeDir}" + relativeDir="${relativeDir#${absdir}}" + objectsDir="${appDir}/Make/${WM_OPTIONS}${relativeDir}" + fi fi echo "$objectsDir" diff --git a/wmake/wclean b/wmake/wclean index 53712bfadd..ca2fe7f81c 100755 --- a/wmake/wclean +++ b/wmake/wclean @@ -313,16 +313,18 @@ fi # Clean the 'Make' directory if present #------------------------------------------------------------------------------ -if [ -d "$MakeDir" ] +if [ -d "$MakeDir" ] && [ -n "$WM_OPTIONS" ] then - objectsDir="$MakeDir/$WM_OPTIONS" - case "$PWD" in - ("$WM_PROJECT_DIR"/*) - buildPath="$WM_PROJECT_DIR/build/${WM_OPTIONS}" - objectsDir=$buildPath$(echo $PWD | sed s%$WM_PROJECT_DIR%% ) - ;; - esac - rm -rf "$objectsDir" 2>/dev/null + # Remove in-source directory (if any) + rm -rf "$MakeDir/$WM_OPTIONS" 2>/dev/null + + # Remove out-of-source directory (if applicable) + relativeDir="${PWD#${WM_PROJECT_DIR}/}" + if [ "$relativeDir" != "$PWD" ] + then + objectsDir="${WM_PROJECT_DIR}/build/${WM_OPTIONS}/${relativeDir}" + rm -rf "$objectsDir" 2>/dev/null + fi fi #------------------------------------------------------------------------------ From fa364eda1276890e90c50767ac0f3b906dab64aa Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 31 Aug 2020 10:04:20 +0200 Subject: [PATCH 3/7] BUG: inconsistency between constructor and output (fixes #1816) - slipped in with changes to csvTableReader (commit 59ed3ba18d1a) so only affects the 2006 version. - adjust constructor to expect "componentColumns", but also accept "valueColumns" as 1912 and earlier-compatibility. This not only fixes the reported bug, but also ensure proper compatibility with older files. ENH: use "refColumn" instead of "timeColumn" for csvTableReader - consistent with the CSV Function1. Support 'timeColumn' as 1912 and earlier-compatibility. TUT: remove unused table-reader entry --- .../interpolationTable/interpolationTable.H | 11 +++++------ .../tableReaders/csv/csvTableReader.C | 14 +++++++++----- .../tableReaders/csv/csvTableReader.H | 1 + .../primitives/functions/Function1/CSV/CSV.C | 2 +- .../pimpleFoam/RAS/TJunctionFan/0.orig/p | 1 - 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/OpenFOAM/interpolations/interpolationTable/interpolationTable.H b/src/OpenFOAM/interpolations/interpolationTable/interpolationTable.H index 934976ffcb..a90dc1b834 100644 --- a/src/OpenFOAM/interpolations/interpolationTable/interpolationTable.H +++ b/src/OpenFOAM/interpolations/interpolationTable/interpolationTable.H @@ -43,14 +43,13 @@ Description Read csv format: \verbatim - readerType csv; - file "/p0vsTime.csv"; - hasHeaderLine true; // skip first line - timeColumn 0; // time is in column 0 - valueColumns (1); // value starts in column 1 + readerType csv; + file "/p0vsTime.csv"; + hasHeaderLine true; // skip first line + refColumn 0; // reference (eg, time) is in column 0 + componentColumns (1); // component values starts in column 1 \endverbatim - Note - Accessing an empty list results in an error. - Accessing a list with a single element always returns the same value. diff --git a/src/OpenFOAM/interpolations/interpolationTable/tableReaders/csv/csvTableReader.C b/src/OpenFOAM/interpolations/interpolationTable/tableReaders/csv/csvTableReader.C index ea6e419791..bc09a69dde 100644 --- a/src/OpenFOAM/interpolations/interpolationTable/tableReaders/csv/csvTableReader.C +++ b/src/OpenFOAM/interpolations/interpolationTable/tableReaders/csv/csvTableReader.C @@ -37,6 +37,7 @@ template Foam::labelList Foam::csvTableReader::getComponentColumns ( const word& name, + std::initializer_list> compat, const dictionary& dict ) { @@ -45,7 +46,7 @@ Foam::labelList Foam::csvTableReader::getComponentColumns labelList cols; - ITstream& is = dict.lookup(name); + ITstream& is = dict.lookupCompat(name, compat); is.format(IOstream::ASCII); is >> cols; dict.checkITstream(is, name); @@ -113,8 +114,11 @@ Foam::csvTableReader::csvTableReader(const dictionary& dict) : tableReader(dict), headerLine_(dict.get("hasHeaderLine")), - refColumn_(dict.get