8#ifndef CT_RXNPATH_GROUP
9#define CT_RXNPATH_GROUP
23 Group() : m_sign(-999) { }
24 Group(
size_t n) : m_sign(0) {
27 Group(span<const int> elnumbers)
28 : m_comp(elnumbers.begin()
34 Group(span<const size_t> elnumbers) :
35 m_comp(elnumbers.size()), m_sign(0)
37 for (
size_t i = 0; i < elnumbers.size(); i++) {
38 m_comp[i] = int(elnumbers[i]);
43 m_comp(g.m_comp), m_sign(g.m_sign) { }
57 for (
size_t m = 0; m < m_comp.size(); m++) {
58 m_comp[m] -= other.m_comp[m];
62 void operator+=(
const Group& other) {
63 for (
size_t m = 0; m < m_comp.size(); m++) {
64 m_comp[m] += other.m_comp[m];
68 void operator*=(
int a) {
69 for (
size_t m = 0; m < m_comp.size(); m++) {
74 bool operator==(
const Group& other)
const {
75 for (
size_t m = 0; m < m_comp.size(); m++) {
76 if (m_comp[m] != other.m_comp[m]) {
82 friend Group operator-(
const Group& g1,
const Group& g2) {
87 friend Group operator+(
const Group& g1,
const Group& g2) {
104 return (m_sign != -999);
106 bool operator!()
const {
107 return (m_sign == -999);
112 size_t size()
const {
113 return m_comp.size();
119 for (
size_t m = 0; m < m_comp.size(); m++) {
120 sum += std::abs(m_comp[m]);
126 if (m_comp.empty()) {
132 std::ostream& fmt(std::ostream& s, span<const string> esymbols)
const;
Class Group is an internal class used by class ReactionPath.
bool valid() const
True if all non-zero atom numbers have the same sign.
void validate()
A group is 'valid' if all of its nonzero atom numbers have the same sign, either positive or negative...
int nAtoms() const
Number of atoms in the group (>= 0)
void operator-=(const Group &other)
Decrement the atom numbers by those in group 'other'.
int nAtoms(size_t m) const
Number of atoms of element m (positive or negative)
This file contains definitions of constants, types and terms that are used in internal routines and a...
Namespace for the Cantera kernel.