From a1bf12effe01e1ccad2b4a2bb793841be74fa155 Mon Sep 17 00:00:00 2001 From: Martin Beaudoin Date: Wed, 21 Feb 2018 20:52:04 -0500 Subject: [PATCH 1/4] Adjustments for macOS --- src/OSspecific/POSIX/POSIX.C | 3 +++ src/OSspecific/POSIX/signals/sigFpe.C | 2 +- src/foam/primitives/Scalar/doubleFloat.H | 19 +++++++++++++++++++ src/foam/primitives/ints/int64/int64.H | 5 +++++ src/foam/primitives/ints/int64/int64IO.C | 12 ++++++++++++ 5 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/OSspecific/POSIX/POSIX.C b/src/OSspecific/POSIX/POSIX.C index 2271f6a0e..1ec27351d 100644 --- a/src/OSspecific/POSIX/POSIX.C +++ b/src/OSspecific/POSIX/POSIX.C @@ -52,7 +52,10 @@ Description #include #include #include + +#ifndef darwin #include +#endif #include diff --git a/src/OSspecific/POSIX/signals/sigFpe.C b/src/OSspecific/POSIX/signals/sigFpe.C index 763dbf7a7..1c788fe73 100644 --- a/src/OSspecific/POSIX/signals/sigFpe.C +++ b/src/OSspecific/POSIX/signals/sigFpe.C @@ -262,7 +262,7 @@ void Foam::sigFpe::set(const bool verbose) # elif defined(__APPLE__) struct sigaction newAction; - newAction.sa_handler = sigFpeHandler; + newAction.sa_handler = sigHandler; newAction.sa_flags = SA_NODEFER; sigemptyset(&newAction.sa_mask); if (sigaction(SIGFPE, &newAction, &oldAction_) < 0) diff --git a/src/foam/primitives/Scalar/doubleFloat.H b/src/foam/primitives/Scalar/doubleFloat.H index 388e0c9a8..594f25528 100644 --- a/src/foam/primitives/Scalar/doubleFloat.H +++ b/src/foam/primitives/Scalar/doubleFloat.H @@ -31,6 +31,25 @@ License #include +#if defined(darwin) && defined(__clang__) +#ifndef DUMMY_SCALAR_FUNCTIONS +#define DUMMY_SCALAR_FUNCTIONS +inline float j0f(float x) { return float(j0(double(x)));} +inline float j1f(float x) { return float(j1(double(x)));} +inline float y0f(float x) { return float(y0(double(x)));} +inline float y1f(float x) { return float(y1(double(x)));} +inline float jnf(const int n, const float s) { return float(jn(n, double(s))); } +inline float ynf(const int n, const float s) { return float(yn(n, double(s))); } + +inline long double j0l(float x) { return double(j0(double(x)));} +inline long double j1l(float x) { return double(j1(double(x)));} +inline long double y0l(float x) { return double(y0(double(x)));} +inline long double y1l(float x) { return double(y1(double(x)));} +inline long double jnl(const int n, const float s) { return double(jn(n, double(s))); } +inline long double ynl(const int n, const float s) { return double(yn(n, double(s))); } +#endif +#endif // darwin + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam diff --git a/src/foam/primitives/ints/int64/int64.H b/src/foam/primitives/ints/int64/int64.H index e337cfe80..deb8f8a72 100644 --- a/src/foam/primitives/ints/int64/int64.H +++ b/src/foam/primitives/ints/int64/int64.H @@ -69,6 +69,11 @@ bool read(const char*, int64_t&); Istream& operator>>(Istream&, int64_t&); Ostream& operator<<(Ostream&, const int64_t); +#if WM_ARCH_OPTION == 64 && darwin && __clang__ + Istream& operator>>(Istream&, long&); + Ostream& operator<<(Ostream&, const long); +#endif + //- Template specialization for pTraits template<> class pTraits diff --git a/src/foam/primitives/ints/int64/int64IO.C b/src/foam/primitives/ints/int64/int64IO.C index 1937d7458..7a36d6047 100644 --- a/src/foam/primitives/ints/int64/int64IO.C +++ b/src/foam/primitives/ints/int64/int64IO.C @@ -101,5 +101,17 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const int64_t i) return os; } +#if WM_ARCH_OPTION == 64 && darwin && __clang__ +Foam::Istream& Foam::operator>>(Istream& is, long& i) +{ + return operator>>(is, reinterpret_cast(i)); +} + +Foam::Ostream& Foam::operator<<(Ostream& os, const long i) +{ + os << int64_t(i); + return os; +} +#endif // ************************************************************************* // From 23b739f1c8543720e57e051a229b474a9607f1be Mon Sep 17 00:00:00 2001 From: Martin Beaudoin Date: Wed, 21 Feb 2018 20:53:08 -0500 Subject: [PATCH 2/4] Add missing Makefile for wmake --- wmake/src/Makefile | 79 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 wmake/src/Makefile diff --git a/wmake/src/Makefile b/wmake/src/Makefile new file mode 100644 index 000000000..a860d8b66 --- /dev/null +++ b/wmake/src/Makefile @@ -0,0 +1,79 @@ +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | foam-extend: Open Source CFD +# \\ / O peration | Version: 4.1 +# \\ / A nd | Web: http://www.foam-extend.org +# \\/ M anipulation | For copyright notice see file Copyright +#------------------------------------------------------------------------------ +# License +# This file is part of foam-extend. +# +# foam-extend is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# foam-extend is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with foam-extend. If not, see . +# +# Script +# Makefile +# +# Description +# Makefile used to compile wmake utilities. +# +#------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------ +# The Makefile use a POSIX shell +#------------------------------------------------------------------------------ + +SHELL = /bin/sh + +#------------------------------------------------------------------------------ +# Initialise suffices list +#------------------------------------------------------------------------------ + +.SUFFIXES: +.SUFFIXES: .o + + +#------------------------------------------------------------------------------ +# set compilation and dependency building rules +#------------------------------------------------------------------------------ + +GENERAL_RULES = $(WM_DIR)/rules/General +RULES = $(WM_DIR)/rules/$(WM_ARCH)$(WM_COMPILER) +BIN = $(WM_DIR)/bin/$(WM_ARCH)$(WM_COMPILER) + +include $(RULES)/general +include $(RULES)/$(WM_LINK_LANGUAGE) + + +#------------------------------------------------------------------------------ +# targets +#------------------------------------------------------------------------------ + +all: $(BIN)/dirToString $(BIN)/wmkdep + +clean: + rm -f $(BIN)/dirToString $(BIN)/wmkdep 2>/dev/null + + +$(BIN)/dirToString: dirToString.c + @mkdir -p $(BIN) + $(cc) $(cFLAGS) dirToString.c -o $(BIN)/dirToString + +$(BIN)/wmkdep: wmkdep.l + @mkdir -p $(BIN) + flex wmkdep.l + $(cc) $(cFLAGS) lex.yy.c -o $(BIN)/wmkdep + @rm -f lex.yy.c 2>/dev/null + + +#------------------------------------------------------------------------------ From a9b6d1beb1bfb5de51aaa4d04c3ce16338d8de23 Mon Sep 17 00:00:00 2001 From: Martin Beaudoin Date: Wed, 21 Feb 2018 21:32:08 -0500 Subject: [PATCH 3/4] Minors adjustments to POSIX.C --- src/OSspecific/POSIX/POSIX.C | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/OSspecific/POSIX/POSIX.C b/src/OSspecific/POSIX/POSIX.C index 1ec27351d..2b388cd15 100644 --- a/src/OSspecific/POSIX/POSIX.C +++ b/src/OSspecific/POSIX/POSIX.C @@ -555,6 +555,7 @@ bool Foam::chMod(const fileName& name, const mode_t m) } +// Return the file mode mode_t Foam::mode(const fileName& name) { fileStat fileStatus(name); @@ -569,6 +570,7 @@ mode_t Foam::mode(const fileName& name) } +// Return the file type: FILE or DIRECTORY Foam::fileName::Type Foam::type(const fileName& name) { mode_t m = mode(name); @@ -588,24 +590,28 @@ Foam::fileName::Type Foam::type(const fileName& name) } +// Does the name exist in the filing system? bool Foam::exists(const fileName& name, const bool checkGzip) { return mode(name) || isFile(name, checkGzip); } +// Does the directory exist? bool Foam::isDir(const fileName& name) { return S_ISDIR(mode(name)); } +// Does the file exist? bool Foam::isFile(const fileName& name, const bool checkGzip) { return S_ISREG(mode(name)) || (checkGzip && S_ISREG(mode(name + ".gz"))); } +// Return size of file off_t Foam::fileSize(const fileName& name) { fileStat fileStatus(name); @@ -620,6 +626,7 @@ off_t Foam::fileSize(const fileName& name) } +// Return time of last file modification time_t Foam::lastModified(const fileName& name) { fileStat fileStatus(name); @@ -634,6 +641,7 @@ time_t Foam::lastModified(const fileName& name) } +// Read a directory and return the entries as a string list Foam::fileNameList Foam::readDir ( const fileName& directory, @@ -729,6 +737,7 @@ Foam::fileNameList Foam::readDir } +// Copy, recursively if necessary, the source to the destination bool Foam::cp(const fileName& src, const fileName& dest) { // Make sure source exists. @@ -828,6 +837,7 @@ bool Foam::cp(const fileName& src, const fileName& dest) } +// Create a softlink. dst should not exist. Returns true if successful. bool Foam::ln(const fileName& src, const fileName& dst) { if (POSIX::debug) @@ -865,6 +875,7 @@ bool Foam::ln(const fileName& src, const fileName& dst) } +// Rename srcFile dstFile bool Foam::mv(const fileName& src, const fileName& dst) { if (POSIX::debug) @@ -890,6 +901,8 @@ bool Foam::mv(const fileName& src, const fileName& dst) } +//- Rename to a corresponding backup file +// If the backup file already exists, attempt with "01" .. "99" index bool Foam::mvBak(const fileName& src, const std::string& ext) { if (POSIX::debug) @@ -927,6 +940,8 @@ bool Foam::mvBak(const fileName& src, const std::string& ext) } + +// Remove a file, returning true if successful otherwise false bool Foam::rm(const fileName& file) { if (POSIX::debug) @@ -947,6 +962,7 @@ bool Foam::rm(const fileName& file) } +// Remove a dirctory and its contents bool Foam::rmDir(const fileName& directory) { if (POSIX::debug) @@ -1236,7 +1252,7 @@ bool Foam::dlSymFound(void* handle, const std::string& symbol) } } - +#ifdef NOT_SURE_HOW_TO_USE_THIS static int collectLibsCallback ( struct dl_phdr_info *info, @@ -1263,6 +1279,7 @@ Foam::fileNameList Foam::dlLoaded() } return libs; } +#endif void Foam::osRandomSeed(const label seed) From f54d1bf5f1994378ffcbc4e67ef877a3bc2c3049 Mon Sep 17 00:00:00 2001 From: Martin Beaudoin Date: Thu, 22 Feb 2018 21:13:06 -0500 Subject: [PATCH 4/4] Fixes for compiling 4.1 on macOS. --- .../rhoPorousSimpleFoam/Make/options | 1 + .../compressible/rhoSimpleFoam/Make/options | 1 + .../steadyCompressibleFoam/Make/options | 1 + .../steadyCompressibleMRFFoam/Make/options | 1 + .../steadyCompressibleSRFFoam/Make/options | 1 + .../steadyUniversalFoam/Make/options | 1 + .../steadyUniversalMRFFoam/Make/options | 1 + .../coupled/MRFPorousFoam/Make/options | 1 + .../coupled/pUCoupledFoam/Make/options | 1 + .../solvers/equationReaderDemo/Make/options | 2 +- .../buoyantBoussinesqSimpleFoam/Make/options | 1 + .../buoyantSimpleFoam/Make/options | 1 + .../buoyantSimpleRadiationFoam/Make/options | 1 + .../porousSimpleIbFoam/Make/options | 1 + .../simpleIbFoam/Make/options | 1 + .../incompressible/MRFSimpleFoam/Make/options | 1 + .../incompressible/boundaryFoam/Make/options | 1 + .../incompressible/channelFoam/Make/options | 1 + .../porousSimpleFoam/Make/options | 1 + .../incompressible/simpleFoam/Make/options | 1 + .../incompressible/simpleSRFFoam/Make/options | 1 + .../execFlowFunctionObjects/Make/options | 2 + .../postProcessing/turbulence/R/Make/options | 1 + .../createTurbulenceFields/Make/options | 1 + .../velocityField/Pe/Make/options | 2 + .../wall/wallHeatFlux/Make/options | 1 + .../wall/wallShearStress/Make/options | 2 + .../postProcessing/wall/yPlusLES/Make/options | 1 + .../postProcessing/wall/yPlusRAS/Make/options | 2 + src/OSspecific/POSIX/POSIX.C | 6 +- .../dlLibraryTable/dlLibraryTable.C | 74 ++++++++++++++++--- .../dlLibraryTable/dlLibraryTable.H | 10 +++ src/foam/global/argList/argList.C | 2 +- wmake/rules/darwinIntel64Gcc/c++ | 2 +- 34 files changed, 112 insertions(+), 16 deletions(-) diff --git a/applications/solvers/compressible/rhoPorousSimpleFoam/Make/options b/applications/solvers/compressible/rhoPorousSimpleFoam/Make/options index 74924fb07..7fd2893c3 100644 --- a/applications/solvers/compressible/rhoPorousSimpleFoam/Make/options +++ b/applications/solvers/compressible/rhoPorousSimpleFoam/Make/options @@ -10,6 +10,7 @@ EXE_LIBS = \ -lbasicThermophysicalModels \ -lspecie \ -lcompressibleRASModels \ + -lcompressibleTurbulenceModel \ -lfiniteVolume \ -lmeshTools \ -llduSolvers diff --git a/applications/solvers/compressible/rhoSimpleFoam/Make/options b/applications/solvers/compressible/rhoSimpleFoam/Make/options index f75e725ad..c4c1d7a70 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/Make/options +++ b/applications/solvers/compressible/rhoSimpleFoam/Make/options @@ -9,6 +9,7 @@ EXE_LIBS = \ -lbasicThermophysicalModels \ -lspecie \ -lcompressibleRASModels \ + -lcompressibleTurbulenceModel \ -lfiniteVolume \ -lmeshTools \ -llduSolvers diff --git a/applications/solvers/compressible/steadyCompressibleFoam/Make/options b/applications/solvers/compressible/steadyCompressibleFoam/Make/options index 4989a55bb..efe307e09 100644 --- a/applications/solvers/compressible/steadyCompressibleFoam/Make/options +++ b/applications/solvers/compressible/steadyCompressibleFoam/Make/options @@ -10,4 +10,5 @@ EXE_LIBS = \ -lbasicThermophysicalModels \ -lspecie \ -lcompressibleRASModels \ + -lcompressibleTurbulenceModel \ -llduSolvers diff --git a/applications/solvers/compressible/steadyCompressibleMRFFoam/Make/options b/applications/solvers/compressible/steadyCompressibleMRFFoam/Make/options index d1521d407..b61f7ce7d 100644 --- a/applications/solvers/compressible/steadyCompressibleMRFFoam/Make/options +++ b/applications/solvers/compressible/steadyCompressibleMRFFoam/Make/options @@ -10,4 +10,5 @@ EXE_LIBS = \ -lbasicThermophysicalModels \ -lspecie \ -lcompressibleRASModels \ + -lcompressibleTurbulenceModel \ -llduSolvers diff --git a/applications/solvers/compressible/steadyCompressibleSRFFoam/Make/options b/applications/solvers/compressible/steadyCompressibleSRFFoam/Make/options index d1521d407..b61f7ce7d 100644 --- a/applications/solvers/compressible/steadyCompressibleSRFFoam/Make/options +++ b/applications/solvers/compressible/steadyCompressibleSRFFoam/Make/options @@ -10,4 +10,5 @@ EXE_LIBS = \ -lbasicThermophysicalModels \ -lspecie \ -lcompressibleRASModels \ + -lcompressibleTurbulenceModel \ -llduSolvers diff --git a/applications/solvers/compressible/steadyUniversalFoam/Make/options b/applications/solvers/compressible/steadyUniversalFoam/Make/options index 4989a55bb..efe307e09 100644 --- a/applications/solvers/compressible/steadyUniversalFoam/Make/options +++ b/applications/solvers/compressible/steadyUniversalFoam/Make/options @@ -10,4 +10,5 @@ EXE_LIBS = \ -lbasicThermophysicalModels \ -lspecie \ -lcompressibleRASModels \ + -lcompressibleTurbulenceModel \ -llduSolvers diff --git a/applications/solvers/compressible/steadyUniversalMRFFoam/Make/options b/applications/solvers/compressible/steadyUniversalMRFFoam/Make/options index 4989a55bb..efe307e09 100644 --- a/applications/solvers/compressible/steadyUniversalMRFFoam/Make/options +++ b/applications/solvers/compressible/steadyUniversalMRFFoam/Make/options @@ -10,4 +10,5 @@ EXE_LIBS = \ -lbasicThermophysicalModels \ -lspecie \ -lcompressibleRASModels \ + -lcompressibleTurbulenceModel \ -llduSolvers diff --git a/applications/solvers/coupled/MRFPorousFoam/Make/options b/applications/solvers/coupled/MRFPorousFoam/Make/options index 5d2b99e6d..673ad545c 100644 --- a/applications/solvers/coupled/MRFPorousFoam/Make/options +++ b/applications/solvers/coupled/MRFPorousFoam/Make/options @@ -8,5 +8,6 @@ EXE_INC = \ EXE_LIBS = \ -lincompressibleRASModels \ -lincompressibleTransportModels \ + -lincompressibleTurbulenceModel \ -lfiniteVolume \ -llduSolvers diff --git a/applications/solvers/coupled/pUCoupledFoam/Make/options b/applications/solvers/coupled/pUCoupledFoam/Make/options index 5d2b99e6d..673ad545c 100644 --- a/applications/solvers/coupled/pUCoupledFoam/Make/options +++ b/applications/solvers/coupled/pUCoupledFoam/Make/options @@ -8,5 +8,6 @@ EXE_INC = \ EXE_LIBS = \ -lincompressibleRASModels \ -lincompressibleTransportModels \ + -lincompressibleTurbulenceModel \ -lfiniteVolume \ -llduSolvers diff --git a/applications/solvers/equationReaderDemo/Make/options b/applications/solvers/equationReaderDemo/Make/options index 66669cbe1..9d5375839 100644 --- a/applications/solvers/equationReaderDemo/Make/options +++ b/applications/solvers/equationReaderDemo/Make/options @@ -9,6 +9,6 @@ EXE_INC = \ EXE_LIBS = \ -lincompressibleRASModels \ -lincompressibleTransportModels \ + -lincompressibleTurbulenceModel \ -lfiniteVolume \ -lequationReader - diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/Make/options b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/Make/options index 7428bd37b..0ef627748 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/Make/options +++ b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/Make/options @@ -10,4 +10,5 @@ EXE_LIBS = \ -lmeshTools \ -lincompressibleRASModels \ -lincompressibleTransportModels \ + -lincompressibleTurbulenceModel \ -llduSolvers diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/Make/options b/applications/solvers/heatTransfer/buoyantSimpleFoam/Make/options index 8b8257e63..5b5c1bdd6 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/Make/options +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/Make/options @@ -10,5 +10,6 @@ EXE_LIBS = \ -lbasicThermophysicalModels \ -lspecie \ -lcompressibleRASModels \ + -lcompressibleTurbulenceModel \ -lfiniteVolume \ -llduSolvers diff --git a/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/Make/options b/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/Make/options index efec577a7..5f384de4b 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/Make/options +++ b/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/Make/options @@ -13,6 +13,7 @@ EXE_LIBS = \ -lspecie \ -lradiation \ -lcompressibleRASModels \ + -lcompressibleTurbulenceModel \ -lfiniteVolume \ -lmeshTools \ -llduSolvers diff --git a/applications/solvers/immersedBoundary/porousSimpleIbFoam/Make/options b/applications/solvers/immersedBoundary/porousSimpleIbFoam/Make/options index 0d53c03a0..212eee945 100644 --- a/applications/solvers/immersedBoundary/porousSimpleIbFoam/Make/options +++ b/applications/solvers/immersedBoundary/porousSimpleIbFoam/Make/options @@ -10,6 +10,7 @@ EXE_INC = \ EXE_LIBS = \ -lincompressibleRASModels \ -lincompressibleTransportModels \ + -lincompressibleTurbulenceModel \ -lfiniteVolume \ -lmeshTools \ -lsurfMesh \ diff --git a/applications/solvers/immersedBoundary/simpleIbFoam/Make/options b/applications/solvers/immersedBoundary/simpleIbFoam/Make/options index 0d53c03a0..212eee945 100644 --- a/applications/solvers/immersedBoundary/simpleIbFoam/Make/options +++ b/applications/solvers/immersedBoundary/simpleIbFoam/Make/options @@ -10,6 +10,7 @@ EXE_INC = \ EXE_LIBS = \ -lincompressibleRASModels \ -lincompressibleTransportModels \ + -lincompressibleTurbulenceModel \ -lfiniteVolume \ -lmeshTools \ -lsurfMesh \ diff --git a/applications/solvers/incompressible/MRFSimpleFoam/Make/options b/applications/solvers/incompressible/MRFSimpleFoam/Make/options index 44cec8365..1a89e69b9 100644 --- a/applications/solvers/incompressible/MRFSimpleFoam/Make/options +++ b/applications/solvers/incompressible/MRFSimpleFoam/Make/options @@ -6,5 +6,6 @@ EXE_INC = \ EXE_LIBS = \ -lincompressibleRASModels \ -lincompressibleTransportModels \ + -lincompressibleTurbulenceModel \ -lfiniteVolume \ -llduSolvers diff --git a/applications/solvers/incompressible/boundaryFoam/Make/options b/applications/solvers/incompressible/boundaryFoam/Make/options index 751b36915..21a0b69d3 100644 --- a/applications/solvers/incompressible/boundaryFoam/Make/options +++ b/applications/solvers/incompressible/boundaryFoam/Make/options @@ -9,6 +9,7 @@ EXE_INC = \ EXE_LIBS = \ -lincompressibleRASModels \ -lincompressibleTransportModels \ + -lincompressibleTurbulenceModel \ -lfiniteVolume \ -lmeshTools \ -lsampling \ diff --git a/applications/solvers/incompressible/channelFoam/Make/options b/applications/solvers/incompressible/channelFoam/Make/options index 238d93eca..3dfa5a7ba 100644 --- a/applications/solvers/incompressible/channelFoam/Make/options +++ b/applications/solvers/incompressible/channelFoam/Make/options @@ -10,6 +10,7 @@ EXE_INC = \ EXE_LIBS = \ -lincompressibleLESModels \ -lincompressibleTransportModels \ + -lincompressibleTurbulenceModel \ -lfiniteVolume \ -lmeshTools \ -llduSolvers diff --git a/applications/solvers/incompressible/porousSimpleFoam/Make/options b/applications/solvers/incompressible/porousSimpleFoam/Make/options index 39e0ffa67..157fb8a1a 100644 --- a/applications/solvers/incompressible/porousSimpleFoam/Make/options +++ b/applications/solvers/incompressible/porousSimpleFoam/Make/options @@ -10,6 +10,7 @@ EXE_INC = \ EXE_LIBS = \ -lincompressibleRASModels \ -lincompressibleTransportModels \ + -lincompressibleTurbulenceModel \ -lfiniteVolume \ -lmeshTools \ -llduSolvers diff --git a/applications/solvers/incompressible/simpleFoam/Make/options b/applications/solvers/incompressible/simpleFoam/Make/options index 5d2b99e6d..673ad545c 100644 --- a/applications/solvers/incompressible/simpleFoam/Make/options +++ b/applications/solvers/incompressible/simpleFoam/Make/options @@ -8,5 +8,6 @@ EXE_INC = \ EXE_LIBS = \ -lincompressibleRASModels \ -lincompressibleTransportModels \ + -lincompressibleTurbulenceModel \ -lfiniteVolume \ -llduSolvers diff --git a/applications/solvers/incompressible/simpleSRFFoam/Make/options b/applications/solvers/incompressible/simpleSRFFoam/Make/options index 02297d94c..6c29e3c36 100644 --- a/applications/solvers/incompressible/simpleSRFFoam/Make/options +++ b/applications/solvers/incompressible/simpleSRFFoam/Make/options @@ -6,6 +6,7 @@ EXE_INC = \ EXE_LIBS = \ -lincompressibleRASModels \ -lincompressibleTransportModels \ + -lincompressibleTurbulenceModel \ -lfiniteVolume \ -lmeshTools \ -llduSolvers diff --git a/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/Make/options b/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/Make/options index fe46b10d1..900a2c286 100644 --- a/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/Make/options +++ b/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/Make/options @@ -9,10 +9,12 @@ EXE_INC = \ EXE_LIBS = \ $(FOAM_LIBBIN)/postCalc.o \ -lincompressibleTransportModels \ + -lincompressibleTurbulenceModel \ -lincompressibleRASModels \ -lincompressibleLESModels \ -lbasicThermophysicalModels \ -lspecie \ -lcompressibleRASModels \ -lcompressibleLESModels \ + -lcompressibleTurbulenceModel \ -lfiniteVolume diff --git a/applications/utilities/postProcessing/turbulence/R/Make/options b/applications/utilities/postProcessing/turbulence/R/Make/options index 5e71b80af..bfcaacafe 100644 --- a/applications/utilities/postProcessing/turbulence/R/Make/options +++ b/applications/utilities/postProcessing/turbulence/R/Make/options @@ -7,4 +7,5 @@ EXE_INC = \ EXE_LIBS = \ -lincompressibleRASModels \ -lincompressibleTransportModels \ + -lincompressibleTurbulenceModel \ -lfiniteVolume diff --git a/applications/utilities/postProcessing/turbulence/createTurbulenceFields/Make/options b/applications/utilities/postProcessing/turbulence/createTurbulenceFields/Make/options index 89632547e..5df3702bd 100644 --- a/applications/utilities/postProcessing/turbulence/createTurbulenceFields/Make/options +++ b/applications/utilities/postProcessing/turbulence/createTurbulenceFields/Make/options @@ -7,4 +7,5 @@ EXE_INC = \ EXE_LIBS = \ -lincompressibleRASModels \ -lincompressibleTransportModels \ + -lincompressibleTurbulenceModel \ -lfiniteVolume diff --git a/applications/utilities/postProcessing/velocityField/Pe/Make/options b/applications/utilities/postProcessing/velocityField/Pe/Make/options index aa00dc2b5..bf9e49497 100644 --- a/applications/utilities/postProcessing/velocityField/Pe/Make/options +++ b/applications/utilities/postProcessing/velocityField/Pe/Make/options @@ -11,10 +11,12 @@ EXE_INC = \ EXE_LIBS = \ $(FOAM_LIBBIN)/postCalc.o \ -lincompressibleTransportModels \ + -lincompressibleTurbulenceModel \ -lincompressibleRASModels \ -lincompressibleLESModels \ -lbasicThermophysicalModels \ -lspecie \ + -lcompressibleTurbulenceModel \ -lcompressibleRASModels \ -lcompressibleLESModels \ -lfiniteVolume \ diff --git a/applications/utilities/postProcessing/wall/wallHeatFlux/Make/options b/applications/utilities/postProcessing/wall/wallHeatFlux/Make/options index 8cdfe23fd..6ea9210f2 100644 --- a/applications/utilities/postProcessing/wall/wallHeatFlux/Make/options +++ b/applications/utilities/postProcessing/wall/wallHeatFlux/Make/options @@ -7,6 +7,7 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude EXE_LIBS = \ + -lcompressibleTurbulenceModel \ -lcompressibleRASModels \ -lreactionThermophysicalModels \ -lfiniteVolume \ diff --git a/applications/utilities/postProcessing/wall/wallShearStress/Make/options b/applications/utilities/postProcessing/wall/wallShearStress/Make/options index c9f4bdaa6..64a9ba35b 100644 --- a/applications/utilities/postProcessing/wall/wallShearStress/Make/options +++ b/applications/utilities/postProcessing/wall/wallShearStress/Make/options @@ -9,7 +9,9 @@ EXE_INC = \ EXE_LIBS = \ -lincompressibleRASModels \ -lincompressibleTransportModels \ + -lincompressibleTurbulenceModel \ -lbasicThermophysicalModels \ -lspecie \ + -lcompressibleTurbulenceModel \ -lcompressibleRASModels \ -lfiniteVolume diff --git a/applications/utilities/postProcessing/wall/yPlusLES/Make/options b/applications/utilities/postProcessing/wall/yPlusLES/Make/options index f6131ce41..5b0c8d3cf 100644 --- a/applications/utilities/postProcessing/wall/yPlusLES/Make/options +++ b/applications/utilities/postProcessing/wall/yPlusLES/Make/options @@ -9,4 +9,5 @@ EXE_INC = \ EXE_LIBS = \ -lincompressibleLESModels \ -lincompressibleTransportModels \ + -lincompressibleTurbulenceModel \ -lfiniteVolume diff --git a/applications/utilities/postProcessing/wall/yPlusRAS/Make/options b/applications/utilities/postProcessing/wall/yPlusRAS/Make/options index 459989eb9..c7919255c 100644 --- a/applications/utilities/postProcessing/wall/yPlusRAS/Make/options +++ b/applications/utilities/postProcessing/wall/yPlusRAS/Make/options @@ -9,9 +9,11 @@ EXE_INC = \ EXE_LIBS = \ -lincompressibleTransportModels \ + -lincompressibleTurbulenceModel \ -lincompressibleRASModels \ -lbasicThermophysicalModels \ -lspecie \ + -lcompressibleTurbulenceModel \ -lcompressibleRASModels \ -lfiniteVolume \ -lmeshTools \ diff --git a/src/OSspecific/POSIX/POSIX.C b/src/OSspecific/POSIX/POSIX.C index 2b388cd15..b7ffbbcd6 100644 --- a/src/OSspecific/POSIX/POSIX.C +++ b/src/OSspecific/POSIX/POSIX.C @@ -264,10 +264,10 @@ Foam::fileNameList Foam::findEtcFiles fileNameList results; // Search for user files in - // * ~/.OpenFOAM/VERSION - // * ~/.OpenFOAM + // * ~/.foam/VERSION + // * ~/.foam // - fileName searchDir = home()/".OpenFOAM"; + fileName searchDir = home()/".foam"; if (isDir(searchDir)) { fileName fullName = searchDir/FOAMversion/name; diff --git a/src/foam/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C b/src/foam/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C index 39d8838e2..66d7cc9bc 100644 --- a/src/foam/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C +++ b/src/foam/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C @@ -26,6 +26,7 @@ License #include "dlLibraryTable.H" #include "OSspecific.H" #include "int.H" +#include // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -34,6 +35,8 @@ namespace Foam defineTypeNameAndDebug(dlLibraryTable, 0); } +Foam::dlLibraryTable Foam::dlLibraryTable::loadedLibraries; + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -75,24 +78,75 @@ bool Foam::dlLibraryTable::open { if (functionLibName.size()) { - void* functionLibPtr = dlOpen(functionLibName, verbose); + void* functionLibPtr = + dlopen(functionLibName.c_str(), RTLD_LAZY|RTLD_GLOBAL); +#ifdef darwin + // If failing to load under OS X, let's try some obvious variations + // before giving up completely + fileName osxFileName(functionLibName); + + if(!functionLibPtr && functionLibName.ext()=="so") + { + osxFileName=functionLibName.lessExt()+".dylib"; + + functionLibPtr = + dlopen(osxFileName.c_str(), RTLD_LAZY|RTLD_GLOBAL); + } + + // If unsuccessful, which might be the case under Mac OSX 10.11 (El + // Capitan) with System Integrity Protection (SIP) enabled, let's try + // building a full path using well-known environment variables. This is + // the last resort, unless you provide the full pathname yourself. if (!functionLibPtr) { - if (verbose) - { - WarningInFunction - << "could not load " << functionLibName - << endl; - } + fileName l_LIBBIN_Name = + getEnv("FOAM_LIBBIN")/osxFileName; + functionLibPtr = + dlopen(l_LIBBIN_Name.c_str(), RTLD_LAZY|RTLD_GLOBAL); + } + if (!functionLibPtr) + { + fileName l_SITE_LIBBIN_Name = + getEnv("FOAM_SITE_LIBBIN")/osxFileName; + functionLibPtr = + dlopen(l_SITE_LIBBIN_Name.c_str(), RTLD_LAZY|RTLD_GLOBAL); + } + if (!functionLibPtr) + { + fileName l_USER_LIBBIN_Name = + getEnv("FOAM_USER_LIBBIN")/osxFileName; + functionLibPtr = + dlopen(l_USER_LIBBIN_Name.c_str(), RTLD_LAZY|RTLD_GLOBAL); + } +#elif defined mingw + if(!functionLibPtr && functionLibName.ext()=="so") { + fileName lName=functionLibName.lessExt()+".dll"; + functionLibPtr = + dlopen(lName.c_str(), RTLD_LAZY|RTLD_GLOBAL); + } +#endif + if (!functionLibPtr) + { + WarningIn + ( + "dlLibraryTable::open(const fileName& functionLibName)" + ) << "could not load " << dlerror() + << endl; return false; } else { - libPtrs_.append(functionLibPtr); - libNames_.append(functionLibName); - return true; + if (!loadedLibraries.found(functionLibPtr)) + { + loadedLibraries.insert(functionLibPtr, functionLibName); + return true; + } + else + { + return false; + } } } else diff --git a/src/foam/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.H b/src/foam/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.H index 360bc6aef..de28c00ef 100644 --- a/src/foam/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.H +++ b/src/foam/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.H @@ -37,6 +37,8 @@ SourceFiles #include "label.H" #include "DynamicList.H" +#include "Hash.H" +#include "HashTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -48,6 +50,8 @@ namespace Foam \*---------------------------------------------------------------------------*/ class dlLibraryTable +: + public HashTable > { // Private Member Functions @@ -68,6 +72,12 @@ public: // Declare name of the class and its debug switch ClassName("dlLibraryTable"); + // Static data members + + //- Static data someStaticData + static dlLibraryTable loadedLibraries; + + // Constructors //- Construct null diff --git a/src/foam/global/argList/argList.C b/src/foam/global/argList/argList.C index 01b398b2f..ab384ebc9 100644 --- a/src/foam/global/argList/argList.C +++ b/src/foam/global/argList/argList.C @@ -1145,7 +1145,7 @@ void Foam::argList::printUsage() const printNotes(); Info<< nl - <<"Using: OpenFOAM-" << Foam::FOAMversion + <<"Using: foam-extend-" << Foam::FOAMversion << " (see www.foam-extend.org)" << nl <<"Build: " << Foam::FOAMbuild << nl << endl; diff --git a/wmake/rules/darwinIntel64Gcc/c++ b/wmake/rules/darwinIntel64Gcc/c++ index 785ac0dd5..85a6efa8e 100644 --- a/wmake/rules/darwinIntel64Gcc/c++ +++ b/wmake/rules/darwinIntel64Gcc/c++ @@ -1,6 +1,6 @@ .SUFFIXES: .C .cxx .cc .cpp -c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wno-overloaded-virtual -Wno-unsequenced -Wno-c++11-extensions -Wno-unused-comparison +c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wno-overloaded-virtual -Wno-unsequenced -Wno-c++11-extensions -Wno-unused-comparison -Wno-undefined-var-template CC = $(WM_CXX) $(WM_CXXFLAGS) -ftrapping-math