phaseInterfaceKey.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2021-2023 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 \*---------------------------------------------------------------------------*/
25 
26 #include "phaseModel.H"
27 #include "phaseInterface.H"
28 #include "phaseInterfaceKey.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
33 {}
34 
35 
37 {}
38 
39 
41 (
42  const phaseModel& phase1,
43  const phaseModel& phase2
44 )
45 :
46  Pair<word>
47  (
48  phaseInterface::getPhase1(phase1, phase2).name(),
49  phaseInterface::getPhase2(phase1, phase2).name()
50  )
51 {}
52 
53 
55 :
56  phaseInterfaceKey(interface.phase1(), interface.phase2())
57 {}
58 
59 
60 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
61 
63 {}
64 
65 
66 // * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
67 
68 Foam::label Foam::phaseInterfaceKey::hash::operator()
69 (
70  const phaseInterfaceKey& key
71 ) const
72 {
73  return word::hash()(key.first()) + word::hash()(key.second());
74 }
75 
76 
77 // * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
78 
79 bool Foam::operator==
80 (
81  const phaseInterfaceKey& a,
82  const phaseInterfaceKey& b
83 )
84 {
85  return Pair<word>::compare(a, b) == 1;
86 }
87 
88 
89 bool Foam::operator!=
90 (
91  const phaseInterfaceKey& a,
92  const phaseInterfaceKey& b
93 )
94 {
95  return !(a == b);
96 }
97 
98 
99 // * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * * //
100 
102 {
104 
105  return is;
106 }
107 
108 
109 // * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * * //
110 
112 {
114 
115  return os;
116 }
117 
118 
119 // ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
An ordered pair of two objects of type <T> with first() and second() elements.
Definition: Pair.H:65
static int compare(const Pair< Type > &a, const Pair< Type > &b)
Compare Pairs.
Definition: Pair.H:153
Word-pair based class used for keying interface models in hash tables.
phaseInterfaceKey()
Construct null.
Class to represent an interface between phases. Derivations can further specify the configuration of ...
Hashing function class, shared by all the derived classes.
Definition: string.H:93
A class for handling words, derived from string.
Definition: word.H:62
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:381
volScalarField & b
Definition: createFields.H:25
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
word name(const bool)
Return a word representation of a bool.
Definition: boolIO.C:39
Istream & operator>>(Istream &, pistonPointEdgeData &)
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)