From 2919c9b6754decfc51aa1c884121f8603585b6ab Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 1 Feb 2022 19:39:25 +0100 Subject: [PATCH] STYLE: minor changes - do not need STRINGIFY macros in ragel code - remove wordPairHashTable.H and use equivalent wordPairHashes.H instead STYLE: replace addDictOption with explicit option - the usage text is otherwise misleading GIT: combine Pair/Tuple2 directories --- .../test/flatOutput1/Test-flatOuput1.C | 28 +++++++++---------- .../steadyParticleTracks.C | 8 ++++-- .../setAlphaField/setAlphaField.C | 7 ++++- .../expressions/fields/fieldExprScanner.cc | 6 ++-- .../expressions/fields/fieldExprScanner.rl | 6 ++-- .../include/addFunctionObjectOptions.H | 7 ++++- .../primitives/{Pair => tuples}/Pair.H | 0 .../primitives/{Pair => tuples}/PairI.H | 0 .../primitives/{Tuple2 => tuples}/Tuple2.H | 0 .../primitives/{Pair => tuples}/labelPair.H | 0 .../{Pair => tuples}/labelPairHashes.H | 0 .../primitives/{Pair => tuples}/wordPair.H | 0 .../{Pair => tuples}/wordPairHashes.H | 4 +-- .../expressions/patch/patchExprScanner.cc | 6 ++-- .../expressions/patch/patchExprScanner.rl | 6 ++-- .../expressions/volume/volumeExprScanner.cc | 6 ++-- .../expressions/volume/volumeExprScanner.rl | 6 ++-- .../refinementParameters.H | 6 ++-- .../refinementParameters/wordPairHashTable.H | 15 +--------- 19 files changed, 56 insertions(+), 55 deletions(-) rename src/OpenFOAM/primitives/{Pair => tuples}/Pair.H (100%) rename src/OpenFOAM/primitives/{Pair => tuples}/PairI.H (100%) rename src/OpenFOAM/primitives/{Tuple2 => tuples}/Tuple2.H (100%) rename src/OpenFOAM/primitives/{Pair => tuples}/labelPair.H (100%) rename src/OpenFOAM/primitives/{Pair => tuples}/labelPairHashes.H (100%) rename src/OpenFOAM/primitives/{Pair => tuples}/wordPair.H (100%) rename src/OpenFOAM/primitives/{Pair => tuples}/wordPairHashes.H (97%) diff --git a/applications/test/flatOutput1/Test-flatOuput1.C b/applications/test/flatOutput1/Test-flatOuput1.C index 58e2f7d594..8909f0eb99 100644 --- a/applications/test/flatOutput1/Test-flatOuput1.C +++ b/applications/test/flatOutput1/Test-flatOuput1.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -32,13 +32,13 @@ Description #include "ListOps.H" #include "FlatOutput.H" #include "IOstreams.H" -#include "macros.H" using namespace Foam; // For testing various pre-defined formatting -#define printFlatOutput(Content, Format) \ - STRINGIFY(Format) << ": " << flatOutput(Content, FlatOutput::Format{}) +#define printFlatOutput(Content, Format) \ + Info<< nl << #Format << ": " \ + << flatOutput(Content, FlatOutput::Format{}) << nl // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -77,20 +77,20 @@ int main(int argc, char *argv[]) Info<< nl << "write: "; flatOutput(words1).write(Info) << nl; - Info<< nl << printFlatOutput(words1, BareComma) << nl; - Info<< nl << printFlatOutput(words1, BareSpace) << nl; + printFlatOutput(words1, BareComma); + printFlatOutput(words1, BareSpace); - Info<< nl << printFlatOutput(words1, BraceComma) << nl; - Info<< nl << printFlatOutput(words1, BraceSpace) << nl; + printFlatOutput(words1, BraceComma); + printFlatOutput(words1, BraceSpace); - Info<< nl << printFlatOutput(words1, ParenComma) << nl; - Info<< nl << printFlatOutput(words1, ParenSpace) << nl; + printFlatOutput(words1, ParenComma); + printFlatOutput(words1, ParenSpace); - Info<< nl << printFlatOutput(words1, PointyComma) << nl; - Info<< nl << printFlatOutput(words1, PointySpace) << nl; + printFlatOutput(words1, PointyComma); + printFlatOutput(words1, PointySpace); - Info<< nl << printFlatOutput(words1, SquareComma) << nl; - Info<< nl << printFlatOutput(words1, SquareSpace) << nl; + printFlatOutput(words1, SquareComma); + printFlatOutput(words1, SquareSpace); } diff --git a/applications/utilities/postProcessing/lagrangian/steadyParticleTracks/steadyParticleTracks.C b/applications/utilities/postProcessing/lagrangian/steadyParticleTracks/steadyParticleTracks.C index 8da9c07151..3984a7a9ab 100644 --- a/applications/utilities/postProcessing/lagrangian/steadyParticleTracks/steadyParticleTracks.C +++ b/applications/utilities/postProcessing/lagrangian/steadyParticleTracks/steadyParticleTracks.C @@ -126,10 +126,14 @@ int main(int argc, char *argv[]) argList::noParallel(); timeSelector::addOptions(); #include "addRegionOption.H" - #include "addDictOption.H" + argList::addOption + ( + "dict", + "file", + "Alternative particleTrackDict dictionary" + ); #include "setRootCase.H" - #include "createTime.H" instantList timeDirs = timeSelector::select0(runTime, args); #include "createNamedMesh.H" diff --git a/applications/utilities/preProcessing/setAlphaField/setAlphaField.C b/applications/utilities/preProcessing/setAlphaField/setAlphaField.C index c340b3f224..6f46e527d3 100644 --- a/applications/utilities/preProcessing/setAlphaField/setAlphaField.C +++ b/applications/utilities/preProcessing/setAlphaField/setAlphaField.C @@ -145,7 +145,12 @@ int main(int argc, char *argv[]) "implicit function." ); - #include "addDictOption.H" + argList::addOption + ( + "dict", + "file", + "Alternative setAlphaFieldDict dictionary" + ); #include "addRegionOption.H" #include "setRootCase.H" #include "createTime.H" diff --git a/src/OpenFOAM/expressions/fields/fieldExprScanner.cc b/src/OpenFOAM/expressions/fields/fieldExprScanner.cc index be55e6c93e..1e77ed2e27 100644 --- a/src/OpenFOAM/expressions/fields/fieldExprScanner.cc +++ b/src/OpenFOAM/expressions/fields/fieldExprScanner.cc @@ -7,7 +7,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019-2021 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -36,7 +36,7 @@ Description #include "fieldExprLemonParser.h" #include "fieldExprParser.H" #include "Enum.H" -#include "macros.H" +//#include "macros.H" #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" #pragma GCC diagnostic ignored "-Wunused-const-variable" @@ -163,7 +163,7 @@ static int driverTokenType #define EMIT_TOKEN(T) \ driver_.parsePosition() = (ts-buf); \ - DebugInfo<< STRINGIFY(T) << " at " << driver_.parsePosition() << nl; \ + DebugInfo<< #T << " at " << driver_.parsePosition() << nl; \ parser_->parse(TOKEN_OF(T)); \ driver_.parsePosition() = (p-buf); diff --git a/src/OpenFOAM/expressions/fields/fieldExprScanner.rl b/src/OpenFOAM/expressions/fields/fieldExprScanner.rl index 8511398817..84fbf2ecd8 100644 --- a/src/OpenFOAM/expressions/fields/fieldExprScanner.rl +++ b/src/OpenFOAM/expressions/fields/fieldExprScanner.rl @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019-2021 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -34,7 +34,7 @@ Description #include "fieldExprLemonParser.h" #include "fieldExprParser.H" #include "Enum.H" -#include "macros.H" +//#include "macros.H" #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" #pragma GCC diagnostic ignored "-Wunused-const-variable" @@ -161,7 +161,7 @@ static int driverTokenType #define EMIT_TOKEN(T) \ driver_.parsePosition() = (ts-buf); \ - DebugInfo<< STRINGIFY(T) << " at " << driver_.parsePosition() << nl; \ + DebugInfo<< #T << " at " << driver_.parsePosition() << nl; \ parser_->parse(TOKEN_OF(T)); \ driver_.parsePosition() = (p-buf); diff --git a/src/OpenFOAM/include/addFunctionObjectOptions.H b/src/OpenFOAM/include/addFunctionObjectOptions.H index 35f8503e7d..55feb0a91a 100644 --- a/src/OpenFOAM/include/addFunctionObjectOptions.H +++ b/src/OpenFOAM/include/addFunctionObjectOptions.H @@ -1,4 +1,9 @@ -#include "addDictOption.H" +Foam::argList::addOption +( + "dict", + "file", + "Read control dictionary from specified location" +); Foam::argList::addOption ( "field", diff --git a/src/OpenFOAM/primitives/Pair/Pair.H b/src/OpenFOAM/primitives/tuples/Pair.H similarity index 100% rename from src/OpenFOAM/primitives/Pair/Pair.H rename to src/OpenFOAM/primitives/tuples/Pair.H diff --git a/src/OpenFOAM/primitives/Pair/PairI.H b/src/OpenFOAM/primitives/tuples/PairI.H similarity index 100% rename from src/OpenFOAM/primitives/Pair/PairI.H rename to src/OpenFOAM/primitives/tuples/PairI.H diff --git a/src/OpenFOAM/primitives/Tuple2/Tuple2.H b/src/OpenFOAM/primitives/tuples/Tuple2.H similarity index 100% rename from src/OpenFOAM/primitives/Tuple2/Tuple2.H rename to src/OpenFOAM/primitives/tuples/Tuple2.H diff --git a/src/OpenFOAM/primitives/Pair/labelPair.H b/src/OpenFOAM/primitives/tuples/labelPair.H similarity index 100% rename from src/OpenFOAM/primitives/Pair/labelPair.H rename to src/OpenFOAM/primitives/tuples/labelPair.H diff --git a/src/OpenFOAM/primitives/Pair/labelPairHashes.H b/src/OpenFOAM/primitives/tuples/labelPairHashes.H similarity index 100% rename from src/OpenFOAM/primitives/Pair/labelPairHashes.H rename to src/OpenFOAM/primitives/tuples/labelPairHashes.H diff --git a/src/OpenFOAM/primitives/Pair/wordPair.H b/src/OpenFOAM/primitives/tuples/wordPair.H similarity index 100% rename from src/OpenFOAM/primitives/Pair/wordPair.H rename to src/OpenFOAM/primitives/tuples/wordPair.H diff --git a/src/OpenFOAM/primitives/Pair/wordPairHashes.H b/src/OpenFOAM/primitives/tuples/wordPairHashes.H similarity index 97% rename from src/OpenFOAM/primitives/Pair/wordPairHashes.H rename to src/OpenFOAM/primitives/tuples/wordPairHashes.H index 92eaf28a51..1053484b53 100644 --- a/src/OpenFOAM/primitives/Pair/wordPairHashes.H +++ b/src/OpenFOAM/primitives/tuples/wordPairHashes.H @@ -42,8 +42,8 @@ Description \*---------------------------------------------------------------------------*/ -#ifndef wordPairHashes_H -#define wordPairHashes_H +#ifndef Foam_wordPairHashes_H +#define Foam_wordPairHashes_H #include "wordPair.H" #include "HashSet.H" diff --git a/src/finiteVolume/expressions/patch/patchExprScanner.cc b/src/finiteVolume/expressions/patch/patchExprScanner.cc index 2231d7386a..7cd8f92b4f 100644 --- a/src/finiteVolume/expressions/patch/patchExprScanner.cc +++ b/src/finiteVolume/expressions/patch/patchExprScanner.cc @@ -7,7 +7,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019-2021 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -36,7 +36,7 @@ Description #include "patchExprLemonParser.h" #include "patchExprParser.H" #include "Enum.H" -#include "macros.H" +//#include "macros.H" #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" #pragma GCC diagnostic ignored "-Wunused-const-variable" @@ -295,7 +295,7 @@ static int driverTokenType #define EMIT_TOKEN(T) \ driver_.parsePosition() = (ts-buf); \ - DebugInfo<< STRINGIFY(T) << " at " << driver_.parsePosition() << nl; \ + DebugInfo<< #T << " at " << driver_.parsePosition() << nl; \ parser_->parse(TOKEN_OF(T)); \ driver_.parsePosition() = (p-buf); diff --git a/src/finiteVolume/expressions/patch/patchExprScanner.rl b/src/finiteVolume/expressions/patch/patchExprScanner.rl index 54f6478fe1..68ab0ae7e4 100644 --- a/src/finiteVolume/expressions/patch/patchExprScanner.rl +++ b/src/finiteVolume/expressions/patch/patchExprScanner.rl @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019-2021 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -34,7 +34,7 @@ Description #include "patchExprLemonParser.h" #include "patchExprParser.H" #include "Enum.H" -#include "macros.H" +//#include "macros.H" #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" #pragma GCC diagnostic ignored "-Wunused-const-variable" @@ -293,7 +293,7 @@ static int driverTokenType #define EMIT_TOKEN(T) \ driver_.parsePosition() = (ts-buf); \ - DebugInfo<< STRINGIFY(T) << " at " << driver_.parsePosition() << nl; \ + DebugInfo<< #T << " at " << driver_.parsePosition() << nl; \ parser_->parse(TOKEN_OF(T)); \ driver_.parsePosition() = (p-buf); diff --git a/src/finiteVolume/expressions/volume/volumeExprScanner.cc b/src/finiteVolume/expressions/volume/volumeExprScanner.cc index ace78ea621..433b9f230a 100644 --- a/src/finiteVolume/expressions/volume/volumeExprScanner.cc +++ b/src/finiteVolume/expressions/volume/volumeExprScanner.cc @@ -7,7 +7,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019-2021 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -35,7 +35,7 @@ Description #include "volumeExprLemonParser.h" #include "volumeExprParser.H" #include "Enum.H" -#include "macros.H" +//#include "macros.H" #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" #pragma GCC diagnostic ignored "-Wunused-const-variable" @@ -314,7 +314,7 @@ static int driverTokenType #define EMIT_TOKEN(T) \ driver_.parsePosition() = (ts-buf); \ - DebugInfo<< STRINGIFY(T) << " at " << driver_.parsePosition() << nl; \ + DebugInfo<< #T << " at " << driver_.parsePosition() << nl; \ parser_->parse(TOKEN_OF(T)); \ driver_.parsePosition() = (p-buf); diff --git a/src/finiteVolume/expressions/volume/volumeExprScanner.rl b/src/finiteVolume/expressions/volume/volumeExprScanner.rl index 60cf6bb327..bb1aa10187 100644 --- a/src/finiteVolume/expressions/volume/volumeExprScanner.rl +++ b/src/finiteVolume/expressions/volume/volumeExprScanner.rl @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019-2021 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -33,7 +33,7 @@ Description #include "volumeExprLemonParser.h" #include "volumeExprParser.H" #include "Enum.H" -#include "macros.H" +//#include "macros.H" #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" #pragma GCC diagnostic ignored "-Wunused-const-variable" @@ -312,7 +312,7 @@ static int driverTokenType #define EMIT_TOKEN(T) \ driver_.parsePosition() = (ts-buf); \ - DebugInfo<< STRINGIFY(T) << " at " << driver_.parsePosition() << nl; \ + DebugInfo<< #T << " at " << driver_.parsePosition() << nl; \ parser_->parse(TOKEN_OF(T)); \ driver_.parsePosition() = (p-buf); diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/refinementParameters/refinementParameters.H b/src/mesh/snappyHexMesh/snappyHexMeshDriver/refinementParameters/refinementParameters.H index d05bce28e4..068d1fe95a 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/refinementParameters/refinementParameters.H +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/refinementParameters/refinementParameters.H @@ -41,7 +41,7 @@ SourceFiles #include "dictionary.H" #include "pointField.H" #include "Switch.H" -#include "wordPairHashTable.H" +#include "wordPairHashes.H" #include "surfaceZonesInfo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -49,7 +49,7 @@ SourceFiles namespace Foam { -// Class forward declarations +// Forward Declarations class polyMesh; /*---------------------------------------------------------------------------*\ @@ -58,7 +58,7 @@ class polyMesh; class refinementParameters { - // Private data + // Private Data //- Total number of cells const label maxGlobalCells_; diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/refinementParameters/wordPairHashTable.H b/src/mesh/snappyHexMesh/snappyHexMeshDriver/refinementParameters/wordPairHashTable.H index d5b8b49c18..7cec1b4541 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/refinementParameters/wordPairHashTable.H +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/refinementParameters/wordPairHashTable.H @@ -1,14 +1 @@ -/*---------------------------------------------------------------------------*\ -Description - Compatibility include. - -\*---------------------------------------------------------------------------*/ - -#ifndef wordPairHashTable_H -#define wordPairHashTable_H - -#include "wordPairHashes.H" - -#endif - -// ************************************************************************* // +#warning File removed - left for old dependency check only