From 36c651f1648678cc3e84c8e1553d8b8cc7cccd10 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 21 Jun 2012 10:31:48 +0100 Subject: [PATCH 1/5] STYLE: activeBaffleVelocity: indenting --- .../activeBaffleVelocityFvPatchVectorField.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C index 9ba601d853..86cd31df92 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -181,6 +181,7 @@ void Foam::activeBaffleVelocityFvPatchVectorField::autoMap ).neighbFvPatch().patch().patchSlice(areas); } + void Foam::activeBaffleVelocityFvPatchVectorField::rmap ( const fvPatchVectorField& ptf, From 14aafe2b71711f52d6ddd55c77146285a9d8eac7 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 22 Jun 2012 16:40:52 +0100 Subject: [PATCH 2/5] ENH: reconstructPar: -newTimes argument to reconstruct missing times --- .../reconstructPar/reconstructPar.C | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C index 37d4a04f22..b47a15a6e1 100644 --- a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C +++ b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -69,6 +69,11 @@ int main(int argc, char *argv[]) "noLagrangian", "skip reconstructing lagrangian positions and fields" ); + argList::addBoolOption + ( + "newTimes", + "only reconstruct new times (i.e. that do not exist already)" + ); # include "setRootCase.H" # include "createTime.H" @@ -95,6 +100,10 @@ int main(int argc, char *argv[]) args.optionLookup("lagrangianFields")() >> selectedLagrangianFields; } + + const bool newTimes = args.optionFound("newTimes"); + + // determine the processor count directly label nProcs = 0; while (isDir(args.path()/(word("processor") + name(nProcs)))) @@ -134,6 +143,8 @@ int main(int argc, char *argv[]) args ); + instantList masterTimeDirs = runTime.times(); + if (timeDirs.empty()) { FatalErrorIn(args.executable()) @@ -165,6 +176,14 @@ int main(int argc, char *argv[]) // Loop over all times forAll(timeDirs, timeI) { + if (newTimes && findIndex(masterTimeDirs, timeDirs[timeI]) != -1) + { + Info<< "Skipping time " << timeDirs[timeI].name() + << endl << endl; + continue; + } + + // Set time for global database runTime.setTime(timeDirs[timeI], timeI); From 6b5fa6cd3325a04bcfd41ea9cc9a8d6b64b46316 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 22 Jun 2012 16:42:04 +0100 Subject: [PATCH 3/5] STYLE: TableBase: keep includes out of header file --- src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C | 1 + src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C index 4b52d26699..14d2fc210d 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C +++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.C @@ -25,6 +25,7 @@ License #include "TableBase.H" #include "Time.H" +#include "interpolationWeights.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H index ce4c3d2287..bd98858d71 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H @@ -38,7 +38,6 @@ SourceFiles #include "DataEntry.H" #include "Tuple2.H" #include "dimensionSet.H" -#include "interpolationWeights.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -55,6 +54,8 @@ Ostream& operator<< const TableBase& ); +class interpolationWeights; + /*---------------------------------------------------------------------------*\ Class TableBase Declaration \*---------------------------------------------------------------------------*/ From c6c98192497e44e6af3d0722e775f55e224c972a Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 22 Jun 2012 16:42:21 +0100 Subject: [PATCH 4/5] BUG: dynamicCodeContext: do not add line number to Make/options --- .../db/dynamicLibrary/dynamicCode/dynamicCodeContext.C | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCodeContext.C b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCodeContext.C index a5bb2a889a..22c49df9c0 100644 --- a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCodeContext.C +++ b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCodeContext.C @@ -112,13 +112,9 @@ Foam::dynamicCodeContext::dynamicCodeContext(const dictionary& dict) addLineDirective(include_, includePtr->startLineNumber(), dict.name()); } - // Do not add line directive to options_ (Make/options) since at it is a - // single line at this point. Can be fixed. + // Do not add line directive to options_ (Make/options) and libs since + // they are preprocessed as a single line at this point. Can be fixed. - if (libsPtr) - { - addLineDirective(libs_, libsPtr->startLineNumber(), dict.name()); - } if (localPtr) { addLineDirective(localCode_, localPtr->startLineNumber(), dict.name()); From 5388a95da295216e038fe8162d55d491d67c2113 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 22 Jun 2012 16:57:35 +0100 Subject: [PATCH 5/5] ENH: Hash: template specialisation for Hash and derivatives --- src/OpenFOAM/primitives/hashes/Hash/Hash.H | 105 ++++++++++++++++++++- 1 file changed, 104 insertions(+), 1 deletion(-) diff --git a/src/OpenFOAM/primitives/hashes/Hash/Hash.H b/src/OpenFOAM/primitives/hashes/Hash/Hash.H index e5fbb2823b..e4f67371da 100644 --- a/src/OpenFOAM/primitives/hashes/Hash/Hash.H +++ b/src/OpenFOAM/primitives/hashes/Hash/Hash.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,6 +37,8 @@ Description #include "uLabel.H" #include "Hasher.H" #include "pTraits.H" +#include "fileName.H" +#include "wordRe.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -99,6 +101,107 @@ public: }; +//- Hash specialization for hashing strings +template<> +class Hash +{ +public: + + Hash() + {} + + unsigned operator()(const string& p, unsigned seed) const + { + return string::hash()(p, seed); + } + unsigned operator()(const string& p) const + { + return string::hash()(p); + } +}; + + +//- Hash specialization for hashing words +template<> +class Hash +{ +public: + + Hash() + {} + + unsigned operator()(const word& p, unsigned seed) const + { + return word::hash()(p, seed); + } + unsigned operator()(const word& p) const + { + return word::hash()(p); + } +}; + + +//- Hash specialization for hashing fileNames +template<> +class Hash +{ +public: + + Hash() + {} + + unsigned operator()(const fileName& p, unsigned seed) const + { + return fileName::hash()(p, seed); + } + unsigned operator()(const fileName& p) const + { + return fileName::hash()(p); + } +}; + + +//- Hash specialization for hashing wordRes +template<> +class Hash +{ +public: + + Hash() + {} + + unsigned operator()(const wordRe& p, unsigned seed) const + { + return wordRe::hash()(p, seed); + } + unsigned operator()(const wordRe& p) const + { + return wordRe::hash()(p); + } +}; + + +//- Hash specialization for hashing keyTypes +template<> +class Hash +{ +public: + + Hash() + {} + + unsigned operator()(const keyType& p, unsigned seed) const + { + return keyType::hash()(p, seed); + } + unsigned operator()(const keyType& p) const + { + return keyType::hash()(p); + } +}; + + + //- Hash specialization for hashing pointer addresses. // Treat a pointer like a long. // This should work for both 32-bit and 64-bit pointers.