From 161991032ef3822fed883759406ccdc82d8cd3b9 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 1 Feb 2011 18:23:08 +0100 Subject: [PATCH 01/24] STYLE: deactivate coco-cpp until its future is clearer --- src/OpenFOAM/Make/files | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index bf4c345bec..7e293fc7eb 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -164,11 +164,16 @@ $(functionEntries)/includeIfPresentEntry/includeIfPresentEntry.C $(functionEntries)/inputModeEntry/inputModeEntry.C $(functionEntries)/removeEntry/removeEntry.C -calcEntry = $(functionEntries)/calcEntry -$(calcEntry)/calcEntryParser.atg -$(calcEntry)/calcEntryInternal.C -$(calcEntry)/calcEntry.C - +/* + * Requires customized coco-cpp + * could be dropped or activated in the future + */ +/* + calcEntry = $(functionEntries)/calcEntry + $(calcEntry)/calcEntryParser.atg + $(calcEntry)/calcEntryInternal.C + $(calcEntry)/calcEntry.C +*/ IOdictionary = db/IOobjects/IOdictionary $(IOdictionary)/IOdictionary.C From 1129edaf53da3fd313d894d4317ed1a5df0f9ad0 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 1 Feb 2011 18:34:19 +0100 Subject: [PATCH 02/24] STYLE: apps/paraview3/bashrc-EXAMPLE to guide people with non-standard paraview --- etc/apps/paraview3/bashrc-EXAMPLE | 46 +++++++++++++++++++++++++++++++ etc/bashrc | 12 ++++---- 2 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 etc/apps/paraview3/bashrc-EXAMPLE diff --git a/etc/apps/paraview3/bashrc-EXAMPLE b/etc/apps/paraview3/bashrc-EXAMPLE new file mode 100644 index 0000000000..8db47a9ec7 --- /dev/null +++ b/etc/apps/paraview3/bashrc-EXAMPLE @@ -0,0 +1,46 @@ +#----------------------------------*-sh-*-------------------------------------- +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. +# \\/ M anipulation | +#------------------------------------------------------------------------------ +# License +# This file is part of OpenFOAM. +# +# OpenFOAM is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenFOAM. If not, see . +# +# File +# paraview3/bashrc-EXAMPLE +# +# Description +# Example of chaining to the standard paraview3/bashrc with a +# different ParaView_VERSION +# +# Note +# This file could be copied to a user or site location, but should never +# replace the default shipped version as this will cause an infinite loop +# +#------------------------------------------------------------------------------ + +# +# Use other (shipped) bashrc with a different ParaView_VERSION +# + +foamFile=$($WM_PROJECT_DIR/bin/foamEtcFile -mode o apps/paraview3/bashrc 2>/dev/null) +[ $? -eq 0 ] && . $foamFile ParaView_VERSION=3.9.0 + +unset foamFile + +# ----------------------------------------------------------------------------- diff --git a/etc/bashrc b/etc/bashrc index 95c83e82f8..310d5fe00d 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -122,12 +122,12 @@ export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION # Source files, possibly with some verbosity _foamSource() { - while [ $# -ge 1 ] - do - [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "Sourcing: $1" - . $1 - shift - done + while [ $# -ge 1 ] + do + [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "Sourcing: $1" + . $1 + shift + done } # Evaluate command-line parameters From 1a03d43b57f3ec5788d16e79269e1227abe0d039 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 1 Feb 2011 18:50:19 +0100 Subject: [PATCH 03/24] STYLE: remove comments referring to '' or ' ' --- .../manipulation/insideCells/insideCells.C | 30 +++++++++++-------- .../writers/dx/dxSurfaceWriter.H | 10 +++---- .../writers/ensight/ensightSurfaceWriter.H | 10 +++---- .../writers/foamFile/foamFileSurfaceWriter.H | 10 +++---- .../writers/raw/rawSurfaceWriter.H | 10 +++---- .../writers/starcd/starcdSurfaceWriter.H | 6 ++-- .../sampledSurface/writers/surfaceWriter.H | 12 ++++---- .../writers/vtk/vtkSurfaceWriter.H | 10 +++---- 8 files changed, 52 insertions(+), 46 deletions(-) diff --git a/applications/utilities/mesh/manipulation/insideCells/insideCells.C b/applications/utilities/mesh/manipulation/insideCells/insideCells.C index 967240701e..16a37594d8 100644 --- a/applications/utilities/mesh/manipulation/insideCells/insideCells.C +++ b/applications/utilities/mesh/manipulation/insideCells/insideCells.C @@ -2,7 +2,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 @@ -22,8 +22,8 @@ License along with OpenFOAM. If not, see . Description - Picks up cells with cell centre 'inside' of surface. Requires surface - to be closed and singly connected. + Picks up cells with cell centre 'inside' of surface. + Requires surface to be closed and singly connected. \*---------------------------------------------------------------------------*/ @@ -42,9 +42,16 @@ using namespace Foam; int main(int argc, char *argv[]) { + argList::addNote + ( + "Create a cellSet for cells with their centres inside the defined " + "surface.\n" + "Surface must be closed and singly connected." + ); + argList::noParallel(); - argList::validArgs.append("surface file"); - argList::validArgs.append("destination cellSet"); + argList::validArgs.append("surfaceFile"); + argList::validArgs.append("cellSet"); # include "setRootCase.H" # include "createTime.H" @@ -75,14 +82,13 @@ int main(int argc, char *argv[]) } - Info<< "Selected " << insideCells.size() - << " cells out of " << mesh.nCells() << endl - << endl + Info<< "Selected " << insideCells.size() << " of " << mesh.nCells() + << " cells" << nl << nl << "Writing selected cells to cellSet " << insideCells.name() - << endl << endl - << "Use this cellSet e.g. with subsetMesh : " << endl << endl - << " subsetMesh " << insideCells.name() - << endl << endl; + << nl << nl + << "Use this cellSet e.g. with subsetMesh : " << nl << nl + << " subsetMesh " << insideCells.name() + << nl << endl; insideCells.write(); diff --git a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.H b/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.H index e4e3af67e6..6ff54c775f 100644 --- a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.H @@ -96,7 +96,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -110,7 +110,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -124,7 +124,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -138,7 +138,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -152,7 +152,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, diff --git a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.H b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.H index 628c178d4e..ca42fa8f08 100644 --- a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.H @@ -117,7 +117,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -131,7 +131,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -145,7 +145,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -159,7 +159,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -173,7 +173,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, diff --git a/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.H b/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.H index ce19c21455..7912a65acf 100644 --- a/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.H @@ -107,7 +107,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -121,7 +121,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -135,7 +135,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -149,7 +149,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -163,7 +163,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, diff --git a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H index 5ec4d1ac30..c08b0eee5e 100644 --- a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H @@ -128,7 +128,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -142,7 +142,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -156,7 +156,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -170,7 +170,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -184,7 +184,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, diff --git a/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.H b/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.H index bf0a0eb824..be537abed0 100644 --- a/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.H @@ -129,7 +129,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -143,7 +143,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -157,7 +157,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, diff --git a/src/sampling/sampledSurface/writers/surfaceWriter.H b/src/sampling/sampledSurface/writers/surfaceWriter.H index be26517849..f9d0587164 100644 --- a/src/sampling/sampledSurface/writers/surfaceWriter.H +++ b/src/sampling/sampledSurface/writers/surfaceWriter.H @@ -119,7 +119,7 @@ public: //- Write single surface geometry to file. virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -132,7 +132,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -147,7 +147,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -162,7 +162,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -177,7 +177,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -192,7 +192,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, diff --git a/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.H b/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.H index 322159094b..75af4a347e 100644 --- a/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.H @@ -105,7 +105,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -119,7 +119,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -133,7 +133,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -147,7 +147,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, @@ -161,7 +161,7 @@ public: // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, // //surface/TIME + const fileName& outputDir, // /surface/TIME const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, From ffd20770ddf3a9e236d2217ad62b41c6430edc34 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 4 Feb 2011 18:59:45 +0100 Subject: [PATCH 04/24] ENH: add (non-templated) polynomialFunction STYLE: integrateLimits() -> integrate() for consistency with DataEntry/polynomial. Rename old 'integrate', 'integrateMinus1' methods to 'integral', 'integralMinus1' (ie, substantive instead of verb for clarity). --- .../test/Polynomial/Test-Polynomial.C | 65 ++- src/OpenFOAM/Make/files | 1 + .../functions/Polynomial/Polynomial.C | 109 +++-- .../functions/Polynomial/Polynomial.H | 47 +- .../functions/Polynomial/polynomialFunction.C | 415 ++++++++++++++++++ .../functions/Polynomial/polynomialFunction.H | 246 +++++++++++ .../thermo/hPolynomial/hPolynomialThermo.C | 8 +- 7 files changed, 809 insertions(+), 82 deletions(-) create mode 100644 src/OpenFOAM/primitives/functions/Polynomial/polynomialFunction.C create mode 100644 src/OpenFOAM/primitives/functions/Polynomial/polynomialFunction.H diff --git a/applications/test/Polynomial/Test-Polynomial.C b/applications/test/Polynomial/Test-Polynomial.C index fbfbcc2000..c251bade74 100644 --- a/applications/test/Polynomial/Test-Polynomial.C +++ b/applications/test/Polynomial/Test-Polynomial.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,6 +31,7 @@ Description #include "IStringStream.H" #include "Polynomial.H" +#include "polynomialFunction.H" #include "Random.H" #include "cpuTime.H" @@ -38,7 +39,7 @@ using namespace Foam; const int PolySize = 8; const scalar coeff[] = { 0.11, 0.45, -0.94, 1.58, -2.58, 0.08, 3.15, -4.78 }; -const char* polyDef = "testPoly (0.11 0.45 -0.94 1.58 -2.58 0.08 3.15 -4.78)"; +const char* polyDef = "(0.11 0.45 -0.94 1.58 -2.58 0.08 3.15 -4.78)"; scalar polyValue(const scalar x) @@ -58,7 +59,7 @@ scalar polyValue(const scalar x) scalar intPolyValue(const scalar x) { - // Hard-coded integrated form of above polynomial + // Hard-coded integral form of above polynomial return coeff[0]*x + coeff[1]/2.0*sqr(x) @@ -109,27 +110,44 @@ int main(int argc, char *argv[]) const label nIters = 1000; scalar sum = 0.0; - Info<< "null poly = " << (Polynomial<8>()) << nl << endl; + Info<< "null poly = " << (Polynomial<8>()) << nl + << "null poly = " << (polynomialFunction(8)) << nl + << endl; - // Polynomial<8> poly("testPoly", IStringStream(polyDef)()); Polynomial<8> poly(coeff); - Polynomial<9> intPoly(poly.integrate(0.0)); + Polynomial<9> intPoly(poly.integral(0.0)); - Info<< "poly = " << poly << endl; - Info<< "intPoly = " << intPoly << nl << endl; + IStringStream is(polyDef); + polynomialFunction polyfunc(is); - Info<< "2*poly = " << 2*poly << endl; - Info<< "poly+poly = " << poly + poly << nl << endl; + Info<< "poly = " << poly << nl + << "intPoly = " << intPoly << nl + << endl; - Info<< "3*poly = " << 3*poly << endl; - Info<< "poly+poly+poly = " << poly + poly + poly << nl << endl; + Info<< "2*poly = " << 2*poly << nl + << "poly+poly = " << poly + poly << nl + << "3*poly = " << 3*poly << nl + << "poly+poly+poly = " << poly + poly + poly << nl + << "3*poly - 2*poly = " << 3*poly - 2*poly << nl + << endl; + + Info<< nl << "--- as polynomialFunction" << nl << endl; + Info<< "polyf = " << polyfunc << nl + << "intPoly = " << poly.integral(0.0) << nl + << endl; + + Info<< "2*polyf = " << 2*polyfunc << nl + << "polyf+polyf = " << polyfunc + polyfunc << nl + << "3*polyf = " << 3*polyfunc << nl + << "polyf+polyf+polyf = " << polyfunc + polyfunc + polyfunc << nl + << "3*polyf - 2*polyf = " << 3*polyfunc - 2*polyfunc << nl + << endl; - Info<< "3*poly - 2*poly = " << 3*poly - 2*poly << nl << endl; Polynomial<8> polyCopy = poly; Info<< "poly, polyCopy = " << poly << ", " << polyCopy << nl << endl; polyCopy = 2.5*poly; - Info<< "2.5*polyCopy = " << polyCopy << nl << endl; + Info<< "2.5*poly = " << polyCopy << nl << endl; Random rnd(123456); for (int i=0; i<10; i++) @@ -139,8 +157,8 @@ int main(int argc, char *argv[]) scalar px = polyValue(x); scalar ipx = intPolyValue(x); - scalar pxTest = poly.evaluate(x); - scalar ipxTest = intPoly.evaluate(x); + scalar pxTest = poly.value(x); + scalar ipxTest = intPoly.value(x); Info<<"\nx = " << x << endl; Info<< " px, pxTest = " << px << ", " << pxTest << endl; @@ -173,10 +191,21 @@ int main(int argc, char *argv[]) sum = 0.0; for (label iter = 0; iter < nIters; ++iter) { - sum += poly.evaluate(loop+iter); + sum += poly.value(loop+iter); } } - Info<< "evaluate: " << sum + Info<< "value: " << sum + << " in " << timer.cpuTimeIncrement() << " s\n"; + + for (int loop = 0; loop < n; ++loop) + { + sum = 0.0; + for (label iter = 0; iter < nIters; ++iter) + { + sum += polyfunc.value(loop+iter); + } + } + Info<< "via function: " << sum << " in " << timer.cpuTimeIncrement() << " s\n"; diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 7e293fc7eb..ba3c157b10 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -66,6 +66,7 @@ primitives/functions/DataEntry/makeDataEntries.C primitives/functions/DataEntry/polynomial/polynomial.C primitives/functions/DataEntry/polynomial/polynomialIO.C +primitives/functions/Polynomial/polynomialFunction.C strings = primitives/strings $(strings)/string/string.C diff --git a/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.C b/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.C index 7f9ae731f6..3c642de2d3 100644 --- a/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.C +++ b/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.C @@ -41,6 +41,18 @@ Foam::Polynomial::Polynomial() } +template +Foam::Polynomial::Polynomial +( + const Polynomial& poly +) +: + VectorSpace, scalar, PolySize>(poly), + logActive_(poly.logActive_), + logCoeff_(poly.logCoeff_) +{} + + template Foam::Polynomial::Polynomial(const scalar coeffs[PolySize]) : @@ -68,7 +80,7 @@ Foam::Polynomial::Polynomial(const UList& coeffs) ( "Polynomial::Polynomial(const UList&)" ) << "Size mismatch: Needed " << PolySize - << " but got " << coeffs.size() + << " but given " << coeffs.size() << nl << exit(FatalError); } @@ -79,6 +91,39 @@ Foam::Polynomial::Polynomial(const UList& coeffs) } +// template +// Foam::Polynomial::Polynomial(const polynomialFunction& poly) +// : +// VectorSpace, scalar, PolySize>(), +// logActive_(poly.logActive()), +// logCoeff_(poly.logCoeff()) +// { +// if (poly.size() != PolySize) +// { +// FatalErrorIn +// ( +// "Polynomial::Polynomial(const polynomialFunction&)" +// ) << "Size mismatch: Needed " << PolySize +// << " but given " << poly.size() +// << nl << exit(FatalError); +// } +// +// for (int i = 0; i < PolySize; ++i) +// { +// this->v_[i] = poly[i]; +// } +// } + + +template +Foam::Polynomial::Polynomial(Istream& is) +: + VectorSpace, scalar, PolySize>(is), + logActive_(false), + logCoeff_(0.0) +{} + + template Foam::Polynomial::Polynomial(const word& name, Istream& is) : @@ -111,38 +156,17 @@ Foam::Polynomial::Polynomial(const word& name, Istream& is) } -template -Foam::Polynomial::Polynomial(Istream& is) -: - VectorSpace, scalar, PolySize>(is), - logActive_(false), - logCoeff_(0.0) -{} - - -template -Foam::Polynomial::Polynomial -( - const Polynomial& poly -) -: - VectorSpace, scalar, PolySize>(poly), - logActive_(poly.logActive_), - logCoeff_(poly.logCoeff_) -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -bool& Foam::Polynomial::logActive() +bool Foam::Polynomial::logActive() const { return logActive_; } template -Foam::scalar& Foam::Polynomial::logCoeff() +Foam::scalar Foam::Polynomial::logCoeff() const { return logCoeff_; } @@ -151,27 +175,27 @@ Foam::scalar& Foam::Polynomial::logCoeff() template Foam::scalar Foam::Polynomial::value(const scalar x) const { - scalar y = this->v_[0]; + scalar val = this->v_[0]; // avoid costly pow() in calculation scalar powX = x; for (label i=1; iv_[i]*powX; + val += this->v_[i]*powX; powX *= x; } if (logActive_) { - y += logCoeff_*log(x); + val += logCoeff_*log(x); } - return y; + return val; } template -Foam::scalar Foam::Polynomial::integrateLimits +Foam::scalar Foam::Polynomial::integrate ( const scalar x1, const scalar x2 @@ -181,7 +205,7 @@ Foam::scalar Foam::Polynomial::integrateLimits { FatalErrorIn ( - "scalar Polynomial::integrateLimits" + "scalar Polynomial::integrate" "(" "const scalar, " "const scalar" @@ -190,22 +214,33 @@ Foam::scalar Foam::Polynomial::integrateLimits << nl << abort(FatalError); } - intPolyType poly = this->integrate(); - return poly.value(x2) - poly.value(x1); + // avoid costly pow() in calculation + scalar powX1 = x1; + scalar powX2 = x2; + + scalar val = this->v_[0]*(powX2 - powX1); + for (label i=1; iv_[i]/(i + 1) * (powX2 - powX1); + powX1 *= x1; + powX2 *= x2; + } + + return val; } template typename Foam::Polynomial::intPolyType -Foam::Polynomial::integrate(const scalar intConstant) +Foam::Polynomial::integral(const scalar intConstant) const { intPolyType newCoeffs; newCoeffs[0] = intConstant; forAll(*this, i) { - newCoeffs[i + 1] = this->v_[i]/(i + 1); + newCoeffs[i+1] = this->v_[i]/(i + 1); } return newCoeffs; @@ -214,14 +249,14 @@ Foam::Polynomial::integrate(const scalar intConstant) template typename Foam::Polynomial::polyType -Foam::Polynomial::integrateMinus1(const scalar intConstant) +Foam::Polynomial::integralMinus1(const scalar intConstant) const { polyType newCoeffs; if (this->v_[0] > VSMALL) { - newCoeffs.logActive() = true; - newCoeffs.logCoeff() = this->v_[0]; + newCoeffs.logActive_ = true; + newCoeffs.logCoeff_ = this->v_[0]; } newCoeffs[0] = intConstant; diff --git a/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.H b/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.H index 06511b0003..5dfa271c8d 100644 --- a/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.H +++ b/src/OpenFOAM/primitives/functions/Polynomial/Polynomial.H @@ -29,14 +29,14 @@ Description poly = logCoeff*log(x) + sum(coeff_[i]*x^i) - where 0 \<= i \<= n + where 0 \<= i \<= N - integer powers, starting at zero - value(x) to evaluate the poly for a given value - integrate(x1, x2) between two scalar values - - integrate() to return a new, intergated coeff polynomial + - integral() to return a new, integral coeff polynomial - increases the size (order) - - integrateMinus1() to return a new, integrated coeff polynomial where + - integralMinus1() to return a new, integral coeff polynomial where the base poly starts at order -1 SourceFiles @@ -85,10 +85,10 @@ class Polynomial // Private data - //- Include the log term? - only activated using integrateMinus1() + //- Include the log term? - only activated using integralMinus1() bool logActive_; - //- Log coefficient - only activated using integrateMinus1() + //- Log coefficient - only activated using integralMinus1() scalar logCoeff_; @@ -104,6 +104,9 @@ public: //- Construct null, with all coefficients = 0.0 Polynomial(); + //- Copy constructor + Polynomial(const Polynomial&); + //- Construct from C-array of coefficients explicit Polynomial(const scalar coeffs[PolySize]); @@ -111,24 +114,21 @@ public: explicit Polynomial(const UList& coeffs); //- Construct from Istream - Polynomial(Istream& is); + Polynomial(Istream&); //- Construct from name and Istream - Polynomial(const word& name, Istream& is); - - //- Copy constructor - Polynomial(const Polynomial& poly); + Polynomial(const word& name, Istream&); // Member Functions // Access - //- Return access to the log term active flag - bool& logActive(); + //- Return true if the log term is active + bool logActive() const; - //- Return access to the log coefficient - scalar& logCoeff(); + //- Return the log coefficient + scalar logCoeff() const; // Evaluation @@ -136,16 +136,17 @@ public: //- Return polynomial value scalar value(const scalar x) const; - //- Return integrated polynomial coefficients - // argument becomes zeroth element (constant of integration) - intPolyType integrate(const scalar intConstant = 0.0); - - //- Return integrated polynomial coefficients when lowest order - // is -1. Argument added to zeroth element - polyType integrateMinus1(const scalar intConstant = 0.0); - //- Integrate between two values - scalar integrateLimits(const scalar x1, const scalar x2) const; + scalar integrate(const scalar x1, const scalar x2) const; + + + //- Return integral coefficients. + // Argument becomes zeroth element (constant of integration) + intPolyType integral(const scalar intConstant = 0.0) const; + + //- Return integral coefficients when lowest order is -1. + // Argument becomes zeroth element (constant of integration) + polyType integralMinus1(const scalar intConstant = 0.0) const; //- Ostream Operator diff --git a/src/OpenFOAM/primitives/functions/Polynomial/polynomialFunction.C b/src/OpenFOAM/primitives/functions/Polynomial/polynomialFunction.C new file mode 100644 index 0000000000..44e82ac26d --- /dev/null +++ b/src/OpenFOAM/primitives/functions/Polynomial/polynomialFunction.C @@ -0,0 +1,415 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "polynomialFunction.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(polynomialFunction, 0); +} + + +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + + +Foam::polynomialFunction Foam::polynomialFunction::cloneIntegral +( + const polynomialFunction& poly, + const scalar intConstant +) +{ + polynomialFunction newPoly(poly.size()+1); + + newPoly[0] = intConstant; + forAll(poly, i) + { + newPoly[i+1] = poly[i]/(i + 1); + } + + return newPoly; +} + + +Foam::polynomialFunction Foam::polynomialFunction::cloneIntegralMinus1 +( + const polynomialFunction& poly, + const scalar intConstant +) +{ + polynomialFunction newPoly(poly.size()+1); + + if (poly[0] > VSMALL) + { + newPoly.logActive_ = true; + newPoly.logCoeff_ = poly[0]; + } + + newPoly[0] = intConstant; + for (label i=1; i < poly.size(); ++i) + { + newPoly[i] = poly[i]/i; + } + + return newPoly; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::polynomialFunction::polynomialFunction(const label order) +: + scalarList(order, 0.0), + logActive_(false), + logCoeff_(0.0) +{ + if (this->empty()) + { + FatalErrorIn + ( + "polynomialFunction::polynomialFunction(const label order)" + ) << "polynomialFunction coefficients are invalid (empty)" + << nl << exit(FatalError); + } +} + + +Foam::polynomialFunction::polynomialFunction(const polynomialFunction& poly) +: + scalarList(poly), + logActive_(poly.logActive_), + logCoeff_(poly.logCoeff_) +{} + + +Foam::polynomialFunction::polynomialFunction(const UList& coeffs) +: + scalarList(coeffs), + logActive_(false), + logCoeff_(0.0) +{ + if (this->empty()) + { + FatalErrorIn + ( + "polynomialFunction::polynomialFunction(const UList&)" + ) << "polynomialFunction coefficients are invalid (empty)" + << nl << exit(FatalError); + } +} + + +Foam::polynomialFunction::polynomialFunction(Istream& is) +: + scalarList(is), + logActive_(false), + logCoeff_(0.0) +{ + if (this->empty()) + { + FatalErrorIn + ( + "polynomialFunction::polynomialFunction(Istream&)" + ) << "polynomialFunction coefficients are invalid (empty)" + << nl << exit(FatalError); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::polynomialFunction::~polynomialFunction() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::polynomialFunction::logActive() const +{ + return logActive_; +} + + +Foam::scalar Foam::polynomialFunction::logCoeff() const +{ + return logCoeff_; +} + + +Foam::scalar Foam::polynomialFunction::value(const scalar x) const +{ + const scalarList& coeffs = *this; + scalar val = coeffs[0]; + + // avoid costly pow() in calculation + scalar powX = x; + for (label i=1; ilogCoeff_*log(x); + } + + return val; +} + + +Foam::scalar Foam::polynomialFunction::integrate +( + const scalar x1, + const scalar x2 +) const +{ + const scalarList& coeffs = *this; + + if (logActive_) + { + FatalErrorIn + ( + "scalar polynomialFunction::integrate" + "(" + "const scalar, " + "const scalar" + ") const" + ) << "Cannot integrate polynomial with logarithmic coefficients" + << nl << abort(FatalError); + } + + // avoid costly pow() in calculation + scalar powX1 = x1; + scalar powX2 = x2; + + scalar val = coeffs[0]*(powX2 - powX1); + for (label i=1; i poly.size()) + { + forAll(poly, i) + { + coeffs[i] += poly[i]; + } + } + else + { + coeffs.setSize(poly.size(), 0.0); + + forAll(coeffs, i) + { + coeffs[i] += poly[i]; + } + } + + return *this; +} + + +Foam::polynomialFunction& +Foam::polynomialFunction::operator-=(const polynomialFunction& poly) +{ + scalarList& coeffs = *this; + + if (coeffs.size() > poly.size()) + { + forAll(poly, i) + { + coeffs[i] -= poly[i]; + } + } + else + { + coeffs.setSize(poly.size(), 0.0); + + forAll(coeffs, i) + { + coeffs[i] -= poly[i]; + } + } + + return *this; +} + + +Foam::polynomialFunction& +Foam::polynomialFunction::operator*=(const scalar s) +{ + scalarList& coeffs = *this; + forAll(coeffs, i) + { + coeffs[i] *= s; + } + + return *this; +} + + +Foam::polynomialFunction& +Foam::polynomialFunction::operator/=(const scalar s) +{ + scalarList& coeffs = *this; + forAll(coeffs, i) + { + coeffs[i] /= s; + } + + return *this; +} + + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +Foam::Ostream& Foam::operator<<(Ostream& os, const polynomialFunction& poly) +{ + // output like VectorSpace + os << token::BEGIN_LIST; + + if (!poly.empty()) + { + for (int i=0; i. + +Class + Foam::polynomialFunction + +Description + Polynomial function representation + + poly = logCoeff*log(x) + sum(coeff_[i]*x^i) + + where 0 \<= i \<= N + + - integer powers, starting at zero + - value(x) to evaluate the poly for a given value + - integrate(x1, x2) between two scalar values + - integral() to return a new, integral coeff polynomial + - increases the size (order) + - integralMinus1() to return a new, integral coeff polynomial where + the base poly starts at order -1 + +SeeAlso + Foam::Polynomial for a templated implementation + +SourceFiles + polynomialFunction.C + +\*---------------------------------------------------------------------------*/ + +#ifndef polynomialFunction_H +#define polynomialFunction_H + +#include "scalarList.H" +#include "Ostream.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class polynomialFunction; + +// Forward declaration of friend functions +Ostream& operator<<(Ostream&, const polynomialFunction&); + + +/*---------------------------------------------------------------------------*\ + Class polynomialFunction Declaration +\*---------------------------------------------------------------------------*/ + +class polynomialFunction +: + private scalarList +{ + // Private data + + //- Include the log term? - only activated using integralMinus1() + bool logActive_; + + //- Log coefficient - only activated using integralMinus1() + scalar logCoeff_; + + + // Private Member Functions + + //- Return integral coefficients. + // Argument becomes zeroth element (constant of integration) + static polynomialFunction cloneIntegral + ( + const polynomialFunction&, + const scalar intConstant = 0.0 + ); + + //- Return integral coefficients when lowest order is -1. + // Argument becomes zeroth element (constant of integration) + static polynomialFunction cloneIntegralMinus1 + ( + const polynomialFunction&, + const scalar intConstant = 0.0 + ); + + + //- Disallow default bitwise assignment + void operator=(const polynomialFunction&); + + + +public: + + //- Runtime type information + TypeName("polynomialFunction"); + + + // Constructors + + //- Construct a particular size, with all coefficients = 0.0 + explicit polynomialFunction(const label); + + //- Copy constructor + polynomialFunction(const polynomialFunction&); + + //- Construct from a list of coefficients + explicit polynomialFunction(const UList& coeffs); + + //- Construct from Istream + polynomialFunction(Istream&); + + + //- Destructor + virtual ~polynomialFunction(); + + + // Member Functions + + //- Return the number of coefficients + using scalarList::size; + + //- Return coefficient + using scalarList::operator[]; + + + // Access + + + //- Return true if the log term is active + bool logActive() const; + + //- Return the log coefficient + scalar logCoeff() const; + + + // Evaluation + + //- Return polynomial value + scalar value(const scalar x) const; + + //- Integrate between two values + scalar integrate(const scalar x1, const scalar x2) const; + + + //- Return integral coefficients. + // Argument becomes zeroth element (constant of integration) + polynomialFunction integral + ( + const scalar intConstant = 0.0 + ) const; + + //- Return integral coefficients when lowest order is -1. + // Argument becomes zeroth element (constant of integration) + polynomialFunction integralMinus1 + ( + const scalar intConstant = 0.0 + ) const; + + + // Member Operators + + polynomialFunction& operator+=(const polynomialFunction&); + polynomialFunction& operator-=(const polynomialFunction&); + + polynomialFunction& operator*=(const scalar); + polynomialFunction& operator/=(const scalar); + + + //- Ostream Operator + friend Ostream& operator<<(Ostream&, const polynomialFunction&); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * // + +polynomialFunction operator+ +( + const polynomialFunction&, + const polynomialFunction& +); + + +polynomialFunction operator- +( + const polynomialFunction&, + const polynomialFunction& +); + + +polynomialFunction operator* +( + const scalar, + const polynomialFunction& +); + + +polynomialFunction operator/ +( + const scalar, + const polynomialFunction& +); + + +polynomialFunction operator* +( + const polynomialFunction&, + const scalar +); + + +polynomialFunction operator/ +( + const polynomialFunction&, + const scalar +); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C index 15269f6ce2..c86db56ae7 100644 --- a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C +++ b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C @@ -45,8 +45,8 @@ Foam::hPolynomialThermo::hPolynomialThermo Sf_ *= this->W(); CpCoeffs_ *= this->W(); - hCoeffs_ = CpCoeffs_.integrate(); - sCoeffs_ = CpCoeffs_.integrateMinus1(); + hCoeffs_ = CpCoeffs_.integral(); + sCoeffs_ = CpCoeffs_.integralMinus1(); // Offset h poly so that it is relative to the enthalpy at Tstd hCoeffs_[0] += Hf_ - hCoeffs_.value(specie::Tstd); @@ -73,8 +73,8 @@ Foam::hPolynomialThermo::hPolynomialThermo Sf_ *= this->W(); CpCoeffs_ *= this->W(); - hCoeffs_ = CpCoeffs_.integrate(); - sCoeffs_ = CpCoeffs_.integrateMinus1(); + hCoeffs_ = CpCoeffs_.integral(); + sCoeffs_ = CpCoeffs_.integralMinus1(); // Offset h poly so that it is relative to the enthalpy at Tstd hCoeffs_[0] += Hf_ - hCoeffs_.value(specie::Tstd); From 96edf6f32dde45b388279598c67674c0239680ac Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 8 Feb 2011 13:48:01 +0100 Subject: [PATCH 05/24] STYLE: pass wordReList instead of wordList to polyBoundaryMesh::patchSet() - make warning optional and reuse in cellDistFuncs::getPatchIDs --- .../polyBoundaryMesh/polyBoundaryMesh.C | 20 ++++--- .../polyBoundaryMesh/polyBoundaryMesh.H | 11 ++-- .../inverseDistanceDiffusivity.C | 2 +- .../inverseDistanceDiffusivity.H | 10 ++-- src/meshTools/cellDist/cellDistFuncs.C | 53 +++++-------------- src/meshTools/cellDist/cellDistFuncs.H | 8 +-- .../field/nearWallFields/nearWallFields.C | 5 +- .../functionObjects/forces/forces/forces.C | 3 +- 8 files changed, 47 insertions(+), 65 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C index e26c665c63..897e290b43 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C @@ -550,11 +550,12 @@ Foam::label Foam::polyBoundaryMesh::whichPatch(const label faceIndex) const Foam::labelHashSet Foam::polyBoundaryMesh::patchSet ( - const wordList& patchNames + const wordReList& patchNames, + const bool warnNotFound ) const { - wordList allPatchNames = names(); - labelHashSet ps(size()); + const wordList allPatchNames(this->names()); + labelHashSet ids(size()); forAll(patchNames, i) { @@ -562,20 +563,23 @@ Foam::labelHashSet Foam::polyBoundaryMesh::patchSet // of all patch names for matches labelList patchIDs = findStrings(patchNames[i], allPatchNames); - if (patchIDs.empty()) + if (patchIDs.empty() && warnNotFound) { - WarningIn("polyBoundaryMesh::patchSet(const wordList&)") - << "Cannot find any patch names matching " << patchNames[i] + WarningIn + ( + "polyBoundaryMesh::patchSet" + "(const wordReList&, const bool) const" + ) << "Cannot find any patch names matching " << patchNames[i] << endl; } forAll(patchIDs, j) { - ps.insert(patchIDs[j]); + ids.insert(patchIDs[j]); } } - return ps; + return ids; } diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H index 0e94bb89b3..39fb527368 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H @@ -38,6 +38,7 @@ SourceFiles #include "polyPatchList.H" #include "regIOobject.H" #include "labelPair.H" +#include "wordReList.H" #include "HashSet.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -166,9 +167,13 @@ public: //- Per boundary face label the patch index const labelList& patchID() const; - //- Return the set of patch IDs corresponding to the given list of names - // Wild cards are expanded. - labelHashSet patchSet(const wordList&) const; + //- Return the set of patch IDs corresponding to the given names + // By default warns if given names are not found. + labelHashSet patchSet + ( + const wordReList& patchNames, + const bool warnNotFound = true + ) const; //- Check whether all procs have all patches and in same order. Return // true if in error. diff --git a/src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.C b/src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.C index 0cc744e7dd..bbaae54007 100644 --- a/src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.C +++ b/src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.C @@ -2,7 +2,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 diff --git a/src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.H b/src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.H index 5e1025d1f7..dc88204bd6 100644 --- a/src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.H +++ b/src/fvMotionSolver/motionDiffusivity/inverseDistance/inverseDistanceDiffusivity.H @@ -2,7 +2,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 @@ -36,6 +36,7 @@ SourceFiles #define inverseDistanceDiffusivity_H #include "uniformDiffusivity.H" +#include "wordReList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -43,7 +44,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class inverseDistanceDiffusivity Declaration + Class inverseDistanceDiffusivity Declaration \*---------------------------------------------------------------------------*/ class inverseDistanceDiffusivity @@ -53,9 +54,8 @@ class inverseDistanceDiffusivity // Private data //- Patches selected to base the distance on - // These can contain regular expressions and the actual patch names - // will be searched for. - wordList patchNames_; + // These can contain patch names or regular expressions to search for. + wordReList patchNames_; // Private Member Functions diff --git a/src/meshTools/cellDist/cellDistFuncs.C b/src/meshTools/cellDist/cellDistFuncs.C index 493ee6b666..123ea628d8 100644 --- a/src/meshTools/cellDist/cellDistFuncs.C +++ b/src/meshTools/cellDist/cellDistFuncs.C @@ -2,7 +2,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 @@ -28,14 +28,9 @@ License #include "wallPolyPatch.H" #include "polyBoundaryMesh.H" -namespace Foam -{ +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -defineTypeNameAndDebug(cellDistFuncs, 0); - -} +defineTypeNameAndDebug(Foam::cellDistFuncs, 0); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -61,7 +56,6 @@ Foam::label Foam::cellDistFuncs::findIndex // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from mesh Foam::cellDistFuncs::cellDistFuncs(const polyMesh& mesh) : mesh_(mesh) @@ -70,36 +64,12 @@ Foam::cellDistFuncs::cellDistFuncs(const polyMesh& mesh) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -// Get patch ids of named patches Foam::labelHashSet Foam::cellDistFuncs::getPatchIDs ( - const wordList& patchNames + const wordReList& patchNames ) const { - const polyBoundaryMesh& bMesh = mesh().boundaryMesh(); - - // Construct Set of patchNames for easy checking if included - HashSet patchNamesHash(patchNames.size()); - - forAll(patchNames, patchI) - { - patchNamesHash.insert(patchNames[patchI]); - } - - // Loop over all patches and check if patch name in hashset - - labelHashSet patchIDs(bMesh.size()); - - forAll(bMesh, patchI) - { - const polyPatch& patch = bMesh[patchI]; - - if (patchNamesHash.found(patch.name())) - { - patchIDs.insert(patchI); - } - } - return patchIDs; + return mesh().boundaryMesh().patchSet(patchNames, false); } @@ -252,8 +222,10 @@ Foam::label Foam::cellDistFuncs::getPointNeighbours // size of largest patch (out of supplied subset of patches) -Foam::label Foam::cellDistFuncs::maxPatchSize(const labelHashSet& patchIDs) - const +Foam::label Foam::cellDistFuncs::maxPatchSize +( + const labelHashSet& patchIDs +) const { label maxSize = 0; @@ -271,8 +243,11 @@ Foam::label Foam::cellDistFuncs::maxPatchSize(const labelHashSet& patchIDs) // sum of patch sizes (out of supplied subset of patches) -Foam::label Foam::cellDistFuncs::sumPatchSize(const labelHashSet& patchIDs) - const +Foam::label Foam::cellDistFuncs::sumPatchSize +( + const labelHashSet& patchIDs +) +const { label sum = 0; diff --git a/src/meshTools/cellDist/cellDistFuncs.H b/src/meshTools/cellDist/cellDistFuncs.H index 7392e18f2d..3ef0c5e6e8 100644 --- a/src/meshTools/cellDist/cellDistFuncs.H +++ b/src/meshTools/cellDist/cellDistFuncs.H @@ -2,7 +2,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 @@ -39,7 +39,7 @@ SourceFiles #include "scalarField.H" #include "HashSet.H" #include "Map.H" -#include "wordList.H" +#include "wordReList.H" #include "scalarField.H" #include "point.H" #include "primitivePatch.H" @@ -98,8 +98,8 @@ public: return mesh_; } - //- Get patchIDs of named patches - labelHashSet getPatchIDs(const wordList&) const; + //- Return the set of patch IDs corresponding to the given names + labelHashSet getPatchIDs(const wordReList& patchNames) const; //- Get patchIDs of/derived off certain type (e.g. 'processorPolyPatch') // Uses isA, not isType diff --git a/src/postProcessing/functionObjects/field/nearWallFields/nearWallFields.C b/src/postProcessing/functionObjects/field/nearWallFields/nearWallFields.C index 228fa5ad32..2774396e4f 100644 --- a/src/postProcessing/functionObjects/field/nearWallFields/nearWallFields.C +++ b/src/postProcessing/functionObjects/field/nearWallFields/nearWallFields.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -87,8 +87,7 @@ void Foam::nearWallFields::read(const dictionary& dict) const fvMesh& mesh = refCast(obr_); dict.lookup("fields") >> fieldSet_; - patchSet_ = - mesh.boundaryMesh().patchSet(wordList(dict.lookup("patches"))); + patchSet_ = mesh.boundaryMesh().patchSet(dict.lookup("patches")); distance_ = readScalar(dict.lookup("distance")); diff --git a/src/postProcessing/functionObjects/forces/forces/forces.C b/src/postProcessing/functionObjects/forces/forces/forces.C index 412794795b..aacc6b1947 100644 --- a/src/postProcessing/functionObjects/forces/forces/forces.C +++ b/src/postProcessing/functionObjects/forces/forces/forces.C @@ -229,8 +229,7 @@ void Foam::forces::read(const dictionary& dict) const fvMesh& mesh = refCast(obr_); - patchSet_ = - mesh.boundaryMesh().patchSet(wordList(dict.lookup("patches"))); + patchSet_ = mesh.boundaryMesh().patchSet(dict.lookup("patches")); if (directForceDensity_) { From 10f5e8080328ce7307f4f352a563311cd482e326 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 11 Feb 2011 09:21:08 +0100 Subject: [PATCH 06/24] ENH: add -make option to touchdep, toucho - restricts selection to Make/$WM_OPTIONS* subdirectories, which is useful when multiple compilers are in use --- bin/touchdep | 70 +++++++++++++++++++++++++++++++++++++++++++--------- bin/toucho | 67 ++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 113 insertions(+), 24 deletions(-) diff --git a/bin/touchdep b/bin/touchdep index cfc8cebc20..48c19081ca 100755 --- a/bin/touchdep +++ b/bin/touchdep @@ -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 @@ -28,25 +28,71 @@ # Description # touch all .dep files #------------------------------------------------------------------------------ +usage() { + while [ "$#" -ge 1 ]; do echo "$1"; shift; done + cat< Date: Fri, 11 Feb 2011 16:45:36 +0100 Subject: [PATCH 07/24] STYLE: remove editing junk --- src/surfMesh/surfaceFormats/ofs/OFSsurfaceFormat.H | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/surfMesh/surfaceFormats/ofs/OFSsurfaceFormat.H b/src/surfMesh/surfaceFormats/ofs/OFSsurfaceFormat.H index cad33330cc..39b1654623 100644 --- a/src/surfMesh/surfaceFormats/ofs/OFSsurfaceFormat.H +++ b/src/surfMesh/surfaceFormats/ofs/OFSsurfaceFormat.H @@ -2,7 +2,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 @@ -28,7 +28,7 @@ Description Provide a means of reading/writing the single-file OpenFOAM surface format. Note - This class provides more methods than the regular surface format interface.x + This class provides more methods than the regular surface format interface. SourceFiles OFSsurfaceFormat.C From 0c2eb36ed20f835b889cf8607772d949a658c67e Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 11 Feb 2011 16:52:36 +0100 Subject: [PATCH 08/24] STYLE: allow spaces in pkg name (again) --- wmake/wmakePrintBuild | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wmake/wmakePrintBuild b/wmake/wmakePrintBuild index 3812bece3e..103e65cb07 100755 --- a/wmake/wmakePrintBuild +++ b/wmake/wmakePrintBuild @@ -76,8 +76,8 @@ do ;; -pkg | -package) [ "$#" -ge 2 ] || usage "'$1' option requires an argument" - # mark empty as 'none', disallow '!' and spaces in string - package=$(echo "${2:-none}" | sed -e 's/!//g' -e 's/ //g') + # mark empty as 'none', disallow '!' in string + package=$(echo "${2:-none}" | sed -e 's/!//g') shift 2 ;; -v | -version) From 56e07de724a455ee4058eb7ad89bb505325a3d6f Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 14 Feb 2011 10:00:48 +0100 Subject: [PATCH 09/24] STYLE: changed some missed doxygen '@' to '\' --- .../mesh/conversion/foamToStarMesh/foamToStarMesh.C | 2 +- .../preProcessing/changeDictionary/changeDictionary.C | 2 +- bin/foamEtcFile | 6 +++--- src/OSspecific/POSIX/regExp.H | 2 +- .../includeIfPresentEntry/includeIfPresentEntry.H | 2 +- src/OpenFOAM/global/foamDoc.H | 10 +++++----- src/conversion/meshWriter/meshWriter.H | 2 +- .../coordinateRotation/coordinateRotation.H | 2 +- .../surfaceFormats/stl/STLsurfaceFormatASCII.L | 10 +++++----- .../chemistryReaders/chemkinReader/chemkinLexer.L | 10 +++++----- .../triSurface/interfaces/STL/readSTLASCII.L | 8 ++++---- 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C b/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C index b154a3816d..af4985dd43 100644 --- a/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C +++ b/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C @@ -40,7 +40,7 @@ Usage Note The cellTable information available in the files - \c constant/cellTable and @c constant/polyMesh/cellTableId + \c constant/cellTable and \c constant/polyMesh/cellTableId will be used if available. Otherwise the cellZones are used when creating the cellTable information. diff --git a/applications/utilities/preProcessing/changeDictionary/changeDictionary.C b/applications/utilities/preProcessing/changeDictionary/changeDictionary.C index b580a27e71..083107efb9 100644 --- a/applications/utilities/preProcessing/changeDictionary/changeDictionary.C +++ b/applications/utilities/preProcessing/changeDictionary/changeDictionary.C @@ -29,7 +29,7 @@ Description type in the field and polyMesh/boundary files. Reads dictionaries (fields) and entries to change from a dictionary. - E.g. to make the \em movingWall a \em fixedValue for @em p but all other + E.g. to make the \em movingWall a \em fixedValue for \em p but all other \em Walls a zeroGradient boundary condition, the \c system/changeDictionaryDict would contain the following: \verbatim diff --git a/bin/foamEtcFile b/bin/foamEtcFile index 5bae566b55..20b5be0fed 100755 --- a/bin/foamEtcFile +++ b/bin/foamEtcFile @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------- # License @@ -33,10 +33,10 @@ # personal settings to site-wide settings. # # For example, within the user ~/.OpenFOAM//prefs.sh: -# @verbatim +# \code # foamPrefs=`$WM_PROJECT_DIR/bin/foamEtcFile -m go prefs.sh` \ # && _foamSource $foamPrefs -# @endverbatim +# \endcode # #------------------------------------------------------------------------------- usage() { diff --git a/src/OSspecific/POSIX/regExp.H b/src/OSspecific/POSIX/regExp.H index 7144d5723f..9106264ac8 100644 --- a/src/OSspecific/POSIX/regExp.H +++ b/src/OSspecific/POSIX/regExp.H @@ -29,7 +29,7 @@ Description SeeAlso The manpage regex(7) for more information about POSIX regular expressions. - These differ somewhat from \c Perl and @c sed regular expressions. + These differ somewhat from \c Perl and \c sed regular expressions. SourceFiles regExp.C diff --git a/src/OpenFOAM/db/dictionary/functionEntries/includeIfPresentEntry/includeIfPresentEntry.H b/src/OpenFOAM/db/dictionary/functionEntries/includeIfPresentEntry/includeIfPresentEntry.H index 98df647af7..f723f5ee98 100644 --- a/src/OpenFOAM/db/dictionary/functionEntries/includeIfPresentEntry/includeIfPresentEntry.H +++ b/src/OpenFOAM/db/dictionary/functionEntries/includeIfPresentEntry/includeIfPresentEntry.H @@ -27,7 +27,7 @@ Class Description Specify a file to include if it exists. Expects a single string to follow. - The \c \#includeIfPresent directive is similar to the @c \#include + The \c \#includeIfPresent directive is similar to the \c \#include directive, but does not generate an error if the file does not exist. See Also diff --git a/src/OpenFOAM/global/foamDoc.H b/src/OpenFOAM/global/foamDoc.H index c44819062d..04af83ae1b 100644 --- a/src/OpenFOAM/global/foamDoc.H +++ b/src/OpenFOAM/global/foamDoc.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -21,9 +21,9 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -@mainpage OpenFOAM®: open source CFD +\mainpage OpenFOAM®: open source CFD -@section about About OpenFOAM +\section about About OpenFOAM OpenFOAM is a free, open source CFD software package produced by a commercial company, @@ -35,7 +35,7 @@ License heat transfer, to solid dynamics and electromagnetics. More ... -@section users Our commitment to the users +\section users Our commitment to the users OpenFOAM comes with full commercial support from OpenCFD, including @@ -48,7 +48,7 @@ License These activities fund the development, maintenance and release of OpenFOAM to make it an extremely viable commercial open source product. -@section opensource Our commitment to open source +\section opensource Our commitment to open source OpenCFD is committed to open source software, continually developing and maintaining OpenFOAM under the diff --git a/src/conversion/meshWriter/meshWriter.H b/src/conversion/meshWriter/meshWriter.H index 4aace111bc..431b565be2 100644 --- a/src/conversion/meshWriter/meshWriter.H +++ b/src/conversion/meshWriter/meshWriter.H @@ -35,7 +35,7 @@ Description write OpenFOAM meshes and/or results to another CFD format - currently just STAR-CD -@par Files +\par Files "constant/boundaryRegion" is an IOMap that contains the boundary type and names. eg, diff --git a/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H b/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H index f7a44de396..8ae67e952c 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H +++ b/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H @@ -32,7 +32,7 @@ Description or (e3/e1). Any nonorthogonality will be absorbed into the second vector. For convenience, the dictionary constructor forms allow a few shortcuts: - - if the \c type is not otherwise specified, the type @c axes + - if the \c type is not otherwise specified, the type \c axes is implicit - if an axes specification (eg, e3/e1) is used, the coordinateRotation sub-dictionary can be dropped. diff --git a/src/surfMesh/surfaceFormats/stl/STLsurfaceFormatASCII.L b/src/surfMesh/surfaceFormats/stl/STLsurfaceFormatASCII.L index 5ba1363297..6145df61ca 100644 --- a/src/surfMesh/surfaceFormats/stl/STLsurfaceFormatASCII.L +++ b/src/surfMesh/surfaceFormats/stl/STLsurfaceFormatASCII.L @@ -2,7 +2,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 @@ -36,7 +36,7 @@ License using namespace Foam; // Dummy yyFlexLexer::yylex() to keep the linker happy. It is not called -//! @cond dummy +//! \cond dummy int yyFlexLexer::yylex() { FatalErrorIn("yyFlexLexer::yylex()") @@ -44,12 +44,12 @@ int yyFlexLexer::yylex() << abort(FatalError); return 0; } -//! @endcond +//! \endcond // Dummy yywrap to keep yylex happy at compile time. // It is called by yylex but is not used as the mechanism to change file. // See <> -//! @cond dummy +//! \cond dummy #if YY_FLEX_SUBMINOR_VERSION < 34 extern "C" int yywrap() #else @@ -58,7 +58,7 @@ int yyFlexLexer::yywrap() { return 1; } -//! @endcond +//! \endcond //- A lexer for parsing STL ASCII files. diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L index 58987ae82e..9cdded54d9 100644 --- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L +++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L @@ -2,7 +2,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 @@ -38,7 +38,7 @@ License int Foam::chemkinReader::yyBufSize = YY_BUF_SIZE; // Dummy yyFlexLexer::yylex() to keep the linker happy. It is not called -//! @cond dummy +//! \cond dummy int yyFlexLexer::yylex() { FatalErrorIn("yyFlexLexer::yylex()") @@ -47,13 +47,13 @@ int yyFlexLexer::yylex() return 0; } -//! @endcond +//! \endcond // Dummy yywrap to keep yylex happy at compile time. // It is called by yylex but is not used as the mechanism to change file. // See <> -//! @cond dummy +//! \cond dummy #if YY_FLEX_SUBMINOR_VERSION < 34 extern "C" int yywrap() #else @@ -62,7 +62,7 @@ int yyFlexLexer::yywrap() { return 1; } -//! @endcond +//! \endcond Foam::string foamSpecieString(const char* YYText) diff --git a/src/triSurface/triSurface/interfaces/STL/readSTLASCII.L b/src/triSurface/triSurface/interfaces/STL/readSTLASCII.L index 9cb9f1d3d1..20c63997c7 100644 --- a/src/triSurface/triSurface/interfaces/STL/readSTLASCII.L +++ b/src/triSurface/triSurface/interfaces/STL/readSTLASCII.L @@ -39,7 +39,7 @@ License using namespace Foam; // Dummy yyFlexLexer::yylex() to keep the linker happy. It is not called -//! @cond dummy +//! \cond dummy int yyFlexLexer::yylex() { FatalErrorIn("yyFlexLexer::yylex()") @@ -47,12 +47,12 @@ int yyFlexLexer::yylex() << abort(FatalError); return 0; } -//! @endcond +//! \endcond // Dummy yywrap to keep yylex happy at compile time. // It is called by yylex but is not used as the mechanism to change file. // See <> -//! @cond dummy +//! \cond dummy #if YY_FLEX_SUBMINOR_VERSION < 34 extern "C" int yywrap() #else @@ -61,7 +61,7 @@ int yyFlexLexer::yywrap() { return 1; } -//! @endcond +//! \endcond class STLLexer From cf65eebcd55707625684832ced9d9a8be1a96ad6 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 15 Feb 2011 09:29:33 +0100 Subject: [PATCH 10/24] ENH: add foamPackDeps, foamPackMake to help transferring between machines --- bin/foamPackDeps | 132 ++++++++++++++++++++++++++++++++++++ bin/foamPackDoxygen | 2 +- bin/foamPackMake | 135 +++++++++++++++++++++++++++++++++++++ bin/foamPackThirdPartyDeps | 1 + bin/foamPackThirdPartyMake | 1 + 5 files changed, 270 insertions(+), 1 deletion(-) create mode 100755 bin/foamPackDeps create mode 100755 bin/foamPackMake create mode 120000 bin/foamPackThirdPartyDeps create mode 120000 bin/foamPackThirdPartyMake diff --git a/bin/foamPackDeps b/bin/foamPackDeps new file mode 100755 index 0000000000..198c3a3b19 --- /dev/null +++ b/bin/foamPackDeps @@ -0,0 +1,132 @@ +#!/bin/sh +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. +# \\/ M anipulation | +#------------------------------------------------------------------------------- +# License +# This file is part of OpenFOAM. +# +# OpenFOAM is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenFOAM. If not, see . +# +# Script +# foamPackDeps [OPTION] +# +# Description +# Pack and compress *.dep files from OpenFOAM +# +# Script +# foamPackDeps [OPTION] +# +# Description +# Pack and compress *.dep files from OpenFOAM ThirdParty +# +#------------------------------------------------------------------------------ +toolsDir="${0%/*}/tools" # this script is located in the tools/ parent dir + +case "${0##*/}" in +*ThirdParty*) + # for ThirdParty + codeBase="OpenFOAM ThirdParty" + packDir=ThirdParty-$WM_PROJECT_VERSION + ;; +*) + # regular + codeBase="OpenFOAM ThirdParty" + packDir=$WM_PROJECT-$WM_PROJECT_VERSION + ;; +esac + + +usage() { + while [ $# -gt 0 ]; do echo "$1" 1>&2; shift; done +cat <&2 +Usage: ${0##*/} [OPTION] +options: + -o specify alternative output directory + +* Pack and compress *.dep files from $codeBase + +USAGE + exit 1 +} + + +unset outputDir +# parse options +while [ "$#" -gt 0 ] +do + case "$1" in + -h | -help) + usage + ;; + -o | -output) + [ "$#" -ge 2 ] || usage "'$1' option requires an argument" + outputDir=${2%%/} + shift 2 + ;; + -*) + usage "unknown option: '$*'" + ;; + *) + break + ;; + esac +done + +# check for essential directories +[ -d $packDir ] || { + echo "Error: directory $packDir does not exist" 1>&2 + exit 1 +} + + +#------------------------------------------------------------------------------ +timeStamp=$(date +%Y-%m-%d) +packExt=tgz +packBase=${packDir}.deps_${timeStamp} + +# add optional output directory +[ -d "$outputDir" ] && packBase="$outputDir/$packBase" +packFile=$packBase.$packExt + +# avoid overwriting old pack file +if [ -f $packFile ] +then + echo "Error: $packFile already exists" 1>&2 + exit 1 +fi + +cat <&2 +------------------------------------------------------------------------------- +Packing *.dep files into $packFile + +INFO + +# Clean up on Ctrl-C +trap 'rm -f $packFile 2>/dev/null' INT + +find -H $packDir -name '*.dep' -type f -print | tar cpzf $packFile -T - + +if [ $? -eq 0 ] +then + echo "Finished packing *.dep files into file $packFile" 1>&2 +else + echo "Error: failure packing *.dep files into $packFile" 1>&2 + rm -f $packFile 2>/dev/null +fi + +#------------------------------------------------------------------------------ diff --git a/bin/foamPackDoxygen b/bin/foamPackDoxygen index c9337e972f..464a5d523f 100755 --- a/bin/foamPackDoxygen +++ b/bin/foamPackDoxygen @@ -122,7 +122,7 @@ if [ $? -eq 0 ] then echo "Finished packing doxygen html into file $packFile" 1>&2 else - echo "Error: failure packing doxygen html file $packFile" 1>&2 + echo "Error: failure packing doxygen html into file $packFile" 1>&2 rm -f $packFile 2>/dev/null fi diff --git a/bin/foamPackMake b/bin/foamPackMake new file mode 100755 index 0000000000..a3370867d0 --- /dev/null +++ b/bin/foamPackMake @@ -0,0 +1,135 @@ +#!/bin/sh +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. +# \\/ M anipulation | +#------------------------------------------------------------------------------- +# License +# This file is part of OpenFOAM. +# +# OpenFOAM is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenFOAM. If not, see . +# +# Script +# foamPackMake [OPTION] +# +# Description +# Pack and compress OpenFOAM Make/ directories +# +# Script +# foamPackThirdPartyMake [OPTION] +# +# Description +# Pack and compress OpenFOAM ThirdParty Make/ directories +# +#------------------------------------------------------------------------------ +toolsDir="${0%/*}/tools" # this script is located in the tools/ parent dir + +case "${0##*/}" in +*ThirdParty*) + # for ThirdParty + codeBase="OpenFOAM ThirdParty" + packDir=ThirdParty-$WM_PROJECT_VERSION + ;; +*) + # regular + codeBase="OpenFOAM ThirdParty" + packDir=$WM_PROJECT-$WM_PROJECT_VERSION + ;; +esac + + +usage() { + while [ $# -gt 0 ]; do echo "$1" 1>&2; shift; done +cat <&2 +Usage: ${0##*/} [OPTION] +options: + -o specify alternative output directory + +* Pack and compress $codeBase Make/ directories + + The value of 'archOptions' normally corresponds to \$WM_OPTIONS + The current value of \$WM_OPTIONS = $WM_OPTIONS + +USAGE + exit 1 +} + + +unset outputDir +# parse options +while [ "$#" -gt 0 ] +do + case "$1" in + -h | -help) + usage + ;; + -o | -output) + [ "$#" -ge 2 ] || usage "'$1' option requires an argument" + outputDir=${2%%/} + shift 2 + ;; + -*) + usage "unknown option: '$*'" + ;; + *) + break + ;; + esac +done + +[ $# -eq 1 ] || usage "Error: specify architecture" + +# same as $WM_OPTIONS - eg, 'linux64GccDPOpt' +archOptions="$1" + +#------------------------------------------------------------------------------ +timeStamp=$(date +%Y-%m-%d) +packExt=tgz +packBase=${packDir}.Make-${archOptions}_${timeStamp} + +# add optional output directory +[ -d "$outputDir" ] && packBase="$outputDir/$packBase" +packFile=$packBase.$packExt + +# avoid overwriting old pack file +if [ -f $packFile ] +then + echo "Error: $packFile already exists" 1>&2 + exit 1 +fi + +cat <&2 +------------------------------------------------------------------------------- +Pack and compress Make/$archOptions* directories into $packFile + +INFO + +# Clean up on Ctrl-C +trap 'rm -f $packFile 2>/dev/null' INT + +find -H $packDir -depth -name Make -type d -print | \ + xargs -i find '{}' -depth -name "$archOptions*" -type d -print | \ + tar cpzf $packFile -T - + +if [ $? -eq 0 ] +then + echo "Finished packing Make/$archOptions directories into $packFile" 1>&2 +else + echo "Error: failure packing Make/$archOptions directories into $packFile" 1>&2 + rm -f $packFile 2>/dev/null +fi + +#------------------------------------------------------------------------------ diff --git a/bin/foamPackThirdPartyDeps b/bin/foamPackThirdPartyDeps new file mode 120000 index 0000000000..331c2569c8 --- /dev/null +++ b/bin/foamPackThirdPartyDeps @@ -0,0 +1 @@ +foamPackDeps \ No newline at end of file diff --git a/bin/foamPackThirdPartyMake b/bin/foamPackThirdPartyMake new file mode 120000 index 0000000000..56bc81cf73 --- /dev/null +++ b/bin/foamPackThirdPartyMake @@ -0,0 +1 @@ +foamPackMake \ No newline at end of file From 449a0e253dfb72f33e444fff19f141ccbf49c689 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 15 Feb 2011 10:08:46 +0100 Subject: [PATCH 11/24] ENH: add -current option to foamPackBin, foamPackMake - reduces typing --- bin/foamPack | 6 +++--- bin/foamPackBin | 21 ++++++++++++++++----- bin/foamPackDeps | 4 ++-- bin/foamPackDoxygen | 18 +++++++++--------- bin/foamPackMake | 21 ++++++++++++++++----- bin/tools/foamPackSource | 4 ++-- 6 files changed, 48 insertions(+), 26 deletions(-) diff --git a/bin/foamPack b/bin/foamPack index 3faa48cfdf..5c22d5849a 100755 --- a/bin/foamPack +++ b/bin/foamPack @@ -37,8 +37,8 @@ usage() { cat <&2 Usage: ${0##*/} [OPTION] options: - -o specify alternative output directory - -nogit bypass using 'git archive' + -o, -output specify alternative output directory + -nogit bypass using 'git archive' * Pack and compress OpenFOAM directory for release @@ -46,7 +46,7 @@ USAGE exit 1 } -unset prefix outputDir nogit +unset outputDir nogit # parse options while [ "$#" -gt 0 ] do diff --git a/bin/foamPackBin b/bin/foamPackBin index 2cd739b818..67738d1ea8 100755 --- a/bin/foamPackBin +++ b/bin/foamPackBin @@ -57,8 +57,10 @@ usage() { while [ $# -gt 0 ]; do echo "$1" 1>&2; shift; done cat <&2 Usage: ${0##*/} [OPTION] + ${0##*/} [OPTION] -current options: - -o specify alternative output directory + -c, -current use current value of \$WM_OPTIONS + -o, -output specify alternative output directory * Pack and compress binary version of $codeBase for release @@ -70,7 +72,8 @@ USAGE } -unset prefix outputDir +unset archOptions outputDir + # parse options while [ "$#" -gt 0 ] do @@ -78,6 +81,10 @@ do -h | -help) usage ;; + -c | -current) # use $WM_OPTIONS - eg, 'linux64GccDPOpt' + archOptions="$WM_OPTIONS" + shift + ;; -o | -output) [ "$#" -ge 2 ] || usage "'$1' option requires an argument" outputDir=${2%%/} @@ -92,10 +99,14 @@ do esac done -[ $# -eq 1 ] || usage "Error: specify architecture" +if [ -n "$archOptions" ] +then + [ $# -eq 0 ] || usage "Error: cannot specify both -current and architecture" +else + archOptions="$1" + [ $# -eq 1 ] || usage "Error: specify architecture" +fi -# same as $WM_OPTIONS - eg, 'linux64GccDPOpt' -archOptions="$1" #------------------------------------------------------------------------------ timeStamp=$(date +%Y-%m-%d) diff --git a/bin/foamPackDeps b/bin/foamPackDeps index 198c3a3b19..67a885b900 100755 --- a/bin/foamPackDeps +++ b/bin/foamPackDeps @@ -56,7 +56,7 @@ usage() { cat <&2 Usage: ${0##*/} [OPTION] options: - -o specify alternative output directory + -o, -output specify alternative output directory * Pack and compress *.dep files from $codeBase @@ -123,7 +123,7 @@ find -H $packDir -name '*.dep' -type f -print | tar cpzf $packFile -T - if [ $? -eq 0 ] then - echo "Finished packing *.dep files into file $packFile" 1>&2 + echo "Finished packing *.dep files into $packFile" 1>&2 else echo "Error: failure packing *.dep files into $packFile" 1>&2 rm -f $packFile 2>/dev/null diff --git a/bin/foamPackDoxygen b/bin/foamPackDoxygen index 464a5d523f..6f1b17ca27 100755 --- a/bin/foamPackDoxygen +++ b/bin/foamPackDoxygen @@ -37,8 +37,8 @@ usage() { cat <&2 Usage: ${0##*/} [OPTION] options: - -prefix use alternative prefix - -o specify alternative output directory + -o, -output specify alternative output directory + -prefix use alternative prefix * Pack and compress the OpenFOAM doxygen html for release @@ -54,16 +54,16 @@ do -h | -help) usage ;; - -prefix | --prefix) - [ "$#" -ge 2 ] || usage "'$1' option requires an argument" - prefix=${2%%/} - shift 2 - ;; -o | -output) [ "$#" -ge 2 ] || usage "'$1' option requires an argument" outputDir=${2%%/} shift 2 ;; + -prefix | --prefix) + [ "$#" -ge 2 ] || usage "'$1' option requires an argument" + prefix=${2%%/} + shift 2 + ;; -*) usage "unknown option: '$*'" ;; @@ -120,9 +120,9 @@ fi if [ $? -eq 0 ] then - echo "Finished packing doxygen html into file $packFile" 1>&2 + echo "Finished packing doxygen html into $packFile" 1>&2 else - echo "Error: failure packing doxygen html into file $packFile" 1>&2 + echo "Error: failure packing doxygen html into $packFile" 1>&2 rm -f $packFile 2>/dev/null fi diff --git a/bin/foamPackMake b/bin/foamPackMake index a3370867d0..c4325723e3 100755 --- a/bin/foamPackMake +++ b/bin/foamPackMake @@ -55,8 +55,10 @@ usage() { while [ $# -gt 0 ]; do echo "$1" 1>&2; shift; done cat <&2 Usage: ${0##*/} [OPTION] + ${0##*/} [OPTION] -current options: - -o specify alternative output directory + -c, -current use current value of \$WM_OPTIONS + -o, -output specify alternative output directory * Pack and compress $codeBase Make/ directories @@ -68,7 +70,8 @@ USAGE } -unset outputDir +unset archOptions outputDir + # parse options while [ "$#" -gt 0 ] do @@ -76,6 +79,10 @@ do -h | -help) usage ;; + -c | -current) # use $WM_OPTIONS - eg, 'linux64GccDPOpt' + archOptions="$WM_OPTIONS" + shift + ;; -o | -output) [ "$#" -ge 2 ] || usage "'$1' option requires an argument" outputDir=${2%%/} @@ -90,10 +97,14 @@ do esac done -[ $# -eq 1 ] || usage "Error: specify architecture" +if [ -n "$archOptions" ] +then + [ $# -eq 0 ] || usage "Error: cannot specify both -current and architecture" +else + archOptions="$1" + [ $# -eq 1 ] || usage "Error: specify architecture" +fi -# same as $WM_OPTIONS - eg, 'linux64GccDPOpt' -archOptions="$1" #------------------------------------------------------------------------------ timeStamp=$(date +%Y-%m-%d) diff --git a/bin/tools/foamPackSource b/bin/tools/foamPackSource index 55a7b3bbee..a4d014cfcf 100755 --- a/bin/tools/foamPackSource +++ b/bin/tools/foamPackSource @@ -84,9 +84,9 @@ trap 'rm -f $packFile $tmpFile 2>/dev/null' INT tar cpzf $packFile --files-from $tmpFile if [ $? -eq 0 ] then - echo "Finished packing $packDir into file $packFile" 1>&2 + echo "Finished packing $packDir into $packFile" 1>&2 else - echo "Error: failure packing $packDir into file $packFile" 1>&2 + echo "Error: failure packing $packDir into $packFile" 1>&2 rm -f $packFile 2>/dev/null fi From dd22de68d4c8f71fea57f80180ed821c4e68f942 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 15 Feb 2011 11:04:08 +0100 Subject: [PATCH 12/24] ENH: support bzip2 compression for foamPack* --- bin/foamPackBin | 18 ++++++++++++++++-- bin/foamPackDeps | 22 ++++++++++++++++++++-- bin/foamPackDoxygen | 23 ++++++++++++++++++++--- bin/foamPackMake | 21 +++++++++++++++++++-- bin/tools/foamListSourceFiles | 2 ++ bin/tools/foamPackSource | 12 +++++++++++- 6 files changed, 88 insertions(+), 10 deletions(-) diff --git a/bin/foamPackBin b/bin/foamPackBin index 67738d1ea8..3ee4641383 100755 --- a/bin/foamPackBin +++ b/bin/foamPackBin @@ -59,6 +59,7 @@ cat <&2 Usage: ${0##*/} [OPTION] ${0##*/} [OPTION] -current options: + -b, -bzip2 use bzip2 instead of gzip compression -c, -current use current value of \$WM_OPTIONS -o, -output specify alternative output directory @@ -73,6 +74,7 @@ USAGE unset archOptions outputDir +packExt=tgz # parse options while [ "$#" -gt 0 ] @@ -81,6 +83,10 @@ do -h | -help) usage ;; + -b | -bzip2) + packExt=tbz + shift + ;; -c | -current) # use $WM_OPTIONS - eg, 'linux64GccDPOpt' archOptions="$WM_OPTIONS" shift @@ -110,7 +116,6 @@ fi #------------------------------------------------------------------------------ timeStamp=$(date +%Y-%m-%d) -packExt=tgz packBase=${packDir}.${archOptions}_${timeStamp} # add optional output directory @@ -137,11 +142,20 @@ else exit 1 fi +# bzip2 or gzip compression +case "$packFile" in +*tbz) + tarOpt=cpjf + ;; +*) + tarOpt=cpzf + ;; +esac # Clean up on Ctrl-C trap 'rm -f $packFile 2>/dev/null' INT -tar cpzf $packFile $dirList +tar $tarOpt $packFile $dirList if [ $? -eq 0 ] then echo "Finished packing file $packFile" 1>&2 diff --git a/bin/foamPackDeps b/bin/foamPackDeps index 67a885b900..1de69167df 100755 --- a/bin/foamPackDeps +++ b/bin/foamPackDeps @@ -56,6 +56,7 @@ usage() { cat <&2 Usage: ${0##*/} [OPTION] options: + -b, -bzip2 use bzip2 instead of gzip compression -o, -output specify alternative output directory * Pack and compress *.dep files from $codeBase @@ -66,6 +67,8 @@ USAGE unset outputDir +packExt=tgz + # parse options while [ "$#" -gt 0 ] do @@ -73,6 +76,10 @@ do -h | -help) usage ;; + -b | -bzip2) + packExt=tbz + shift + ;; -o | -output) [ "$#" -ge 2 ] || usage "'$1' option requires an argument" outputDir=${2%%/} @@ -96,7 +103,6 @@ done #------------------------------------------------------------------------------ timeStamp=$(date +%Y-%m-%d) -packExt=tgz packBase=${packDir}.deps_${timeStamp} # add optional output directory @@ -116,10 +122,22 @@ Packing *.dep files into $packFile INFO + +# bzip2 or gzip compression +case "$packFile" in +*tbz) + tarOpt=cpjf + ;; +*) + tarOpt=cpzf + ;; +esac + + # Clean up on Ctrl-C trap 'rm -f $packFile 2>/dev/null' INT -find -H $packDir -name '*.dep' -type f -print | tar cpzf $packFile -T - +find -H $packDir -name '*.dep' -type f -print | tar $tarOpt $packFile -T - if [ $? -eq 0 ] then diff --git a/bin/foamPackDoxygen b/bin/foamPackDoxygen index 6f1b17ca27..a5104e39b9 100755 --- a/bin/foamPackDoxygen +++ b/bin/foamPackDoxygen @@ -37,6 +37,7 @@ usage() { cat <&2 Usage: ${0##*/} [OPTION] options: + -b, -bzip2 use bzip2 instead of gzip compression -o, -output specify alternative output directory -prefix use alternative prefix @@ -46,7 +47,10 @@ USAGE exit 1 } + unset prefix outputDir +packExt=tgz + # parse options while [ "$#" -gt 0 ] do @@ -54,6 +58,10 @@ do -h | -help) usage ;; + -b | -bzip2) + packExt=tbz + shift + ;; -o | -output) [ "$#" -ge 2 ] || usage "'$1' option requires an argument" outputDir=${2%%/} @@ -87,7 +95,6 @@ then fi #------------------------------------------------------------------------------ -packExt=tgz packName=${packDir}_Doxygen # add optional output directory @@ -107,15 +114,25 @@ Packing doxygen html into $packFile INFO +# bzip2 or gzip compression +case "$packFile" in +*tbz) + tarOpt=cpjf + ;; +*) + tarOpt=cpzf + ;; +esac + # Clean up on Ctrl-C trap 'rm -f $packFile 2>/dev/null' INT if [ -n "$prefix" ] then # requires GNU tar - tar cpzf $packFile --transform="s@^@$prefix/@" $htmlDir + tar $tarOpt $packFile --transform="s@^@$prefix/@" $htmlDir else - tar cpzf $packFile $packDir/$htmlDir + tar $tarOpt $packFile $packDir/$htmlDir fi if [ $? -eq 0 ] diff --git a/bin/foamPackMake b/bin/foamPackMake index c4325723e3..f930e633c7 100755 --- a/bin/foamPackMake +++ b/bin/foamPackMake @@ -57,6 +57,7 @@ cat <&2 Usage: ${0##*/} [OPTION] ${0##*/} [OPTION] -current options: + -b, -bzip2 use bzip2 instead of gzip compression -c, -current use current value of \$WM_OPTIONS -o, -output specify alternative output directory @@ -71,6 +72,7 @@ USAGE unset archOptions outputDir +packExt=tgz # parse options while [ "$#" -gt 0 ] @@ -79,6 +81,10 @@ do -h | -help) usage ;; + -b | -bzip2) + packExt=tbz + shift + ;; -c | -current) # use $WM_OPTIONS - eg, 'linux64GccDPOpt' archOptions="$WM_OPTIONS" shift @@ -108,7 +114,6 @@ fi #------------------------------------------------------------------------------ timeStamp=$(date +%Y-%m-%d) -packExt=tgz packBase=${packDir}.Make-${archOptions}_${timeStamp} # add optional output directory @@ -128,12 +133,24 @@ Pack and compress Make/$archOptions* directories into $packFile INFO + +# bzip2 or gzip compression +case "$packFile" in +*tbz) + tarOpt=cpjf + ;; +*) + tarOpt=cpzf + ;; +esac + + # Clean up on Ctrl-C trap 'rm -f $packFile 2>/dev/null' INT find -H $packDir -depth -name Make -type d -print | \ xargs -i find '{}' -depth -name "$archOptions*" -type d -print | \ - tar cpzf $packFile -T - + tar $tarOpt $packFile -T - if [ $? -eq 0 ] then diff --git a/bin/tools/foamListSourceFiles b/bin/tools/foamListSourceFiles index a8d4d59091..2deedeac8c 100755 --- a/bin/tools/foamListSourceFiles +++ b/bin/tools/foamListSourceFiles @@ -71,6 +71,8 @@ find -H $packDir \ -a ! -name "*.tar" \ -a ! -name "*.tar.gz" \ -a ! -name "*.tgz" \ + -a ! -name "*.tar.bz2" \ + -a ! -name "*.tbz" \ -a ! -name "core" \ -a ! -name "core.[1-9]*" \ -a ! -name "libccmio*" \ diff --git a/bin/tools/foamPackSource b/bin/tools/foamPackSource index a4d014cfcf..83fe64391f 100755 --- a/bin/tools/foamPackSource +++ b/bin/tools/foamPackSource @@ -78,10 +78,20 @@ INFO wc $tmpFile | awk '{print "Packing",$1,"files - this could take some time ..."}' 1>&2 +# bzip2 or gzip compression +case "$packFile" in +*tbz) + tarOpt=cpjf + ;; +*) + tarOpt=cpzf + ;; +esac + # Clean up on Ctrl-C trap 'rm -f $packFile $tmpFile 2>/dev/null' INT -tar cpzf $packFile --files-from $tmpFile +tar $tarOpt $packFile --files-from $tmpFile if [ $? -eq 0 ] then echo "Finished packing $packDir into $packFile" 1>&2 From 9926d5f2a4142103906b1d628b3e64cef3a5df17 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 15 Feb 2011 16:12:12 +0100 Subject: [PATCH 13/24] BUG: dir names missed in toucho, touchdep - forgot in 10f5e8080328ce7307f4f352a563311cd482e326 --- bin/touchdep | 2 +- bin/toucho | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/touchdep b/bin/touchdep index 48c19081ca..fd22f4db23 100755 --- a/bin/touchdep +++ b/bin/touchdep @@ -85,7 +85,7 @@ do if [ "$restrictOpt" = true ] then echo "touching all .dep files under Make/$WM_OPTIONS* : $i" - find -depth -name Make -type d -print | \ + find $i -depth -name Make -type d -print | \ xargs -i find '{}' -depth -name "$WM_OPTIONS*" -type d -print | \ xargs -i find '{}' -name '*.dep' -type f -print | \ xargs -t touch diff --git a/bin/toucho b/bin/toucho index 71093cc49c..7d6bbc98b6 100755 --- a/bin/toucho +++ b/bin/toucho @@ -81,7 +81,7 @@ do if [ "$restrictOpt" = true ] then echo "touching all .o files under Make/$WM_OPTIONS* : $i" - find -depth -name Make -type d -print | \ + find $i -depth -name Make -type d -print | \ xargs -i find '{}' -depth -name "$WM_OPTIONS*" -type d -print | \ xargs -i find '{}' -name '*.o' -type f -print | \ xargs -t touch From 2873f9fc8dfbbb6df95f7ca951b1b64b3878d608 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 15 Feb 2011 16:26:59 +0100 Subject: [PATCH 14/24] ENH: add findEmptyMake for detecting rogue Make/ directories --- bin/findEmptyMake | 82 +++++++++++++++++++++++++++++++++++++++++++++++ bin/finddep | 4 +-- bin/foamPackBin | 2 +- bin/foamPackDeps | 2 +- bin/foamPackMake | 2 +- 5 files changed, 87 insertions(+), 5 deletions(-) create mode 100755 bin/findEmptyMake diff --git a/bin/findEmptyMake b/bin/findEmptyMake new file mode 100755 index 0000000000..37125c97e7 --- /dev/null +++ b/bin/findEmptyMake @@ -0,0 +1,82 @@ +#!/bin/sh +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. +# \\/ M anipulation | +#------------------------------------------------------------------------------- +# License +# This file is part of OpenFOAM. +# +# OpenFOAM is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenFOAM. If not, see . +# +# Script +# findEmptyMake +# +# Description +# Usage: findEmptyMake [dir1 .. dirN] +# +# Find Make/ directories without a 'files' or 'options' file. +# This can occur when a directory has been moved. +#------------------------------------------------------------------------------ +usage() { + exec 1>&2 + while [ "$#" -ge 1 ]; do echo "$1"; shift; done + cat<&2 + else + echo "skipping non-dir: $checkDir" 1>&2 + continue + fi + + find $checkDir -depth -name Make -type d -print | while read makeDir + do + [ -r "$makeDir/files" -a -r "$makeDir/options" ] || echo "$makeDir" + done + +done +# ----------------------------------------------------------------------------- diff --git a/bin/finddep b/bin/finddep index 331983cba1..0ef6401f4c 100755 --- a/bin/finddep +++ b/bin/finddep @@ -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 @@ -30,9 +30,9 @@ # #------------------------------------------------------------------------------ usage() { + exec 1>&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat< ... * find all .dep files referring to any of ... diff --git a/bin/foamPackBin b/bin/foamPackBin index 3ee4641383..1aee24cadf 100755 --- a/bin/foamPackBin +++ b/bin/foamPackBin @@ -46,7 +46,7 @@ case "${0##*/}" in ;; *) # regular - codeBase="OpenFOAM ThirdParty" + codeBase="OpenFOAM" packDir=$WM_PROJECT-$WM_PROJECT_VERSION listBinDirs=$toolsDir/foamListBinDirs ;; diff --git a/bin/foamPackDeps b/bin/foamPackDeps index 1de69167df..d0c6552122 100755 --- a/bin/foamPackDeps +++ b/bin/foamPackDeps @@ -45,7 +45,7 @@ case "${0##*/}" in ;; *) # regular - codeBase="OpenFOAM ThirdParty" + codeBase="OpenFOAM" packDir=$WM_PROJECT-$WM_PROJECT_VERSION ;; esac diff --git a/bin/foamPackMake b/bin/foamPackMake index f930e633c7..08d2b69504 100755 --- a/bin/foamPackMake +++ b/bin/foamPackMake @@ -45,7 +45,7 @@ case "${0##*/}" in ;; *) # regular - codeBase="OpenFOAM ThirdParty" + codeBase="OpenFOAM" packDir=$WM_PROJECT-$WM_PROJECT_VERSION ;; esac From f691fe7896aff38a6160f3a885fe005d357fd329 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 15 Feb 2011 16:48:26 +0100 Subject: [PATCH 15/24] STYLE: more consistent use of stderr for script usage --- bin/engridFoam | 3 ++- bin/foamClearPolyMesh | 7 ++++--- bin/foamCopySettings | 7 ++++--- bin/foamEndJob | 3 ++- bin/foamExec | 1 + bin/foamJob | 3 ++- bin/foamLog | 3 ++- bin/foamNew | 3 ++- bin/foamNewCase | 3 ++- bin/foamPack | 5 +++-- bin/foamPackBin | 5 +++-- bin/foamPackDeps | 5 +++-- bin/foamPackDoxygen | 5 +++-- bin/foamPackMake | 5 +++-- bin/foamPackThirdParty | 5 +++-- bin/foamUpdateCaseFileHeader | 3 ++- bin/paraFoam | 3 ++- bin/rmdepall | 5 +++-- bin/rmdepold | 5 +++-- bin/tools/foamConfigurePaths | 3 ++- bin/tools/org-batch | 5 +++-- bin/touchdep | 1 + bin/toucho | 1 + 23 files changed, 56 insertions(+), 33 deletions(-) diff --git a/bin/engridFoam b/bin/engridFoam index 076f34ddee..6384c365e2 100755 --- a/bin/engridFoam +++ b/bin/engridFoam @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------- # License @@ -30,6 +30,7 @@ # #------------------------------------------------------------------------------ usage() { + exec 1>&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat<&2; shift; done - cat <&2 + exec 1>&2 + while [ "$#" -ge 1 ]; do echo "$1"; shift; done + cat <&2; shift; done - cat <&2 + exec 1>&2 + while [ "$#" -ge 1 ]; do echo "$1"; shift; done + cat <&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat< diff --git a/bin/foamExec b/bin/foamExec index 47a2428ccd..26ad311349 100755 --- a/bin/foamExec +++ b/bin/foamExec @@ -39,6 +39,7 @@ # foamEtcFile #------------------------------------------------------------------------------ usage() { + exec 1>&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat<&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat<&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat <&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat< {args} diff --git a/bin/foamNewCase b/bin/foamNewCase index 52cd516bb6..fda86b4bdd 100755 --- a/bin/foamNewCase +++ b/bin/foamNewCase @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------- # License @@ -37,6 +37,7 @@ templateDir="appTemplates" #------------------------------------------------------------------------------ usage() { + exec 1>&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat<&2; shift; done -cat <&2 + exec 1>&2 + while [ "$#" -gt 0 ]; do echo "$1"; shift; done +cat < specify alternative output directory diff --git a/bin/foamPackBin b/bin/foamPackBin index 1aee24cadf..36614ab781 100755 --- a/bin/foamPackBin +++ b/bin/foamPackBin @@ -54,8 +54,9 @@ esac usage() { - while [ $# -gt 0 ]; do echo "$1" 1>&2; shift; done -cat <&2 + exec 1>&2 + while [ "$#" -gt 0 ]; do echo "$1"; shift; done +cat < ${0##*/} [OPTION] -current options: diff --git a/bin/foamPackDeps b/bin/foamPackDeps index d0c6552122..ab663a04c4 100755 --- a/bin/foamPackDeps +++ b/bin/foamPackDeps @@ -52,8 +52,9 @@ esac usage() { - while [ $# -gt 0 ]; do echo "$1" 1>&2; shift; done -cat <&2 + exec 1>&2 + while [ "$#" -gt 0 ]; do echo "$1"; shift; done +cat <&2; shift; done -cat <&2 + exec 1>&2 + while [ "$#" -gt 0 ]; do echo "$1"; shift; done +cat <&2; shift; done -cat <&2 + exec 1>&2 + while [ "$#" -gt 0 ]; do echo "$1"; shift; done +cat < ${0##*/} [OPTION] -current options: diff --git a/bin/foamPackThirdParty b/bin/foamPackThirdParty index 37625b42cd..bb7c0f6d78 100755 --- a/bin/foamPackThirdParty +++ b/bin/foamPackThirdParty @@ -33,8 +33,9 @@ packDir=ThirdParty-$WM_PROJECT_VERSION toolsDir="${0%/*}/tools" # this script is located in the tools/ parent dir usage() { - while [ $# -gt 0 ]; do echo "$1" 1>&2; shift; done -cat <&2 + exec 1>&2 + while [ "$#" -gt 0 ]; do echo "$1"; shift; done +cat < specify alternative output directory diff --git a/bin/foamUpdateCaseFileHeader b/bin/foamUpdateCaseFileHeader index 92d856f749..afc32cf151 100755 --- a/bin/foamUpdateCaseFileHeader +++ b/bin/foamUpdateCaseFileHeader @@ -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 @@ -33,6 +33,7 @@ # #------------------------------------------------------------------------------ usage() { + exec 1>&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat<&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat< #------------------------------------------------------------------------------ usage() { + exec 1>&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done - cat<&2 + cat< diff --git a/bin/rmdepold b/bin/rmdepold index 01197eb04f..bb83bbd9b6 100755 --- a/bin/rmdepold +++ b/bin/rmdepold @@ -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 @@ -34,8 +34,9 @@ # - optionally remove empty directories #------------------------------------------------------------------------------ usage() { + exec 1>&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done - cat<&2 + cat<&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat<&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat<&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat<&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat< Date: Tue, 15 Feb 2011 17:09:51 +0100 Subject: [PATCH 16/24] STYLE: minor cleanup in wmakePrintBuild --- wmake/wmakePrintBuild | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/wmake/wmakePrintBuild b/wmake/wmakePrintBuild index 71ff327fe3..5461601d4f 100755 --- a/wmake/wmakePrintBuild +++ b/wmake/wmakePrintBuild @@ -29,6 +29,9 @@ # Print the version used when building the project # #------------------------------------------------------------------------------ +# persistent build tag +build="$WM_PROJECT_DIR/.build" + usage() { exec 1>&2 @@ -41,6 +44,7 @@ options: -major report \$WM_PROJECT_VERSION only and exit -update update \$WM_PROJECT_DIR/.build from the git information -pkg TAG specify packager/release tag ('none' marks an empty packager) + -short report short version information (ie, without pkg tag) -version VER specify an alternative version Print the version used when building the project, in this order of precedence: @@ -53,7 +57,7 @@ USAGE } #------------------------------------------------------------------------------ -unset checkOnly update package version oldPackage oldVersion +unset checkOnly update package version shortOpt # parse options while [ "$#" -gt 0 ] @@ -80,6 +84,10 @@ do package=$(echo "${2:-none}" | sed -e 's/!//g') shift 2 ;; + -short) + shortOpt=true + shift + ;; -v | -version) [ "$#" -ge 2 ] || usage "'$1' option requires an argument" version="$2" @@ -93,17 +101,11 @@ done #------------------------------------------------------------------------------ -# -# persistent build tag -# -build="$WM_PROJECT_DIR/.build" - -unset oldVersion oldPackage - # # retrieve old values from the $WM_PROJECT_DIR/.build cache, stored as # version [packager] # +unset oldPackage oldVersion getOldValues() { set -- $(tail -1 $build 2>/dev/null) @@ -157,6 +159,11 @@ fi # retrieve old values getOldValues +if [ "$shortOpt" = true ] +then + unset package oldPackage +fi + # # update persistent build tag if possible # @@ -171,6 +178,14 @@ then fi fi +# cat<< DEBUG 1>&2 +# Debug information +# version='$version' +# package='$package' +# oldVersion='$oldVersion' +# oldPackage='$oldPackage' +# DEBUG + # check git vs. persistent build tag if [ -n "$checkOnly" ] From 28e63891739effb586a30b2f00303ad8418cfb69 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 15 Feb 2011 17:24:39 +0100 Subject: [PATCH 17/24] STYLE: accept and silently ignore -current option in foamPackDeps - may be useful in the future. For now it keeps consistency with foamPackMake, foamPackBins --- bin/foamPackDeps | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/foamPackDeps b/bin/foamPackDeps index ab663a04c4..0f4d040fff 100755 --- a/bin/foamPackDeps +++ b/bin/foamPackDeps @@ -58,6 +58,7 @@ cat < specify alternative output directory * Pack and compress *.dep files from $codeBase @@ -67,7 +68,7 @@ USAGE } -unset outputDir +unset archOptions outputDir packExt=tgz # parse options @@ -81,6 +82,10 @@ do packExt=tbz shift ;; + -c | -current) # use $WM_OPTIONS - eg, 'linux64GccDPOpt' + archOptions="$WM_OPTIONS" + shift + ;; -o | -output) [ "$#" -ge 2 ] || usage "'$1' option requires an argument" outputDir=${2%%/} From b9f772609510a182a9a93e68ea4df81a9679ac65 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 15 Feb 2011 18:51:23 +0100 Subject: [PATCH 18/24] ENH: fix wcleanAll, wcleanMachine to work with new platforms/ layout --- wmake/wcleanAll | 45 ++++++++++++++++++++++++++++----------------- wmake/wcleanMachine | 30 +++++++++++++++++++----------- 2 files changed, 47 insertions(+), 28 deletions(-) diff --git a/wmake/wcleanAll b/wmake/wcleanAll index 70ed739503..641cc84fca 100755 --- a/wmake/wcleanAll +++ b/wmake/wcleanAll @@ -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 @@ -30,33 +30,44 @@ # directories of all machines and delete them. # #------------------------------------------------------------------------------ -if [ "$1" = "-h" -o "$1" = "-help" ] -then - echo "Usage: ${0##*/}" - echo - echo " Remove all object files and *.dep files" - exit 1 -fi +usage() { + exec 1>&2 + while [ "$#" -ge 1 ]; do echo "$1"; shift; done + cat<&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat< Date: Tue, 15 Feb 2011 18:58:58 +0100 Subject: [PATCH 19/24] GIT-HOOK: push-hook false positive --- src/finiteVolume/cfdTools/general/adjustPhi/adjustPhi.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/finiteVolume/cfdTools/general/adjustPhi/adjustPhi.C b/src/finiteVolume/cfdTools/general/adjustPhi/adjustPhi.C index 93a23c94cb..e497c361b2 100644 --- a/src/finiteVolume/cfdTools/general/adjustPhi/adjustPhi.C +++ b/src/finiteVolume/cfdTools/general/adjustPhi/adjustPhi.C @@ -2,7 +2,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 From fc2bd193560c08f41f905c24b12844051dd40ce4 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 15 Feb 2011 19:01:04 +0100 Subject: [PATCH 20/24] STYLE: use 'platforms/' for organizing wmake binaries as well - replaces previously used 'bin/' STYLE: add -help to makeWmake --- bin/tools/foamListBinDirs | 69 ++++++++++------------------- bin/tools/foamListSourceFiles | 5 +-- bin/tools/foamListThirdPartyBinDirs | 20 ++++++--- wmake/Makefile | 2 +- wmake/makeWmake | 37 +++++++++++++--- wmake/rules/General/sourceToDep | 2 +- wmake/scripts/makeFiles | 4 +- wmake/src/Makefile | 26 +++++------ wmake/wmake | 3 +- 9 files changed, 90 insertions(+), 78 deletions(-) diff --git a/bin/tools/foamListBinDirs b/bin/tools/foamListBinDirs index 336bd91cde..da2f4d4a37 100755 --- a/bin/tools/foamListBinDirs +++ b/bin/tools/foamListBinDirs @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------- # License @@ -23,7 +23,7 @@ # along with OpenFOAM. If not, see . # # Script -# foamListBinDirs +# foamListBinDirs [archOptions] # # Description # Lists directories containing binary files of OpenFOAM @@ -33,9 +33,9 @@ #------------------------------------------------------------------------------ toolsDir="${0%/*}" # this script is already located in the tools/ directory -[ $# -eq 2 ] || { +[ $# -eq 1 -o $# -eq 2 ] || { cat <&2 -Usage : ${0##*/} +Usage : ${0##*/} [archOptions] * Lists directories containing binary files for OpenFOAM @@ -49,8 +49,13 @@ USAGE #------------------------------------------------------------------------------ packDir="$1" -# same as $WM_OPTIONS - eg, 'linux64GccDPOpt' -archOptions="$2" +# default to same as $WM_OPTIONS - eg, 'linux64GccDPOpt' +archOptions="${2:-$WM_OPTIONS}" + +[ -n "$archOptions" ] || { + echo "Error: no archOptions specified" 1>&2 + exit 1 +} # base arch (w/o precision, optimization, etc) # same as "$WM_ARCH$WM_COMPILER" @@ -65,42 +70,18 @@ arch3264=$(echo "$archOS" | sed -e 's@64@-64@') #------------------------------------------------------------------------------ - # check for essential directories -[ -d $packDir ] || { - echo "Error: directory $packDir does not exist" 1>&2 - exit 1 -} - - -# -# check places for libraries - same as $FOAM_LIBBIN -# this has moved around a bit in the recent past -# -[ -d $packDir/lib/$archOptions ] || \ -[ -d $packDir/platforms/$archOptions/lib ] || { -cat <&2 -Error: no directory for libraries exists: - $packDir/lib/$archOptions - $packDir/platforms/$archOptions/lib -LIB_CHECK - exit 1 -} - -# -# check places for executables - same as $FOAM_APPBIN -# this has moved around a bit in the recent past -# -[ -d $packDir/applications/bin/$archOptions ] || \ -[ -d $packDir/platforms/$archOptions/bin ] || { -cat <&2 -Error: no directory for executables exists: - $packDir/platforms/$archOptions/bin - $packDir/applications/bin/$archOptions -BIN_CHECK - exit 1 -} - +for dir in \ + $packDir \ + $packDir/platforms/$archOptions/bin \ + $packDir/platforms/$archOptions/lib \ + ; +do + [ -d $dir ] || { + echo "Error: directory $dir does not exist" 1>&2 + exit 1 + } +done #------------------------------------------------------------------------------ # list of directories @@ -108,13 +89,11 @@ dirList=$( for dir in \ $packDir/platforms/$archOptions/bin \ $packDir/platforms/$archOptions/lib \ - $packDir/wmake/bin/$archCompiler \ - $packDir/wmake/bin/$archOS \ + $packDir/wmake/platforms/$archCompiler \ + $packDir/wmake/platforms/$archOS \ $packDir/wmake/rules/General \ $packDir/wmake/rules/$archCompiler \ $packDir/wmake/rules/$archOS \ - $packDir/applications/bin/$archOptions \ - $packDir/lib/$archOptions \ ; do [ -d $dir ] && echo $dir diff --git a/bin/tools/foamListSourceFiles b/bin/tools/foamListSourceFiles index 2deedeac8c..ef6c166e4c 100755 --- a/bin/tools/foamListSourceFiles +++ b/bin/tools/foamListSourceFiles @@ -46,7 +46,7 @@ USAGE packDir=$(echo "$1" | sed -e 's@//*@/@g' -e 's@/$@@') # check for essential directories -[ -d $packDir ] || { +[ -d "$packDir" ] || { echo "Error: directory $packDir does not exist" 1>&2 exit 1 } @@ -77,12 +77,9 @@ find -H $packDir \ -a ! -name "core.[1-9]*" \ -a ! -name "libccmio*" \ | sed \ - -e "\@$packDir/lib/@d" \ -e '\@/\.git/@d' \ -e '\@/\.tags/@d' \ -e '\@/README\.org@d' \ - -e '\@/bin/[^/]*/@{ \@/bin/tools/@!d }' \ - -e '\@/lib/@d' \ -e '\@/platforms/@d' \ -e '\@/t/@d' \ -e '\@/Make[.A-Za-z]*/[^/]*/@d' \ diff --git a/bin/tools/foamListThirdPartyBinDirs b/bin/tools/foamListThirdPartyBinDirs index 872049628e..c97fefede7 100755 --- a/bin/tools/foamListThirdPartyBinDirs +++ b/bin/tools/foamListThirdPartyBinDirs @@ -23,7 +23,7 @@ # along with OpenFOAM. If not, see . # # Script -# foamListThirdPartyBinDirs +# foamListThirdPartyBinDirs [archOptions] # # Description # Lists directories containing binary files for OpenFOAM ThirdParty @@ -33,9 +33,9 @@ #------------------------------------------------------------------------------ toolsDir="${0%/*}" # this script is already located in the tools/ directory -[ $# -eq 2 ] || { +[ $# -eq 1 -o $# -eq 2 ] || { cat <&2 -Usage : ${0##*/} +Usage : ${0##*/} [archOptions] * List directories containing binary files for OpenFOAM ThirdParty @@ -49,8 +49,13 @@ USAGE #------------------------------------------------------------------------------ packDir="$1" -# same as $WM_OPTIONS - eg, 'linux64GccDPOpt' -archOptions="$2" +# default to same as $WM_OPTIONS - eg, 'linux64GccDPOpt' +archOptions="${2:-$WM_OPTIONS}" + +[ -n "$archOptions" ] || { + echo "Error: no archOptions specified" 1>&2 + exit 1 +} # base arch (w/o precision, optimization, etc) # same as "$WM_ARCH$WM_COMPILER" @@ -66,7 +71,10 @@ arch3264=$(echo "$archOS" | sed -e 's@64@-64@') #------------------------------------------------------------------------------ # check for essential directories -for dir in $packDir $packDir/platforms/$archOptions/lib +for dir in \ + $packDir \ + $packDir/platforms/$archOptions/lib \ + ; do [ -d $dir ] || { echo "Error: directory $dir does not exist" 1>&2 diff --git a/wmake/Makefile b/wmake/Makefile index 72fd3ed087..168710ce19 100644 --- a/wmake/Makefile +++ b/wmake/Makefile @@ -106,7 +106,7 @@ SEXE = a.out GENERAL_RULES = $(WM_DIR)/rules/General RULES = $(WM_DIR)/rules/$(WM_ARCH)$(WM_COMPILER) -BIN = $(WM_DIR)/bin/$(WM_ARCH)$(WM_COMPILER) +WMAKE_BIN = $(WM_DIR)/platforms/$(WM_ARCH)$(WM_COMPILER) include $(GENERAL_RULES)/general include $(RULES)/general diff --git a/wmake/makeWmake b/wmake/makeWmake index bd2a7cae19..3185c80909 100755 --- a/wmake/makeWmake +++ b/wmake/makeWmake @@ -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 @@ -26,13 +26,40 @@ # makeWmake # # Description -# Script to build all the system-specific parts of wmake +# Build platform-specific parts of wmake # #------------------------------------------------------------------------------ +usage() { + exec 1>&2 + while [ "$#" -ge 1 ]; do echo "$1"; shift; done + cat</dev/null + rm -f $(WMAKE_BIN)/* 2>/dev/null -$(BIN)/dirToString: dirToString.c - @mkdir -p $(BIN) - $(cc) $(cFLAGS) dirToString.c -o $(BIN)/dirToString +$(WMAKE_BIN)/dirToString: dirToString.c + @mkdir -p $(WMAKE_BIN) + $(cc) $(cFLAGS) dirToString.c -o $(WMAKE_BIN)/dirToString -$(BIN)/wmkdep: wmkdep.l - @mkdir -p $(BIN) +$(WMAKE_BIN)/wmkdep: wmkdep.l + @mkdir -p $(WMAKE_BIN) flex wmkdep.l - $(cc) $(cFLAGS) lex.yy.c -o $(BIN)/wmkdep + $(cc) $(cFLAGS) lex.yy.c -o $(WMAKE_BIN)/wmkdep @rm -f lex.yy.c 2>/dev/null # for bootstrapping - use generated files directly (instead of from .atg file) -$(BIN)/wmkdepend: wmkdepend.cpp \ +$(WMAKE_BIN)/wmkdepend: wmkdepend.cpp \ wmkdependParser.cpp wmkdependScanner.cpp \ wmkdependParser.h wmkdependScanner.h - @mkdir -p $(BIN) + @mkdir -p $(WMAKE_BIN) $(CC) $(c++FLAGS) \ wmkdepend.cpp wmkdependParser.cpp wmkdependScanner.cpp \ - -o $(BIN)/wmkdepend + -o $(WMAKE_BIN)/wmkdepend #------------------------------------------------------------------------------ diff --git a/wmake/wmake b/wmake/wmake index 54ee5696e8..37a17eca79 100755 --- a/wmake/wmake +++ b/wmake/wmake @@ -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 @@ -32,6 +32,7 @@ Script=${0##*/} usage() { + exec 1>&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat< Date: Wed, 16 Feb 2011 09:57:03 +0100 Subject: [PATCH 21/24] GIT: skip tab check on Makefiles (not just wmake/Makefiles) --- bin/tools/pre-commit-hook | 2 +- bin/tools/pre-receive-hook | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/tools/pre-commit-hook b/bin/tools/pre-commit-hook index d44edba275..44518f0837 100755 --- a/bin/tools/pre-commit-hook +++ b/bin/tools/pre-commit-hook @@ -148,7 +148,7 @@ checkIllegalCode() do case "$f" in # exclude potential makefiles - (wmake/[Mm]akefile* | wmake/rules/*) + (*[Mm]akefile* | wmake/rules/*) ;; (*) # parse line numbers from grep output: diff --git a/bin/tools/pre-receive-hook b/bin/tools/pre-receive-hook index cf4dcb42be..641185cf13 100755 --- a/bin/tools/pre-receive-hook +++ b/bin/tools/pre-receive-hook @@ -111,7 +111,7 @@ checkIllegalCode() do case "$f" in # exclude potential makefiles - (wmake/[Mm]akefile* | wmake/rules/*) + (*[Mm]akefile* | wmake/rules/*) ;; (*) # parse line numbers from grep output: From 906f1f36dece14fc96d2ff9f95f5bf4e0552cf62 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 16 Feb 2011 11:12:26 +0000 Subject: [PATCH 22/24] BUG: build distributionModels earlier in build order --- src/Allwmake | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Allwmake b/src/Allwmake index 00bbf8e5e6..128d4a9845 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -39,6 +39,7 @@ parallel/decompose/AllwmakeLnInclude dummyThirdParty/Allwmake $* wmake $makeOption lagrangian/basic +wmake $makeOption lagrangian/distributionModels wmake $makeOption finiteVolume wmake $makeOption genericPatchFields From 30bad1a72a37770eaba49da8d82290a1b95ea4ed Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 16 Feb 2011 11:21:50 +0000 Subject: [PATCH 23/24] COMP: removed EulerianInterfacialModels lib - not built yet --- .../utilities/miscellaneous/foamDebugSwitches/Make/options | 1 - 1 file changed, 1 deletion(-) diff --git a/applications/utilities/miscellaneous/foamDebugSwitches/Make/options b/applications/utilities/miscellaneous/foamDebugSwitches/Make/options index 11303fd0e8..0dfd48454a 100644 --- a/applications/utilities/miscellaneous/foamDebugSwitches/Make/options +++ b/applications/utilities/miscellaneous/foamDebugSwitches/Make/options @@ -21,7 +21,6 @@ EXE_LIBS = \ -ledgeMesh \ -lengine \ -lerrorEstimation \ - -lEulerianInterfacialModels \ -lextrudeModel \ -lfieldFunctionObjects \ -lfileFormats \ From ddffdd5627686d5966a5732a4ba497c34150a54d Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 16 Feb 2011 11:32:49 +0000 Subject: [PATCH 24/24] COMP: Added OSspecifc/WM_OSTYPE include to PV3 reader CmakeLists --- .../PV3Readers/PV3FoamReader/PV3FoamReader/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/CMakeLists.txt b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/CMakeLists.txt index 93dc9f702e..701b09d359 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/CMakeLists.txt +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/CMakeLists.txt @@ -18,6 +18,7 @@ LINK_DIRECTORIES( ) INCLUDE_DIRECTORIES( + $ENV{WM_PROJECT_DIR}/src/OSspecific/$ENV{WM_OSTYPE} $ENV{WM_PROJECT_DIR}/src/OpenFOAM/lnInclude $ENV{WM_PROJECT_DIR}/src/finiteVolume/lnInclude ${PROJECT_SOURCE_DIR}/../vtkPV3Foam