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-2016 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 // Forward declaration of friend functions and operators
44 
45 class phasePairKey;
46 
47 bool operator==(const phasePairKey&, const phasePairKey&);
48 bool operator!=(const phasePairKey&, const phasePairKey&);
49 
50 Istream& operator>>(Istream&, phasePairKey&);
51 Ostream& operator<<(Ostream&, const phasePairKey&);
52 
53 
54 /*---------------------------------------------------------------------------*\
55  Class phasePairKey Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class phasePairKey
59 :
60  public Pair<word>
61 {
62 public:
63 
64  class hash
65  :
66  public Hash<phasePairKey>
67  {
68  public:
69 
70  // Constructors
71 
72  // Construct null
73  hash();
74 
75 
76  // Member operators
77 
78  // Generate a hash from a phase pair key
79  label operator()(const phasePairKey& key) const;
80  };
81 
82 
83 private:
84 
85  // Private data
86 
87  //- Flag to indicate whether ordering is important
88  bool ordered_;
89 
90 
91 public:
92 
93  // Constructors
94 
95  //- Construct null
96  phasePairKey();
97 
98  //- Construct from names and the ordering flag
100  (
101  const word& name1,
102  const word& name2,
103  const bool ordered = false
104  );
105 
106 
107  // Destructor
108  virtual ~phasePairKey();
109 
110 
111  // Access
112 
113  //- Return the ordered flag
114  bool ordered() const;
115 
116 
117  // Friend Operators
118 
119  //- Test if keys are equal
120  friend bool operator==(const phasePairKey& a, const phasePairKey& b);
121 
122  //- Test if keys are unequal
123  friend bool operator!=(const phasePairKey& a, const phasePairKey& b);
124 
125  //- Read from stdin
126  friend Istream& operator>>(Istream& is, phasePairKey& key);
127 
128  //- Write to stdout
129  friend Ostream& operator<<(Ostream& os, const phasePairKey& key);
130 };
131 
132 
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 
135 } // End namespace Foam
136 
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 
139 #endif
140 
141 // ************************************************************************* //
bool ordered() const
Return the ordered flag.
label operator()(const phasePairKey &key) const
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
friend Ostream & operator<<(Ostream &os, const phasePairKey &key)
Write to stdout.
friend bool operator!=(const phasePairKey &a, const phasePairKey &b)
Test if keys are unequal.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
friend bool operator==(const phasePairKey &a, const phasePairKey &b)
Test if keys are equal.
An ordered pair of two objects of type <T> with first() and second() elements.
Definition: contiguous.H:49
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
A class for handling words, derived from string.
Definition: word.H:59
Istream & operator>>(Istream &, directionInfo &)
virtual ~phasePairKey()
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
Ostream & operator<<(Ostream &, const ensightPart &)
Hash function class for primitives. All non-primitives used to hash entries on hash tables likely nee...
Definition: Hash.H:54
phasePairKey()
Construct null.
bool operator!=(const particle &, const particle &)
Definition: particle.C:1106
Namespace for OpenFOAM.
friend Istream & operator>>(Istream &is, phasePairKey &key)
Read from stdin.