36typedef Cabinet<Solution> SolutionCabinet;
37template<> SolutionCabinet* SolutionCabinet::s_storage = 0;
39typedef Cabinet<Interface> InterfaceCabinet;
40template<> InterfaceCabinet* InterfaceCabinet::s_storage;
42typedef Cabinet<Transport> TransportCabinet;
43template<> TransportCabinet* TransportCabinet::s_storage;
45typedef Cabinet<ThermoPhase> ThermoPhaseCabinet;
46template<> ThermoPhaseCabinet* ThermoPhaseCabinet::s_storage;
48typedef Cabinet<Kinetics> KineticsCabinet;
49template<> KineticsCabinet* KineticsCabinet::s_storage;
55 int32_t
sol_newSolution(
const char* infile,
const char* name,
const char* transport)
60 int id = SolutionCabinet::add(obj);
62 ThermoPhaseCabinet::add(obj->thermo(),
id);
64 if (obj->kinetics()) {
65 KineticsCabinet::add(obj->kinetics(),
id);
67 if (obj->transport()) {
68 TransportCabinet::add(obj->transport(),
id);
76 int32_t
sol_newInterface(
const char* infile,
const char* name, int32_t adjacentLen,
const int32_t* adjacent)
80 vector<shared_ptr<Solution>> adjacent_;
81 for (
int i = 0; i < adjacentLen; i++) {
82 adjacent_.push_back(SolutionCabinet::at(adjacent[i]));
85 int id = SolutionCabinet::add(obj);
87 ThermoPhaseCabinet::add(obj->thermo(),
id);
89 if (obj->kinetics()) {
90 KineticsCabinet::add(obj->kinetics(),
id);
102 auto obj = SolutionCabinet::at(handle);
104 if (obj->transport()) {
105 int index = TransportCabinet::index(*(obj->transport()), handle);
107 TransportCabinet::del(index);
110 if (obj->kinetics()) {
111 int index = KineticsCabinet::index(*(obj->kinetics()), handle);
113 KineticsCabinet::del(index);
117 int index = ThermoPhaseCabinet::index(*(obj->thermo()), handle);
119 ThermoPhaseCabinet::del(index);
122 SolutionCabinet::del(handle);
129 int32_t
sol_name(int32_t handle, int32_t bufLen,
char* buf)
133 string out = SolutionCabinet::at(handle)->name();
135 return int(out.size()) + 1;
145 SolutionCabinet::at(handle)->setName(name);
156 auto obj = SolutionCabinet::at(handle)->thermo();
157 return ThermoPhaseCabinet::index(*obj, handle);
167 auto obj = SolutionCabinet::at(handle)->kinetics();
168 return KineticsCabinet::index(*obj, handle);
178 auto obj = SolutionCabinet::at(handle)->transport();
179 return TransportCabinet::index(*obj, handle);
189 string out = SolutionCabinet::at(handle)->transportModel();
191 return int(out.size()) + 1;
201 auto obj = SolutionCabinet::at(handle);
202 if (obj->transport()) {
203 TransportCabinet::del(
204 TransportCabinet::index(*(obj->transport()), handle));
206 obj->setTransportModel(model);
207 return TransportCabinet::add(obj->transport(), handle);
217 return SolutionCabinet::at(handle)->nAdjacent();
227 if (i < 0 || i >= SolutionCabinet::at(handle)->nAdjacent()) {
228 throw IndexError(
"sol_adjacent",
"", i, SolutionCabinet::at(handle)->nAdjacent());
230 auto obj = SolutionCabinet::at(handle)->adjacent(i);
231 int id = SolutionCabinet::add(obj);
233 ThermoPhaseCabinet::add(obj->thermo(),
id);
235 if (obj->kinetics()) {
236 KineticsCabinet::add(obj->kinetics(),
id);
238 if (obj->transport()) {
239 TransportCabinet::add(obj->transport(),
id);
251 string out = SolutionCabinet::at(handle)->adjacentName(i);
253 return int(out.size()) + 1;
259 int32_t
sol_source(int32_t handle, int32_t bufLen,
char* buf)
263 string out = SolutionCabinet::at(handle)->source();
265 return int(out.size()) + 1;
276 return SolutionCabinet::size();
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...
Header file defining class TransportFactory (see TransportFactory)
An array index is out of range.
CTSOL - Generated CLib Cantera interface library.
int32_t sol_adjacent(int32_t handle, int32_t i)
Get the Solution object for an adjacent phase by index.
int32_t sol_newInterface(const char *infile, const char *name, int32_t adjacentLen, const int32_t *adjacent)
Create and initialize a new Interface from an input file.
int32_t sol_adjacentName(int32_t handle, int32_t i, int32_t bufLen, char *buf)
Get the name of an adjacent phase by index.
int32_t sol_newSolution(const char *infile, const char *name, const char *transport)
Create and initialize a new Solution manager from an input file.
int32_t sol_source(int32_t handle, int32_t bufLen, char *buf)
Retrieve source used for object creation; usually an input file name.
int32_t sol_del(int32_t handle)
Delete Solution object.
int32_t sol_transport(int32_t handle)
Accessor for the Transport pointer.
int32_t sol_thermo(int32_t handle)
Accessor for the ThermoPhase pointer.
int32_t sol_transportModel(int32_t handle, int32_t bufLen, char *buf)
Retrieve transport model name.
int32_t sol_cabinetSize()
Return size of Solution storage.
int32_t sol_nAdjacent(int32_t handle)
Get the number of adjacent phases.
int32_t sol_kinetics(int32_t handle)
Accessor for the Kinetics pointer.
int32_t sol_name(int32_t handle, int32_t bufLen, char *buf)
Return the name of this Solution object.
int32_t sol_setTransportModel(int32_t handle, const char *model)
Set the Transport object by name.
int32_t sol_setName(int32_t handle, const char *name)
Set the name of this Solution object.
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.
shared_ptr< Solution > newSolution(const string &infile, const string &name, const string &transport, const vector< shared_ptr< Solution > > &adjacent)
Create and initialize a new Solution manager from an input file.
shared_ptr< Interface > newInterface(const string &infile, const string &name, const vector< string > &adjacent)
Create and initialize a new Interface from an input file.
Namespace for the Cantera kernel.
T handleAllExceptions(T ctErrorCode, T otherErrorCode)
Exception handler used at language interface boundaries.
Contains declarations for string manipulation functions within Cantera.