Cantera
Loading...
Searching...
No Matches
ctkin.cpp
Go to the documentation of this file.
1/**
2 * CTKIN - Generated CLib %Cantera interface library.
3 *
4 * @file ctkin.cpp
5 *
6 * Generated CLib API for Cantera's Kinetics 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"
19#include "cantera_clib/ctkin.h"
20
27
28using namespace Cantera;
29
30//! @cond
31//! Cabinet type definitions will be ignored by Doxygen
32
33// Define Cabinet<Kinetics> (single-instance object)
34typedef Cabinet<Kinetics> KineticsCabinet;
35template<> KineticsCabinet* KineticsCabinet::s_storage = 0; // initialized here
36
37typedef Cabinet<ThermoPhase> ThermoPhaseCabinet;
38template<> ThermoPhaseCabinet* ThermoPhaseCabinet::s_storage; // initialized elsewhere
39
40typedef Cabinet<Reaction> ReactionCabinet;
41template<> ReactionCabinet* ReactionCabinet::s_storage; // initialized elsewhere
42
43//! @endcond
44
45extern "C" {
46
47 int32_t kin_kineticsType(int32_t handle, int32_t bufLen, char* buf)
48 {
49 // getter: virtual string Kinetics::kineticsType()
50 try {
51 string out = KineticsCabinet::at(handle)->kineticsType();
52 copyString(out, buf, bufLen);
53 return int(out.size()) + 1;
54 } catch (...) {
55 return handleAllExceptions(-1, ERR);
56 }
57 }
58
59 int32_t kin_nReactions(int32_t handle)
60 {
61 // size getter: size_t Kinetics::nReactions()
62 try {
63 return static_cast<int32_t>(KineticsCabinet::at(handle)->nReactions());
64 } catch (...) {
65 return handleAllExceptions(ERR, ERR);
66 }
67 }
68
69 int32_t kin_reaction(int32_t handle, int32_t i)
70 {
71 // accessor: shared_ptr<Reaction> Kinetics::reaction(size_t)
72 try {
73 if (i < 0 || static_cast<size_t>(i) >= KineticsCabinet::at(handle)->nReactions()) {
74 throw IndexError("kin_reaction", "", i, KineticsCabinet::at(handle)->nReactions());
75 }
76 return ReactionCabinet::add(KineticsCabinet::at(handle)->reaction(i));
77 } catch (...) {
78 return handleAllExceptions(-2, ERR);
79 }
80 }
81
82 int32_t kin_nPhases(int32_t handle)
83 {
84 // size getter: size_t Kinetics::nPhases()
85 try {
86 return static_cast<int32_t>(KineticsCabinet::at(handle)->nPhases());
87 } catch (...) {
88 return handleAllExceptions(ERR, ERR);
89 }
90 }
91
92 int32_t kin_phase(int32_t handle, int32_t n)
93 {
94 // accessor: shared_ptr<ThermoPhase> Kinetics::phase(size_t)
95 try {
96 if (n < 0 || static_cast<size_t>(n) >= KineticsCabinet::at(handle)->nPhases()) {
97 throw IndexError("kin_phase", "", n, KineticsCabinet::at(handle)->nPhases());
98 }
99 return ThermoPhaseCabinet::add(KineticsCabinet::at(handle)->phase(n));
100 } catch (...) {
101 return handleAllExceptions(-2, ERR);
102 }
103 }
104
105 int32_t kin_reactionPhase(int32_t handle)
106 {
107 // accessor: shared_ptr<ThermoPhase> Kinetics::reactionPhase()
108 try {
109 return ThermoPhaseCabinet::add(KineticsCabinet::at(handle)->reactionPhase());
110 } catch (...) {
111 return handleAllExceptions(-2, ERR);
112 }
113 }
114
115 int32_t kin_phaseIndex(int32_t handle, const char* ph)
116 {
117 // method: custom code
118 try {
119 // *************** begin custom code ***************
120 return static_cast<int32_t>(KineticsCabinet::at(handle)->phaseIndex(ph, true));
121 // **************** end custom code ****************
122 } catch (...) {
123 return handleAllExceptions(-1, ERR);
124 }
125 }
126
127 int32_t kin_nTotalSpecies(int32_t handle)
128 {
129 // size getter: size_t Kinetics::nTotalSpecies()
130 try {
131 return static_cast<int32_t>(KineticsCabinet::at(handle)->nTotalSpecies());
132 } catch (...) {
133 return handleAllExceptions(ERR, ERR);
134 }
135 }
136
137 double kin_reactantStoichCoeff(int32_t handle, int32_t k, int32_t i)
138 {
139 // method: virtual double Kinetics::reactantStoichCoeff(size_t, size_t)
140 try {
141 return KineticsCabinet::at(handle)->reactantStoichCoeff(k, i);
142 } catch (...) {
143 return handleAllExceptions(DERR, DERR);
144 }
145 }
146
147 double kin_productStoichCoeff(int32_t handle, int32_t k, int32_t i)
148 {
149 // method: virtual double Kinetics::productStoichCoeff(size_t, size_t)
150 try {
151 return KineticsCabinet::at(handle)->productStoichCoeff(k, i);
152 } catch (...) {
153 return handleAllExceptions(DERR, DERR);
154 }
155 }
156
157 int32_t kin_getFwdRatesOfProgress(int32_t handle, int32_t fwdROPLen, double* fwdROP)
158 {
159 // array getter: virtual void Kinetics::getFwdRatesOfProgress(span<double>)
160 try {
161 auto& obj = KineticsCabinet::at(handle);
162 // no size checking specified
163 span<double> fwdROP_(fwdROP, fwdROPLen);
164 obj->getFwdRatesOfProgress(fwdROP_);
165 return 0;
166 } catch (...) {
167 return handleAllExceptions(-1, ERR);
168 }
169 }
170
171 int32_t kin_getRevRatesOfProgress(int32_t handle, int32_t revROPLen, double* revROP)
172 {
173 // array getter: virtual void Kinetics::getRevRatesOfProgress(span<double>)
174 try {
175 auto& obj = KineticsCabinet::at(handle);
176 // no size checking specified
177 span<double> revROP_(revROP, revROPLen);
178 obj->getRevRatesOfProgress(revROP_);
179 return 0;
180 } catch (...) {
181 return handleAllExceptions(-1, ERR);
182 }
183 }
184
185 int32_t kin_getNetRatesOfProgress(int32_t handle, int32_t netROPLen, double* netROP)
186 {
187 // array getter: virtual void Kinetics::getNetRatesOfProgress(span<double>)
188 try {
189 auto& obj = KineticsCabinet::at(handle);
190 // no size checking specified
191 span<double> netROP_(netROP, netROPLen);
192 obj->getNetRatesOfProgress(netROP_);
193 return 0;
194 } catch (...) {
195 return handleAllExceptions(-1, ERR);
196 }
197 }
198
199 int32_t kin_getEquilibriumConstants(int32_t handle, int32_t kcLen, double* kc)
200 {
201 // array getter: virtual void Kinetics::getEquilibriumConstants(span<double>)
202 try {
203 auto& obj = KineticsCabinet::at(handle);
204 // no size checking specified
205 span<double> kc_(kc, kcLen);
206 obj->getEquilibriumConstants(kc_);
207 return 0;
208 } catch (...) {
209 return handleAllExceptions(-1, ERR);
210 }
211 }
212
213 int32_t kin_getFwdRateConstants(int32_t handle, int32_t kfwdLen, double* kfwd)
214 {
215 // array getter: virtual void Kinetics::getFwdRateConstants(span<double>)
216 try {
217 auto& obj = KineticsCabinet::at(handle);
218 // no size checking specified
219 span<double> kfwd_(kfwd, kfwdLen);
220 obj->getFwdRateConstants(kfwd_);
221 return 0;
222 } catch (...) {
223 return handleAllExceptions(-1, ERR);
224 }
225 }
226
227 int32_t kin_getRevRateConstants(int32_t handle, int32_t krevLen, double* krev, int32_t doIrreversible)
228 {
229 // method: virtual void Kinetics::getRevRateConstants(span<double>, bool)
230 try {
231 span<double> krev_(krev, krevLen);
232 bool doIrreversible_ = (doIrreversible != 0);
233 KineticsCabinet::at(handle)->getRevRateConstants(krev_, doIrreversible_);
234 return 0;
235 } catch (...) {
236 return handleAllExceptions(-1, ERR);
237 }
238 }
239
240 int32_t kin_getCreationRates(int32_t handle, int32_t cdotLen, double* cdot)
241 {
242 // array getter: virtual void Kinetics::getCreationRates(span<double>)
243 try {
244 auto& obj = KineticsCabinet::at(handle);
245 // no size checking specified
246 span<double> cdot_(cdot, cdotLen);
247 obj->getCreationRates(cdot_);
248 return 0;
249 } catch (...) {
250 return handleAllExceptions(-1, ERR);
251 }
252 }
253
254 int32_t kin_getDestructionRates(int32_t handle, int32_t ddotLen, double* ddot)
255 {
256 // array getter: virtual void Kinetics::getDestructionRates(span<double>)
257 try {
258 auto& obj = KineticsCabinet::at(handle);
259 // no size checking specified
260 span<double> ddot_(ddot, ddotLen);
261 obj->getDestructionRates(ddot_);
262 return 0;
263 } catch (...) {
264 return handleAllExceptions(-1, ERR);
265 }
266 }
267
268 int32_t kin_getNetProductionRates(int32_t handle, int32_t wdotLen, double* wdot)
269 {
270 // array getter: virtual void Kinetics::getNetProductionRates(span<double>)
271 try {
272 auto& obj = KineticsCabinet::at(handle);
273 // no size checking specified
274 span<double> wdot_(wdot, wdotLen);
275 obj->getNetProductionRates(wdot_);
276 return 0;
277 } catch (...) {
278 return handleAllExceptions(-1, ERR);
279 }
280 }
281
282 int32_t kin_getFwdRatesOfProgress_ddT(int32_t handle, int32_t dropLen, double* drop)
283 {
284 // array getter: virtual void Kinetics::getFwdRatesOfProgress_ddT(span<double>)
285 try {
286 auto& obj = KineticsCabinet::at(handle);
287 // no size checking specified
288 span<double> drop_(drop, dropLen);
289 obj->getFwdRatesOfProgress_ddT(drop_);
290 return 0;
291 } catch (...) {
292 return handleAllExceptions(-1, ERR);
293 }
294 }
295
296 int32_t kin_getFwdRatesOfProgress_ddP(int32_t handle, int32_t dropLen, double* drop)
297 {
298 // array getter: virtual void Kinetics::getFwdRatesOfProgress_ddP(span<double>)
299 try {
300 auto& obj = KineticsCabinet::at(handle);
301 // no size checking specified
302 span<double> drop_(drop, dropLen);
303 obj->getFwdRatesOfProgress_ddP(drop_);
304 return 0;
305 } catch (...) {
306 return handleAllExceptions(-1, ERR);
307 }
308 }
309
310 int32_t kin_getFwdRatesOfProgress_ddC(int32_t handle, int32_t dropLen, double* drop)
311 {
312 // array getter: virtual void Kinetics::getFwdRatesOfProgress_ddC(span<double>)
313 try {
314 auto& obj = KineticsCabinet::at(handle);
315 // no size checking specified
316 span<double> drop_(drop, dropLen);
317 obj->getFwdRatesOfProgress_ddC(drop_);
318 return 0;
319 } catch (...) {
320 return handleAllExceptions(-1, ERR);
321 }
322 }
323
324 int32_t kin_getRevRatesOfProgress_ddT(int32_t handle, int32_t dropLen, double* drop)
325 {
326 // array getter: virtual void Kinetics::getRevRatesOfProgress_ddT(span<double>)
327 try {
328 auto& obj = KineticsCabinet::at(handle);
329 // no size checking specified
330 span<double> drop_(drop, dropLen);
331 obj->getRevRatesOfProgress_ddT(drop_);
332 return 0;
333 } catch (...) {
334 return handleAllExceptions(-1, ERR);
335 }
336 }
337
338 int32_t kin_getRevRatesOfProgress_ddP(int32_t handle, int32_t dropLen, double* drop)
339 {
340 // array getter: virtual void Kinetics::getRevRatesOfProgress_ddP(span<double>)
341 try {
342 auto& obj = KineticsCabinet::at(handle);
343 // no size checking specified
344 span<double> drop_(drop, dropLen);
345 obj->getRevRatesOfProgress_ddP(drop_);
346 return 0;
347 } catch (...) {
348 return handleAllExceptions(-1, ERR);
349 }
350 }
351
352 int32_t kin_getRevRatesOfProgress_ddC(int32_t handle, int32_t dropLen, double* drop)
353 {
354 // array getter: virtual void Kinetics::getRevRatesOfProgress_ddC(span<double>)
355 try {
356 auto& obj = KineticsCabinet::at(handle);
357 // no size checking specified
358 span<double> drop_(drop, dropLen);
359 obj->getRevRatesOfProgress_ddC(drop_);
360 return 0;
361 } catch (...) {
362 return handleAllExceptions(-1, ERR);
363 }
364 }
365
366 int32_t kin_getNetRatesOfProgress_ddT(int32_t handle, int32_t dropLen, double* drop)
367 {
368 // array getter: virtual void Kinetics::getNetRatesOfProgress_ddT(span<double>)
369 try {
370 auto& obj = KineticsCabinet::at(handle);
371 // no size checking specified
372 span<double> drop_(drop, dropLen);
373 obj->getNetRatesOfProgress_ddT(drop_);
374 return 0;
375 } catch (...) {
376 return handleAllExceptions(-1, ERR);
377 }
378 }
379
380 int32_t kin_getNetRatesOfProgress_ddP(int32_t handle, int32_t dropLen, double* drop)
381 {
382 // array getter: virtual void Kinetics::getNetRatesOfProgress_ddP(span<double>)
383 try {
384 auto& obj = KineticsCabinet::at(handle);
385 // no size checking specified
386 span<double> drop_(drop, dropLen);
387 obj->getNetRatesOfProgress_ddP(drop_);
388 return 0;
389 } catch (...) {
390 return handleAllExceptions(-1, ERR);
391 }
392 }
393
394 int32_t kin_getNetRatesOfProgress_ddC(int32_t handle, int32_t dropLen, double* drop)
395 {
396 // array getter: virtual void Kinetics::getNetRatesOfProgress_ddC(span<double>)
397 try {
398 auto& obj = KineticsCabinet::at(handle);
399 // no size checking specified
400 span<double> drop_(drop, dropLen);
401 obj->getNetRatesOfProgress_ddC(drop_);
402 return 0;
403 } catch (...) {
404 return handleAllExceptions(-1, ERR);
405 }
406 }
407
408 int32_t kin_getCreationRates_ddT(int32_t handle, int32_t dwdotLen, double* dwdot)
409 {
410 // array getter: void Kinetics::getCreationRates_ddT(span<double>)
411 try {
412 auto& obj = KineticsCabinet::at(handle);
413 // no size checking specified
414 span<double> dwdot_(dwdot, dwdotLen);
415 obj->getCreationRates_ddT(dwdot_);
416 return 0;
417 } catch (...) {
418 return handleAllExceptions(-1, ERR);
419 }
420 }
421
422 int32_t kin_getCreationRates_ddP(int32_t handle, int32_t dwdotLen, double* dwdot)
423 {
424 // array getter: void Kinetics::getCreationRates_ddP(span<double>)
425 try {
426 auto& obj = KineticsCabinet::at(handle);
427 // no size checking specified
428 span<double> dwdot_(dwdot, dwdotLen);
429 obj->getCreationRates_ddP(dwdot_);
430 return 0;
431 } catch (...) {
432 return handleAllExceptions(-1, ERR);
433 }
434 }
435
436 int32_t kin_getCreationRates_ddC(int32_t handle, int32_t dwdotLen, double* dwdot)
437 {
438 // array getter: void Kinetics::getCreationRates_ddC(span<double>)
439 try {
440 auto& obj = KineticsCabinet::at(handle);
441 // no size checking specified
442 span<double> dwdot_(dwdot, dwdotLen);
443 obj->getCreationRates_ddC(dwdot_);
444 return 0;
445 } catch (...) {
446 return handleAllExceptions(-1, ERR);
447 }
448 }
449
450 int32_t kin_getDestructionRates_ddT(int32_t handle, int32_t dwdotLen, double* dwdot)
451 {
452 // array getter: void Kinetics::getDestructionRates_ddT(span<double>)
453 try {
454 auto& obj = KineticsCabinet::at(handle);
455 // no size checking specified
456 span<double> dwdot_(dwdot, dwdotLen);
457 obj->getDestructionRates_ddT(dwdot_);
458 return 0;
459 } catch (...) {
460 return handleAllExceptions(-1, ERR);
461 }
462 }
463
464 int32_t kin_getDestructionRates_ddP(int32_t handle, int32_t dwdotLen, double* dwdot)
465 {
466 // array getter: void Kinetics::getDestructionRates_ddP(span<double>)
467 try {
468 auto& obj = KineticsCabinet::at(handle);
469 // no size checking specified
470 span<double> dwdot_(dwdot, dwdotLen);
471 obj->getDestructionRates_ddP(dwdot_);
472 return 0;
473 } catch (...) {
474 return handleAllExceptions(-1, ERR);
475 }
476 }
477
478 int32_t kin_getDestructionRates_ddC(int32_t handle, int32_t dwdotLen, double* dwdot)
479 {
480 // array getter: void Kinetics::getDestructionRates_ddC(span<double>)
481 try {
482 auto& obj = KineticsCabinet::at(handle);
483 // no size checking specified
484 span<double> dwdot_(dwdot, dwdotLen);
485 obj->getDestructionRates_ddC(dwdot_);
486 return 0;
487 } catch (...) {
488 return handleAllExceptions(-1, ERR);
489 }
490 }
491
492 int32_t kin_getNetProductionRates_ddT(int32_t handle, int32_t dwdotLen, double* dwdot)
493 {
494 // array getter: void Kinetics::getNetProductionRates_ddT(span<double>)
495 try {
496 auto& obj = KineticsCabinet::at(handle);
497 // no size checking specified
498 span<double> dwdot_(dwdot, dwdotLen);
499 obj->getNetProductionRates_ddT(dwdot_);
500 return 0;
501 } catch (...) {
502 return handleAllExceptions(-1, ERR);
503 }
504 }
505
506 int32_t kin_getNetProductionRates_ddP(int32_t handle, int32_t dwdotLen, double* dwdot)
507 {
508 // array getter: void Kinetics::getNetProductionRates_ddP(span<double>)
509 try {
510 auto& obj = KineticsCabinet::at(handle);
511 // no size checking specified
512 span<double> dwdot_(dwdot, dwdotLen);
513 obj->getNetProductionRates_ddP(dwdot_);
514 return 0;
515 } catch (...) {
516 return handleAllExceptions(-1, ERR);
517 }
518 }
519
520 int32_t kin_getNetProductionRates_ddC(int32_t handle, int32_t dwdotLen, double* dwdot)
521 {
522 // array getter: void Kinetics::getNetProductionRates_ddC(span<double>)
523 try {
524 auto& obj = KineticsCabinet::at(handle);
525 // no size checking specified
526 span<double> dwdot_(dwdot, dwdotLen);
527 obj->getNetProductionRates_ddC(dwdot_);
528 return 0;
529 } catch (...) {
530 return handleAllExceptions(-1, ERR);
531 }
532 }
533
534 int32_t kin_getNetProductionRates_ddX(int32_t handle, int32_t bufLen, double* buf)
535 {
536 // method: custom code
537 try {
538 // *************** begin custom code ***************
539 auto& obj = KineticsCabinet::at(handle);
540 auto mat = obj->netProductionRates_ddX();
541 int32_t rows = static_cast<int32_t>(mat.rows());
542 int32_t cols = static_cast<int32_t>(mat.cols());
543 int32_t need = rows * cols;
544 if (bufLen < need) {
545 throw CanteraError("kin_getNetProductionRates_ddX", "bufLen is too small");
546 }
547 for (int32_t idx = 0; idx < need; ++idx) {
548 buf[idx] = 0.0;
549 }
550 for (int k = 0; k < mat.outerSize(); ++k) {
551 for (Eigen::SparseMatrix<double>::InnerIterator it(mat, k); it; ++it) {
552 buf[it.col() * rows + it.row()] = it.value();
553 }
554 }
555 return 0;
556 // **************** end custom code ****************
557 } catch (...) {
558 return handleAllExceptions(-1, ERR);
559 }
560 }
561
562 int32_t kin_getNetRatesOfProgress_ddX(int32_t handle, int32_t bufLen, double* buf)
563 {
564 // method: custom code
565 try {
566 // *************** begin custom code ***************
567 auto& obj = KineticsCabinet::at(handle);
568 auto mat = obj->netRatesOfProgress_ddX();
569 int32_t rows = static_cast<int32_t>(mat.rows());
570 int32_t cols = static_cast<int32_t>(mat.cols());
571 int32_t need = rows * cols;
572 if (bufLen < need) {
573 throw CanteraError("kin_getNetRatesOfProgress_ddX", "bufLen is too small");
574 }
575 for (int32_t idx = 0; idx < need; ++idx) {
576 buf[idx] = 0.0;
577 }
578 for (int k = 0; k < mat.outerSize(); ++k) {
579 for (Eigen::SparseMatrix<double>::InnerIterator it(mat, k); it; ++it) {
580 buf[it.col() * rows + it.row()] = it.value();
581 }
582 }
583 return 0;
584 // **************** end custom code ****************
585 } catch (...) {
586 return handleAllExceptions(-1, ERR);
587 }
588 }
589
590 double kin_multiplier(int32_t handle, int32_t i)
591 {
592 // method: double Kinetics::multiplier(size_t)
593 try {
594 return KineticsCabinet::at(handle)->multiplier(i);
595 } catch (...) {
596 return handleAllExceptions(DERR, DERR);
597 }
598 }
599
600 int32_t kin_setMultiplier(int32_t handle, int32_t i, double f)
601 {
602 // method: virtual void Kinetics::setMultiplier(size_t, double)
603 try {
604 KineticsCabinet::at(handle)->setMultiplier(i, f);
605 return 0;
606 } catch (...) {
607 return handleAllExceptions(-1, ERR);
608 }
609 }
610
611 int32_t kin_isReversible(int32_t handle, int32_t i)
612 {
613 // method: bool Kinetics::isReversible(size_t)
614 try {
615 bool out = KineticsCabinet::at(handle)->isReversible(i);
616 return int(out);
617 } catch (...) {
618 return handleAllExceptions(-1, ERR);
619 }
620 }
621
622 int32_t kin_kineticsSpeciesIndex(int32_t handle, const char* nm)
623 {
624 // method: custom code
625 try {
626 // *************** begin custom code ***************
627 return static_cast<int32_t>(KineticsCabinet::at(handle)->kineticsSpeciesIndex(nm, true));
628 // **************** end custom code ****************
629 } catch (...) {
630 return handleAllExceptions(-1, ERR);
631 }
632 }
633
634 int32_t kin_advanceCoverages(int32_t handle, double tstep)
635 {
636 // setter: void InterfaceKinetics::advanceCoverages(double)
637 try {
638 KineticsCabinet::as<InterfaceKinetics>(handle)->advanceCoverages(tstep);
639 return 0;
640 } catch (...) {
641 return handleAllExceptions(-1, ERR);
642 }
643 }
644
645 int32_t kin_getDeltaEnthalpy(int32_t handle, int32_t deltaHLen, double* deltaH)
646 {
647 // array getter: virtual void Kinetics::getDeltaEnthalpy(span<double>)
648 try {
649 auto& obj = KineticsCabinet::at(handle);
650 // no size checking specified
651 span<double> deltaH_(deltaH, deltaHLen);
652 obj->getDeltaEnthalpy(deltaH_);
653 return 0;
654 } catch (...) {
655 return handleAllExceptions(-1, ERR);
656 }
657 }
658
659 int32_t kin_getDeltaGibbs(int32_t handle, int32_t deltaGLen, double* deltaG)
660 {
661 // array getter: virtual void Kinetics::getDeltaGibbs(span<double>)
662 try {
663 auto& obj = KineticsCabinet::at(handle);
664 // no size checking specified
665 span<double> deltaG_(deltaG, deltaGLen);
666 obj->getDeltaGibbs(deltaG_);
667 return 0;
668 } catch (...) {
669 return handleAllExceptions(-1, ERR);
670 }
671 }
672
673 int32_t kin_getDeltaEntropy(int32_t handle, int32_t deltaSLen, double* deltaS)
674 {
675 // array getter: virtual void Kinetics::getDeltaEntropy(span<double>)
676 try {
677 auto& obj = KineticsCabinet::at(handle);
678 // no size checking specified
679 span<double> deltaS_(deltaS, deltaSLen);
680 obj->getDeltaEntropy(deltaS_);
681 return 0;
682 } catch (...) {
683 return handleAllExceptions(-1, ERR);
684 }
685 }
686
687 int32_t kin_getDeltaSSEnthalpy(int32_t handle, int32_t deltaHLen, double* deltaH)
688 {
689 // array getter: virtual void Kinetics::getDeltaSSEnthalpy(span<double>)
690 try {
691 auto& obj = KineticsCabinet::at(handle);
692 // no size checking specified
693 span<double> deltaH_(deltaH, deltaHLen);
694 obj->getDeltaSSEnthalpy(deltaH_);
695 return 0;
696 } catch (...) {
697 return handleAllExceptions(-1, ERR);
698 }
699 }
700
701 int32_t kin_getDeltaSSGibbs(int32_t handle, int32_t deltaGLen, double* deltaG)
702 {
703 // array getter: virtual void Kinetics::getDeltaSSGibbs(span<double>)
704 try {
705 auto& obj = KineticsCabinet::at(handle);
706 // no size checking specified
707 span<double> deltaG_(deltaG, deltaGLen);
708 obj->getDeltaSSGibbs(deltaG_);
709 return 0;
710 } catch (...) {
711 return handleAllExceptions(-1, ERR);
712 }
713 }
714
715 int32_t kin_getDeltaSSEntropy(int32_t handle, int32_t deltaSLen, double* deltaS)
716 {
717 // array getter: virtual void Kinetics::getDeltaSSEntropy(span<double>)
718 try {
719 auto& obj = KineticsCabinet::at(handle);
720 // no size checking specified
721 span<double> deltaS_(deltaS, deltaSLen);
722 obj->getDeltaSSEntropy(deltaS_);
723 return 0;
724 } catch (...) {
725 return handleAllExceptions(-1, ERR);
726 }
727 }
728
729 int32_t kin_del(int32_t handle)
730 {
731 // destructor
732 try {
733 KineticsCabinet::del(handle);
734 return 0;
735 } catch (...) {
736 return handleAllExceptions(-1, ERR);
737 }
738 }
739
741 {
742 // reserved CLib function: custom code
743 try {
744 // *************** begin custom code ***************
745 return KineticsCabinet::size();
746 // **************** end custom code ****************
747 } catch (...) {
748 return handleAllExceptions(-1, ERR);
749 }
750 }
751
752} // extern "C"
Header for a simple thermodynamics model of a surface phase derived from ThermoPhase,...
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
Template for classes to hold pointers to objects.
Definition Cabinet.h:51
Base class for exceptions thrown by Cantera classes.
An array index is out of range.
CTKIN - Generated CLib Cantera interface library.
int32_t kin_getNetRatesOfProgress_ddC(int32_t handle, int32_t dropLen, double *drop)
Calculate derivatives for net rates-of-progress with respect to molar concentration at constant tempe...
Definition ctkin.cpp:394
int32_t kin_getDeltaGibbs(int32_t handle, int32_t deltaGLen, double *deltaG)
Return the vector of values for the reaction Gibbs free energy change.
Definition ctkin.cpp:659
int32_t kin_setMultiplier(int32_t handle, int32_t i, double f)
Set the multiplier for reaction i to f.
Definition ctkin.cpp:600
int32_t kin_getRevRatesOfProgress_ddP(int32_t handle, int32_t dropLen, double *drop)
Calculate derivatives for reverse rates-of-progress with respect to pressure at constant temperature,...
Definition ctkin.cpp:338
int32_t kin_getDestructionRates_ddC(int32_t handle, int32_t dwdotLen, double *dwdot)
Calculate derivatives for species destruction rates with respect to molar concentration at constant t...
Definition ctkin.cpp:478
int32_t kin_getNetProductionRates_ddT(int32_t handle, int32_t dwdotLen, double *dwdot)
Calculate derivatives for species net production rates with respect to temperature at constant pressu...
Definition ctkin.cpp:492
int32_t kin_del(int32_t handle)
Delete Kinetics object.
Definition ctkin.cpp:729
int32_t kin_reaction(int32_t handle, int32_t i)
Return the Reaction object for reaction i.
Definition ctkin.cpp:69
int32_t kin_getCreationRates_ddT(int32_t handle, int32_t dwdotLen, double *dwdot)
Calculate derivatives for species creation rates with respect to temperature at constant pressure,...
Definition ctkin.cpp:408
int32_t kin_nPhases(int32_t handle)
The number of phases participating in the reaction mechanism.
Definition ctkin.cpp:82
int32_t kin_reactionPhase(int32_t handle)
Return pointer to phase where the reactions occur.
Definition ctkin.cpp:105
int32_t kin_getFwdRatesOfProgress_ddC(int32_t handle, int32_t dropLen, double *drop)
Calculate derivatives for forward rates-of-progress with respect to molar concentration at constant t...
Definition ctkin.cpp:310
double kin_productStoichCoeff(int32_t handle, int32_t k, int32_t i)
Stoichiometric coefficient of species k as a product in reaction i.
Definition ctkin.cpp:147
int32_t kin_getEquilibriumConstants(int32_t handle, int32_t kcLen, double *kc)
Get the vector of equilibrium constants in concentration units.
Definition ctkin.cpp:199
int32_t kin_getRevRatesOfProgress(int32_t handle, int32_t revROPLen, double *revROP)
Return the Reverse rates of progress of the reactions.
Definition ctkin.cpp:171
int32_t kin_getRevRatesOfProgress_ddT(int32_t handle, int32_t dropLen, double *drop)
Calculate derivatives for reverse rates-of-progress with respect to temperature at constant pressure,...
Definition ctkin.cpp:324
int32_t kin_getDestructionRates(int32_t handle, int32_t ddotLen, double *ddot)
Species destruction rates [kmol/m^3/s or kmol/m^2/s].
Definition ctkin.cpp:254
int32_t kin_getNetProductionRates_ddX(int32_t handle, int32_t bufLen, double *buf)
Dense composition Jacobian d(net production rate)/dX, column-major (n x n).
Definition ctkin.cpp:534
int32_t kin_advanceCoverages(int32_t handle, double tstep)
Advance the surface coverages in time.
Definition ctkin.cpp:634
int32_t kin_getDestructionRates_ddT(int32_t handle, int32_t dwdotLen, double *dwdot)
Calculate derivatives for species destruction rates with respect to temperature at constant pressure,...
Definition ctkin.cpp:450
int32_t kin_phase(int32_t handle, int32_t n)
Return pointer to phase associated with Kinetics by index.
Definition ctkin.cpp:92
int32_t kin_getRevRateConstants(int32_t handle, int32_t krevLen, double *krev, int32_t doIrreversible)
Return the reverse rate constants.
Definition ctkin.cpp:227
int32_t kin_getNetProductionRates_ddP(int32_t handle, int32_t dwdotLen, double *dwdot)
Calculate derivatives for species net production rates with respect to pressure at constant temperatu...
Definition ctkin.cpp:506
int32_t kin_getDeltaEntropy(int32_t handle, int32_t deltaSLen, double *deltaS)
Return the vector of values for the reactions change in entropy.
Definition ctkin.cpp:673
int32_t kin_getCreationRates_ddP(int32_t handle, int32_t dwdotLen, double *dwdot)
Calculate derivatives for species creation rates with respect to pressure at constant temperature,...
Definition ctkin.cpp:422
int32_t kin_getDeltaEnthalpy(int32_t handle, int32_t deltaHLen, double *deltaH)
Return the vector of values for the reactions change in enthalpy.
Definition ctkin.cpp:645
int32_t kin_kineticsType(int32_t handle, int32_t bufLen, char *buf)
Identifies the Kinetics manager type.
Definition ctkin.cpp:47
int32_t kin_getCreationRates(int32_t handle, int32_t cdotLen, double *cdot)
Species creation rates [kmol/m^3/s or kmol/m^2/s].
Definition ctkin.cpp:240
int32_t kin_getNetRatesOfProgress_ddP(int32_t handle, int32_t dropLen, double *drop)
Calculate derivatives for net rates-of-progress with respect to pressure at constant temperature,...
Definition ctkin.cpp:380
int32_t kin_phaseIndex(int32_t handle, const char *ph)
Return the phase index of a phase in the list of phases defined within the object.
Definition ctkin.cpp:115
int32_t kin_getDeltaSSEnthalpy(int32_t handle, int32_t deltaHLen, double *deltaH)
Return the vector of values for the change in the standard state enthalpies of reaction.
Definition ctkin.cpp:687
int32_t kin_getDeltaSSGibbs(int32_t handle, int32_t deltaGLen, double *deltaG)
Return the vector of values for the reaction standard state Gibbs free energy change.
Definition ctkin.cpp:701
int32_t kin_getNetRatesOfProgress_ddT(int32_t handle, int32_t dropLen, double *drop)
Calculate derivatives for net rates-of-progress with respect to temperature at constant pressure,...
Definition ctkin.cpp:366
int32_t kin_getFwdRatesOfProgress_ddP(int32_t handle, int32_t dropLen, double *drop)
Calculate derivatives for forward rates-of-progress with respect to pressure at constant temperature,...
Definition ctkin.cpp:296
int32_t kin_getDestructionRates_ddP(int32_t handle, int32_t dwdotLen, double *dwdot)
Calculate derivatives for species destruction rates with respect to pressure at constant temperature,...
Definition ctkin.cpp:464
int32_t kin_getNetProductionRates(int32_t handle, int32_t wdotLen, double *wdot)
Species net production rates [kmol/m^3/s or kmol/m^2/s].
Definition ctkin.cpp:268
double kin_reactantStoichCoeff(int32_t handle, int32_t k, int32_t i)
Stoichiometric coefficient of species k as a reactant in reaction i.
Definition ctkin.cpp:137
int32_t kin_getFwdRatesOfProgress(int32_t handle, int32_t fwdROPLen, double *fwdROP)
Return the forward rates of progress of the reactions.
Definition ctkin.cpp:157
int32_t kin_getDeltaSSEntropy(int32_t handle, int32_t deltaSLen, double *deltaS)
Return the vector of values for the change in the standard state entropies for each reaction.
Definition ctkin.cpp:715
int32_t kin_getNetRatesOfProgress(int32_t handle, int32_t netROPLen, double *netROP)
Net rates of progress.
Definition ctkin.cpp:185
int32_t kin_isReversible(int32_t handle, int32_t i)
True if reaction i has been declared to be reversible.
Definition ctkin.cpp:611
int32_t kin_getNetRatesOfProgress_ddX(int32_t handle, int32_t bufLen, double *buf)
Dense reaction composition Jacobian d(net rate of progress)/dX, column-major.
Definition ctkin.cpp:562
int32_t kin_getNetProductionRates_ddC(int32_t handle, int32_t dwdotLen, double *dwdot)
Calculate derivatives for species net production rates with respect to molar concentration at constan...
Definition ctkin.cpp:520
int32_t kin_nTotalSpecies(int32_t handle)
The total number of species in all phases participating in the kinetics mechanism.
Definition ctkin.cpp:127
int32_t kin_nReactions(int32_t handle)
Number of reactions in the reaction mechanism.
Definition ctkin.cpp:59
int32_t kin_kineticsSpeciesIndex(int32_t handle, const char *nm)
Return the index of a species within the phases participating in this kinetic mechanism.
Definition ctkin.cpp:622
int32_t kin_getRevRatesOfProgress_ddC(int32_t handle, int32_t dropLen, double *drop)
Calculate derivatives for reverse rates-of-progress with respect to molar concentration at constant t...
Definition ctkin.cpp:352
int32_t kin_getFwdRateConstants(int32_t handle, int32_t kfwdLen, double *kfwd)
Return the forward rate constants.
Definition ctkin.cpp:213
int32_t kin_getCreationRates_ddC(int32_t handle, int32_t dwdotLen, double *dwdot)
Calculate derivatives for species creation rates with respect to molar concentration at constant temp...
Definition ctkin.cpp:436
int32_t kin_getFwdRatesOfProgress_ddT(int32_t handle, int32_t dropLen, double *drop)
Calculate derivatives for forward rates-of-progress with respect to temperature at constant pressure,...
Definition ctkin.cpp:282
int32_t kin_cabinetSize()
Return size of Kinetics storage.
Definition ctkin.cpp:740
double kin_multiplier(int32_t handle, int32_t i)
The current value of the multiplier for reaction i.
Definition ctkin.cpp:590
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.
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595
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.