18enum flow_t { NetFlow, OneWayFlow };
22class ReactionPathBuilder;
50 const Path* path(
int n)
const {
57 return static_cast<int>(m_paths.size());
78 vector<Path*> m_paths;
85 typedef map<size_t, double> rxn_path_map;
99 void addReaction(
size_t rxnNumber,
double value,
const string& label =
"");
122 return (n == m_a ? m_b : (n == m_b ? m_a : 0));
129 void setFlow(
double v) {
135 return static_cast<int>(m_rxn.size());
147 void writeLabel(std::ostream& s,
double threshold = 0.005);
150 map<string, double> m_label;
153 double m_total = 0.0;
190 double flow(
size_t k1,
size_t k2) {
191 return (m_paths[k1][k2] ? m_paths[k1][k2]->
flow() : 0.0);
199 void writeData(std::ostream& s);
232 void add(shared_ptr<ReactionPathDiagram> d);
237 Path* path(
size_t k1,
size_t k2) {
238 return m_paths[k1][k2];
240 Path* path(
size_t n) {
241 return m_pathlist[n];
244 return m_pathlist.size();
250 void addNode(
size_t k,
const string& nm,
double x = 0.0);
258 void linkNodes(
size_t k1,
size_t k2,
size_t rxn,
double value,
string legend =
"");
260 void include(
const string& aaname) {
261 m_include.push_back(aaname);
263 void exclude(
const string& aaname) {
264 m_exclude.push_back(aaname);
266 void include(vector<string>& names) {
267 for (
size_t i = 0; i < names.size(); i++) {
268 m_include.push_back(names[i]);
271 void exclude(vector<string>& names) {
272 for (
size_t i = 0; i < names.size(); i++) {
273 m_exclude.push_back(names[i]);
276 vector<string>& included() {
279 vector<string>& excluded() {
282 vector<size_t> species();
283 vector<int> reactions();
328 string name =
"reaction_paths";
343 double m_flxmax = 0.0;
344 map<size_t, map<size_t, Path*>> m_paths;
348 vector<Path*> m_pathlist;
349 vector<string> m_include;
350 vector<string> m_exclude;
351 vector<size_t> m_speciesNumber;
355 size_t m_local =
npos;
370 int init(std::ostream& logfile,
Kinetics& s);
372 int build(
Kinetics& s,
const string& element, std::ostream& output,
384 vector<double> m_ropf;
385 vector<double> m_ropr;
387 vector<vector<size_t>> m_reac;
388 vector<vector<size_t>> m_prod;
390 vector<vector<int>> m_groups;
391 vector<Group> m_sgroup;
392 vector<string> m_elementSymbols;
399 vector<bool> m_determinate;
401 map<string, size_t> m_enamemap;
414 shared_ptr<Kinetics> kin,
const string& element);
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
shared_ptr< ReactionPathBuilder > m_builder
Shared pointer to ReactionPathBuilder.
string element
Element used for the construction of a reaction path diagram.
string getDot()
Export string in dot format.
double arrow_width
The arrow width. If < 0, then scale with flux value.
bool m_isBuilt
Boolean indicating whether diagram is built.
string title
Reaction path diagram title.
std::stringstream m_log
Logging stream.
void exportToDot(std::ostream &s)
Export the reaction path diagram.
string dashed_color
Color for dashed lines.
void findMajorPaths(double threshold, size_t lda, double *a)
Undocumented.
void displayOnly(size_t k=npos)
Include only species and fluxes that are directly connected to a species.
bool hasNode(size_t k)
True if a node for species k exists.
double y_size
Maximum size (y-dimension).
string dot_options
Options for the 'dot' program.
void build()
Build the reaction path diagram.
string normal_color
Color for normal-weight lines.
double scale
The scaling factor for the fluxes.
bool show_details
Boolean flag to show details.
double dashed_max
Maximum relative flux for dashed lines.
string m_font
Reaction path diagram font.
string name
Name used for dot export.
string getLog()
Get logging messages generated while building the reaction path diagram.
double x_size
Maximum size (x-dimension).
shared_ptr< Kinetics > m_kin
Kinetics used by ReactionPathBuilder.
double label_min
Minimum relative flux for labels.
set< size_t > m_rxns
Indices of reactions that are included in the diagram.
void setFlowType(const string &fType)
Get the way flows are drawn. Either 'NetFlow' or 'OneWayFlow'.
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.
double bold_min
Minimum relative flux for bold lines.
const string flowType() const
Get the way flows are drawn. Either 'NetFlow' or 'OneWayFlow'.
void setFont(const string &font)
Set name of the font used.
flow_t flow_type
The way flows are drawn. Either 'NetFlow' or 'OneWayFlow'.
string bold_color
Color for bold lines.
string getData()
Get a (roughly) human-readable representation of the reaction path diagram.
double threshold
Threshold for the minimum flux relative value that will be plotted.
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"
shared_ptr< ReactionPathDiagram > newReactionPathDiagram(shared_ptr< Kinetics > kin, const string &element)
Create a new reaction path diagram.