18enum flow_t { NetFlow, OneWayFlow };
49 const Path* path(
int n)
const {
56 return static_cast<int>(m_paths.size());
77 vector<Path*> m_paths;
84 typedef map<size_t, double> rxn_path_map;
98 void addReaction(
size_t rxnNumber,
double value,
const string& label =
"");
121 return (n == m_a ? m_b : (n == m_b ? m_a : 0));
128 void setFlow(
double v) {
134 return static_cast<int>(m_rxn.size());
146 void writeLabel(std::ostream& s,
double threshold = 0.005);
149 map<string, double> m_label;
152 double m_total = 0.0;
180 double flow(
size_t k1,
size_t k2) {
181 return (m_paths[k1][k2] ? m_paths[k1][k2]->
flow() : 0.0);
189 void writeData(std::ostream& s);
209 Path* path(
size_t k1,
size_t k2) {
210 return m_paths[k1][k2];
212 Path* path(
size_t n) {
213 return m_pathlist[n];
216 return m_pathlist.size();
222 void addNode(
size_t k,
const string& nm,
double x = 0.0);
224 void displayOnly(
size_t k=
npos) {
228 void linkNodes(
size_t k1,
size_t k2,
size_t rxn,
double value,
string legend =
"");
230 void include(
const string& aaname) {
231 m_include.push_back(aaname);
233 void exclude(
const string& aaname) {
234 m_exclude.push_back(aaname);
236 void include(vector<string>& names) {
237 for (
size_t i = 0; i < names.size(); i++) {
238 m_include.push_back(names[i]);
241 void exclude(vector<string>& names) {
242 for (
size_t i = 0; i < names.size(); i++) {
243 m_exclude.push_back(names[i]);
246 vector<string>& included() {
249 vector<string>& excluded() {
252 vector<size_t> species();
253 vector<int> reactions();
254 void findMajorPaths(
double threshold,
size_t lda,
double* a);
255 void setFont(
const string& font) {
261 string bold_color =
"blue";
262 string normal_color =
"steelblue";
263 string dashed_color =
"gray";
265 string m_font =
"Helvetica";
266 double threshold = 0.005;
267 double bold_min = 0.2;
268 double dashed_max = 0.0;
269 double label_min = 0.0;
270 double x_size = -1.0;
271 double y_size = -1.0;
272 string name =
"reaction_paths";
273 string dot_options =
"center=1;";
274 flow_t flow_type = NetFlow;
276 double arrow_width = -5.0;
277 bool show_details =
false;
278 double arrow_hue = 0.6666;
281 double m_flxmax = 0.0;
282 map<size_t, map<size_t, Path*>> m_paths;
286 vector<Path*> m_pathlist;
287 vector<string> m_include;
288 vector<string> m_exclude;
289 vector<size_t> m_speciesNumber;
293 size_t m_local =
npos;
303 int init(std::ostream& logfile,
Kinetics& s);
305 int build(
Kinetics& s,
const string& element, std::ostream& output,
317 vector<double> m_ropf;
318 vector<double> m_ropr;
320 vector<vector<size_t>> m_reac;
321 vector<vector<size_t>> m_prod;
323 vector<vector<int>> m_groups;
324 vector<Group> m_sgroup;
325 vector<string> m_elementSymbols;
332 vector<bool> m_determinate;
334 map<string, size_t> m_enamemap;
Headers for the DenseMatrix object, which deals with dense rectangular matrices and description of th...
Base class for kinetics managers and also contains the kineticsmgr module documentation (see Kinetics...
A class for 2D arrays stored in column-major (Fortran-compatible) form.
A class for full (non-sparse) matrices with Fortran-compatible data storage, which adds matrix operat...
Public interface for kinetics managers.
virtual ~Path()
Destructor.
const SpeciesNode * begin() const
Upstream node.
int nReactions()
Number of reactions contributing to this path.
void addReaction(size_t rxnNumber, double value, const string &label="")
Add a reaction to the path.
void writeLabel(std::ostream &s, double threshold=0.005)
Write the label for a path connecting two species, indicating the percent of the total flow due to ea...
double flow()
The total flow in this path.
SpeciesNode * otherNode(SpeciesNode *n)
If n is one of the nodes this path connects, then the other node is returned.
const rxn_path_map & reactionMap()
Map from reaction number to flow from that reaction in this path.
const SpeciesNode * end() const
Downstream node.
int findGroups(std::ostream &logfile, Kinetics &s)
Analyze a reaction to determine which reactants lead to which products.
map< size_t, map< size_t, map< size_t, Group > > > m_transfer
m_transfer[reaction][reactant number][product number] where "reactant number" means the number of the...
Reaction path diagrams (graphs).
map< size_t, SpeciesNode * > m_nodes
map of species index to SpeciesNode
void exportToDot(std::ostream &s)
Export the reaction path diagram.
bool hasNode(size_t k)
True if a node for species k exists.
set< size_t > m_rxns
Indices of reactions that are included in the diagram.
virtual ~ReactionPathDiagram()
Destructor.
double maxFlow()
The largest one-way flow value in any path.
double flow(size_t k1, size_t k2)
The one-way flow from node k1 to node k2.
double netFlow(size_t k1, size_t k2)
The net flow from node k1 to node k2.
Nodes in reaction path graphs.
virtual ~SpeciesNode()=default
Destructor.
string name
Label on graph.
bool visible
Visible on graph;.
int nPaths() const
Total number of paths to or from this node.
SpeciesNode()=default
Default constructor.
double value
May be used to set node appearance.
size_t number
Species number.
void addPath(Path *path)
add a path to or from this node
Namespace for the Cantera kernel.
const size_t npos
index returned by functions to indicate "no position"