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) 2014-2018 OpenFOAM Foundation
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 declaration of friend functions and operators
46 
47 class phasePairKey;
48 
49 bool operator==(const phasePairKey&, const phasePairKey&);
50 bool operator!=(const phasePairKey&, const phasePairKey&);
51 
52 Istream& operator>>(Istream&, phasePairKey&);
53 Ostream& operator<<(Ostream&, const phasePairKey&);
54 
55 
56 /*---------------------------------------------------------------------------*\
57  Class phasePairKey Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 class phasePairKey
61 :
62  public Pair<word>
63 {
64 public:
65 
66  class hash
67  :
68  public Hash<phasePairKey>
69  {
70  public:
71 
72  // Constructors
73 
74  // Construct null
75  hash();
76 
77 
78  // Member operators
79 
80  // Generate a hash from a phase pair key
81  label operator()(const phasePairKey& key) const;
82  };
83 
84 
85 private:
86 
87  // Private data
88 
89  //- Flag to indicate whether ordering is important
90  bool ordered_;
91 
92 
93 public:
94 
95  // Constructors
96 
97  //- Construct null
98  phasePairKey();
99 
100  //- Construct from names and the ordering flag
102  (
103  const word& name1,
104  const word& name2,
105  const bool ordered = false
106  );
107 
108 
109  // Destructor
110  virtual ~phasePairKey();
111 
112 
113  // Access
114 
115  //- Return the ordered flag
116  bool ordered() const;
117 
118 
119  // Friend Operators
120 
121  //- Test if keys are equal
122  friend bool operator==(const phasePairKey& a, const phasePairKey& b);
123 
124  //- Test if keys are unequal
125  friend bool operator!=(const phasePairKey& a, const phasePairKey& b);
126 
127  //- Read from stdin
128  friend Istream& operator>>(Istream& is, phasePairKey& key);
129 
130  //- Write to stdout
131  friend Ostream& operator<<(Ostream& os, const phasePairKey& key);
132 };
133 
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 } // End namespace Foam
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 #endif
142 
143 // ************************************************************************* //
Foam::phasePairKey::~phasePairKey
virtual ~phasePairKey()
Definition: phasePairKey.C:54
Foam::phasePairKey::hash::operator()
label operator()(const phasePairKey &key) const
Definition: phasePairKey.C:69
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::phasePairKey::hash
Ordered or unordered hashing of word pair.
Definition: phasePairKey.H:65
Foam::phasePairKey::operator>>
friend Istream & operator>>(Istream &is, phasePairKey &key)
Read from stdin.
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:228
Pair.H
Foam::phasePairKey::phasePairKey
phasePairKey()
Construct null.
Definition: phasePairKey.C:36
Foam::operator!=
bool operator!=(const eddy &a, const eddy &b)
Definition: eddy.H:235
Foam::phasePairKey::operator<<
friend Ostream & operator<<(Ostream &os, const phasePairKey &key)
Write to stdout.
Foam::Hash
Hash function class. The default definition is for primitives, non-primitives used to hash entries on...
Definition: Hash.H:55
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
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:59
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::phasePairKey::ordered
bool ordered() const
Return the ordered flag.
Definition: phasePairKey.C:60
Foam::phasePairKey::operator==
friend bool operator==(const phasePairKey &a, const phasePairKey &b)
Test if keys are equal.
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 if keys are unequal.
Foam::phasePairKey::hash::hash
hash()
Definition: phasePairKey.C:32
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &)
Definition: boundaryPatch.C:102