specieCoeffs.H
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) 2019 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::specieCoeffs
26 
27 Description
28  Class to hold the specie index and its coefficients in the
29  reaction rate expression.
30 
31 SourceFiles
32  specieCoeffs.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef specieCoeffs_H
37 #define specieCoeffs_H
38 
39 #include "speciesTable.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 // Forward declaration of friend functions and operators
47 class specieCoeffs;
48 Ostream& operator<<(Ostream&, const specieCoeffs&);
49 
50 
51 /*---------------------------------------------------------------------------*\
52  Class specieCoeffs Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 class specieCoeffs
56 {
57 public:
58 
60  scalar stoichCoeff;
61  scalar exponent;
62 
63  specieCoeffs()
64  :
65  index(-1),
66  stoichCoeff(0),
67  exponent(1)
68  {}
69 
70  specieCoeffs(const speciesTable& species, Istream& is);
71 
72  bool operator==(const specieCoeffs& sc) const
73  {
74  return index == sc.index;
75  }
76 
77  bool operator!=(const specieCoeffs& sc) const
78  {
79  return index != sc.index;
80  }
81 
82  friend Ostream& operator<<(Ostream& os, const specieCoeffs& sc)
83  {
84  os << sc.index << token::SPACE
85  << sc.stoichCoeff << token::SPACE
86  << sc.exponent;
87  return os;
88  }
89 
90  //- Construct the left- and right-hand-side reaction coefficients
91  static void setLRhs
92  (
93  Istream&,
94  const speciesTable&,
95  List<specieCoeffs>& lhs,
97  );
98 
99  //- Write the string representation of the specieCoeffs list
100  static void reactionStr
101  (
103  const speciesTable&,
104  const List<specieCoeffs>& scs
105  );
106 
107  //- Return string representation of reaction
108  static string reactionStr
109  (
110  OStringStream& reaction,
111  const speciesTable&,
112  const List<specieCoeffs>& lhs,
113  const List<specieCoeffs>& rhs
114  );
115 };
116 
117 
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 
120 } // End namespace Foam
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 #endif
125 
126 // ************************************************************************* //
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
Class to hold the specie index and its coefficients in the reaction rate expression.
Definition: specieCoeffs.H:54
bool operator!=(const specieCoeffs &sc) const
Definition: specieCoeffs.H:76
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
static void reactionStr(OStringStream &reaction, const speciesTable &, const List< specieCoeffs > &scs)
Write the string representation of the specieCoeffs list.
Definition: specieCoeffs.C:177
CombustionModel< rhoReactionThermo > & reaction
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
static void setLRhs(Istream &, const speciesTable &, List< specieCoeffs > &lhs, List< specieCoeffs > &rhs)
Construct the left- and right-hand-side reaction coefficients.
Definition: specieCoeffs.C:95
A wordList with hashed indices for faster lookup by name.
Ostream & operator<<(Ostream &, const ensightPart &)
bool operator==(const specieCoeffs &sc) const
Definition: specieCoeffs.H:71
friend Ostream & operator<<(Ostream &os, const specieCoeffs &sc)
Definition: specieCoeffs.H:81
Output to memory buffer stream.
Definition: OStringStream.H:49
Namespace for OpenFOAM.