18enum flow_t { NetFlow, OneWayFlow };
31 visible(false), m_in(0.0), m_out(0.0) {}
51 const Path* path(
int n)
const {
58 return static_cast<int>(m_paths.size());
64 doublereal outflow() {
70 doublereal netOutflow() {
79 std::vector<Path*> m_paths;
86 typedef std::map<size_t, doublereal> rxn_path_map;
91 Path(SpeciesNode* begin, SpeciesNode* end);
100 void addReaction(
size_t rxnNumber, doublereal value,
101 const std::string& label =
"");
104 const SpeciesNode* begin()
const {
107 SpeciesNode* begin() {
112 const SpeciesNode* end()
const {
123 SpeciesNode* otherNode(SpeciesNode* n) {
124 return (n == m_a ? m_b : (n == m_b ? m_a : 0));
131 void setFlow(doublereal v) {
137 return static_cast<int>(m_rxn.size());
141 const rxn_path_map& reactionMap() {
149 void writeLabel(std::ostream& s, doublereal threshold = 0.005);
152 std::map<std::string, doublereal> m_label;
153 SpeciesNode* m_a, *m_b;
183 doublereal
flow(
size_t k1,
size_t k2) {
184 return (m_paths[k1][k2] ? m_paths[k1][k2]->
flow() : 0.0);
189 return (m_nodes[k] != 0);
192 void writeData(std::ostream& s);
212 Path* path(
size_t k1,
size_t k2) {
213 return m_paths[k1][k2];
215 Path* path(
size_t n) {
216 return m_pathlist[n];
219 return m_pathlist.size();
222 return m_nodes.size();
225 void addNode(
size_t k,
const std::string& nm, doublereal x = 0.0);
227 void displayOnly(
size_t k=
npos) {
231 void linkNodes(
size_t k1,
size_t k2,
size_t rxn, doublereal value,
232 std::string legend =
"");
234 void include(
const std::string& aaname) {
235 m_include.push_back(aaname);
237 void exclude(
const std::string& aaname) {
238 m_exclude.push_back(aaname);
240 void include(std::vector<std::string>& names) {
241 for (
size_t i = 0; i < names.size(); i++) {
242 m_include.push_back(names[i]);
245 void exclude(std::vector<std::string>& names) {
246 for (
size_t i = 0; i < names.size(); i++) {
247 m_exclude.push_back(names[i]);
250 std::vector<std::string>& included() {
253 std::vector<std::string>& excluded() {
256 std::vector<size_t> species();
258 void findMajorPaths(doublereal threshold,
size_t lda, doublereal* a);
259 void setFont(
const std::string& font) {
265 std::string bold_color;
266 std::string normal_color;
267 std::string dashed_color;
270 doublereal threshold, bold_min, dashed_max, label_min;
271 doublereal x_size, y_size;
272 std::string name, dot_options;
275 doublereal arrow_width;
277 doublereal arrow_hue;
281 std::map<size_t, std::map<size_t, Path*> > m_paths;
282 std::map<size_t, SpeciesNode*> m_nodes;
283 std::vector<Path*> m_pathlist;
284 std::vector<std::string> m_include;
285 std::vector<std::string> m_exclude;
286 std::vector<size_t> m_speciesNumber;
287 std::map<size_t, int> m_rxns;
292class ReactionPathBuilder
295 ReactionPathBuilder() {}
296 virtual ~ReactionPathBuilder() {}
298 int init(std::ostream& logfile, Kinetics& s);
300 int build(Kinetics& s,
const std::string& element, std::ostream& output,
301 ReactionPathDiagram& r,
bool quiet=
false);
304 int findGroups(std::ostream& logfile, Kinetics& s);
307 void findElements(Kinetics& kin);
315 std::vector<std::vector<size_t> > m_reac;
316 std::vector<std::vector<size_t> > m_prod;
317 DenseMatrix m_elatoms;
318 std::vector<vector_int> m_groups;
319 std::vector<Group> m_sgroup;
320 std::vector<std::string> m_elementSymbols;
325 std::map<size_t, std::map<size_t, std::map<size_t, Group> > > m_transfer;
327 std::vector<bool> m_determinate;
329 std::map<std::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...
Reaction path diagrams (graphs).
doublereal maxFlow()
The largest one-way flow value in any path.
doublereal netFlow(size_t k1, size_t k2)
The net flow from node k1 to node k2.
void exportToDot(std::ostream &s)
Export the reaction path diagram.
bool hasNode(size_t k)
True if a node for species k exists.
virtual ~ReactionPathDiagram()
Destructor.
doublereal flow(size_t k1, size_t k2)
The one-way flow from node k1 to node k2.
Nodes in reaction path graphs.
virtual ~SpeciesNode()
Destructor.
doublereal value
May be used to set node appearance.
std::string name
Label on graph.
bool visible
Visible on graph;.
int nPaths() const
Total number of paths to or from this node.
SpeciesNode()
Default constructor.
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"
std::vector< int > vector_int
Vector of ints.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.