reaction.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) 2020-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 Class
25  Foam::reaction
26 
27 Description
28  Reaction base-class holding the specie names and coefficients
29 
30 SourceFiles
31  reactionI.H
32  reaction.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef reaction_H
37 #define reaction_H
38 
39 #include "speciesTable.H"
40 #include "specieCoeffs.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 // Forward declaration of friend functions and operators
48 
49 class reaction;
50 
51 inline Ostream& operator<<(Ostream&, const reaction&);
52 
53 /*---------------------------------------------------------------------------*\
54  Class reaction Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class reaction
58 {
59 
60 public:
61 
62  // Static data
63 
64  //- Number of un-named reactions
65  static label nUnNamedReactions;
66 
67 
68 private:
69 
70  // Private Data
71 
72  //- Name of reaction
73  const word name_;
74 
75  //- List of specie names present in reaction system
76  const speciesTable& species_;
77 
78  //- Specie info for the left-hand-side of the reaction
79  List<specieCoeffs> lhs_;
80 
81  //- Specie info for the right-hand-side of the reaction
82  List<specieCoeffs> rhs_;
83 
84 
85  // Private Member Functions
86 
87  //- Return new reaction ID for un-named reactions
88  label getNewReactionIndex();
89 
90 
91 public:
92 
93  // Constructors
94 
95  //- Construct from components
96  reaction
97  (
98  const speciesTable& species,
99  const List<specieCoeffs>& lhs,
100  const List<specieCoeffs>& rhs
101  );
102 
103  //- Construct as copy given new speciesTable
104  reaction(const reaction&, const speciesTable& species);
105 
106  //- Construct from dictionary
107  reaction
108  (
109  const speciesTable& species,
110  const dictionary& dict
111  );
112 
113 
114  //- Destructor
115  ~reaction()
116  {}
117 
118 
119  // Member Functions
120 
121  // Access
122 
123  //- Return the name of the reaction
124  inline const word& name() const;
125 
126  //- Return the components of the left hand side
127  inline const List<specieCoeffs>& lhs() const;
128 
129  //- Return the components of the right hand side
130  inline const List<specieCoeffs>& rhs() const;
131 
132  //- Return the specie list
133  inline const speciesTable& species() const;
134 
135 
136  //- Write
137  void write(Ostream&) const;
138 
139 
140  // Member Operators
141 
142  //- Disallow default bitwise assignment
143  void operator=(const reaction&) = delete;
144 
145 
146  // Ostream Operator
147 
148  friend Ostream& operator<<(Ostream&, const reaction&);
149 };
150 
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 } // End namespace Foam
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 #include "reactionI.H"
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 #endif
163 
164 // ************************************************************************* //
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:91
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
A wordList with hashed indices for faster lookup by name.
Reaction base-class holding the specie names and coefficients.
Definition: reaction.H:57
void operator=(const reaction &)=delete
Disallow default bitwise assignment.
void write(Ostream &) const
Write.
Definition: reaction.C:93
static label nUnNamedReactions
Number of un-named reactions.
Definition: reaction.H:64
const speciesTable & species() const
Return the specie list.
Definition: reactionI.H:48
friend Ostream & operator<<(Ostream &, const reaction &)
~reaction()
Destructor.
Definition: reaction.H:114
const List< specieCoeffs > & lhs() const
Return the components of the left hand side.
Definition: reactionI.H:36
const List< specieCoeffs > & rhs() const
Return the components of the right hand side.
Definition: reactionI.H:42
const word & name() const
Return the name of the reaction.
Definition: reactionI.H:30
reaction(const speciesTable &species, const List< specieCoeffs > &lhs, const List< specieCoeffs > &rhs)
Construct from components.
Definition: reaction.C:46
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
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
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)
dictionary dict