18 enum 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;
92 Path(SpeciesNode* begin, SpeciesNode* end);
102 void addReaction(
size_t rxnNumber, doublereal value,
103 const std::string& label =
"");
106 const SpeciesNode* begin()
const {
109 SpeciesNode* begin() {
114 const SpeciesNode* end()
const {
125 SpeciesNode* otherNode(SpeciesNode* n) {
126 return (n == m_a ? m_b : (n == m_b ? m_a : 0));
133 void setFlow(doublereal v) {
139 return static_cast<int>(m_rxn.size());
143 const rxn_path_map& reactionMap() {
151 void writeLabel(std::ostream& s, doublereal threshold = 0.005);
154 std::map<std::string, doublereal> m_label;
155 SpeciesNode* m_a, *m_b;
185 doublereal
flow(
size_t k1,
size_t k2) {
186 return (m_paths[k1][k2] ? m_paths[k1][k2]->
flow() : 0.0);
191 return (m_nodes[k] != 0);
194 void writeData(std::ostream& s);
216 Path* path(
size_t k1,
size_t k2) {
217 return m_paths[k1][k2];
219 Path* path(
size_t n) {
220 return m_pathlist[n];
223 return m_pathlist.size();
226 return m_nodes.size();
229 void addNode(
size_t k,
const std::string& nm, doublereal x = 0.0);
231 void displayOnly(
size_t k=
npos) {
235 void linkNodes(
size_t k1,
size_t k2,
size_t rxn, doublereal value,
236 std::string legend =
"");
238 void include(
const std::string& aaname) {
239 m_include.push_back(aaname);
241 void exclude(
const std::string& aaname) {
242 m_exclude.push_back(aaname);
244 void include(std::vector<std::string>& names) {
245 for (
size_t i = 0; i < names.size(); i++) {
246 m_include.push_back(names[i]);
249 void exclude(std::vector<std::string>& names) {
250 for (
size_t i = 0; i < names.size(); i++) {
251 m_exclude.push_back(names[i]);
254 std::vector<std::string>& included() {
257 std::vector<std::string>& excluded() {
260 std::vector<size_t> species();
262 void findMajorPaths(doublereal threshold,
size_t lda, doublereal* a);
263 void setFont(
const std::string& font) {
269 std::string bold_color;
270 std::string normal_color;
271 std::string dashed_color;
274 doublereal threshold,
275 bold_min, dashed_max, label_min;
276 doublereal x_size, y_size;
277 std::string name, dot_options;
280 doublereal arrow_width;
282 doublereal arrow_hue;
286 std::map<size_t, std::map<size_t, Path*> > m_paths;
287 std::map<size_t, SpeciesNode*> m_nodes;
288 std::vector<Path*> m_pathlist;
289 std::vector<std::string> m_include;
290 std::vector<std::string> m_exclude;
291 std::vector<size_t> m_speciesNumber;
292 std::map<size_t, int> m_rxns;
297 class ReactionPathBuilder
300 ReactionPathBuilder() {}
301 virtual ~ReactionPathBuilder() {}
303 int init(std::ostream& logfile, Kinetics& s);
305 int build(Kinetics& s,
const std::string& element, std::ostream& output,
306 ReactionPathDiagram& r,
bool quiet=
false);
310 int findGroups(std::ostream& logfile, Kinetics& s);
312 void writeGroup(std::ostream& out,
const Group& g);
315 void findElements(Kinetics& kin);
323 std::vector<std::vector<size_t> > m_reac;
324 std::vector<std::vector<size_t> > m_prod;
325 DenseMatrix m_elatoms;
326 std::vector<std::vector<int> > m_groups;
327 std::vector<Group> m_sgroup;
328 std::vector<std::string> m_elementSymbols;
330 std::map<size_t, std::map<size_t, std::map<size_t, Group> > > m_transfer;
331 std::vector<bool> m_determinate;
333 std::map<std::string, size_t> m_enamemap;
bool visible
Visible on graph;.
void exportToDot(std::ostream &s)
Export the reaction path diagram.
const size_t npos
index returned by functions to indicate "no position"
Nodes in reaction path graphs.
size_t number
Species number.
void addPath(Path *path)
add a path to or from this node
std::vector< int > vector_int
Vector of ints.
doublereal flow(size_t k1, size_t k2)
The one-way flow from node k1 to node k2.
virtual ~ReactionPathDiagram()
Destructor.
bool hasNode(size_t k)
True if a node for species k exists.
virtual ~SpeciesNode()
Destructor.
doublereal value
May be used to set node appearance.
Reaction path diagrams (graphs).
Base class for kinetics managers and also contains the kineticsmgr module documentation (see Kinetics...
std::string name
Label on graph.
doublereal maxFlow()
The largest one-way flow value in any path.
SpeciesNode()
Default constructor.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Headers for the DenseMatrix object, which deals with dense rectangular matrices and description of th...
int nPaths() const
Total number of paths to or from this node.
doublereal netFlow(size_t k1, size_t k2)
The net flow from node k1 to node k2.