Cantera  3.2.0a2
Loading...
Searching...
No Matches
ctrdiag.cpp
Go to the documentation of this file.
1/**
2 * CTRDIAG - Generated CLib %Cantera interface library.
3 *
4 * @file ctrdiag.cpp
5 *
6 * Generated CLib API for Cantera's ReactionPathDiagram class.
7 *
8 * This file was generated by sourcegen. It will be re-generated by the
9 * %Cantera build process. Do not manually edit.
10 *
11 * @warning This module is an experimental part of the %Cantera API and
12 * may be changed without notice.
13 */
14
15// This file is part of Cantera. See License.txt in the top-level directory or
16// at https://cantera.org/license.txt for license and copyright information.
17
18#include "clib_utils.h"
20
25
26using namespace Cantera;
27
28//! @cond
29//! Cabinet type definitions will be ignored by Doxygen
30
31// Define Cabinet<ReactionPathDiagram> (single-instance object)
32typedef Cabinet<ReactionPathDiagram> ReactionPathDiagramCabinet;
33template<> ReactionPathDiagramCabinet* ReactionPathDiagramCabinet::s_storage = 0; // initialized here
34
35typedef Cabinet<Kinetics> KineticsCabinet;
36template<> KineticsCabinet* KineticsCabinet::s_storage; // initialized elsewhere
37
38//! @endcond
39
40extern "C" {
41
42 int32_t rdiag_newReactionPathDiagram(int32_t kin, const char* element)
43 {
44 // constructor: shared_ptr<ReactionPathDiagram> newReactionPathDiagram(shared_ptr<Kinetics>, const string&)
45 try {
46 return ReactionPathDiagramCabinet::add(newReactionPathDiagram(KineticsCabinet::at(kin), element));
47 } catch (...) {
48 return handleAllExceptions(-2, ERR);
49 }
50 }
51
52 int32_t rdiag_showDetails(int handle)
53 {
54 // variable (getter): variable getter: show_details
55 try {
56 bool out = ReactionPathDiagramCabinet::at(handle)->show_details;
57 return int(out);
58 } catch (...) {
59 return handleAllExceptions(-1, ERR);
60 }
61 }
62
63 int32_t rdiag_setShowDetails(int32_t handle, int32_t show_details)
64 {
65 // variable (setter): variable setter: show_details
66 try {
67 bool show_details_ = (show_details != 0);
68 ReactionPathDiagramCabinet::at(handle)->show_details = show_details_;
69 return 0;
70 } catch (...) {
71 return handleAllExceptions(ERR, ERR);
72 }
73 }
74
75 double rdiag_threshold(int handle)
76 {
77 // variable (getter): variable getter: threshold
78 try {
79 return ReactionPathDiagramCabinet::at(handle)->threshold;
80 } catch (...) {
81 return handleAllExceptions(DERR, DERR);
82 }
83 }
84
85 int32_t rdiag_setThreshold(int32_t handle, double threshold)
86 {
87 // variable (setter): variable setter: threshold
88 try {
89 ReactionPathDiagramCabinet::at(handle)->threshold = threshold;
90 return 0;
91 } catch (...) {
92 return handleAllExceptions(ERR, ERR);
93 }
94 }
95
96 double rdiag_boldThreshold(int handle)
97 {
98 // variable (getter): variable getter: bold_min
99 try {
100 return ReactionPathDiagramCabinet::at(handle)->bold_min;
101 } catch (...) {
102 return handleAllExceptions(DERR, DERR);
103 }
104 }
105
106 int32_t rdiag_setBoldThreshold(int32_t handle, double bold_min)
107 {
108 // variable (setter): variable setter: bold_min
109 try {
110 ReactionPathDiagramCabinet::at(handle)->bold_min = bold_min;
111 return 0;
112 } catch (...) {
113 return handleAllExceptions(ERR, ERR);
114 }
115 }
116
117 double rdiag_normalThreshold(int handle)
118 {
119 // variable (getter): variable getter: dashed_max
120 try {
121 return ReactionPathDiagramCabinet::at(handle)->dashed_max;
122 } catch (...) {
123 return handleAllExceptions(DERR, DERR);
124 }
125 }
126
127 int32_t rdiag_setNormalThreshold(int32_t handle, double dashed_max)
128 {
129 // variable (setter): variable setter: dashed_max
130 try {
131 ReactionPathDiagramCabinet::at(handle)->dashed_max = dashed_max;
132 return 0;
133 } catch (...) {
134 return handleAllExceptions(ERR, ERR);
135 }
136 }
137
138 double rdiag_labelThreshold(int handle)
139 {
140 // variable (getter): variable getter: label_min
141 try {
142 return ReactionPathDiagramCabinet::at(handle)->label_min;
143 } catch (...) {
144 return handleAllExceptions(DERR, DERR);
145 }
146 }
147
148 int32_t rdiag_setLabelThreshold(int32_t handle, double label_min)
149 {
150 // variable (setter): variable setter: label_min
151 try {
152 ReactionPathDiagramCabinet::at(handle)->label_min = label_min;
153 return 0;
154 } catch (...) {
155 return handleAllExceptions(ERR, ERR);
156 }
157 }
158
159 int32_t rdiag_boldColor(int handle, int32_t bufLen, char* buf)
160 {
161 // variable (getter): variable getter: bold_color
162 try {
163 string out = ReactionPathDiagramCabinet::at(handle)->bold_color;
164 copyString(out, buf, bufLen);
165 return int(out.size()) + 1;
166 } catch (...) {
167 return handleAllExceptions(-1, ERR);
168 }
169 }
170
171 int32_t rdiag_setBoldColor(int32_t handle, const char* bold_color)
172 {
173 // variable (setter): variable setter: bold_color
174 try {
175 ReactionPathDiagramCabinet::at(handle)->bold_color = bold_color;
176 return 0;
177 } catch (...) {
178 return handleAllExceptions(ERR, ERR);
179 }
180 }
181
182 int32_t rdiag_normalColor(int handle, int32_t bufLen, char* buf)
183 {
184 // variable (getter): variable getter: normal_color
185 try {
186 string out = ReactionPathDiagramCabinet::at(handle)->normal_color;
187 copyString(out, buf, bufLen);
188 return int(out.size()) + 1;
189 } catch (...) {
190 return handleAllExceptions(-1, ERR);
191 }
192 }
193
194 int32_t rdiag_setNormalColor(int32_t handle, const char* normal_color)
195 {
196 // variable (setter): variable setter: normal_color
197 try {
198 ReactionPathDiagramCabinet::at(handle)->normal_color = normal_color;
199 return 0;
200 } catch (...) {
201 return handleAllExceptions(ERR, ERR);
202 }
203 }
204
205 int32_t rdiag_dashedColor(int handle, int32_t bufLen, char* buf)
206 {
207 // variable (getter): variable getter: dashed_color
208 try {
209 string out = ReactionPathDiagramCabinet::at(handle)->dashed_color;
210 copyString(out, buf, bufLen);
211 return int(out.size()) + 1;
212 } catch (...) {
213 return handleAllExceptions(-1, ERR);
214 }
215 }
216
217 int32_t rdiag_setDashedColor(int32_t handle, const char* dashed_color)
218 {
219 // variable (setter): variable setter: dashed_color
220 try {
221 ReactionPathDiagramCabinet::at(handle)->dashed_color = dashed_color;
222 return 0;
223 } catch (...) {
224 return handleAllExceptions(ERR, ERR);
225 }
226 }
227
228 int32_t rdiag_dotOptions(int handle, int32_t bufLen, char* buf)
229 {
230 // variable (getter): variable getter: dot_options
231 try {
232 string out = ReactionPathDiagramCabinet::at(handle)->dot_options;
233 copyString(out, buf, bufLen);
234 return int(out.size()) + 1;
235 } catch (...) {
236 return handleAllExceptions(-1, ERR);
237 }
238 }
239
240 int32_t rdiag_setDotOptions(int32_t handle, const char* dot_options)
241 {
242 // variable (setter): variable setter: dot_options
243 try {
244 ReactionPathDiagramCabinet::at(handle)->dot_options = dot_options;
245 return 0;
246 } catch (...) {
247 return handleAllExceptions(ERR, ERR);
248 }
249 }
250
251 int32_t rdiag_font(int handle, int32_t bufLen, char* buf)
252 {
253 // variable (getter): variable getter: m_font
254 try {
255 string out = ReactionPathDiagramCabinet::at(handle)->m_font;
256 copyString(out, buf, bufLen);
257 return int(out.size()) + 1;
258 } catch (...) {
259 return handleAllExceptions(-1, ERR);
260 }
261 }
262
263 int32_t rdiag_setFont(int32_t handle, const char* font)
264 {
265 // setter: void ReactionPathDiagram::setFont(const string&)
266 try {
267 ReactionPathDiagramCabinet::at(handle)->setFont(font);
268 return 0;
269 } catch (...) {
270 return handleAllExceptions(-1, ERR);
271 }
272 }
273
274 double rdiag_scale(int handle)
275 {
276 // variable (getter): variable getter: scale
277 try {
278 return ReactionPathDiagramCabinet::at(handle)->scale;
279 } catch (...) {
280 return handleAllExceptions(DERR, DERR);
281 }
282 }
283
284 int32_t rdiag_setScale(int32_t handle, double scale)
285 {
286 // variable (setter): variable setter: scale
287 try {
288 ReactionPathDiagramCabinet::at(handle)->scale = scale;
289 return 0;
290 } catch (...) {
291 return handleAllExceptions(ERR, ERR);
292 }
293 }
294
295 int32_t rdiag_flowType(int32_t handle, int32_t bufLen, char* buf)
296 {
297 // getter: const string ReactionPathDiagram::flowType()
298 try {
299 string out = ReactionPathDiagramCabinet::at(handle)->flowType();
300 copyString(out, buf, bufLen);
301 return int(out.size()) + 1;
302 } catch (...) {
303 return handleAllExceptions(-1, ERR);
304 }
305 }
306
307 int32_t rdiag_setFlowType(int32_t handle, const char* fType)
308 {
309 // setter: void ReactionPathDiagram::setFlowType(const string&)
310 try {
311 ReactionPathDiagramCabinet::at(handle)->setFlowType(fType);
312 return 0;
313 } catch (...) {
314 return handleAllExceptions(-1, ERR);
315 }
316 }
317
318 double rdiag_arrowWidth(int handle)
319 {
320 // variable (getter): variable getter: arrow_width
321 try {
322 return ReactionPathDiagramCabinet::at(handle)->arrow_width;
323 } catch (...) {
324 return handleAllExceptions(DERR, DERR);
325 }
326 }
327
328 int32_t rdiag_setArrowWidth(int32_t handle, double arrow_width)
329 {
330 // variable (setter): variable setter: arrow_width
331 try {
332 ReactionPathDiagramCabinet::at(handle)->arrow_width = arrow_width;
333 return 0;
334 } catch (...) {
335 return handleAllExceptions(ERR, ERR);
336 }
337 }
338
339 int32_t rdiag_title(int handle, int32_t bufLen, char* buf)
340 {
341 // variable (getter): variable getter: title
342 try {
343 string out = ReactionPathDiagramCabinet::at(handle)->title;
344 copyString(out, buf, bufLen);
345 return int(out.size()) + 1;
346 } catch (...) {
347 return handleAllExceptions(-1, ERR);
348 }
349 }
350
351 int32_t rdiag_setTitle(int32_t handle, const char* title)
352 {
353 // variable (setter): variable setter: title
354 try {
355 ReactionPathDiagramCabinet::at(handle)->title = title;
356 return 0;
357 } catch (...) {
358 return handleAllExceptions(ERR, ERR);
359 }
360 }
361
362 int32_t rdiag_add(int32_t handle, int32_t d)
363 {
364 // setter: void ReactionPathDiagram::add(shared_ptr<ReactionPathDiagram>)
365 try {
366 ReactionPathDiagramCabinet::at(handle)->add(ReactionPathDiagramCabinet::at(d));
367 return 0;
368 } catch (...) {
369 return handleAllExceptions(-1, ERR);
370 }
371 }
372
373 int32_t rdiag_displayOnly(int32_t handle, int32_t k)
374 {
375 // setter: void ReactionPathDiagram::displayOnly(size_t)
376 try {
377 ReactionPathDiagramCabinet::at(handle)->displayOnly(k);
378 return 0;
379 } catch (...) {
380 return handleAllExceptions(-1, ERR);
381 }
382 }
383
384 int32_t rdiag_getDot(int32_t handle, int32_t bufLen, char* buf)
385 {
386 // getter: string ReactionPathDiagram::getDot()
387 try {
388 string out = ReactionPathDiagramCabinet::at(handle)->getDot();
389 copyString(out, buf, bufLen);
390 return int(out.size()) + 1;
391 } catch (...) {
392 return handleAllExceptions(-1, ERR);
393 }
394 }
395
396 int32_t rdiag_getData(int32_t handle, int32_t bufLen, char* buf)
397 {
398 // getter: string ReactionPathDiagram::getData()
399 try {
400 string out = ReactionPathDiagramCabinet::at(handle)->getData();
401 copyString(out, buf, bufLen);
402 return int(out.size()) + 1;
403 } catch (...) {
404 return handleAllExceptions(-1, ERR);
405 }
406 }
407
408 int32_t rdiag_build(int32_t handle)
409 {
410 // method: void ReactionPathDiagram::build()
411 try {
412 ReactionPathDiagramCabinet::at(handle)->build();
413 return 0;
414 } catch (...) {
415 return handleAllExceptions(-1, ERR);
416 }
417 }
418
419 int32_t rdiag_getLog(int32_t handle, int32_t bufLen, char* buf)
420 {
421 // getter: string ReactionPathDiagram::getLog()
422 try {
423 string out = ReactionPathDiagramCabinet::at(handle)->getLog();
424 copyString(out, buf, bufLen);
425 return int(out.size()) + 1;
426 } catch (...) {
427 return handleAllExceptions(-1, ERR);
428 }
429 }
430
431 int32_t rdiag_findMajor(int32_t handle, double threshold, int32_t lda, int32_t aLen, double* a)
432 {
433 // method: void ReactionPathDiagram::findMajorPaths(double, size_t, double*)
434 try {
435 ReactionPathDiagramCabinet::at(handle)->findMajorPaths(threshold, lda, a);
436 return 0;
437 } catch (...) {
438 return handleAllExceptions(-1, ERR);
439 }
440 }
441
442 int32_t rdiag_del(int32_t handle)
443 {
444 // destructor
445 try {
446 ReactionPathDiagramCabinet::del(handle);
447 return 0;
448 } catch (...) {
449 return handleAllExceptions(-1, ERR);
450 }
451 }
452
454 {
455 // reserved CLib function: custom code
456 try {
457 // *************** begin custom code ***************
458 return ReactionPathDiagramCabinet::size();
459 // **************** end custom code ****************
460 } catch (...) {
461 return handleAllExceptions(-1, ERR);
462 }
463 }
464
465 int32_t rdiag_parentHandle(int32_t handle)
466 {
467 // reserved CLib function: custom code
468 try {
469 // *************** begin custom code ***************
470 return ReactionPathDiagramCabinet::parent(handle);
471 // **************** end custom code ****************
472 } catch (...) {
473 return handleAllExceptions(-1, ERR);
474 }
475 }
476
477} // extern "C"
Classes for reaction path analysis.
CTRDIAG - Generated CLib Cantera interface library.
int32_t rdiag_findMajor(int32_t handle, double threshold, int32_t lda, int32_t aLen, double *a)
Undocumented.
Definition ctrdiag.cpp:431
int32_t rdiag_newReactionPathDiagram(int32_t kin, const char *element)
Create a new reaction path diagram.
Definition ctrdiag.cpp:42
int32_t rdiag_add(int32_t handle, int32_t d)
Add fluxes from other ReactionPathDiagram to this diagram.
Definition ctrdiag.cpp:362
int32_t rdiag_setDashedColor(int32_t handle, const char *dashed_color)
Color for dashed lines.
Definition ctrdiag.cpp:217
double rdiag_normalThreshold(int handle)
Maximum relative flux for dashed lines.
Definition ctrdiag.cpp:117
int32_t rdiag_setTitle(int32_t handle, const char *title)
Reaction path diagram title.
Definition ctrdiag.cpp:351
int32_t rdiag_del(int32_t handle)
Delete ReactionPathDiagram object.
Definition ctrdiag.cpp:442
int32_t rdiag_dotOptions(int handle, int32_t bufLen, char *buf)
Options for the 'dot' program.
Definition ctrdiag.cpp:228
int32_t rdiag_build(int32_t handle)
Build the reaction path diagram.
Definition ctrdiag.cpp:408
int32_t rdiag_setDotOptions(int32_t handle, const char *dot_options)
Options for the 'dot' program.
Definition ctrdiag.cpp:240
int32_t rdiag_getDot(int32_t handle, int32_t bufLen, char *buf)
Export string in.
Definition ctrdiag.cpp:384
int32_t rdiag_setBoldColor(int32_t handle, const char *bold_color)
Color for bold lines.
Definition ctrdiag.cpp:171
int32_t rdiag_setBoldThreshold(int32_t handle, double bold_min)
Minimum relative flux for bold lines.
Definition ctrdiag.cpp:106
double rdiag_arrowWidth(int handle)
The arrow width.
Definition ctrdiag.cpp:318
int32_t rdiag_parentHandle(int32_t handle)
Return handle to parent of ReactionPathDiagram object.
Definition ctrdiag.cpp:465
int32_t rdiag_setNormalThreshold(int32_t handle, double dashed_max)
Maximum relative flux for dashed lines.
Definition ctrdiag.cpp:127
int32_t rdiag_showDetails(int handle)
Boolean flag to show details.
Definition ctrdiag.cpp:52
int32_t rdiag_cabinetSize()
Return size of ReactionPathDiagram storage.
Definition ctrdiag.cpp:453
int32_t rdiag_getData(int32_t handle, int32_t bufLen, char *buf)
Get a (roughly) human-readable representation of the reaction path diagram.
Definition ctrdiag.cpp:396
int32_t rdiag_dashedColor(int handle, int32_t bufLen, char *buf)
Color for dashed lines.
Definition ctrdiag.cpp:205
int32_t rdiag_setShowDetails(int32_t handle, int32_t show_details)
Boolean flag to show details.
Definition ctrdiag.cpp:63
int32_t rdiag_title(int handle, int32_t bufLen, char *buf)
Reaction path diagram title.
Definition ctrdiag.cpp:339
double rdiag_labelThreshold(int handle)
Minimum relative flux for labels.
Definition ctrdiag.cpp:138
int32_t rdiag_setThreshold(int32_t handle, double threshold)
Threshold for the minimum flux relative value that will be plotted.
Definition ctrdiag.cpp:85
int32_t rdiag_flowType(int32_t handle, int32_t bufLen, char *buf)
Get the way flows are drawn.
Definition ctrdiag.cpp:295
int32_t rdiag_setArrowWidth(int32_t handle, double arrow_width)
The arrow width.
Definition ctrdiag.cpp:328
double rdiag_threshold(int handle)
Threshold for the minimum flux relative value that will be plotted.
Definition ctrdiag.cpp:75
int32_t rdiag_displayOnly(int32_t handle, int32_t k)
Include only species and fluxes that are directly connected to a species.
Definition ctrdiag.cpp:373
int32_t rdiag_boldColor(int handle, int32_t bufLen, char *buf)
Color for bold lines.
Definition ctrdiag.cpp:159
int32_t rdiag_getLog(int32_t handle, int32_t bufLen, char *buf)
Get logging messages generated while building the reaction path diagram.
Definition ctrdiag.cpp:419
double rdiag_boldThreshold(int handle)
Minimum relative flux for bold lines.
Definition ctrdiag.cpp:96
int32_t rdiag_setFlowType(int32_t handle, const char *fType)
Get the way flows are drawn.
Definition ctrdiag.cpp:307
int32_t rdiag_setNormalColor(int32_t handle, const char *normal_color)
Color for normal-weight lines.
Definition ctrdiag.cpp:194
int32_t rdiag_normalColor(int handle, int32_t bufLen, char *buf)
Color for normal-weight lines.
Definition ctrdiag.cpp:182
int32_t rdiag_font(int handle, int32_t bufLen, char *buf)
Reaction path diagram font.
Definition ctrdiag.cpp:251
double rdiag_scale(int handle)
The scaling factor for the fluxes.
Definition ctrdiag.cpp:274
int32_t rdiag_setScale(int32_t handle, double scale)
The scaling factor for the fluxes.
Definition ctrdiag.cpp:284
int32_t rdiag_setFont(int32_t handle, const char *font)
Set name of the font used.
Definition ctrdiag.cpp:263
int32_t rdiag_setLabelThreshold(int32_t handle, double label_min)
Minimum relative flux for labels.
Definition ctrdiag.cpp:148
size_t copyString(const string &source, char *dest, size_t length)
Copy the contents of a string into a char array of a given length.
void scale(InputIter begin, InputIter end, OutputIter out, S scale_factor)
Multiply elements of an array by a scale factor.
Definition utilities.h:104
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595
shared_ptr< ReactionPathDiagram > newReactionPathDiagram(shared_ptr< Kinetics > kin, const string &element)
Create a new reaction path diagram.
T handleAllExceptions(T ctErrorCode, T otherErrorCode)
Exception handler used at language interface boundaries.
Definition clib_utils.h:32
Contains declarations for string manipulation functions within Cantera.