diff --git a/applications/test/codeStream/codeStreamDict1 b/applications/test/codeStream/codeStreamDict1 index ec94ddb17366ae062009bd41da453fa2f0899f07..59eb3d43f66fcab1d2a1d701380bd9000c89a1d8 100644 --- a/applications/test/codeStream/codeStreamDict1 +++ b/applications/test/codeStream/codeStreamDict1 @@ -33,10 +33,20 @@ writeInterval #codeStream -I$(LIB_SRC)/finiteVolume/lnInclude #}; + localCode + #{ + static int someCode() + { + Info<<"called someCode\n"; + return 10; + } + #}; + code #{ label interval = ($endIter - $begIter); - label nDumps = $nDumps; + // label nDumps = $nDumps; + label nDumps = someCode(); os << (interval / nDumps); #}; }; diff --git a/applications/utilities/mesh/advanced/PDRMesh/Make/options b/applications/utilities/mesh/advanced/PDRMesh/Make/options index 6ab51e876af65b2f20212ffa2f91f0e33da6691c..4ce2e001eaab52b06b6368812abbcf33685c4698 100644 --- a/applications/utilities/mesh/advanced/PDRMesh/Make/options +++ b/applications/utilities/mesh/advanced/PDRMesh/Make/options @@ -8,4 +8,3 @@ EXE_LIBS = \ -ldynamicMesh \ -lfiniteVolume \ -lcompressibleRASModels - diff --git a/etc/codeTemplates/dynamicCode/codeStreamTemplate.C b/etc/codeTemplates/dynamicCode/codeStreamTemplate.C index 35ff81f47667f83e528a78b0de97d38db3036425..f742a2b2309e58c32328c5dbfcbd77b02e2d5fb5 100644 --- a/etc/codeTemplates/dynamicCode/codeStreamTemplate.C +++ b/etc/codeTemplates/dynamicCode/codeStreamTemplate.C @@ -34,26 +34,37 @@ Description ${codeInclude} //}}} end codeInclude -using namespace Foam; - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +namespace Foam +{ + +// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * // + +//{{{ begin localCode +${localCode} +//}}} end localCode + + +// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // extern "C" { -void ${typeName} -( - Ostream& os, - const dictionary& dict -) -{ + void ${typeName} + ( + Ostream& os, + const dictionary& dict + ) + { //{{{ begin code -${code}; + ${code} //}}} end code -} + } } + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace Foam + // ************************************************************************* // diff --git a/etc/codeTemplates/dynamicCode/fixedValueFvPatchScalarFieldTemplate.C b/etc/codeTemplates/dynamicCode/fixedValueFvPatchScalarFieldTemplate.C index 9e88840aec46de4ecf819ddc7c36a69603774411..280ee4810db4df1a011f9fb30ded7bcd8973d2ee 100644 --- a/etc/codeTemplates/dynamicCode/fixedValueFvPatchScalarFieldTemplate.C +++ b/etc/codeTemplates/dynamicCode/fixedValueFvPatchScalarFieldTemplate.C @@ -38,6 +38,13 @@ ${codeInclude} namespace Foam { +// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * // + +//{{{ begin localCode +${localCode} +//}}} end localCode + + // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // extern "C" @@ -60,6 +67,17 @@ extern "C" } } +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makeRemovablePatchTypeField +( + fvPatchScalarField, + ${typeName}FixedValueFvPatchScalarField +); + + +const char* ${typeName}FixedValueFvPatchScalarField::SHA1sum = "${SHA1sum}"; + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -177,22 +195,13 @@ void ${typeName}FixedValueFvPatchScalarField::updateCoeffs() } //{{{ begin code - ${code}; + ${code} //}}} end code fixedValueFvPatchScalarField::updateCoeffs(); } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makeRemovablePatchTypeField -( - fvPatchScalarField, - ${typeName}FixedValueFvPatchScalarField -); - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/etc/codeTemplates/dynamicCode/fixedValueFvPatchScalarFieldTemplate.H b/etc/codeTemplates/dynamicCode/fixedValueFvPatchScalarFieldTemplate.H index c9a2d1c1604b5de95e251d445f0a681b0604702e..742a9ca01bd9ce7bb5ffda611d94128a910ce881 100644 --- a/etc/codeTemplates/dynamicCode/fixedValueFvPatchScalarFieldTemplate.H +++ b/etc/codeTemplates/dynamicCode/fixedValueFvPatchScalarFieldTemplate.H @@ -55,6 +55,9 @@ class ${typeName}FixedValueFvPatchScalarField public: + //- Information about the SHA1 of the code itself + static const char* SHA1sum; + //- Runtime type information TypeName("${typeName}"); diff --git a/etc/cshrc b/etc/cshrc index 9b9f04c47c2a2d1d6bd0e70280d7de40f69fd46a..476efeb43308f7e09c3de29c4833fb0626720ce9 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -64,8 +64,8 @@ set foamCompiler=system # WM_COMPILER = Gcc | Gcc43 | Gcc44 | Gcc45 | Clang | Icc (Intel icc) setenv WM_COMPILER Gcc setenv WM_COMPILER_ARCH # defined but empty -setenv WM_COMPILER_LIB_ARCH # defined but empty -# +unsetenv WM_COMPILER_LIB_ARCH + #- Architecture: # WM_ARCH_OPTION = 32 | 64 setenv WM_ARCH_OPTION 64 diff --git a/etc/settings.csh b/etc/settings.csh index 48b234a337a422c25172b4e5bbd2fa121b38ed4f..76beaadb51319ef8e63450fec4e63abf55292de8 100644 --- a/etc/settings.csh +++ b/etc/settings.csh @@ -164,18 +164,19 @@ case ThirdParty: _foamAddMan $gccDir/man _foamAddPath $gccDir/bin + # add compiler libraries to run-time environment # 64-bit needs lib64, but 32-bit needs lib (not lib32) - if ($WM_ARCH_OPTION == 64) then + if ($WM_ARCH_OPTION == 64 && $?WM_COMPILER_LIB_ARCH) then _foamAddLib $gccDir/lib$WM_COMPILER_LIB_ARCH else _foamAddLib $gccDir/lib endif - # add in gmp/mpfr libraries + # add gmp/mpfr libraries to run-time environment _foamAddLib $gmpDir/lib _foamAddLib $mpfrDir/lib - # add in mpc libraries (not need for older gcc) + # add mpc libraries (not need for older gcc) to run-time environment if ( $?mpc_version ) then _foamAddLib $mpcDir/lib endif diff --git a/etc/settings.sh b/etc/settings.sh index beebfacf74eb5769ddd86aea39f5ed92dfe8f22c..edbabe3cb6db25ab80aa14747689c7ca9220d25f 100644 --- a/etc/settings.sh +++ b/etc/settings.sh @@ -182,6 +182,7 @@ OpenFOAM | ThirdParty) _foamAddMan $gccDir/man _foamAddPath $gccDir/bin + # add compiler libraries to run-time environment # 64-bit needs lib64, but 32-bit needs lib (not lib32) if [ "$WM_ARCH_OPTION" = 64 ] then @@ -190,11 +191,12 @@ OpenFOAM | ThirdParty) _foamAddLib $gccDir/lib fi - # add in gmp/mpfr libraries + + # add gmp/mpfr libraries to run-time environment _foamAddLib $gmpDir/lib _foamAddLib $mpfrDir/lib - # add in mpc libraries (not need for older gcc) + # add mpc libraries (not need for older gcc) to run-time environment if [ -n "$mpc_version" ] then _foamAddLib $mpcDir/lib diff --git a/src/Allwmake b/src/Allwmake index 37313b73dfdbf52d18ce6bd8b585741a7454c3c6..2013e4b0de892502a224802185c7fe7dd3521f3a 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -1,6 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -[ $# -ge 1 ] && makeOption=$1 || makeOption=libso +makeType=${1:-libso} wmakeCheckPwd "$WM_PROJECT_DIR/src" || { echo "Error: Current directory is not \$WM_PROJECT_DIR/src" @@ -25,49 +25,49 @@ wmakeLnInclude OSspecific/${WM_OSTYPE:-POSIX} Pstream/Allwmake $* OSspecific/${WM_OSTYPE:-POSIX}/Allwmake -wmake $makeOption OpenFOAM +wmake $makeType OpenFOAM -wmake $makeOption fileFormats -wmake $makeOption triSurface -wmake $makeOption meshTools -wmake $makeOption edgeMesh -wmake $makeOption surfMesh +wmake $makeType fileFormats +wmake $makeType triSurface +wmake $makeType meshTools +wmake $makeType edgeMesh +wmake $makeType surfMesh # Decomposition methods needed by dummyThirdParty parallel/decompose/AllwmakeLnInclude # dummyThirdParty (dummy metisDecomp, scotchDecomp etc) needed by e.g. meshTools dummyThirdParty/Allwmake $* -wmake $makeOption finiteVolume -wmake $makeOption lagrangian/basic -wmake $makeOption lagrangian/distributionModels -wmake $makeOption genericPatchFields +wmake $makeType finiteVolume +wmake $makeType lagrangian/basic +wmake $makeType lagrangian/distributionModels +wmake $makeType genericPatchFields # Build the proper scotchDecomp, metisDecomp etc. parallel/Allwmake $* -wmake $makeOption conversion +wmake $makeType conversion -wmake $makeOption sampling +wmake $makeType sampling -wmake $makeOption dynamicMesh -wmake $makeOption dynamicFvMesh -wmake $makeOption topoChangerFvMesh +wmake $makeType dynamicMesh +wmake $makeType dynamicFvMesh +wmake $makeType topoChangerFvMesh -wmake $makeOption ODE -wmake $makeOption randomProcesses +wmake $makeType ODE +wmake $makeType randomProcesses thermophysicalModels/Allwmake $* transportModels/Allwmake $* turbulenceModels/Allwmake $* -wmake $makeOption surfaceFilmModels +wmake $makeType surfaceFilmModels lagrangian/Allwmake $* postProcessing/Allwmake $* mesh/Allwmake $* fvAgglomerationMethods/Allwmake $* -wmake $makeOption fvMotionSolver -wmake $makeOption engine +wmake $makeType fvMotionSolver +wmake $makeType engine # ----------------------------------------------------------------- end-of-file diff --git a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C index 3f66a438393c11a968a59d930a79bad5a8486113..00b94cb4264229a1017fadabdae2e1dd8ebdf5a4 100644 --- a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C +++ b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C @@ -373,6 +373,7 @@ void Foam::dynamicCode::setFilterContext const dynamicCodeContext& context ) { + filterVars_.set("localCode", context.localCode()); filterVars_.set("code", context.code()); filterVars_.set("codeInclude", context.include()); filterVars_.set("SHA1sum", context.sha1().str()); @@ -523,7 +524,7 @@ bool Foam::dynamicCode::copyOrCreateFiles(const bool verbose) const bool Foam::dynamicCode::wmakeLibso() const { - const Foam::string wmakeCmd("wmake libso " + this->codeRelPath()); + const Foam::string wmakeCmd("wmake -s libso " + this->codeRelPath()); Info<< "Invoking " << wmakeCmd << endl; if (Foam::system(wmakeCmd)) diff --git a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCodeContext.C b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCodeContext.C index 44ca8f6fda21ff33a31f57385a72db3035b34387..4031f92144c86ce74433c9a013a42de5df6beae7 100644 --- a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCodeContext.C +++ b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCodeContext.C @@ -35,6 +35,7 @@ Foam::dynamicCodeContext::dynamicCodeContext(const dictionary& dict) : dict_(dict), code_(stringOps::trim(dict["code"])), + localCode_(), include_(), options_() { @@ -45,6 +46,13 @@ Foam::dynamicCodeContext::dynamicCodeContext(const dictionary& dict) // - necessary for compilation options, convenient for includes // and body. + // optional + if (dict.found("localCode")) + { + localCode_ = stringOps::trim(dict["localCode"]); + stringOps::inplaceExpand(localCode_, dict); + } + // optional if (dict.found("codeInclude")) { @@ -59,9 +67,9 @@ Foam::dynamicCodeContext::dynamicCodeContext(const dictionary& dict) stringOps::inplaceExpand(options_, dict); } - // calculate SHA1 digest from include, options, code + // calculate SHA1 digest from include, options, localCode, code OSHA1stream os; - os << include_ << options_ << code_; + os << include_ << options_ << localCode_ << code_; sha1_ = os.digest(); } diff --git a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCodeContext.H b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCodeContext.H index 2aa248c20f7729327262f4283a4074ff28c560a3..01aa7e2b05b83c9ca40dc83ac30f2a04cca72f9f 100644 --- a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCodeContext.H +++ b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCodeContext.H @@ -57,6 +57,9 @@ class dynamicCodeContext //- Mandatory "code" entry string code_; + //- Optional "localCode" entry + string localCode_; + //- Optional "codeInclude" entry string include_; @@ -99,6 +102,12 @@ public: return code_; } + //- Return the local (file-scope) code + const string& localCode() const + { + return localCode_; + } + //- Return SHA1 digest calculated from include, options, code const SHA1Digest& sha1() const { diff --git a/src/Pstream/Allwmake b/src/Pstream/Allwmake index 742d3d4478eaf475cf4d7f7174a8a5cb8041a8e3..613263d7bc026a47d5907270b58e8137bea14252 100755 --- a/src/Pstream/Allwmake +++ b/src/Pstream/Allwmake @@ -1,9 +1,9 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -[ $# -ge 1 ] && makeOption=$1 || makeOption=libso +makeType=${1:-libso} set -x -wmake $makeOption dummy +wmake $makeType dummy case "$WM_MPLIB" in *MPI*) @@ -13,11 +13,11 @@ case "$WM_MPLIB" in echo set -x # force compilation into qualified directory - WM_OPTIONS=${WM_OPTIONS}$WM_MPLIB wmake $makeOption mpi + WM_OPTIONS=${WM_OPTIONS}$WM_MPLIB wmake $makeType mpi ;; #GAMMA) -# wmake $makeOption gamma +# wmake $makeType gamma # ;; esac diff --git a/src/conversion/Allwmake b/src/conversion/Allwmake index 444d3f654914f34ac8b85f9fb9ab7494dc57437a..014885de4792becd0a6dff09304e0c5e6cc63d9f 100755 --- a/src/conversion/Allwmake +++ b/src/conversion/Allwmake @@ -1,8 +1,8 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -[ $# -ge 1 ] && makeOption=$1 || makeOption=libso +makeType=${1:-libso} set -x -wmake $makeOption +wmake $makeType # ----------------------------------------------------------------- end-of-file diff --git a/src/dummyThirdParty/Allwmake b/src/dummyThirdParty/Allwmake index 5076d8d2b72e19cf8ef9d71a6962fc0a75db8cd0..d747a472dbb6aefa4544614087ab8712e5d9df96 100755 --- a/src/dummyThirdParty/Allwmake +++ b/src/dummyThirdParty/Allwmake @@ -1,12 +1,12 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -[ $# -ge 1 ] && makeOption=$1 || makeOption=libso +makeType=${1:-libso} set -x -wmake $makeOption scotchDecomp -wmake $makeOption ptscotchDecomp -wmake $makeOption metisDecomp -wmake $makeOption MGridGen +wmake $makeType scotchDecomp +wmake $makeType ptscotchDecomp +wmake $makeType metisDecomp +wmake $makeType MGridGen # ----------------------------------------------------------------- end-of-file diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchScalarField.C index 9123e0cb7019147d6303099199481302add01705..fb4fdbef83cee7c88a73218484b6d4180f9126de 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchScalarField.C @@ -45,6 +45,7 @@ const Foam::word Foam::codedFixedValueFvPatchScalarField::codeTemplateC const Foam::word Foam::codedFixedValueFvPatchScalarField::codeTemplateH = "fixedValueFvPatchScalarFieldTemplate.H"; + // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // void* Foam::codedFixedValueFvPatchScalarField::loadLibrary @@ -352,7 +353,7 @@ codedFixedValueFvPatchScalarField fixedValueFvPatchField<scalar>(ptf, p, iF, mapper), dict_(ptf.dict_), redirectType_(ptf.redirectType_), - oldLibPath_(), + oldLibPath_(ptf.oldLibPath_), redirectPatchFieldPtr_() {} @@ -384,7 +385,7 @@ codedFixedValueFvPatchScalarField fixedValueFvPatchField<scalar>(ptf), dict_(ptf.dict_), redirectType_(ptf.redirectType_), - oldLibPath_(), + oldLibPath_(ptf.oldLibPath_), redirectPatchFieldPtr_() {} @@ -399,7 +400,7 @@ codedFixedValueFvPatchScalarField fixedValueFvPatchField<scalar>(ptf, iF), dict_(ptf.dict_), redirectType_(ptf.redirectType_), - oldLibPath_(), + oldLibPath_(ptf.oldLibPath_), redirectPatchFieldPtr_() {} @@ -412,7 +413,7 @@ Foam::codedFixedValueFvPatchScalarField::redirectPatchField() const if (!redirectPatchFieldPtr_.valid()) { // Construct a patch - // Make sure to construct the patchfield with uptodate value. + // Make sure to construct the patchfield with up-to-date value OStringStream os; os.writeKeyword("type") << redirectType_ << token::END_STATEMENT @@ -420,19 +421,6 @@ Foam::codedFixedValueFvPatchScalarField::redirectPatchField() const static_cast<const scalarField&>(*this).writeEntry("value", os); IStringStream is(os.str()); dictionary dict(is); -// Info<< "constructing patchField from :" << dict << endl; - -// if (fvPatchScalarField::dictionaryConstructorTablePtr_) -// { -// fvPatchScalarField::dictionaryConstructorPtr funcPtr = -// ( -// fvPatchScalarField::dictionaryConstructorTablePtr_-> -// find(redirectType_)() -// ); -// -// Info<< redirectType_ << " FunctionPtr => " -// << long(funcPtr) << endl; -// } redirectPatchFieldPtr_.set ( @@ -455,7 +443,7 @@ void Foam::codedFixedValueFvPatchScalarField::updateCoeffs() return; } - // Make sure library containing user-defined fvPatchField is uptodate + // Make sure library containing user-defined fvPatchField is up-to-date updateLibrary(); const fvPatchScalarField& fvp = redirectPatchField(); @@ -474,7 +462,7 @@ void Foam::codedFixedValueFvPatchScalarField::evaluate const Pstream::commsTypes commsType ) { - // Make sure library containing user-defined fvPatchField is uptodate + // Make sure library containing user-defined fvPatchField is up-to-date updateLibrary(); const fvPatchScalarField& fvp = redirectPatchField(); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchScalarField.H index 0161654f30c6b3acd5f998026f950c1c007151cf..003f03dc6c3a2da49742ac93ea8b8edba90b2b12 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchScalarField.H @@ -119,6 +119,7 @@ class codedFixedValueFvPatchScalarField //- Global loader/unloader function type typedef void (*loaderFunctionType)(bool); + //- Load specified library and execute globalFuncName(true) static void* loadLibrary ( const fileName& libPath, @@ -126,6 +127,7 @@ class codedFixedValueFvPatchScalarField const dictionary& contextDict ); + //- Execute globalFuncName(false) and unload specified library static void unloadLibrary ( const fileName& libPath, @@ -134,6 +136,7 @@ class codedFixedValueFvPatchScalarField ); + //- Create library based on the dynamicCodeContext void createLibrary(dynamicCode&, const dynamicCodeContext&) const; //- Update library as required diff --git a/src/fvAgglomerationMethods/Allwmake b/src/fvAgglomerationMethods/Allwmake index 8328d915fc671b1561795a490c5470167e86a10f..c4313c1a470d5271de0ab063e186c26e516d6690 100755 --- a/src/fvAgglomerationMethods/Allwmake +++ b/src/fvAgglomerationMethods/Allwmake @@ -1,13 +1,13 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -[ $# -ge 1 ] && makeOption=$1 || makeOption=libso +makeType=${1:-libso} set -x export ParMGridGen=$WM_THIRD_PARTY_DIR/ParMGridGen-1.0 if [ -d "$ParMGridGen/MGridGen/Lib" ] then - wmake $makeOption MGridGenGamgAgglomeration + wmake $makeType MGridGenGamgAgglomeration fi wmake libso pairPatchAgglomeration diff --git a/src/lagrangian/Allwmake b/src/lagrangian/Allwmake index 908338e62f2a6efbcfc54eb13c3efe4e48b00466..b8774ae5949b68378240d0bded8a3da7f7ac13c1 100755 --- a/src/lagrangian/Allwmake +++ b/src/lagrangian/Allwmake @@ -1,15 +1,15 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -[ $# -ge 1 ] && makeOption=$1 || makeOption=libso +makeType=${1:-libso} set -x -wmake $makeOption distributionModels -wmake $makeOption basic -wmake $makeOption solidParticle -wmake $makeOption intermediate -wmake $makeOption dieselSpray -wmake $makeOption dsmc -wmake $makeOption coalCombustion +wmake $makeType distributionModels +wmake $makeType basic +wmake $makeType solidParticle +wmake $makeType intermediate +wmake $makeType dieselSpray +wmake $makeType dsmc +wmake $makeType coalCombustion molecularDynamics/Allwmake $* diff --git a/src/lagrangian/molecularDynamics/Allwmake b/src/lagrangian/molecularDynamics/Allwmake index 60b24dea4dd310a0ef7cadcd5e23655dc5897234..7c17819ad52c64d6e5d97b480f8571f3a32785b2 100755 --- a/src/lagrangian/molecularDynamics/Allwmake +++ b/src/lagrangian/molecularDynamics/Allwmake @@ -1,10 +1,10 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -[ $# -ge 1 ] && makeOption=$1 || makeOption=libso +makeType=${1:-libso} set -x -wmake $makeOption potential -wmake $makeOption molecularMeasurements -wmake $makeOption molecule +wmake $makeType potential +wmake $makeType molecularMeasurements +wmake $makeType molecule # ----------------------------------------------------------------- end-of-file diff --git a/src/mesh/Allwmake b/src/mesh/Allwmake index f980e0e73fa960191080511b80ab2d7571c5bafc..712094055c7ab0be1d0b397d567e62be4b98e2a8 100755 --- a/src/mesh/Allwmake +++ b/src/mesh/Allwmake @@ -1,9 +1,9 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -[ $# -ge 1 ] && makeOption=$1 || makeOption=libso +makeType=${1:-libso} set -x -wmake $makeOption autoMesh -wmake $makeOption blockMesh +wmake $makeType autoMesh +wmake $makeType blockMesh # ----------------------------------------------------------------- end-of-file diff --git a/src/parallel/Allwmake b/src/parallel/Allwmake index d3600e13b1992a63eef07282165b8f7cbe778170..ab84e5b749c2e6815e579e194f910a9fc2dac13c 100755 --- a/src/parallel/Allwmake +++ b/src/parallel/Allwmake @@ -1,11 +1,11 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -[ $# -ge 1 ] && makeOption=$1 || makeOption=libso +makeType=${1:-libso} set -x decompose/Allwmake $* reconstruct/Allwmake $* -wmake $makeOption distributed +wmake $makeType distributed # ----------------------------------------------------------------- end-of-file diff --git a/src/parallel/decompose/Allwmake b/src/parallel/decompose/Allwmake index 3848e66478cae3ba36776daf1a247ce390b1c3cc..38898b1ea310da0649bd9918ff1a42a894e2648b 100755 --- a/src/parallel/decompose/Allwmake +++ b/src/parallel/decompose/Allwmake @@ -1,6 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -[ $# -ge 1 ] && makeOption=$1 || makeOption=libso +makeType=${1:-libso} # get SCOTCH_VERSION, SCOTCH_ARCH_PATH settings=`$WM_PROJECT_DIR/bin/foamEtcFile apps/scotch/bashrc` @@ -17,17 +17,17 @@ set -x wmakeLnInclude decompositionMethods -wmake $makeOption scotchDecomp +wmake $makeType scotchDecomp if [ -d "$FOAM_LIBBIN/$FOAM_MPI" ] then ( WM_OPTIONS=${WM_OPTIONS}$WM_MPLIB - wmake $makeOption ptscotchDecomp + wmake $makeType ptscotchDecomp ) fi -wmake $makeOption decompositionMethods +wmake $makeType decompositionMethods # ----------------------------------------------------------------- end-of-file diff --git a/src/parallel/reconstruct/Allwmake b/src/parallel/reconstruct/Allwmake index 3d651d5a0033915818890a2779600473d095c330..85e8e9723a63aa6e8a724b689b3e22fe383bc8b8 100755 --- a/src/parallel/reconstruct/Allwmake +++ b/src/parallel/reconstruct/Allwmake @@ -1,8 +1,8 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -[ $# -ge 1 ] && makeOption=$1 || makeOption=libso +makeType=${1:-libso} set -x -wmake $makeOption reconstruct +wmake $makeType reconstruct # ----------------------------------------------------------------- end-of-file diff --git a/src/postProcessing/Allwmake b/src/postProcessing/Allwmake index 5a1caf16606eebdd3108560d15698654b66616ff..24b764c4208c02d9b53d2d2d913d5a4e783169cc 100755 --- a/src/postProcessing/Allwmake +++ b/src/postProcessing/Allwmake @@ -1,10 +1,10 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -[ $# -ge 1 ] && makeOption=$1 || makeOption=libso +makeType=${1:-libso} set -x wmake libo postCalc -wmake $makeOption foamCalcFunctions +wmake $makeType foamCalcFunctions functionObjects/Allwmake $* diff --git a/src/postProcessing/functionObjects/Allwmake b/src/postProcessing/functionObjects/Allwmake index 9ae9bd3dca12085fc47258507e4c6189b43eb81e..e62cdf86c7e8c936c4097a85752f4a9f139cd762 100755 --- a/src/postProcessing/functionObjects/Allwmake +++ b/src/postProcessing/functionObjects/Allwmake @@ -1,13 +1,13 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -[ $# -ge 1 ] && makeOption=$1 || makeOption=libso +makeType=${1:-libso} set -x -wmake $makeOption field -wmake $makeOption forces -wmake $makeOption IO -wmake $makeOption utilities -wmake $makeOption jobControl -wmake $makeOption systemCall +wmake $makeType field +wmake $makeType forces +wmake $makeType IO +wmake $makeType utilities +wmake $makeType jobControl +wmake $makeType systemCall # ----------------------------------------------------------------- end-of-file diff --git a/src/thermophysicalModels/Allwmake b/src/thermophysicalModels/Allwmake index 939464ceb764ebd45c7b775a48457f6c6c0edebb..07d4cbf0333f9764453ae1268844cb78048ec9b3 100755 --- a/src/thermophysicalModels/Allwmake +++ b/src/thermophysicalModels/Allwmake @@ -1,24 +1,24 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -[ $# -ge 1 ] && makeOption=$1 || makeOption=libso +makeType=${1:-libso} set -x -wmake $makeOption specie -wmake $makeOption solid -wmake $makeOption thermophysicalFunctions +wmake $makeType specie +wmake $makeType solid +wmake $makeType thermophysicalFunctions ./properties/Allwmake $* -wmake $makeOption basic -wmake $makeOption reactionThermo -wmake $makeOption laminarFlameSpeed -wmake $makeOption chemistryModel -wmake $makeOption barotropicCompressibilityModel -wmake $makeOption thermalPorousZone -wmake $makeOption SLGThermo +wmake $makeType basic +wmake $makeType reactionThermo +wmake $makeType laminarFlameSpeed +wmake $makeType chemistryModel +wmake $makeType barotropicCompressibilityModel +wmake $makeType thermalPorousZone +wmake $makeType SLGThermo # Should be combined with solids&solidMixture -wmake $makeOption basicSolidThermo +wmake $makeType basicSolidThermo -wmake $makeOption radiationModels +wmake $makeType radiationModels # ----------------------------------------------------------------- end-of-file diff --git a/src/thermophysicalModels/properties/Allwmake b/src/thermophysicalModels/properties/Allwmake index da66ba8d47604562dc3be53b5e6bb0893b4c5250..f088d140d5f141f6cc63039f672fcadd1930f44b 100755 --- a/src/thermophysicalModels/properties/Allwmake +++ b/src/thermophysicalModels/properties/Allwmake @@ -1,12 +1,12 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -[ $# -ge 1 ] && makeOption=$1 || makeOption=libso +makeType=${1:-libso} set -x -wmake $makeOption liquidProperties -wmake $makeOption liquidMixtureProperties -wmake $makeOption solidProperties -wmake $makeOption solidMixtureProperties +wmake $makeType liquidProperties +wmake $makeType liquidMixtureProperties +wmake $makeType solidProperties +wmake $makeType solidMixtureProperties # ----------------------------------------------------------------- end-of-file diff --git a/src/transportModels/Allwmake b/src/transportModels/Allwmake index f0eba94263ea1be6267d34f1dc7781621c5466e9..21078c07fdf2b36d0bb5935e76376588f5dd714a 100755 --- a/src/transportModels/Allwmake +++ b/src/transportModels/Allwmake @@ -1,11 +1,11 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -[ $# -ge 1 ] && makeOption=$1 || makeOption=libso +makeType=${1:-libso} set -x -wmake $makeOption incompressible -wmake $makeOption interfaceProperties -wmake $makeOption twoPhaseInterfaceProperties -# wmake $makeOption compressible +wmake $makeType incompressible +wmake $makeType interfaceProperties +wmake $makeType twoPhaseInterfaceProperties +# wmake $makeType compressible # ----------------------------------------------------------------- end-of-file diff --git a/src/turbulenceModels/LES/Allwmake b/src/turbulenceModels/LES/Allwmake index d24309692e25aa1d0b6b6489dfc5d1bd8c18608f..6ee54e6c27fd5bc6d13bcc096bb72b03bec83f34 100755 --- a/src/turbulenceModels/LES/Allwmake +++ b/src/turbulenceModels/LES/Allwmake @@ -1,11 +1,11 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -[ $# -ge 1 ] && makeOption=$1 || makeOption=libso +makeType=${1:-libso} set -x wmakeLnInclude ../incompressible/LES -wmake $makeOption LESfilters -wmake $makeOption LESdeltas +wmake $makeType LESfilters +wmake $makeType LESdeltas # ----------------------------------------------------------------- end-of-file diff --git a/src/turbulenceModels/compressible/Allwmake b/src/turbulenceModels/compressible/Allwmake index 60605f926d6781f193ed657f261c8a3f7838a271..6e230c01ff9ecb72284d29bda2152e1ec003466c 100755 --- a/src/turbulenceModels/compressible/Allwmake +++ b/src/turbulenceModels/compressible/Allwmake @@ -1,10 +1,10 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -[ $# -ge 1 ] && makeOption=$1 || makeOption=libso +makeType=${1:-libso} set -x -wmake $makeOption turbulenceModel -wmake $makeOption RAS -wmake $makeOption LES +wmake $makeType turbulenceModel +wmake $makeType RAS +wmake $makeType LES # ----------------------------------------------------------------- end-of-file diff --git a/src/turbulenceModels/incompressible/Allwmake b/src/turbulenceModels/incompressible/Allwmake index 60605f926d6781f193ed657f261c8a3f7838a271..6e230c01ff9ecb72284d29bda2152e1ec003466c 100755 --- a/src/turbulenceModels/incompressible/Allwmake +++ b/src/turbulenceModels/incompressible/Allwmake @@ -1,10 +1,10 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -[ $# -ge 1 ] && makeOption=$1 || makeOption=libso +makeType=${1:-libso} set -x -wmake $makeOption turbulenceModel -wmake $makeOption RAS -wmake $makeOption LES +wmake $makeType turbulenceModel +wmake $makeType RAS +wmake $makeType LES # ----------------------------------------------------------------- end-of-file diff --git a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/Allrun b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/Allrun index a972b6806ac19b4d27a07669783bfc5fc0b63eae..de516b423f13649bd02be48cad7fdeb38af648ff 100755 --- a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/Allrun +++ b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/Allrun @@ -14,4 +14,4 @@ runApplication PDRMesh # Run runApplication PDRFoam -# ----------------------------------------------------------------- end-of-file \ No newline at end of file +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/README b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/README index bbf97c686661b490557efb4faa4b2e05a5a2d4c1..13d0f4a92321161b2f1fddbaba86685364d642f1 100644 --- a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/README +++ b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/README @@ -8,4 +8,4 @@ Step to introduce the PDR fields: 1) Create zero-size patches for wall or/and coupled baffles in the boundary file. 2) Specify the boundary contitions for these patches in the fields. -3) Create the new PDR mesh using the PDRMesh utility. \ No newline at end of file +3) Create the new PDR mesh using the PDRMesh utility. diff --git a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/constant/thermophysicalProperties b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/constant/thermophysicalProperties index 401abd41ee8bc10b8bd076918e5acc9fa787d3c0..820dc02a9bf1c52d0a022def1be79b2b2ea4a8b7 100644 --- a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/constant/thermophysicalProperties +++ b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/constant/thermophysicalProperties @@ -59,4 +59,4 @@ burntProducts Ts 170.672; } -// ************************************************************************* // \ No newline at end of file +// ************************************************************************* // diff --git a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/fuels/propane.dat b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/fuels/propane.dat index c13dca170af842fa46b7ae02d29c155866841f7c..b5fb431b633ad14a40f073f26d949bab4ba5f756 100644 --- a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/fuels/propane.dat +++ b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/fuels/propane.dat @@ -69,4 +69,4 @@ SCOPECoeffs 0 ); } -} \ No newline at end of file +} diff --git a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/system/controlDict b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/system/controlDict index 920dd2a52158451b14dd615843732e5514cee5ec..3a9d4195c1764644dc5440ebb176fc6e72fdc037 100644 --- a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/system/controlDict +++ b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/system/controlDict @@ -51,4 +51,4 @@ maxCo 0.3; maxDeltaT 1; -// ************************************************************************* // \ No newline at end of file +// ************************************************************************* // diff --git a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/system/fvSchemes b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/system/fvSchemes index d600158ce475a91724613e0ab2c172d0350c7b26..5aeba77ebb08e2594e48062adf8d01178f0fd3bd 100755 --- a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/system/fvSchemes +++ b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/system/fvSchemes @@ -82,4 +82,5 @@ fluxRequired default no; p; } + // ************************************************************************* // diff --git a/wmake/Makefile b/wmake/Makefile index 168710ce196756a73da878c3208cbb78bb181eef..bd86b11ed48246a584e6aa414d22e514ff6f6c23 100644 --- a/wmake/Makefile +++ b/wmake/Makefile @@ -1,4 +1,4 @@ -#------------------------------------------------------------------------------ +#-------------------------------*- makefile -*--------------------------------- # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | diff --git a/wmake/rules/linuxIA64Gcc/general b/wmake/rules/linuxIA64Gcc/general index a19f130aae83af7a543e58987f322d39538a5d6f..480ea1b9c41d5a6b0a9bdfbe310d51c8a4c3e6d3 100644 --- a/wmake/rules/linuxIA64Gcc/general +++ b/wmake/rules/linuxIA64Gcc/general @@ -1,4 +1,5 @@ CPP = cpp -traditional-cpp $(GFLAGS) + PROJECT_LIBS = -l$(WM_PROJECT) -ldl include $(GENERAL_RULES)/standard diff --git a/wmake/wclean b/wmake/wclean index dd54ae2b609d0832ed827729c9d74301b30a95c6..088bfda52a4909ef5aa57d380667c23a5f345ded 100755 --- a/wmake/wclean +++ b/wmake/wclean @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------- # License @@ -40,6 +40,7 @@ Usage: $Script [OPTION] [dir] $Script [OPTION] target [dir [MakeDir]] options: + -s | -silent ignored - for compatibility with wmake -help print the usage Clean up the wmake control directory Make/\$WM_OPTIONS and remove the @@ -52,21 +53,35 @@ The targets correspond to a subset of the 'wmake' special targets: clean Make, any *.dep files and lnInclude directories USAGE - exit 1 + exit 1 } -# provide immediate help -if [ "$1" = "-h" -o "$1" = "-help" ] -then - usage -fi + +# parse options +while [ "$#" -gt 0 ] +do + case "$1" in + -h | -help) + usage + ;; + -s | -silent) # ignored - for compatibility with wmake + shift + ;; + -*) + usage "unknown option: '$*'" + ;; + *) + break + ;; + esac +done #------------------------------------------------------------------------------ -# check arguments and change to the directory in which to run wmake +# check arguments and change to the directory in which to run wclean #------------------------------------------------------------------------------ -unset dir makeOption +unset dir makeType MakeDir=Make if [ $# -ge 1 ] @@ -76,7 +91,7 @@ then then dir=$1 else - makeOption=$1 + makeType=$1 fi # specified directory name: @@ -101,7 +116,7 @@ fi # Recurse the directories tree #------------------------------------------------------------------------------ -if [ "$makeOption" = all ] +if [ "$makeType" = all ] then if [ -e Allwclean ] # consistent with Allwmake then @@ -121,8 +136,8 @@ then fi fi -# makeOption is not needed beyond this point -unset makeOption +# makeType is not needed beyond this point +unset makeType #------------------------------------------------------------------------------ diff --git a/wmake/wmake b/wmake/wmake index 37a17eca798a6d927dc668006abf63759ee16bf6..7dea37e2345c69e8e7a81e391d4f5c7006046a63 100755 --- a/wmake/wmake +++ b/wmake/wmake @@ -40,8 +40,10 @@ Usage: $Script [OPTION] [dir] $Script [OPTION] target [dir [MakeDir]] options: + -s | -silent invoke make in 'silent' mode (do not echo commands) -help print the usage + A general, easy-to-use make system for multi-platform development The 'target' is a Makefile target: @@ -59,12 +61,28 @@ USAGE exit 1 } -# provide immediate help, even if environment is not set -if [ "$1" = "-h" -o "$1" = "-help" ] -then - usage -fi +# normally use "make" +make="make" +# parse options +while [ "$#" -gt 0 ] +do + case "$1" in + -h | -help) + usage + ;; + -s | -silent) + make="$make -s" + shift + ;; + -*) + usage "unknown option: '$*'" + ;; + *) + break + ;; + esac +done # # check environment variables @@ -77,6 +95,7 @@ do } done + # when compiling anything but a standalone exe: # WM_PROJECT and WM_PROJECT_DIR must be set [ "$1" = exe -o \( "$WM_PROJECT" -a "$WM_PROJECT_DIR" \) ] || { @@ -91,8 +110,6 @@ done # Select the version of make to be used #------------------------------------------------------------------------------ -make="make" - # set WM_NCOMPPROCS automatically when both WM_HOSTS and WM_SCHEDULER are set if [ -z "$WM_NCOMPPROCS" -a -n "$WM_HOSTS" -a -n "$WM_SCHEDULER" ] then @@ -113,7 +130,7 @@ then mkdir -p $lockDir fi - make="make --no-print-directory -j "$WM_NCOMPPROCS + make="$make --no-print-directory -j "$WM_NCOMPPROCS fi fi @@ -122,7 +139,7 @@ fi # check arguments and change to the directory in which to run wmake #------------------------------------------------------------------------------ -unset dir makeOption +unset dir makeType MakeDir=Make if [ $# -ge 1 ] @@ -131,7 +148,7 @@ then then dir=$1 else - makeOption=$1 + makeType=$1 fi # specified directory name: @@ -154,7 +171,7 @@ fi # Recurse the application directories tree #------------------------------------------------------------------------------ -if [ "$makeOption" = all ] +if [ "$makeType" = all ] then if [ -e Allwmake ] then @@ -187,12 +204,12 @@ fi # transform "all" option to "libso" if that looks appropriate or remove it # so that the call to make builds the application -if [ "$makeOption" = all ] +if [ "$makeType" = all ] then - unset makeOption + unset makeType if grep -e '^ *LIB *=' "$MakeDir/files" >/dev/null 2>&1 then - makeOption=libso + makeType=libso fi fi @@ -226,7 +243,7 @@ OBJECTS_DIR=$MakeDir/$WM_OPTIONS touch $OBJECTS_DIR/dontIncludeDeps -case "$makeOption" in +case "$makeType" in lib | libo | libso ) $make -s -f $WM_DIR/Makefile MAKE_DIR=$MakeDir INCLUDE_DEPS=$OBJECTS_DIR/dontIncludeDeps lnInclude/uptodate ;; @@ -241,7 +258,7 @@ rc=$? # make the object files and link #------------------------------------------------------------------------------ -cmd="$make -f $WM_DIR/Makefile MAKE_DIR=$MakeDir INCLUDE_DEPS=$OBJECTS_DIR/includeDeps $makeOption" +cmd="$make -f $WM_DIR/Makefile MAKE_DIR=$MakeDir INCLUDE_DEPS=$OBJECTS_DIR/includeDeps $makeType" # echo "cmd=$cmd" exec $cmd diff --git a/wmake/wmakeLnInclude b/wmake/wmakeLnInclude index 9306db803467a40f7b9cf2d2e5075fb0358b3a16..493091e31100b12f083305e9838c9d970b4bb623 100755 --- a/wmake/wmakeLnInclude +++ b/wmake/wmakeLnInclude @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------- # License @@ -40,10 +40,16 @@ Script=${0##*/} usage() { + exec 1>&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat<<USAGE -usage: $Script [-f] <dir> +Usage: $Script [OPTION] dir + +options: + -f | -force force update + -s | -silent use 'silent' mode (do not echo command) + -help print the usage Link all the source files in the <dir> into <dir>/lnInclude @@ -63,7 +69,7 @@ unset findOpt # default 'ln' option lnOpt="-s" -unset forceUpdate +unset forceUpdate silentOpt # simple parse options while [ "$#" -gt 0 ] @@ -72,10 +78,14 @@ do -h | -help) # provide immediate help usage ;; - -f) - shift + -f | -force) forceUpdate=true lnOpt="-sf" + shift + ;; + -s | -silent) + silentOpt=true + shift ;; -*) usage "unknown option: '$*'" @@ -128,10 +138,12 @@ fi cd $incDir || exit 1 +#------------------------------------------------------------------------------ -# Link include files -# ~~~~~~~~~~~~~~~~~~ -echo "$Script: linking include files to $incDir" +if [ "$silentOpt" != true ] +then + echo "$Script: linking include files to $incDir" 1>&2 +fi # # remove any broken links first (this helps when file locations have moved)