Cantera
Install
User Guide
Examples
Reference
Develop
Community
4.0.0a2
Toggle main menu visibility
Loading...
Searching...
No Matches
Group.cpp
Go to the documentation of this file.
1
/**
2
* @file Group.cpp Implementation file for the Group class used in reaction path
3
* analysis.
4
*/
5
6
// This file is part of Cantera. See License.txt in the top-level directory or
7
// at https://cantera.org/license.txt for license and copyright information.
8
9
#include "
cantera/kinetics/Group.h
"
10
#include <iostream>
11
12
namespace
Cantera
13
{
14
15
void
Group::validate
()
16
{
17
// if already checked and not valid, return
18
if
(m_sign == -999) {
19
return
;
20
}
21
22
m_sign = 0;
23
bool
ok =
true
;
24
for
(
size_t
m = 0; m < m_comp.size(); m++) {
25
if
(m_comp[m] != 0) {
26
if
(m_sign == 0) {
27
m_sign = m_comp[m]/abs(m_comp[m]);
28
}
else
if
(m_sign * m_comp[m] < 0) {
29
ok =
false
;
30
break
;
31
}
32
}
33
}
34
if
(!ok) {
35
m_sign = -999;
36
}
37
}
38
39
std::ostream& Group::fmt(std::ostream& s, span<const string> esymbols)
const
40
{
41
s <<
"("
;
42
bool
first =
true
;
43
for
(
size_t
m = 0; m < m_comp.size(); m++) {
44
int
nm = m_comp[m];
45
if
(nm != 0) {
46
if
(!first) {
47
s <<
"-"
;
48
}
49
s << esymbols[m];
50
if
(nm != 1) {
51
s << nm;
52
}
53
first =
false
;
54
}
55
}
56
s <<
")"
;
57
return
s;
58
}
59
60
}
Group.h
Cantera::Group::validate
void validate()
A group is 'valid' if all of its nonzero atom numbers have the same sign, either positive or negative...
Definition
Group.cpp:15
Cantera
Namespace for the Cantera kernel.
Definition
AnyMap.cpp:595
src
kinetics
Group.cpp
Generated by
1.17.0