Loading...
Searching...
No Matches
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
36inline const Foam::phaseModel& Foam::phasePair::phase2() const
37{
38 return phase2_;
39}
40
42inline bool Foam::phasePair::contains(const phaseModel& phase) const
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()
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()
87
88 return -1;
89 }
90}
91
92
94{
95 return g_;
96}
97
98
99// * * * * * * * * * * * * * * * * Iterators * * * * * * * * * * * * * * * * //
100
101inline Foam::phasePair::const_iterator::const_iterator
102(
103 const phasePair& pair,
104 const label index
106:
107 pair_(pair),
108 index_(index)
109{}
110
112inline Foam::phasePair::const_iterator::const_iterator(const phasePair& pair)
113:
114 const_iterator(pair, 0)
115{}
116
118inline Foam::label Foam::phasePair::const_iterator::index() const
119{
120 return index_;
121}
122
123
124inline bool Foam::phasePair::const_iterator::operator==
125(
126 const const_iterator& iter
127) const
128{
129 return (this->index_ == iter.index_);
130}
131
132
133inline bool Foam::phasePair::const_iterator::operator!=
134(
135 const const_iterator& iter
136) const
137{
138 return !(this->operator==(iter));
139}
140
141
142inline const Foam::phaseModel&
143Foam::phasePair::const_iterator::operator*() const
144{
145 if (index_ == 0)
146 {
147 return pair_.phase1_;
148 }
149 else
151 return pair_.phase2_;
152 }
153}
154
155
156inline const Foam::phaseModel&
158{
159 return operator*();
160}
161
162
163inline const Foam::phaseModel&
164Foam::phasePair::const_iterator::otherPhase() const
165{
166 if (index_ == 0)
167 {
168 return pair_.phase2_;
169 }
170 else
172 return pair_.phase1_;
173 }
174}
175
176
178Foam::phasePair::const_iterator::operator++()
180 index_++;
181 return *this;
182}
183
184
186Foam::phasePair::const_iterator::operator++(int)
188 const_iterator old = *this;
189 this->operator++();
190 return old;
191}
192
197}
198
201{
202 return const_iterator(*this, 2);
203}
204
209}
210
211
213{
214 return const_iterator(*this, 2);
215}
216
217
218// ************************************************************************* //
const T * const_iterator
Random access iterator for traversing FixedList.
Definition FixedList.H:135
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition phaseModel.H:56
friend bool operator==(const phasePairKey &a, const phasePairKey &b)
Test for equality.
const phaseModel & operator*() const
Definition phasePairI.H:136
const_iterator & operator++()
Definition phasePairI.H:171
const phaseModel & otherPhase() const
Definition phasePairI.H:157
const phaseModel & operator()() const
Definition phasePairI.H:150
label index() const
Return the current index.
Definition phasePairI.H:111
Description for mass transfer between a pair of phases. The direction of the mass transfer is from th...
Definition phasePair.H:52
const_iterator cbegin() const
const_iterator set to the beginning of the pair
Definition phasePairI.H:187
const phaseModel & otherPhase(const phaseModel &phase) const
Return the other phase relative to the given phase.
Definition phasePairI.H:42
const_iterator begin() const
const_iterator set to the beginning of the pair
Definition phasePairI.H:199
label index(const phaseModel &phase) const
Return the index of the given phase. Generates a FatalError if.
Definition phasePairI.H:65
const uniformDimensionedVectorField & g() const
Return gravitation acceleration.
Definition phasePairI.H:86
bool contains(const phaseModel &phase) const
Return true if this phasePair contains the given phase.
Definition phasePairI.H:35
const_iterator end() const
const_iterator set to beyond the end of the pair
Definition phasePairI.H:205
const_iterator cend() const
const_iterator set to beyond the end of the pair
Definition phasePairI.H:193
const multiphaseInter::phaseModel & phase1() const
Definition phasePairI.H:23
const multiphaseInter::phaseModel & phase2() const
Definition phasePairI.H:29
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition phase.H:53
const word & name() const
Definition phase.H:114
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
tmp< faMatrix< Type > > operator*(const areaScalarField::Internal &, const faMatrix< Type > &)
UniformDimensionedField< vector > uniformDimensionedVectorField
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition errorManip.H:125