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-2021 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 "specieExponent.H"
40 #include "speciesTable.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 // Forward declaration of friend functions and operators
48 class specieCoeffs;
49 Ostream& operator<<(Ostream&, const specieCoeffs&);
50 
51 /*---------------------------------------------------------------------------*\
52  Class specieCoeffs Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 class specieCoeffs
56 {
57 public:
58 
59  // Public Data
60 
61  //- Index of the specie
62  label index;
63 
64  //- Stoichiometric coefficient
65  scalar stoichCoeff;
66 
67  //- Exponent of the specie concentration
69 
70 
71  // Constructors
72 
73  //- Construct null
74  specieCoeffs()
75  :
76  index(-labelMax),
77  stoichCoeff(NaN),
78  exponent()
79  {}
80 
81  //- Construct from species table and input stream
82  specieCoeffs(const speciesTable& species, Istream& is);
83 
84 
85  // Member Functions
86 
87  //- Construct the left- and right-hand-side reaction coefficients
88  static void setLRhs
89  (
90  Istream&,
91  const speciesTable&,
92  List<specieCoeffs>& lhs,
94  );
95 
96  //- Write the string representation of the specieCoeffs list
97  static void reactionStr
98  (
100  const speciesTable&,
101  const List<specieCoeffs>& scs
102  );
103 
104  //- Return string representation of reaction
105  static string reactionStr
106  (
107  OStringStream& reaction,
108  const speciesTable&,
109  const List<specieCoeffs>& lhs,
110  const List<specieCoeffs>& rhs
111  );
112 
113 
114  // Member Operators
115 
116  //- Equality comparison
117  bool operator==(const specieCoeffs& sc) const
118  {
119  return index == sc.index;
120  }
121 
122  //- Inequality comparison
123  bool operator!=(const specieCoeffs& sc) const
124  {
125  return index != sc.index;
126  }
127 
128  //- Write to output stream
129  friend Ostream& operator<<(Ostream& os, const specieCoeffs& sc)
130  {
131  os << sc.index << token::SPACE
132  << sc.stoichCoeff << token::SPACE
133  << sc.exponent;
134  return os;
135  }
136 };
137 
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 } // End namespace Foam
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 
145 #endif
146 
147 // ************************************************************************* //
Class to hold the specie index and its coefficients in the reaction rate expression.
Definition: specieCoeffs.H:54
bool operator!=(const specieCoeffs &sc) const
Inequality comparison.
Definition: specieCoeffs.H:122
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
Reaction base-class holding the specie names and coefficients.
Definition: reaction.H:56
static void reactionStr(OStringStream &reaction, const speciesTable &, const List< specieCoeffs > &scs)
Write the string representation of the specieCoeffs list.
Definition: specieCoeffs.C:177
specieExponent exponent
Exponent of the specie concentration.
Definition: specieCoeffs.H:67
scalar stoichCoeff
Stoichiometric coefficient.
Definition: specieCoeffs.H:64
static const label labelMax
Definition: label.H:62
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
label index
Index of the specie.
Definition: specieCoeffs.H:61
A wordList with hashed indices for faster lookup by name.
Ostream & operator<<(Ostream &, const ensightPart &)
bool operator==(const specieCoeffs &sc) const
Equality comparison.
Definition: specieCoeffs.H:116
friend Ostream & operator<<(Ostream &os, const specieCoeffs &sc)
Write to output stream.
Definition: specieCoeffs.H:128
Output to memory buffer stream.
Definition: OStringStream.H:49
specieCoeffs()
Construct null.
Definition: specieCoeffs.H:73
Namespace for OpenFOAM.