phasePairI.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-------------------------------------------------------------------------------
10License
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\*---------------------------------------------------------------------------*/
27
28// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
29
30inline const Foam::phaseModel& Foam::phasePair::phase1() const
31{
32 return phase1_;
33}
34
35
36inline const Foam::phaseModel& Foam::phasePair::phase2() const
37{
38 return phase2_;
39}
40
41
43{
44 return &phase1_ == &phase || & phase2_ == &phase;
45}
46
47
49(
50 const phaseModel& phase
51) const
52{
53 if (&phase1_ == &phase)
54 {
55 return phase2_;
56 }
57 else if (&phase2_ == &phase)
58 {
59 return phase1_;
60 }
61 else
62 {
64 << "this phasePair does not contain phase " << phase.name()
65 << exit(FatalError);
66
67 return phase;
68 }
69}
70
71
72inline Foam::label Foam::phasePair::index(const phaseModel& phase) const
73{
74 if (&phase1_ == &phase)
75 {
76 return 0;
77 }
78 else if (&phase2_ == &phase)
79 {
80 return 1;
81 }
82 else
83 {
85 << "this phasePair does not contain phase " << phase.name()
86 << exit(FatalError);
87
88 return -1;
89 }
90}
91
92
94{
95 return g_;
96}
97
98
99// * * * * * * * * * * * * * * * * Iterators * * * * * * * * * * * * * * * * //
100
102(
103 const phasePair& pair,
104 const label index
105)
106:
107 pair_(pair),
108 index_(index)
109{}
110
111
113:
114 const_iterator(pair, 0)
115{}
116
117
119{
120 return index_;
121}
122
123
125(
126 const const_iterator& iter
127) const
128{
129 return (this->index_ == iter.index_);
130}
131
132
134(
135 const const_iterator& iter
136) const
137{
138 return !(this->operator==(iter));
139}
140
141
142inline const Foam::phaseModel&
144{
145 if (index_ == 0)
146 {
147 return pair_.phase1_;
148 }
149 else
150 {
151 return pair_.phase2_;
152 }
153}
154
155
156inline const Foam::phaseModel&
158{
159 return operator*();
160}
161
162
163inline const Foam::phaseModel&
165{
166 if (index_ == 0)
167 {
168 return pair_.phase2_;
169 }
170 else
171 {
172 return pair_.phase1_;
173 }
174}
175
176
179{
180 index_++;
181 return *this;
182}
183
184
187{
188 const_iterator old = *this;
189 this->operator++();
190 return old;
191}
192
193
195{
196 return const_iterator(*this);
197}
198
199
201{
202 return const_iterator(*this, 2);
203}
204
205
207{
208 return const_iterator(*this);
209}
210
211
213{
214 return const_iterator(*this, 2);
215}
216
217
218// ************************************************************************* //
A const_iterator for iterating across on values.
Definition: bitSet.H:505
edgeFaceCirculator & operator++()
Step to next face. Uses no edge addressing!
Ostream & operator()() const
Output stream (master only).
Definition: ensightCaseI.H:74
friend Ostream & operator(Ostream &, const faMatrix< Type > &)
friend forceSuSp operator*(const forceSuSp &susp1, const forceSuSp &susp2)
Addition.
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition: phaseModel.H:61
friend bool operator==(const phasePairKey &a, const phasePairKey &b)
Test for equality.
STL const_iterator.
Definition: phasePair.H:181
const phaseModel & otherPhase() const
Definition: phasePairI.H:164
Description for mass transfer between a pair of phases. The direction of the mass transfer is from th...
Definition: phasePair.H:56
const_iterator cbegin() const
const_iterator set to the beginning of the pair
Definition: phasePairI.H:194
const_iterator begin() const
const_iterator set to the beginning of the pair
Definition: phasePairI.H:206
const uniformDimensionedVectorField & g() const
Return gravitation acceleration.
Definition: phasePairI.H:93
bool contains(const phaseModel &phase) const
Return true if this phasePair contains the given phase.
Definition: phasePairI.H:42
const_iterator end() const
const_iterator set to beyond the end of the pair
Definition: phasePairI.H:212
const_iterator cend() const
const_iterator set to beyond the end of the pair
Definition: phasePairI.H:200
const multiphaseInter::phaseModel & phase1() const
Definition: phasePairI.H:30
const multiphaseInter::phaseModel & phase2() const
Definition: phasePairI.H:36
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition: phase.H:57
const word & name() const
Definition: phase.H:111
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
tmp< faMatrix< Type > > operator*(const areaScalarField::Internal &, const faMatrix< Type > &)
error FatalError
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130