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 | Copyright (C) 2014-2015 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::phasePairKey
26 
27 Description
28 
29 SourceFiles
30 
31 \*---------------------------------------------------------------------------*/
32 
33 #ifndef phasePairKey_H
34 #define phasePairKey_H
35 
36 #include "Pair.H"
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
40 namespace Foam
41 {
42 
43 /*---------------------------------------------------------------------------*\
44  Class phasePairKey Declaration
45 \*---------------------------------------------------------------------------*/
46 
47 class phasePairKey
48 :
49  public Pair<word>
50 {
51 public:
52 
53  class hash
54  :
55  public Hash<phasePairKey>
56  {
57  public:
58 
59  // Constructors
60 
61  // Construct null
62  hash();
63 
64 
65  // Member operators
66 
67  // Generate a hash from a phase pair key
68  label operator()(const phasePairKey& key) const;
69  };
70 
71 
72 private:
73 
74  // Private data
75 
76  //- Flag to indicate whether ordering is important
77  bool ordered_;
78 
79 
80 public:
81 
82  // Constructors
83 
84  //- Construct null
85  phasePairKey();
86 
87  //- Construct from names and the ordering flag
89  (
90  const word& name1,
91  const word& name2,
92  const bool ordered = false
93  );
94 
95 
96  // Destructor
97  virtual ~phasePairKey();
98 
99 
100  // Access
101 
102  //- Return the ordered flag
103  bool ordered() const;
104 
105 
106  // Friend Operators
107 
108  //- Test if keys are equal
109  friend bool operator==(const phasePairKey& a, const phasePairKey& b);
110 
111  //- Test if keys are unequal
112  friend bool operator!=(const phasePairKey& a, const phasePairKey& b);
113 
114  //- Read from stdin
115  friend Istream& operator>>(Istream& is, phasePairKey& key);
116 
117  //- Write to stdout
118  friend Ostream& operator<<(Ostream& os, const phasePairKey& key);
119 };
120 
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 } // End namespace Foam
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 #endif
129 
130 // ************************************************************************* //
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::phasePairKey::hash::operator()
label operator()(const phasePairKey &key) const
Foam::phasePairKey::hash
Definition: phasePairKey.H:52
Foam::phasePairKey::operator>>
friend Istream & operator>>(Istream &is, phasePairKey &key)
Read from stdin.
Pair.H
Foam::phasePairKey::phasePairKey
phasePairKey()
Construct null.
Foam::phasePairKey::~phasePairKey
virtual ~phasePairKey()
Foam::phasePairKey::operator<<
friend Ostream & operator<<(Ostream &os, const phasePairKey &key)
Write to stdout.
Foam::Hash
Hash function class for primitives. All non-primitives used to hash entries on hash tables likely nee...
Definition: Hash.H:56
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:59
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:28
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::phasePairKey
Definition: phasePairKey.H:46
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::phasePairKey::ordered
bool ordered() const
Return the ordered flag.
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: contiguous.H:49
Foam::phasePairKey::operator!=
friend bool operator!=(const phasePairKey &a, const phasePairKey &b)
Test if keys are unequal.
Foam::phasePairKey::hash::hash
hash()
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::phasePairKey::ordered_
bool ordered_
Flag to indicate whether ordering is important.
Definition: phasePairKey.H:76