From 7e7285a7cd7eea7cce888f056abb36074aae9121 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 11 Oct 2010 14:55:03 +0200 Subject: [PATCH 1/7] STYLE: add namespace Foam::porousMedia - avoid name collisions with future thermal models etc. --- .../cfdTools/general/porousMedia/porousZone.H | 6 +++++ .../fixedTemperature/fixedTemperature.C | 9 +++++--- .../fixedTemperature/fixedTemperature.H | 10 ++++++-- .../noThermalModel/noThermalModel.C | 23 +++++++++++-------- .../noThermalModel/noThermalModel.H | 14 +++++++---- .../thermalModel/thermalModel/thermalModel.C | 13 +++++++---- .../thermalModel/thermalModel/thermalModel.H | 20 +++++++++++----- .../thermalModel/thermalModelNew.C | 7 +++--- .../thermalPorousZone/thermalPorousZone.C | 2 +- .../thermalPorousZone/thermalPorousZone.H | 2 +- 10 files changed, 71 insertions(+), 35 deletions(-) diff --git a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.H b/src/finiteVolume/cfdTools/general/porousMedia/porousZone.H index ef48645d2b..3b1e3a6df1 100644 --- a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.H +++ b/src/finiteVolume/cfdTools/general/porousMedia/porousZone.H @@ -21,6 +21,12 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . +Namespace + Foam::porousMedia + +Description + Namespace for models related to porous media + Class Foam::porousZone diff --git a/src/thermophysicalModels/thermalPorousZone/thermalModel/fixedTemperature/fixedTemperature.C b/src/thermophysicalModels/thermalPorousZone/thermalModel/fixedTemperature/fixedTemperature.C index 512746722c..dba5a3d470 100644 --- a/src/thermophysicalModels/thermalPorousZone/thermalModel/fixedTemperature/fixedTemperature.C +++ b/src/thermophysicalModels/thermalPorousZone/thermalModel/fixedTemperature/fixedTemperature.C @@ -32,6 +32,8 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam +{ +namespace porousMedia { defineTypeNameAndDebug(fixedTemperature, 0); @@ -42,11 +44,12 @@ namespace Foam pZone ); } +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::fixedTemperature::fixedTemperature(const porousZone& pZone) +Foam::porousMedia::fixedTemperature::fixedTemperature(const porousZone& pZone) : thermalModel(pZone, typeName), T_(readScalar(coeffDict_.lookup("T"))) @@ -55,13 +58,13 @@ Foam::fixedTemperature::fixedTemperature(const porousZone& pZone) // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // -Foam::fixedTemperature::~fixedTemperature() +Foam::porousMedia::fixedTemperature::~fixedTemperature() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::fixedTemperature::addEnthalpySource +void Foam::porousMedia::fixedTemperature::addEnthalpySource ( const basicThermo& thermo, const volScalarField& rho, diff --git a/src/thermophysicalModels/thermalPorousZone/thermalModel/fixedTemperature/fixedTemperature.H b/src/thermophysicalModels/thermalPorousZone/thermalModel/fixedTemperature/fixedTemperature.H index 11c1c7c442..4ae9aab656 100644 --- a/src/thermophysicalModels/thermalPorousZone/thermalModel/fixedTemperature/fixedTemperature.H +++ b/src/thermophysicalModels/thermalPorousZone/thermalModel/fixedTemperature/fixedTemperature.H @@ -22,10 +22,10 @@ License along with OpenFOAM. If not, see . Class - Foam::fixedTemperature + Foam::porousMedia::fixedTemperature Description - Fixed temperature model + Fixed temperature model for porous media \*---------------------------------------------------------------------------*/ @@ -40,6 +40,8 @@ Description namespace Foam { +namespace porousMedia +{ /*---------------------------------------------------------------------------*\ Class fixedTemperature Declaration @@ -86,6 +88,10 @@ public: }; +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace porousMedia + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/thermophysicalModels/thermalPorousZone/thermalModel/noThermalModel/noThermalModel.C b/src/thermophysicalModels/thermalPorousZone/thermalModel/noThermalModel/noThermalModel.C index a7c3dfd017..b654bef6f6 100644 --- a/src/thermophysicalModels/thermalPorousZone/thermalModel/noThermalModel/noThermalModel.C +++ b/src/thermophysicalModels/thermalPorousZone/thermalModel/noThermalModel/noThermalModel.C @@ -33,20 +33,23 @@ License namespace Foam { - defineTypeNameAndDebug(noThermalModel, 0); +namespace porousMedia +{ + defineTypeNameAndDebug(noThermalModel, 0); - addToRunTimeSelectionTable - ( - thermalModel, - noThermalModel, - pZone - ); + addToRunTimeSelectionTable + ( + thermalModel, + noThermalModel, + pZone + ); +} } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::noThermalModel::noThermalModel(const porousZone& pZone) +Foam::porousMedia::noThermalModel::noThermalModel(const porousZone& pZone) : thermalModel(pZone) {} @@ -54,13 +57,13 @@ Foam::noThermalModel::noThermalModel(const porousZone& pZone) // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // -Foam::noThermalModel::~noThermalModel() +Foam::porousMedia::noThermalModel::~noThermalModel() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::noThermalModel::addEnthalpySource +void Foam::porousMedia::noThermalModel::addEnthalpySource ( const basicThermo&, const volScalarField&, diff --git a/src/thermophysicalModels/thermalPorousZone/thermalModel/noThermalModel/noThermalModel.H b/src/thermophysicalModels/thermalPorousZone/thermalModel/noThermalModel/noThermalModel.H index af23d09feb..123a9b2fd5 100644 --- a/src/thermophysicalModels/thermalPorousZone/thermalModel/noThermalModel/noThermalModel.H +++ b/src/thermophysicalModels/thermalPorousZone/thermalModel/noThermalModel/noThermalModel.H @@ -22,10 +22,10 @@ License along with OpenFOAM. If not, see . Class - Foam::noThermalModel + Foam::porousMedia::noThermalModel Description - Dummy model for 'none' option + A dummy thermal model porous media, corresponding to the 'none' option \*---------------------------------------------------------------------------*/ @@ -40,9 +40,11 @@ Description namespace Foam { +namespace porousMedia +{ /*---------------------------------------------------------------------------*\ - Class noThermalModel Declaration + Class noThermalModel Declaration \*---------------------------------------------------------------------------*/ class noThermalModel @@ -59,7 +61,7 @@ public: // Constructors //- Construct from porous zone - noThermalModel(const porousZone& pZone); + noThermalModel(const porousZone&); //- Destructor @@ -78,6 +80,10 @@ public: }; +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace porousMedia + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModel.C b/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModel.C index e8ba858b8c..d7e36c8ed8 100644 --- a/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModel.C +++ b/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModel.C @@ -29,21 +29,24 @@ License namespace Foam { - defineTypeNameAndDebug(thermalModel, 0); - defineRunTimeSelectionTable(thermalModel, pZone); +namespace porousMedia +{ + defineTypeNameAndDebug(thermalModel, 0); + defineRunTimeSelectionTable(thermalModel, pZone); +} } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::thermalModel::thermalModel(const porousZone& pZone) +Foam::porousMedia::thermalModel::thermalModel(const porousZone& pZone) : pZone_(pZone), coeffDict_(dictionary::null) {} -Foam::thermalModel::thermalModel +Foam::porousMedia::thermalModel::thermalModel ( const porousZone& pZone, const word& modelType @@ -56,7 +59,7 @@ Foam::thermalModel::thermalModel // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // -Foam::thermalModel::~thermalModel() +Foam::porousMedia::thermalModel::~thermalModel() {} diff --git a/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModel.H b/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModel.H index c6bd861919..bda42db68e 100644 --- a/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModel.H +++ b/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModel.H @@ -22,10 +22,10 @@ License along with OpenFOAM. If not, see . Class - Foam::thermalModel + Foam::porousMedia::thermalModel Description - Base class for selecting the temperature specification models + Base class to select the temperature specification models for porousMedia \*---------------------------------------------------------------------------*/ @@ -43,10 +43,14 @@ Description namespace Foam { +// Forward declaration of classes class basicThermo; +namespace porousMedia +{ + /*---------------------------------------------------------------------------*\ - Class thermalModel Declaration + Class thermalModel Declaration \*---------------------------------------------------------------------------*/ class thermalModel @@ -84,10 +88,10 @@ public: // Constructors //- Construct null from porous zone - thermalModel(const porousZone& pZone); + thermalModel(const porousZone&); //- Construct from porous zone and model type name - thermalModel(const porousZone& pZone, const word& modelType); + thermalModel(const porousZone&, const word& modelType); //- Destructor @@ -95,7 +99,7 @@ public: //- Selector - static autoPtr New(const porousZone& pZone); + static autoPtr New(const porousZone&); // Member Functions @@ -110,6 +114,10 @@ public: }; +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace porousMedia + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModelNew.C b/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModelNew.C index e97685a3fc..8b89b7eef1 100644 --- a/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModelNew.C +++ b/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModelNew.C @@ -27,7 +27,8 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::autoPtr Foam::thermalModel::New +Foam::autoPtr +Foam::porousMedia::thermalModel::New ( const porousZone& pZone ) @@ -43,7 +44,7 @@ Foam::autoPtr Foam::thermalModel::New { FatalErrorIn ( - "thermalModel::New(const porousZone&)" + "porousMedia::thermalModel::New(const porousZone&)" ) << "Unknown thermalModel type " << modelType << nl << nl << "Valid thermalModel types are :" << endl @@ -51,7 +52,7 @@ Foam::autoPtr Foam::thermalModel::New << abort(FatalError); } - return autoPtr(cstrIter()(pZone)); + return autoPtr(cstrIter()(pZone)); } diff --git a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.C b/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.C index 6e19d7a177..bd5c378308 100644 --- a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.C +++ b/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.C @@ -38,7 +38,7 @@ Foam::thermalPorousZone::thermalPorousZone ) : porousZone(key, mesh, dict), - model_(thermalModel::New(*this)) + model_(porousMedia::thermalModel::New(*this)) {} diff --git a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.H b/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.H index 3264194939..6164420e8f 100644 --- a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.H +++ b/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.H @@ -68,7 +68,7 @@ class thermalPorousZone void operator=(const thermalPorousZone&); //- Thermal model - autoPtr model_; + autoPtr model_; public: From d967687f14ebffeb44153211aaca338eab629bd4 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 12 Oct 2010 10:57:08 +0200 Subject: [PATCH 2/7] ENH: add settings/rules for clang-2.8 --- etc/settings.csh | 25 +++++++++++++++++++++++++ etc/settings.sh | 25 +++++++++++++++++++++++++ wmake/rules/linux64Clang/c | 16 ++++++++++++++++ wmake/rules/linux64Clang/c++ | 21 +++++++++++++++++++++ wmake/rules/linux64Clang/c++Debug | 2 ++ wmake/rules/linux64Clang/c++Opt | 3 +++ wmake/rules/linux64Clang/c++Prof | 2 ++ wmake/rules/linux64Clang/cDebug | 2 ++ wmake/rules/linux64Clang/cOpt | 2 ++ wmake/rules/linux64Clang/cProf | 2 ++ wmake/rules/linux64Clang/general | 8 ++++++++ wmake/rules/linux64Clang/mplibHPMPI | 3 +++ wmake/rules/linuxClang/c | 16 ++++++++++++++++ wmake/rules/linuxClang/c++ | 21 +++++++++++++++++++++ wmake/rules/linuxClang/c++Debug | 2 ++ wmake/rules/linuxClang/c++Opt | 2 ++ wmake/rules/linuxClang/c++Prof | 2 ++ wmake/rules/linuxClang/cDebug | 2 ++ wmake/rules/linuxClang/cOpt | 2 ++ wmake/rules/linuxClang/cProf | 2 ++ wmake/rules/linuxClang/general | 9 +++++++++ wmake/rules/linuxClang/mplibHPMPI | 3 +++ 22 files changed, 172 insertions(+) create mode 100644 wmake/rules/linux64Clang/c create mode 100644 wmake/rules/linux64Clang/c++ create mode 100644 wmake/rules/linux64Clang/c++Debug create mode 100644 wmake/rules/linux64Clang/c++Opt create mode 100644 wmake/rules/linux64Clang/c++Prof create mode 100644 wmake/rules/linux64Clang/cDebug create mode 100644 wmake/rules/linux64Clang/cOpt create mode 100644 wmake/rules/linux64Clang/cProf create mode 100644 wmake/rules/linux64Clang/general create mode 100644 wmake/rules/linux64Clang/mplibHPMPI create mode 100644 wmake/rules/linuxClang/c create mode 100644 wmake/rules/linuxClang/c++ create mode 100644 wmake/rules/linuxClang/c++Debug create mode 100644 wmake/rules/linuxClang/c++Opt create mode 100644 wmake/rules/linuxClang/c++Prof create mode 100644 wmake/rules/linuxClang/cDebug create mode 100644 wmake/rules/linuxClang/cOpt create mode 100644 wmake/rules/linuxClang/cProf create mode 100644 wmake/rules/linuxClang/general create mode 100644 wmake/rules/linuxClang/mplibHPMPI diff --git a/etc/settings.csh b/etc/settings.csh index 8b51bb7b41..d1d9a413fc 100644 --- a/etc/settings.csh +++ b/etc/settings.csh @@ -108,6 +108,12 @@ case OpenFOAM: set gmp_version=gmp-4.2.4 set mpfr_version=mpfr-2.4.1 breaksw + case Clang: + # using clang - not gcc + setenv WM_CC 'clang' + setenv WM_CXX 'clang++' + set clang_version=llvm-2.8 + breaksw default: echo echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:" @@ -159,6 +165,25 @@ case OpenFOAM: endif unset gcc_version gccDir unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir + + if ( $?clang_version ) then + set clangDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$clang_version + + # Check that the compiler directory can be found + if ( ! -d "$clangDir" ) then + echo + echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:" + echo " Cannot find $clangDir installation." + echo " Please install this compiler version or if you wish to use the system compiler," + echo " change the 'compilerInstall' setting to 'system' in this file" + echo + endif + + _foamAddMan $clangDir/man + _foamAddPath $clangDir/bin + endif + unset clang_version clangDir + breaksw endsw diff --git a/etc/settings.sh b/etc/settings.sh index aae19a764b..4a1ce214c3 100644 --- a/etc/settings.sh +++ b/etc/settings.sh @@ -131,6 +131,12 @@ OpenFOAM) gmp_version=gmp-4.2.4 mpfr_version=mpfr-2.4.1 ;; + Clang) + # using clang - not gcc + export WM_CC='clang' + export WM_CXX='clang++' + clang_version=llvm-2.8 + ;; *) echo echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:" @@ -183,6 +189,25 @@ OpenFOAM) fi unset gcc_version gccDir unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir + + if [ -n "$clang_version" ] + then + clangDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$clang_version + + # Check that the compiler directory can be found + [ -d "$clangDir" ] || { + echo + echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:" + echo " Cannot find $clangDir installation." + echo " Please install this compiler version or if you wish to use the system compiler," + echo " change the 'compilerInstall' setting to 'system' in this file" + echo + } + + _foamAddMan $clangDir/share/man + _foamAddPath $clangDir/bin + fi + unset clang_version clangDir ;; esac diff --git a/wmake/rules/linux64Clang/c b/wmake/rules/linux64Clang/c new file mode 100644 index 0000000000..7d7d4f61a1 --- /dev/null +++ b/wmake/rules/linux64Clang/c @@ -0,0 +1,16 @@ +.SUFFIXES: .c .h + +cWARN = -Wall + +cc = clang -m64 + +include $(RULES)/c$(WM_COMPILE_OPTION) + +cFLAGS = $(GFLAGS) $(cWARN) $(cOPT) $(cDBUG) $(LIB_HEADER_DIRS) -fPIC + +ctoo = $(WM_SCHEDULER) $(cc) $(cFLAGS) -c $$SOURCE -o $@ + +LINK_LIBS = $(cDBUG) + +LINKLIBSO = $(cc) -shared +LINKEXE = $(cc) -Xlinker --add-needed -Xlinker -z -Xlinker nodefs diff --git a/wmake/rules/linux64Clang/c++ b/wmake/rules/linux64Clang/c++ new file mode 100644 index 0000000000..75da3e4ad2 --- /dev/null +++ b/wmake/rules/linux64Clang/c++ @@ -0,0 +1,21 @@ +.SUFFIXES: .C .cxx .cc .cpp + +c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor + +CC = clang++ -m64 + +include $(RULES)/c++$(WM_COMPILE_OPTION) + +ptFLAGS = -DNoRepository -ftemplate-depth-60 + +c++FLAGS = $(GFLAGS) $(c++WARN) $(c++OPT) $(c++DBUG) $(ptFLAGS) $(LIB_HEADER_DIRS) -fPIC + +Ctoo = $(WM_SCHEDULER) $(CC) $(c++FLAGS) -c $$SOURCE -o $@ +cxxtoo = $(Ctoo) +cctoo = $(Ctoo) +cpptoo = $(Ctoo) + +LINK_LIBS = $(c++DBUG) + +LINKLIBSO = $(CC) $(c++FLAGS) -shared +LINKEXE = $(CC) $(c++FLAGS) -Xlinker --add-needed diff --git a/wmake/rules/linux64Clang/c++Debug b/wmake/rules/linux64Clang/c++Debug new file mode 100644 index 0000000000..19bdb9c334 --- /dev/null +++ b/wmake/rules/linux64Clang/c++Debug @@ -0,0 +1,2 @@ +c++DBUG = -ggdb3 -DFULLDEBUG +c++OPT = -O0 -fdefault-inline diff --git a/wmake/rules/linux64Clang/c++Opt b/wmake/rules/linux64Clang/c++Opt new file mode 100644 index 0000000000..3363be8090 --- /dev/null +++ b/wmake/rules/linux64Clang/c++Opt @@ -0,0 +1,3 @@ +#c++DBUG = -O0 -DFULLDEBUG -g +c++DBUG = +c++OPT = -O3 diff --git a/wmake/rules/linux64Clang/c++Prof b/wmake/rules/linux64Clang/c++Prof new file mode 100644 index 0000000000..3bda4dad55 --- /dev/null +++ b/wmake/rules/linux64Clang/c++Prof @@ -0,0 +1,2 @@ +c++DBUG = -pg +c++OPT = -O2 diff --git a/wmake/rules/linux64Clang/cDebug b/wmake/rules/linux64Clang/cDebug new file mode 100644 index 0000000000..72b638f458 --- /dev/null +++ b/wmake/rules/linux64Clang/cDebug @@ -0,0 +1,2 @@ +cDBUG = -ggdb -DFULLDEBUG +cOPT = -O1 -fdefault-inline -finline-functions diff --git a/wmake/rules/linux64Clang/cOpt b/wmake/rules/linux64Clang/cOpt new file mode 100644 index 0000000000..17318709f1 --- /dev/null +++ b/wmake/rules/linux64Clang/cOpt @@ -0,0 +1,2 @@ +cDBUG = +cOPT = -O3 diff --git a/wmake/rules/linux64Clang/cProf b/wmake/rules/linux64Clang/cProf new file mode 100644 index 0000000000..ca3ac9bf5f --- /dev/null +++ b/wmake/rules/linux64Clang/cProf @@ -0,0 +1,2 @@ +cDBUG = -pg +cOPT = -O2 diff --git a/wmake/rules/linux64Clang/general b/wmake/rules/linux64Clang/general new file mode 100644 index 0000000000..809751cd0a --- /dev/null +++ b/wmake/rules/linux64Clang/general @@ -0,0 +1,8 @@ +CPP = cpp -traditional-cpp $(GFLAGS) + +PROJECT_LIBS = -l$(WM_PROJECT) -liberty -ldl + +include $(GENERAL_RULES)/standard + +include $(RULES)/c +include $(RULES)/c++ diff --git a/wmake/rules/linux64Clang/mplibHPMPI b/wmake/rules/linux64Clang/mplibHPMPI new file mode 100644 index 0000000000..574492a236 --- /dev/null +++ b/wmake/rules/linux64Clang/mplibHPMPI @@ -0,0 +1,3 @@ +PFLAGS = +PINC = -I$(MPI_ARCH_PATH)/include -D_MPICC_H +PLIBS = -L$(MPI_ARCH_PATH)/lib/linux_amd64 -lmpi diff --git a/wmake/rules/linuxClang/c b/wmake/rules/linuxClang/c new file mode 100644 index 0000000000..99b3238306 --- /dev/null +++ b/wmake/rules/linuxClang/c @@ -0,0 +1,16 @@ +.SUFFIXES: .c .h + +cWARN = -Wall + +cc = clang -m32 + +include $(RULES)/c$(WM_COMPILE_OPTION) + +cFLAGS = $(GFLAGS) $(cWARN) $(cOPT) $(cDBUG) $(LIB_HEADER_DIRS) -fPIC + +ctoo = $(WM_SCHEDULER) $(cc) $(cFLAGS) -c $$SOURCE -o $@ + +LINK_LIBS = $(cDBUG) + +LINKLIBSO = $(cc) -shared +LINKEXE = $(cc) -Xlinker --add-needed -Xlinker -z -Xlinker nodefs diff --git a/wmake/rules/linuxClang/c++ b/wmake/rules/linuxClang/c++ new file mode 100644 index 0000000000..2f7a3bde44 --- /dev/null +++ b/wmake/rules/linuxClang/c++ @@ -0,0 +1,21 @@ +.SUFFIXES: .C .cxx .cc .cpp + +c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast + +CC = clang++ -m32 + +include $(RULES)/c++$(WM_COMPILE_OPTION) + +ptFLAGS = -DNoRepository -ftemplate-depth-60 + +c++FLAGS = $(GFLAGS) $(c++WARN) $(c++OPT) $(c++DBUG) $(ptFLAGS) $(LIB_HEADER_DIRS) -fPIC + +Ctoo = $(WM_SCHEDULER) $(CC) $(c++FLAGS) -c $$SOURCE -o $@ +cxxtoo = $(Ctoo) +cctoo = $(Ctoo) +cpptoo = $(Ctoo) + +LINK_LIBS = $(c++DBUG) + +LINKLIBSO = $(CC) $(c++FLAGS) -shared +LINKEXE = $(CC) $(c++FLAGS) -Xlinker --add-needed diff --git a/wmake/rules/linuxClang/c++Debug b/wmake/rules/linuxClang/c++Debug new file mode 100644 index 0000000000..19bdb9c334 --- /dev/null +++ b/wmake/rules/linuxClang/c++Debug @@ -0,0 +1,2 @@ +c++DBUG = -ggdb3 -DFULLDEBUG +c++OPT = -O0 -fdefault-inline diff --git a/wmake/rules/linuxClang/c++Opt b/wmake/rules/linuxClang/c++Opt new file mode 100644 index 0000000000..2aedabd628 --- /dev/null +++ b/wmake/rules/linuxClang/c++Opt @@ -0,0 +1,2 @@ +c++DBUG = +c++OPT = -O3 diff --git a/wmake/rules/linuxClang/c++Prof b/wmake/rules/linuxClang/c++Prof new file mode 100644 index 0000000000..3bda4dad55 --- /dev/null +++ b/wmake/rules/linuxClang/c++Prof @@ -0,0 +1,2 @@ +c++DBUG = -pg +c++OPT = -O2 diff --git a/wmake/rules/linuxClang/cDebug b/wmake/rules/linuxClang/cDebug new file mode 100644 index 0000000000..72b638f458 --- /dev/null +++ b/wmake/rules/linuxClang/cDebug @@ -0,0 +1,2 @@ +cDBUG = -ggdb -DFULLDEBUG +cOPT = -O1 -fdefault-inline -finline-functions diff --git a/wmake/rules/linuxClang/cOpt b/wmake/rules/linuxClang/cOpt new file mode 100644 index 0000000000..17318709f1 --- /dev/null +++ b/wmake/rules/linuxClang/cOpt @@ -0,0 +1,2 @@ +cDBUG = +cOPT = -O3 diff --git a/wmake/rules/linuxClang/cProf b/wmake/rules/linuxClang/cProf new file mode 100644 index 0000000000..ca3ac9bf5f --- /dev/null +++ b/wmake/rules/linuxClang/cProf @@ -0,0 +1,2 @@ +cDBUG = -pg +cOPT = -O2 diff --git a/wmake/rules/linuxClang/general b/wmake/rules/linuxClang/general new file mode 100644 index 0000000000..97ce8c940c --- /dev/null +++ b/wmake/rules/linuxClang/general @@ -0,0 +1,9 @@ +CPP = cpp -traditional-cpp $(GFLAGS) +LD = ld -melf_i386 + +PROJECT_LIBS = -l$(WM_PROJECT) -liberty -ldl + +include $(GENERAL_RULES)/standard + +include $(RULES)/c +include $(RULES)/c++ diff --git a/wmake/rules/linuxClang/mplibHPMPI b/wmake/rules/linuxClang/mplibHPMPI new file mode 100644 index 0000000000..8aff40632b --- /dev/null +++ b/wmake/rules/linuxClang/mplibHPMPI @@ -0,0 +1,3 @@ +PFLAGS = +PINC = -I$(MPI_ARCH_PATH)/include -D_MPICC_H +PLIBS = -L$(MPI_ARCH_PATH)/lib/linux_ia32 -lmpi From 05fe5f2f97efeb066c1815c343fcc551cb63e182 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 12 Oct 2010 11:09:32 +0200 Subject: [PATCH 3/7] COMP: forward declare lduScheduleEntry as struct not class --- .../matrices/lduMatrix/lduAddressing/lduSchedule/lduSchedule.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduSchedule/lduSchedule.H b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduSchedule/lduSchedule.H index 7c975627cc..3793a54528 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduSchedule/lduSchedule.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduSchedule/lduSchedule.H @@ -42,7 +42,7 @@ namespace Foam // Forward declaration of friend functions and operators -class lduScheduleEntry; +struct lduScheduleEntry; Ostream& operator<<(Ostream& os, const lduScheduleEntry& lb); From 95219e6f7672b4df2e049a8c5ab10798ecb243af Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 12 Oct 2010 12:17:13 +0200 Subject: [PATCH 4/7] COMP: specialization Foam::NamedEnum templates within namespace Foam - otherwise gets flagged as an error by clang --- src/OSspecific/POSIX/fileMonitor.C | 16 ++++---- src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C | 16 +++++--- src/OpenFOAM/db/Time/Time.C | 37 ++++++++++--------- .../outputFilterOutputControl.C | 21 ++++++----- .../constraint/cyclic/cyclicPolyPatch.C | 22 ++++++----- .../primitiveShapes/triangle/intersection.C | 30 ++++++++------- .../meshCut/directions/directions.C | 16 ++++---- .../slidingInterface/slidingInterface.C | 19 ++++++---- .../phaseProperties/phaseProperties.C | 18 +++++---- .../refinementSurfaces/refinementSurfaces.C | 36 ++++++++++-------- .../sets/cellSources/faceToCell/faceToCell.C | 26 ++++++------- .../faceZoneToCell/faceZoneToCell.C | 23 +++++------- .../cellSources/pointToCell/pointToCell.C | 21 ++++------- .../sets/faceSources/cellToFace/cellToFace.C | 22 +++++------ .../faceSources/pointToFace/pointToFace.C | 22 +++++------ .../pointSources/cellToPoint/cellToPoint.C | 20 ++++------ .../pointSources/faceToPoint/faceToPoint.C | 20 ++++------ .../sets/topoSetSource/topoSetSource.C | 26 ++++++------- .../distributedTriSurfaceMesh.C | 22 ++++++----- .../fieldAverageItem/fieldAverageItem.C | 14 ++++--- .../field/fieldMinMax/fieldMinMax.C | 14 ++++--- .../abortCalculation/abortCalculation.C | 20 +++++++--- src/sampling/sampledSet/coordSet/coordSet.C | 20 ++++++---- .../alphaContactAngleFvPatchScalarField.C | 26 ++++++------- 24 files changed, 272 insertions(+), 255 deletions(-) diff --git a/src/OSspecific/POSIX/fileMonitor.C b/src/OSspecific/POSIX/fileMonitor.C index 48807d2e68..982d5e28dc 100644 --- a/src/OSspecific/POSIX/fileMonitor.C +++ b/src/OSspecific/POSIX/fileMonitor.C @@ -49,19 +49,19 @@ Class defineTypeNameAndDebug(Foam::fileMonitor, 0); -template<> -const char* Foam::NamedEnum::names[] = -{ - "unmodified", - "modified", - "deleted" -}; const Foam::NamedEnum Foam::fileMonitor::fileStateNames_; - namespace Foam { + template<> + const char* Foam::NamedEnum::names[] = + { + "unmodified", + "modified", + "deleted" + }; + //- Reduction operator for PackedList of fileState class reduceFileStates { diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C index b5d22692f0..51e2fadfe7 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C @@ -32,13 +32,17 @@ License defineTypeNameAndDebug(Foam::UPstream, 0); -template<> -const char* Foam::NamedEnum::names[] = +namespace Foam { - "blocking", - "scheduled", - "nonBlocking" -}; + template<> + const char* Foam::NamedEnum::names[] = + { + "blocking", + "scheduled", + "nonBlocking" + }; +} + const Foam::NamedEnum Foam::UPstream::commsTypeNames; diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index aadcdc7c54..487576586b 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -32,28 +32,31 @@ License defineTypeNameAndDebug(Foam::Time, 0); -template<> -const char* Foam::NamedEnum::names[] = +namespace Foam { - "endTime", - "noWriteNow", - "writeNow", - "nextWrite" -}; + template<> + const char* Foam::NamedEnum::names[] = + { + "endTime", + "noWriteNow", + "writeNow", + "nextWrite" + }; + + template<> + const char* Foam::NamedEnum::names[] = + { + "timeStep", + "runTime", + "adjustableRunTime", + "clockTime", + "cpuTime" + }; +} const Foam::NamedEnum Foam::Time::stopAtControlNames_; -template<> -const char* Foam::NamedEnum::names[] = -{ - "timeStep", - "runTime", - "adjustableRunTime", - "clockTime", - "cpuTime" -}; - const Foam::NamedEnum Foam::Time::writeControlNames_; diff --git a/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C b/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C index 82e74c55c7..008085253d 100644 --- a/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C +++ b/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C @@ -27,16 +27,19 @@ License // * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * // -template<> -const char* Foam::NamedEnum -< - Foam::outputFilterOutputControl::outputControls, - 2 ->::names[] = +namespace Foam { - "timeStep", - "outputTime" -}; + template<> + const char* Foam::NamedEnum + < + Foam::outputFilterOutputControl::outputControls, + 2 + >::names[] = + { + "timeStep", + "outputTime" + }; +} const Foam::NamedEnum Foam::outputFilterOutputControl::outputControlNames_; diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C index 330b912fb9..01ed37fd16 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C @@ -44,16 +44,20 @@ namespace Foam addToRunTimeSelectionTable(polyPatch, cyclicPolyPatch, word); addToRunTimeSelectionTable(polyPatch, cyclicPolyPatch, dictionary); -} -template<> -const char* Foam::NamedEnum::names[] = -{ - "unknown", - "rotational", - "translational", - "noOrdering" -}; + template<> + const char* Foam::NamedEnum + < + Foam::cyclicPolyPatch::transformType, + 4 + >::names[] = + { + "unknown", + "rotational", + "translational", + "noOrdering" + }; +} const Foam::NamedEnum Foam::cyclicPolyPatch::transformTypeNames; diff --git a/src/OpenFOAM/meshes/primitiveShapes/triangle/intersection.C b/src/OpenFOAM/meshes/primitiveShapes/triangle/intersection.C index abaf9c5015..110754f77a 100644 --- a/src/OpenFOAM/meshes/primitiveShapes/triangle/intersection.C +++ b/src/OpenFOAM/meshes/primitiveShapes/triangle/intersection.C @@ -29,27 +29,29 @@ License Foam::scalar Foam::intersection::planarTol_ = 0.2; -template<> -const char* Foam::NamedEnum::names[] = +namespace Foam { - "vector", - "contactSphere" -}; + template<> + const char* Foam::NamedEnum::names[] = + { + "vector", + "contactSphere" + }; + + template<> + const char* Foam::NamedEnum::names[] = + { + "fullRay", + "halfRay", + "visible" + }; +} const Foam::NamedEnum Foam::intersection::directionNames_; -template<> -const char* Foam::NamedEnum::names[] = -{ - "fullRay", - "halfRay", - "visible" -}; - const Foam::NamedEnum Foam::intersection::algorithmNames_; - // ************************************************************************* // diff --git a/src/dynamicMesh/meshCut/directions/directions.C b/src/dynamicMesh/meshCut/directions/directions.C index 793323e54d..5f5fb220af 100644 --- a/src/dynamicMesh/meshCut/directions/directions.C +++ b/src/dynamicMesh/meshCut/directions/directions.C @@ -35,19 +35,21 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -template<> -const char* Foam::NamedEnum::names[] = +namespace Foam { - "tan1", - "tan2", - "normal" -}; + template<> + const char* Foam::NamedEnum::names[] = + { + "tan1", + "tan2", + "normal" + }; +} const Foam::NamedEnum Foam::directions::directionTypeNames_; - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // For debugging diff --git a/src/dynamicMesh/slidingInterface/slidingInterface.C b/src/dynamicMesh/slidingInterface/slidingInterface.C index b7bbecdc5c..85fa080750 100644 --- a/src/dynamicMesh/slidingInterface/slidingInterface.C +++ b/src/dynamicMesh/slidingInterface/slidingInterface.C @@ -45,17 +45,20 @@ namespace Foam slidingInterface, dictionary ); + + template<> + const char* Foam::NamedEnum + < + Foam::slidingInterface::typeOfMatch, + 2 + >::names[] = + { + "integral", + "partial" + }; } -template<> -const char* Foam::NamedEnum::names[] = -{ - "integral", - "partial" -}; - - const Foam::NamedEnum Foam::slidingInterface::typeOfMatchNames_; diff --git a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C index bd01c8b207..4ad492b064 100644 --- a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C +++ b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C @@ -27,15 +27,17 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -template<> -const char* Foam::NamedEnum::names[] = +namespace Foam { - "gas", - "liquid", - "solid", - "unknown" -}; - + template<> + const char* Foam::NamedEnum::names[] = + { + "gas", + "liquid", + "solid", + "unknown" + }; +} const Foam::NamedEnum Foam::phaseProperties::phaseTypeNames_; diff --git a/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C b/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C index ecb0542578..9a91bcccb0 100644 --- a/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C +++ b/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C @@ -34,15 +34,19 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -template<> -const char* -Foam::NamedEnum::names[] = +namespace Foam { - "inside", - "outside", - "insidePoint", - "none" -}; + template<> + const char* + Foam::NamedEnum::names[] = + { + "inside", + "outside", + "insidePoint", + "none" + }; +} + const Foam::NamedEnum Foam::refinementSurfaces::areaSelectionAlgoNames; @@ -388,7 +392,7 @@ Foam::labelList Foam::refinementSurfaces::getClosedNamedSurfaces() const } -// Get indices of named surfaces with a +// Get indices of named surfaces with a Foam::labelList Foam::refinementSurfaces::getInsidePointNamedSurfaces() const { labelList closed(cellZoneNames_.size()); @@ -411,9 +415,9 @@ Foam::labelList Foam::refinementSurfaces::getInsidePointNamedSurfaces() const // Foam::labelList Foam::refinementSurfaces::countRegions(const triSurface& s) // { // const geometricSurfacePatchList& regions = s.patches(); -// +// // labelList nTris(regions.size(), 0); -// +// // forAll(s, triI) // { // nTris[s[triI].region()]++; @@ -433,15 +437,15 @@ Foam::labelList Foam::refinementSurfaces::getInsidePointNamedSurfaces() const // ) const // { // const searchableSurface& geom = allGeometry_[surfaces_[surfI]]; -// +// // // Get per element the region // labelList region; // geom.getRegion(info, region); -// +// // // Initialise fields to region wise minLevel // minLevelField.setSize(ctrs.size()); // minLevelField = -1; -// +// // forAll(minLevelField, i) // { // if (info[i].hit()) @@ -449,12 +453,12 @@ Foam::labelList Foam::refinementSurfaces::getInsidePointNamedSurfaces() const // minLevelField[i] = minLevel(surfI, region[i]); // } // } -// +// // // Find out if triangle inside shell with higher level // // What level does shell want to refine fc to? // labelList shellLevel; // shells.findHigherLevel(ctrs, minLevelField, shellLevel); -// +// // forAll(minLevelField, i) // { // minLevelField[i] = max(minLevelField[i], shellLevel[i]); diff --git a/src/meshTools/sets/cellSources/faceToCell/faceToCell.C b/src/meshTools/sets/cellSources/faceToCell/faceToCell.C index db7cb5269f..9589929aed 100644 --- a/src/meshTools/sets/cellSources/faceToCell/faceToCell.C +++ b/src/meshTools/sets/cellSources/faceToCell/faceToCell.C @@ -33,13 +33,18 @@ License namespace Foam { + defineTypeNameAndDebug(faceToCell, 0); + addToRunTimeSelectionTable(topoSetSource, faceToCell, word); + addToRunTimeSelectionTable(topoSetSource, faceToCell, istream); -defineTypeNameAndDebug(faceToCell, 0); - -addToRunTimeSelectionTable(topoSetSource, faceToCell, word); - -addToRunTimeSelectionTable(topoSetSource, faceToCell, istream); - + template<> + const char* Foam::NamedEnum::names[] = + { + "neighbour", + "owner", + "any", + "all" + }; } @@ -51,15 +56,6 @@ Foam::topoSetSource::addToUsageTable Foam::faceToCell::usage_ " of the faces in the faceSet or where all faces are in the faceSet\n\n" ); -template<> -const char* Foam::NamedEnum::names[] = -{ - "neighbour", - "owner", - "any", - "all" -}; - const Foam::NamedEnum Foam::faceToCell::faceActionNames_; diff --git a/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.C b/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.C index da2feb7e04..2d5bd7f4d5 100644 --- a/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.C +++ b/src/meshTools/sets/cellSources/faceZoneToCell/faceZoneToCell.C @@ -32,13 +32,16 @@ License namespace Foam { + defineTypeNameAndDebug(faceZoneToCell, 0); + addToRunTimeSelectionTable(topoSetSource, faceZoneToCell, word); + addToRunTimeSelectionTable(topoSetSource, faceZoneToCell, istream); -defineTypeNameAndDebug(faceZoneToCell, 0); - -addToRunTimeSelectionTable(topoSetSource, faceZoneToCell, word); - -addToRunTimeSelectionTable(topoSetSource, faceZoneToCell, istream); - + template<> + const char* Foam::NamedEnum::names[] = + { + "master", + "slave" + }; } @@ -51,14 +54,6 @@ Foam::topoSetSource::addToUsageTable Foam::faceZoneToCell::usage_ ); -template<> -const char* Foam::NamedEnum::names[] = -{ - "master", - "slave" -}; - - const Foam::NamedEnum Foam::faceZoneToCell::faceActionNames_; diff --git a/src/meshTools/sets/cellSources/pointToCell/pointToCell.C b/src/meshTools/sets/cellSources/pointToCell/pointToCell.C index 359f82fae3..ebb3a010b9 100644 --- a/src/meshTools/sets/cellSources/pointToCell/pointToCell.C +++ b/src/meshTools/sets/cellSources/pointToCell/pointToCell.C @@ -33,13 +33,15 @@ License namespace Foam { + defineTypeNameAndDebug(pointToCell, 0); + addToRunTimeSelectionTable(topoSetSource, pointToCell, word); + addToRunTimeSelectionTable(topoSetSource, pointToCell, istream); -defineTypeNameAndDebug(pointToCell, 0); - -addToRunTimeSelectionTable(topoSetSource, pointToCell, word); - -addToRunTimeSelectionTable(topoSetSource, pointToCell, istream); - + template<> + const char* Foam::NamedEnum::names[] = + { + "any" + }; } @@ -50,13 +52,6 @@ Foam::topoSetSource::addToUsageTable Foam::pointToCell::usage_ " Select all cells with any point in the pointSet\n\n" ); -template<> -const char* Foam::NamedEnum::names[] = -{ - "any" -}; - - const Foam::NamedEnum Foam::pointToCell::pointActionNames_; diff --git a/src/meshTools/sets/faceSources/cellToFace/cellToFace.C b/src/meshTools/sets/faceSources/cellToFace/cellToFace.C index a7e5b8c285..2ff1769c8f 100644 --- a/src/meshTools/sets/faceSources/cellToFace/cellToFace.C +++ b/src/meshTools/sets/faceSources/cellToFace/cellToFace.C @@ -34,13 +34,16 @@ License namespace Foam { + defineTypeNameAndDebug(cellToFace, 0); + addToRunTimeSelectionTable(topoSetSource, cellToFace, word); + addToRunTimeSelectionTable(topoSetSource, cellToFace, istream); -defineTypeNameAndDebug(cellToFace, 0); - -addToRunTimeSelectionTable(topoSetSource, cellToFace, word); - -addToRunTimeSelectionTable(topoSetSource, cellToFace, istream); - + template<> + const char* Foam::NamedEnum::names[] = + { + "all", + "both" + }; } @@ -52,13 +55,6 @@ Foam::topoSetSource::addToUsageTable Foam::cellToFace::usage_ " -both: faces where both neighbours are in the cellSet\n\n" ); -template<> -const char* Foam::NamedEnum::names[] = -{ - "all", - "both" -}; - const Foam::NamedEnum Foam::cellToFace::cellActionNames_; diff --git a/src/meshTools/sets/faceSources/pointToFace/pointToFace.C b/src/meshTools/sets/faceSources/pointToFace/pointToFace.C index 51c7fb1351..8e272b86df 100644 --- a/src/meshTools/sets/faceSources/pointToFace/pointToFace.C +++ b/src/meshTools/sets/faceSources/pointToFace/pointToFace.C @@ -33,13 +33,16 @@ License namespace Foam { + defineTypeNameAndDebug(pointToFace, 0); + addToRunTimeSelectionTable(topoSetSource, pointToFace, word); + addToRunTimeSelectionTable(topoSetSource, pointToFace, istream); -defineTypeNameAndDebug(pointToFace, 0); - -addToRunTimeSelectionTable(topoSetSource, pointToFace, word); - -addToRunTimeSelectionTable(topoSetSource, pointToFace, istream); - + template<> + const char* Foam::NamedEnum::names[] = + { + "any", + "all" + }; } @@ -52,13 +55,6 @@ Foam::topoSetSource::addToUsageTable Foam::pointToFace::usage_ " -all points in the pointSet\n\n" ); -template<> -const char* Foam::NamedEnum::names[] = -{ - "any", - "all" -}; - const Foam::NamedEnum Foam::pointToFace::pointActionNames_; diff --git a/src/meshTools/sets/pointSources/cellToPoint/cellToPoint.C b/src/meshTools/sets/pointSources/cellToPoint/cellToPoint.C index aaa74c8493..5026b51cfc 100644 --- a/src/meshTools/sets/pointSources/cellToPoint/cellToPoint.C +++ b/src/meshTools/sets/pointSources/cellToPoint/cellToPoint.C @@ -33,13 +33,15 @@ License namespace Foam { + defineTypeNameAndDebug(cellToPoint, 0); + addToRunTimeSelectionTable(topoSetSource, cellToPoint, word); + addToRunTimeSelectionTable(topoSetSource, cellToPoint, istream); -defineTypeNameAndDebug(cellToPoint, 0); - -addToRunTimeSelectionTable(topoSetSource, cellToPoint, word); - -addToRunTimeSelectionTable(topoSetSource, cellToPoint, istream); - + template<> + const char* Foam::NamedEnum::names[] = + { + "all" + }; } @@ -50,12 +52,6 @@ Foam::topoSetSource::addToUsageTable Foam::cellToPoint::usage_ " Select all points of cells in the cellSet\n\n" ); -template<> -const char* Foam::NamedEnum::names[] = -{ - "all" -}; - const Foam::NamedEnum Foam::cellToPoint::cellActionNames_; diff --git a/src/meshTools/sets/pointSources/faceToPoint/faceToPoint.C b/src/meshTools/sets/pointSources/faceToPoint/faceToPoint.C index ff1161b820..4d0919f7c8 100644 --- a/src/meshTools/sets/pointSources/faceToPoint/faceToPoint.C +++ b/src/meshTools/sets/pointSources/faceToPoint/faceToPoint.C @@ -33,13 +33,15 @@ License namespace Foam { + defineTypeNameAndDebug(faceToPoint, 0); + addToRunTimeSelectionTable(topoSetSource, faceToPoint, word); + addToRunTimeSelectionTable(topoSetSource, faceToPoint, istream); -defineTypeNameAndDebug(faceToPoint, 0); - -addToRunTimeSelectionTable(topoSetSource, faceToPoint, word); - -addToRunTimeSelectionTable(topoSetSource, faceToPoint, istream); - + template<> + const char* Foam::NamedEnum::names[] = + { + "all" + }; } @@ -50,12 +52,6 @@ Foam::topoSetSource::addToUsageTable Foam::faceToPoint::usage_ " Select all points of faces in the faceSet\n\n" ); -template<> -const char* Foam::NamedEnum::names[] = -{ - "all" -}; - const Foam::NamedEnum Foam::faceToPoint::faceActionNames_; diff --git a/src/meshTools/sets/topoSetSource/topoSetSource.C b/src/meshTools/sets/topoSetSource/topoSetSource.C index bb68be7e9c..f82cf59a90 100644 --- a/src/meshTools/sets/topoSetSource/topoSetSource.C +++ b/src/meshTools/sets/topoSetSource/topoSetSource.C @@ -34,24 +34,24 @@ namespace Foam defineTypeNameAndDebug(topoSetSource, 0); defineRunTimeSelectionTable(topoSetSource, word); defineRunTimeSelectionTable(topoSetSource, istream); + + template<> + const char* Foam::NamedEnum::names[] = + { + "clear", + "new", + "invert", + "add", + "delete", + "subset", + "list", + "remove" + }; } Foam::HashTable* Foam::topoSetSource::usageTablePtr_ = NULL; -template<> -const char* Foam::NamedEnum::names[] = -{ - "clear", - "new", - "invert", - "add", - "delete", - "subset", - "list", - "remove" -}; - const Foam::NamedEnum Foam::topoSetSource::actionNames_; diff --git a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C index 80d9c43651..accee92b3f 100644 --- a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C +++ b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C @@ -49,18 +49,20 @@ namespace Foam distributedTriSurfaceMesh, dict ); + + template<> + const char* Foam::NamedEnum + < + Foam::distributedTriSurfaceMesh::distributionType, + 3 + >::names[] = + { + "follow", + "independent", + "frozen" + }; } - -template<> -const char* -Foam::NamedEnum::names[] = -{ - "follow", - "independent", - "frozen" -}; - const Foam::NamedEnum Foam::distributedTriSurfaceMesh::distributionTypeNames_; diff --git a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItem.C b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItem.C index 591bc36229..ee3d6e4e8a 100644 --- a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItem.C +++ b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverageItem/fieldAverageItem.C @@ -27,12 +27,16 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -template<> -const char* Foam::NamedEnum::names[] = +namespace Foam { - "iteration", - "time" -}; + template<> + const char* Foam::NamedEnum::names[] = + { + "iteration", + "time" + }; +} + const Foam::NamedEnum Foam::fieldAverageItem::baseTypeNames_; diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C index eda5f7434f..c0f715e716 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C @@ -33,13 +33,15 @@ License defineTypeNameAndDebug(Foam::fieldMinMax, 0); - -template<> -const char* Foam::NamedEnum::names[] = +namespace Foam { - "magnitude", - "component" -}; + template<> + const char* Foam::NamedEnum::names[] = + { + "magnitude", + "component" + }; +} const Foam::NamedEnum diff --git a/src/postProcessing/functionObjects/jobControl/abortCalculation/abortCalculation.C b/src/postProcessing/functionObjects/jobControl/abortCalculation/abortCalculation.C index 49ae674ef6..f26f558fb5 100644 --- a/src/postProcessing/functionObjects/jobControl/abortCalculation/abortCalculation.C +++ b/src/postProcessing/functionObjects/jobControl/abortCalculation/abortCalculation.C @@ -37,13 +37,21 @@ defineTypeNameAndDebug(Foam::abortCalculation, 0); // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -template<> -const char* Foam::NamedEnum::names[] = +namespace Foam { - "noWriteNow", - "writeNow", - "nextWrite" -}; + template<> + const char* Foam::NamedEnum + < + Foam::abortCalculation::actionType, + 3 + >::names[] = + { + "noWriteNow", + "writeNow", + "nextWrite" + }; +} + const Foam::NamedEnum Foam::abortCalculation::actionTypeNames_; diff --git a/src/sampling/sampledSet/coordSet/coordSet.C b/src/sampling/sampledSet/coordSet/coordSet.C index bc1237f310..24d6b4174c 100644 --- a/src/sampling/sampledSet/coordSet/coordSet.C +++ b/src/sampling/sampledSet/coordSet/coordSet.C @@ -27,15 +27,19 @@ License // * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * // -template<> -const char* Foam::NamedEnum::names[] = +namespace Foam { - "xyz", - "x", - "y", - "z", - "distance" -}; + template<> + const char* Foam::NamedEnum::names[] = + { + "xyz", + "x", + "y", + "z", + "distance" + }; +} + const Foam::NamedEnum Foam::coordSet::coordFormatNames_; diff --git a/src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.C b/src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.C index 1d030286cf..53e2bdc5c8 100644 --- a/src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.C +++ b/src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.C @@ -33,20 +33,20 @@ License namespace Foam { defineTypeNameAndDebug(alphaContactAngleFvPatchScalarField, 0); -} -template<> -const char* Foam::NamedEnum -< - Foam::alphaContactAngleFvPatchScalarField::limitControls, - 4 ->::names[] = -{ - "none", - "gradient", - "zeroGradient", - "alpha" -}; + template<> + const char* Foam::NamedEnum + < + Foam::alphaContactAngleFvPatchScalarField::limitControls, + 4 + >::names[] = + { + "none", + "gradient", + "zeroGradient", + "alpha" + }; +} const Foam::NamedEnum < From ee0cb57cd9ecf8bb2ee6de810c617e86baf6bf7e Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 12 Oct 2010 12:17:13 +0200 Subject: [PATCH 5/7] COMP: specializations of templates within namespace Foam - otherwise gets flagged as an error by clang --- .../Tensor/labelTensor/labelTensor.C | 49 ++++++++++--------- .../Vector/labelVector/labelVector.C | 20 ++++---- 2 files changed, 37 insertions(+), 32 deletions(-) diff --git a/src/OpenFOAM/primitives/Tensor/labelTensor/labelTensor.C b/src/OpenFOAM/primitives/Tensor/labelTensor/labelTensor.C index 63419832af..e8a189f094 100644 --- a/src/OpenFOAM/primitives/Tensor/labelTensor/labelTensor.C +++ b/src/OpenFOAM/primitives/Tensor/labelTensor/labelTensor.C @@ -28,32 +28,35 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -template<> -const char* const Foam::labelTensor::typeName = "labelTensor"; - -template<> -const char* Foam::labelTensor::componentNames[] = +namespace Foam { - "xx", "xy", "xz", - "yx", "yy", "yz", - "zx", "zy", "zz" -}; + template<> + const char* const Foam::labelTensor::typeName = "labelTensor"; -template<> -const Foam::labelTensor Foam::labelTensor::zero -( - 0, 0, 0, - 0, 0, 0, - 0, 0, 0 -); + template<> + const char* Foam::labelTensor::componentNames[] = + { + "xx", "xy", "xz", + "yx", "yy", "yz", + "zx", "zy", "zz" + }; -template<> -const Foam::labelTensor Foam::labelTensor::one -( - 1, 1, 1, - 1, 1, 1, - 1, 1, 1 -); + template<> + const Foam::labelTensor Foam::labelTensor::zero + ( + 0, 0, 0, + 0, 0, 0, + 0, 0, 0 + ); + + template<> + const Foam::labelTensor Foam::labelTensor::one + ( + 1, 1, 1, + 1, 1, 1, + 1, 1, 1 + ); +} // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/Vector/labelVector/labelVector.C b/src/OpenFOAM/primitives/Vector/labelVector/labelVector.C index b7473ee50e..c98da288cf 100644 --- a/src/OpenFOAM/primitives/Vector/labelVector/labelVector.C +++ b/src/OpenFOAM/primitives/Vector/labelVector/labelVector.C @@ -27,17 +27,19 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -template<> -const char* const Foam::labelVector::typeName = "labelVector"; +namespace Foam +{ + template<> + const char* const Foam::labelVector::typeName = "labelVector"; -template<> -const char* Foam::labelVector::componentNames[] = {"x", "y", "z"}; + template<> + const char* Foam::labelVector::componentNames[] = {"x", "y", "z"}; -template<> -const Foam::labelVector Foam::labelVector::zero(0, 0, 0); - -template<> -const Foam::labelVector Foam::labelVector::one(1, 1, 1); + template<> + const Foam::labelVector Foam::labelVector::zero(0, 0, 0); + template<> + const Foam::labelVector Foam::labelVector::one(1, 1, 1); +} // ************************************************************************* // From 850fa066d3282d435e85af7b208d2ce566ea1a28 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 13 Oct 2010 10:43:16 +0200 Subject: [PATCH 6/7] ENH: add UList typedefs for the various List counterparts - eg, labelUList <-> labelList scalarUList <-> scalarList ... Note the unallocLabelList typedef is still available. However labelUList requires less typing (10 vs. 17 chars) and has a more obvious to labelList. --- doc/doxygen/Doxyfile | 6 ++++-- .../Lists/PackedList/PackedBoolList.H | 6 ++++++ src/OpenFOAM/containers/Lists/UList/UList.H | 1 + src/OpenFOAM/primitives/Lists/boolList.H | 8 ++++++++ src/OpenFOAM/primitives/Lists/fileNameList.H | 10 +++++++++- src/OpenFOAM/primitives/Lists/labelList.H | 18 +++++++++++++++--- src/OpenFOAM/primitives/Lists/scalarList.H | 10 +++++++++- .../primitives/Lists/sphericalTensorList.H | 10 +++++++++- src/OpenFOAM/primitives/Lists/stringList.H | 10 +++++++++- src/OpenFOAM/primitives/Lists/symmTensorList.H | 10 +++++++++- src/OpenFOAM/primitives/Lists/tensorList.H | 10 +++++++++- src/OpenFOAM/primitives/Lists/vectorList.H | 10 +++++++++- src/OpenFOAM/primitives/Lists/wordList.H | 10 +++++++++- src/OpenFOAM/primitives/Lists/wordReList.H | 12 ++++++++++-- .../primitives/strings/wordRe/wordRe.C | 2 +- .../primitives/strings/wordRe/wordRe.H | 2 +- .../primitives/strings/wordRe/wordReI.H | 2 +- 17 files changed, 119 insertions(+), 18 deletions(-) diff --git a/doc/doxygen/Doxyfile b/doc/doxygen/Doxyfile index 1445ad0bc2..51a8ae2b50 100644 --- a/doc/doxygen/Doxyfile +++ b/doc/doxygen/Doxyfile @@ -574,12 +574,14 @@ WARN_LOGFILE = # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -# INPUT = $(WM_PROJECT_DIR)/src \ +#INPUT = $(WM_PROJECT_DIR)/src \ # $(WM_PROJECT_DIR)/applications/utilities \ # $(WM_PROJECT_DIR)/applications/solvers # limit input for testing purposes -INPUT = $(WM_PROJECT_DIR)/src/OpenFOAM/global +INPUT = $(WM_PROJECT_DIR)/src/OpenFOAM/global \ + $(WM_PROJECT_DIR)/src/OpenFOAM/containers \ + $(WM_PROJECT_DIR)/src/OpenFOAM/primitives # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is diff --git a/src/OpenFOAM/containers/Lists/PackedList/PackedBoolList.H b/src/OpenFOAM/containers/Lists/PackedList/PackedBoolList.H index 7e47674b8b..fb790a3e05 100644 --- a/src/OpenFOAM/containers/Lists/PackedList/PackedBoolList.H +++ b/src/OpenFOAM/containers/Lists/PackedList/PackedBoolList.H @@ -51,6 +51,12 @@ SeeAlso namespace Foam { +// Forward declaration +class PackedBoolList; + +//- @typedef A List of PackedBoolList +typedef List PackedBoolListList; + /*---------------------------------------------------------------------------*\ Class PackedBoolList Declaration \*---------------------------------------------------------------------------*/ diff --git a/src/OpenFOAM/containers/Lists/UList/UList.H b/src/OpenFOAM/containers/Lists/UList/UList.H index 8f7e009287..d0cb05fc17 100644 --- a/src/OpenFOAM/containers/Lists/UList/UList.H +++ b/src/OpenFOAM/containers/Lists/UList/UList.H @@ -59,6 +59,7 @@ template class SubList; template class UList; template Ostream& operator<<(Ostream&, const UList&); +typedef UList