phasePairKey.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2017 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::phasePairKey
28 
29 Description
30 
31 SourceFiles
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef phasePairKey_H
36 #define phasePairKey_H
37 
38 #include "Pair.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 // Forward declarations
46 class phasePairKey;
47 
48 bool operator==(const phasePairKey& a, const phasePairKey& b);
49 bool operator!=(const phasePairKey& a, const phasePairKey& b);
50 
51 Istream& operator>>(Istream& is, phasePairKey& key);
52 Ostream& operator<<(Ostream& os, const phasePairKey& key);
53 
54 /*---------------------------------------------------------------------------*\
55  Class phasePairKey Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class phasePairKey
59 :
60  public Pair<word>
61 {
62  // Private data
63 
64  //- Flag to indicate whether ordering is important
65  bool ordered_;
66 
67 
68 public:
69 
70  //- Ordered or unordered hashing of word pair
71  struct hash
72  {
73  //- Generate a hash from a phase pair key
74  label operator()(const phasePairKey& key) const;
75  };
76 
77 
78  // Constructors
79 
80  //- Construct null
81  phasePairKey() {} // = default
82 
83  //- Construct from names and optional ordering flag
85  (
86  const word& name1,
87  const word& name2,
88  const bool ordered = false
89  );
90 
91 
92  //- Destructor
93  virtual ~phasePairKey() = default;
94 
95 
96  // Access
97 
98  //- Return the ordered flag
99  bool ordered() const;
100 
101 
102  // Friend Operators
103 
104  //- Test for equality
105  friend bool operator==(const phasePairKey& a, const phasePairKey& b);
106 
107  //- Test for inequality
108  friend bool operator!=(const phasePairKey& a, const phasePairKey& b);
109 
110  //- Read from Istream
111  friend Istream& operator>>(Istream& is, phasePairKey& key);
112 
113  //- Write to Ostream
114  friend Ostream& operator<<(Ostream& os, const phasePairKey& key);
115 };
116 
117 
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 
120 } // End namespace Foam
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 #endif
125 
126 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::phasePairKey::operator>>
friend Istream & operator>>(Istream &is, phasePairKey &key)
Read from Istream.
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:230
Pair.H
Foam::phasePairKey::phasePairKey
phasePairKey()
Construct null.
Definition: phasePairKey.H:80
Foam::phasePairKey::hash
Ordered or unordered hashing of word pair.
Definition: phasePairKey.H:70
Foam::operator!=
bool operator!=(const eddy &a, const eddy &b)
Definition: eddy.H:235
Foam::phasePairKey::~phasePairKey
virtual ~phasePairKey()=default
Destructor.
Definition: phasePairKey.C:54
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::phasePairKey::operator<<
friend Ostream & operator<<(Ostream &os, const phasePairKey &key)
Write to Ostream.
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
Foam::operator==
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::phasePairKey
Definition: phasePairKey.H:57
Foam::phasePairKey::hash::operator()
label operator()(const phasePairKey &key) const
Generate a hash from a phase pair key.
Definition: phasePairKey.C:55
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::phasePairKey::ordered
bool ordered() const
Return the ordered flag.
Definition: phasePairKey.C:46
Foam::phasePairKey::operator==
friend bool operator==(const phasePairKey &a, const phasePairKey &b)
Test for equality.
Foam::Pair
An ordered pair of two objects of type <T> with first() and second() elements.
Definition: Pair.H:54
Foam::phasePairKey::operator!=
friend bool operator!=(const phasePairKey &a, const phasePairKey &b)
Test for inequality.
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56