From d5efa1cc8aeae61ce3b78ffbe02ec156cba7064d Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 6 Jul 2010 17:47:12 +0200 Subject: [PATCH 01/14] STYLE: consistent naming of files containing the 'New' method - as per commit 937e0d23d02657c05879136aefb3b421ab2aa69f --- .../atomizationModel/newAtomizationModel.C | 74 ------------------- .../CollisionModel/CollisionModel.C | 2 +- .../CollisionModel/CollisionModel.H | 2 +- ...ewCollisionModel.C => CollisionModelNew.C} | 0 .../PairModel/PairModel/PairModel.C | 2 +- .../PairModel/PairModel/PairModel.H | 2 +- .../{NewPairModel.C => PairModelNew.C} | 0 .../WallModel/WallModel/WallModel.C | 2 +- .../WallModel/WallModel/WallModel.H | 2 +- .../{NewWallModel.C => WallModelNew.C} | 0 .../basicSolidThermo/Make/files | 2 +- ...sicSolidThermo.C => basicSolidThermoNew.C} | 0 12 files changed, 7 insertions(+), 81 deletions(-) delete mode 100644 src/lagrangian/dieselSpray/spraySubModels/atomizationModel/atomizationModel/newAtomizationModel.C rename src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/CollisionModel/{NewCollisionModel.C => CollisionModelNew.C} (100%) rename src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairModel/PairModel/{NewPairModel.C => PairModelNew.C} (100%) rename src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallModel/WallModel/{NewWallModel.C => WallModelNew.C} (100%) rename src/thermophysicalModels/basicSolidThermo/basicSolidThermo/{newBasicSolidThermo.C => basicSolidThermoNew.C} (100%) diff --git a/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/atomizationModel/newAtomizationModel.C b/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/atomizationModel/newAtomizationModel.C deleted file mode 100644 index 5304ea008d..0000000000 --- a/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/atomizationModel/newAtomizationModel.C +++ /dev/null @@ -1,74 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 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 "error.H" -#include "atomizationModel.H" -#include "LISA.H" -#include "noAtomization.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -autoPtr atomizationModel::New -( - const dictionary& dict, - spray& sm -) -{ - word atomizationModelType - ( - dict.lookup("atomizationModel") - ); - - Info<< "Selecting atomizationModel " - << atomizationModelType << endl; - - dictionaryConstructorTable::iterator cstrIter = - dictionaryConstructorTablePtr_->find(atomizationModelType); - - if (cstrIter == dictionaryConstructorTablePtr_->end()) - { - FatalError - << "atomizationModel::New(const dictionary&, const spray&) : " << endl - << " unknown atomizationModelType type " - << atomizationModelType - << ", constructor not in hash table" << endl << endl - << " Valid atomizationModel types are :" << endl; - Info<< dictionaryConstructorTablePtr_->sortedToc() << abort(FatalError); - } - - return autoPtr(cstrIter()(dict, sm)); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/CollisionModel/CollisionModel.C b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/CollisionModel/CollisionModel.C index 47db7f93da..5f22f04750 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/CollisionModel/CollisionModel.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/CollisionModel/CollisionModel.C @@ -59,6 +59,6 @@ Foam::CollisionModel::~CollisionModel() // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#include "NewCollisionModel.C" +#include "CollisionModelNew.C" // ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/CollisionModel/CollisionModel.H b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/CollisionModel/CollisionModel.H index cbce0ee43a..fc6f9a4886 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/CollisionModel/CollisionModel.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/CollisionModel/CollisionModel.H @@ -29,7 +29,7 @@ Description SourceFiles CollisionModel.C - NewCollisionModel.C + CollisionModelNew.C \*---------------------------------------------------------------------------*/ diff --git a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/CollisionModel/NewCollisionModel.C b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/CollisionModel/CollisionModelNew.C similarity index 100% rename from src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/CollisionModel/NewCollisionModel.C rename to src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/CollisionModel/CollisionModelNew.C diff --git a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairModel/PairModel/PairModel.C b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairModel/PairModel/PairModel.C index 79adb906c1..cbd869d822 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairModel/PairModel/PairModel.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairModel/PairModel/PairModel.C @@ -75,6 +75,6 @@ Foam::PairModel::coeffDict() const // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#include "NewPairModel.C" +#include "PairModelNew.C" // ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairModel/PairModel/PairModel.H b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairModel/PairModel/PairModel.H index b5b36fdb68..bbfb8f4aec 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairModel/PairModel/PairModel.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairModel/PairModel/PairModel.H @@ -29,7 +29,7 @@ Description SourceFiles PairModel.C - NewPairModel.C + PairModelNew.C \*---------------------------------------------------------------------------*/ diff --git a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairModel/PairModel/NewPairModel.C b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairModel/PairModel/PairModelNew.C similarity index 100% rename from src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairModel/PairModel/NewPairModel.C rename to src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairModel/PairModel/PairModelNew.C diff --git a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallModel/WallModel/WallModel.C b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallModel/WallModel/WallModel.C index d25cc29c6a..a26f9b1e11 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallModel/WallModel/WallModel.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallModel/WallModel/WallModel.C @@ -83,6 +83,6 @@ Foam::WallModel::coeffDict() const // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#include "NewWallModel.C" +#include "WallModelNew.C" // ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallModel/WallModel/WallModel.H b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallModel/WallModel/WallModel.H index 392825f829..3d6a6cfcf1 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallModel/WallModel/WallModel.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallModel/WallModel/WallModel.H @@ -29,7 +29,7 @@ Description SourceFiles WallModel.C - NewWallModel.C + WallModelNew.C \*---------------------------------------------------------------------------*/ diff --git a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallModel/WallModel/NewWallModel.C b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallModel/WallModel/WallModelNew.C similarity index 100% rename from src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallModel/WallModel/NewWallModel.C rename to src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/WallModel/WallModel/WallModelNew.C diff --git a/src/thermophysicalModels/basicSolidThermo/Make/files b/src/thermophysicalModels/basicSolidThermo/Make/files index f7f64d01d2..e550ce2035 100644 --- a/src/thermophysicalModels/basicSolidThermo/Make/files +++ b/src/thermophysicalModels/basicSolidThermo/Make/files @@ -1,7 +1,7 @@ constSolidThermo/constSolidThermo.C directionalSolidThermo/directionalSolidThermo.C basicSolidThermo/basicSolidThermo.C -basicSolidThermo/newBasicSolidThermo.C +basicSolidThermo/basicSolidThermoNew.C interpolatedSolidThermo/interpolatedSolidThermo.C LIB = $(FOAM_LIBBIN)/libbasicSolidThermo diff --git a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/newBasicSolidThermo.C b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermoNew.C similarity index 100% rename from src/thermophysicalModels/basicSolidThermo/basicSolidThermo/newBasicSolidThermo.C rename to src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermoNew.C From 48696bdb45c5f9852cdbd35eeb8bcf4d8cef8447 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 12 Jul 2010 11:48:24 +0200 Subject: [PATCH 02/14] ENH: silently remove leading ~OpenFOAM/ in bin/foamEtcFile - makes it easier to cut-and-paste from dictionary contents that use the Foam::findEtcFile expansion --- bin/foamEtcFile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/foamEtcFile b/bin/foamEtcFile index 7cea635885..5bae566b55 100755 --- a/bin/foamEtcFile +++ b/bin/foamEtcFile @@ -195,9 +195,10 @@ done # done -# Save the essential bits of information: +# Save the essential bits of information +# silently remove leading ~OpenFOAM/ (used in Foam::findEtcFile) nArgs=$# -fileName="$1" +fileName="${1#~OpenFOAM/}" # Define the various places to be searched: unset dirList From 6a03ebdd24df7e1a4c257e599ab849902300935f Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 21 Jul 2010 10:19:03 +0200 Subject: [PATCH 03/14] ENH: support keyType for porousZones - allows a regex to collect several cellZones. For example, ( "cat1?(Back|Front)*" { coordinateSystem system_10; porosity 0.781; ... } ) --- .../cfdTools/general/porousMedia/porousZone.C | 61 ++++++++------ .../cfdTools/general/porousMedia/porousZone.H | 30 +++---- .../general/porousMedia/porousZoneTemplates.C | 67 ++++++++++------ .../thermalPorousZone/thermalPorousZone.C | 31 ++++---- .../thermalPorousZone/thermalPorousZone.H | 15 +--- .../thermalPorousZoneTemplates.C | 79 ------------------- .../thermalPorousZone/thermalPorousZones.C | 2 +- .../thermalPorousZone/thermalPorousZones.H | 10 ++- 8 files changed, 120 insertions(+), 175 deletions(-) delete mode 100644 src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZoneTemplates.C diff --git a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C b/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C index 745c66c58d..b7aef80850 100644 --- a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C +++ b/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,6 +27,7 @@ License #include "fvMesh.H" #include "fvMatrices.H" #include "geometricOneField.H" +#include "stringListOps.H" // * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // @@ -62,15 +63,15 @@ void Foam::porousZone::adjustNegativeResistance(dimensionedVector& resist) Foam::porousZone::porousZone ( - const word& name, + const keyType& key, const fvMesh& mesh, const dictionary& dict ) : - name_(name), + key_(key), mesh_(mesh), dict_(dict), - cellZoneID_(mesh_.cellZones().findZoneID(name)), + cellZoneIds_(0), coordSys_(dict, mesh), porosity_(1), intensity_(0), @@ -80,9 +81,27 @@ Foam::porousZone::porousZone D_("D", dimensionSet(0, -2, 0, 0, 0), tensor::zero), F_("F", dimensionSet(0, -1, 0, 0, 0), tensor::zero) { - Info<< "Creating porous zone: " << name_ << endl; + Info<< "Creating porous zone: " << key_ << endl; - bool foundZone = (cellZoneID_ != -1); + if (key_.isPattern()) + { + cellZoneIds_ = findStrings + ( + key_, + mesh_.cellZones().names() + ); + } + else + { + const label zoneId = mesh_.cellZones().findZoneID(key_); + if (zoneId != -1) + { + cellZoneIds_.setSize(1); + cellZoneIds_[0] = zoneId; + } + } + + bool foundZone = !cellZoneIds_.empty(); reduce(foundZone, orOp()); if (!foundZone && Pstream::master()) @@ -90,8 +109,8 @@ Foam::porousZone::porousZone FatalErrorIn ( "Foam::porousZone::porousZone" - "(const fvMesh&, const word&, const dictionary&)" - ) << "cannot find porous cellZone " << name_ + "(const keyType&, const fvMesh&, const dictionary&)" + ) << "cannot find porous cellZone " << key_ << exit(FatalError); } @@ -106,7 +125,7 @@ Foam::porousZone::porousZone FatalIOErrorIn ( "Foam::porousZone::porousZone" - "(const fvMesh&, const word&, const dictionary&)", + "(const keyType&, const fvMesh&, const dictionary&)", dict_ ) << "out-of-range porosity value " << porosity_ @@ -123,7 +142,7 @@ Foam::porousZone::porousZone FatalIOErrorIn ( "Foam::porousZone::porousZone" - "(const fvMesh&, const word&, const dictionary&)", + "(const keyType&, const fvMesh&, const dictionary&)", dict_ ) << "out-of-range turbulent intensity value " << intensity_ @@ -140,7 +159,7 @@ Foam::porousZone::porousZone FatalIOErrorIn ( "Foam::porousZone::porousZone" - "(const fvMesh&, const word&, const dictionary&)", + "(const keyType&, const fvMesh&, const dictionary&)", dict_ ) << "out-of-range turbulent length scale " << mixingLength_ @@ -169,7 +188,7 @@ Foam::porousZone::porousZone FatalIOErrorIn ( "Foam::porousZone::porousZone" - "(const fvMesh&, const word&, const dictionary&)", + "(const keyType&, const fvMesh&, const dictionary&)", dict_ ) << "incorrect dimensions for d: " << d.dimensions() << " should be " << D_.dimensions() @@ -192,7 +211,7 @@ Foam::porousZone::porousZone FatalIOErrorIn ( "Foam::porousZone::porousZone" - "(const fvMesh&, const word&, const dictionary&)", + "(const keyType&, const fvMesh&, const dictionary&)", dict_ ) << "incorrect dimensions for f: " << f.dimensions() << " should be " << F_.dimensions() @@ -220,7 +239,7 @@ Foam::porousZone::porousZone FatalIOErrorIn ( "Foam::porousZone::porousZone" - "(const fvMesh&, const word&, const dictionary&)", + "(const keyType&, const fvMesh&, const dictionary&)", dict_ ) << "neither powerLaw (C0/C1) " "nor Darcy-Forchheimer law (d/f) specified" @@ -239,7 +258,7 @@ Foam::porousZone::porousZone void Foam::porousZone::addResistance(fvVectorMatrix& UEqn) const { - if (cellZoneID_ == -1) + if (cellZoneIds_.empty()) { return; } @@ -250,7 +269,6 @@ void Foam::porousZone::addResistance(fvVectorMatrix& UEqn) const compressible = true; } - const labelList& cells = mesh_.cellZones()[cellZoneID_]; const scalarField& V = mesh_.V(); scalarField& Udiag = UEqn.diag(); vectorField& Usource = UEqn.source(); @@ -263,7 +281,6 @@ void Foam::porousZone::addResistance(fvVectorMatrix& UEqn) const addPowerLawResistance ( Udiag, - cells, V, mesh_.lookupObject("rho"), U @@ -274,7 +291,6 @@ void Foam::porousZone::addResistance(fvVectorMatrix& UEqn) const addPowerLawResistance ( Udiag, - cells, V, geometricOneField(), U @@ -293,7 +309,6 @@ void Foam::porousZone::addResistance(fvVectorMatrix& UEqn) const ( Udiag, Usource, - cells, V, mesh_.lookupObject("rho"), mesh_.lookupObject("mu"), @@ -306,7 +321,6 @@ void Foam::porousZone::addResistance(fvVectorMatrix& UEqn) const ( Udiag, Usource, - cells, V, geometricOneField(), mesh_.lookupObject("nu"), @@ -324,7 +338,7 @@ void Foam::porousZone::addResistance bool correctAUprocBC ) const { - if (cellZoneID_ == -1) + if (cellZoneIds_.empty()) { return; } @@ -335,7 +349,6 @@ void Foam::porousZone::addResistance compressible = true; } - const labelList& cells = mesh_.cellZones()[cellZoneID_]; const vectorField& U = UEqn.psi(); if (C0_ > VSMALL) @@ -345,7 +358,6 @@ void Foam::porousZone::addResistance addPowerLawResistance ( AU, - cells, mesh_.lookupObject("rho"), U ); @@ -355,7 +367,6 @@ void Foam::porousZone::addResistance addPowerLawResistance ( AU, - cells, geometricOneField(), U ); @@ -372,7 +383,6 @@ void Foam::porousZone::addResistance addViscousInertialResistance ( AU, - cells, mesh_.lookupObject("rho"), mesh_.lookupObject("mu"), U @@ -383,7 +393,6 @@ void Foam::porousZone::addResistance addViscousInertialResistance ( AU, - cells, geometricOneField(), mesh_.lookupObject("nu"), U diff --git a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.H b/src/finiteVolume/cfdTools/general/porousMedia/porousZone.H index 59a83a24a5..6bd909143c 100644 --- a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.H +++ b/src/finiteVolume/cfdTools/general/porousMedia/porousZone.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -110,8 +110,8 @@ class porousZone { // Private data - //- Name of this zone - word name_; + //- Name of this zone, or a regular expression + keyType key_; //- Reference to the finite volume mesh this zone is part of const fvMesh& mesh_; @@ -119,8 +119,8 @@ class porousZone //- Dictionary containing the parameters dictionary dict_; - //- Cell zone ID - label cellZoneID_; + //- Cell zone Ids + labelList cellZoneIds_; //- Coordinate system used for the zone (Cartesian) coordinateSystem coordSys_; @@ -159,7 +159,6 @@ class porousZone void addPowerLawResistance ( scalarField& Udiag, - const labelList& cells, const scalarField& V, const RhoFieldType& rho, const vectorField& U @@ -171,7 +170,6 @@ class porousZone ( scalarField& Udiag, vectorField& Usource, - const labelList& cells, const scalarField& V, const RhoFieldType& rho, const scalarField& mu, @@ -184,7 +182,6 @@ class porousZone void addPowerLawResistance ( tensorField& AU, - const labelList& cells, const RhoFieldType& rho, const vectorField& U ) const; @@ -194,7 +191,6 @@ class porousZone void addViscousInertialResistance ( tensorField& AU, - const labelList& cells, const RhoFieldType& rho, const scalarField& mu, const vectorField& U @@ -213,7 +209,7 @@ public: // Constructors //- Construct from components - porousZone(const word& name, const fvMesh&, const dictionary&); + porousZone(const keyType& key, const fvMesh&, const dictionary&); //- Return clone autoPtr clone() const @@ -237,10 +233,10 @@ public: autoPtr operator()(Istream& is) const { - word name(is); + keyType key(is); dictionary dict(is); - return autoPtr(new porousZone(name, mesh_, dict)); + return autoPtr(new porousZone(key, mesh_, dict)); } }; @@ -255,9 +251,9 @@ public: // Access //- cellZone name - const word& zoneName() const + const keyType& zoneName() const { - return name_; + return key_; } //- Return mesh @@ -266,10 +262,10 @@ public: return mesh_; } - //- cellZone number - label zoneId() const + //- cellZone numbers + const labelList& zoneIds() const { - return cellZoneID_; + return cellZoneIds_; } //- dictionary values used for the porousZone diff --git a/src/finiteVolume/cfdTools/general/porousMedia/porousZoneTemplates.C b/src/finiteVolume/cfdTools/general/porousMedia/porousZoneTemplates.C index 46a60ca782..4e72859f80 100644 --- a/src/finiteVolume/cfdTools/general/porousMedia/porousZoneTemplates.C +++ b/src/finiteVolume/cfdTools/general/porousMedia/porousZoneTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,12 +33,15 @@ void Foam::porousZone::modifyDdt(fvMatrix& m) const { if (porosity_ < 1) { - const labelList& cells = mesh_.cellZones()[cellZoneID_]; - - forAll(cells, i) + forAll(cellZoneIds_, zoneI) { - m.diag()[cells[i]] *= porosity_; - m.source()[cells[i]] *= porosity_; + const labelList& cells = mesh_.cellZones()[cellZoneIds_[zoneI]]; + + forAll(cells, i) + { + m.diag()[cells[i]] *= porosity_; + m.source()[cells[i]] *= porosity_; + } } } } @@ -48,7 +51,6 @@ template void Foam::porousZone::addPowerLawResistance ( scalarField& Udiag, - const labelList& cells, const scalarField& V, const RhoFieldType& rho, const vectorField& U @@ -57,10 +59,15 @@ void Foam::porousZone::addPowerLawResistance const scalar C0 = C0_; const scalar C1m1b2 = (C1_ - 1.0)/2.0; - forAll(cells, i) + forAll(cellZoneIds_, zoneI) { - Udiag[cells[i]] += + const labelList& cells = mesh_.cellZones()[cellZoneIds_[zoneI]]; + + forAll(cells, i) + { + Udiag[cells[i]] += V[cells[i]]*rho[cells[i]]*C0*pow(magSqr(U[cells[i]]), C1m1b2); + } } } @@ -70,7 +77,6 @@ void Foam::porousZone::addViscousInertialResistance ( scalarField& Udiag, vectorField& Usource, - const labelList& cells, const scalarField& V, const RhoFieldType& rho, const scalarField& mu, @@ -80,14 +86,21 @@ void Foam::porousZone::addViscousInertialResistance const tensor& D = D_.value(); const tensor& F = F_.value(); - forAll(cells, i) + forAll(cellZoneIds_, zoneI) { - tensor dragCoeff = mu[cells[i]]*D + (rho[cells[i]]*mag(U[cells[i]]))*F; - scalar isoDragCoeff = tr(dragCoeff); + const labelList& cells = mesh_.cellZones()[cellZoneIds_[zoneI]]; - Udiag[cells[i]] += V[cells[i]]*isoDragCoeff; - Usource[cells[i]] -= - V[cells[i]]*((dragCoeff - I*isoDragCoeff) & U[cells[i]]); + forAll(cells, i) + { + const tensor dragCoeff = mu[cells[i]]*D + + (rho[cells[i]]*mag(U[cells[i]]))*F; + + const scalar isoDragCoeff = tr(dragCoeff); + + Udiag[cells[i]] += V[cells[i]]*isoDragCoeff; + Usource[cells[i]] -= + V[cells[i]]*((dragCoeff - I*isoDragCoeff) & U[cells[i]]); + } } } @@ -96,7 +109,6 @@ template void Foam::porousZone::addPowerLawResistance ( tensorField& AU, - const labelList& cells, const RhoFieldType& rho, const vectorField& U ) const @@ -104,10 +116,15 @@ void Foam::porousZone::addPowerLawResistance const scalar C0 = C0_; const scalar C1m1b2 = (C1_ - 1.0)/2.0; - forAll(cells, i) + forAll(cellZoneIds_, zoneI) { - AU[cells[i]] = AU[cells[i]] - + I*(rho[cells[i]]*C0*pow(magSqr(U[cells[i]]), C1m1b2)); + const labelList& cells = mesh_.cellZones()[cellZoneIds_[zoneI]]; + + forAll(cells, i) + { + AU[cells[i]] = AU[cells[i]] + + I*(rho[cells[i]]*C0*pow(magSqr(U[cells[i]]), C1m1b2)); + } } } @@ -116,7 +133,6 @@ template void Foam::porousZone::addViscousInertialResistance ( tensorField& AU, - const labelList& cells, const RhoFieldType& rho, const scalarField& mu, const vectorField& U @@ -125,9 +141,14 @@ void Foam::porousZone::addViscousInertialResistance const tensor& D = D_.value(); const tensor& F = F_.value(); - forAll(cells, i) + forAll(cellZoneIds_, zoneI) { - AU[cells[i]] += mu[cells[i]]*D + (rho[cells[i]]*mag(U[cells[i]]))*F; + const labelList& cells = mesh_.cellZones()[cellZoneIds_[zoneI]]; + + forAll(cells, i) + { + AU[cells[i]] += mu[cells[i]]*D + (rho[cells[i]]*mag(U[cells[i]]))*F; + } } } diff --git a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.C b/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.C index 322260c643..df6a32d84b 100644 --- a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.C +++ b/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,12 +32,12 @@ License Foam::thermalPorousZone::thermalPorousZone ( - const word& name, + const keyType& key, const fvMesh& mesh, const dictionary& dict ) : - porousZone(name, mesh, dict), + porousZone(key, mesh, dict), T_("T", dimTemperature, -GREAT) { if (const dictionary* dictPtr = dict.subDictPtr("thermalModel")) @@ -53,11 +53,7 @@ Foam::thermalPorousZone::thermalPorousZone FatalIOErrorIn ( "thermalPorousZone::thermalPorousZone" - "(" - "const word& name, " - "const fvMesh& mesh, " - "const dictionary& dict" - ")", + "(const keyType&, const fvMesh&, const dictionary&)", *dictPtr ) << "thermalModel " << thermalModel << " is not supported" << nl << " Supported thermalModels are: fixedTemperature" @@ -76,23 +72,28 @@ void Foam::thermalPorousZone::addEnthalpySource fvScalarMatrix& hEqn ) const { - if (zoneId() == -1 || T_.value() < 0.0) + const labelList& zones = this->zoneIds(); + if (zones.empty() || T_.value() < 0.0) { return; } - const labelList& cells = mesh().cellZones()[zoneId()]; const scalarField& V = mesh().V(); scalarField& hDiag = hEqn.diag(); scalarField& hSource = hEqn.source(); - scalarField hZone = thermo.h(scalarField(cells.size(), T_.value()), cells); - scalar rate = 1e6; + // TODO: generalize for non-fixedTemperature methods + const scalar rate = 1e6; - forAll(cells, i) + forAll(zones, zoneI) { - hDiag[cells[i]] += rate*V[cells[i]]*rho[cells[i]]; - hSource[cells[i]] += rate*V[cells[i]]*rho[cells[i]]*hZone[i]; + const labelList& cells = mesh().cellZones()[zones[zoneI]]; + + forAll(cells, i) + { + hDiag[cells[i]] += rate*V[cells[i]]*rho[cells[i]]; + hSource[cells[i]] += rate*V[cells[i]]*rho[cells[i]]*T_.value(); + } } } diff --git a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.H b/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.H index f3cf5b3396..7278f4ec98 100644 --- a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.H +++ b/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,7 +33,6 @@ See Also SourceFiles thermalPorousZone.C - thermalPorousZoneTemplates.C \*---------------------------------------------------------------------------*/ @@ -76,7 +75,7 @@ public: // Constructors //- Construct from components - thermalPorousZone(const word& name, const fvMesh&, const dictionary&); + thermalPorousZone(const keyType& key, const fvMesh&, const dictionary&); //- Return clone autoPtr clone() const @@ -101,12 +100,12 @@ public: autoPtr operator()(Istream& is) const { - word name(is); + keyType key(is); dictionary dict(is); return autoPtr ( - new thermalPorousZone(name, mesh_, dict) + new thermalPorousZone(key, mesh_, dict) ); } }; @@ -149,12 +148,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#ifdef NoRepository -//# include "thermalPorousZoneTemplates.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - #endif // ************************************************************************* // diff --git a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZoneTemplates.C b/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZoneTemplates.C deleted file mode 100644 index 261abb18e9..0000000000 --- a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZoneTemplates.C +++ /dev/null @@ -1,79 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 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 "porousZone.H" -#include "fvMesh.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template -void Foam::porousZone::addPowerLawResistance -( - scalarField& Udiag, - const labelList& cells, - const scalarField& V, - const RhoFieldType& rho, - const vectorField& U -) const -{ - const scalar C0 = C0_; - const scalar C1m1b2 = (C1_ - 1.0)/2.0; - - forAll(cells, i) - { - Udiag[cells[i]] += - V[cells[i]]*rho[cells[i]]*C0*pow(magSqr(U[cells[i]]), C1m1b2); - } -} - - -template -void Foam::porousZone::addViscousInertialResistance -( - scalarField& Udiag, - vectorField& Usource, - const labelList& cells, - const scalarField& V, - const RhoFieldType& rho, - const scalarField& mu, - const vectorField& U -) const -{ - const tensor& D = D_.value(); - const tensor& F = F_.value(); - - forAll(cells, i) - { - tensor dragCoeff = mu[cells[i]]*D + (rho[cells[i]]*mag(U[cells[i]]))*F; - scalar isoDragCoeff = tr(dragCoeff); - - Udiag[cells[i]] += V[cells[i]]*isoDragCoeff; - Usource[cells[i]] -= - V[cells[i]]*((dragCoeff - I*isoDragCoeff) & U[cells[i]]); - } -} - - -// ************************************************************************* // diff --git a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZones.C b/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZones.C index a98b0e064c..c35bd5c0dd 100644 --- a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZones.C +++ b/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZones.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZones.H b/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZones.H index e696f2bb5b..5d72c6f90e 100644 --- a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZones.H +++ b/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZones.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -46,7 +46,11 @@ Description d d [0 -2 0 0 0] (-1000 -1000 0.50753e+08); f f [0 -1 0 0 0] (-1000 -1000 12.83); } - Temperature [0 0 1 0 0] 600; + thermalModel + { + type fixedTemperature; + T T [0 0 1 0 0] 600; + } } ) @endverbatim @@ -69,7 +73,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class thermalPorousZones Declaration + Class thermalPorousZones Declaration \*---------------------------------------------------------------------------*/ class thermalPorousZones From 82dec4824e3d560092777a83d43a3cae50f47c65 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 21 Jul 2010 11:11:42 +0200 Subject: [PATCH 04/14] ENH: support find via keyType for coordinateSystems - findAll() method returns a labelList of all matching names - find() method returns the index to the first matching name For example, use a regex to specify alternative coordinate systems in porousZones ( "cat1?(Back|Front)*" { coordinateSystem "(cat1|system_10)"; porosity 0.781; ... } ) --- .../coordinateSystems/coordinateSystem.C | 21 ++++---- .../coordinateSystems/coordinateSystem.H | 2 +- .../coordinateSystems/coordinateSystems.C | 52 ++++++++++++++++--- .../coordinateSystems/coordinateSystems.H | 13 +++-- 4 files changed, 64 insertions(+), 24 deletions(-) diff --git a/src/meshTools/coordinateSystems/coordinateSystem.C b/src/meshTools/coordinateSystems/coordinateSystem.C index 8e5fc7bceb..0a5fe400f7 100644 --- a/src/meshTools/coordinateSystems/coordinateSystem.C +++ b/src/meshTools/coordinateSystems/coordinateSystem.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -136,37 +136,36 @@ Foam::coordinateSystem::coordinateSystem { const entry* entryPtr = dict.lookupEntryPtr(typeName_(), false, false); - // a simple entry is a lookup into global coordinateSystems + // non-dictionary entry is a lookup into global coordinateSystems if (entryPtr && !entryPtr->isDict()) { - word csName; - entryPtr->stream() >> csName; + keyType key(entryPtr->stream()); - const coordinateSystems& csLst = coordinateSystems::New(obr); + const coordinateSystems& lst = coordinateSystems::New(obr); + const label id = lst.find(key); - label csId = csLst.find(csName); if (debug) { Info<< "coordinateSystem::coordinateSystem" "(const dictionary&, const objectRegistry&):" << nl << "using global coordinate system: " - << csName << "=" << csId << endl; + << key << "=" << id << endl; } - if (csId < 0) + if (id < 0) { FatalErrorIn ( "coordinateSystem::coordinateSystem" "(const dictionary&, const objectRegistry&)" - ) << "could not find coordinate system: " << csName << nl - << "available coordinate systems: " << csLst.toc() << nl << nl + ) << "could not find coordinate system: " << key << nl + << "available coordinate systems: " << lst.toc() << nl << nl << exit(FatalError); } // copy coordinateSystem, but assign the name as the typeName // to avoid strange things in writeDict() - operator=(csLst[csId]); + operator=(lst[id]); name_ = typeName_(); } else diff --git a/src/meshTools/coordinateSystems/coordinateSystem.H b/src/meshTools/coordinateSystems/coordinateSystem.H index e2a8f47aff..11a48d6eb7 100644 --- a/src/meshTools/coordinateSystems/coordinateSystem.H +++ b/src/meshTools/coordinateSystems/coordinateSystem.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/meshTools/coordinateSystems/coordinateSystems.C b/src/meshTools/coordinateSystems/coordinateSystems.C index 28632d0ae0..4d82900408 100644 --- a/src/meshTools/coordinateSystems/coordinateSystems.C +++ b/src/meshTools/coordinateSystems/coordinateSystems.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -26,6 +26,7 @@ License #include "coordinateSystems.H" #include "IOPtrList.H" #include "Time.H" +#include "stringListOps.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -97,13 +98,25 @@ const Foam::coordinateSystems& Foam::coordinateSystems::New // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -Foam::label Foam::coordinateSystems::find(const word& keyword) const +Foam::label Foam::coordinateSystems::find(const keyType& key) const { - forAll(*this, i) + if (key.isPattern()) { - if (keyword == operator[](i).name()) + labelList allFound = findAll(key); + // return first element + if (!allFound.empty()) { - return i; + return allFound[0]; + } + } + else + { + forAll(*this, i) + { + if (key == operator[](i).name()) + { + return i; + } } } @@ -111,9 +124,34 @@ Foam::label Foam::coordinateSystems::find(const word& keyword) const } -bool Foam::coordinateSystems::found(const word& keyword) const +Foam::labelList Foam::coordinateSystems::findAll(const keyType& key) const { - return find(keyword) >= 0; + labelList allFound; + if (key.isPattern()) + { + allFound = findStrings(key, toc()); + } + else + { + allFound.setSize(size()); + label nFound = 0; + forAll(*this, i) + { + if (key == operator[](i).name()) + { + allFound[nFound++] = i; + } + } + allFound.setSize(nFound); + } + + return allFound; +} + + +bool Foam::coordinateSystems::found(const keyType& key) const +{ + return find(key) >= 0; } diff --git a/src/meshTools/coordinateSystems/coordinateSystems.H b/src/meshTools/coordinateSystems/coordinateSystems.H index 60bd169ba0..2976a6f94e 100644 --- a/src/meshTools/coordinateSystems/coordinateSystems.H +++ b/src/meshTools/coordinateSystems/coordinateSystems.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -97,11 +97,14 @@ public: // Member Functions - //- Find and return index for a given keyword, returns -1 if not found - label find(const word& key) const; + //- Find and return index for the first match, returns -1 if not found + label find(const keyType& key) const; - //- Search for given keyword - bool found(const word& keyword) const; + //- Find and return indices for all matches + labelList findAll(const keyType& key) const; + + //- Search for given key + bool found(const keyType& key) const; //- Return the table of contents (list of all keywords) wordList toc() const; From 7faf359bc1d105e390dc00956c60af2fbb08ee65 Mon Sep 17 00:00:00 2001 From: graham Date: Wed, 21 Jul 2010 10:58:53 +0100 Subject: [PATCH 05/14] COMP: adding -traditional-cpp to CPP variable. --- wmake/rules/SiCortex64Gcc/general | 1 + wmake/rules/linux64Gcc/general | 2 ++ wmake/rules/linux64Gcc43/general | 2 ++ wmake/rules/linux64Gcc44/general | 2 ++ wmake/rules/linux64Gcc45/general | 1 - wmake/rules/linux64Icc/general | 2 ++ wmake/rules/linuxGcc/general | 1 + wmake/rules/linuxGcc43/general | 1 + wmake/rules/linuxGcc44/general | 1 + wmake/rules/linuxGcc45/general | 1 - wmake/rules/linuxIA64Gcc/general | 1 + wmake/rules/linuxIA64Icc/general | 2 +- wmake/rules/linuxIcc/general | 1 + wmake/rules/linuxPPC64Gcc/general | 1 + 14 files changed, 16 insertions(+), 3 deletions(-) diff --git a/wmake/rules/SiCortex64Gcc/general b/wmake/rules/SiCortex64Gcc/general index eb820ab36d..aeab411b5b 100644 --- a/wmake/rules/SiCortex64Gcc/general +++ b/wmake/rules/SiCortex64Gcc/general @@ -1,3 +1,4 @@ +CPP = cpp -traditional-cpp $(GFLAGS) LD = ld -A64 PROJECT_LIBS = -l$(WM_PROJECT) -liberty -ldl diff --git a/wmake/rules/linux64Gcc/general b/wmake/rules/linux64Gcc/general index e7faa0c0f2..809751cd0a 100644 --- a/wmake/rules/linux64Gcc/general +++ b/wmake/rules/linux64Gcc/general @@ -1,3 +1,5 @@ +CPP = cpp -traditional-cpp $(GFLAGS) + PROJECT_LIBS = -l$(WM_PROJECT) -liberty -ldl include $(GENERAL_RULES)/standard diff --git a/wmake/rules/linux64Gcc43/general b/wmake/rules/linux64Gcc43/general index e7faa0c0f2..809751cd0a 100644 --- a/wmake/rules/linux64Gcc43/general +++ b/wmake/rules/linux64Gcc43/general @@ -1,3 +1,5 @@ +CPP = cpp -traditional-cpp $(GFLAGS) + PROJECT_LIBS = -l$(WM_PROJECT) -liberty -ldl include $(GENERAL_RULES)/standard diff --git a/wmake/rules/linux64Gcc44/general b/wmake/rules/linux64Gcc44/general index e7faa0c0f2..809751cd0a 100644 --- a/wmake/rules/linux64Gcc44/general +++ b/wmake/rules/linux64Gcc44/general @@ -1,3 +1,5 @@ +CPP = cpp -traditional-cpp $(GFLAGS) + PROJECT_LIBS = -l$(WM_PROJECT) -liberty -ldl include $(GENERAL_RULES)/standard diff --git a/wmake/rules/linux64Gcc45/general b/wmake/rules/linux64Gcc45/general index f9bb2e6b1e..fcd79624e9 100644 --- a/wmake/rules/linux64Gcc45/general +++ b/wmake/rules/linux64Gcc45/general @@ -1,4 +1,3 @@ -# need single-line output from cpp CPP = cpp -traditional-cpp PROJECT_LIBS = -l$(WM_PROJECT) -liberty -ldl diff --git a/wmake/rules/linux64Icc/general b/wmake/rules/linux64Icc/general index e7faa0c0f2..4f411aec98 100644 --- a/wmake/rules/linux64Icc/general +++ b/wmake/rules/linux64Icc/general @@ -1,3 +1,5 @@ +CPP = /lib/cpp -traditional-cpp $(GFLAGS) + PROJECT_LIBS = -l$(WM_PROJECT) -liberty -ldl include $(GENERAL_RULES)/standard diff --git a/wmake/rules/linuxGcc/general b/wmake/rules/linuxGcc/general index ce84842fee..97ce8c940c 100644 --- a/wmake/rules/linuxGcc/general +++ b/wmake/rules/linuxGcc/general @@ -1,3 +1,4 @@ +CPP = cpp -traditional-cpp $(GFLAGS) LD = ld -melf_i386 PROJECT_LIBS = -l$(WM_PROJECT) -liberty -ldl diff --git a/wmake/rules/linuxGcc43/general b/wmake/rules/linuxGcc43/general index ce84842fee..97ce8c940c 100644 --- a/wmake/rules/linuxGcc43/general +++ b/wmake/rules/linuxGcc43/general @@ -1,3 +1,4 @@ +CPP = cpp -traditional-cpp $(GFLAGS) LD = ld -melf_i386 PROJECT_LIBS = -l$(WM_PROJECT) -liberty -ldl diff --git a/wmake/rules/linuxGcc44/general b/wmake/rules/linuxGcc44/general index ce84842fee..97ce8c940c 100644 --- a/wmake/rules/linuxGcc44/general +++ b/wmake/rules/linuxGcc44/general @@ -1,3 +1,4 @@ +CPP = cpp -traditional-cpp $(GFLAGS) LD = ld -melf_i386 PROJECT_LIBS = -l$(WM_PROJECT) -liberty -ldl diff --git a/wmake/rules/linuxGcc45/general b/wmake/rules/linuxGcc45/general index 91c54db85d..fdd03dc9a5 100644 --- a/wmake/rules/linuxGcc45/general +++ b/wmake/rules/linuxGcc45/general @@ -1,4 +1,3 @@ -# need single-line output from cpp CPP = cpp -traditional-cpp LD = ld -melf_i386 diff --git a/wmake/rules/linuxIA64Gcc/general b/wmake/rules/linuxIA64Gcc/general index 7285501d98..44c2e33667 100644 --- a/wmake/rules/linuxIA64Gcc/general +++ b/wmake/rules/linuxIA64Gcc/general @@ -1,3 +1,4 @@ +CPP = cpp -traditional-cpp $(GFLAGS) PROJECT_LIBS = -l$(WM_PROJECT) -liberty -ldl include $(GENERAL_RULES)/standard diff --git a/wmake/rules/linuxIA64Icc/general b/wmake/rules/linuxIA64Icc/general index 66953a9652..748cfe770d 100644 --- a/wmake/rules/linuxIA64Icc/general +++ b/wmake/rules/linuxIA64Icc/general @@ -1,4 +1,4 @@ -CPP = cpp -DICC_IA64_PREFETCH +CPP = /lib/cpp -traditional-cpp $(GFLAGS) -DICC_IA64_PREFETCH GLIBS = -liberty diff --git a/wmake/rules/linuxIcc/general b/wmake/rules/linuxIcc/general index ce84842fee..e4d0cb7d7b 100644 --- a/wmake/rules/linuxIcc/general +++ b/wmake/rules/linuxIcc/general @@ -1,3 +1,4 @@ +CPP = /lib/cpp -traditional-cpp $(GFLAGS) LD = ld -melf_i386 PROJECT_LIBS = -l$(WM_PROJECT) -liberty -ldl diff --git a/wmake/rules/linuxPPC64Gcc/general b/wmake/rules/linuxPPC64Gcc/general index 81927e682b..ad4126abe8 100644 --- a/wmake/rules/linuxPPC64Gcc/general +++ b/wmake/rules/linuxPPC64Gcc/general @@ -1,3 +1,4 @@ +CPP = cpp -traditional-cpp $(GFLAGS) LD = ld -m elf64ppc PROJECT_LIBS = -l$(WM_PROJECT) -liberty -ldl From b2d6ae091b466fdab005477c913c24a3d5ccc9d7 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 21 Jul 2010 12:58:43 +0200 Subject: [PATCH 06/14] ENH: made Andy's pre-receive hook into a pre-commit hook - allows fixes before trying to push --- bin/tools/pre-commit-hook | 183 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 183 insertions(+) create mode 100755 bin/tools/pre-commit-hook diff --git a/bin/tools/pre-commit-hook b/bin/tools/pre-commit-hook new file mode 100755 index 0000000000..5460f7b38d --- /dev/null +++ b/bin/tools/pre-commit-hook @@ -0,0 +1,183 @@ +#!/bin/bash +#---------------------------------*- sh -*------------------------------------- +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright (C) 2010-2010 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 +# pre-commit-hook +# +# Description +# pre-commit hook for git. +# Copy or link this file as ".git/hooks/pre-commit" +# +# Eg, +# ( +# cd $WM_PROJECT_DIR/.git/hooks && +# ln -sf ../../bin/tools/pre-commit-hook pre-commit +# ) +# +# Hook receives: empty +# +# Checks for +# - illegal code, e.g. +# - copyright is current, e.g. if present, contains XXX- +# - columns greater than 80 for *.[CH] files +# +# Note +# Using "git commit --no-verify" it is possible to override the hook. +# +#------------------------------------------------------------------------------ +die() +{ + echo 'pre-commit hook failure' 1>&2 + echo '-----------------------' 1>&2 + echo '' 1>&2 + echo "$@" 1>&2 + exit 1 +} + +#----------------------------------------------------------------------------- +# Check content that will be added by this commit. + +if git rev-parse --verify -q HEAD > /dev/null +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 +fi + +# list of all files +fileList=$(git diff-index --name-only $against --) +unset badFiles + +# join badFiles with this +NL=$'\n ' + +showBadFiles() +{ + if [ -n "$badFiles" ] + then + echo 'pre-commit hook failure' 1>&2 + echo '-----------------------' 1>&2 + echo "$@" 1>&2 + echo '' 1>&2 + echo "File(s):$badFiles" 1>&2 + echo '' 1>&2 + exit 1 + fi +} + +# +# check for bad characters or strings +# +checkIllegalCode() +{ + TAB=$'\t' + BAD=("Nabla" "$TAB") + BADmsg=("Nabla" "") + n=${#BAD[@]}; + + unset errorType + for (( i = 0; i < $n; i++ )) + do + for f in $fileList + do + illegalWord="${BAD[$i]}" + if git grep -q --cached "$illegalWord" -- "$f" + then + errorType="${BADmsg[$i]}" + badFiles="$badFiles$NL$f" + break 2 + fi + done + done + + showBadFiles "Remove/correct '$errorType' references before pushing" +} + + +# +# check that OpenCFD copyright is current +# +checkCopyright() +{ + year=$(date +%Y) + + for f in $fileList + do + present=`git grep --cached Copyright -- "$f" | grep OpenCFD` + if [ -n "$present" ] + then + echo "$present" | grep -q "$year" || badFiles="$badFiles$NL$f" + fi + done + + showBadFiles "Update copyright year before pushing, e.g. XXXX-$year" +} + + +# +# limit line length to 80-columns, except C++ comment lines +# +checkLineLength() +{ + for f in $fileList + do + # limit to *.[CH] files + case "$f" in + *.[CH]) + ## detect long lines, but ignore C++ comment-lines + ## extract line numbers + longLines=$(git grep -n --cached ".\{81,\}" -- "$f" | + sed -ne '\@^[^:]*:[^:]*: *//.*@b; s@^[^:]*:\([0-9]*\):.*@\1@p' | + tr '\n' ' ' + ) + if [ -n "$longLines" ] + then + badFiles="$badFiles$NL$f -- lines: $longLines" + fi + ;; + esac + done + + showBadFiles "Limit code to 80 columns before pushing" +} + + +# do all checks +#~~~~~~~~~~~~~~ + +# use builtin whitespace checks to avoid trailing space +bad=$(git diff-index --check --cached $against --) || die "$bad" + +# check for illegal code, e.g. , Nabla etc +checkIllegalCode + +# if OpenCFD copyright exists, ensure it contains correct year +checkCopyright + +# ensure code conforms to 80 col max +checkLineLength + + +#------------------------------------------------------------------------------ From a76dd34d474ea756608ef3c93a8ddfdc96537066 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 21 Jul 2010 13:34:46 +0200 Subject: [PATCH 07/14] Adjust bin/tools/pre-commit-hook to avoid triggering pre-receive hook --- bin/tools/pre-commit-hook | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/tools/pre-commit-hook b/bin/tools/pre-commit-hook index 5460f7b38d..cb27530287 100755 --- a/bin/tools/pre-commit-hook +++ b/bin/tools/pre-commit-hook @@ -93,8 +93,8 @@ showBadFiles() checkIllegalCode() { TAB=$'\t' - BAD=("Nabla" "$TAB") - BADmsg=("Nabla" "") + BAD=("[N]abla" "$TAB") + BADmsg=("nabla" "") n=${#BAD[@]}; unset errorType @@ -170,7 +170,7 @@ checkLineLength() # use builtin whitespace checks to avoid trailing space bad=$(git diff-index --check --cached $against --) || die "$bad" -# check for illegal code, e.g. , Nabla etc +# check for illegal code, e.g. , nabla etc checkIllegalCode # if OpenCFD copyright exists, ensure it contains correct year From 3b7afb3ffb382faffbe6c17d728899aea2bfa755 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 21 Jul 2010 13:50:20 +0200 Subject: [PATCH 08/14] STYLE: add some comments to pre-commit-hook, unclutter some syntax --- bin/tools/pre-commit-hook | 81 ++++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 39 deletions(-) diff --git a/bin/tools/pre-commit-hook b/bin/tools/pre-commit-hook index cb27530287..c40cbf049b 100755 --- a/bin/tools/pre-commit-hook +++ b/bin/tools/pre-commit-hook @@ -70,10 +70,10 @@ fi fileList=$(git diff-index --name-only $against --) unset badFiles -# join badFiles with this -NL=$'\n ' +# join badFiles with this amount of space +Indent=" " -showBadFiles() +reportBadFiles() { if [ -n "$badFiles" ] then @@ -81,7 +81,8 @@ showBadFiles() echo '-----------------------' 1>&2 echo "$@" 1>&2 echo '' 1>&2 - echo "File(s):$badFiles" 1>&2 + echo "File(s):" 1>&2 + echo "$badFiles" 1>&2 echo '' 1>&2 exit 1 fi @@ -92,27 +93,27 @@ showBadFiles() # checkIllegalCode() { - TAB=$'\t' - BAD=("[N]abla" "$TAB") - BADmsg=("nabla" "") - n=${#BAD[@]}; + badWords=("[N]abla" $'\t') + badMsg=("nabla" "") + nWords=${#badWords[@]}; - unset errorType - for (( i = 0; i < $n; i++ )) + for (( i = 0; i < $nWords; i++ )) do + illegal="${badWords[$i]}" + + badFiles=$( for f in $fileList do - illegalWord="${BAD[$i]}" - if git grep -q --cached "$illegalWord" -- "$f" - then - errorType="${BADmsg[$i]}" - badFiles="$badFiles$NL$f" - break 2 - fi + git grep -q --cached -e "$illegal" -- "$f" && \ + echo "$Indent$f" done - done + ) - showBadFiles "Remove/correct '$errorType' references before pushing" + if [ -n "$badFiles" ] + then + reportBadFiles "Remove/correct bad '${badMsg[$i]}' references" + fi + done } @@ -123,61 +124,63 @@ checkCopyright() { year=$(date +%Y) + badFiles=$( for f in $fileList do - present=`git grep --cached Copyright -- "$f" | grep OpenCFD` - if [ -n "$present" ] + copyright=$(git grep --cached -e Copyright -- "$f" | grep OpenCFD) + if [ -n "$copyright" ] then - echo "$present" | grep -q "$year" || badFiles="$badFiles$NL$f" + echo "$copyright" | grep -q "$year" || echo "$Indent$f" fi done + ) - showBadFiles "Update copyright year before pushing, e.g. XXXX-$year" + reportBadFiles "Update copyright year, e.g. XXXX-$year" } # # limit line length to 80-columns, except C++ comment lines +# parses +# path/fileName:: contents +# and extracts line numbers for non-comment lines # checkLineLength() { + badFiles=$( for f in $fileList do # limit to *.[CH] files case "$f" in - *.[CH]) - ## detect long lines, but ignore C++ comment-lines - ## extract line numbers - longLines=$(git grep -n --cached ".\{81,\}" -- "$f" | - sed -ne '\@^[^:]*:[^:]*: *//.*@b; s@^[^:]*:\([0-9]*\):.*@\1@p' | + (*.[CH]) + lines=$(git grep -n --cached -e ".\{81,\}" -- "$f" | + sed -n \ + -e '\@^[^:]*:[^:]*: *//.*@b' \ + -e 's@^[^:]*:\([0-9]*\):.*@\1@p' | tr '\n' ' ' ) - if [ -n "$longLines" ] - then - badFiles="$badFiles$NL$f -- lines: $longLines" - fi + [ -n "$lines" ] && echo "$Indent$f -- lines: $lines" ;; esac done - - showBadFiles "Limit code to 80 columns before pushing" + ) + reportBadFiles "Limit code to 80 columns before pushing" } # do all checks #~~~~~~~~~~~~~~ -# use builtin whitespace checks to avoid trailing space +# builtin whitespace check to avoid trailing space, including CR-LF endings bad=$(git diff-index --check --cached $against --) || die "$bad" -# check for illegal code, e.g. , nabla etc +# check for illegal code, e.g. , etc checkIllegalCode -# if OpenCFD copyright exists, ensure it contains correct year +# ensure OpenCFD copyright contains correct year checkCopyright -# ensure code conforms to 80 col max +# ensure code conforms to 80 columns max checkLineLength - #------------------------------------------------------------------------------ From 2a1ccb730ed8a96ddc5d2f9fd68a31090140e9f3 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 22 Jul 2010 10:29:27 +0200 Subject: [PATCH 09/14] ENH: drop special treatment for C++ comments line length in pre-commit-hook ENH: report line number for illegal words and for copyrights --- bin/tools/pre-commit-hook | 89 ++++++++++++++++++++++++++++----------- 1 file changed, 65 insertions(+), 24 deletions(-) diff --git a/bin/tools/pre-commit-hook b/bin/tools/pre-commit-hook index c40cbf049b..76f96d4a9d 100755 --- a/bin/tools/pre-commit-hook +++ b/bin/tools/pre-commit-hook @@ -70,10 +70,13 @@ fi fileList=$(git diff-index --name-only $against --) unset badFiles -# join badFiles with this amount of space +# join list of files with this amount of space Indent=" " -reportBadFiles() +# +# report bad files and die if there are any +# +dieOnBadFiles() { if [ -n "$badFiles" ] then @@ -88,14 +91,15 @@ reportBadFiles() fi } + # # check for bad characters or strings # checkIllegalCode() { badWords=("[N]abla" $'\t') - badMsg=("nabla" "") - nWords=${#badWords[@]}; + badMsg=("NABLA" "") + nWords=${#badWords[@]} for (( i = 0; i < $nWords; i++ )) do @@ -104,15 +108,17 @@ checkIllegalCode() badFiles=$( for f in $fileList do - git grep -q --cached -e "$illegal" -- "$f" && \ - echo "$Indent$f" + # parse line numbers from this: + # path/fileName:: contents + lines=$(git grep --cached -n -e "$illegal" -- "$f" | + sed -e 's@^[^:]*:\([0-9]*\):.*@\1@' | + tr '\n' ' ' + ) + [ -n "$lines" ] && echo "$Indent$f -- lines: $lines" done ) - if [ -n "$badFiles" ] - then - reportBadFiles "Remove/correct bad '${badMsg[$i]}' references" - fi + dieOnBadFiles "Remove/correct bad '${badMsg[$i]}' references" done } @@ -127,23 +133,25 @@ checkCopyright() badFiles=$( for f in $fileList do - copyright=$(git grep --cached -e Copyright -- "$f" | grep OpenCFD) - if [ -n "$copyright" ] - then - echo "$copyright" | grep -q "$year" || echo "$Indent$f" - fi + # parse line numbers from this: + # path/fileName:: contents + # for Copyright lines without the current year + lines=$(git grep --cached -n -e Copyright -- "$f" | + sed -n \ + -e "/OpenCFD/{ /$year/b;" \ + -e 's@^[^:]*:\([0-9]*\):.*@\1@p }' | + tr '\n' ' ' + ) + [ -n "$lines" ] && echo "$Indent$f -- lines: $lines" done ) - reportBadFiles "Update copyright year, e.g. XXXX-$year" + dieOnBadFiles "Update copyright year, e.g. XXXX-$year" } # -# limit line length to 80-columns, except C++ comment lines -# parses -# path/fileName:: contents -# and extracts line numbers for non-comment lines +# limit line length to 80-columns # checkLineLength() { @@ -153,7 +161,36 @@ checkLineLength() # limit to *.[CH] files case "$f" in (*.[CH]) - lines=$(git grep -n --cached -e ".\{81,\}" -- "$f" | + # parse line numbers from this: + # path/fileName:: contents + lines=$(git grep --cached -n -e ".\{81,\}" -- "$f" | + sed -e 's@^[^:]*:\([0-9]*\):.*@\1@' | + tr '\n' ' ' + ) + [ -n "$lines" ] && echo "$Indent$f -- lines: $lines" + ;; + esac + done + ) + + dieOnBadFiles "Limit code to 80 columns before pushing" +} + + +# +# limit line length to 80-columns, except C++ comment lines +# +checkLineLengthNonComments() +{ + badFiles=$( + for f in $fileList + do + # limit to *.[CH] files + case "$f" in + (*.[CH]) + # parse line numbers from this (strip comment lines): + # path/fileName:: contents + lines=$(git grep --cached -n -e ".\{81,\}" -- "$f" | sed -n \ -e '\@^[^:]*:[^:]*: *//.*@b' \ -e 's@^[^:]*:\([0-9]*\):.*@\1@p' | @@ -164,15 +201,17 @@ checkLineLength() esac done ) - reportBadFiles "Limit code to 80 columns before pushing" + + dieOnBadFiles "Limit code to 80 columns before pushing" } + # do all checks -#~~~~~~~~~~~~~~ +# ~~~~~~~~~~~~~ # builtin whitespace check to avoid trailing space, including CR-LF endings -bad=$(git diff-index --check --cached $against --) || die "$bad" +bad=$(git diff-index --cached --check $against --) || die "$bad" # check for illegal code, e.g. , etc checkIllegalCode @@ -183,4 +222,6 @@ checkCopyright # ensure code conforms to 80 columns max checkLineLength + +exit 0 #------------------------------------------------------------------------------ From e0990125568966656c0fd73210368ee26489dc05 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 23 Jul 2010 09:31:18 +0200 Subject: [PATCH 10/14] STYLE: use regex to avoid extra loop in pre-commit-hook --- bin/tools/pre-commit-hook | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/bin/tools/pre-commit-hook b/bin/tools/pre-commit-hook index 76f96d4a9d..be4bb69b24 100755 --- a/bin/tools/pre-commit-hook +++ b/bin/tools/pre-commit-hook @@ -93,33 +93,27 @@ dieOnBadFiles() # -# check for bad characters or strings +# check for bad strings, characters, etc # checkIllegalCode() { - badWords=("[N]abla" $'\t') - badMsg=("NABLA" "") - nWords=${#badWords[@]} + reBad="(N""abla|"$'\t'")" + msgBad="N""abla or " - for (( i = 0; i < $nWords; i++ )) + badFiles=$( + for f in $fileList do - illegal="${badWords[$i]}" - - badFiles=$( - for f in $fileList - do - # parse line numbers from this: - # path/fileName:: contents - lines=$(git grep --cached -n -e "$illegal" -- "$f" | - sed -e 's@^[^:]*:\([0-9]*\):.*@\1@' | - tr '\n' ' ' - ) - [ -n "$lines" ] && echo "$Indent$f -- lines: $lines" - done + # parse line numbers from this: + # path/fileName:: contents + lines=$(git grep --cached -n -E -e "$reBad" -- "$f" | + sed -e 's@^[^:]*:\([0-9]*\):.*@\1@' | + tr '\n' ' ' ) - - dieOnBadFiles "Remove/correct bad '${badMsg[$i]}' references" + [ -n "$lines" ] && echo "$Indent$f -- lines: $lines" done + ) + + dieOnBadFiles "Remove/correct bad '$msgBad' references" } @@ -138,7 +132,8 @@ checkCopyright() # for Copyright lines without the current year lines=$(git grep --cached -n -e Copyright -- "$f" | sed -n \ - -e "/OpenCFD/{ /$year/b;" \ + -e '/OpenCFD/{ ' \ + -e "/$year/b" \ -e 's@^[^:]*:\([0-9]*\):.*@\1@p }' | tr '\n' ' ' ) From 102f79701659462b89dad540cb0d3cf3bdd216c3 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 23 Jul 2010 10:08:47 +0100 Subject: [PATCH 11/14] ENH: Added DOS-style line ending check to git hook --- bin/tools/pre-commit-hook | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/tools/pre-commit-hook b/bin/tools/pre-commit-hook index be4bb69b24..9b5a394fde 100755 --- a/bin/tools/pre-commit-hook +++ b/bin/tools/pre-commit-hook @@ -97,8 +97,8 @@ dieOnBadFiles() # checkIllegalCode() { - reBad="(N""abla|"$'\t'")" - msgBad="N""abla or " + reBad="(N""abla|"$'\t'"|"$'\r\n'")" + msgBad="N""abla, , or DOS-style line ending" badFiles=$( for f in $fileList @@ -219,4 +219,5 @@ checkLineLength exit 0 + #------------------------------------------------------------------------------ From a3a6b890d0d7a8e6ab914f254b91861150005b5b Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 23 Jul 2010 10:54:56 +0100 Subject: [PATCH 12/14] dimensionedScalar cbrt: changed word "1/3" to "1|3" --- .../dimensionedTypes/dimensionedScalar/dimensionedScalar.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenFOAM/dimensionedTypes/dimensionedScalar/dimensionedScalar.C b/src/OpenFOAM/dimensionedTypes/dimensionedScalar/dimensionedScalar.C index a08224dd43..36cfd55827 100644 --- a/src/OpenFOAM/dimensionedTypes/dimensionedScalar/dimensionedScalar.C +++ b/src/OpenFOAM/dimensionedTypes/dimensionedScalar/dimensionedScalar.C @@ -155,7 +155,7 @@ dimensionedScalar cbrt(const dimensionedScalar& ds) return dimensionedScalar ( "cbrt(" + ds.name() + ')', - pow(ds.dimensions(), dimensionedScalar("(1/3)", dimless, 1.0/3.0)), + pow(ds.dimensions(), dimensionedScalar("(1|3)", dimless, 1.0/3.0)), ::cbrt(ds.value()) ); } From d5ee2e8e1f66861e82b0f10d54b2bcf74a9d7f3e Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 23 Jul 2010 10:56:18 +0100 Subject: [PATCH 13/14] Corrected copyright date. --- .../dimensionedTypes/dimensionedScalar/dimensionedScalar.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenFOAM/dimensionedTypes/dimensionedScalar/dimensionedScalar.C b/src/OpenFOAM/dimensionedTypes/dimensionedScalar/dimensionedScalar.C index 36cfd55827..79ffd76e09 100644 --- a/src/OpenFOAM/dimensionedTypes/dimensionedScalar/dimensionedScalar.C +++ b/src/OpenFOAM/dimensionedTypes/dimensionedScalar/dimensionedScalar.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License From 7c1ca51598cbc253f4e87a036fb3be1360cef555 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 23 Jul 2010 12:06:51 +0100 Subject: [PATCH 14/14] Revert "ENH: Added DOS-style line ending check to git hook" This reverts commit 102f79701659462b89dad540cb0d3cf3bdd216c3. --- bin/tools/pre-commit-hook | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/tools/pre-commit-hook b/bin/tools/pre-commit-hook index 9b5a394fde..be4bb69b24 100755 --- a/bin/tools/pre-commit-hook +++ b/bin/tools/pre-commit-hook @@ -97,8 +97,8 @@ dieOnBadFiles() # checkIllegalCode() { - reBad="(N""abla|"$'\t'"|"$'\r\n'")" - msgBad="N""abla, , or DOS-style line ending" + reBad="(N""abla|"$'\t'")" + msgBad="N""abla or " badFiles=$( for f in $fileList @@ -219,5 +219,4 @@ checkLineLength exit 0 - #------------------------------------------------------------------------------