From 14c9582458f9f71014744f2ee0643a87139369b5 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 3 Aug 2020 17:04:10 +0200 Subject: [PATCH] ENH: provide wordPair typedef in Pair.H, and separate wordPair.H --- applications/test/Hashing/Test-Hashing.C | 22 +++---- src/OpenFOAM/primitives/Pair/Pair.H | 8 +-- src/OpenFOAM/primitives/Pair/wordPair.H | 73 ++++++++++++++++++++++++ 3 files changed, 89 insertions(+), 14 deletions(-) create mode 100644 src/OpenFOAM/primitives/Pair/wordPair.H diff --git a/applications/test/Hashing/Test-Hashing.C b/applications/test/Hashing/Test-Hashing.C index 6485ef8c15..0028ef638b 100644 --- a/applications/test/Hashing/Test-Hashing.C +++ b/applications/test/Hashing/Test-Hashing.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018-2019 OpenCFD Ltd. + Copyright (C) 2018-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -38,6 +38,7 @@ Description #include "stringList.H" #include "labelList.H" #include "labelPair.H" +#include "wordPair.H" #include "edgeList.H" #include "faceList.H" #include "triFaceList.H" @@ -154,8 +155,6 @@ void reportHashList(const UList& list) } -typedef Pair wordPair; - void reportHashList(const UList& list) { Info<<"contiguous = " << is_contiguous::value << nl << nl; @@ -269,16 +268,20 @@ int main(int argc, char *argv[]) IFstream is("hashingTests"); - if (!is.good()) + if (is.good()) { - Info<< "No \"hashingTests\" file found ...\n"; + Info<< nl << "Process " << is.name() << " file ..." << nl; + } + else + { + Info<< nl << "No " << is.name() << " file found ..." << nl; } - while (is.good()) - { - const word listType(is); + token tok; - if (listType.empty()) continue; + while (is.good() && is.read(tok) && tok.good()) + { + const word listType(tok.wordToken()); Info<< nl; IOobject::writeDivider(Info) << listType << nl; @@ -286,7 +289,6 @@ int main(int argc, char *argv[]) if (listType == "stringList") { stringList list(is); - reportHashList(list); } else if (listType == "labelList") diff --git a/src/OpenFOAM/primitives/Pair/Pair.H b/src/OpenFOAM/primitives/Pair/Pair.H index 5545540720..5b9dd491fc 100644 --- a/src/OpenFOAM/primitives/Pair/Pair.H +++ b/src/OpenFOAM/primitives/Pair/Pair.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2019 OpenCFD Ltd. + Copyright (C) 2017-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -51,11 +51,12 @@ See also namespace Foam { -// Forward declarations +// Forward Declarations template class Pair; // Common pair types typedef Pair