Cantera  3.2.0a2
Loading...
Searching...
No Matches
cttrans.cpp
Go to the documentation of this file.
1/**
2 * CTTRANS - Generated CLib %Cantera interface library.
3 *
4 * @file cttrans.cpp
5 *
6 * Generated CLib API for Cantera's Transport 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
23
24using namespace Cantera;
25
26//! @cond
27//! Cabinet type definitions will be ignored by Doxygen
28
29// Define Cabinet<Transport> (single-instance object)
30typedef Cabinet<Transport> TransportCabinet;
31template<> TransportCabinet* TransportCabinet::s_storage = 0; // initialized here
32
33//! @endcond
34
35extern "C" {
36
37 int32_t trans_transportModel(int32_t handle, int32_t bufLen, char* buf)
38 {
39 // getter: virtual string Transport::transportModel()
40 try {
41 string out = TransportCabinet::at(handle)->transportModel();
42 copyString(out, buf, bufLen);
43 return int(out.size()) + 1;
44 } catch (...) {
45 return handleAllExceptions(-1, ERR);
46 }
47 }
48
49 double trans_viscosity(int32_t handle)
50 {
51 // getter: virtual double Transport::viscosity()
52 try {
53 return TransportCabinet::at(handle)->viscosity();
54 } catch (...) {
55 return handleAllExceptions(DERR, DERR);
56 }
57 }
58
59 double trans_thermalConductivity(int32_t handle)
60 {
61 // getter: virtual double Transport::thermalConductivity()
62 try {
63 return TransportCabinet::at(handle)->thermalConductivity();
64 } catch (...) {
65 return handleAllExceptions(DERR, DERR);
66 }
67 }
68
69 double trans_electricalConductivity(int32_t handle)
70 {
71 // getter: virtual double Transport::electricalConductivity()
72 try {
73 return TransportCabinet::at(handle)->electricalConductivity();
74 } catch (...) {
75 return handleAllExceptions(DERR, DERR);
76 }
77 }
78
79 int32_t trans_getThermalDiffCoeffs(int32_t handle, int32_t dtLen, double* dt)
80 {
81 // getter: virtual void Transport::getThermalDiffCoeffs(double* const)
82 try {
83 auto& obj = TransportCabinet::at(handle);
84 // no size checking specified
85 obj->getThermalDiffCoeffs(dt);
86 return 0;
87 } catch (...) {
88 return handleAllExceptions(-1, ERR);
89 }
90 }
91
92 int32_t trans_getMixDiffCoeffs(int32_t handle, int32_t dLen, double* d)
93 {
94 // getter: virtual void Transport::getMixDiffCoeffs(double* const)
95 try {
96 auto& obj = TransportCabinet::at(handle);
97 // no size checking specified
98 obj->getMixDiffCoeffs(d);
99 return 0;
100 } catch (...) {
101 return handleAllExceptions(-1, ERR);
102 }
103 }
104
105 int32_t trans_getBinaryDiffCoeffs(int32_t handle, const int32_t ld, int32_t dLen, double* d)
106 {
107 // method: virtual void Transport::getBinaryDiffCoeffs(const size_t, double* const)
108 try {
109 TransportCabinet::at(handle)->getBinaryDiffCoeffs(ld, d);
110 return 0;
111 } catch (...) {
112 return handleAllExceptions(-1, ERR);
113 }
114 }
115
116 int32_t trans_getMultiDiffCoeffs(int32_t handle, const int32_t ld, int32_t dLen, double* d)
117 {
118 // method: virtual void Transport::getMultiDiffCoeffs(const size_t, double* const)
119 try {
120 TransportCabinet::at(handle)->getMultiDiffCoeffs(ld, d);
121 return 0;
122 } catch (...) {
123 return handleAllExceptions(-1, ERR);
124 }
125 }
126
127 int32_t trans_getMolarFluxes(int32_t handle, int32_t state1Len, const double* state1, int32_t state2Len, const double* state2, const double delta, int32_t cfluxesLen, double* cfluxes)
128 {
129 // method: virtual void Transport::getMolarFluxes(const double* const, const double* const, const double, double* const)
130 try {
131 TransportCabinet::at(handle)->getMolarFluxes(state1, state2, delta, cfluxes);
132 return 0;
133 } catch (...) {
134 return handleAllExceptions(-1, ERR);
135 }
136 }
137
138 int32_t trans_getMassFluxes(int32_t handle, int32_t state1Len, const double* state1, int32_t state2Len, const double* state2, double delta, int32_t mfluxesLen, double* mfluxes)
139 {
140 // method: virtual void Transport::getMassFluxes(const double*, const double*, double, double*)
141 try {
142 TransportCabinet::at(handle)->getMassFluxes(state1, state2, delta, mfluxes);
143 return 0;
144 } catch (...) {
145 return handleAllExceptions(-1, ERR);
146 }
147 }
148
149 int32_t trans_del(int32_t handle)
150 {
151 // no-op
152 return 0;
153 }
154
156 {
157 // reserved CLib function: custom code
158 try {
159 // *************** begin custom code ***************
160 return TransportCabinet::size();
161 // **************** end custom code ****************
162 } catch (...) {
163 return handleAllExceptions(-1, ERR);
164 }
165 }
166
167 int32_t trans_parentHandle(int32_t handle)
168 {
169 // reserved CLib function: custom code
170 try {
171 // *************** begin custom code ***************
172 return TransportCabinet::parent(handle);
173 // **************** end custom code ****************
174 } catch (...) {
175 return handleAllExceptions(-1, ERR);
176 }
177 }
178
179} // extern "C"
Header file defining class TransportFactory (see TransportFactory)
CTTRANS - Generated CLib Cantera interface library.
int32_t trans_getMultiDiffCoeffs(int32_t handle, const int32_t ld, int32_t dLen, double *d)
Return the multicomponent diffusion coefficients [m²/s].
Definition cttrans.cpp:116
double trans_viscosity(int32_t handle)
Get the dynamic viscosity [Pa·s].
Definition cttrans.cpp:49
double trans_electricalConductivity(int32_t handle)
Get the electrical conductivity [siemens/m].
Definition cttrans.cpp:69
int32_t trans_transportModel(int32_t handle, int32_t bufLen, char *buf)
Identifies the model represented by this Transport object.
Definition cttrans.cpp:37
int32_t trans_getBinaryDiffCoeffs(int32_t handle, const int32_t ld, int32_t dLen, double *d)
Returns the matrix of binary diffusion coefficients [m²/s].
Definition cttrans.cpp:105
int32_t trans_getThermalDiffCoeffs(int32_t handle, int32_t dtLen, double *dt)
Return a vector of thermal diffusion coefficients [kg/m/s].
Definition cttrans.cpp:79
int32_t trans_getMassFluxes(int32_t handle, int32_t state1Len, const double *state1, int32_t state2Len, const double *state2, double delta, int32_t mfluxesLen, double *mfluxes)
Get the mass fluxes [kg/m²/s], given the thermodynamic state at two nearby points.
Definition cttrans.cpp:138
int32_t trans_getMixDiffCoeffs(int32_t handle, int32_t dLen, double *d)
Return a vector of mixture averaged diffusion coefficients [m²/s].
Definition cttrans.cpp:92
int32_t trans_del(int32_t handle)
Destructor; required by some APIs although object is managed by Solution.
Definition cttrans.cpp:149
int32_t trans_parentHandle(int32_t handle)
Return handle to parent of Transport object.
Definition cttrans.cpp:167
int32_t trans_getMolarFluxes(int32_t handle, int32_t state1Len, const double *state1, int32_t state2Len, const double *state2, const double delta, int32_t cfluxesLen, double *cfluxes)
Get the molar fluxes [kmol/m²/s], given the thermodynamic state at two nearby points.
Definition cttrans.cpp:127
double trans_thermalConductivity(int32_t handle)
Get the mixture thermal conductivity [W/m/K].
Definition cttrans.cpp:59
int32_t trans_cabinetSize()
Return size of Transport storage.
Definition cttrans.cpp:155
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.