mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: provide wordPair typedef in Pair.H, and separate wordPair.H
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -38,6 +38,7 @@ Description
|
|||||||
#include "stringList.H"
|
#include "stringList.H"
|
||||||
#include "labelList.H"
|
#include "labelList.H"
|
||||||
#include "labelPair.H"
|
#include "labelPair.H"
|
||||||
|
#include "wordPair.H"
|
||||||
#include "edgeList.H"
|
#include "edgeList.H"
|
||||||
#include "faceList.H"
|
#include "faceList.H"
|
||||||
#include "triFaceList.H"
|
#include "triFaceList.H"
|
||||||
@ -154,8 +155,6 @@ void reportHashList(const UList<labelList>& list)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
typedef Pair<word> wordPair;
|
|
||||||
|
|
||||||
void reportHashList(const UList<wordPair>& list)
|
void reportHashList(const UList<wordPair>& list)
|
||||||
{
|
{
|
||||||
Info<<"contiguous = " << is_contiguous<wordPair>::value << nl << nl;
|
Info<<"contiguous = " << is_contiguous<wordPair>::value << nl << nl;
|
||||||
@ -269,16 +268,20 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
IFstream is("hashingTests");
|
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())
|
token tok;
|
||||||
{
|
|
||||||
const word listType(is);
|
|
||||||
|
|
||||||
if (listType.empty()) continue;
|
while (is.good() && is.read(tok) && tok.good())
|
||||||
|
{
|
||||||
|
const word listType(tok.wordToken());
|
||||||
|
|
||||||
Info<< nl;
|
Info<< nl;
|
||||||
IOobject::writeDivider(Info) << listType << nl;
|
IOobject::writeDivider(Info) << listType << nl;
|
||||||
@ -286,7 +289,6 @@ int main(int argc, char *argv[])
|
|||||||
if (listType == "stringList")
|
if (listType == "stringList")
|
||||||
{
|
{
|
||||||
stringList list(is);
|
stringList list(is);
|
||||||
|
|
||||||
reportHashList(list);
|
reportHashList(list);
|
||||||
}
|
}
|
||||||
else if (listType == "labelList")
|
else if (listType == "labelList")
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2017-2019 OpenCFD Ltd.
|
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -51,11 +51,12 @@ See also
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declarations
|
// Forward Declarations
|
||||||
template<class T> class Pair;
|
template<class T> class Pair;
|
||||||
|
|
||||||
// Common pair types
|
// Common pair types
|
||||||
typedef Pair<label> labelPair; //!< A pair of labels
|
typedef Pair<label> labelPair; //!< A pair of labels
|
||||||
|
typedef Pair<word> wordPair; //!< A pair of words
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
@ -67,12 +68,11 @@ class Pair
|
|||||||
:
|
:
|
||||||
public FixedList<T, 2>
|
public FixedList<T, 2>
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct
|
||||||
Pair() = default;
|
Pair() = default;
|
||||||
|
|
||||||
//- Copy construct from components
|
//- Copy construct from components
|
||||||
|
|||||||
73
src/OpenFOAM/primitives/Pair/wordPair.H
Normal file
73
src/OpenFOAM/primitives/Pair/wordPair.H
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Typedef
|
||||||
|
Foam::wordPairPair
|
||||||
|
|
||||||
|
Description
|
||||||
|
A pair of wordPairs.
|
||||||
|
|
||||||
|
Typedef
|
||||||
|
Foam::wordPairList
|
||||||
|
|
||||||
|
Description
|
||||||
|
List of wordPairs.
|
||||||
|
|
||||||
|
Typedef
|
||||||
|
Foam::wordPairUList
|
||||||
|
|
||||||
|
Description
|
||||||
|
UList of wordPairs.
|
||||||
|
|
||||||
|
Typedef
|
||||||
|
Foam::wordPairSubList
|
||||||
|
|
||||||
|
Description
|
||||||
|
A SubList of wordPairs.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef wordPair_H
|
||||||
|
#define wordPair_H
|
||||||
|
|
||||||
|
#include "List.H"
|
||||||
|
#include "SubList.H"
|
||||||
|
#include "Pair.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
typedef Pair<wordPair> wordPairPair;
|
||||||
|
typedef List<wordPair> wordPairList;
|
||||||
|
typedef UList<wordPair> wordPairUList;
|
||||||
|
typedef SubList<wordPair> wordPairSubList;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
Reference in New Issue
Block a user